decocms 4.82.13 → 4.82.15
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-B6AELEdc.js → AlertCircle-CeOq_QOa.js} +1 -1
- package/dist/client/assets/{AreaChart-fCNs67j_.js → AreaChart-DWLsJ9L_.js} +1 -1
- package/dist/client/assets/{ArrowUp-YK2fJPgi.js → ArrowUp-CCgnuK4p.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BKVLcZTe.js → ArrowUpRight-BUF92paN.js} +1 -1
- package/dist/client/assets/{CheckCircle-BfxYbuVE.js → CheckCircle-DU0E1kqe.js} +1 -1
- package/dist/client/assets/{ChevronDown-CQLSXgt3.js → ChevronDown-DA-FKtUl.js} +1 -1
- package/dist/client/assets/{ChevronRight-Fgy0rUS_.js → ChevronRight-CHBqaZbp.js} +1 -1
- package/dist/client/assets/ChevronUp-z2fewBpw.js +1 -0
- package/dist/client/assets/{Copy01-B0CQRE_5.js → Copy01-mdfV84Qi.js} +1 -1
- package/dist/client/assets/DotsVertical-CfEiDPnS.js +1 -0
- package/dist/client/assets/{Eye-CLtdCpUf.js → Eye-DwGaKloo.js} +1 -1
- package/dist/client/assets/{FilterLines-DeiGsRZY.js → FilterLines-DTtZUWPT.js} +1 -1
- package/dist/client/assets/{Globe01-B52VKYy7.js → Globe01-DjB8n-mo.js} +1 -1
- package/dist/client/assets/{Globe04-B0las6Jv.js → Globe04-DutdpBnz.js} +1 -1
- package/dist/client/assets/{HardDrive-CU-vvmKE.js → HardDrive-CGELqP5N.js} +1 -1
- package/dist/client/assets/{Image01-B-FQwXx8.js → Image01-BTSbKZvY.js} +1 -1
- package/dist/client/assets/{Key01-myvTSA8u.js → Key01-DkkbB1Yr.js} +1 -1
- package/dist/client/assets/{LayoutLeft-C0g0LezP.js → LayoutLeft-B1GHI-YD.js} +1 -1
- package/dist/client/assets/{LinkExternal01-d9EixhiS.js → LinkExternal01-DJ_9J6wi.js} +1 -1
- package/dist/client/assets/{Monitor01-BkDBzdlH.js → Monitor01-pmSL1YcM.js} +1 -1
- package/dist/client/assets/{Package-eNacrLmv.js → Package-CWS4_j2H.js} +1 -1
- package/dist/client/assets/{Palette-BiKqXWvc.js → Palette-DPL8s5xh.js} +1 -1
- package/dist/client/assets/{Play-CdkPhmTs.js → Play-DR0RovML.js} +1 -1
- package/dist/client/assets/{Plus-DWjKZ2wj.js → Plus-CztP4VvG.js} +1 -1
- package/dist/client/assets/{SearchLg-DBOWvxyl.js → SearchLg-BzyTJkaM.js} +1 -1
- package/dist/client/assets/{SearchMd-CKteZWzZ.js → SearchMd-D8besh0I.js} +1 -1
- package/dist/client/assets/{Settings02-CM0Uzs0U.js → Settings02-CuqicLOk.js} +1 -1
- package/dist/client/assets/{Shield01-aDvWVv5Z.js → Shield01-4kmCM8vo.js} +1 -1
- package/dist/client/assets/{Star01-B-8espqJ.js → Star01-DHUNj4ei.js} +1 -1
- package/dist/client/assets/{Stars01-DsfblQf3.js → Stars01-tn1arSwR.js} +1 -1
- package/dist/client/assets/{Stars02-DBH33Ez2.js → Stars02-Di59xUHt.js} +1 -1
- package/dist/client/assets/{Sun-MvOAGgKN.js → Sun-CC4UrAWz.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DUrn8gXV.js → SwitchHorizontal01-cKbBsGPr.js} +1 -1
- package/dist/client/assets/{Tool01-4pit7qOS.js → Tool01-DehbzRDq.js} +1 -1
- package/dist/client/assets/{Tool02-tJKj7JcW.js → Tool02-hbk9uCUP.js} +1 -1
- package/dist/client/assets/{Trash01-DEWgFvvg.js → Trash01-DtotiGOx.js} +1 -1
- package/dist/client/assets/TrendUp01-Bzv8tCE3.js +1 -0
- package/dist/client/assets/{Upload01-C8RP0Fvq.js → Upload01-mGXKgGjJ.js} +1 -1
- package/dist/client/assets/{User01-v0Bqr3nA.js → User01-CqaAq7aP.js} +1 -1
- package/dist/client/assets/{Users01-CPNZ7uMu.js → Users01-ZGhY-EtM.js} +1 -1
- package/dist/client/assets/{Users03-WVYBBENu.js → Users03-CJYVEqY6.js} +1 -1
- package/dist/client/assets/{X-Dm6kY_ek.js → X-C00VJyk9.js} +1 -1
- package/dist/client/assets/{XCircle-cwYbcP7y.js → XCircle-D5ueBEPv.js} +1 -1
- package/dist/client/assets/{XClose-DnNyN9T-.js → XClose-COXhcGxA.js} +1 -1
- package/dist/client/assets/{Zap-CNRURtEh.js → Zap-CyltBR5S.js} +1 -1
- package/dist/client/assets/{ZapSquare-Dj8pa8Fg.js → ZapSquare-DzvB1OVj.js} +1 -1
- package/dist/client/assets/{ZoomOut-_psBJlXD.js → ZoomOut-DnsiYOYE.js} +1 -1
- package/dist/client/assets/{access-gate-CPecvlS5.js → access-gate-DUg1OQzh.js} +1 -1
- package/dist/client/assets/{add-section-modal-CcLBxmBX.js → add-section-modal-BN8Y54kh.js} +1 -1
- package/dist/client/assets/agent-icon-DD1XuUZV.js +1 -0
- package/dist/client/assets/agents-list-CYVjTPcg.js +1 -0
- package/dist/client/assets/ai-providers-7J7oaSIJ.js +1 -0
- package/dist/client/assets/{alert-XkDwazoe.js → alert-BAS3TA95.js} +1 -1
- package/dist/client/assets/{alert-dialog-3VMQ65hF.js → alert-dialog-pZnlrqwf.js} +1 -1
- package/dist/client/assets/app-editor-Dv5aoi2Q.js +1 -0
- package/dist/client/assets/{auth-dSVlMQ86.js → auth-BH7x9puf.js} +1 -1
- package/dist/client/assets/{auth-catchall-BVp4zpOf.js → auth-catchall-4ljJEgz3.js} +1 -1
- package/dist/client/assets/{auth-entry-C48ylSC_.js → auth-entry-CKXeCVAg.js} +1 -1
- package/dist/client/assets/{auth-split-layout-dbrXw6Uq.js → auth-split-layout-CUJ9nkHR.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-BHT9Kp62.js → authenticate-and-persist-oauth-Cv50WZiI.js} +1 -1
- package/dist/client/assets/{automation-list-row-PkSpkeID.js → automation-list-row-k6YDoU1F.js} +1 -1
- package/dist/client/assets/automation-runs-CnJwo9o6.js +87 -0
- package/dist/client/assets/automations-Dgs0AdsJ.js +1 -0
- package/dist/client/assets/{autosend-D_-616qs.js → autosend-BndTn1RX.js} +1 -1
- package/dist/client/assets/{avatar-UXZ4R5Yb.js → avatar-BV7BW59M.js} +1 -1
- package/dist/client/assets/{badge-CfAmvo-h.js → badge-DdEWwdjD.js} +1 -1
- package/dist/client/assets/{block-document-DbCz5f9N.js → block-document-DPR5iaEz.js} +2 -2
- package/dist/client/assets/{brand-context-G_6bLd5F.js → brand-context-D-BeYI94.js} +1 -1
- package/dist/client/assets/buckets-BmvZUYuX.js +1 -0
- package/dist/client/assets/bulk-category-panel-DWzVkVjS.js +1 -0
- package/dist/client/assets/calendar-BQIrOmm1.js +102 -0
- package/dist/client/assets/{capability-load-error-B9xkkNBq.js → capability-load-error-CBWml6hq.js} +1 -1
- package/dist/client/assets/{card-dLLzWD0r.js → card-f5iCgnuC.js} +1 -1
- package/dist/client/assets/category-editor-B9oFmSoe.js +1 -0
- package/dist/client/assets/{chat-context-CyCuyn4t.js → chat-context-BzTO5WN0.js} +13 -11
- package/dist/client/assets/checkbox-CxcJOsaQ.js +1 -0
- package/dist/client/assets/{cli-auth-success-zoB4TWhQ.js → cli-auth-success-BS60fauw.js} +1 -1
- package/dist/client/assets/collection-detail-CMxoDay1.js +1 -0
- package/dist/client/assets/collection-display-button-DlylAXm4.js +1 -0
- package/dist/client/assets/{collection-search-C4jDpdZf.js → collection-search-DLZgCv04.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DIkftYUF.js → collection-table-wrapper-DNDfhvJo.js} +1 -1
- package/dist/client/assets/{collection-tabs-DvvibY6H.js → collection-tabs-DZpZSybV.js} +1 -1
- package/dist/client/assets/{command-EQNrbniG.js → command-tBDIrLoF.js} +1 -1
- package/dist/client/assets/commerce-onboarding-BSUs1HKX.js +1 -0
- package/dist/client/assets/{companions-core-fc2Z_sCB.js → companions-core-Cd0liGC_.js} +1 -1
- package/dist/client/assets/connect-desktop-dialog-BYBMu3N5.js +1 -0
- package/dist/client/assets/{connection-card-CtY9PRIw.js → connection-card-B9qVUyx7.js} +1 -1
- package/dist/client/assets/connection-detail-Kd3nzbnA.js +1 -0
- package/dist/client/assets/{connection-form-helpers-TGmycj7X.js → connection-form-helpers-DKt4iErs.js} +1 -1
- package/dist/client/assets/connections-BeoxUP3C.js +1 -0
- package/dist/client/assets/{decopilot-sse-pool-DHojW3EC.js → decopilot-sse-pool-C6iebzwQ.js} +1 -1
- package/dist/client/assets/{dialog-CmXDzme5.js → dialog-BJfLYuit.js} +1 -1
- package/dist/client/assets/{domain-settings-GxKzcerZ.js → domain-settings-CfHBsp-L.js} +1 -1
- package/dist/client/assets/{drawer-Ds-r7525.js → drawer-Baw0xzc3.js} +1 -1
- package/dist/client/assets/dropdown-menu-BhfnlfU6.js +1 -0
- package/dist/client/assets/{empty-state-CdKwtMyP.js → empty-state-BYiNNxsG.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CK9iLAoG.js → extract-connection-data-J1VuF4OH.js} +1 -1
- package/dist/client/assets/file-explorer-CcD0ikH9.js +2 -0
- package/dist/client/assets/{file-type-icon-DjNFZnTs.js → file-type-icon-zRxoda45.js} +1 -1
- package/dist/client/assets/{files-CQYyuV1E.js → files-DD6Mi8Wg.js} +1 -1
- package/dist/client/assets/{form-x0k-kdB2.js → form-M4hxtBov.js} +1 -1
- package/dist/client/assets/general-CVTq53WI.js +1 -0
- package/dist/client/assets/{github-repo-picker-C-tZ-Bba.js → github-repo-picker-C1xhTE3Y.js} +1 -1
- package/dist/client/assets/{hooks-QHrmNjJQ.js → hooks-NPNZyDPQ.js} +6 -6
- package/dist/client/assets/{index-BjO8A-VO.js → index-4drSQZJw.js} +1 -1
- package/dist/client/assets/{index-BCiDnhhX.js → index-B8DLJIRD.js} +4 -4
- package/dist/client/assets/{index-CeqD0RVV.js → index-BAlJ2Lmy.js} +1 -1
- package/dist/client/assets/{index-Czi2ZhJ5.js → index-BF2PvN6y.js} +1 -1
- package/dist/client/assets/index-C0aFdpR9.js +2 -0
- package/dist/client/assets/{index-BcWQMJI4.js → index-CCfHA78w.js} +3 -3
- package/dist/client/assets/{index-CUVgjm02.js → index-CLMqgJD5.js} +1 -1
- package/dist/client/assets/{index-CzMEWsZX.js → index-CdQfFNYL.js} +1 -1
- package/dist/client/assets/{index-T-oY3h3t.js → index-CkWlYouF.js} +1 -1
- package/dist/client/assets/{index-DonY639O.js → index-Cl-Je6HH.js} +29 -29
- package/dist/client/assets/{index-C-B6S6Q9.js → index-ClUkG6N9.js} +1 -1
- package/dist/client/assets/index-DAYNblke.js +1 -0
- package/dist/client/assets/{index-DF3zg-P1.js → index-DIPAEwLP.js} +3 -3
- package/dist/client/assets/index-Dj5WILcq.css +1 -0
- package/dist/client/assets/{index-cG8paP3z.js → index-Dt28nlD4.js} +1 -1
- package/dist/client/assets/{index-redirect-_hpy7g8S.js → index-redirect-CmI0ALY4.js} +1 -1
- package/dist/client/assets/{input-BZTiU0ds.js → input-CfHOale8.js} +1 -1
- package/dist/client/assets/{integration-icon-BfKWLZT4.js → integration-icon-BzIpy5hd.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-fPpySKy7.js → invite-member-dialog-Bi9Ad5RM.js} +1 -1
- package/dist/client/assets/{label-B1OfKy2N.js → label-q4Lz_o7x.js} +1 -1
- package/dist/client/assets/{layout-BzlkAZij.js → layout-BeXU4geV.js} +1 -1
- package/dist/client/assets/{login-CfYNPvDo.js → login-ULhcI_8j.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CoKzxQiz.js → mcp-oauth-BD7eUVto.js} +1 -1
- package/dist/client/assets/members-CbH0lki7.js +1 -0
- package/dist/client/assets/{monaco-editor-BzdwB2U8.js → monaco-editor-C4mpNtzY.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C0-lT8X-.js → monitoring-stats-row-CZzkQYId.js} +1 -1
- package/dist/client/assets/{multi-select-BYFsBcLx.js → multi-select-DCA9Da7k.js} +1 -1
- package/dist/client/assets/{oauth-callback-D6L6RroV.js → oauth-callback-Dan_MKSA.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-NS24Yhk_.js → oauth-callback-ai-provider-B1ZRW88t.js} +1 -1
- package/dist/client/assets/{onboarding-CXfWXP3L.js → onboarding-BO_9ySh0.js} +1 -1
- package/dist/client/assets/{org-install-CFASOU4_.js → org-install-CpFIEnER.js} +1 -1
- package/dist/client/assets/{org-layout-gngtZKVa.js → org-layout-CULBOosB.js} +1 -1
- package/dist/client/assets/{organization-choice-DB-AR__E.js → organization-choice-DFVSxnej.js} +1 -1
- package/dist/client/assets/orgs-CBXFrHFa.js +1 -0
- package/dist/client/assets/{page-seo-form-DsaBxdUW.js → page-seo-form-DHenYYCe.js} +1 -1
- package/dist/client/assets/page-seo-sheet-ClW_iDoO.js +1 -0
- package/dist/client/assets/{popover-BzHpXFL_.js → popover-CXcO7_bx.js} +1 -1
- package/dist/client/assets/post-editor-DhFxw021.js +1 -0
- package/dist/client/assets/{primitives-BxBoeZTE.js → primitives-BmJhmJIK.js} +1 -1
- package/dist/client/assets/profile-NhoDC18k.js +1 -0
- package/dist/client/assets/project-app-view-utsK6OxP.js +1 -0
- package/dist/client/assets/record-editor-CecDBJXr.js +1 -0
- package/dist/client/assets/redirect-editor-dV0nhSya.js +1 -0
- package/dist/client/assets/registry-CT54Qzvf.js +2 -0
- package/dist/client/assets/{registry-layout-B8iHO94t.js → registry-layout-BWFRgJfZ.js} +2 -2
- package/dist/client/assets/{reports-DFt5o5JU.js → reports-B3SZ3Jl3.js} +2 -2
- package/dist/client/assets/{require-capability-CEBGt_Ot.js → require-capability-CNquWgoq.js} +1 -1
- package/dist/client/assets/{required-auth-layout-vPZ2d-Yx.js → required-auth-layout-DXZH_cMh.js} +1 -1
- package/dist/client/assets/{reset-password-l6ffdCqx.js → reset-password-CeKxEPEA.js} +1 -1
- package/dist/client/assets/roles-Ds1s8Crb.js +1 -0
- package/dist/client/assets/{search-input-ByuB0YyC.js → search-input-BBqHwy7J.js} +1 -1
- package/dist/client/assets/secrets-BJLITdOe.js +1 -0
- package/dist/client/assets/sections-editor-x_JJ-dXm.js +2 -0
- package/dist/client/assets/select-D45GDan5.js +1 -0
- package/dist/client/assets/{select-model-CebmAt-C.js → select-model-BdqTIzoZ.js} +1 -1
- package/dist/client/assets/self-tool-result-DveXGlAh.js +1 -0
- package/dist/client/assets/seo-editor-D_gFq0_r.js +1 -0
- package/dist/client/assets/{settings-layout-DUpflFya.js → settings-layout-CHmblNlb.js} +1 -1
- package/dist/client/assets/{settings-section-DS6otYn7.js → settings-section-amOjmhEI.js} +1 -1
- package/dist/client/assets/{shell-controls-B9xMPAfw.js → shell-controls-CgCFroeq.js} +1 -1
- package/dist/client/assets/{shell-layout-Bo6QxW8m.js → shell-layout-CdiwNTyI.js} +1 -1
- package/dist/client/assets/{sidebar-BFdShy9x.js → sidebar-C7aQbJG9.js} +1 -1
- package/dist/client/assets/{skeleton-BGZh750P.js → skeleton-Dxm-lG43.js} +1 -1
- package/dist/client/assets/sso-DJnUWhf6.js +1 -0
- package/dist/client/assets/{store-ioH_J-rE.js → store-NquDFej1.js} +1 -1
- package/dist/client/assets/store-registry-DUeHm7WT.js +2 -0
- package/dist/client/assets/{studio-tools-bThaob6p.js → studio-tools-CYfQ2AAQ.js} +1 -1
- package/dist/client/assets/{switch-C2KH_TaK.js → switch-CdTxZDmU.js} +1 -1
- package/dist/client/assets/{table-XKbQ5Wjx.js → table-0RqXTFkI.js} +1 -1
- package/dist/client/assets/{tabs-D-6eQ0wE.js → tabs-7Gp9khG9.js} +1 -1
- package/dist/client/assets/{textarea-PYu4eHQV.js → textarea-DqwqE7DK.js} +1 -1
- package/dist/client/assets/{toggle-group-BcxqPGrf.js → toggle-group-aSRsQY-d.js} +1 -1
- package/dist/client/assets/{toolbar-D90MFc80.js → toolbar-BWl3LL6D.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-D3m9VnTI.js → toolbar-icon-button-DCIRoG12.js} +1 -1
- package/dist/client/assets/{tooltip-O3iHy7-o.js → tooltip-WJkhQjcG.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B4nhSJlr.js → use-ai-providers-C40YpJE-.js} +1 -1
- package/dist/client/assets/{use-automations-C01orYPa.js → use-automations-C9d02WY2.js} +1 -1
- package/dist/client/assets/{use-autosave-BhfvFfoI.js → use-autosave-C9WyysaS.js} +1 -1
- package/dist/client/assets/{use-capability--WeMT0KP.js → use-capability-CFtUu9S6.js} +1 -1
- package/dist/client/assets/use-clock-tick-BEOof-IF.js +1 -0
- package/dist/client/assets/{use-collections-K1HyCAfG.js → use-collections-zWVyDZcY.js} +1 -1
- package/dist/client/assets/{use-connection-twfWXxwG.js → use-connection-zVMbceFt.js} +1 -1
- package/dist/client/assets/{use-copy-DQ4y4418.js → use-copy-aL4eG47e.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-NwJ9x5Kd.js → use-create-virtual-mcp-CC9xkgX7.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BdWGMbok.js → use-debounced-autosave-fAbS1zOg.js} +1 -1
- package/dist/client/assets/{use-debounced-value-xN0eyoO9.js → use-debounced-value-DNsl2JfP.js} +1 -1
- package/dist/client/assets/use-deco-credits-CcPnJVuR.js +1 -0
- package/dist/client/assets/{use-decopilot-events-BEOY-_n2.js → use-decopilot-events-CsMJmVbs.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BlzYSB_f.js → use-delete-connection-R5JvHOU0.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-DYO-CLsy.js → use-deployment-admin-C6_xz3oM.js} +1 -1
- package/dist/client/assets/{use-file-configs-Bs9N4w-Z.js → use-file-configs-DKMcr7Ka.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Dt7gLdpr.js → use-infinite-scroll-BfgefGd-.js} +1 -1
- package/dist/client/assets/{use-join-requests-D0z99IAk.js → use-join-requests-DwZmJTC-.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-C7G9bAkb.js → use-mcp-auth-status-DqdsBw6O.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DrROXOcH.js → use-mcp-client-jqf5Iy9F.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-D28ox9dJ.js → use-mcp-tools-FlPegk9r.js} +1 -1
- package/dist/client/assets/{use-members-mvfsRjey.js → use-members-4b0HekAB.js} +1 -1
- package/dist/client/assets/{use-mobile-nauPjzo2.js → use-mobile-Dzfwh2PG.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BJC_x779.js → use-navigate-to-agent-BdTIm_yX.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-jU0nDPT-.js → use-org-auth-client-DNidmaGB.js} +1 -1
- package/dist/client/assets/{use-org-sso-j8hZyqdO.js → use-org-sso-XSU8Sbkk.js} +1 -1
- package/dist/client/assets/{use-organization-roles-thqey2Pm.js → use-organization-roles-DO-lRy6_.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BJ1bjHsL.js → use-organization-settings-B5oAjTeU.js} +1 -1
- package/dist/client/assets/{use-registry-app-CeyrXTI4.js → use-registry-app-C86I4fwX.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D94L7VqK.js → use-registry-connections-C5ZlG8AQ.js} +1 -1
- package/dist/client/assets/{use-secrets-C1Fme0Ya.js → use-secrets-CwCibfpX.js} +1 -1
- package/dist/client/assets/{use-status-sounds-B1YKt2sD.js → use-status-sounds-B3WHalkp.js} +1 -1
- package/dist/client/assets/{use-view-mode-gP4n4GFH.js → use-view-mode-CQEpkEmN.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-C964oRwj.js → use-virtual-mcp-rI-Jb4Ga.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-6TwOL6Xo.js +1 -0
- package/dist/client/assets/{useRouterState-Bi7YKwTw.js → useRouterState-zOoyC2QF.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-COj06tw2.js +1 -0
- package/dist/client/assets/{users-BiDYlXA2.js → users-C2DJRY0B.js} +1 -1
- package/dist/client/assets/variant-calendar-BTK0fdXF.js +1 -0
- package/dist/client/assets/{view-mode-toggle-kFlOpvCC.js → view-mode-toggle-CQPkkcdM.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/Check-BF3t7WWi.js +0 -1
- package/dist/client/assets/ChevronUp-Y-IpPAUR.js +0 -1
- package/dist/client/assets/Circle-0HId1SV6.js +0 -1
- package/dist/client/assets/DotsVertical-CYU3Mae1.js +0 -1
- package/dist/client/assets/Flag01-B_AKNFoc.js +0 -1
- package/dist/client/assets/List-DZAsltZv.js +0 -1
- package/dist/client/assets/TrendUp01-7N_6K3-X.js +0 -1
- package/dist/client/assets/UserPlus01-D2pAl0t2.js +0 -1
- package/dist/client/assets/agent-icon-DmIJ53uv.js +0 -1
- package/dist/client/assets/agents-list-GFWV8fSw.js +0 -1
- package/dist/client/assets/ai-providers-C93Uux8H.js +0 -1
- package/dist/client/assets/app-editor-GnwEYs2F.js +0 -1
- package/dist/client/assets/automation-runs-yMzfgCqo.js +0 -188
- package/dist/client/assets/automations-Db9v_2wu.js +0 -1
- package/dist/client/assets/buckets-Bkz3itxJ.js +0 -1
- package/dist/client/assets/bulk-category-panel-EjjgUKdU.js +0 -1
- package/dist/client/assets/calendar-BdMqQsTv.js +0 -1
- package/dist/client/assets/category-editor-l1ImzDA-.js +0 -1
- package/dist/client/assets/checkbox-CxV2vfbv.js +0 -1
- package/dist/client/assets/collection-detail-ByPPxvaR.js +0 -1
- package/dist/client/assets/collection-display-button-BBHublq2.js +0 -1
- package/dist/client/assets/commerce-onboarding-Dgs4FWfH.js +0 -1
- package/dist/client/assets/connect-desktop-dialog-CPSwwSyz.js +0 -1
- package/dist/client/assets/connection-detail-DuvF3pbE.js +0 -1
- package/dist/client/assets/connections-CE66Octw.js +0 -1
- package/dist/client/assets/dropdown-menu-BgNr7tM1.js +0 -1
- package/dist/client/assets/file-explorer-nG37TAVQ.js +0 -2
- package/dist/client/assets/general-c3hgsq_x.js +0 -1
- package/dist/client/assets/index-DKadkG06.js +0 -4
- package/dist/client/assets/index-DpLPq5a_.css +0 -1
- package/dist/client/assets/index-bj26_8KX.js +0 -1
- package/dist/client/assets/members-CrKGCoFu.js +0 -1
- package/dist/client/assets/orgs-jcqywdGM.js +0 -1
- package/dist/client/assets/page-seo-sheet-BF2mpJ0B.js +0 -1
- package/dist/client/assets/post-editor-JD3fSSO7.js +0 -1
- package/dist/client/assets/profile-CZ9vM3_S.js +0 -1
- package/dist/client/assets/project-app-view-40EQ9ogm.js +0 -1
- package/dist/client/assets/record-editor-BmGDR-eB.js +0 -1
- package/dist/client/assets/redirect-editor-0M8-Neu7.js +0 -1
- package/dist/client/assets/registry-CwTOcwuV.js +0 -2
- package/dist/client/assets/roles-Bo-eSbrf.js +0 -1
- package/dist/client/assets/secrets-C_1Jcs02.js +0 -1
- package/dist/client/assets/sections-editor-gaZ0BvyI.js +0 -2
- package/dist/client/assets/select-B6GE4jHJ.js +0 -1
- package/dist/client/assets/self-tool-result-DJIiUu6Z.js +0 -1
- package/dist/client/assets/seo-editor-DNUmLmzw.js +0 -1
- package/dist/client/assets/sso-D7EYt-G3.js +0 -1
- package/dist/client/assets/store-registry-s8bkhEBH.js +0 -2
- package/dist/client/assets/use-clock-tick-DboEo7Cc.js +0 -1
- package/dist/client/assets/use-deco-credits-Bm-VH5Hm.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DKhJHTs2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DAAXTkZt.js +0 -1
- package/dist/client/assets/variant-calendar-m6XjJ2dx.js +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import{r as O,bN as cs,bO as zl,j as b,at as Ll,aM as lt,bP as jl,c as us,l as et,bQ as Bi}from"./index-DIPAEwLP.js";import{w as Vl}from"./agent-icon-DD1XuUZV.js";import{i as Wl}from"./ChevronRight-CHBqaZbp.js";function $l(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function nb(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 rb(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 Y(n){this.content=n}Y.prototype={constructor:Y,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,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Y(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Y(t)},addToStart:function(n,e){return new Y([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Y(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Y(i)},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=Y.from(n),n.size?new Y(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Y.from(n),n.size?new Y(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Y.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}};Y.from=function(n){if(n instanceof Y)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Y(e)};function ds(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=ds(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function fs(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){t-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let c=fs(s.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class v{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,i=0,o){for(let s=0,a=0;a<t;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new v(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),i+=a.nodeSize),s=l}return new v(r,i)}cutByIndex(e,t){return e==t?v.empty:e==0&&t==this.content.length?this:new v(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new v(i,o)}addToStart(e){return new v([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new v(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return ds(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return fs(this,e,t,r)}findIndex(e){if(e==0)return fn(0,e);if(e==this.size)return fn(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 i=this.child(t),o=r+i.nodeSize;if(o>=e)return o==e?fn(t+1,o):fn(t,r);r=o}}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 v.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return v.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new v(t||e,r)}static from(e){if(!e)return v.empty;if(e instanceof v)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new v([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const rr={index:0,offset:0};function fn(n,e){return rr.index=n,rr.offset=e,rr}function Mn(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(!Mn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Mn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let j=class Er{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}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&&Mn(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 i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 Er.none;if(e instanceof Er)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};j.none=[];class Cn extends Error{}class S{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=ps(this.content,e+this.openStart,t);return r&&new S(r,this.openStart,this.openEnd)}removeBetween(e,t){return new S(hs(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 S.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(v.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new S(e,r,i)}}S.empty=new S(v.empty,0,0);function hs(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(i==e||o.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(hs(o.content,e-i-1,t-i-1)))}function ps(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=ps(s.content,e-o-1,t,s);return a&&n.replaceChild(i,s.copy(a))}function ql(n,e,t){if(t.openStart>n.depth)throw new Cn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Cn("Inconsistent open depths");return ms(n,e,t,0)}function ms(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=ms(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return ot(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=Hl(t,n);return ot(o,ys(n,s,a,e,r))}else return ot(o,Nn(n,e,r))}function gs(n,e){if(!e.type.compatibleContent(n.type))throw new Cn("Cannot join "+e.type.name+" onto "+n.type.name)}function Tr(n,e,t){let r=n.node(t);return gs(r,e.node(t)),r}function it(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 Wt(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(it(n.nodeAfter,r),o++));for(let a=o;a<s;a++)it(i.child(a),r);e&&e.depth==t&&e.textOffset&&it(e.nodeBefore,r)}function ot(n,e){return n.type.checkContent(e),n.copy(e)}function ys(n,e,t,r,i){let o=n.depth>i&&Tr(n,e,i+1),s=r.depth>i&&Tr(t,r,i+1),a=[];return Wt(null,n,i,a),o&&s&&e.index(i)==t.index(i)?(gs(o,s),it(ot(o,ys(n,e,t,r,i+1)),a)):(o&&it(ot(o,Nn(n,e,i+1)),a),Wt(e,t,i,a),s&&it(ot(s,Nn(t,r,i+1)),a)),Wt(r,null,i,a),new v(a)}function Nn(n,e,t){let r=[];if(Wt(null,n,t,r),n.depth>t){let i=Tr(n,e,t+1);it(ot(i,Nn(n,e,t+1)),r)}return Wt(e,null,t,r),new v(r)}function Hl(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(v.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Yt{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],i=e.child(t);return r?e.child(t).cut(r):i}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],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return j.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 Dn(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=[],i=0,o=t;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new Yt(t,r,o)}static resolveCached(e,t){let r=Fi.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else Fi.set(e,r=new Jl);let i=r.elts[r.i]=Yt.resolve(e,t);return r.i=(r.i+1)%Yl,i}}class Jl{constructor(){this.elts=[],this.i=0}}const Yl=12,Fi=new WeakMap;class Dn{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 Ul=Object.create(null);class ye{constructor(e,t,r,i=j.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||v.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,i=0){this.content.nodesBetween(e,t,r,i,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,i){return this.content.textBetween(e,t,r,i)}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&&Mn(this.attrs,t||e.defaultAttrs||Ul)&&j.sameSet(this.marks,r||j.none)}copy(e=null){return e==this.content?this:new ye(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ye(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 S.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new S(c,i.depth-s,o.depth-s)}replace(e,t,r){return ql(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Yt.resolveCached(this,e)}resolveNoCache(e){return Yt.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),bs(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=v.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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=j.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(!j.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 i=v.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}ye.prototype.text=void 0;class En extends ye{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bs(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 En(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new En(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 bs(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ct{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Kl(e,t);if(r.next==null)return ct.empty;let i=xs(r);r.next&&r.err("Unexpected trailing text");let o=nc(tc(i));return rc(o,r),o}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 i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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 i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!t||l.validEnd))return v.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(u));if(h)return h}}return null}return o(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 i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
2
|
+
`)}}ct.empty=new ct(!0);class Kl{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 xs(n){let e=[];do e.push(Gl(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gl(n){let e=[];do e.push(Xl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Xl(n){let e=ec(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=Ql(n,e);else break;return e}function zi(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Ql(n,e){let t=zi(n),r=t;return n.eat(",")&&(n.next!="}"?r=zi(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Zl(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function ec(n){if(n.eat("(")){let e=xs(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=Zl(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 tc(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=t())}else if(s.type=="star"){let l=t();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=t();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,l),u),l=u}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=t();r(l,u),i(o(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function vs(n,e){return e-n}function Li(n,e){let t=[];return r(e),t.sort(vs);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&t.indexOf(l)==-1&&r(l)}}}function nc(n){let e=Object.create(null);return t(Li(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Li(n,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new ct(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(vs);o.next.push({type:i[s][0],next:e[a.join(",")]||t(a)})}return o}}function rc(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ks(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 ws(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Ss(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Ms(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new oc(n,r,e[r]);return t}let ji=class Cs{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=Ms(e,r.attrs),this.defaultAttrs=ks(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==ct.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:ws(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ye(this,this.computeAttrs(e),v.from(t),j.setFrom(r))}createChecked(e=null,t,r){return t=v.from(t),this.checkContent(t),new ye(this,this.computeAttrs(e),t,j.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=v.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(v.empty,!0);return o?new ye(this,e,t.append(o),j.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){Ss(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:j.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Cs(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ic(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class oc{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ic(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jn{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ms(e,i.attrs),this.excluded=null;let o=ks(this.attrs);this.instance=o?new j(this,o):null}create(e=null){return!e&&this.instance?this.instance:new j(this,ws(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new jn(o,i++,t,s)),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){Ss(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ns{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Y.from(e.nodes),t.marks=Y.from(e.marks||{}),this.nodes=ji.compile(this.spec.nodes,this),this.marks=jn.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=ct.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Vi(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Vi(this,s.split(" "))}this.nodeFromJSON=i=>ye.fromJSON(this,i),this.markFromJSON=i=>j.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ji){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,i)}text(e,t){let r=this.nodes.text;return new En(r,r.defaultAttrs,e,j.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 Vi(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function sc(n){return n.tag!=null}function ac(n){return n.style!=null}class $e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(sc(i))this.tags.push(i);else if(ac(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new $i(this,t,!1);return r.addAll(e,j.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new $i(this,t,!0);return r.addAll(e,j.none,t.from,t.to),S.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(uc(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let a=t[s];if((a.priority==null?50:a.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=qi(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=qi(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $e(e,$e.schemaRules(e)))}}const Ds={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},lc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Es={ol:!0,ul:!0},Ut=1,Or=2,$t=4;function Wi(n,e,t){return e!=null?(e?Ut:0)|(e==="full"?Or:0):n&&n.whitespace=="pre"?Ut|Or:t&~$t}class hn{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=j.none,this.match=o||(s&$t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(v.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ut)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=v.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(v.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&&!Ds.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class $i{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=Wi(null,t.preserveWhitespace,0)|(r?$t:0);i?o=new hn(i.type,i.attrs,j.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new hn(null,null,j.none,!0,null,s):o=new hn(e.schema.topNodeType,null,j.none,!0,null,s),this.nodes=[o],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,i=this.top,o=i.options&Or?"full":this.localPreserveWS||(i.options&Ut)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(s.text(a[l]),t,!/\S/.test(a[l]));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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Es.hasOwnProperty(s)&&this.parser.normalizeLists&&cc(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:lc.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Ds.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
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 i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,t.attrs||null,r,t.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=j.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):Hi(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Wi(e,o,s.options);s.options&$t&&s.content.length==0&&(a|=$t);let l=j.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Hi(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new hn(e,t,l,i,null,a)),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|=Ut)}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(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 cc(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Es.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function uc(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function qi(n){let e={};for(let t in n)e[t]=n[t];return e}function Hi(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class pt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ir(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=vn(ir(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&vn(ir(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return vn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ji(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ji(e.marks)}}function Ji(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ir(n){return n.document||window.document}const Yi=new WeakMap;function dc(n){let e=Yi.get(n);return e===void 0&&Yi.set(n,e=fc(n)),e}function fc(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 i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function vn(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 i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=dc(r))&&o.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 s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),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 h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=vn(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Ts=65535,Os=Math.pow(2,16);function hc(n,e){return n+e*Os}function Ui(n){return n&Ts}function pc(n){return(n-(n&Ts))/Os}const As=1,Ps=2,kn=4,Rs=8;class Ar{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Rs)>0}get deletedBefore(){return(this.delInfo&(As|kn))>0}get deletedAfter(){return(this.delInfo&(Ps|kn))>0}get deletedAcross(){return(this.delInfo&kn)>0}}class ae{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ae.empty)return ae.empty}recover(e){let t=0,r=Ui(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+pc(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 i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],u=this.ranges[a+s],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:t:t,f=l+i+(h<0?0:u);if(r)return f;let p=e==(t<0?l:d)?null:hc(a/3,e-l),g=e==l?Ps:e==d?As:kn;return(t<0?e!=l:e!=d)&&(g|=Rs),new Ar(f,g,p)}i+=u-c}return r?e+i:new Ar(e+i,0,null)}touches(e,t){let r=0,i=Ui(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new ae(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ae.empty:new ae(e<0?[0,-e,0]:[0,0,e])}}ae.empty=new ae([]);class Tn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Tn(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 i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i: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 i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Tn;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 i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Ar(e,i,null)}}const or=Object.create(null);class Z{getMap(){return ae.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=or[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 or)throw new RangeError("Duplicate use of step JSON ID "+e);return or[e]=t,t.prototype.jsonID=e,t}}class ${constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new $(e,null)}static fail(e){return new $(null,e)}static fromReplace(e,t,r,i){try{return $.ok(e.replace(t,r,i))}catch(o){if(o instanceof Cn)return $.fail(o.message);throw o}}}function Kr(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Kr(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return v.fromArray(r)}class je extends Z{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),i=r.node(r.sharedDepth(this.to)),o=new S(Kr(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return $.fromReplace(e,this.from,this.to,o)}invert(){return new me(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 je(t.pos,r.pos,this.mark)}merge(e){return e instanceof je&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new je(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 je(t.from,t.to,e.markFromJSON(t.mark))}}Z.jsonID("addMark",je);class me extends Z{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 S(Kr(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return $.fromReplace(e,this.from,this.to,r)}invert(){return new je(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 me(t.pos,r.pos,this.mark)}merge(e){return e instanceof me&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new me(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 me(t.from,t.to,e.markFromJSON(t.mark))}}Z.jsonID("removeMark",me);class Ve extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return $.fromReplace(e,this.pos,this.pos+1,new S(v.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Ve(this.pos,t.marks[i]);return new Ve(this.pos,this.mark)}}return new ut(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ve(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 Ve(t.pos,e.markFromJSON(t.mark))}}Z.jsonID("addNodeMark",Ve);class ut extends Z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return $.fromReplace(e,this.pos,this.pos+1,new S(v.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ve(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ut(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 ut(t.pos,e.markFromJSON(t.mark))}}Z.jsonID("removeNodeMark",ut);class W extends Z{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Pr(e,this.from,this.to)?$.fail("Structure replace would overwrite content"):$.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ae([this.from,this.to-this.from,this.slice.size])}invert(e){return new W(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&&W.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new W(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof W)||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?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new W(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?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new W(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 W(t.from,t.to,S.fromJSON(e,t.slice),!!t.structure)}}W.MAP_BIAS=1;Z.jsonID("replace",W);class H extends Z{constructor(e,t,r,i,o,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Pr(e,this.from,this.gapFrom)||Pr(e,this.gapTo,this.to)))return $.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return $.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?$.fromReplace(e,this.from,this.to,r):$.fail("Content does not fit in gap")}getMap(){return new ae([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 H(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new H(t.pos,r.pos,i,o,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 H(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}}Z.jsonID("replaceAround",H);function Pr(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function mc(n,e,t,r){let i=[],o=[],s,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==h&&s.mark.eq(d[g])?s.to=f:i.push(s=new me(h,f,d[g])));a&&a.to==h?a.to=f:o.push(a=new je(h,f,r))}}),i.forEach(l=>n.step(l)),o.forEach(l=>n.step(l))}function gc(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof jn){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==o-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=o):i.push({style:d,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>n.step(new me(s.from,s.to,s.style)))}function Gr(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new W(a,u,S.empty));else{r=d;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new me(a,u,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new S(v.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new W(a+h.index,a+h.index+h[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(v.empty,!0);n.replace(a,a,new S(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function yc(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Pt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,o=0;;--r){let s=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-o;if(r<n.depth&&s.canReplace(a,l,t))return r;if(r==0||s.type.spec.isolating||!yc(s,a,l))break;a&&(i=1),l<s.childCount&&(o=1)}return null}function bc(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,u=v.empty,d=0;for(let p=o,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=v.from(r.node(p).copy(u)),d++):l--;let h=v.empty,f=0;for(let p=o,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=v.from(i.node(p).copy(h)),f++):c++;n.step(new H(l,c,s,a,new S(u.append(h),d,f),u.size-d,!0))}function Xr(n,e,t=null,r=n){let i=xc(n,e),o=i&&vc(r,e);return o?i.map(Ki).concat({type:e,attrs:t}).concat(o.map(Ki)):null}function Ki(n){return{type:n,attrs:null}}function xc(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function vc(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:s}function kc(n,e,t){let r=v.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=v.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new H(i,o,i,o,new S(r,0,0),t.length,!0))}function wc(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Sc(n.doc,n.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&_s(n,s,a,o),Gr(n,n.mapping.slice(o).map(a,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(a,1),h=u.map(a+s.nodeSize,1);return n.step(new H(d,h,d+1,h-1,new S(v.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Is(n,s,a,o),!1}})}function Is(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function _s(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function Sc(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Mc(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new H(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new S(v.from(s),0,0),1,!0))}function Pe(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(f))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Cc(n,e,t=1,r){let i=n.doc.resolve(e),o=v.empty,s=v.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){o=v.from(i.node(a).copy(o));let u=r&&r[c];s=v.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}n.step(new W(e,e,new S(o.append(s),t,t),!0))}function Ue(n,e){let t=n.resolve(e),r=t.index();return Bs(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Nc(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function Bs(n,e){return!!(n&&e&&!n.isLeaf&&Nc(n,e))}function Vn(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Bs(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Dc(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);_s(n,u.node(),u.before(),a)}s.inlineContent&&Gr(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new W(c,l.map(e+t,-1),S.empty,!0)),r===!0){let u=n.doc.resolve(c);Is(n,u.node(),u.before(),n.steps.length)}return n}function Ec(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Tc(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Wn(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Fs(i,o,r)?new W(e,t,r):new Oc(i,o,r).fit()}function Fs(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Oc{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=v.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=v.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new S(o,s,a);return e>-1?new H(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new W(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=sr(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(v.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=sr(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=sr(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new S(zt(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new S(zt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let g=a.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||l==0||g.content.size)&&(d=m,u.push(zs(g.mark(h.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=Lt(this.placed,t,v.from(u)),this.frontier[t].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g<f;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?S.empty:new S(zt(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new S(zt(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ar(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=ar(e,t,i,r,o);if(s){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=ar(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Lt(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Lt(this.placed,this.depth,v.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(v.empty,!0);t.childCount&&(this.placed=Lt(this.placed,this.frontier.length,t))}}function zt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(zt(n.firstChild.content,e-1,t)))}function Lt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Lt(n.lastChild.content,e-1,t)))}function sr(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function zs(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,zs(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(v.empty,!0)))),n.copy(r)}function ar(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!Ac(t,o.content,s)?a:null}function Ac(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Pc(n){return n.spec.defining||n.spec.definingForContent}function Rc(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Fs(i,o,r))return n.step(new W(e,t,r));let s=js(i,o);s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==f&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=Pc(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let g=0;g<s.length;g++){let m=s[(g+l)%s.length],y=!0;m<0&&(y=!1,m=-m);let x=i.node(m-1),w=i.index(m-1);if(x.canReplaceWith(w,w,p.type,p.marks))return n.replace(i.before(m),y?o.after(m):t,new S(Ls(r.content,0,r.openStart,f),f,r.openEnd))}}let d=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let f=s[h];f<0||(e=i.before(f),t=o.after(f))}}function Ls(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Ls(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(v.empty,!0))}return n}function Ic(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Ec(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new S(v.from(r),0,0))}function _c(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let s=r.sharedDepth(t),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>s;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&t==i.start(l);l--)t=i.before(l);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let o=js(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function js(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Mt extends Z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return $.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return $.fromReplace(e,this.pos,this.pos+1,new S(v.from(i),0,t.isLeaf?0:1))}getMap(){return ae.empty}invert(e){return new Mt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mt(t.pos,t.attr,t.value)}}Z.jsonID("attr",Mt);class Kt extends Z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return $.ok(r)}getMap(){return ae.empty}invert(e){return new Kt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Kt(t.attr,t.value)}}Z.jsonID("docAttr",Kt);let Nt=class extends Error{};Nt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Nt.prototype=Object.create(Error.prototype);Nt.prototype.constructor=Nt;Nt.prototype.name="TransformError";class Vs{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Tn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Nt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((o,s,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=S.empty){let i=Wn(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new S(v.from(r),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Rc(this,e,t,r),this}replaceRangeWith(e,t,r){return Ic(this,e,t,r),this}deleteRange(e,t){return _c(this,e,t),this}lift(e,t){return bc(this,e,t),this}join(e,t=1){return Dc(this,e,t),this}wrap(e,t){return kc(this,e,t),this}setBlockType(e,t=e,r,i=null){return wc(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Mc(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Mt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Kt(e,t)),this}addNodeMark(e,t){return this.step(new Ve(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof j)t.isInSet(r.marks)&&this.step(new ut(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new ut(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,t=1,r){return Cc(this,e,t,r),this}addMark(e,t,r){return mc(this,e,t,r),this}removeMark(e,t,r){return gc(this,e,t,r),this}clearIncompatible(e,t,r){return Gr(this,e,t,r),this}}const lr=Object.create(null);class B{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Bc(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=S.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(c.pos),a?S.empty:t),a==0&&Qi(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Qi(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new I(e):kt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?kt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):kt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new le(e.node(0))}static atStart(e){return kt(e,e,0,0,1)||new le(e)}static atEnd(e){return kt(e,e,e.content.size,e.childCount,-1)||new le(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=lr[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in lr)throw new RangeError("Duplicate use of selection JSON ID "+e);return lr[e]=t,t.prototype.jsonID=e,t}getBookmark(){return I.between(this.$anchor,this.$head).getBookmark()}}B.prototype.visible=!0;class Bc{constructor(e,t){this.$from=e,this.$to=t}}let Gi=!1;function Xi(n){!Gi&&!n.parent.inlineContent&&(Gi=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class I extends B{constructor(e,t=e){Xi(e),Xi(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return B.near(r);let i=e.resolve(t.map(this.anchor));return new I(i.parent.inlineContent?i:r,r)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof I&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new $n(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new I(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=B.findFrom(t,r,!0)||B.findFrom(t,-r,!0);if(o)t=o.$head;else return B.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new I(e,t)}}B.jsonID("text",I);class $n{constructor(e,t){this.anchor=e,this.head=t}map(e){return new $n(e.map(this.anchor),e.map(this.head))}resolve(e){return I.between(e.resolve(this.anchor),e.resolve(this.head))}}class D extends B{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?B.near(o):new D(o)}content(){return new S(v.from(this.node),0,0)}eq(e){return e instanceof D&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Qr(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new D(e.resolve(t.anchor))}static create(e,t){return new D(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}D.prototype.visible=!1;B.jsonID("node",D);class Qr{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new $n(r,r):new Qr(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&D.isSelectable(r)?new D(t):B.near(t)}}class le extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=S.empty){if(t==S.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new le(e)}map(e){return new le(e)}eq(e){return e instanceof le}getBookmark(){return Fc}}B.jsonID("all",le);const Fc={map(){return this},resolve(n){return new le(n)}};function kt(n,e,t,r,i,o=!1){if(e.inlineContent)return I.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&D.isSelectable(a))return D.create(n,t-(i<0?a.nodeSize:0))}else{let l=kt(n,a,t+i,i<0?a.childCount:0,i,o);if(l)return l}t+=a.nodeSize*i}return null}function Qi(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof W||i instanceof H))return;let o=n.mapping.maps[r],s;o.forEach((a,l,c,u)=>{s==null&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}const Zi=1,pn=2,eo=4;class zc extends Vs{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Zi)&~pn,this.storedMarks=null,this}get selectionSet(){return(this.updated&Zi)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=pn,this}ensureMarks(e){return j.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&pn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~pn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||j.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=eo,this}get scrolledIntoView(){return(this.updated&eo)>0}}function to(n,e){return!e||!n?n:n.bind(e)}class jt{constructor(e,t,r){this.name=e,this.init=to(t.init,r),this.apply=to(t.apply,r)}}const Lc=[new jt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new jt("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new jt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new jt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class cr{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Lc.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new jt(r.key,r.spec.state,r))})}}class St{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new St(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new zc(this)}static create(e){let t=new cr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new St(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new cr(this.schema,e.plugins),r=t.fields,i=new St(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new cr(e.schema,e.plugins),o=new St(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=ye.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=B.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){o[s.name]=c.fromJSON.call(l,e,t[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Ws(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ws(i,e,{})),t[r]=i}return t}class ve{constructor(e){this.spec=e,this.props={},e.props&&Ws(e.props,this,this.props),this.key=e.key?e.key.key:$s("plugin")}getState(e){return e[this.key]}}const ur=Object.create(null);function $s(n){return n in ur?n+"$"+ ++ur[n]:(ur[n]=0,n+"$")}class Ke{constructor(e="key"){this.key=$s(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Zr=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function qs(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Hs=(n,e,t)=>{let r=qs(n,t);if(!r)return!1;let i=ei(r);if(!i){let s=r.blockRange(),a=s&&Pt(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(ea(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Dt(o,"end")||D.isSelectable(o)))for(let s=r.depth;;s--){let a=Wn(n.doc,r.before(s),r.after(s),S.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Dt(o,"end")?B.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):D.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},jc=(n,e,t)=>{let r=qs(n,t);if(!r)return!1;let i=ei(r);return i?Js(n,i,e):!1},Vc=(n,e,t)=>{let r=Us(n,t);if(!r)return!1;let i=ti(r);return i?Js(n,i,e):!1};function Js(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Wn(n.doc,o,l,S.empty);if(!c||c.from!=o||c instanceof W&&c.slice.size>=l-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(I.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Dt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Ys=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=ei(r)}let s=o&&o.nodeBefore;return!s||!D.isSelectable(s)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ei(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Us(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Ks=(n,e,t)=>{let r=Us(n,t);if(!r)return!1;let i=ti(r);if(!i)return!1;let o=i.nodeAfter;if(ea(n,i,e,1))return!0;if(r.parent.content.size==0&&(Dt(o,"start")||D.isSelectable(o))){let s=Wn(n.doc,r.before(),r.after(),S.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=n.tr.step(s);a.setSelection(Dt(o,"start")?B.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):D.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Gs=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=ti(r)}let s=o&&o.nodeAfter;return!s||!D.isSelectable(s)?!1:(e&&e(n.tr.setSelection(D.create(n.doc,o.pos)).scrollIntoView()),!0)};function ti(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Wc=(n,e)=>{let t=n.selection,r=t instanceof D,i;if(r){if(t.node.isTextblock||!Ue(n.doc,t.from))return!1;i=t.from}else if(i=Vn(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(D.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},$c=(n,e)=>{let t=n.selection,r;if(t instanceof D){if(t.node.isTextblock||!Ue(n.doc,t.to))return!1;r=t.to}else if(r=Vn(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},qc=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Pt(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Xs=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
6
|
+
`).scrollIntoView()),!0)};function ni(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Hc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=ni(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(B.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Qs=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof le||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ni(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(I.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Zs=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Pe(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Pt(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Jc(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof D&&e.selection.node.isBlock)return!r.parentOffset||!Pe(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=ni(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),o.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof I||e.selection instanceof le)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Pe(u.doc,d,o.length,o);if(h||(o[0]=a?{type:a}:null,h=Pe(u.doc,d,o.length,o)),!h)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let f=u.mapping.map(r.before(s)),p=u.doc.resolve(f);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return t&&t(u.scrollIntoView()),!0}}const Yc=Jc(),Uc=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(D.create(n.doc,i))),!0)};function Kc(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ue(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ea(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&Kc(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(t){let f=e.pos+o.nodeSize,p=v.empty;for(let y=s.length-1;y>=0;y--)p=v.from(s[y].create(null,p));p=v.from(i.copy(p));let g=n.tr.step(new H(e.pos-1,f,e.pos,f,new S(p,1,0),s.length,!0)),m=g.doc.resolve(f+2*s.length);m.nodeAfter&&m.nodeAfter.type==i.type&&Ue(g.doc,m.pos)&&g.join(m.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:B.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&Pt(d);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(d,h).scrollIntoView()),!0;if(c&&Dt(o,"start",!0)&&Dt(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let g=o,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(t){let y=v.empty;for(let w=p.length-1;w>=0;w--)y=v.from(p[w].copy(y));let x=n.tr.step(new H(e.pos-p.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new S(y,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function ta(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(I.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const Gc=ta(-1),Xc=ta(1);function Qc(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),a=s&&Xr(s,n,e);return a?(r&&r(t.tr.wrap(s,a).scrollIntoView()),!0):!1}}function no(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=t.selection.ranges[o];t.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[s];o.setBlockType(a,l,n,e)}r(o.scrollIntoView())}return!0}}function ri(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}ri(Zr,Hs,Ys);ri(Zr,Ks,Gs);ri(Xs,Qs,Zs,Yc);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Zc(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let a=r?t.tr:null;return eu(a,s,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function eu(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new Dn(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Dn(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Xr(o,t,r,e);return a?(n&&tu(n,e,a,i,t),!0):!1}function tu(n,e,t,r,i){let o=v.empty;for(let u=t.length-1;u>=0;u--)o=v.from(t[u].type.create(t[u].attrs,o));n.step(new H(e.start-(r?2:0),e.end,e.start,e.end,new S(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let a=t.length-s,l=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&Pe(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return n}function nu(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?ru(e,t,n,o):iu(e,t,o):!0:!1}}function ru(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new H(o-1,s,o,s,new S(v.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Dn(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=Pt(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Ue(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function iu(n,e,t){let r=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?v.empty:v.from(i))))return!1;let d=o.pos,h=d+s.nodeSize;return r.step(new H(d-(a?1:0),h+(l?1:0),d+1,h-1,new S((a?v.empty:v.from(i.copy(v.empty))).append(l?v.empty:v.from(i.copy(v.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function ou(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=v.from(c?n.create():null),d=new S(v.from(n.create(null,v.from(a.type.create(null,u)))),c?3:1,0),h=o.start,f=o.end;t(e.tr.step(new H(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const U=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Et=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Rr=null;const Oe=function(n,e,t){let r=Rr||(Rr=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},su=function(){Rr=null},dt=function(n,e,t,r){return t&&(ro(n,e,t,r,-1)||ro(n,e,t,r,1))},au=/^(img|br|input|textarea|hr)$/i;function ro(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:de(n))){let s=n.parentNode;if(!s||s.nodeType!=1||on(n)||au.test(n.nodeName)||n.contentEditable=="false")return!1;e=U(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?de(n):0}else return!1}}function de(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function lu(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=de(n)}else if(n.parentNode&&!on(n))e=U(n),n=n.parentNode;else return null}}function cu(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!on(n))e=U(n)+1,n=n.parentNode;else return null}}function uu(n,e,t){for(let r=e==0,i=e==de(n);r||i;){if(n==t)return!0;let o=U(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==de(n)}}function on(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const qn=function(n){return n.focusNode&&dt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Ze(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function du(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fu(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(de(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(de(r.startContainer),r.startOffset)}}}const Se=typeof navigator<"u"?navigator:null,io=typeof document<"u"?document:null,Ge=Se&&Se.userAgent||"",Ir=/Edge\/(\d+)/.exec(Ge),na=/MSIE \d/.exec(Ge),_r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ge),oe=!!(na||_r||Ir),qe=na?document.documentMode:_r?+_r[1]:Ir?+Ir[1]:0,fe=!oe&&/gecko\/(\d+)/i.test(Ge);fe&&+(/Firefox\/(\d+)/.exec(Ge)||[0,0])[1];const Br=!oe&&/Chrome\/(\d+)/.exec(Ge),G=!!Br,ra=Br?+Br[1]:0,Q=!oe&&!!Se&&/Apple Computer/.test(Se.vendor),Tt=Q&&(/Mobile\/\w+/.test(Ge)||!!Se&&Se.maxTouchPoints>2),ue=Tt||(Se?/Mac/.test(Se.platform):!1),ia=Se?/Win/.test(Se.platform):!1,Ae=/Android \d/.test(Ge),sn=!!io&&"webkitFontSmoothing"in io.documentElement.style,hu=sn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function pu(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ee(n,e){return typeof n=="number"?n:n[e]}function mu(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function oo(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Et(s);continue}let a=s,l=a==o.body,c=l?pu(o):mu(a),u=0,d=0;if(e.top<c.top+Ee(r,"top")?d=-(c.top-e.top+Ee(i,"top")):e.bottom>c.bottom-Ee(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ee(i,"top")-c.top:e.bottom-c.bottom+Ee(i,"bottom")),e.left<c.left+Ee(r,"left")?u=-(c.left-e.left+Ee(i,"left")):e.right>c.right-Ee(r,"right")&&(u=e.right-c.right+Ee(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-f,m=a.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let h=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:Et(s)}}function gu(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=n.root.elementFromPoint(o,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:oa(n.dom)}}function oa(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Et(r));return e}function yu({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;sa(t,r==0?0:r-e)}function sa(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let bt=null;function bu(n){if(n.setActive)return n.setActive();if(bt)return n.focus(bt);let e=oa(n);n.focus(bt==null?{get preventScroll(){return bt={preventScroll:!0},!0}}:void 0),bt||(bt=!1,sa(e,0))}function aa(n,e){let t,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Oe(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=u,r=g,i=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(o=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=d+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?xu(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:aa(t,i)}function xu(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Fe(r,1);if(s.top!=s.bottom&&ii(e,s)){i={node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function ii(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function vu(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function ku(n,e,t){let{node:r,offset:i}=aa(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function wu(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let a=n.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function la(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ii(e,c))return la(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function Su(n,e){let t=n.dom.ownerDocument,r,i=0,o=fu(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!ii(e,c)||(s=la(n.dom,e,c),!s))return null}if(Q)for(let c=s;r&&c;c=Et(c))c.draggable&&(r=void 0);if(s=vu(s,e),r){if(fe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;sn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=wu(n,r,i,e))}a==null&&(a=ku(n,s,e));let l=n.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function so(n){return n.top<n.bottom||n.left<n.right}function Fe(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(so(r))return r}return Array.prototype.find.call(t,so)||n.getBoundingClientRect()}const Mu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ca(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=sn||fe;if(r.nodeType==3)if(s&&(Mu.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Fe(Oe(r,i,i),t);if(fe&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Fe(Oe(r,i-1,i-1),-1);if(c.top==l.top){let u=Fe(Oe(r,i,i+1),-1);if(u.top!=l.top)return Rt(u,u.left<c.left)}}return l}else{let l=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(l--,u=1):t<0?l--:c++,Rt(Fe(Oe(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==de(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return dr(l.getBoundingClientRect(),!1)}if(o==null&&i<de(r)){let l=r.childNodes[i];if(l.nodeType==1)return dr(l.getBoundingClientRect(),!0)}return dr(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==de(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Oe(l,de(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Rt(Fe(c,1),!1)}if(o==null&&i<de(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Oe(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Rt(Fe(c,-1),!0)}return Rt(Fe(r.nodeType==3?Oe(r):r,-t),t>=0)}function Rt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function dr(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function ua(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Cu(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return ua(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=ca(n,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Oe(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Nu=/[\u0590-\u08ac]/;function Du(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=n.domSelection();return a?!Nu.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?o:s:ua(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),m=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),m}):r.pos==r.start()||r.pos==r.end()}let ao=null,lo=null,co=!1;function Eu(n,e,t){return ao==e&&lo==t?co:(ao=e,lo=t,co=t=="up"||t=="down"?Cu(n,e,t):Du(n,e,t))}const he=0,uo=1,tt=2,Me=3;class an{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=he,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>U(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof fa){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof da&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?U(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?U(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let u=s+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=U(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=U(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let g=this.children[f],m=p+g.size;if(o>p&&s<m)return g.setSelection(e-p-g.border,t-p-g.border,r,i);p=m}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((fe||Q)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
7
|
+
`),d&&p==f.nodeValue.length)for(let g=f,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:U(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=f.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(fe&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Q)&&dt(a.node,a.offset,u.anchorNode,u.anchorOffset)&&dt(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(d&&fe)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let a=r+o.border,l=s-o.border;if(e>=a&&t<=l){this.dirty=e==r||t==s?tt:uo,e==a&&t==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Me:o.markDirty(e-a,t-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?tt:Me}r=s}this.dirty=tt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?tt:uo;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class da extends an{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==he&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Tu extends an{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ft extends an{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=pt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new ft(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Me||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Me&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=he){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=he}}slice(e,t,r){let i=ft.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=zr(o,t,s,r)),e>0&&(o=zr(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class He extends an{constructor(e,t,r,i,o,s,a,l,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,o,s){let a=o.nodeViews[t.type.name],l,c=a&&a(t,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=pt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=ma(u,r,t),c?l=new Ou(e,t,r,i,u,d||null,h,c,o,s+1):t.isText?new Hn(e,t,r,i,u,h,o):new He(e,t,r,i,u,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>v.empty)}return e}matchesNode(e,t,r){return this.dirty==he&&e.eq(this.node)&&On(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Pu(this,s&&s.node,e);_u(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?j.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e,h);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==tt)&&(s&&this.protectLocalComposition(e,s),ha(this.contentDOM,this.children,e),Tt&&Bu(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof I)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=Fu(this.node.content,s,r-t,i-t);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Tu(this,o,t,i);e.input.compositionNodes.push(s),this.children=zr(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==Me||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=he}updateOuterDeco(e){if(On(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=pa(this.dom,this.nodeDOM,Fr(this.outerDeco,this.node,t),Fr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function fo(n,e,t,r,i){ma(r,e,n);let o=new He(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Hn extends He{constructor(e,t,r,i,o,s,a){super(e,t,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Me||this.dirty!=he&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=he||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=he,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Hn(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Me)}get domAtom(){return!1}isText(e){return this.node.text==e}}class fa extends an{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==he&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Ou extends He{constructor(e,t,r,i,o,s,a,l,c,u){super(e,t,r,i,o,s,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==Me)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ha(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=ho(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof ft){let l=r?r.previousSibling:n.lastChild;ha(s.contentDOM,s.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=ho(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const qt=function(n){n&&(this.nodeName=n)};qt.prototype=Object.create(null);const nt=[new qt];function Fr(n,e,t){if(n.length==0)return nt;let r=t?nt[0]:new qt,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new qt(s.nodeName));for(let a in s){let l=s[a];l!=null&&(t&&i.length==1&&i.push(r=new qt(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function pa(n,e,t,r){if(t==nt&&r==nt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=t[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=nt[0]),i=l}Au(i,a||nt[0],s)}return i}function Au(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function ma(n,e,t){return pa(n,n,nt,Fr(e,t,n.nodeType!=1))}function On(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function ho(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Pu{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ru(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=he,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ft.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==Me&&s.dom==s.contentDOM&&(s.dirty=tt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof He){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Me&&On(t,l.outerDeco));if(!h&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=tt,d.updateChildren(i,s+1),d.dirty=he),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!On(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=He.create(this.top,t,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,o){let s=He.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new da(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ft;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Hn)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Q||G)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new fa(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Ru(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof ft)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function Iu(n,e){return n.type.side-e.type.side}function _u(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let m=i[s++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(Iu);for(let m=0;m<d.length;m++)t(d[m],c,!!l)}else t(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let m=0;m<a.length;m++)a[m].to<=o&&a.splice(m--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let p=o+h.nodeSize;if(h.isText){let m=p;s<i.length&&i[s].from<m&&(m=i[s].from);for(let y=0;y<a.length;y++)a[y].to<m&&(m=a[y].to);m<p&&(l=h.cut(m-o),h=h.cut(0,m-o),p=m,f=-1)}else for(;s<i.length&&i[s].to<p;)s++;let g=h.isInline&&!h.isLeaf?a.filter(m=>!m.inline):a.slice();r(h,g,e.forChild(o,h),f),o=p}}function Bu(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Fu(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=t){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function zr(n,e,t,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],c=a,u=a+=l.size;c>=t||u<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(l.slice(t-c,l.size,r)))}return o}function oi(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(qn(t)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&D.isSelectable(d)&&i.parent&&!(d.isInline&&uu(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new D(s==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,h=s;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,s]=h==n.state.selection.anchor?[h,d]:[d,h],a=r.resolve(s)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||n.state.selection.head<a.pos&&!o?1:-1;c=si(n,u,a,d)}return c}function ga(n){return n.editable?n.hasFocus():ba(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Re(n,e=!1){let t=n.state.selection;if(ya(n,t),!!ga(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&G){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&dt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Lu(n);else{let{anchor:r,head:i}=t,o,s;po&&!(t instanceof I)&&(t.$from.parent.inlineContent||(o=mo(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=mo(n,t.to))),n.docView.setSelection(r,i,n,e),po&&(o&&go(o),s&&go(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&zu(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const po=Q||G&&ra<63;function mo(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Q&&i&&i.contentEditable=="false")return fr(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return fr(i);if(o)return fr(o)}}function fr(n){return n.contentEditable="true",Q&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function go(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function zu(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ga(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Lu(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,U(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&oe&&qe<=11&&(t.disabled=!0,t.disabled=!1)}function ya(n,e){if(e instanceof D){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(yo(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else yo(n)}function yo(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function si(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||I.between(e,t,r)}function bo(n){return n.editable&&!n.hasFocus()?!1:ba(n)}function ba(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ju(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return dt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Lr(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&B.findFrom(o,e)}function ze(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function xo(n,e,t){let r=n.state.selection;if(r instanceof I)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return ze(n,new I(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Lr(n.state,e);return i&&i instanceof D?ze(n,i):!1}else if(!(ue&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?D.isSelectable(o)?ze(n,new D(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):sn?ze(n,new I(n.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof D&&r.node.isInline)return ze(n,new I(e>0?r.$to:r.$from));{let i=Lr(n.state,e);return i?ze(n,i):!1}}}function An(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ht(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function xt(n,e){return e<0?Vu(n):Wu(n)}function Vu(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(fe&&t.nodeType==1&&r<An(t)&&Ht(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Ht(a,-1))i=t,o=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(xa(t))break;{let a=t.previousSibling;for(;a&&Ht(a,-1);)i=t.parentNode,o=U(a),a=a.previousSibling;if(a)t=a,r=An(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?jr(n,t,r):i&&jr(n,i,o)}function Wu(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=An(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Ht(a,1))o=t,s=++r;else break}else{if(xa(t))break;{let a=t.nextSibling;for(;a&&Ht(a,1);)o=a.parentNode,s=U(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=An(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&jr(n,o,s)}function xa(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function $u(n,e){for(;n&&e==n.childNodes.length&&!on(n);)e=U(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function qu(n,e){for(;n&&!e&&!on(n);)e=U(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function jr(n,e,t){if(e.nodeType!=3){let o,s;(s=$u(e,t))?(e=s,t=0):(o=qu(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(qn(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Re(n)},50)}function vo(n,e){let t=n.state.doc.resolve(e);if(!(G||ia)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function ko(n,e,t){let r=n.state.selection;if(r instanceof I&&!r.empty||t.indexOf("s")>-1||ue&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Lr(n.state,e);if(s&&s instanceof D)return ze(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof le?B.near(s,e):B.findFrom(s,e);return a?ze(n,a):!1}return!1}function wo(n,e){if(!(n.state.selection instanceof I))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function So(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Hu(n){if(!Q||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;So(n,r,"true"),setTimeout(()=>So(n,r,"false"),20)}return!1}function Ju(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Yu(n,e){let t=e.keyCode,r=Ju(e);if(t==8||ue&&t==72&&r=="c")return wo(n,-1)||xt(n,-1);if(t==46&&!e.shiftKey||ue&&t==68&&r=="c")return wo(n,1)||xt(n,1);if(t==13||t==27)return!0;if(t==37||ue&&t==66&&r=="c"){let i=t==37?vo(n,n.state.selection.from)=="ltr"?-1:1:-1;return xo(n,i,r)||xt(n,i)}else if(t==39||ue&&t==70&&r=="c"){let i=t==39?vo(n,n.state.selection.from)=="ltr"?1:-1:1;return xo(n,i,r)||xt(n,i)}else{if(t==38||ue&&t==80&&r=="c")return ko(n,-1,r)||xt(n,-1);if(t==40||ue&&t==78&&r=="c")return Hu(n)||ko(n,1,r)||xt(n,1);if(r==(ue?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ai(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=n.someProp("clipboardSerializer")||pt.fromSchema(n.state.schema),a=Ca(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ma[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=a.createElement(u[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
8
|
+
|
|
9
|
+
`);return{dom:l,text:h,slice:e}}function va(n,e,t,r,i){let o=i.parent.type.spec.code,s,a;if(!t&&!e)return null;let l=!!e&&(r||o||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,o||r,n)}),o)return a=new S(v.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let d=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(d)a=d;else{let h=i.marks(),{schema:f}=n.state,p=pt.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(f.text(g,h)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=Xu(t),sn&&Qu(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||$e.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Uu.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Zu(Mo(a,+u[1],+u[2]),u[4]);else if(a=S.maxOpen(Ku(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=Mo(a,d,h)}return n.someProp("transformPasted",d=>{a=d(a,n,l)}),a}const Uu=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ku(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&wa(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Sa(s[s.length-1],o.length));let u=ka(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return v.from(s)}return n}function ka(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,v.from(n));return n}function wa(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=wa(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(v.from(ka(t,n,i+1))))}}function Sa(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Sa(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(v.empty,!0);return n.copy(t.append(r))}function Vr(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(o=0),i<r-1&&(a=Vr(a,e,t,r,i+1,o)),i>=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(v.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function Mo(n,e,t){return e<n.openStart&&(n=new S(Vr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new S(Vr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ma={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Co=null;function Ca(){return Co||(Co=document.implementation.createHTMLDocument("title"))}let hr=null;function Gu(n){let e=window.trustedTypes;return e?(hr||(hr=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),hr.createHTML(n)):n}function Xu(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ca().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Ma[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=Gu(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function Qu(n){let e=n.querySelectorAll(G?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Zu(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=v.from(l.create(r[a+1],i)),o++,s++}return new S(i,o,s)}const te={},ne={},ed={touchstart:!0,touchmove:!0};class td{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function nd(n){for(let e in te){let t=te[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{id(n,r)&&!li(n,r)&&(n.editable||!(r.type in ne))&&t(n,r)},ed[e]?{passive:!0}:void 0)}Q&&n.dom.addEventListener("input",()=>null),Wr(n)}function We(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function rd(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Wr(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>li(n,r))})}function li(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function id(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function od(n,e){!li(n,e)&&te[e.type]&&(n.editable||!(e.type in ne))&&te[e.type](n,e)}ne.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Da(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ae&&G&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Tt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Ze(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Yu(n,t)?t.preventDefault():We(n,"key")};ne.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ne.keypress=(n,e)=>{let t=e;if(Da(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ue&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof I)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),o=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i,o))&&n.dispatch(o()),t.preventDefault()}};function Jn(n){return{left:n.clientX,top:n.clientY}}function sd(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ci(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,a=>s>o.depth?a(n,t,o.nodeAfter,o.before(s),i,!0):a(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function Ct(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function ad(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&D.isSelectable(r)?(Ct(n,new D(t)),!0):!1}function ld(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof D&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(D.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(Ct(n,D.create(n.state.doc,i)),!0):!1}function cd(n,e,t,r,i){return ci(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?ld(n,t):ad(n,t))}function ud(n,e,t,r){return ci(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function dd(n,e,t,r){return ci(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||fd(n,t,r)}function fd(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ct(n,I.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)Ct(n,I.create(r,a+1,a+1+s.content.size));else if(D.isSelectable(s))Ct(n,D.create(r,a));else continue;return!0}}function ui(n){return Pn(n)}const Na=ue?"metaKey":"ctrlKey";te.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=ui(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&sd(t,n.input.lastClick)&&!t[Na]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o,button:t.button};let s=n.posAtCoords(Jn(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new hd(n,s,t,!!r)):(o=="doubleClick"?ud:dd)(n,s.pos,s.inside,t)?t.preventDefault():We(n,"pointer"))};class hd{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Na],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof D&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&fe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),We(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Re(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Jn(e))),this.updateAllowDefault(e),this.allowDefault||!t?We(this.view,"pointer"):cd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Q&&this.mightDrag&&!this.mightDrag.node.isAtom||G&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ct(this.view,B.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):We(this.view,"pointer")}move(e){this.updateAllowDefault(e),We(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}te.touchstart=n=>{n.input.lastTouch=Date.now(),ui(n),We(n,"pointer")};te.touchmove=n=>{n.input.lastTouch=Date.now(),We(n,"pointer")};te.contextmenu=n=>ui(n);function Da(n,e){return n.composing?!0:Q&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const pd=Ae?5e3:-1;ne.compositionstart=ne.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof I&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||G&&ia&&md(n)))n.markCursor=n.state.storedMarks||t.marks(),Pn(n,!0),n.markCursor=null;else if(Pn(n,!e.selection.empty),fe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Ea(n,pd)};function md(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}ne.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ea(n,20))};function Ea(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Pn(n),e))}function Ta(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=yd());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function gd(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=lu(e.focusNode,e.focusOffset),r=cu(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function yd(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Pn(n,e=!1){if(!(Ae&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ta(n),e||n.docView&&n.docView.dirty){let t=oi(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function bd(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Gt=oe&&qe<15||Tt&&hu<604;te.copy=ne.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Gt?null:t.clipboardData,s=r.content(),{dom:a,text:l}=ai(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):bd(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xd(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function vd(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Xt(n,r.value,null,i,e):Xt(n,r.textContent,r.innerHTML,i,e)},50)}function Xt(n,e,t,r,i){let o=va(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,o||S.empty)))return!0;if(!o)return!1;let s=xd(o),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Oa(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ne.paste=(n,e)=>{let t=e;if(n.composing&&!Ae)return;let r=Gt?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Xt(n,Oa(r),r.getData("text/html"),i,t)?t.preventDefault():vd(n,t)};class Aa{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const kd=ue?"altKey":"ctrlKey";function Pa(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[kd]}te.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Jn(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof D?i.to-1:i.to))){if(r&&r.mightDrag)s=D.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=D.create(n.state.doc,d.posBefore))}}let a=(s||n.state.selection).content(),{dom:l,text:c,slice:u}=ai(n,a);(!t.dataTransfer.files.length||!G||ra>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Gt?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Gt||t.dataTransfer.setData("text/plain",c),n.dragging=new Aa(u,Pa(n,t),s)};te.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ne.dragover=ne.dragenter=(n,e)=>e.preventDefault();ne.drop=(n,e)=>{try{wd(n,e,n.dragging)}finally{n.dragging=null}};function wd(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Jn(e));if(!r)return;let i=n.state.doc.resolve(r.pos),o=t&&t.slice;o?n.someProp("transformPasted",f=>{o=f(o,n,!1)}):o=va(n,Oa(e.dataTransfer),Gt?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(t&&Pa(n,e));if(n.someProp("handleDrop",f=>f(n,e,o||S.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?Tc(n.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=n.state.tr;if(s){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&D.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new D(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,m,y)=>f=y),l.setSelection(si(n,h,l.doc.resolve(f)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}te.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Re(n)},20))};te.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};te.beforeinput=(n,e)=>{if(G&&Ae&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Ze(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in ne)te[n]=ne[n];function Qt(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Rn{constructor(e,t){this.toDOM=e,this.spec=t||st,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new ge(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Rn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Qt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Je{constructor(e,t){this.attrs=e,this.spec=t||st}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new ge(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Je&&Qt(this.attrs,e.attrs)&&Qt(this.spec,e.spec)}static is(e){return e.type instanceof Je}destroy(){}}class di{constructor(e,t){this.attrs=e,this.spec=t||st}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new ge(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof di&&Qt(this.attrs,e.attrs)&&Qt(this.spec,e.spec)}destroy(){}}class ge{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ge(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new ge(e,e,new Rn(t,r))}static inline(e,t,r,i){return new ge(e,t,new Je(r,i))}static node(e,t,r,i){return new ge(e,t,new di(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Je}get widget(){return this.type instanceof Rn}}const wt=[],st={};class q{constructor(e,t){this.local=e.length?e:wt,this.children=t.length?t:wt}static create(e,t){return t.length?In(t,e,0,st):X}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,i+a,o)}}map(e,t,r){return this==X||e.maps.length==0?this:this.mapInner(e,t,0,0,r||st)}mapInner(e,t,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?Sd(this.children,s||[],e,t,r,i,o):s?new q(s.sort(at),wt):X}add(e,t){return t.length?this==X?q.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Ia(t,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,In(u,a,c+1,st)),o+=3}});let s=Ra(o?_a(t):t,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new q(s.length?this.local.concat(s).sort(at):this.local,i||this.children)}remove(e){return e.length==0||this==X?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+t,l=r[o+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=X?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new q(i,r):X}forChild(e,t){if(this==X)return this;if(t.isLeaf)return q.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Je){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new q(i.sort(at),wt);return r?new Le([a,r]):a}return r||X}eq(e){if(this==e)return!0;if(!(e instanceof q)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return fi(this.localsInner(e))}localsInner(e){if(this==X)return wt;if(e.inlineContent||!this.local.some(Je.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Je||t.push(this.local[r]);return t}forEachSet(e){e(this)}}q.empty=new q([],[]);q.removeOverlap=fi;const X=q.empty;class Le{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,st));return Le.from(r)}forChild(e,t){if(t.isLeaf)return q.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=X&&(o instanceof Le?r=r.concat(o.members):r.push(o))}return Le.from(r)}eq(e){if(!(e instanceof Le)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?fi(r?t:t.sort(at)):wt}static from(e){switch(e.length){case 0:return X;case 1:return e[0];default:return new Le(e.every(t=>t instanceof q)?e:e.reduce((t,r)=>t.concat(r instanceof q?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Sd(n,e,t,r,i,o,s){let a=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((h,f,p,g)=>{let m=g-p-(f-h);for(let y=0;y<a.length;y+=3){let x=a[y+1];if(x<0||h>x+u-d)continue;let w=a[y]+u-d;f>=w?a[y+1]=h<=w?-2:-1:h>=u&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(n[c]+o),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let h=t.map(n[c+1]+o,-1),f=h-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==f){let y=a[c+2].mapInner(t,m,u+1,n[c]+o+1,s);y!=X?(a[c]=d,a[c+1]=f,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Md(a,n,e,t,i,o,s),u=In(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new q(e.sort(at),a)}function Ra(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new ge(i.from+e,i.to+e,i.type))}return t}function Md(n,e,t,r,i,o,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?t.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+o+1);return t}function Ia(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function _a(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function In(n,e,t,r){let i=[],o=!1;e.forEach((a,l)=>{let c=Ia(n,a,l+t);if(c){o=!0;let u=In(c,a,t+l+1,r);u!=X&&i.push(l,l+a.nodeSize,u)}});let s=Ra(o?_a(n):n,-t).sort(at);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new q(s,i):X}function at(n,e){return n.from-e.from||n.to-e.to}function fi(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),No(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),No(e,i,r.copy(o.from,r.to)));break}}}return e}function No(n,e,t){for(;e<n.length&&at(t,n[e])>0;)e++;n.splice(e,0,t)}function pr(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=X&&e.push(r)}),n.cursorWrapper&&e.push(q.create(n.state.doc,[n.cursorWrapper.deco])),Le.from(e)}const Cd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Nd=oe&&qe<=11;class Dd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Ed{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Dd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);oe&&qe<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Q&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Nd&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Cd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(bo(this.view)){if(this.suppressingSelectionUpdates)return Re(this.view);if(oe&&qe<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&dt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=Et(o))t.add(o);for(let o=e.anchorNode;o;o=Et(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&bo(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(fe&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||Ad(e,d)!=f)&&h.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&qn(r)&&(c=oi(e))&&c.eq(B.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Re(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Td(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Pd(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Re(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(oe&&qe<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?U(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?U(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Do=new WeakMap,Eo=!1;function Td(n){if(!Do.has(n)&&(Do.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=fe,Eo)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Eo=!0}}function To(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return dt(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Od(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return To(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?To(n,t):null}function Ad(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Pd(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let o of e)if(((t=o.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(o,a.firstChild),r==o&&n.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function Rd(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,u=l.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],qn(l)||c.push({node:l.focusNode,offset:l.focusOffset})),G&&n.input.lastKeyCode===8)for(let m=o;m>i;m--){let y=r.childNodes[m-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){o=m;break}if(!x||x.size)break}let d=n.state.doc,h=n.someProp("domParser")||$e.fromSchema(n.state.schema),f=d.resolve(s),p=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:o,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Id,context:f});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),p={anchor:m+s,head:y+s}}return{doc:g,sel:p,from:s,to:a}}function Id(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Q&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Q&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const _d=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Bd(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,R=oi(n,M);if(R&&!n.state.selection.eq(R)){if(G&&Ae&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",re=>re(n,Ze(13,"Enter"))))return;let _=n.state.tr.setSelection(R);M=="pointer"?_.setMeta("pointer",!0):M=="key"&&_.scrollIntoView(),o&&_.setMeta("composition",o),n.dispatch(_)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Rd(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=Ld(d.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Tt&&n.input.lastIOSEnter>Date.now()-225||Ae)&&i.some(M=>M.nodeType==1&&!_d.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,Ze(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof I&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=Oo(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let R=n.state.tr.setSelection(M);o&&R.setMeta("composition",o),n.dispatch(R)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof I&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),oe&&qe<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),x=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((Tt&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!x&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,Ze(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&zd(u,p.start,p.endA,g,m)&&n.someProp("handleKeyDown",M=>M(n,Ze(8,"Backspace")))){Ae&&G&&n.domObserver.suppressSelectionUpdates();return}G&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Ae&&!x&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Ze(13,"Enter"))})},20));let w=p.start,C=p.endA,k=M=>{let R=M||n.state.tr.replace(w,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let _=Oo(n,R.doc,c.sel);_&&!(G&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==w||_.head==R.mapping.map(C)-1)||oe&&_.empty&&_.head==w)&&R.setSelection(_)}return o&&R.setMeta("composition",o),R.scrollIntoView()},P;if(x)if(g.pos==m.pos){oe&&qe<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Re(n),20));let M=k(n.state.tr.delete(w,C)),R=u.resolve(p.start).marksAcross(u.resolve(p.endA));R&&M.ensureMarks(R),n.dispatch(M)}else if(p.endA==p.endB&&(P=Fd(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let M=k(n.state.tr);P.type=="add"?M.addMark(w,C,P.mark):M.removeMark(w,C,P.mark),n.dispatch(M)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset),R=()=>k(n.state.tr.insertText(M,w,C));n.someProp("handleTextInput",_=>_(n,w,C,M,R))||n.dispatch(R())}else n.dispatch(k());else n.dispatch(k())}function Oo(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:si(n,e.resolve(t.anchor),e.resolve(t.head))}function Fd(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(v.from(c).eq(n))return{mark:a,type:s}}function zd(n,e,t,r,i){if(t-e<=i.pos-r.pos||mr(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&t==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(mr(o,!0,!0));return!s.parent.isTextblock||s.pos>t||mr(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function mr(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Ld(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&n.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&Ao(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<n.size&&Ao(n.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Ao(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Ba{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new td,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Bo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Io(this),Ro(this),this.nodeViews=_o(this),this.docView=fo(this.state.doc,Po(this),pr(this),this.dom,this),this.domObserver=new Ed(this,(r,i,o,s)=>Bd(this,r,i,o,s)),this.domObserver.start(),nd(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Wr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Bo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Ta(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=_o(this);Vd(f,this.nodeViews)&&(this.nodeViews=f,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Wr(this),this.editable=Io(this),Ro(this);let l=pr(this),c=Po(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&gu(this);if(s){this.domObserver.stop();let f=d&&(oe||G)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&jd(i.selection,e.selection);if(d){let p=G?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gd(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=fo(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ju(this))?Re(this,f):(ya(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&yu(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof D){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&oo(this,t.getBoundingClientRect(),e)}else oo(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Aa(e.slice,e.move,i<0?void 0:D.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=t?t(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(oe){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&bu(this.dom),Re(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Su(this,e)}coordsAtPos(e,t=1){return ca(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Eu(this,t||this.state,e)}pasteHTML(e,t){return Xt(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Xt(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ai(this,e)}destroy(){this.docView&&(rd(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],pr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,su())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return od(this,e)}domSelectionRange(){let e=this.domSelection();return e?Q&&this.root.nodeType===11&&du(this.dom.ownerDocument)==this.dom&&Od(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ba.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Po(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ge.node(0,n.state.doc.content.size,e)]}function Ro(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ge.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Io(n){return!n.someProp("editable",e=>e(n.state)===!1)}function jd(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function _o(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Vd(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Bo(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ye={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_n={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Wd=typeof navigator<"u"&&/Mac/.test(navigator.platform),$d=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var K=0;K<10;K++)Ye[48+K]=Ye[96+K]=String(K);for(var K=1;K<=24;K++)Ye[K+111]="F"+K;for(var K=65;K<=90;K++)Ye[K]=String.fromCharCode(K+32),_n[K]=String.fromCharCode(K);for(var gr in Ye)_n.hasOwnProperty(gr)||(_n[gr]=Ye[gr]);function qd(n){var e=Wd&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||$d&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?_n:Ye)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Hd=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Jd=typeof navigator<"u"&&/Win/.test(navigator.platform);function Yd(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Hd?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Ud(n){let e=Object.create(null);for(let t in n)e[Yd(t)]=n[t];return e}function yr(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Kd(n){return new ve({props:{handleKeyDown:Gd(n)}})}function Gd(n){let e=Ud(n);return function(t,r){let i=qd(r),o,s=e[yr(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[yr(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Jd&&r.ctrlKey&&r.altKey)&&(o=Ye[r.keyCode])&&o!=i){let a=e[yr(o,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Xd=Object.defineProperty,hi=(n,e)=>{for(var t in e)Xd(n,t,{get:e[t],enumerable:!0})};function Yn(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}var Un=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,o=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([s,a])=>[s,(...c)=>{const u=a(...c)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,h])=>[d,(...p)=>{const g=this.buildProps(l,e),m=h(...p)(g);return s.push(m),u}])),run:c};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:o}=r,s={tr:n,editor:r,view:o,state:Yn({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(s)]))}};return s}},Fa={};hi(Fa,{blur:()=>Qd,clearContent:()=>Zd,clearNodes:()=>ef,command:()=>tf,createParagraphNear:()=>nf,cut:()=>rf,deleteCurrentNode:()=>of,deleteNode:()=>sf,deleteRange:()=>af,deleteSelection:()=>lf,enter:()=>cf,exitCode:()=>uf,extendMarkRange:()=>df,first:()=>ff,focus:()=>pf,forEach:()=>mf,insertContent:()=>gf,insertContentAt:()=>xf,joinBackward:()=>wf,joinDown:()=>kf,joinForward:()=>Sf,joinItemBackward:()=>Mf,joinItemForward:()=>Cf,joinTextblockBackward:()=>Nf,joinTextblockForward:()=>Df,joinUp:()=>vf,keyboardShortcut:()=>Tf,lift:()=>Of,liftEmptyBlock:()=>Af,liftListItem:()=>Pf,newlineInCode:()=>Rf,resetAttributes:()=>If,scrollIntoView:()=>_f,selectAll:()=>Bf,selectNodeBackward:()=>Ff,selectNodeForward:()=>zf,selectParentNode:()=>Lf,selectTextblockEnd:()=>jf,selectTextblockStart:()=>Vf,setContent:()=>Wf,setMark:()=>ch,setMeta:()=>uh,setNode:()=>dh,setNodeSelection:()=>fh,setTextDirection:()=>hh,setTextSelection:()=>ph,sinkListItem:()=>mh,splitBlock:()=>gh,splitListItem:()=>yh,toggleList:()=>bh,toggleMark:()=>xh,toggleNode:()=>vh,toggleWrap:()=>kh,undoInputRule:()=>wh,unsetAllMarks:()=>Sh,unsetMark:()=>Mh,unsetTextDirection:()=>Ch,updateAttributes:()=>Nh,wrapIn:()=>Dh,wrapInList:()=>Eh});var Qd=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Zd=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),ef=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=Pt(f);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,g)}(p||p===0)&&e.lift(f,p)})}),!0},tf=n=>e=>n(e),nf=()=>({state:n,dispatch:e})=>Qs(n,e),rf=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new I(r.doc.resolve(Math.max(s-1,0)))),!0},of=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);n.delete(a,l).scrollIntoView()}return!0}return!1};function J(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var sf=n=>({tr:e,state:t,dispatch:r})=>{const i=J(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},af=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},lf=()=>({state:n,dispatch:e})=>Zr(n,e),cf=()=>({commands:n})=>n.keyboardShortcut("Enter"),uf=()=>({state:n,dispatch:e})=>Hc(n,e);function pi(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Bn(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:pi(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function za(n,e,t={}){return n.find(r=>r.type===e&&Bn(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Fo(n,e,t={}){return!!za(n,e,t)}function mi(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!za([...i.node.marks],e,t)))return;let s=i.index,a=n.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&Fo([...n.parent.child(s-1).marks],e,t);)s-=1,a-=n.parent.child(s).nodeSize;for(;l<n.parent.childCount&&Fo([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Ie(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var df=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Ie(n,r.schema),{doc:s,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=mi(l,o,e);if(d&&d.from<=c&&d.to>=u){const h=I.create(s,d.from,d.to);t.setSelection(h)}}return!0},ff=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function La(n){return n instanceof I}function rt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function ja(n,e=null){if(!e)return null;const t=B.atStart(n),r=B.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?I.create(n,rt(0,i,o),rt(n.content.size,i,o)):I.create(n,rt(e,i,o),rt(e,i,o))}function $r(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Zt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hf(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var pf=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Zt()||$r())&&r.dom.focus(),hf()&&!Zt()&&!$r()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(o&&n===null&&!La(t.state.selection))return s(),!0;const a=ja(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},mf=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),gf=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Va=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Va(r)}return n};function mn(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Va(t)}function en(n,e,t){if(n instanceof ye||n instanceof v)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return v.fromArray(n.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),en("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,a="";const l=new Ns({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?$e.fromSchema(l).parseSlice(mn(n),t.parseOptions):$e.fromSchema(l).parse(mn(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=$e.fromSchema(e);return t.slice?o.parseSlice(mn(n),t.parseOptions).content:o.parse(mn(n),t.parseOptions)}return en("",e,t)}function yf(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof W||i instanceof H))return;const o=n.mapping.maps[r];let s=0;o.forEach((a,l,c,u)=>{s===0&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}var bf=n=>!("type"in n),xf=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=m=>{o.emit("contentError",{editor:o,error:m,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{en(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){l(m)}try{a=en(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(m){return l(m),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((bf(a)?a:[a]).forEach(m=>{m.check(),h=h?m.isText&&m.marks.length===0:!1,f=f?m.isBlock:!1}),u===d&&f){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(h){if(Array.isArray(e))g=e.map(m=>m.text||"").join("");else if(e instanceof v){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),g=m}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const m=r.doc.resolve(u),y=m.node(),x=m.parentOffset===0,w=y.isText||y.isTextblock,C=y.content.size>0;x&&w&&C&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}t.updateSelection&&yf(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},vf=()=>({state:n,dispatch:e})=>Wc(n,e),kf=()=>({state:n,dispatch:e})=>$c(n,e),wf=()=>({state:n,dispatch:e})=>Hs(n,e),Sf=()=>({state:n,dispatch:e})=>Ks(n,e),Mf=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Vn(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Cf=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Vn(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Nf=()=>({state:n,dispatch:e})=>jc(n,e),Df=()=>({state:n,dispatch:e})=>Vc(n,e);function Wa(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Ef(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Zt()||Wa()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}var Tf=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=Ef(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function tn(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?J(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const l=i-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Bn(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}var Of=(n,e={})=>({state:t,dispatch:r})=>{const i=J(n,t.schema);return tn(t,i,e)?qc(t,r):!1},Af=()=>({state:n,dispatch:e})=>Zs(n,e),Pf=n=>({state:e,dispatch:t})=>{const r=J(n,e.schema);return nu(r)(e,t)},Rf=()=>({state:n,dispatch:e})=>Xs(n,e);function Kn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function zo(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var If=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Kn(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(o=J(n,r.schema)),a==="mark"&&(s=Ie(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{o&&o===u.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,zo(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(h=>{s===h.type&&(l=!0,i&&t.addMark(d,d+u.nodeSize,s.create(zo(h.attrs,e))))})})}),l},_f=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Bf=()=>({tr:n,dispatch:e})=>{if(e){const t=new le(n.doc);n.setSelection(t)}return!0},Ff=()=>({state:n,dispatch:e})=>Ys(n,e),zf=()=>({state:n,dispatch:e})=>Gs(n,e),Lf=()=>({state:n,dispatch:e})=>Uc(n,e),jf=()=>({state:n,dispatch:e})=>Xc(n,e),Vf=()=>({state:n,dispatch:e})=>Gc(n,e);function qr(n,e,t={},r={}){return en(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Wf=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{const{doc:l}=o;if(r.preserveWhitespace!=="full"){const c=qr(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function $a(n,e){const t=Ie(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function $f(n,e){const t=new Vs(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function qf(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function ib(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function Hf(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Gn(n){return e=>Hf(e.$from,n)}function N(n,e,t){return n.config[e]===void 0&&n.parent?N(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?N(n.parent,e,t):null}):n.config[e]}function gi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=N(e,"addExtensions",t);return r?[e,...gi(r())]:e}).flat(10)}function yi(n,e){const t=pt.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function qa(n){return typeof n=="function"}function L(n,e=void 0,...t){return qa(n)?e?n.bind(e)(...t):n(...t):n}function Jf(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ot(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Ha(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ot(n),i=[...t,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...s,...a];return n.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=N(c,"addGlobalAttributes",u);if(!d)return;d().forEach(f=>{let p;Array.isArray(f.types)?p=f.types:f.types==="*"?p=l:f.types==="nodes"?p=s:f.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(f.attributes).forEach(([m,y])=>{e.push({type:g,name:m,attribute:{...o,...y}})})})})}),i.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=N(c,"addAttributes",u);if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:c.name,name:f,attribute:g})})}),e}function Yf(n){const e=[];let t="",r=!1,i=!1,o=0;const s=n.length;for(let a=0;a<s;a+=1){const l=n[a];if(l==="'"&&!i){r=!r,t+=l;continue}if(l==='"'&&!r){i=!i,t+=l;continue}if(!r&&!i){if(l==="("){o+=1,t+=l;continue}if(l===")"&&o>0){o-=1,t+=l;continue}if(l===";"&&o===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function Lo(n){const e=[],t=Yf(n||""),r=t.length;for(let i=0;i<r;i+=1){const o=t[i],s=o.indexOf(":");if(s===-1)continue;const a=o.slice(0,s).trim(),l=o.slice(s+1).trim();a&&l&&e.push([a,l])}return e}function Uf(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([...Lo(r[i]),...Lo(o)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=o}),r},{})}function nn(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Uf(t,r),{})}function Kf(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function jo(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(t):Kf(t.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Vo(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Jf(t)?!1:t!=null))}function Wo(n){var e,t;const r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function Gf(n,e){var t;const r=Ha(n),{nodeExtensions:i,markExtensions:o}=Ot(n),s=(t=i.find(c=>N(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((y,x)=>{const w=N(x,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),f=Vo({...h,content:L(N(c,"content",d)),marks:L(N(c,"marks",d)),group:L(N(c,"group",d)),inline:L(N(c,"inline",d)),atom:L(N(c,"atom",d)),selectable:L(N(c,"selectable",d)),draggable:L(N(c,"draggable",d)),code:L(N(c,"code",d)),whitespace:L(N(c,"whitespace",d)),linebreakReplacement:L(N(c,"linebreakReplacement",d)),defining:L(N(c,"defining",d)),isolating:L(N(c,"isolating",d)),attrs:Object.fromEntries(u.map(Wo))}),p=L(N(c,"parseHTML",d));p&&(f.parseDOM=p.map(y=>jo(y,u)));const g=N(c,"renderHTML",d);g&&(f.toDOM=y=>g({node:y,HTMLAttributes:nn(y,u)}));const m=N(c,"renderText",d);return m&&(f.toText=m),[c.name,f]})),l=Object.fromEntries(o.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((m,y)=>{const x=N(y,"extendMarkSchema",d);return{...m,...x?x(c):{}}},{}),f=Vo({...h,inclusive:L(N(c,"inclusive",d)),excludes:L(N(c,"excludes",d)),group:L(N(c,"group",d)),spanning:L(N(c,"spanning",d)),code:L(N(c,"code",d)),attrs:Object.fromEntries(u.map(Wo))}),p=L(N(c,"parseHTML",d));p&&(f.parseDOM=p.map(m=>jo(m,u)));const g=N(c,"renderHTML",d);return g&&(f.toDOM=m=>g({mark:m,HTMLAttributes:nn(m,u)})),[c.name,f]}));return new Ns({topNode:s,nodes:a,marks:l})}function Xf(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Jt(n){return n.sort((t,r)=>{const i=N(t,"priority")||100,o=N(r,"priority")||100;return i>o?-1:i<o?1:0})}function Ja(n){const e=Jt(gi(n)),t=Xf(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Ya(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
|
|
11
|
+
|
|
12
|
+
`,textSerializers:s={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,u,d)=>{var h;l.isBlock&&c>r&&(a+=o);const f=s?.[l.type.name];if(f)return u&&(a+=f({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Qf(n,e){const t={from:0,to:n.content.size};return Ya(n,t,e)}function Ua(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Zf(n,e){const t=J(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===t.name);return s?{...s.attrs}:{}}function eh(n,e){const t=Kn(typeof e=="string"?e:e.name,n.schema);return t==="node"?Zf(n,e):t==="mark"?$a(n,e):{}}function th(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function nh(n){const e=th(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,s)=>s!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function rh(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=t[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),u=e.slice(o).map(l),d=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),nh(r)}function Ka(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=mi(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var ob=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let o=r,s=null;for(;o>0&&s===null;){const a=i.node(o);a?.type.name===e?s=a:o-=1}return[s,o]};function It(n,e){return e.nodes[n]||e.marks[n]||null}function wn(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var ih=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function Hr(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Ie(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Bn(d.attrs,t,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;n.doc.nodesBetween(f,p,(g,m)=>{if(o&&g.inlineContent&&!g.type.allowsMarkType(o))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(f,m),x=Math.min(p,m+g.nodeSize),w=x-y;s+=w,a.push(...g.marks.map(C=>({mark:C,from:y,to:x})))})}),s===0)return!1;const l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>Bn(d.mark.attrs,t,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=s}function oh(n,e,t={}){if(!e)return tn(n,null,t)||Hr(n,null,t);const r=Kn(e,n.schema);return r==="node"?tn(n,e,t):r==="mark"?Hr(n,e,t):!1}var sb=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const o=Gn(a=>a.type.name===e)(n.selection);if(!o)return!1;const s=n.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},ab=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function $o(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function qo(n,e){const{nodeExtensions:t}=Ot(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=L(N(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function bi(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(bi(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function lb(n){return n instanceof D}var Ga=class Xa{constructor(e){this.position=e}static fromJSON(e){return new Xa(e.position)}toJSON(){return{position:this.position}}};function sh(n,e){const t=e.mapping.mapResult(n.position);return{position:new Ga(t.pos),mapResult:t}}function ah(n){return new Ga(n)}function lh(n,e,t){var r;const{selection:i}=e;let o=null;if(La(i)&&(o=i.$cursor),o){const a=(r=n.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));c=f&&p}return!c}),c})}var ch=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:a}=o,l=Ie(n,r.schema);if(i)if(s){const c=$a(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(h,f)=>{const p=Math.max(f,u),g=Math.min(f+h.nodeSize,d);h.marks.find(y=>y.type===l)?h.marks.forEach(y=>{l===y.type&&t.addMark(p,g,l.create({...y.attrs,...e}))}):t.addMark(p,g,l.create(e))})});return lh(r,t,l)},uh=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),dh=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=J(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>no(o,{...s,...e})(t)?!0:a.clearNodes()).command(({state:a})=>no(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fh=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=rt(n,0,r.content.size),o=D.create(r,i);e.setSelection(o)}return!0},hh=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=o.from,a=o.to),i&&t.doc.nodesBetween(s,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},ph=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=I.atStart(r).from,a=I.atEnd(r).to,l=rt(i,s,a),c=rt(o,s,a),u=I.create(r,l,c);e.setSelection(u)}return!0},mh=n=>({state:e,dispatch:t})=>{const r=J(n,e.schema);return ou(r)(e,t)};function Ho(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var gh=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=wn(c,a.node().type.name,a.node().attrs);if(o instanceof D&&o.node.isBlock)return!a.parentOffset||!Pe(s,a.pos)?!1:(r&&(n&&Ho(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:qf(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,p=Pe(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&Pe(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:u}]:void 0),r){if(p&&(o instanceof I&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&Ho(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},yh=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const a=J(n,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let y=v.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-x;R>=l.depth-3;R-=1)y=v.from(l.node(R).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,C={...wn(h,l.node().type.name,l.node().attrs),...e},k=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(C))||void 0;y=y.append(v.from(a.createAndFill(null,k)||void 0));const P=l.before(l.depth-(x-1));t.replace(P,l.after(-w),new S(y,4-x,0));let M=-1;t.doc.nodesBetween(P,t.doc.content.size,(R,_)=>{if(M>-1)return!1;R.isTextblock&&R.content.size===0&&(M=_+1)}),M>-1&&t.setSelection(I.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...wn(h,d.type.name,d.attrs),...e},g={...wn(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const m=f?[{type:a,attrs:p},{type:f,attrs:g}]:[{type:a,attrs:p}];if(!Pe(t.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:x}=r,{splittableMarks:w}=o.extensionManager,C=x||y.$to.parentOffset&&y.$from.marks();if(t.split(l.pos,2,m).scrollIntoView(),!C||!i)return!0;const k=C.filter(P=>w.includes(P.type.name));t.ensureMarks(k)}return!0},br=(n,e)=>{const t=Gn(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Ue(n.doc,t.pos)&&n.join(t.pos),!0},xr=(n,e)=>{const t=Gn(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&Ue(n.doc,r)&&n.join(r),!0},bh=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=J(n,s.schema),p=J(e,s.schema),{selection:g,storedMarks:m}=s,{$from:y,$to:x}=g,w=y.blockRange(x),C=m||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const k=Gn(P=>qo(P.type.name,d))(g);if(w.depth>=1&&k&&w.depth-k.depth<=1){if(k.node.type===f)return c.liftListItem(p);if(qo(k.node.type.name,d)&&f.validContent(k.node.content)&&a)return l().command(()=>(o.setNodeMarkup(k.pos,f),!0)).command(()=>br(o,f)).command(()=>xr(o,f)).run()}return!t||!C||!a?l().command(()=>u().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>br(o,f)).command(()=>xr(o,f)).run():l().command(()=>{const P=u().wrapInList(f,r),M=C.filter(R=>h.includes(R.type.name));return o.ensureMarks(M),P?!0:c.clearNodes()}).wrapInList(f,r).command(()=>br(o,f)).command(()=>xr(o,f)).run()},xh=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Ie(n,r.schema);return Hr(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},vh=(n,e,t={})=>({state:r,commands:i})=>{const o=J(n,r.schema),s=J(e,r.schema),a=tn(r,o,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...t})},kh=(n,e={})=>({state:t,commands:r})=>{const i=J(n,t.schema);return tn(t,i,e)?r.lift(i):r.wrapIn(i,e)},wh=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},Sh=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Mh=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=t,l=Ie(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:h,to:f}=a;const p=(o=c.marks().find(m=>m.type===l))==null?void 0:o.attrs,g=mi(c,l,p);g&&(h=g.from,f=g.to),t.removeMark(h,f,l)}else d.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},Ch=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let o,s;return typeof n=="number"?(o=n,s=n):n&&"from"in n&&"to"in n?(o=n.from,s=n.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},Nh=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const a=Kn(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(o=J(n,r.schema)),a==="mark"&&(s=Ie(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,p,g;t.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{o&&o===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),h=y,f=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&o&&o===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),h=y,f=m),y>=u&&y<=d&&(o&&o===m.type&&(l=!0,i&&t.setNodeMarkup(y,void 0,{...m.attrs,...e})),s&&m.marks.length&&m.marks.forEach(x=>{if(s===x.type&&(l=!0,i)){const w=Math.max(y,u),C=Math.min(y+m.nodeSize,d);t.addMark(w,C,s.create({...x.attrs,...e}))}}))}),f&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&i&&t.addMark(p,g,s.create({...m.attrs,...e}))}))}),l},Dh=(n,e={})=>({state:t,dispatch:r})=>{const i=J(n,t.schema);return Qc(i,e)(t,r)},Eh=(n,e={})=>({state:t,dispatch:r})=>{const i=J(n,t.schema);return Zc(i,e)(t,r)},Th=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Xn=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Oh=(n,e)=>{if(pi(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function gn(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=ih(c)+o;return s.forEach(h=>{if(u)return;const f=Oh(d,h.find);if(!f)return;const p=l.state.tr,g=Yn({state:l.state,transaction:p}),m={from:r-(f[0].length-o.length),to:i},{commands:y,chain:x,can:w}=new Un({editor:t,state:g});h.handler({state:g,range:m,match:f,commands:y,chain:x,can:w})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:o}),l.dispatch(p),u=!0)}),u}function Ah(n){const{editor:e,rules:t}=n,r=new ve({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=yi(v.from(u),s.schema);const{from:d}=l,h=d+u.length;gn({editor:e,from:d,to:h,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return gn({editor:e,from:o,to:s,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&gn({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?gn({editor:e,from:s.pos,to:s.pos,text:`
|
|
13
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Ph(n){return Object.prototype.toString.call(n).slice(8,-1)}function yn(n){return Ph(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Qa(n,e){const t={...n};return yn(n)&&yn(e)&&Object.keys(e).forEach(r=>{yn(e[r])&&yn(n[r])?t[r]=Qa(n[r],e[r]):t[r]=e[r]}),t}var xi=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...L(N(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...L(N(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Qa(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Rh=class Za extends xi{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Za(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>c?.type.name===t.name))return!1;const l=s.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Ih(n){return typeof n=="number"}var _h=class{constructor(n){this.find=n.find,this.handler=n.handler}},Bh=(n,e,t)=>{if(pi(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Fh(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Un({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(f,p)=>{var g,m,y,x,w;if((m=(g=f.type)==null?void 0:g.spec)!=null&&m.code||!(f.isText||f.isTextblock||f.isInline))return;const C=(w=(x=(y=f.content)==null?void 0:y.size)!=null?x:f.nodeSize)!=null?w:0,k=Math.max(r,p),P=Math.min(i,p+C);if(k>=P)return;const M=f.isText?f.text||"":f.textBetween(k-p,P-p,void 0,"");Bh(M,o.find,s).forEach(_=>{if(_.index===void 0)return;const re=k+_.index+1,yt=re+_[0].length,De={from:t.tr.mapping.map(re),to:t.tr.mapping.map(yt)},_e=o.handler({state:t,range:De,match:_,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(_e)})}),d.every(f=>f!==null)}var bn=null,zh=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Lh(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:f,pasteEvt:p})=>{const g=u.tr,m=Yn({state:u,transaction:g});if(!(!Fh({editor:e,state:m,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new ve({view(d){const h=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(bn=e)},f=()=>{bn&&(bn=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(o=r===d.dom.parentElement,a=h,!o){const f=bn;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return s=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!o,y=p.getMeta("applyPasteRules"),x=!!y;if(!g&&!m&&!x)return;if(x){let{text:k}=y;typeof k=="string"?k=k:k=yi(v.from(k),f.schema);const{from:P}=y,M=P+k.length,R=zh(k);return l({rule:u,state:f,from:P,to:{b:M},pasteEvt:R})}const w=h.doc.content.findDiffStart(f.doc.content),C=h.doc.content.findDiffEnd(f.doc.content);if(!(!Ih(w)||!C||w===C.b))return l({rule:u,state:f,from:w,to:C,pasteEvt:s})}}))}var Qn=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Ja(n),this.schema=Gf(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:It(e.name,this.schema)},r=N(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Jt([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:It(r.name,this.schema)},o=[],s=N(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&N(r,"exitable",i)&&(a.ArrowRight=()=>Rh.handleExit({editor:n,mark:r})),s){const h=Object.fromEntries(Object.entries(s()).map(([f,p])=>[f,()=>p({editor:n})]));a={...a,...h}}const l=Kd(a);o.push(l);const c=N(r,"addInputRules",i);if($o(r,n.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=Ah({editor:n,rules:h}),p=Array.isArray(f)?f:[f];o.push(...p)}}const u=N(r,"addPasteRules",i);if($o(r,n.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=Lh({editor:n,rules:h});o.push(...f)}}const d=N(r,"addProseMirrorPlugins",i);if(d){const h=d();o.push(...h)}return o})}get attributes(){return Ha(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ot(this.extensions);return Object.fromEntries(e.filter(t=>!!N(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:J(t.name,this.schema)},o=N(t,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const a=(l,c,u,d,h)=>{const f=nn(l,r);return s({node:l,view:c,getPos:u,decorations:d,innerDecorations:h,editor:n,extension:t,HTMLAttributes:f})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return Jt([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:It(i.name,this.schema)},s=N(i,"dispatchTransaction",o);return s?a=>{s.call(o,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return Jt([...this.extensions]).reduce((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:It(i.name,this.schema)},s=N(i,"transformPastedHTML",o);return s?(a,l)=>{const c=r(a,l);return s.call(o,c)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=Ot(this.extensions);return Object.fromEntries(e.filter(t=>!!N(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ie(t.name,this.schema)},o=N(t,"addMarkView",i);if(!o)return[];const s=(a,l,c)=>{const u=nn(a,r);return o()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{Zh(a,n,d)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:It(e.name,this.schema)};e.type==="mark"&&((t=L(N(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=N(e,"onBeforeCreate",r),o=N(e,"onCreate",r),s=N(e,"onUpdate",r),a=N(e,"onSelectionUpdate",r),l=N(e,"onTransaction",r),c=N(e,"onFocus",r),u=N(e,"onBlur",r),d=N(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Qn.resolve=Ja;Qn.sort=Jt;Qn.flatten=gi;var jh={};hi(jh,{ClipboardTextSerializer:()=>tl,Commands:()=>nl,Delete:()=>rl,Drop:()=>il,Editable:()=>ol,FocusEvents:()=>al,Keymap:()=>ll,Paste:()=>cl,Tabindex:()=>ul,TextDirection:()=>dl,focusEventsPluginKey:()=>sl});var Ne=class el extends xi{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new el(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},tl=Ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ve({key:new Ke("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=Ua(t);return Ya(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),nl=Ne.create({name:"commands",addCommands(){return{...Fa}}}),rl=Ne.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const o=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const u=$f(n.before,[n,...e]);rh(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,g)=>{const m=g+p.nodeSize-2,y=f.oldRange.from<=g&&m<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:m,newFrom:u.mapping.map(g),newTo:u.mapping.map(m),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,p)=>{var g,m;if(f instanceof me){const y=h.slice(p).map(f.from,-1),x=h.slice(p).map(f.to),w=h.invert().map(y,-1),C=h.invert().map(x),k=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(M=>M.eq(f.mark)),P=(m=u.doc.nodeAt(x))==null?void 0:m.marks.some(M=>M.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:w,to:C},newRange:{from:y,to:x},partial:!!(P||k),editor:this.editor,transaction:n,combinedTransform:u})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),il=Ne.create({name:"drop",addProseMirrorPlugins(){return[new ve({key:new Ke("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),ol=Ne.create({name:"editable",addProseMirrorPlugins(){return[new ve({key:new Ke("editable"),props:{editable:()=>this.editor.options.editable}})]}}),sl=new Ke("focusEvents"),al=Ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ve({key:sl,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ll=Ne.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:B.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Zt()||Wa()?o:i},addProseMirrorPlugins(){return[new ve({key:new Ke("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=B.atStart(e.doc).from,c=B.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!bi(t.doc))return;const h=t.tr,f=Yn({state:t,transaction:h}),{commands:p}=new Un({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),cl=Ne.create({name:"paste",addProseMirrorPlugins(){return[new ve({key:new Ke("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),ul=Ne.create({name:"tabindex",addProseMirrorPlugins(){return[new ve({key:new Ke("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),dl=Ne.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Ot(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ve({key:new Ke("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Vh=class Vt{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Vt(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Vt(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Vt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=t.isInline,a=this.pos+r+(o?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!s&&l.depth<=this.depth)return;const c=new Vt(l,this.editor,i,i||s?t:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>t[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Wh=`.ProseMirror {
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ProseMirror {
|
|
18
|
+
word-wrap: break-word;
|
|
19
|
+
white-space: pre-wrap;
|
|
20
|
+
white-space: break-spaces;
|
|
21
|
+
-webkit-font-variant-ligatures: none;
|
|
22
|
+
font-variant-ligatures: none;
|
|
23
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ProseMirror [contenteditable="false"] {
|
|
27
|
+
white-space: normal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ProseMirror pre {
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
img.ProseMirror-separator {
|
|
39
|
+
display: inline !important;
|
|
40
|
+
border: none !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
width: 0 !important;
|
|
43
|
+
height: 0 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ProseMirror-gapcursor {
|
|
47
|
+
display: none;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
position: absolute;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ProseMirror-gapcursor:after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -2px;
|
|
58
|
+
width: 20px;
|
|
59
|
+
border-top: 1px solid black;
|
|
60
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes ProseMirror-cursor-blink {
|
|
64
|
+
to {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ProseMirror-hideselection *::selection {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror-hideselection * {
|
|
78
|
+
caret-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
+
display: block;
|
|
83
|
+
}`;function $h(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var qh=class extends Th{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:sh,createMappablePosition:ah},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=ja(e,this.options.autofocus);this.editorState=St.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=$h(Wh,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=qa(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;t=t.filter(s=>!s.key.startsWith(o))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[ol,tl.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),nl,al,ll,ul,il,cl,rl,dl.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Qn(r,this)}createCommandManager(){this.commandManager=new Un({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=qr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=qr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new Ba(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const s=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return eh(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return oh(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return yi(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
|
|
84
|
+
|
|
85
|
+
`,textSerializers:t={}}=n||{};return Qf(this.state.doc,{blockSeparator:e,textSerializers:{...Ua(this.schema),...t}})}get isEmpty(){return bi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new Vh(e,this)}get $doc(){return this.$pos(0)}};function cb(n){return new Xn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=L(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=t.from+a.indexOf(s),u=c+s.length;if(Ka(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(g=>g===n.type&&g!==f.mark.type)).filter(f=>f.to>c).length)return null;u<t.to&&o.delete(u,t.to),c>t.from&&o.delete(t.from+l,c);const h=t.from+l+s.length;o.addMark(t.from+l,h,n.type.create(i||{})),o.removeStoredMark(n.type)}},undoable:n.undoable})}function ub(n){return new Xn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=L(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:n.undoable})}function db(n){return new Xn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=L(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)},undoable:n.undoable})}function fb(n){return new Xn({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=L(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),c=l&&Xr(l,n.type,o);if(!c)return null;if(s.wrap(l,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>f.includes(m.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ue(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)},undoable:n.undoable})}function hb(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof D){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function pb(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Hh={};hi(Hh,{createAtomBlockMarkdownSpec:()=>Jh,createBlockMarkdownSpec:()=>Yh,createInlineMarkdownSpec:()=>Gh,parseAttributes:()=>vi,parseIndentedBlocks:()=>Xh,renderNestedMarkdownContent:()=>Qh,serializeAttributes:()=>ki});function vi(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function ki(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Jh(n){const{nodeName:e,name:t,parseAttributes:r=vi,serializeAttributes:i=ki,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=n,l=t||e,c=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...o,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(f);if(!p)return;const g=p[1]||"",m=r(g);if(!s.find(x=>!(x in m)))return{type:e,raw:p[0],attributes:m}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function Yh(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=vi,serializeAttributes:o=ki,defaultAttributes:s={},content:a="block",allowedAttributes:l}=n,c=t||e,u=d=>{if(!l)return d;const h={};return l.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const g=r(d);f=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const p={...s,...d.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),m=d.match(g);if(!m)return;const[y,x=""]=m,w=i(x);let C=1;const k=y.length;let P="";const M=/^:::([\w-]*)(\s.*)?/gm,R=d.slice(k);for(M.lastIndex=0;;){const _=M.exec(R);if(_===null)break;const re=_.index,yt=_[1];if(!((p=_[2])!=null&&p.endsWith(":::"))){if(yt)C+=1;else if(C-=1,C===0){const De=R.slice(0,re);P=De.trim();const _e=d.slice(0,k+re+_[0].length);let ke=[];if(P)if(a==="block")for(ke=f.blockTokens(De),ke.forEach(pe=>{pe.text&&(!pe.tokens||pe.tokens.length===0)&&(pe.tokens=f.inlineTokens(pe.text))});ke.length>0;){const pe=ke[ke.length-1];if(pe.type==="paragraph"&&(!pe.text||pe.text.trim()===""))ke.pop();else break}else ke=f.inlineTokens(P);return{type:e,raw:_e,attributes:w,content:P,tokens:ke}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),p=o(f),g=p?` {${p}}`:"",m=h.renderChildren(d.content||[],`
|
|
86
|
+
|
|
87
|
+
`);return`:::${c}${g}
|
|
88
|
+
|
|
89
|
+
${m}
|
|
90
|
+
|
|
91
|
+
:::`}}}function Uh(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=t.exec(n)}return e}function Kh(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Gh(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Uh,serializeAttributes:o=Kh,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,u=h=>{if(!l)return h;const f={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in h){const y=h[g];if(m!==void 0&&y===m)return;f[g]=y}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...s,...h.attributes};if(a)return f.createNode(e,p);const g=r?r(h):h.content||"";return g?f.createNode(e,p,[f.createTextNode(g)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=h.match(f),g=p?.index;return g!==void 0?g:-1},tokenize(h,f,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=h.match(g);if(!m)return;let y="",x="";if(a){const[,C]=m;x=C}else{const[,C,k]=m;x=C,y=k||""}const w=i(x.trim());return{type:e,raw:m[0],content:y.trim(),attributes:w}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(h.attrs||{}),g=o(p),m=g?` ${g}`:"";return a?`[${c}${m}]`:`[${c}${m}]${f}[/${c}]`}}}function Xh(n,e,t){var r,i,o,s;const a=n.split(`
|
|
92
|
+
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const h=a[u],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
|
|
93
|
+
`;continue}else return}const p=e.extractItemData(f),{indentLevel:g,mainContent:m}=p;c=`${c}${h}
|
|
94
|
+
`;const y=[m];for(u+=1;u<a.length;){const k=a[u];if(k.trim()===""){const M=a.slice(u+1).findIndex(re=>re.trim()!=="");if(M===-1)break;if((((i=(r=a[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>g){y.push(k),c=`${c}${k}
|
|
95
|
+
`,u+=1;continue}else break}if((((s=(o=k.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>g)y.push(k),c=`${c}${k}
|
|
96
|
+
`,u+=1;else break}let x;const w=y.slice(1);if(w.length>0){const k=w.map(P=>P.slice(g+d)).join(`
|
|
97
|
+
`);k.trim()&&(e.customNestedParser?x=e.customNestedParser(k):x=t.blockTokens(k))}const C=e.createToken(p,x);l.push(C)}if(l.length!==0)return{items:l,raw:c}}function Qh(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[o,...s]=n.content,a=e.renderChildren([o]);let l=`${i}${a}`;return s&&s.length>0&&s.forEach((c,u)=>{var d,h;const f=(h=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?h:e.renderChildren([c]);if(f!=null){const p=f.split(`
|
|
98
|
+
`).map(g=>g?e.indent(g):e.indent("")).join(`
|
|
99
|
+
`);l+=c.type==="paragraph"?`
|
|
100
|
+
|
|
101
|
+
${p}`:`
|
|
102
|
+
${p}`}}),l}function Zh(n,e,t={}){const{state:r}=e,{doc:i,tr:o}=r,s=n;i.descendants((a,l)=>{const c=o.mapping.map(l),u=o.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(f=>{if(f!==s)return!1;d=f}),!d)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==d.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});o.removeMark(c,u,n.type),o.addMark(c,u,f)}}),o.docChanged&&e.view.dispatch(o)}var ep=class fl extends xi{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new fl(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},tp=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,r,i,o,s,a;const{view:l}=this.editor,c=n.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const x=this.dom.getBoundingClientRect(),w=u.getBoundingClientRect(),C=(i=n.offsetX)!=null?i:(r=n.nativeEvent)==null?void 0:r.offsetX,k=(s=n.offsetY)!=null?s:(o=n.nativeEvent)==null?void 0:o.offsetY;d=w.x-x.x+C,h=w.y-x.y+k}const f=this.dom.cloneNode(!0);try{const x=this.dom.getBoundingClientRect();f.style.width=`${Math.round(x.width)}px`,f.style.height=`${Math.round(x.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(a=n.dataTransfer)==null||a.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const m=D.create(l.state.doc,g),y=l.state.tr.setSelection(m);l.dispatch(y)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=n.type.startsWith("drag"),o=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!o&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=D.isSelectable(this.node),d=n.type==="copy",h=n.type==="paste",f=n.type==="cut",p=n.type==="mousedown";if(!c&&u&&i&&n.target===this.dom&&n.preventDefault(),c&&i&&!l&&n.target===this.dom)return n.preventDefault(),!1;if(c&&a&&!l&&p){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||o||d||h||f||p&&u)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(Zt()||$r())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function mb(n){return new _h({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=L(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),h=d+a.length;if(Ka(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===n.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;h<t.to&&s.delete(h,t.to),d>t.from&&s.delete(t.from+u,d),c=t.from+u+a.length,s.addMark(t.from+u,c,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}const{getOwnPropertyNames:np,getOwnPropertySymbols:rp}=Object,{hasOwnProperty:ip}=Object.prototype;function vr(n,e){return function(r,i,o){return n(r,i,o)&&e(r,i,o)}}function xn(n){return function(t,r,i){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,i);const{cache:o}=i,s=o.get(t),a=o.get(r);if(s&&a)return s===r&&a===t;o.set(t,r),o.set(r,t);const l=n(t,r,i);return o.delete(t),o.delete(r),l}}function op(n){return n?.[Symbol.toStringTag]}function Jo(n){return np(n).concat(rp(n))}const sp=Object.hasOwn||((n,e)=>ip.call(n,e));function mt(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const ap="__v",lp="__o",cp="_owner",{getOwnPropertyDescriptor:Yo,keys:Uo}=Object;function up(n,e){return n.byteLength===e.byteLength&&Fn(new Uint8Array(n),new Uint8Array(e))}function dp(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function fp(n,e){return n.byteLength===e.byteLength&&Fn(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function hp(n,e){return mt(n.getTime(),e.getTime())}function pp(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function mp(n,e){return n===e}function Ko(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=n.entries();let s,a,l=0;for(;(s=o.next())&&!s.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(i[d]){d++;continue}const h=s.value,f=a.value;if(t.equals(h[0],f[0],l,d,n,e,t)&&t.equals(h[1],f[1],h[0],f[0],n,e,t)){u=i[d]=!0;break}d++}if(!u)return!1;l++}return!0}const gp=mt;function yp(n,e,t){const r=Uo(n);let i=r.length;if(Uo(e).length!==i)return!1;for(;i-- >0;)if(!hl(n,e,t,r[i]))return!1;return!0}function _t(n,e,t){const r=Jo(n);let i=r.length;if(Jo(e).length!==i)return!1;let o,s,a;for(;i-- >0;)if(o=r[i],!hl(n,e,t,o)||(s=Yo(n,o),a=Yo(e,o),(s||a)&&(!s||!a||s.configurable!==a.configurable||s.enumerable!==a.enumerable||s.writable!==a.writable)))return!1;return!0}function bp(n,e){return mt(n.valueOf(),e.valueOf())}function xp(n,e){return n.source===e.source&&n.flags===e.flags}function Go(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=n.values();let s,a;for(;(s=o.next())&&!s.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!i[u]&&t.equals(s.value,a.value,s.value,a.value,n,e,t)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function Fn(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function vp(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function hl(n,e,t,r){return(r===cp||r===lp||r===ap)&&(n.$$typeof||e.$$typeof)?!0:sp(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const kp="[object ArrayBuffer]",wp="[object Arguments]",Sp="[object Boolean]",Mp="[object DataView]",Cp="[object Date]",Np="[object Error]",Dp="[object Map]",Ep="[object Number]",Tp="[object Object]",Op="[object RegExp]",Ap="[object Set]",Pp="[object String]",Rp={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Ip="[object URL]",_p=Object.prototype.toString;function Bp({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:f,unknownTagComparators:p}){return function(m,y,x){if(m===y)return!0;if(m==null||y==null)return!1;const w=typeof m;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?a(m,y,x):w==="function"?o(m,y,x):!1;const C=m.constructor;if(C!==y.constructor)return!1;if(C===Object)return l(m,y,x);if(Array.isArray(m))return e(m,y,x);if(C===Date)return r(m,y,x);if(C===RegExp)return u(m,y,x);if(C===Map)return s(m,y,x);if(C===Set)return d(m,y,x);const k=_p.call(m);if(k===Cp)return r(m,y,x);if(k===Op)return u(m,y,x);if(k===Dp)return s(m,y,x);if(k===Ap)return d(m,y,x);if(k===Tp)return typeof m.then!="function"&&typeof y.then!="function"&&l(m,y,x);if(k===Ip)return f(m,y,x);if(k===Np)return i(m,y,x);if(k===wp)return l(m,y,x);if(Rp[k])return h(m,y,x);if(k===kp)return n(m,y,x);if(k===Mp)return t(m,y,x);if(k===Sp||k===Ep||k===Pp)return c(m,y,x);if(p){let P=p[k];if(!P){const M=op(m);M&&(P=p[M])}if(P)return P(m,y,x)}return!1}}function Fp({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:up,areArraysEqual:t?_t:dp,areDataViewsEqual:fp,areDatesEqual:hp,areErrorsEqual:pp,areFunctionsEqual:mp,areMapsEqual:t?vr(Ko,_t):Ko,areNumbersEqual:gp,areObjectsEqual:t?_t:yp,arePrimitiveWrappersEqual:bp,areRegExpsEqual:xp,areSetsEqual:t?vr(Go,_t):Go,areTypedArraysEqual:t?vr(Fn,_t):Fn,areUrlsEqual:vp,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const i=xn(r.areArraysEqual),o=xn(r.areMapsEqual),s=xn(r.areObjectsEqual),a=xn(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:a})}return r}function zp(n){return function(e,t,r,i,o,s,a){return n(e,t,a)}}function Lp({circular:n,comparator:e,createState:t,equals:r,strict:i}){if(t)return function(a,l){const{cache:c=n?new WeakMap:void 0,meta:u}=t();return e(a,l,{cache:c,equals:r,meta:u,strict:i})};if(n)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,o)}}const jp=Xe();Xe({strict:!0});Xe({circular:!0});Xe({circular:!0,strict:!0});Xe({createInternalComparator:()=>mt});Xe({strict:!0,createInternalComparator:()=>mt});Xe({circular:!0,createInternalComparator:()=>mt});Xe({circular:!0,createInternalComparator:()=>mt,strict:!0});function Xe(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:i=!1}=n,o=Fp(n),s=Bp(o),a=t?t(s):zp(s);return Lp({circular:e,comparator:s,createState:r,equals:a,strict:i})}var Vp=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Wp=({contentComponent:n})=>{const e=cs.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return b.jsx(b.Fragment,{children:Object.values(e)})};function $p(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:jl.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}var qp=class extends lt.Component{constructor(n){var e;super(n),this.editorContentRef=lt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=n.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&((n=e.view.dom)!=null&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=$p(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var n;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:Vp(e,this.editorContentRef),...t}),n?.contentComponent&&b.jsx(Wp,{contentComponent:n.contentComponent})]})}},Hp=O.forwardRef((n,e)=>{const t=lt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return lt.createElement(qp,{key:t,innerRef:e,...n})}),Jp=lt.memo(Hp),Yp=typeof window<"u"?O.useLayoutEffect:O.useEffect,Up=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Kp(n){var e;const[t]=O.useState(()=>new Up(n.editor)),r=zl.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:jp);return Yp(()=>t.watch(n.editor),[n.editor,t]),O.useDebugValue(r),r}var Gp=!1,Jr=typeof window>"u",Xp=Jr||!!(typeof window<"u"&&window.next),Qp=class pl{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Jr||Xp?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)==null?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)==null?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)==null?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)==null?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)==null?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)==null?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)==null?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)==null?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)==null?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)==null?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)==null?void 0:o.call(i,...r)},onDelete:(...r)=>{var i,o;return(o=(i=this.options.current).onDelete)==null?void 0:o.call(i,...r)}};return new qh(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=t.extensions)==null?void 0:s[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?pl.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function gb(n={},e=[]){const t=O.useRef(n);t.current=n;const[r]=O.useState(()=>new Qp(t)),i=cs.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(i),O.useEffect(r.onRender(e)),Kp({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&o===0?0:o+1}),i}var wi=O.createContext({editor:null});wi.Consumer;var yb=()=>O.useContext(wi),ml=O.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Zp=()=>O.useContext(ml),em=lt.forwardRef((n,e)=>{const{onDragStart:t}=Zp(),r=n.as||"div";return b.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Xo(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Qo(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function tm(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function nm(n){if(Xo(n)||Qo(n))return!0;if(tm(n)){const e=n.type;if(e)return Xo(e)||Qo(e)}return!1}function rm(){try{if(O.version)return parseInt(O.version.split(".")[0],10)>=19}catch{}return!1}var im=class{constructor(n,{editor:e,props:t={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=n,this.editor=e,this.props=t,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Ll.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var n;if(this.destroyed)return;const e=this.component,t=this.props,r=this.editor,i=rm(),o=nm(e),s={...t};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=a=>{this.ref=a}),this.reactElement=b.jsx(e,{...s}),(n=r?.contentComponent)==null||n.setRenderer(this.id,this)}updateProps(n={}){this.destroyed||(this.props={...this.props,...n},this.render())}destroy(){var n;this.destroyed=!0;const e=this.editor;(n=e?.contentComponent)==null||n.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(n){Object.keys(n).forEach(e=>{this.element.setAttribute(e,n[e])})}};lt.createContext({markViewContentRef:()=>{}});var om=class extends tp{constructor(n,e,t){if(super(n,e,t),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,r,i){var o;return r==="storage"?(o=n.storage[e.name])!=null?o:{}:Reflect.get(t,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:O.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,o=O.memo(l=>b.jsx(ml.Provider,{value:r,children:O.createElement(i,l)}));o.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new im(o,{editor:this.editor,props:n,as:s,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var n;if(this.renderer.element.firstElementChild&&!((n=this.renderer.element.firstElementChild)!=null&&n.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(n,e,t){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(n.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:o,newNode:n,newDecorations:e,oldInnerDecorations:s,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}return n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,r({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let n={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=nn(this.node,e);n=this.options.attrs({node:this.node,HTMLAttributes:t})}else n=this.options.attrs;this.renderer.updateAttributes(n)}}};function sm(n,e){return t=>t.editor.contentComponent?new om(n,t,e):{}}var Si=O.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Si.displayName="TiptapContext";var am=()=>O.useContext(Si);function gl({editor:n,instance:e,children:t}){const r=n??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=O.useMemo(()=>({editor:r}),[r]),o=O.useMemo(()=>({editor:r}),[r]);return b.jsx(wi.Provider,{value:o,children:b.jsx(Si.Provider,{value:i,children:t})})}gl.displayName="Tiptap";function yl({...n}){const{editor:e}=am();return b.jsx(Jp,{editor:e,...n})}yl.displayName="Tiptap.Content";Object.assign(gl,{Content:yl});function lm(n){return n.storage.mention}function bb(n,e,t){n.chain().focus().insertContentAt(e,[cm(t),{type:"text",text:" "}]).run()}function cm(n){return{type:"mention",attrs:n}}function um(n){const e=us.c(21),{node:t,selected:r,view:i,editor:o,getPos:s}=n,{name:a,char:l,kind:c,id:u,args:d}=t.attrs,h=r&&i.editable,f=c==="task",p=l==="@",g=i.editable&&l==="/"&&(c==="prompt"||c==null);let m;e[0]!==d||e[1]!==o||e[2]!==s||e[3]!==u||e[4]!==g||e[5]!==a?(m=re=>{if(!g)return;const De=lm(o)?.onEditChip;if(!De||typeof s!="function")return;const _e=s();typeof _e=="number"&&(re.preventDefault(),re.stopPropagation(),De({promptId:u,promptName:a,args:d??{},pos:_e}))},e[0]=d,e[1]=o,e[2]=s,e[3]=u,e[4]=g,e[5]=a,e[6]=m):m=e[6];const y=m,x=g?"cursor-pointer":"cursor-default",w=p?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",C=h&&"outline-2 outline-blue-300 outline-offset-0",k=g&&"hover:brightness-95",P=!f&&"capitalize";let M;e[7]!==x||e[8]!==w||e[9]!==C||e[10]!==k||e[11]!==P?(M=et("px-1 py-1 rounded","inline-flex items-center gap-1",x,"select-none","text-xs font-light",w,C,k,P),e[7]=x,e[8]=w,e[9]=C,e[10]=k,e[11]=P,e[12]=M):M=e[12];let R;e[13]!==f||e[14]!==a?(R=f?b.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:a??""}):a?$l(a):"",e[13]=f,e[14]=a,e[15]=R):R=e[15];let _;return e[16]!==l||e[17]!==y||e[18]!==M||e[19]!==R?(_=b.jsxs(em,{onClick:y,className:M,children:[l,R]}),e[16]=l,e[17]=y,e[18]=M,e[19]=R,e[20]=_):_=e[20],_}const xb=ep.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id")||null,renderHTML:n=>n.id?{"data-id":n.id}:{}},name:{default:null,parseHTML:n=>n.getAttribute("data-name")||null,renderHTML:n=>n.name?{"data-name":n.name}:{}},char:{default:"/",parseHTML:n=>n.getAttribute("data-char")||"/",renderHTML:n=>n.char?{"data-char":n.char}:{}},metadata:{default:null,parseHTML:n=>{try{return JSON.parse(n.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:n=>n.metadata?{"data-metadata":JSON.stringify(n.metadata)}:{}},kind:{default:null,parseHTML:n=>n.getAttribute("data-kind")||null,renderHTML:n=>n.kind?{"data-kind":n.kind}:{}},args:{default:null,parseHTML:n=>{try{return JSON.parse(n.getAttribute("data-args")||"null")}catch{return null}},renderHTML:n=>n.args?{"data-args":JSON.stringify(n.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:n,HTMLAttributes:e}){const t={"data-type":"mention"};return n.attrs.id&&(t["data-id"]=n.attrs.id),n.attrs.name&&(t["data-name"]=n.attrs.name),n.attrs.char&&(t["data-char"]=n.attrs.char),n.attrs.metadata&&(t["data-metadata"]=JSON.stringify(n.attrs.metadata)),n.attrs.kind&&(t["data-kind"]=n.attrs.kind),n.attrs.args&&(t["data-args"]=JSON.stringify(n.attrs.args)),["span",{...e,...t}]},renderText({node:n}){const e=n.attrs.char??"@",t=n.attrs.name??"";return`${e}${t}`},addNodeView(){return sm(um)}});function F(n){const e=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&e==="[object Date]"?new n.constructor(+n):typeof n=="number"||e==="[object Number]"||typeof n=="string"||e==="[object String]"?new Date(n):new Date(NaN)}function ce(n,e){return n instanceof Date?new n.constructor(e):new Date(e)}function ee(n,e){const t=F(n);return isNaN(e)?ce(n,NaN):(e&&t.setDate(t.getDate()+e),t)}function be(n,e){const t=F(n);if(isNaN(e))return ce(n,NaN);if(!e)return t;const r=t.getDate(),i=ce(n,t.getTime());i.setMonth(t.getMonth()+e+1,0);const o=i.getDate();return r>=o?i:(t.setFullYear(i.getFullYear(),i.getMonth(),r),t)}const Mi=6048e5,dm=864e5;let fm={};function ln(){return fm}function Ce(n,e){const t=ln(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=F(n),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function ht(n){return Ce(n,{weekStartsOn:1})}function bl(n){const e=F(n),t=e.getFullYear(),r=ce(n,0);r.setFullYear(t+1,0,4),r.setHours(0,0,0,0);const i=ht(r),o=ce(n,0);o.setFullYear(t,0,4),o.setHours(0,0,0,0);const s=ht(o);return e.getTime()>=i.getTime()?t+1:e.getTime()>=s.getTime()?t:t-1}function At(n){const e=F(n);return e.setHours(0,0,0,0),e}function zn(n){const e=F(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function we(n,e){const t=At(n),r=At(e),i=+t-zn(t),o=+r-zn(r);return Math.round((i-o)/dm)}function hm(n){const e=bl(n),t=ce(n,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),ht(t)}function Yr(n,e){const t=e*7;return ee(n,t)}function pm(n,e){return be(n,e*12)}function mm(n){let e;return n.forEach(function(t){const r=F(t);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function gm(n){let e;return n.forEach(t=>{const r=F(t);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function ie(n,e){const t=At(n),r=At(e);return+t==+r}function Ci(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function ym(n){if(!Ci(n)&&typeof n!="number")return!1;const e=F(n);return!isNaN(Number(e))}function rn(n,e){const t=F(n),r=F(e),i=t.getFullYear()-r.getFullYear(),o=t.getMonth()-r.getMonth();return i*12+o}function bm(n,e,t){const r=Ce(n,t),i=Ce(e,t),o=+r-zn(r),s=+i-zn(i);return Math.round((o-s)/Mi)}function Ni(n){const e=F(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function se(n){const e=F(n);return e.setDate(1),e.setHours(0,0,0,0),e}function xl(n){const e=F(n),t=ce(n,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Di(n,e){const t=ln(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,i=F(n),o=i.getDay(),s=(o<r?-7:0)+6-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function vl(n){return Di(n,{weekStartsOn:1})}const xm={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},vm=(n,e,t)=>{let r;const i=xm[n];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+r:r+" ago":r};function kr(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const km={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wm={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Sm={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mm={date:kr({formats:km,defaultWidth:"full"}),time:kr({formats:wm,defaultWidth:"full"}),dateTime:kr({formats:Sm,defaultWidth:"full"})},Cm={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Nm=(n,e,t,r)=>Cm[n];function Bt(n){return(e,t)=>{const r=t?.context?String(t.context):"standalone";let i;if(r==="formatting"&&n.formattingValues){const s=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):s;i=n.formattingValues[a]||n.formattingValues[s]}else{const s=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;i=n.values[a]||n.values[s]}const o=n.argumentCallback?n.argumentCallback(e):e;return i[o]}}const Dm={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Em={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Tm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Om={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Am={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Pm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Rm=(n,e)=>{const t=Number(n),r=t%100;if(r>20||r<10)switch(r%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Im={ordinalNumber:Rm,era:Bt({values:Dm,defaultWidth:"wide"}),quarter:Bt({values:Em,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Bt({values:Tm,defaultWidth:"wide"}),day:Bt({values:Om,defaultWidth:"wide"}),dayPeriod:Bt({values:Am,defaultWidth:"wide",formattingValues:Pm,defaultFormattingWidth:"wide"})};function Ft(n){return(e,t={})=>{const r=t.width,i=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],o=e.match(i);if(!o)return null;const s=o[0],a=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Bm(a,d=>d.test(s)):_m(a,d=>d.test(s));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(s.length);return{value:c,rest:u}}}function _m(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function Bm(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function Fm(n){return(e,t={})=>{const r=e.match(n.matchPattern);if(!r)return null;const i=r[0],o=e.match(n.parsePattern);if(!o)return null;let s=n.valueCallback?n.valueCallback(o[0]):o[0];s=t.valueCallback?t.valueCallback(s):s;const a=e.slice(i.length);return{value:s,rest:a}}}const zm=/^(\d+)(th|st|nd|rd)?/i,Lm=/\d+/i,jm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Vm={any:[/^b/i,/^(a|c)/i]},Wm={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$m={any:[/1/i,/2/i,/3/i,/4/i]},qm={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Hm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Jm={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ym={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Um={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Km={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Gm={ordinalNumber:Fm({matchPattern:zm,parsePattern:Lm,valueCallback:n=>parseInt(n,10)}),era:Ft({matchPatterns:jm,defaultMatchWidth:"wide",parsePatterns:Vm,defaultParseWidth:"any"}),quarter:Ft({matchPatterns:Wm,defaultMatchWidth:"wide",parsePatterns:$m,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ft({matchPatterns:qm,defaultMatchWidth:"wide",parsePatterns:Hm,defaultParseWidth:"any"}),day:Ft({matchPatterns:Jm,defaultMatchWidth:"wide",parsePatterns:Ym,defaultParseWidth:"any"}),dayPeriod:Ft({matchPatterns:Um,defaultMatchWidth:"any",parsePatterns:Km,defaultParseWidth:"any"})},kl={code:"en-US",formatDistance:vm,formatLong:Mm,formatRelative:Nm,localize:Im,match:Gm,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Xm(n){const e=F(n);return we(e,xl(e))+1}function wl(n){const e=F(n),t=+ht(e)-+hm(e);return Math.round(t/Mi)+1}function Sl(n,e){const t=F(n),r=t.getFullYear(),i=ln(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=ce(n,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=Ce(s,e),l=ce(n,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=Ce(l,e);return t.getTime()>=a.getTime()?r+1:t.getTime()>=c.getTime()?r:r-1}function Qm(n,e){const t=ln(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,i=Sl(n,e),o=ce(n,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Ce(o,e)}function Ml(n,e){const t=F(n),r=+Ce(t,e)-+Qm(t,e);return Math.round(r/Mi)+1}function z(n,e){const t=n<0?"-":"",r=Math.abs(n).toString().padStart(e,"0");return t+r}const Be={y(n,e){const t=n.getFullYear(),r=t>0?t:1-t;return z(e==="yy"?r%100:r,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):z(t+1,2)},d(n,e){return z(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return z(n.getHours()%12||12,e.length)},H(n,e){return z(n.getHours(),e.length)},m(n,e){return z(n.getMinutes(),e.length)},s(n,e){return z(n.getSeconds(),e.length)},S(n,e){const t=e.length,r=n.getMilliseconds(),i=Math.trunc(r*Math.pow(10,t-3));return z(i,e.length)}},vt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Zo={G:function(n,e,t){const r=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(r,{width:"abbreviated"});case"GGGGG":return t.era(r,{width:"narrow"});default:return t.era(r,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const r=n.getFullYear(),i=r>0?r:1-r;return t.ordinalNumber(i,{unit:"year"})}return Be.y(n,e)},Y:function(n,e,t,r){const i=Sl(n,r),o=i>0?i:1-i;if(e==="YY"){const s=o%100;return z(s,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):z(o,e.length)},R:function(n,e){const t=bl(n);return z(t,e.length)},u:function(n,e){const t=n.getFullYear();return z(t,e.length)},Q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return z(r,2);case"Qo":return t.ordinalNumber(r,{unit:"quarter"});case"QQQ":return t.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(r,{width:"narrow",context:"formatting"});default:return t.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,e,t){const r=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return z(r,2);case"qo":return t.ordinalNumber(r,{unit:"quarter"});case"qqq":return t.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(r,{width:"narrow",context:"standalone"});default:return t.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,e,t){const r=n.getMonth();switch(e){case"M":case"MM":return Be.M(n,e);case"Mo":return t.ordinalNumber(r+1,{unit:"month"});case"MMM":return t.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(r,{width:"narrow",context:"formatting"});default:return t.month(r,{width:"wide",context:"formatting"})}},L:function(n,e,t){const r=n.getMonth();switch(e){case"L":return String(r+1);case"LL":return z(r+1,2);case"Lo":return t.ordinalNumber(r+1,{unit:"month"});case"LLL":return t.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(r,{width:"narrow",context:"standalone"});default:return t.month(r,{width:"wide",context:"standalone"})}},w:function(n,e,t,r){const i=Ml(n,r);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):z(i,e.length)},I:function(n,e,t){const r=wl(n);return e==="Io"?t.ordinalNumber(r,{unit:"week"}):z(r,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):Be.d(n,e)},D:function(n,e,t){const r=Xm(n);return e==="Do"?t.ordinalNumber(r,{unit:"dayOfYear"}):z(r,e.length)},E:function(n,e,t){const r=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},e:function(n,e,t,r){const i=n.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return z(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(n,e,t,r){const i=n.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return z(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(n,e,t){const r=n.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return z(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},a:function(n,e,t){const i=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,e,t){const r=n.getHours();let i;switch(r===12?i=vt.noon:r===0?i=vt.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(n,e,t){const r=n.getHours();let i;switch(r>=17?i=vt.evening:r>=12?i=vt.afternoon:r>=4?i=vt.morning:i=vt.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let r=n.getHours()%12;return r===0&&(r=12),t.ordinalNumber(r,{unit:"hour"})}return Be.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):Be.H(n,e)},K:function(n,e,t){const r=n.getHours()%12;return e==="Ko"?t.ordinalNumber(r,{unit:"hour"}):z(r,e.length)},k:function(n,e,t){let r=n.getHours();return r===0&&(r=24),e==="ko"?t.ordinalNumber(r,{unit:"hour"}):z(r,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):Be.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):Be.s(n,e)},S:function(n,e){return Be.S(n,e)},X:function(n,e,t){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ts(r);case"XXXX":case"XX":return Qe(r);default:return Qe(r,":")}},x:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"x":return ts(r);case"xxxx":case"xx":return Qe(r);default:return Qe(r,":")}},O:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+es(r,":");default:return"GMT"+Qe(r,":")}},z:function(n,e,t){const r=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+es(r,":");default:return"GMT"+Qe(r,":")}},t:function(n,e,t){const r=Math.trunc(n.getTime()/1e3);return z(r,e.length)},T:function(n,e,t){const r=n.getTime();return z(r,e.length)}};function es(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),i=Math.trunc(r/60),o=r%60;return o===0?t+String(i):t+String(i)+e+z(o,2)}function ts(n,e){return n%60===0?(n>0?"-":"+")+z(Math.abs(n)/60,2):Qe(n,e)}function Qe(n,e=""){const t=n>0?"-":"+",r=Math.abs(n),i=z(Math.trunc(r/60),2),o=z(r%60,2);return t+i+e+o}const ns=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Cl=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Zm=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],r=t[1],i=t[2];if(!i)return ns(n,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",ns(r,e)).replace("{{time}}",Cl(i,e))},eg={p:Cl,P:Zm},tg=/^D+$/,ng=/^Y+$/,rg=["D","DD","YY","YYYY"];function ig(n){return tg.test(n)}function og(n){return ng.test(n)}function sg(n,e,t){const r=ag(n,e,t);if(console.warn(r),rg.includes(n))throw new RangeError(r)}function ag(n,e,t){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${r} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const lg=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,cg=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ug=/^'([^]*?)'?$/,dg=/''/g,fg=/[a-zA-Z]/;function gt(n,e,t){const r=ln(),i=t?.locale??r.locale??kl,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=F(n);if(!ym(a))throw new RangeError("Invalid time value");let l=e.match(cg).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=eg[d];return h(u,i.formatLong)}return u}).join("").match(lg).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:hg(u)};if(Zo[d])return{isToken:!0,value:u};if(d.match(fg))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!t?.useAdditionalWeekYearTokens&&og(d)||!t?.useAdditionalDayOfYearTokens&&ig(d))&&sg(d,e,String(n));const h=Zo[d[0]];return h(a,d,i.localize,c)}).join("")}function hg(n){const e=n.match(ug);return e?e[1].replace(dg,"'"):n}function pg(n){const e=F(n),t=e.getFullYear(),r=e.getMonth(),i=ce(n,0);return i.setFullYear(t,r+1,0),i.setHours(0,0,0,0),i.getDate()}function mg(n){return Math.trunc(+F(n)/1e3)}function gg(n){const e=F(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(0,0,0,0),e}function yg(n,e){return bm(gg(n),se(n),e)+1}function Ur(n,e){const t=F(n),r=F(e);return t.getTime()>r.getTime()}function Nl(n,e){const t=F(n),r=F(e);return+t<+r}function Ei(n,e){const t=F(n),r=F(e);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()}function bg(n,e){const t=F(n),r=F(e);return t.getFullYear()===r.getFullYear()}function wr(n,e){return ee(n,-e)}function Sr(n,e){const t=F(n),r=t.getFullYear(),i=t.getDate(),o=ce(n,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const s=pg(o);return t.setMonth(e,Math.min(i,s)),t}function rs(n,e){const t=F(n);return isNaN(+t)?ce(n,NaN):(t.setFullYear(e),t)}var T=function(){return T=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},T.apply(this,arguments)};function xg(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function Dl(n,e,t){for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}function cn(n){return n.mode==="multiple"}function un(n){return n.mode==="range"}function Zn(n){return n.mode==="single"}var vg={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function kg(n,e){return gt(n,"LLLL y",e)}function wg(n,e){return gt(n,"d",e)}function Sg(n,e){return gt(n,"LLLL",e)}function Mg(n){return"".concat(n)}function Cg(n,e){return gt(n,"cccccc",e)}function Ng(n,e){return gt(n,"yyyy",e)}var Dg=Object.freeze({__proto__:null,formatCaption:kg,formatDay:wg,formatMonthCaption:Sg,formatWeekNumber:Mg,formatWeekdayName:Cg,formatYearCaption:Ng}),Eg=function(n,e,t){return gt(n,"do MMMM (EEEE)",t)},Tg=function(){return"Month: "},Og=function(){return"Go to next month"},Ag=function(){return"Go to previous month"},Pg=function(n,e){return gt(n,"cccc",e)},Rg=function(n){return"Week n. ".concat(n)},Ig=function(){return"Year: "},_g=Object.freeze({__proto__:null,labelDay:Eg,labelMonthDropdown:Tg,labelNext:Og,labelPrevious:Ag,labelWeekNumber:Rg,labelWeekday:Pg,labelYearDropdown:Ig});function Bg(){var n="buttons",e=vg,t=kl,r={},i={},o=1,s={},a=new Date;return{captionLayout:n,classNames:e,formatters:Dg,labels:_g,locale:t,modifiersClassNames:r,modifiers:i,numberOfMonths:o,styles:s,today:a,mode:"default"}}function Fg(n){var e=n.fromYear,t=n.toYear,r=n.fromMonth,i=n.toMonth,o=n.fromDate,s=n.toDate;return r?o=se(r):e&&(o=new Date(e,0,1)),i?s=Ni(i):t&&(s=new Date(t,11,31)),{fromDate:o?At(o):void 0,toDate:s?At(s):void 0}}var El=O.createContext(void 0);function zg(n){var e,t=n.initialProps,r=Bg(),i=Fg(t),o=i.fromDate,s=i.toDate,a=(e=t.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!o||!s)&&(a="buttons");var l;(Zn(t)||cn(t)||un(t))&&(l=t.onSelect);var c=T(T(T({},r),t),{captionLayout:a,classNames:T(T({},r.classNames),t.classNames),components:T({},t.components),formatters:T(T({},r.formatters),t.formatters),fromDate:o,labels:T(T({},r.labels),t.labels),mode:t.mode||r.mode,modifiers:T(T({},r.modifiers),t.modifiers),modifiersClassNames:T(T({},r.modifiersClassNames),t.modifiersClassNames),onSelect:l,styles:T(T({},r.styles),t.styles),toDate:s});return b.jsx(El.Provider,{value:c,children:n.children})}function V(){var n=O.useContext(El);if(!n)throw new Error("useDayPicker must be used within a DayPickerProvider.");return n}function Tl(n){var e=V(),t=e.locale,r=e.classNames,i=e.styles,o=e.formatters.formatCaption;return b.jsx("div",{className:r.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:n.id,children:o(n.displayMonth,{locale:t})})}function Lg(n){return b.jsx("svg",T({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},n,{children:b.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Ol(n){var e,t,r=n.onChange,i=n.value,o=n.children,s=n.caption,a=n.className,l=n.style,c=V(),u=(t=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&t!==void 0?t:Lg;return b.jsxs("div",{className:a,style:l,children:[b.jsx("span",{className:c.classNames.vhidden,children:n["aria-label"]}),b.jsx("select",{name:n.name,"aria-label":n["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:i,onChange:r,children:o}),b.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,b.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function jg(n){var e,t=V(),r=t.fromDate,i=t.toDate,o=t.styles,s=t.locale,a=t.formatters.formatMonthCaption,l=t.classNames,c=t.components,u=t.labels.labelMonthDropdown;if(!r)return b.jsx(b.Fragment,{});if(!i)return b.jsx(b.Fragment,{});var d=[];if(bg(r,i))for(var h=se(r),f=r.getMonth();f<=i.getMonth();f++)d.push(Sr(h,f));else for(var h=se(new Date),f=0;f<=11;f++)d.push(Sr(h,f));var p=function(m){var y=Number(m.target.value),x=Sr(se(n.displayMonth),y);n.onChange(x)},g=(e=c?.Dropdown)!==null&&e!==void 0?e:Ol;return b.jsx(g,{name:"months","aria-label":u(),className:l.dropdown_month,style:o.dropdown_month,onChange:p,value:n.displayMonth.getMonth(),caption:a(n.displayMonth,{locale:s}),children:d.map(function(m){return b.jsx("option",{value:m.getMonth(),children:a(m,{locale:s})},m.getMonth())})})}function Vg(n){var e,t=n.displayMonth,r=V(),i=r.fromDate,o=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,h=[];if(!i)return b.jsx(b.Fragment,{});if(!o)return b.jsx(b.Fragment,{});for(var f=i.getFullYear(),p=o.getFullYear(),g=f;g<=p;g++)h.push(rs(xl(new Date),g));var m=function(x){var w=rs(se(t),Number(x.target.value));n.onChange(w)},y=(e=c?.Dropdown)!==null&&e!==void 0?e:Ol;return b.jsx(y,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:m,value:t.getFullYear(),caption:u(t,{locale:s}),children:h.map(function(x){return b.jsx("option",{value:x.getFullYear(),children:u(x,{locale:s})},x.getFullYear())})})}function Wg(n,e){var t=O.useState(n),r=t[0],i=t[1],o=e===void 0?r:e;return[o,i]}function $g(n){var e=n.month,t=n.defaultMonth,r=n.today,i=e||t||r||new Date,o=n.toDate,s=n.fromDate,a=n.numberOfMonths,l=a===void 0?1:a;if(o&&rn(o,i)<0){var c=-1*(l-1);i=be(o,c)}return s&&rn(i,s)<0&&(i=s),se(i)}function qg(){var n=V(),e=$g(n),t=Wg(e,n.month),r=t[0],i=t[1],o=function(s){var a;if(!n.disableNavigation){var l=se(s);i(l),(a=n.onMonthChange)===null||a===void 0||a.call(n,l)}};return[r,o]}function Hg(n,e){for(var t=e.reverseMonths,r=e.numberOfMonths,i=se(n),o=se(be(i,r)),s=rn(o,i),a=[],l=0;l<s;l++){var c=be(i,l);a.push(c)}return t&&(a=a.reverse()),a}function Jg(n,e){if(!e.disableNavigation){var t=e.toDate,r=e.pagedNavigation,i=e.numberOfMonths,o=i===void 0?1:i,s=r?o:1,a=se(n);if(!t)return be(a,s);var l=rn(t,n);if(!(l<o))return be(a,s)}}function Yg(n,e){if(!e.disableNavigation){var t=e.fromDate,r=e.pagedNavigation,i=e.numberOfMonths,o=i===void 0?1:i,s=r?o:1,a=se(n);if(!t)return be(a,-s);var l=rn(a,t);if(!(l<=0))return be(a,-s)}}var Al=O.createContext(void 0);function Ug(n){var e=V(),t=qg(),r=t[0],i=t[1],o=Hg(r,e),s=Jg(r,e),a=Yg(r,e),l=function(d){return o.some(function(h){return Ei(d,h)})},c=function(d,h){l(d)||(h&&Nl(d,h)?i(be(d,1+e.numberOfMonths*-1)):i(d))},u={currentMonth:r,displayMonths:o,goToMonth:i,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return b.jsx(Al.Provider,{value:u,children:n.children})}function dn(){var n=O.useContext(Al);if(!n)throw new Error("useNavigation must be used within a NavigationProvider");return n}function is(n){var e,t=V(),r=t.classNames,i=t.styles,o=t.components,s=dn().goToMonth,a=function(u){s(be(u,n.displayIndex?-n.displayIndex:0))},l=(e=o?.CaptionLabel)!==null&&e!==void 0?e:Tl,c=b.jsx(l,{id:n.id,displayMonth:n.displayMonth});return b.jsxs("div",{className:r.caption_dropdowns,style:i.caption_dropdowns,children:[b.jsx("div",{className:r.vhidden,children:c}),b.jsx(jg,{onChange:a,displayMonth:n.displayMonth}),b.jsx(Vg,{onChange:a,displayMonth:n.displayMonth})]})}function Kg(n){return b.jsx("svg",T({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:b.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Gg(n){return b.jsx("svg",T({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:b.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Ln=O.forwardRef(function(n,e){var t=V(),r=t.classNames,i=t.styles,o=[r.button_reset,r.button];n.className&&o.push(n.className);var s=o.join(" "),a=T(T({},i.button_reset),i.button);return n.style&&Object.assign(a,n.style),b.jsx("button",T({},n,{ref:e,type:"button",className:s,style:a}))});function Xg(n){var e,t,r=V(),i=r.dir,o=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!n.nextMonth&&!n.previousMonth)return b.jsx(b.Fragment,{});var h=c(n.previousMonth,{locale:o}),f=[s.nav_button,s.nav_button_previous].join(" "),p=u(n.nextMonth,{locale:o}),g=[s.nav_button,s.nav_button_next].join(" "),m=(e=d?.IconRight)!==null&&e!==void 0?e:Gg,y=(t=d?.IconLeft)!==null&&t!==void 0?t:Kg;return b.jsxs("div",{className:s.nav,style:a.nav,children:[!n.hidePrevious&&b.jsx(Ln,{name:"previous-month","aria-label":h,className:f,style:a.nav_button_previous,disabled:!n.previousMonth,onClick:n.onPreviousClick,children:i==="rtl"?b.jsx(m,{className:s.nav_icon,style:a.nav_icon}):b.jsx(y,{className:s.nav_icon,style:a.nav_icon})}),!n.hideNext&&b.jsx(Ln,{name:"next-month","aria-label":p,className:g,style:a.nav_button_next,disabled:!n.nextMonth,onClick:n.onNextClick,children:i==="rtl"?b.jsx(y,{className:s.nav_icon,style:a.nav_icon}):b.jsx(m,{className:s.nav_icon,style:a.nav_icon})})]})}function ss(n){var e=V().numberOfMonths,t=dn(),r=t.previousMonth,i=t.nextMonth,o=t.goToMonth,s=t.displayMonths,a=s.findIndex(function(p){return Ei(n.displayMonth,p)}),l=a===0,c=a===s.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),h=function(){r&&o(r)},f=function(){i&&o(i)};return b.jsx(Xg,{displayMonth:n.displayMonth,hideNext:u,hidePrevious:d,nextMonth:i,previousMonth:r,onPreviousClick:h,onNextClick:f})}function Qg(n){var e,t=V(),r=t.classNames,i=t.disableNavigation,o=t.styles,s=t.captionLayout,a=t.components,l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:Tl,c;return i?c=b.jsx(l,{id:n.id,displayMonth:n.displayMonth}):s==="dropdown"?c=b.jsx(is,{displayMonth:n.displayMonth,id:n.id}):s==="dropdown-buttons"?c=b.jsxs(b.Fragment,{children:[b.jsx(is,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id}),b.jsx(ss,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id})]}):c=b.jsxs(b.Fragment,{children:[b.jsx(l,{id:n.id,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),b.jsx(ss,{displayMonth:n.displayMonth,id:n.id})]}),b.jsx("div",{className:r.caption,style:o.caption,children:c})}function Zg(n){var e=V(),t=e.footer,r=e.styles,i=e.classNames.tfoot;return t?b.jsx("tfoot",{className:i,style:r.tfoot,children:b.jsx("tr",{children:b.jsx("td",{colSpan:8,children:t})})}):b.jsx(b.Fragment,{})}function ey(n,e,t){for(var r=t?ht(new Date):Ce(new Date,{locale:n,weekStartsOn:e}),i=[],o=0;o<7;o++){var s=ee(r,o);i.push(s)}return i}function ty(){var n=V(),e=n.classNames,t=n.styles,r=n.showWeekNumber,i=n.locale,o=n.weekStartsOn,s=n.ISOWeek,a=n.formatters.formatWeekdayName,l=n.labels.labelWeekday,c=ey(i,o,s);return b.jsxs("tr",{style:t.head_row,className:e.head_row,children:[r&&b.jsx("td",{style:t.head_cell,className:e.head_cell}),c.map(function(u,d){return b.jsx("th",{scope:"col",className:e.head_cell,style:t.head_cell,"aria-label":l(u,{locale:i}),children:a(u,{locale:i})},d)})]})}function ny(){var n,e=V(),t=e.classNames,r=e.styles,i=e.components,o=(n=i?.HeadRow)!==null&&n!==void 0?n:ty;return b.jsx("thead",{style:r.head,className:t.head,children:b.jsx(o,{})})}function ry(n){var e=V(),t=e.locale,r=e.formatters.formatDay;return b.jsx(b.Fragment,{children:r(n.date,{locale:t})})}var Ti=O.createContext(void 0);function iy(n){if(!cn(n.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return b.jsx(Ti.Provider,{value:e,children:n.children})}return b.jsx(oy,{initialProps:n.initialProps,children:n.children})}function oy(n){var e=n.initialProps,t=n.children,r=e.selected,i=e.min,o=e.max,s=function(c,u,d){var h,f;(h=e.onDayClick)===null||h===void 0||h.call(e,c,u,d);var p=!!(u.selected&&i&&r?.length===i);if(!p){var g=!!(!u.selected&&o&&r?.length===o);if(!g){var m=r?Dl([],r):[];if(u.selected){var y=m.findIndex(function(x){return ie(c,x)});m.splice(y,1)}else m.push(c);(f=e.onSelect)===null||f===void 0||f.call(e,m,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=o&&r.length>o-1,d=r.some(function(h){return ie(h,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return b.jsx(Ti.Provider,{value:l,children:t})}function Oi(){var n=O.useContext(Ti);if(!n)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return n}function sy(n,e){var t=e||{},r=t.from,i=t.to;return r&&i?ie(i,n)&&ie(r,n)?void 0:ie(i,n)?{from:i,to:void 0}:ie(r,n)?void 0:Ur(r,n)?{from:n,to:i}:{from:r,to:n}:i?Ur(n,i)?{from:i,to:n}:{from:n,to:i}:r?Nl(n,r)?{from:n,to:r}:{from:r,to:n}:{from:n,to:void 0}}var Ai=O.createContext(void 0);function ay(n){if(!un(n.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return b.jsx(Ai.Provider,{value:e,children:n.children})}return b.jsx(ly,{initialProps:n.initialProps,children:n.children})}function ly(n){var e=n.initialProps,t=n.children,r=e.selected,i=r||{},o=i.from,s=i.to,a=e.min,l=e.max,c=function(f,p,g){var m,y;(m=e.onDayClick)===null||m===void 0||m.call(e,f,p,g);var x=sy(f,r);(y=e.onSelect)===null||y===void 0||y.call(e,x,f,p,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],s?(u.range_end=[s],ie(o,s)||(u.range_middle=[{after:o,before:s}])):u.range_end=[o]):s&&(u.range_start=[s],u.range_end=[s]),a&&(o&&!s&&u.disabled.push({after:wr(o,a-1),before:ee(o,a-1)}),o&&s&&u.disabled.push({after:o,before:ee(o,a-1)}),!o&&s&&u.disabled.push({after:wr(s,a-1),before:ee(s,a-1)})),l){if(o&&!s&&(u.disabled.push({before:ee(o,-l+1)}),u.disabled.push({after:ee(o,l-1)})),o&&s){var d=we(s,o)+1,h=l-d;u.disabled.push({before:wr(o,h)}),u.disabled.push({after:ee(s,h)})}!o&&s&&(u.disabled.push({before:ee(s,-l+1)}),u.disabled.push({after:ee(s,l-1)}))}return b.jsx(Ai.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:t})}function Pi(){var n=O.useContext(Ai);if(!n)throw new Error("useSelectRange must be used within a SelectRangeProvider");return n}function Sn(n){return Array.isArray(n)?Dl([],n):n!==void 0?[n]:[]}function cy(n){var e={};return Object.entries(n).forEach(function(t){var r=t[0],i=t[1];e[r]=Sn(i)}),e}var xe;(function(n){n.Outside="outside",n.Disabled="disabled",n.Selected="selected",n.Hidden="hidden",n.Today="today",n.RangeStart="range_start",n.RangeEnd="range_end",n.RangeMiddle="range_middle"})(xe||(xe={}));var uy=xe.Selected,Te=xe.Disabled,dy=xe.Hidden,fy=xe.Today,Mr=xe.RangeEnd,Cr=xe.RangeMiddle,Nr=xe.RangeStart,hy=xe.Outside;function py(n,e,t){var r,i=(r={},r[uy]=Sn(n.selected),r[Te]=Sn(n.disabled),r[dy]=Sn(n.hidden),r[fy]=[n.today],r[Mr]=[],r[Cr]=[],r[Nr]=[],r[hy]=[],r);return n.fromDate&&i[Te].push({before:n.fromDate}),n.toDate&&i[Te].push({after:n.toDate}),cn(n)?i[Te]=i[Te].concat(e.modifiers[Te]):un(n)&&(i[Te]=i[Te].concat(t.modifiers[Te]),i[Nr]=t.modifiers[Nr],i[Cr]=t.modifiers[Cr],i[Mr]=t.modifiers[Mr]),i}var Pl=O.createContext(void 0);function my(n){var e=V(),t=Oi(),r=Pi(),i=py(e,t,r),o=cy(e.modifiers),s=T(T({},i),o);return b.jsx(Pl.Provider,{value:s,children:n.children})}function Rl(){var n=O.useContext(Pl);if(!n)throw new Error("useModifiers must be used within a ModifiersProvider");return n}function gy(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function yy(n){return!!(n&&typeof n=="object"&&"from"in n)}function by(n){return!!(n&&typeof n=="object"&&"after"in n)}function xy(n){return!!(n&&typeof n=="object"&&"before"in n)}function vy(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function ky(n,e){var t,r=e.from,i=e.to;if(r&&i){var o=we(i,r)<0;o&&(t=[i,r],r=t[0],i=t[1]);var s=we(n,r)>=0&&we(i,n)>=0;return s}return i?ie(i,n):r?ie(r,n):!1}function wy(n){return Ci(n)}function Sy(n){return Array.isArray(n)&&n.every(Ci)}function My(n,e){return e.some(function(t){if(typeof t=="boolean")return t;if(wy(t))return ie(n,t);if(Sy(t))return t.includes(n);if(yy(t))return ky(n,t);if(vy(t))return t.dayOfWeek.includes(n.getDay());if(gy(t)){var r=we(t.before,n),i=we(t.after,n),o=r>0,s=i<0,a=Ur(t.before,t.after);return a?s&&o:o||s}return by(t)?we(n,t.after)>0:xy(t)?we(t.before,n)>0:typeof t=="function"?t(n):!1})}function Ri(n,e,t){var r=Object.keys(e).reduce(function(o,s){var a=e[s];return My(n,a)&&o.push(s),o},[]),i={};return r.forEach(function(o){return i[o]=!0}),t&&!Ei(n,t)&&(i.outside=!0),i}function Cy(n,e){for(var t=se(n[0]),r=Ni(n[n.length-1]),i,o,s=t;s<=r;){var a=Ri(s,e),l=!a.disabled&&!a.hidden;if(!l){s=ee(s,1);continue}if(a.selected)return s;a.today&&!o&&(o=s),i||(i=s),s=ee(s,1)}return o||i}var Ny=365;function Il(n,e){var t=e.moveBy,r=e.direction,i=e.context,o=e.modifiers,s=e.retry,a=s===void 0?{count:0,lastFocused:n}:s,l=i.weekStartsOn,c=i.fromDate,u=i.toDate,d=i.locale,h={day:ee,week:Yr,month:be,year:pm,startOfWeek:function(m){return i.ISOWeek?ht(m):Ce(m,{locale:d,weekStartsOn:l})},endOfWeek:function(m){return i.ISOWeek?vl(m):Di(m,{locale:d,weekStartsOn:l})}},f=h[t](n,r==="after"?1:-1);r==="before"&&c?f=mm([c,f]):r==="after"&&u&&(f=gm([u,f]));var p=!0;if(o){var g=Ri(f,o);p=!g.disabled&&!g.hidden}return p?f:a.count>Ny?a.lastFocused:Il(f,{moveBy:t,direction:r,context:i,modifiers:o,retry:T(T({},a),{count:a.count+1})})}var _l=O.createContext(void 0);function Dy(n){var e=dn(),t=Rl(),r=O.useState(),i=r[0],o=r[1],s=O.useState(),a=s[0],l=s[1],c=Cy(e.displayMonths,t),u=i??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(i),o(void 0)},h=function(m){o(m)},f=V(),p=function(m,y){if(i){var x=Il(i,{moveBy:m,direction:y,context:f,modifiers:t});ie(i,x)||(e.goToDate(x,i),h(x))}},g={focusedDay:i,focusTarget:u,blur:d,focus:h,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return b.jsx(_l.Provider,{value:g,children:n.children})}function Ii(){var n=O.useContext(_l);if(!n)throw new Error("useFocusContext must be used within a FocusProvider");return n}function Ey(n,e){var t=Rl(),r=Ri(n,t,e);return r}var _i=O.createContext(void 0);function Ty(n){if(!Zn(n.initialProps)){var e={selected:void 0};return b.jsx(_i.Provider,{value:e,children:n.children})}return b.jsx(Oy,{initialProps:n.initialProps,children:n.children})}function Oy(n){var e=n.initialProps,t=n.children,r=function(o,s,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,o,s,a),s.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,o,s,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,o,o,s,a)},i={selected:e.selected,onDayClick:r};return b.jsx(_i.Provider,{value:i,children:t})}function Bl(){var n=O.useContext(_i);if(!n)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return n}function Ay(n,e){var t=V(),r=Bl(),i=Oi(),o=Pi(),s=Ii(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,h=s.focus,f=s.focusMonthBefore,p=s.focusMonthAfter,g=s.focusYearBefore,m=s.focusYearAfter,y=s.focusStartOfWeek,x=s.focusEndOfWeek,w=function(A){var E,er,tr,nr;Zn(t)?(E=r.onDayClick)===null||E===void 0||E.call(r,n,e,A):cn(t)?(er=i.onDayClick)===null||er===void 0||er.call(i,n,e,A):un(t)?(tr=o.onDayClick)===null||tr===void 0||tr.call(o,n,e,A):(nr=t.onDayClick)===null||nr===void 0||nr.call(t,n,e,A)},C=function(A){var E;h(n),(E=t.onDayFocus)===null||E===void 0||E.call(t,n,e,A)},k=function(A){var E;d(),(E=t.onDayBlur)===null||E===void 0||E.call(t,n,e,A)},P=function(A){var E;(E=t.onDayMouseEnter)===null||E===void 0||E.call(t,n,e,A)},M=function(A){var E;(E=t.onDayMouseLeave)===null||E===void 0||E.call(t,n,e,A)},R=function(A){var E;(E=t.onDayPointerEnter)===null||E===void 0||E.call(t,n,e,A)},_=function(A){var E;(E=t.onDayPointerLeave)===null||E===void 0||E.call(t,n,e,A)},re=function(A){var E;(E=t.onDayTouchCancel)===null||E===void 0||E.call(t,n,e,A)},yt=function(A){var E;(E=t.onDayTouchEnd)===null||E===void 0||E.call(t,n,e,A)},De=function(A){var E;(E=t.onDayTouchMove)===null||E===void 0||E.call(t,n,e,A)},_e=function(A){var E;(E=t.onDayTouchStart)===null||E===void 0||E.call(t,n,e,A)},ke=function(A){var E;(E=t.onDayKeyUp)===null||E===void 0||E.call(t,n,e,A)},pe=function(A){var E;switch(A.key){case"ArrowLeft":A.preventDefault(),A.stopPropagation(),t.dir==="rtl"?a():l();break;case"ArrowRight":A.preventDefault(),A.stopPropagation(),t.dir==="rtl"?l():a();break;case"ArrowDown":A.preventDefault(),A.stopPropagation(),c();break;case"ArrowUp":A.preventDefault(),A.stopPropagation(),u();break;case"PageUp":A.preventDefault(),A.stopPropagation(),A.shiftKey?g():f();break;case"PageDown":A.preventDefault(),A.stopPropagation(),A.shiftKey?m():p();break;case"Home":A.preventDefault(),A.stopPropagation(),y();break;case"End":A.preventDefault(),A.stopPropagation(),x();break}(E=t.onDayKeyDown)===null||E===void 0||E.call(t,n,e,A)},Fl={onClick:w,onFocus:C,onBlur:k,onKeyDown:pe,onKeyUp:ke,onMouseEnter:P,onMouseLeave:M,onPointerEnter:R,onPointerLeave:_,onTouchCancel:re,onTouchEnd:yt,onTouchMove:De,onTouchStart:_e};return Fl}function Py(){var n=V(),e=Bl(),t=Oi(),r=Pi(),i=Zn(n)?e.selected:cn(n)?t.selected:un(n)?r.selected:void 0;return i}function Ry(n){return Object.values(xe).includes(n)}function Iy(n,e){var t=[n.classNames.day];return Object.keys(e).forEach(function(r){var i=n.modifiersClassNames[r];if(i)t.push(i);else if(Ry(r)){var o=n.classNames["day_".concat(r)];o&&t.push(o)}}),t}function _y(n,e){var t=T({},n.styles.day);return Object.keys(e).forEach(function(r){var i;t=T(T({},t),(i=n.modifiersStyles)===null||i===void 0?void 0:i[r])}),t}function By(n,e,t){var r,i,o,s=V(),a=Ii(),l=Ey(n,e),c=Ay(n,l),u=Py(),d=!!(s.onDayClick||s.mode!=="default");O.useEffect(function(){var P;l.outside||a.focusedDay&&d&&ie(a.focusedDay,n)&&((P=t.current)===null||P===void 0||P.focus())},[a.focusedDay,n,t,d,l.outside]);var h=Iy(s,l).join(" "),f=_y(s,l),p=!!(l.outside&&!s.showOutsideDays||l.hidden),g=(o=(i=s.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:ry,m=b.jsx(g,{date:n,displayMonth:e,activeModifiers:l}),y={style:f,className:h,children:m,role:"gridcell"},x=a.focusTarget&&ie(a.focusTarget,n)&&!l.outside,w=a.focusedDay&&ie(a.focusedDay,n),C=T(T(T({},y),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=w||x?0:-1,r)),c),k={isButton:d,isHidden:p,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:y};return k}function Fy(n){var e=O.useRef(null),t=By(n.date,n.displayMonth,e);return t.isHidden?b.jsx("div",{role:"gridcell"}):t.isButton?b.jsx(Ln,T({name:"day",ref:e},t.buttonProps)):b.jsx("div",T({},t.divProps))}function zy(n){var e=n.number,t=n.dates,r=V(),i=r.onWeekNumberClick,o=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!i)return b.jsx("span",{className:s.weeknumber,style:o.weeknumber,children:u});var d=l(Number(e),{locale:a}),h=function(f){i(e,t,f)};return b.jsx(Ln,{name:"week-number","aria-label":d,className:s.weeknumber,style:o.weeknumber,onClick:h,children:u})}function Ly(n){var e,t,r=V(),i=r.styles,o=r.classNames,s=r.showWeekNumber,a=r.components,l=(e=a?.Day)!==null&&e!==void 0?e:Fy,c=(t=a?.WeekNumber)!==null&&t!==void 0?t:zy,u;return s&&(u=b.jsx("td",{className:o.cell,style:i.cell,children:b.jsx(c,{number:n.weekNumber,dates:n.dates})})),b.jsxs("tr",{className:o.row,style:i.row,children:[u,n.dates.map(function(d){return b.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:b.jsx(l,{displayMonth:n.displayMonth,date:d})},mg(d))})]})}function as(n,e,t){for(var r=t?.ISOWeek?vl(e):Di(e,t),i=t?.ISOWeek?ht(n):Ce(n,t),o=we(r,i),s=[],a=0;a<=o;a++)s.push(ee(i,a));var l=s.reduce(function(c,u){var d=t?.ISOWeek?wl(u):Ml(u,t),h=c.find(function(f){return f.weekNumber===d});return h?(h.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function jy(n,e){var t=as(se(n),Ni(n),e);if(e?.useFixedWeeks){var r=yg(n,e);if(r<6){var i=t[t.length-1],o=i.dates[i.dates.length-1],s=Yr(o,6-r),a=as(Yr(o,1),s,e);t.push.apply(t,a)}}return t}function Vy(n){var e,t,r,i=V(),o=i.locale,s=i.classNames,a=i.styles,l=i.hideHead,c=i.fixedWeeks,u=i.components,d=i.weekStartsOn,h=i.firstWeekContainsDate,f=i.ISOWeek,p=jy(n.displayMonth,{useFixedWeeks:!!c,ISOWeek:f,locale:o,weekStartsOn:d,firstWeekContainsDate:h}),g=(e=u?.Head)!==null&&e!==void 0?e:ny,m=(t=u?.Row)!==null&&t!==void 0?t:Ly,y=(r=u?.Footer)!==null&&r!==void 0?r:Zg;return b.jsxs("table",{id:n.id,className:s.table,style:a.table,role:"grid","aria-labelledby":n["aria-labelledby"],children:[!l&&b.jsx(g,{}),b.jsx("tbody",{className:s.tbody,style:a.tbody,children:p.map(function(x){return b.jsx(m,{displayMonth:n.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),b.jsx(y,{displayMonth:n.displayMonth})]})}function Wy(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var $y=Wy()?O.useLayoutEffect:O.useEffect,Dr=!1,qy=0;function ls(){return"react-day-picker-".concat(++qy)}function Hy(n){var e,t=n??(Dr?ls():null),r=O.useState(t),i=r[0],o=r[1];return $y(function(){i===null&&o(ls())},[]),O.useEffect(function(){Dr===!1&&(Dr=!0)},[]),(e=n??i)!==null&&e!==void 0?e:void 0}function Jy(n){var e,t,r=V(),i=r.dir,o=r.classNames,s=r.styles,a=r.components,l=dn().displayMonths,c=Hy(r.id?"".concat(r.id,"-").concat(n.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(n.displayIndex):void 0,d=[o.month],h=s.month,f=n.displayIndex===0,p=n.displayIndex===l.length-1,g=!f&&!p;i==="rtl"&&(e=[f,p],p=e[0],f=e[1]),f&&(d.push(o.caption_start),h=T(T({},h),s.caption_start)),p&&(d.push(o.caption_end),h=T(T({},h),s.caption_end)),g&&(d.push(o.caption_between),h=T(T({},h),s.caption_between));var m=(t=a?.Caption)!==null&&t!==void 0?t:Qg;return b.jsxs("div",{className:d.join(" "),style:h,children:[b.jsx(m,{id:c,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),b.jsx(Vy,{id:u,"aria-labelledby":c,displayMonth:n.displayMonth})]},n.displayIndex)}function Yy(n){var e=V(),t=e.classNames,r=e.styles;return b.jsx("div",{className:t.months,style:r.months,children:n.children})}function Uy(n){var e,t,r=n.initialProps,i=V(),o=Ii(),s=dn(),a=O.useState(!1),l=a[0],c=a[1];O.useEffect(function(){i.initialFocus&&o.focusTarget&&(l||(o.focus(o.focusTarget),c(!0)))},[i.initialFocus,l,o.focus,o.focusTarget,o]);var u=[i.classNames.root,i.className];i.numberOfMonths>1&&u.push(i.classNames.multiple_months),i.showWeekNumber&&u.push(i.classNames.with_weeknumber);var d=T(T({},i.styles.root),i.style),h=Object.keys(r).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var m;return T(T({},p),(m={},m[g]=r[g],m))},{}),f=(t=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&t!==void 0?t:Yy;return b.jsx("div",T({className:u.join(" "),style:d,dir:i.dir,id:i.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:b.jsx(f,{children:s.displayMonths.map(function(p,g){return b.jsx(Jy,{displayIndex:g,displayMonth:p},g)})})}))}function Ky(n){var e=n.children,t=xg(n,["children"]);return b.jsx(zg,{initialProps:t,children:b.jsx(Ug,{children:b.jsx(Ty,{initialProps:t,children:b.jsx(iy,{initialProps:t,children:b.jsx(ay,{initialProps:t,children:b.jsx(my,{children:b.jsx(Dy,{children:e})})})})})})})}function Gy(n){return b.jsx(Ky,T({},n,{children:b.jsx(Uy,{initialProps:n})}))}function vb(n){const e=us.c(20);let t,r,i,o;e[0]!==n?({className:t,classNames:r,showOutsideDays:o,...i}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=i,e[4]=o):(t=e[1],r=e[2],i=e[3],o=e[4]);const s=o===void 0?!0:o;let a;e[5]!==t?(a=et("p-3",t),e[5]=t,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=et(Bi({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),e[7]=l):l=e[7];const c=i.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md";let u;e[8]!==c?(u=et("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",c),e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=et(Bi({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),e[10]=d):d=e[10];let h;e[11]!==r||e[12]!==u?(h={months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:l,nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:u,day:d,day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...r},e[11]=r,e[12]=u,e[13]=h):h=e[13];let f;e[14]===Symbol.for("react.memo_cache_sentinel")?(f={IconLeft:Qy,IconRight:Xy},e[14]=f):f=e[14];let p;return e[15]!==i||e[16]!==s||e[17]!==a||e[18]!==h?(p=b.jsx(Gy,{showOutsideDays:s,className:a,classNames:h,components:f,...i}),e[15]=i,e[16]=s,e[17]=a,e[18]=h,e[19]=p):p=e[19],p}function Xy(n){const{className:e,...t}=n;return b.jsx(Wl,{className:et("size-4",e),...t})}function Qy(n){const{className:e,...t}=n;return b.jsx(Vl,{className:et("size-4",e),...t})}export{rb as $,db as A,ub as B,vb as C,q as D,wi as E,v as F,hb as G,$f as H,rh as I,ib as J,Ka as K,eh as L,xb as M,ep as N,Qh as O,Ke as P,tn as Q,sm as R,S,I as T,ab as U,sb as V,J as W,ob as X,nn as Y,Xh as Z,nb as _,ve as a,yb as b,cm as c,Jp as d,Ne as e,ge as f,lm as g,pb as h,bb as i,em as j,Tc as k,Gd as l,D as m,B as n,Tn as o,bi as p,L as q,N as r,lb as s,$l as t,gb as u,Uf as v,fb as w,Rh as x,mb as y,cb as z};
|