@prolibu-suite/cobalt-core 0.2.0 → 0.3.0
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/custom-elements.json +15675 -11199
- package/dist/cjs/co-accordion.cjs.entry.js +3 -3
- package/dist/cjs/co-app-shell.cjs.entry.js +4 -4
- package/dist/cjs/co-autocomplete.cjs.entry.js +10 -7
- package/dist/cjs/co-avatar-group.cjs.entry.js +77 -0
- package/dist/cjs/co-avatar.cjs.entry.js +6 -4
- package/dist/cjs/co-badge.cjs.entry.js +2 -2
- package/dist/cjs/co-bottom-sheet.cjs.entry.js +325 -0
- package/dist/cjs/co-button-group.cjs.entry.js +3 -3
- package/dist/cjs/co-button.cjs.entry.js +6 -6
- package/dist/cjs/co-calendar-month.cjs.entry.js +381 -0
- package/dist/cjs/co-calendar_3.cjs.entry.js +11 -11
- package/dist/cjs/co-card.cjs.entry.js +3 -3
- package/dist/cjs/co-checkbox-group.cjs.entry.js +5 -5
- package/dist/cjs/co-checkbox.cjs.entry.js +5 -5
- package/dist/cjs/co-chip.cjs.entry.js +11 -8
- package/dist/cjs/co-color-picker.cjs.entry.js +7 -5
- package/dist/cjs/co-column-picker.cjs.entry.js +3 -3
- package/dist/cjs/co-combobox.cjs.entry.js +7 -7
- package/dist/cjs/co-command-search.cjs.entry.js +151 -12
- package/dist/cjs/co-data-table-pagination.cjs.entry.js +5 -5
- package/dist/cjs/co-data-table.cjs.entry.js +25 -11
- package/dist/cjs/co-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/co-date-range-picker.cjs.entry.js +3 -3
- package/dist/cjs/co-date-range.cjs.entry.js +2 -2
- package/dist/cjs/co-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/co-event-calendar.cjs.entry.js +318 -0
- package/dist/cjs/co-fab.cjs.entry.js +3 -3
- package/dist/cjs/co-file-field.cjs.entry.js +8 -8
- package/dist/cjs/co-helper-text.cjs.entry.js +3 -3
- package/dist/cjs/co-icon-button.cjs.entry.js +5 -5
- package/dist/cjs/co-icon.cjs.entry.js +33 -25
- package/dist/cjs/co-input.cjs.entry.js +6 -6
- package/dist/cjs/co-json-field.cjs.entry.js +10 -6
- package/dist/cjs/co-lightbox.cjs.entry.js +5 -5
- package/dist/cjs/co-list-footer.cjs.entry.js +25 -0
- package/dist/cjs/co-list-item.cjs.entry.js +60 -4
- package/dist/cjs/co-loader_2.cjs.entry.js +293 -0
- package/dist/cjs/co-menu-divider.cjs.entry.js +2 -2
- package/dist/cjs/co-menu-item.cjs.entry.js +17 -10
- package/dist/cjs/co-menu.cjs.entry.js +2 -2
- package/dist/cjs/co-modal.cjs.entry.js +16 -4
- package/dist/cjs/co-navbar.cjs.entry.js +3 -3
- package/dist/cjs/co-number-field.cjs.entry.js +18 -6
- package/dist/cjs/co-page-header.cjs.entry.js +2 -2
- package/dist/cjs/co-phone-field.cjs.entry.js +6 -4
- package/dist/cjs/co-popover.cjs.entry.js +45 -14
- package/dist/cjs/co-progress-bar.cjs.entry.js +8 -4
- package/dist/cjs/co-progress-circle.cjs.entry.js +3 -3
- package/dist/cjs/co-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/co-radio.cjs.entry.js +4 -4
- package/dist/cjs/co-rating.cjs.entry.js +4 -4
- package/dist/cjs/co-ref-field.cjs.entry.js +36 -13
- package/dist/cjs/co-rich-text-editor.cjs.entry.js +1879 -33
- package/dist/cjs/co-rich-text-toolbar.cjs.entry.js +995 -71
- package/dist/cjs/co-rich-text-viewer.cjs.entry.js +55 -19
- package/dist/cjs/co-row.cjs.entry.js +3 -3
- package/dist/cjs/co-select.cjs.entry.js +8 -8
- package/dist/cjs/co-separator.cjs.entry.js +2 -2
- package/dist/cjs/co-sidebar-nav.cjs.entry.js +29 -9
- package/dist/cjs/co-sidebar.cjs.entry.js +3 -3
- package/dist/cjs/co-skeleton.cjs.entry.js +26 -0
- package/dist/cjs/co-slider.cjs.entry.js +3 -3
- package/dist/cjs/co-switch.cjs.entry.js +6 -6
- package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/co-tab.cjs.entry.js +3 -3
- package/dist/cjs/co-tags-field.cjs.entry.js +19 -13
- package/dist/cjs/co-textarea.cjs.entry.js +11 -7
- package/dist/cjs/co-toast.cjs.entry.js +2 -2
- package/dist/cjs/co-toggle-button-group.cjs.entry.js +4 -4
- package/dist/cjs/co-toggle-button.cjs.entry.js +4 -4
- package/dist/cjs/co-tooltip.cjs.entry.js +51 -16
- package/dist/cjs/co-transfer-list.cjs.entry.js +3 -3
- package/dist/cjs/co-video.cjs.entry.js +839 -0
- package/dist/cjs/cobalt.cjs.js +2 -2
- package/dist/cjs/fieldChip-CDIMz_Y6.js +7 -0
- package/dist/cjs/{index-CaEJnpZe.js → index-5NdsiFjZ.js} +14509 -6317
- package/dist/cjs/{index-DoFnrUVH.js → index-BumlM92r.js} +45 -21
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/overlayAfterClose-BdeXrhVY.js +12 -0
- package/dist/{esm/sanitizer-DcK0GGZC.js → cjs/purify.es-DX41ZWS2.js} +3 -107
- package/dist/cjs/{requiredMark-DA6y-4rp.js → requiredMark-CqMGt1H1.js} +1 -1
- package/dist/cjs/richTextI18n-B7ktXg3M.js +382 -0
- package/dist/cjs/toolbar-config-3PlT-3zm.js +216 -0
- package/dist/cjs/tz-Dgom0W69.js +127 -0
- package/dist/cobalt/cobalt.css +1 -1
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/p-0a506c9d.entry.js +1 -0
- package/dist/cobalt/p-0bb55163.entry.js +1 -0
- package/dist/cobalt/{p-6404bd21.entry.js → p-0e8c0d87.entry.js} +1 -1
- package/dist/cobalt/p-12e2c2c4.entry.js +1 -0
- package/dist/cobalt/p-136ad468.entry.js +1 -0
- package/dist/cobalt/{p-654bbc2a.entry.js → p-14b59277.entry.js} +1 -1
- package/dist/cobalt/p-1531d3c9.entry.js +1 -0
- package/dist/cobalt/p-1774d211.entry.js +1 -0
- package/dist/cobalt/p-180e1106.entry.js +1 -0
- package/dist/cobalt/p-1a07c23c.entry.js +1 -0
- package/dist/cobalt/p-1dc9c49e.entry.js +1 -0
- package/dist/cobalt/p-1f747e45.entry.js +1 -0
- package/dist/cobalt/p-201eaf35.entry.js +1 -0
- package/dist/cobalt/p-260101ab.entry.js +1 -0
- package/dist/cobalt/p-279bf91c.entry.js +1 -0
- package/dist/cobalt/p-29be61a9.entry.js +1 -0
- package/dist/cobalt/p-2d2ce434.entry.js +1 -0
- package/dist/cobalt/{p-aa63812a.entry.js → p-2f86e1e0.entry.js} +1 -1
- package/dist/cobalt/{p-522fcdb7.entry.js → p-31ab9a46.entry.js} +1 -1
- package/dist/cobalt/{p-fe9e85b6.entry.js → p-37595103.entry.js} +1 -1
- package/dist/cobalt/{p-def448e4.entry.js → p-377c2ccc.entry.js} +1 -1
- package/dist/cobalt/p-3863ea91.entry.js +1 -0
- package/dist/cobalt/p-3a257cb0.entry.js +1 -0
- package/dist/cobalt/p-3e187456.entry.js +1 -0
- package/dist/cobalt/{p-5d01bd4d.entry.js → p-4431faac.entry.js} +1 -1
- package/dist/cobalt/{p-54f26e95.entry.js → p-4504f7b0.entry.js} +1 -1
- package/dist/cobalt/{p-f8728b21.entry.js → p-456fa86f.entry.js} +1 -1
- package/dist/cobalt/{p-3f9b3fcb.entry.js → p-4871690e.entry.js} +1 -1
- package/dist/cobalt/{p-d17e1444.entry.js → p-4c01d984.entry.js} +1 -1
- package/dist/cobalt/p-51a53177.entry.js +1 -0
- package/dist/cobalt/p-52de17da.entry.js +1 -0
- package/dist/cobalt/p-5890e4d1.entry.js +1 -0
- package/dist/cobalt/{p-f2c5cb74.entry.js → p-58a53421.entry.js} +1 -1
- package/dist/cobalt/p-62274eba.entry.js +1 -0
- package/dist/cobalt/p-635b03d5.entry.js +1 -0
- package/dist/cobalt/p-64ddee92.entry.js +1 -0
- package/dist/cobalt/p-65af5017.entry.js +1 -0
- package/dist/cobalt/p-69d4c0c8.entry.js +1 -0
- package/dist/cobalt/p-6c480916.entry.js +1 -0
- package/dist/cobalt/p-6d1217c3.entry.js +1 -0
- package/dist/cobalt/{p-f0e8fa7d.entry.js → p-6e808b3a.entry.js} +1 -1
- package/dist/cobalt/{p-f97ad9ad.entry.js → p-70b14b05.entry.js} +1 -1
- package/dist/cobalt/{p-97c20011.entry.js → p-790d384e.entry.js} +1 -1
- package/dist/cobalt/p-8012e152.entry.js +1 -0
- package/dist/cobalt/p-80b27203.entry.js +1 -0
- package/dist/cobalt/p-867c1465.entry.js +1 -0
- package/dist/cobalt/p-86a143d7.entry.js +1 -0
- package/dist/cobalt/{p-e8b58332.entry.js → p-8d59f5ad.entry.js} +1 -1
- package/dist/cobalt/p-8d7fdb9d.entry.js +1 -0
- package/dist/cobalt/{p-7f818368.entry.js → p-8dc1dab8.entry.js} +1 -1
- package/dist/cobalt/{p-beb9c11d.entry.js → p-8e1dc062.entry.js} +1 -1
- package/dist/cobalt/p-929e647f.entry.js +1 -0
- package/dist/cobalt/p-92bd9b29.entry.js +1 -0
- package/dist/cobalt/p-93046365.entry.js +1 -0
- package/dist/cobalt/p-98ab5f3f.entry.js +1 -0
- package/dist/cobalt/{p-c87285b6.entry.js → p-9a04ca90.entry.js} +1 -1
- package/dist/cobalt/{p-7ef766c6.entry.js → p-9a088515.entry.js} +1 -1
- package/dist/cobalt/p-9abbd436.entry.js +1 -0
- package/dist/cobalt/p-9d69c067.entry.js +1 -0
- package/dist/cobalt/p-B-ckjCUA.js +1 -0
- package/dist/cobalt/p-B2QLgWrz.js +2 -0
- package/dist/cobalt/p-B6JZk8fL.js +1 -0
- package/dist/cobalt/p-BZJ7NCm5.js +1 -0
- package/dist/cobalt/p-CYsftTKf.js +2 -0
- package/dist/cobalt/p-CegCk7FL.js +1 -0
- package/dist/cobalt/p-Ch1jfwZ2.js +1 -0
- package/dist/cobalt/p-ChibIpZv.js +1 -0
- package/dist/cobalt/p-afb7e19e.entry.js +1 -0
- package/dist/cobalt/{p-b758c2e6.entry.js → p-b6f20268.entry.js} +1 -1
- package/dist/cobalt/{p-bb07da22.entry.js → p-ba90e871.entry.js} +1 -1
- package/dist/cobalt/p-c10697e1.entry.js +1 -0
- package/dist/cobalt/p-c4f59532.entry.js +1 -0
- package/dist/cobalt/{p-1e0282b8.entry.js → p-cb235aa7.entry.js} +1 -1
- package/dist/cobalt/p-cfb36943.entry.js +1 -0
- package/dist/cobalt/p-d809bd44.entry.js +1 -0
- package/dist/cobalt/p-e53861e4.entry.js +1 -0
- package/dist/cobalt/p-e54dd404.entry.js +1 -0
- package/dist/cobalt/{p-01fc77c4.entry.js → p-eb18fdbf.entry.js} +1 -1
- package/dist/cobalt/{p-95d14878.entry.js → p-eb73052a.entry.js} +1 -1
- package/dist/cobalt/{p-273afd93.entry.js → p-ef7d4ae3.entry.js} +1 -1
- package/dist/cobalt/p-f4063c41.entry.js +1 -0
- package/dist/cobalt/p-oImf-7fN.js +1 -0
- package/dist/cobalt/{p-CyYF8IJE.js → p-tPYikBRJ.js} +1 -1
- package/dist/collection/collection-manifest.json +10 -3
- package/dist/collection/components/co-accordion/co-accordion.js +2 -2
- package/dist/collection/components/co-app-shell/co-app-shell.css +79 -6
- package/dist/collection/components/co-app-shell/co-app-shell.js +2 -2
- package/dist/collection/components/co-autocomplete/co-autocomplete.css +28 -1
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +27 -4
- package/dist/collection/components/co-avatar/co-avatar.css +38 -1
- package/dist/collection/components/co-avatar/co-avatar.js +23 -2
- package/dist/collection/components/co-avatar-group/co-avatar-group.css +86 -0
- package/dist/collection/components/co-avatar-group/co-avatar-group.js +224 -0
- package/dist/collection/components/co-badge/co-badge.js +1 -1
- package/dist/collection/components/co-bottom-sheet/co-bottom-sheet.css +136 -0
- package/dist/collection/components/co-bottom-sheet/co-bottom-sheet.js +507 -0
- package/dist/collection/components/co-button/co-button.css +40 -7
- package/dist/collection/components/co-button/co-button.js +26 -7
- package/dist/collection/components/co-button-group/co-button-group.js +2 -2
- package/dist/collection/components/co-calendar/co-calendar.js +1 -1
- package/dist/collection/components/co-calendar-month/co-calendar-month.css +231 -0
- package/dist/collection/components/co-calendar-month/co-calendar-month.js +594 -0
- package/dist/collection/components/co-card/co-card.js +2 -2
- package/dist/collection/components/co-checkbox/co-checkbox.css +7 -1
- package/dist/collection/components/co-checkbox/co-checkbox.js +3 -3
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.css +7 -1
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +3 -3
- package/dist/collection/components/co-chip/co-chip.css +27 -7
- package/dist/collection/components/co-chip/co-chip.js +52 -10
- package/dist/collection/components/co-color-picker/co-color-picker.css +35 -1
- package/dist/collection/components/co-color-picker/co-color-picker.js +24 -2
- package/dist/collection/components/co-column-picker/co-column-picker.js +2 -2
- package/dist/collection/components/co-combobox/co-combobox.css +7 -47
- package/dist/collection/components/co-combobox/co-combobox.js +4 -4
- package/dist/collection/components/co-command-search/co-command-search.css +163 -1
- package/dist/collection/components/co-command-search/co-command-search.js +355 -14
- package/dist/collection/components/co-command-search/commandSearchGroup.js +17 -0
- package/dist/collection/components/co-command-search/commandSearchLogic.js +27 -0
- package/dist/collection/components/co-data-table/co-data-table.css +37 -1
- package/dist/collection/components/co-data-table/co-data-table.js +25 -11
- package/dist/collection/components/co-data-table-pagination/co-data-table-pagination.js +4 -4
- package/dist/collection/components/co-date-field/co-date-field.css +7 -1
- package/dist/collection/components/co-date-field/co-date-field.js +4 -4
- package/dist/collection/components/co-date-range/co-date-range.js +1 -1
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.css +7 -1
- package/dist/collection/components/co-drawer/co-drawer.css +1 -0
- package/dist/collection/components/co-drawer/co-drawer.js +2 -2
- package/dist/collection/components/co-empty-state/co-empty-state.js +1 -1
- package/dist/collection/components/co-event-calendar/co-event-calendar.css +146 -0
- package/dist/collection/components/co-event-calendar/co-event-calendar.js +620 -0
- package/dist/collection/components/co-fab/co-fab.js +2 -2
- package/dist/collection/components/co-file-field/co-file-field.css +7 -1
- package/dist/collection/components/co-file-field/co-file-field.js +5 -5
- package/dist/collection/components/co-helper-text/co-helper-text.js +2 -2
- package/dist/collection/components/co-icon/co-icon.js +7 -37
- package/dist/collection/components/co-icon/iconLoader.js +39 -0
- package/dist/collection/components/co-icon-button/co-icon-button.css +19 -8
- package/dist/collection/components/co-icon-button/co-icon-button.js +23 -4
- package/dist/collection/components/co-input/co-input.css +7 -1
- package/dist/collection/components/co-input/co-input.js +3 -3
- package/dist/collection/components/co-json-field/co-json-field.css +25 -1
- package/dist/collection/components/co-json-field/co-json-field.js +27 -3
- package/dist/collection/components/co-lightbox/co-lightbox.js +4 -4
- package/dist/collection/components/co-list-footer/co-list-footer.css +50 -0
- package/dist/collection/components/co-list-footer/co-list-footer.js +149 -0
- package/dist/collection/components/co-list-item/co-list-item.css +7 -0
- package/dist/collection/components/co-list-item/co-list-item.js +65 -2
- package/dist/collection/components/co-loader/co-loader.css +9 -0
- package/dist/collection/components/co-menu/co-menu.js +1 -1
- package/dist/collection/components/co-menu-divider/co-menu-divider.js +1 -1
- package/dist/collection/components/co-menu-item/co-menu-item.css +18 -0
- package/dist/collection/components/co-menu-item/co-menu-item.js +15 -8
- package/dist/collection/components/co-modal/co-modal.css +42 -2
- package/dist/collection/components/co-modal/co-modal.js +42 -2
- package/dist/collection/components/co-navbar/co-navbar.js +2 -2
- package/dist/collection/components/co-number-field/co-number-field.css +19 -1
- package/dist/collection/components/co-number-field/co-number-field.js +34 -3
- package/dist/collection/components/co-overlay/co-overlay.css +15 -1
- package/dist/collection/components/co-overlay/co-overlay.js +266 -1
- package/dist/collection/components/co-overlay/focusTrap.js +53 -0
- package/dist/collection/components/co-overlay/overlayAfterClose.js +8 -0
- package/dist/collection/components/co-page-header/co-page-header.js +1 -1
- package/dist/collection/components/co-phone-field/co-phone-field.css +30 -2
- package/dist/collection/components/co-phone-field/co-phone-field.js +23 -1
- package/dist/collection/components/co-popover/co-popover.css +9 -0
- package/dist/collection/components/co-popover/co-popover.js +43 -12
- package/dist/collection/components/co-progress-bar/co-progress-bar.css +22 -0
- package/dist/collection/components/co-progress-bar/co-progress-bar.js +26 -2
- package/dist/collection/components/co-progress-circle/co-progress-circle.js +2 -2
- package/dist/collection/components/co-radio/co-radio.js +3 -3
- package/dist/collection/components/co-radio-group/co-radio-group.js +3 -3
- package/dist/collection/components/co-rating/co-rating.js +3 -3
- package/dist/collection/components/co-ref-field/co-ref-field.css +64 -6
- package/dist/collection/components/co-ref-field/co-ref-field.js +0 -0
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.css +1125 -41
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.js +2008 -53
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.css +791 -9
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.js +1071 -71
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.css +78 -0
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.js +46 -41
- package/dist/collection/components/co-row/co-row.js +2 -2
- package/dist/collection/components/co-select/co-select.css +7 -1
- package/dist/collection/components/co-select/co-select.js +5 -5
- package/dist/collection/components/co-separator/co-separator.js +1 -1
- package/dist/collection/components/co-sidebar/co-sidebar.js +2 -2
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.css +99 -12
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +28 -8
- package/dist/collection/components/co-skeleton/co-skeleton.css +28 -0
- package/dist/collection/components/co-skeleton/co-skeleton.js +97 -0
- package/dist/collection/components/co-slider/co-slider.js +2 -2
- package/dist/collection/components/co-switch/co-switch.css +9 -1
- package/dist/collection/components/co-switch/co-switch.js +3 -3
- package/dist/collection/components/co-tab/co-tab.js +2 -2
- package/dist/collection/components/co-tab-group/co-tab-group.js +1 -1
- package/dist/collection/components/co-tags-field/co-tags-field.css +39 -1
- package/dist/collection/components/co-tags-field/co-tags-field.js +36 -10
- package/dist/collection/components/co-textarea/co-textarea.css +26 -1
- package/dist/collection/components/co-textarea/co-textarea.js +28 -4
- package/dist/collection/components/co-toast/co-toast.js +1 -1
- package/dist/collection/components/co-toggle-button/co-toggle-button.css +26 -4
- package/dist/collection/components/co-toggle-button/co-toggle-button.js +3 -3
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.css +16 -12
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.js +2 -2
- package/dist/collection/components/co-tooltip/co-tooltip.css +8 -0
- package/dist/collection/components/co-tooltip/co-tooltip.js +69 -14
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +2 -2
- package/dist/collection/components/co-video/co-video.css +497 -0
- package/dist/collection/components/co-video/co-video.js +1772 -0
- package/dist/collection/utils/fieldChip.js +2 -0
- package/dist/collection/utils/icon-config.js +12 -0
- package/dist/collection/utils/richTextI18n.js +378 -0
- package/dist/collection/utils/sheetGesture.js +53 -0
- package/dist/components/co-accordion.js +1 -1
- package/dist/components/co-app-shell.js +1 -1
- package/dist/components/co-autocomplete.js +1 -1
- package/dist/components/co-avatar-group.d.ts +11 -0
- package/dist/components/co-avatar-group.js +1 -0
- package/dist/components/co-avatar.js +1 -1
- package/dist/components/co-badge.js +1 -1
- package/dist/components/co-bottom-sheet.d.ts +11 -0
- package/dist/components/co-bottom-sheet.js +1 -0
- package/dist/components/co-button-group.js +1 -1
- package/dist/components/co-button.js +1 -1
- package/dist/components/co-calendar-month.d.ts +11 -0
- package/dist/components/co-calendar-month.js +1 -0
- package/dist/components/co-calendar.js +1 -1
- package/dist/components/co-card.js +1 -1
- package/dist/components/co-checkbox-group.js +1 -1
- package/dist/components/co-checkbox.js +1 -1
- package/dist/components/co-chip.js +1 -1
- package/dist/components/co-color-picker.js +1 -1
- package/dist/components/co-column-picker.js +1 -1
- package/dist/components/co-combobox.js +1 -1
- package/dist/components/co-command-search.js +1 -1
- package/dist/components/co-data-table-pagination.js +1 -1
- package/dist/components/co-data-table.js +1 -1
- package/dist/components/co-date-field.js +1 -1
- package/dist/components/co-date-picker.js +1 -1
- package/dist/components/co-date-range-picker.js +1 -1
- package/dist/components/co-date-range.js +1 -1
- package/dist/components/co-drawer.js +1 -1
- package/dist/components/co-empty-state.js +1 -1
- package/dist/components/co-event-calendar.d.ts +11 -0
- package/dist/components/co-event-calendar.js +1 -0
- package/dist/components/co-fab.js +1 -1
- package/dist/components/co-file-field.js +1 -1
- package/dist/components/co-helper-text.js +1 -1
- package/dist/components/co-icon-button.js +1 -1
- package/dist/components/co-icon.js +1 -1
- package/dist/components/co-input.js +1 -1
- package/dist/components/co-json-field.js +1 -1
- package/dist/components/co-lightbox.js +1 -1
- package/dist/components/co-list-footer.d.ts +11 -0
- package/dist/components/co-list-footer.js +1 -0
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-loader.js +1 -1
- package/dist/components/co-menu-divider.js +1 -1
- package/dist/components/co-menu-item.js +1 -1
- package/dist/components/co-menu.js +1 -1
- package/dist/components/co-modal.js +1 -1
- package/dist/components/co-navbar.js +1 -1
- package/dist/components/co-number-field.js +1 -1
- package/dist/components/co-overlay.js +1 -1
- package/dist/components/co-page-header.js +1 -1
- package/dist/components/co-phone-field.js +1 -1
- package/dist/components/co-popover.js +1 -1
- package/dist/components/co-progress-bar.js +1 -1
- package/dist/components/co-progress-circle.js +1 -1
- package/dist/components/co-radio-group.js +1 -1
- package/dist/components/co-radio.js +1 -1
- package/dist/components/co-rating.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-rich-text-editor.js +1 -1
- package/dist/components/co-rich-text-toolbar.js +1 -1
- package/dist/components/co-rich-text-viewer.js +1 -1
- package/dist/components/co-row.js +1 -1
- package/dist/components/co-select.js +1 -1
- package/dist/components/co-separator.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-sidebar.js +1 -1
- package/dist/components/co-skeleton.d.ts +11 -0
- package/dist/components/co-skeleton.js +1 -0
- package/dist/components/co-slider.js +1 -1
- package/dist/components/co-switch.js +1 -1
- package/dist/components/co-tab-group.js +1 -1
- package/dist/components/co-tab.js +1 -1
- package/dist/components/co-tags-field.js +1 -1
- package/dist/components/co-textarea.js +1 -1
- package/dist/components/co-toast.js +1 -1
- package/dist/components/co-toggle-button-group.js +1 -1
- package/dist/components/co-toggle-button.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/co-transfer-list.js +1 -1
- package/dist/components/co-video.d.ts +11 -0
- package/dist/components/co-video.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-B2QLgWrz.js +2 -0
- package/dist/components/{p-BeWXpX8I.js → p-B7vGYFbO.js} +1 -1
- package/dist/components/p-BB2OaYKF.js +1 -0
- package/dist/components/p-BFeE_fiq.js +1 -0
- package/dist/components/p-BNKz39GA.js +1 -0
- package/dist/components/p-Ba4v1NXo.js +1 -0
- package/dist/components/p-C_ULDaks.js +1 -0
- package/dist/components/p-CegCk7FL.js +1 -0
- package/dist/components/p-ChibIpZv.js +1 -0
- package/dist/components/p-D3Y_ti3Q.js +1 -0
- package/dist/components/{p-DObrQi5F.js → p-DKh8ZK4U.js} +1 -1
- package/dist/components/{p-C9tHLXKS.js → p-DeZxp9vb.js} +1 -1
- package/dist/components/p-DvhR3H61.js +1 -0
- package/dist/components/p-DxCFMMfY.js +1 -0
- package/dist/components/{p-OGpfa9Yd.js → p-DzoNGEDU.js} +1 -1
- package/dist/components/p-EPZfLt5l.js +1 -0
- package/dist/components/p-FMnqPWcM.js +1 -0
- package/dist/components/p-Hzh9U2cM.js +1 -0
- package/dist/components/p-WZ06pT2Y.js +1 -0
- package/dist/components/p-tloAgDin.js +1 -0
- package/dist/esm/co-accordion.entry.js +3 -3
- package/dist/esm/co-app-shell.entry.js +4 -4
- package/dist/esm/co-autocomplete.entry.js +10 -7
- package/dist/esm/co-avatar-group.entry.js +75 -0
- package/dist/esm/co-avatar.entry.js +6 -4
- package/dist/esm/co-badge.entry.js +2 -2
- package/dist/esm/co-bottom-sheet.entry.js +323 -0
- package/dist/esm/co-button-group.entry.js +3 -3
- package/dist/esm/co-button.entry.js +6 -6
- package/dist/esm/co-calendar-month.entry.js +379 -0
- package/dist/esm/co-calendar_3.entry.js +12 -12
- package/dist/esm/co-card.entry.js +3 -3
- package/dist/esm/co-checkbox-group.entry.js +5 -5
- package/dist/esm/co-checkbox.entry.js +5 -5
- package/dist/esm/co-chip.entry.js +11 -8
- package/dist/esm/co-color-picker.entry.js +7 -5
- package/dist/esm/co-column-picker.entry.js +3 -3
- package/dist/esm/co-combobox.entry.js +7 -7
- package/dist/esm/co-command-search.entry.js +151 -12
- package/dist/esm/co-data-table-pagination.entry.js +5 -5
- package/dist/esm/co-data-table.entry.js +25 -11
- package/dist/esm/co-date-picker.entry.js +2 -2
- package/dist/esm/co-date-range-picker.entry.js +4 -4
- package/dist/esm/co-date-range.entry.js +2 -2
- package/dist/esm/co-empty-state.entry.js +2 -2
- package/dist/esm/co-event-calendar.entry.js +316 -0
- package/dist/esm/co-fab.entry.js +3 -3
- package/dist/esm/co-file-field.entry.js +8 -8
- package/dist/esm/co-helper-text.entry.js +3 -3
- package/dist/esm/co-icon-button.entry.js +5 -5
- package/dist/esm/co-icon.entry.js +33 -25
- package/dist/esm/co-input.entry.js +6 -6
- package/dist/esm/co-json-field.entry.js +10 -6
- package/dist/esm/co-lightbox.entry.js +5 -5
- package/dist/esm/co-list-footer.entry.js +23 -0
- package/dist/esm/co-list-item.entry.js +60 -4
- package/dist/esm/co-loader_2.entry.js +290 -0
- package/dist/esm/co-menu-divider.entry.js +2 -2
- package/dist/esm/co-menu-item.entry.js +17 -10
- package/dist/esm/co-menu.entry.js +2 -2
- package/dist/esm/co-modal.entry.js +16 -4
- package/dist/esm/co-navbar.entry.js +3 -3
- package/dist/esm/co-number-field.entry.js +18 -6
- package/dist/esm/co-page-header.entry.js +2 -2
- package/dist/esm/co-phone-field.entry.js +6 -4
- package/dist/esm/co-popover.entry.js +45 -14
- package/dist/esm/co-progress-bar.entry.js +8 -4
- package/dist/esm/co-progress-circle.entry.js +3 -3
- package/dist/esm/co-radio-group.entry.js +4 -4
- package/dist/esm/co-radio.entry.js +4 -4
- package/dist/esm/co-rating.entry.js +4 -4
- package/dist/esm/co-ref-field.entry.js +36 -13
- package/dist/esm/co-rich-text-editor.entry.js +1879 -33
- package/dist/esm/co-rich-text-toolbar.entry.js +995 -71
- package/dist/esm/co-rich-text-viewer.entry.js +55 -19
- package/dist/esm/co-row.entry.js +3 -3
- package/dist/esm/co-select.entry.js +8 -8
- package/dist/esm/co-separator.entry.js +2 -2
- package/dist/esm/co-sidebar-nav.entry.js +29 -9
- package/dist/esm/co-sidebar.entry.js +3 -3
- package/dist/esm/co-skeleton.entry.js +24 -0
- package/dist/esm/co-slider.entry.js +3 -3
- package/dist/esm/co-switch.entry.js +6 -6
- package/dist/esm/co-tab-group.entry.js +2 -2
- package/dist/esm/co-tab.entry.js +3 -3
- package/dist/esm/co-tags-field.entry.js +19 -13
- package/dist/esm/co-textarea.entry.js +11 -7
- package/dist/esm/co-toast.entry.js +2 -2
- package/dist/esm/co-toggle-button-group.entry.js +4 -4
- package/dist/esm/co-toggle-button.entry.js +4 -4
- package/dist/esm/co-tooltip.entry.js +51 -16
- package/dist/esm/co-transfer-list.entry.js +3 -3
- package/dist/esm/co-video.entry.js +837 -0
- package/dist/esm/cobalt.js +3 -3
- package/dist/esm/{dates-CyYF8IJE.js → dates-tPYikBRJ.js} +1 -1
- package/dist/esm/fieldChip-GPikjpYw.js +5 -0
- package/dist/esm/{index-BKmfyPZK.js → index-CYsftTKf.js} +45 -21
- package/dist/esm/{index-BjAqSidM.js → index-w_Wxgclf.js} +14508 -6305
- package/dist/esm/loader.js +3 -3
- package/dist/esm/overlayAfterClose-Ch1jfwZ2.js +10 -0
- package/dist/{cjs/sanitizer-CjHZAkOm.js → esm/purify.es-B2QLgWrz.js} +1 -110
- package/dist/esm/{requiredMark-DFvtYtkE.js → requiredMark-CEbXKHcU.js} +1 -1
- package/dist/esm/richTextI18n-B-ckjCUA.js +380 -0
- package/dist/esm/toolbar-config-ChibIpZv.js +212 -0
- package/dist/esm/tz-B6JZk8fL.js +119 -0
- package/dist/types/components/co-autocomplete/co-autocomplete.d.ts +2 -0
- package/dist/types/components/co-avatar/co-avatar.d.ts +2 -0
- package/dist/types/components/co-avatar-group/co-avatar-group.d.ts +33 -0
- package/dist/types/components/co-bottom-sheet/co-bottom-sheet.d.ts +81 -0
- package/dist/types/components/co-button/co-button.d.ts +3 -1
- package/dist/types/components/co-calendar-month/co-calendar-month.d.ts +83 -0
- package/dist/types/components/co-chip/co-chip.d.ts +7 -2
- package/dist/types/components/co-color-picker/co-color-picker.d.ts +2 -0
- package/dist/types/components/co-command-search/co-command-search.d.ts +39 -6
- package/dist/types/components/co-command-search/commandSearchGroup.d.ts +20 -0
- package/dist/types/components/co-command-search/commandSearchLogic.d.ts +17 -0
- package/dist/types/components/co-data-table/co-data-table.d.ts +2 -1
- package/dist/types/components/co-event-calendar/co-event-calendar.d.ts +110 -0
- package/dist/types/components/co-icon/co-icon.d.ts +1 -1
- package/dist/types/components/co-icon/iconLoader.d.ts +6 -0
- package/dist/types/components/co-icon-button/co-icon-button.d.ts +2 -0
- package/dist/types/components/co-json-field/co-json-field.d.ts +3 -0
- package/dist/types/components/co-list-footer/co-list-footer.d.ts +26 -0
- package/dist/types/components/co-list-item/co-list-item.d.ts +11 -0
- package/dist/types/components/co-modal/co-modal.d.ts +6 -0
- package/dist/types/components/co-number-field/co-number-field.d.ts +13 -0
- package/dist/types/components/co-overlay/co-overlay.d.ts +45 -0
- package/dist/types/components/co-overlay/focusTrap.d.ts +20 -0
- package/dist/types/components/co-overlay/overlayAfterClose.d.ts +5 -0
- package/dist/types/components/co-phone-field/co-phone-field.d.ts +2 -0
- package/dist/types/components/co-popover/co-popover.d.ts +9 -0
- package/dist/types/components/co-progress-bar/co-progress-bar.d.ts +2 -0
- package/dist/types/components/co-ref-field/co-ref-field.d.ts +17 -2
- package/dist/types/components/co-rich-text-editor/co-rich-text-editor.d.ts +161 -9
- package/dist/types/components/co-rich-text-toolbar/co-rich-text-toolbar.d.ts +119 -13
- package/dist/types/components/co-rich-text-viewer/co-rich-text-viewer.d.ts +1 -14
- package/dist/types/components/co-skeleton/co-skeleton.d.ts +13 -0
- package/dist/types/components/co-tags-field/co-tags-field.d.ts +2 -0
- package/dist/types/components/co-textarea/co-textarea.d.ts +3 -0
- package/dist/types/components/co-tooltip/co-tooltip.d.ts +12 -0
- package/dist/types/components/co-video/co-video.d.ts +203 -0
- package/dist/types/components.d.ts +1729 -72
- package/dist/types/utils/fieldChip.d.ts +37 -0
- package/dist/types/utils/icon-config.d.ts +11 -0
- package/dist/types/utils/richTextI18n.d.ts +130 -0
- package/dist/types/utils/sheetGesture.d.ts +31 -0
- package/package.json +3 -2
- package/dist/cjs/co-loader.cjs.entry.js +0 -34
- package/dist/cjs/co-overlay.cjs.entry.js +0 -23
- package/dist/cobalt/p-0a6d8061.entry.js +0 -1
- package/dist/cobalt/p-0bf288cd.entry.js +0 -1
- package/dist/cobalt/p-136bdbd2.entry.js +0 -1
- package/dist/cobalt/p-15708d32.entry.js +0 -1
- package/dist/cobalt/p-1578b019.entry.js +0 -1
- package/dist/cobalt/p-23d48581.entry.js +0 -1
- package/dist/cobalt/p-2718ff27.entry.js +0 -1
- package/dist/cobalt/p-2b4d8535.entry.js +0 -1
- package/dist/cobalt/p-3190d715.entry.js +0 -1
- package/dist/cobalt/p-41228dce.entry.js +0 -1
- package/dist/cobalt/p-44672953.entry.js +0 -1
- package/dist/cobalt/p-53ce9023.entry.js +0 -1
- package/dist/cobalt/p-5e7141aa.entry.js +0 -1
- package/dist/cobalt/p-5f905739.entry.js +0 -1
- package/dist/cobalt/p-6678ac0a.entry.js +0 -1
- package/dist/cobalt/p-66a912dd.entry.js +0 -1
- package/dist/cobalt/p-6759ee1c.entry.js +0 -1
- package/dist/cobalt/p-69a40bfd.entry.js +0 -1
- package/dist/cobalt/p-6a6a62cb.entry.js +0 -1
- package/dist/cobalt/p-6d43b6cd.entry.js +0 -1
- package/dist/cobalt/p-759c3dd0.entry.js +0 -1
- package/dist/cobalt/p-782f729f.entry.js +0 -1
- package/dist/cobalt/p-83b89bf8.entry.js +0 -1
- package/dist/cobalt/p-88dc561a.entry.js +0 -1
- package/dist/cobalt/p-8c27aff7.entry.js +0 -1
- package/dist/cobalt/p-996179f7.entry.js +0 -1
- package/dist/cobalt/p-9c533830.entry.js +0 -1
- package/dist/cobalt/p-9d89bf47.entry.js +0 -1
- package/dist/cobalt/p-BKmfyPZK.js +0 -2
- package/dist/cobalt/p-BchB6Hdr.js +0 -1
- package/dist/cobalt/p-DcK0GGZC.js +0 -2
- package/dist/cobalt/p-Qqq8fysz.js +0 -1
- package/dist/cobalt/p-aa17c70b.entry.js +0 -1
- package/dist/cobalt/p-ad4c1b41.entry.js +0 -1
- package/dist/cobalt/p-ae4d3207.entry.js +0 -1
- package/dist/cobalt/p-af64da37.entry.js +0 -1
- package/dist/cobalt/p-c6a242e4.entry.js +0 -1
- package/dist/cobalt/p-cd57e8b4.entry.js +0 -1
- package/dist/cobalt/p-ce3a535f.entry.js +0 -1
- package/dist/cobalt/p-d958566a.entry.js +0 -1
- package/dist/cobalt/p-dd873bf8.entry.js +0 -1
- package/dist/cobalt/p-e4de8865.entry.js +0 -1
- package/dist/cobalt/p-eba0bf7f.entry.js +0 -1
- package/dist/cobalt/p-fad3605d.entry.js +0 -1
- package/dist/cobalt/p-ff2690e5.entry.js +0 -1
- package/dist/components/p-BXdfh__-.js +0 -1
- package/dist/components/p-BchB6Hdr.js +0 -1
- package/dist/components/p-BiW0ubLs.js +0 -1
- package/dist/components/p-CaMgu2_g.js +0 -1
- package/dist/components/p-DBhNS7JD.js +0 -1
- package/dist/components/p-DPi_U-Kl.js +0 -1
- package/dist/components/p-DcK0GGZC.js +0 -2
- package/dist/components/p-MiSJXuBx.js +0 -1
- package/dist/components/p-Sgn-2g8m.js +0 -1
- package/dist/components/p-jDjfGZJp.js +0 -1
- package/dist/components/p-o8hrDIKe.js +0 -1
- package/dist/esm/co-loader.entry.js +0 -32
- package/dist/esm/co-overlay.entry.js +0 -21
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as t}from"./p-DcK0GGZC.js";export{S as SANITIZE_CONFIGS}from"./p-DcK0GGZC.js";function e(t){this.content=t}function n(t,e,r){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:r;let s=t.child(i),o=e.child(i);if(s!=o){if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let t=0;s.text[t]==o.text[t];t++)r++;return r}if(s.content.size||o.content.size){let t=n(s.content,o.content,r+1);if(null!=t)return t}r+=s.nodeSize}else r+=s.nodeSize}}function r(t,e,n,i){for(let s=t.childCount,o=e.childCount;;){if(0==s||0==o)return s==o?null:{a:n,b:i};let l=t.child(--s),u=e.child(--o),h=l.nodeSize;if(l!=u){if(!l.sameMarkup(u))return{a:n,b:i};if(l.isText&&l.text!=u.text){let t=0,e=Math.min(l.text.length,u.text.length);for(;t<e&&l.text[l.text.length-t-1]==u.text[u.text.length-t-1];)t++,n--,i--;return{a:n,b:i}}if(l.content.size||u.content.size){let t=r(l.content,u.content,n-1,i-1);if(t)return t}n-=h,i-=h}else n-=h,i-=h}}e.prototype={constructor:e,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,s=i.find(t),o=i.content.slice();return-1==s?o.push(r||t,n):(o[s+1]=n,r&&(o[s]=r)),new e(o)},remove:function(t){var n=this.find(t);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new e(r)},addToStart:function(t,n){return new e([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new e(r)},addBefore:function(t,n,r){var i=this.remove(n),s=i.content.slice(),o=i.find(t);return s.splice(-1==o?s.length:o,0,n,r),new e(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=e.from(t)).size?new e(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=e.from(t)).size?new e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=e.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var t={};return this.forEach((function(e,n){t[e]=n})),t},get size(){return this.content.length>>1}},e.from=function(t){if(t instanceof e)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new e(n)};class i{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,i){for(let s=0,o=0;o<e;s++){let l=this.content[s],u=o+l.nodeSize;if(u>t&&!1!==n(l,r+o,i||null,s)&&l.content.size){let i=o+1;l.nodesBetween(Math.max(0,t-i),Math.min(l.content.size,e-i),n,r+i)}o=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",s=!0;return this.nodesBetween(t,e,((o,l)=>{let u=o.isText?o.text.slice(Math.max(t,l)-l,e-l):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=u}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),s=1);s<t.content.length;s++)r.push(t.content[s]);return new i(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let i=0,s=0;s<e;i++){let o=this.content[i],l=s+o.nodeSize;l>t&&((s<t||l>e)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))),n.push(o),r+=o.nodeSize),s=l}return new i(n,r)}cutByIndex(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),s=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new i(r,s)}addToStart(t){return new i([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new i(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return n(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return r(this,t,e,n)}findIndex(t){if(0==t)return o(0,t);if(t==this.size)return o(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,n=0;;e++){let r=n+this.child(e).nodeSize;if(r>=t)return r==t?o(e+1,r):o(e,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return i.empty;let e,n=0;for(let r=0;r<t.length;r++){let i=t[r];n+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new i(e||t,n)}static from(t){if(!t)return i.empty;if(t instanceof i)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new i([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);const s={index:0,offset:0};function o(t,e){return s.index=t,s.offset=e,s}function l(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!l(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!l(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let u=class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&l(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort(((t,e)=>t.type.rank-e.type.rank)),n}};u.none=[];class h extends Error{}class a{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=f(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return n&&new a(n,this.openStart,this.openEnd)}removeBetween(t,e){return new a(c(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return a.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new a(i.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new a(t,n,r)}}function c(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(c(s.content,e-i-1,n-i-1)))}function f(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),u=t.maybeChild(o);if(l==e||u.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let h=f(u.content,e-l-1,n,0==o?r-1:0,o==t.childCount-1?i-1:0,u);return h&&t.replaceChild(o,u.copy(h))}function d(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return p(t,e,n,0)}function p(t,e,n,r){let s=t.index(r),o=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let i=p(t,e,n,r+1);return o.copy(o.content.replaceChild(s,i))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:s,end:l}=function(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)r=e.node(t).copy(i.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return v(o,y(t,s,l,e,r))}{let r=t.parent,i=r.content;return v(r,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return v(o,k(t,e,r))}function m(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function g(t,e,n){let r=t.node(n);return m(r,e.node(n)),r}function w(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function b(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(w(t.nodeAfter,r),s++));for(let t=s;t<o;t++)w(i.child(t),r);e&&e.depth==n&&e.textOffset&&w(e.nodeBefore,r)}function v(t,e){return t.type.checkContent(e),t.copy(e)}function y(t,e,n,r,s){let o=t.depth>s&&g(t,e,s+1),l=r.depth>s&&g(n,r,s+1),u=[];return b(null,t,s,u),o&&l&&e.index(s)==n.index(s)?(m(o,l),w(v(o,y(t,e,n,r,s+1)),u)):(o&&w(v(o,k(t,e,s+1)),u),b(e,n,s,u),l&&w(v(l,k(n,r,s+1)),u)),b(r,null,s,u),new i(u)}function k(t,e,n){let r=[];return b(null,t,n,r),t.depth>n&&w(v(g(t,e,n+1),k(t,e,n+1)),r),b(e,null,n,r),new i(r)}a.empty=new a(i.empty,0,0);class M{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return u.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new O(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,i=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(i),o=i-s;if(n.push(e,t,r+s),!o)break;if(e=e.child(t),e.isText)break;i=o-1,r+=s+1}return new M(e,n,i)}static resolveCached(t,e){let n=E.get(t);if(n)for(let t=0;t<n.elts.length;t++){let r=n.elts[t];if(r.pos==e)return r}else E.set(t,n=new x);let r=n.elts[n.i]=M.resolve(t,e);return n.i=(n.i+1)%T,r}}class x{constructor(){this.elts=[],this.i=0}}const T=12,E=new WeakMap;class O{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}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 A=Object.create(null);class L{constructor(t,e,n,r=u.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||i.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&l(this.attrs,e||t.defaultAttrs||A)&&u.sameSet(this.marks,n||u.none)}copy(t=null){return t==this.content?this:new L(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new L(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return a.empty;let r=this.resolve(t),i=this.resolve(e),s=n?0:r.sharedDepth(e),o=r.start(s),l=r.node(s).content.cut(r.pos-o,i.pos-o);return new a(l,r.depth-s,i.depth-s)}replace(t,e,n){return d(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return M.resolveCached(this,t)}resolveNoCache(t){return M.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),$(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=i.empty,r=0,s=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,r,s),l=o&&o.matchFragment(this.content,e);if(!l||!l.validEnd)return!1;for(let t=r;t<s;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(n),s=i&&i.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=u.none;for(let e=0;e<this.marks.length;e++){let n=this.marks[e];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!u.sameSet(t,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 t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=i.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,r,n);return s.type.checkAttrs(s.attrs),s}}L.prototype.text=void 0;class C extends L{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new C(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new C(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function $(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class R{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new N(t,e);if(null==n.next)return R.empty;let r=P(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return function n(r){let i=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);z(t,n).forEach((t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let s=e[r.join(",")]=new R(r.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(B);s.next.push({type:i[t][0],next:e[r.join(",")]||n(r)})}return s}(z(t,0))}(function(t){let e=[[]];return i(function t(e,s){if("choice"==e.type)return e.exprs.reduce(((e,n)=>e.concat(t(n,s))),[]);if("seq"!=e.type){if("star"==e.type){let o=n();return r(s,o),i(t(e.expr,o),o),[r(o)]}if("plus"==e.type){let o=n();return i(t(e.expr,s),o),i(t(e.expr,o),o),[r(o)]}if("opt"==e.type)return[r(s)].concat(t(e.expr,s));if("range"==e.type){let o=s;for(let r=0;r<e.min;r++){let r=n();i(t(e.expr,o),r),o=r}if(-1==e.max)i(t(e.expr,o),o);else for(let s=e.min;s<e.max;s++){let s=n();r(o,s),i(t(e.expr,o),s),o=s}return[r(o)]}if("name"==e.type)return[r(s,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let o=t(e.exprs[r],s);if(r==e.exprs.length-1)return o;i(o,s=n())}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach((t=>t.to=e))}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:n,next:o}=t.next[e];s.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function s(o,l){let u=o.matchFragment(t,n);if(u&&(!e||u.validEnd))return i.from(l.map((t=>t.createAndFill())));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=s(n,l.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:s,next:o}=i.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r})).join("\n")}}R.empty=new R(!0);class N{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function P(t){let e=[];do{e.push(I(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function I(t){let e=[];do{e.push(H(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function H(t){let e=function(t){if(t.eat("(")){let e=P(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let t in n){let r=n[t];r.isInGroup(e)&&i.push(r)}return 0==i.length&&t.err("No node type or group '"+e+"' found"),i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=j(t,e)}return e}function D(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function j(t,e){let n=D(t),r=n;return t.eat(",")&&(r="}"!=t.next?D(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function B(t,e){return e-t}function z(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:s}=i[t];r||-1!=n.indexOf(s)||e(s)}}(e),n.sort(B)}function F(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function U(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(void 0===i){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=e.default}n[r]=i}return n}function _(t,e,n){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in t){let r=t[n];r.validate&&r.validate(e[n])}}function J(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new q(t,r,e[r]);return n}let K=class t{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=J(t,n.attrs),this.defaultAttrs=F(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==R.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:U(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new L(this,this.computeAttrs(t),i.from(e),u.setFrom(n))}createChecked(t=null,e,n){return e=i.from(e),this.checkContent(e),new L(this,this.computeAttrs(t),e,u.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=i.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),s=r&&r.fillBefore(i.empty,!0);return s?new L(this,t,e.append(s),u.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){_(this.attrs,t,"node")}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:u.none:t}static compile(e,n){let r=Object.create(null);e.forEach(((e,i)=>r[e]=new t(e,n,i)));let i=n.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 t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class q{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class W{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=J(t,r.attrs),this.excluded=null;let i=F(this.attrs);this.instance=i?new u(this,i):null}create(t=null){return!t&&this.instance?this.instance:new u(this,U(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,i)=>n[t]=new W(t,r++,e,i))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){_(this.attrs,t,"mark")}excludes(t){return this.excluded.indexOf(t)>-1}}class G{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let e in t)n[e]=t[e];n.nodes=e.from(t.nodes),n.marks=e.from(t.marks||{}),this.nodes=K.compile(this.spec.nodes,this),this.marks=W.compile(this.spec.marks,this);let r=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],n=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=r[n]||(r[n]=R.parse(n,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?V(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:V(this,n.split(" "))}this.nodeFromJSON=t=>L.fromJSON(this,t),this.markFromJSON=t=>u.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new C(n,n.defaultAttrs,t,u.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function V(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let e in t.marks){let r=t.marks[e];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class Q{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new nt(this,e,!1);return n.addAll(t,u.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new nt(this,e,!0);return n.addAll(t,u.none,e.from,e.to),a.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(rt(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(!(0!=s.indexOf(t)||r.context&&!n.matchesContext(r.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach((t=>{n(t=it(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach((t=>{n(t=it(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Q(t,Q.schemaRules(t)))}}const Z={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},Y={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},X={ol:!0,ul:!0};function tt(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class et{constructor(t,e,n,r,i,s){this.type=t,this.attrs=e,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=u.none,this.match=i||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(i.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=i.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Z.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class nt{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,i=e.topNode,s=tt(null,e.preserveWhitespace,0)|(n?4:0);r=i?new et(i.type,i.attrs,u.none,!0,e.topMatch||i.type.contentMatch,s):new et(n?null:t.schema.topNodeType,null,u.none,!0,null,s),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:s}=this.parser;if("full"===i||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let t=n.split(/\r?\n|\r/);for(let n=0;n<t.length;n++)n&&this.insertNode(s.linebreakReplacement.create(),e,!0),t[n]&&this.insertNode(s.text(t[n]),e,!/\S/.test(t[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=r.content[r.content.length-1],i=t.previousSibling;(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(s.text(n),e,!/\S/.test(n)),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let r=this.localPreserveWS,i=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s,o=t.nodeName.toLowerCase();X.hasOwnProperty(o)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&X.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,n));t:if(l?l.ignore:Y.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,e);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let n,r=this.needsBlock;if(Z.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=l&&l.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,l,n,!1===l.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let r=this.parser.matchedStyles[t],i=n.getPropertyValue(r);if(i)for(let t;;){let n=this.parser.matchStyle(r,i,this,t);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter((t=>!n.clearMark(t))):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,r){let i,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),n,"BR"==t.nodeName)||this.leafFallback(t,n);else{let t=this.enter(s,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else n=n.concat(this.parser.schema.marks[e.mark].create(e.attrs));let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,n,!1)));else{let r=t;"string"==typeof e.contentElement?r=t.querySelector(e.contentElement):"function"==typeof e.contentElement?r=e.contentElement(t):e.contentElement&&(r=e.contentElement),this.findAround(t,r,!0),this.addAll(r,n),this.findAround(t,r,!1)}i&&this.sync(o)&&this.open--}addAll(t,e,n,r){let i=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=null==r?null:t.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,e);this.findAtPoint(t,i)}findPlace(t,e,n){let r,i;for(let e=this.open,s=0;e>=0;e--){let o=this.nodes[e],l=o.findWrapping(t);if(l&&(!r||r.length>l.length+s)&&(r=l,i=o,!l.length))break;if(o.solid){if(n)break;s+=2}}if(!r)return null;this.sync(i);for(let t=0;t<r.length;t++)e=this.enterInner(r[t],null,e,!1);return e}insertNode(t,e,n){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let r=this.findPlace(t,e,n);if(r){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let n=u.none;for(let i of r.concat(t.marks))(e.type?e.type.allowsMarkType(i.type):st(i.type,t.type))&&(n=i.addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n,r){let i=this.findPlace(t.create(e),n,!1);return i&&(i=this.enterInner(t,e,n,!0,r)),i}enterInner(t,e,n,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=tt(t,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let l=u.none;return n=n.filter((e=>!(s.type?s.type.allowsMarkType(e.type):st(e.type,t))||(l=e.addToSet(l),!1))),this.nodes.push(new et(t,e,l,r,null,o)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));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(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)&&e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=(r?0:1)-(n?n.depth+1:0),s=(t,o)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;o>=i;o--)if(s(t-1,o))return!0;return!1}{let t=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return!1;o--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function rt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function it(t){let e={};for(let n in t)e[n]=t[n];return e}function st(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:i}=t.edge(n);if(r==e)return!0;if(s.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class ot{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=ut(e).createDocumentFragment());let r=n,i=[];return t.forEach((t=>{if(i.length||t.marks.length){let n=0,s=0;for(;n<i.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(i[n][0])||!1===e.type.spec.spanning)break;n++,s++}else s++}for(;n<i.length;)r=i.pop()[1];for(;s<t.marks.length;){let n=t.marks[s++],o=this.serializeMark(n,t.isInline,e);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){if(t.isText)return ut(e).createTextNode(t.text);let{dom:n,contentDOM:r}=at(ut(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&at(ut(n),r(t,e),null,t.attrs)}static renderSpec(t,e,n=null,r){return"string"==typeof e?{dom:t.createTextNode(e)}:at(t,e,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ot(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=lt(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return lt(t.marks)}}function lt(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ut(t){return t.document||window.document}const ht=new WeakMap;function at(t,e,n,r){if(1==e.nodeType)return{dom:e};if(e.dom&&1==e.dom.nodeType)return e;let i,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=function(t){let e=ht.get(t);return void 0===e&&ht.set(t,e=function(t){let e=null;return function t(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])e||(e=[]),e.push(n);else for(let e=0;e<n.length;e++)t(n[e]);else for(let e in n)t(n[e])}(t),e}(t)),e}(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,l=s.indexOf(" ");l>0&&(n=s.slice(0,l),s=s.slice(l+1));let u=n?t.createElementNS(n,s):t.createElement(s),h=e[1],a=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){a=2;for(let t in h)if(null!=h[t]){let e=t.indexOf(" ");e>0?u.setAttributeNS(t.slice(0,e),t.slice(e+1),h[t]):"style"==t&&u.style?u.style.cssText=h[t]:u.setAttribute(t,h[t])}}for(let i=a;i<e.length;i++){let s=e[i];if(0===s){if(i<e.length-1||i>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}if("string"==typeof s)u.appendChild(t.createTextNode(s));else{let{dom:e,contentDOM:i}=at(t,s,n,r);if(u.appendChild(e),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:u,contentDOM:o}}const ct=Math.pow(2,16);function ft(t){return 65535&t}class dt{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class pt{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&pt.empty)return pt.empty}recover(t){let e=0,n=ft(t);if(!this.inverted)for(let t=0;t<n;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/ct}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[o+i],h=this.ranges[o+s],a=l+u;if(t<=a){let i=l+r+((u?t==l?-1:t==a?1:e:e)<0?0:h);if(n)return i;let s=t==l?2:t==a?1:4;return(e<0?t!=l:t!=a)&&(s|=8),new dt(i,s,t==(e<0?l:a)?null:o/3+(t-l)*ct)}r+=h-u}return n?t+r:new dt(t+r,0,null)}touches(t,e){let n=0,r=ft(e),i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let o=this.ranges[e]-(this.inverted?n:0);if(o>t)break;let l=this.ranges[e+i];if(t<=o+l&&e==3*r)return!0;n+=this.ranges[e+s]-l}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i),u=this.ranges[r+e],h=this.ranges[r+n];t(o,o+u,l,l+h),i+=h-u}}invert(){return new pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?pt.empty:new pt(t<0?[0,-t,0]:[0,0,t])}}pt.empty=new pt([]);class mt{constructor(t,e,n=0,r=(t?t.length:0)){this.mirror=e,this.from=n,this.to=r,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new mt(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),null!=e&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,n=this._maps.length;e<t._maps.length;e++){let r=t.getMirror(e);this.appendMap(t._maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this._maps.length+t._maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t._maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new mt;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(t,e);if(null!=i.recover){let e=this.getMirror(n);if(null!=e&&e>n&&e<this.to){n=e,t=this._maps[e].recover(i.recover);continue}}r|=i.delInfo,t=i.pos}return n?t:new dt(t,r,null)}}const gt=Object.create(null);class wt{getMap(){return pt.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=gt[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in gt)throw new RangeError("Duplicate use of step JSON ID "+t);return gt[t]=e,e.prototype.jsonID=t,e}}class bt{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new bt(t,null)}static fail(t){return new bt(null,t)}static fromReplace(t,e,n,r){try{return bt.ok(t.replace(e,n,r))}catch(t){if(t instanceof h)return bt.fail(t.message);throw t}}}function vt(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(vt(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return i.fromArray(r)}class yt extends wt{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new a(vt(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),r),e.openStart,e.openEnd);return bt.fromReplace(t,this.from,this.to,i)}invert(){return new kt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new yt(e.pos,n.pos,this.mark)}merge(t){return t instanceof yt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new yt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new yt(e.from,e.to,t.markFromJSON(e.mark))}}wt.jsonID("addMark",yt);class kt extends wt{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new a(vt(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return bt.fromReplace(t,this.from,this.to,n)}invert(){return new yt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new kt(e.pos,n.pos,this.mark)}merge(t){return t instanceof kt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new kt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new kt(e.from,e.to,t.markFromJSON(e.mark))}}wt.jsonID("removeMark",kt);class Mt extends wt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return bt.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return bt.fromReplace(t,this.pos,this.pos+1,new a(i.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new Mt(this.pos,e.marks[n]);return new Mt(this.pos,this.mark)}}return new xt(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Mt(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mt(e.pos,t.markFromJSON(e.mark))}}wt.jsonID("addNodeMark",Mt);class xt extends wt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return bt.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return bt.fromReplace(t,this.pos,this.pos+1,new a(i.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new Mt(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new xt(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xt(e.pos,t.markFromJSON(e.mark))}}wt.jsonID("removeNodeMark",xt);class Tt extends wt{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&Et(t,this.from,this.to)?bt.fail("Structure replace would overwrite content"):bt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new pt([this.from,this.to-this.from,this.slice.size])}invert(t){return new Tt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),n=this.from==this.to&&Tt.MAP_BIAS<0?e:t.mapResult(this.from,1);return n.deletedAcross&&e.deletedAcross?null:new Tt(n.pos,Math.max(n.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Tt)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?a.empty:new a(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Tt(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?a.empty:new a(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Tt(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Tt(e.from,e.to,a.fromJSON(t,e.slice),!!e.structure)}}Tt.MAP_BIAS=1,wt.jsonID("replace",Tt);class St extends wt{constructor(t,e,n,r,i,s,o=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(t){if(this.structure&&(Et(t,this.from,this.gapFrom)||Et(t,this.gapTo,this.to)))return bt.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return bt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?bt.fromReplace(t,this.from,this.to,n):bt.fail("Content does not fit in gap")}getMap(){return new pt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new St(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||i>n.pos?null:new St(e.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new St(e.from,e.to,e.gapFrom,e.gapTo,a.fromJSON(t,e.slice),e.insert,!!e.structure)}}function Et(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let t=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function Ot(t,e,n,r=n.contentMatch,s=!0){let o=t.doc.nodeAt(e),l=[],u=e+1;for(let e=0;e<o.childCount;e++){let h=o.child(e),c=u+h.nodeSize,f=r.matchType(h.type);if(f){r=f;for(let e=0;e<h.marks.length;e++)n.allowsMarkType(h.marks[e].type)||t.step(new kt(u,c,h.marks[e]));if(s&&h.isText&&"pre"!=n.whitespace){let t,e,r=/\r?\n|\r/g;for(;t=r.exec(h.text);)e||(e=new a(i.from(n.schema.text(" ",n.allowedMarks(h.marks))),0,0)),l.push(new Tt(u+t.index,u+t.index+t[0].length,e))}}else l.push(new Tt(u,c,a.empty));u=c}if(!r.validEnd){let e=r.fillBefore(i.empty,!0);t.replace(u,u,new a(e,0,0))}for(let e=l.length-1;e>=0;e--)t.step(l[e])}function At(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Lt(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,r=0,i=0;;--n){let s=t.$from.node(n),o=t.$from.index(n)+r,l=t.$to.indexAfter(n)-i;if(n<t.depth&&s.canReplace(o,l,e))return n;if(0==n||s.type.spec.isolating||!At(s,o,l))break;o&&(r=1),l<s.childCount&&(i=1)}return null}function Ct(t,e,n=null,r=t){let i=function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);return s&&n.canReplaceWith(r,i,s.length?s[0]:e)?s:null}(t,e),s=i&&function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let t=r;l&&t<i;t++)l=l.matchType(n.child(t).type);return l&&l.validEnd?o:null}(r,e);return s?i.map($t).concat({type:e,attrs:n}).concat(s.map($t)):null}function $t(t){return{type:t,attrs:null}}function Rt(t,e,n,r){e.forEach(((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let i=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}}))}function Nt(t,e,n,r){e.forEach(((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text("\n"))}}))}function Pt(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let t=i.depth-1,e=n-2;t>s;t--,e--){let n=i.node(t),s=i.index(t);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(s,n.childCount),l=r&&r[e+1];l&&(o=o.replaceChild(0,l.type.create(l.attrs)));let u=r&&r[e]||n;if(!n.canReplace(s+1,n.childCount)||!u.type.validContent(o))return!1}let l=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(l,l,u?u.type:i.node(s+1).type)}function It(t,e){let n=t.resolve(e),r=n.index();return Ht(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ht(t,e){return!(!t||!e||t.isLeaf||!function(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i);if(n=n.matchType(s.type==r?t.type.schema.nodes.text:s.type),!n)return!1;if(!t.type.allowsMarks(s.marks))return!1}return n.validEnd}(t,e))}function Dt(t,e,n=-1){let r=t.resolve(e);for(let t=r.depth;;t--){let i,s,o=r.index(t);if(t==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(t+1),o++,s=r.node(t).maybeChild(o)):(i=r.node(t).maybeChild(o-1),s=r.node(t+1)),i&&!i.isTextblock&&Ht(i,s)&&r.node(t).canReplace(o,o+1))return e;if(0==t)break;e=n<0?r.before(t):r.after(t)}}function jt(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let t=0;t<n.openStart;t++)i=i.firstChild.content;for(let t=1;t<=(0==n.openStart&&n.size?2:1);t++)for(let e=r.depth;e>=0;e--){let n=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,s=r.index(e)+(n>0?1:0),o=r.node(e),l=!1;if(1==t)l=o.canReplace(s,s,i);else{let t=o.contentMatchAt(s).findWrapping(i.firstChild.type);l=t&&o.canReplaceWith(s,s,t[0])}if(l)return 0==n?r.pos:n<0?r.before(e+1):r.after(e+1)}return null}function Bt(t,e,n=e,r=a.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return zt(i,s,r)?new Tt(e,n,r):new Ft(i,s,r).fit()}function zt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}wt.jsonID("replaceAround",St);class Ft{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=i.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=i.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let l=new a(i,s,o);return t>-1?new St(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new Tt(n.pos,r.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let i=e.firstChild;if(e.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){t=n;break}e=i.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,r=null;n?(r=Jt(this.unplaced.content,n-1).firstChild,t=r.content):t=this.unplaced.content;let s=t.firstChild;for(let t=this.depth;t>=0;t--){let o,{type:l,match:u}=this.frontier[t],h=null;if(1==e&&(s?u.matchType(s.type)||(h=u.fillBefore(i.from(s),!1)):r&&l.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:t,parent:r,inject:h};if(2==e&&s&&(o=u.findWrapping(s.type)))return{sliceDepth:n,frontierDepth:t,parent:r,wrap:o};if(r&&u.matchType(r.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=Jt(t,e);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new a(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),0))}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=Jt(t,e);if(r.childCount<=1&&e>0){let i=t.size-e<=e+r.size;this.unplaced=new a(Ut(t,e-1,1),e-1,i?e-1:n)}else this.unplaced=new a(Ut(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:r,wrap:s}){for(;this.depth>e;)this.closeFrontierNode();if(s)for(let t=0;t<s.length;t++)this.openFrontierNode(s[t]);let o=this.unplaced,l=n?n.content:o.content,u=o.openStart-t,h=0,c=[],{match:f,type:d}=this.frontier[e];if(r){for(let t=0;t<r.childCount;t++)c.push(r.child(t));f=f.matchFragment(r)}let p=l.size+t-(o.content.size-o.openEnd);for(;h<l.childCount;){let t=l.child(h),e=f.matchType(t.type);if(!e)break;h++,(h>1||0==u||t.content.size)&&(f=e,c.push(Kt(t.mark(d.allowedMarks(t.marks)),1==h?u:0,h==l.childCount?p:-1)))}let m=h==l.childCount;m||(p=-1),this.placed=_t(this.placed,e,i.from(c)),this.frontier[e].match=f,m&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=l;t<p;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=m?0==t?a.empty:new a(Ut(o.content,t-1,1),t-1,p<0?o.openEnd:t-1):new a(Ut(o.content,t,h),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!qt(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:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=qt(t,e,r,n,i);if(s){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],i=qt(t,n,r,e,!0);if(!i||i.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=_t(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=_t(this.placed,this.depth,i.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(i.empty,!0);t.childCount&&(this.placed=_t(this.placed,this.frontier.length,t))}}function Ut(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ut(t.firstChild.content,e-1,n)))}function _t(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(_t(t.lastChild.content,e-1,n)))}function Jt(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Kt(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Kt(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(i.empty,!0)))),t.copy(r)}function qt(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,s.content,o)?l:null}function Wt(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Wt(i.content,e+1,n,r,i)))}if(e>r){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i.empty,!0))}return t}function Gt(t,e){let n=[];for(let r=Math.min(t.depth,e.depth);r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vt extends wt{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return bt.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return bt.fromReplace(t,this.pos,this.pos+1,new a(i.from(r),0,e.isLeaf?0:1))}getMap(){return pt.empty}invert(t){return new Vt(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Vt(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vt(e.pos,e.attr,e.value)}}wt.jsonID("attr",Vt);class Qt extends wt{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return bt.ok(n)}getMap(){return pt.empty}invert(t){return new Qt(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qt(e.attr,e.value)}}wt.jsonID("docAttr",Qt);let Zt=class extends Error{};Zt=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(Zt.prototype=Object.create(Error.prototype)).constructor=Zt,Zt.prototype.name="TransformError";class Yt{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new mt}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Zt(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(t=r.map(t,1),e=r.map(e,-1)),r.forEach(((n,r,i,s)=>{t=Math.min(t,i),e=Math.max(e,s)}))}return 1e9==t?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=a.empty){let r=Bt(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,n){return this.replace(t,e,new a(i.from(n),0,0))}delete(t,e){return this.replace(t,e,a.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(zt(i,s,r))return t.step(new Tt(e,n,r));let o=Gt(i,s);0==o[o.length-1]&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let t=i.depth,e=i.pos-1;t>0;t--,e--){let n=i.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(t)>-1?l=t:i.before(t)==e&&o.splice(1,0,-t)}let u=o.indexOf(l),h=[],c=r.openStart;for(let t=r.content,e=0;;e++){let n=t.firstChild;if(h.push(n),e==r.openStart)break;t=n.content}for(let t=c-1;t>=0;t--){let e=h[t],n=(f=e.type).spec.defining||f.spec.definingForContent;if(n&&!e.sameMarkup(i.node(Math.abs(l)-1)))c=t;else if(n||!e.type.isTextblock)break}var f;for(let e=r.openStart;e>=0;e--){let l=(e+c+1)%(r.openStart+1),f=h[l];if(f)for(let e=0;e<o.length;e++){let h=o[(e+u)%o.length],c=!0;h<0&&(c=!1,h=-h);let d=i.node(h-1),p=i.index(h-1);if(d.canReplaceWith(p,p,f.type,f.marks))return t.replace(i.before(h),c?s.after(h):n,new a(Wt(r.content,0,r.openStart,l),l,r.openEnd))}}let d=t.steps.length;for(let l=o.length-1;l>=0&&(t.replace(e,n,r),!(t.steps.length>d));l--){let t=o[l];t<0||(e=i.before(t),n=s.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let t=r.depth-1;t>=0;t--){let e=r.index(t);if(r.node(t).canReplaceWith(e,e,n))return r.before(t+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let t=r.depth-1;t>=0;t--){let e=r.indexAfter(t);if(r.node(t).canReplaceWith(e,e,n))return r.after(t+1);if(e<r.node(t).childCount)return null}return null}(t.doc,e,r.type);null!=i&&(e=n=i)}t.replaceRange(e,n,new a(i.from(r),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let s=r.sharedDepth(n),o=!1;for(let t=r.depth;t>s;t--)r.node(t).type.spec.isolating&&(o=!0);for(let t=i.depth;t>s;t--)i.node(t).type.spec.isolating&&(o=!0);if(!o){for(let t=r.depth;t>0&&e==r.start(t);t--)e=r.before(t);for(let t=i.depth;t>0&&n==i.start(t);t--)n=i.before(t);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=Gt(r,i);for(let e=0;e<s.length;e++){let n=s[e],o=e==s.length-1;if(o&&0==n||r.node(n).type.contentMatch.validEnd)return t.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return t.delete(r.before(n),i.after(n))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=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 t.delete(r.before(s),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:r,$to:s,depth:o}=e,l=r.before(o+1),u=s.after(o+1),h=l,c=u,f=i.empty,d=0;for(let t=o,e=!1;t>n;t--)e||r.index(t)>0?(e=!0,f=i.from(r.node(t).copy(f)),d++):h--;let p=i.empty,m=0;for(let t=o,e=!1;t>n;t--)e||s.after(t+1)<s.end(t)?(e=!0,p=i.from(s.node(t).copy(p)),m++):c++;t.step(new St(h,c,l,u,new a(f.append(p),d,m),f.size-d,!0))}(this,t,e),this}join(t,e=1){return function(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let t="pre"==o.whitespace,e=!!o.contentMatch.matchType(i);t&&!e?r=!1:!t&&e&&(r=!0)}let l=t.steps.length;if(!1===r){let r=t.doc.resolve(e+n);Nt(t,r.node(),r.before(),l)}o.inlineContent&&Ot(t,e+n-1,o,s.node().contentMatchAt(s.index()),null==r);let u=t.mapping.slice(l),h=u.map(e-n);if(t.step(new Tt(h,u.map(e+n,-1),a.empty,!0)),!0===r){let e=t.doc.resolve(h);Rt(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return function(t,e,n){let r=i.empty;for(let t=n.length-1;t>=0;t--){if(r.size){let e=n[t].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=i.from(n[t].type.create(n[t].attrs,r))}let s=e.start,o=e.end;t.step(new St(s,o,s,o,new a(r,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,r=null){return function(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{let l="function"==typeof s?s(e):s;if(e.isTextblock&&!e.hasMarkup(r,l)&&function(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(t.doc,t.mapping.slice(o).map(n),r)){let s=null;if(r.schema.linebreakReplacement){let t="pre"==r.whitespace,e=!!r.contentMatch.matchType(r.schema.linebreakReplacement);t&&!e?s=!1:!t&&e&&(s=!0)}!1===s&&Nt(t,e,n,o),Ot(t,t.mapping.slice(o).map(n,1),r,void 0,null===s);let u=t.mapping.slice(o),h=u.map(n,1),c=u.map(n+e.nodeSize,1);return t.step(new St(h,c,h+1,c-1,new a(i.from(r.create(l,null,e.marks)),0,0),1,!0)),!0===s&&Rt(t,e,n,o),!1}}))}(this,t,e,n,r),this}setNodeMarkup(t,e,n=null,r){return function(t,e,n,r,s){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(r,null,s||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new St(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new a(i.from(l),0,0),1,!0))}(this,t,e,n,r),this}setNodeAttribute(t,e,n){return this.step(new Vt(t,e,n)),this}setDocAttribute(t,e){return this.step(new Qt(t,e)),this}addNodeMark(t,e){return this.step(new Mt(t,e)),this}removeNodeMark(t,e){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(e instanceof u)e.isInSet(n.marks)&&this.step(new xt(t,e));else{let r,i=n.marks,s=[];for(;r=e.isInSet(i);)s.push(new xt(t,r)),i=r.removeFromSet(i);for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t,e=1,n){return function(t,e,n=1,r){let s=t.doc.resolve(e),o=i.empty,l=i.empty;for(let t=s.depth,e=s.depth-n,u=n-1;t>e;t--,u--){o=i.from(s.node(t).copy(o));let e=r&&r[u];l=i.from(e?e.type.create(e.attrs,l):s.node(t).copy(l))}t.step(new Tt(e,e,new a(o.append(l),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,r){let i,s,o=[],l=[];t.doc.nodesBetween(e,n,((t,u,h)=>{if(!t.isInline)return;let a=t.marks;if(!r.isInSet(a)&&h.type.allowsMarkType(r.type)){let h=Math.max(u,e),c=Math.min(u+t.nodeSize,n),f=r.addToSet(a);for(let t=0;t<a.length;t++)a[t].isInSet(f)||(i&&i.to==h&&i.mark.eq(a[t])?i.to=c:o.push(i=new kt(h,c,a[t])));s&&s.to==h?s.to=c:l.push(s=new yt(h,c,r))}})),o.forEach((e=>t.step(e))),l.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,((t,o)=>{if(!t.isInline)return;s++;let l=null;if(r instanceof W){let e,n=t.marks;for(;e=r.isInSet(n);)(l||(l=[])).push(e),n=e.removeFromSet(n)}else r?r.isInSet(t.marks)&&(l=[r]):l=t.marks;if(l&&l.length){let r=Math.min(o+t.nodeSize,n);for(let t=0;t<l.length;t++){let n,u=l[t];for(let t=0;t<i.length;t++){let e=i[t];e.step==s-1&&u.eq(i[t].style)&&(n=e)}n?(n.to=r,n.step=s):i.push({style:u,from:Math.max(o,e),to:r,step:s})}}})),i.forEach((e=>t.step(new kt(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return Ot(this,t,e,n),this}}const Xt=Object.create(null);class te{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new ee(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=a.empty){let n=e.content.lastChild,r=null;for(let t=0;t<e.openEnd;t++)r=n,n=n.lastChild;let i=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:u}=s[o],h=t.mapping.slice(i);t.replaceRange(h.map(l.pos),h.map(u.pos),o?a.empty:e),0==o&&ce(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],l=t.mapping.slice(n),u=l.map(s.pos),h=l.map(o.pos);i?t.deleteRange(u,h):(t.replaceRangeWith(u,h,e),ce(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new ie(t):ae(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let r=t.depth-1;r>=0;r--){let i=e<0?ae(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):ae(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new ue(t.node(0))}static atStart(t){return ae(t,t,0,0,1)||new ue(t)}static atEnd(t){return ae(t,t,t.content.size,t.childCount,-1)||new ue(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Xt[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Xt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Xt[t]=e,e.prototype.jsonID=t,e}getBookmark(){return ie.between(this.$anchor,this.$head).getBookmark()}}te.prototype.visible=!0;class ee{constructor(t,e){this.$from=t,this.$to=e}}let ne=!1;function re(t){ne||t.parent.inlineContent||(ne=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ie extends te{constructor(t,e=t){re(t),re(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return te.near(n);let r=t.resolve(e.map(this.anchor));return new ie(r.parent.inlineContent?r:n,n)}replace(t,e=a.empty){if(super.replace(t,e),e==a.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof ie&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new se(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new ie(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=te.findFrom(e,n,!0)||te.findFrom(e,-n,!0);if(!t)return te.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r||(t=(te.findFrom(t,-n,!0)||te.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0)&&(t=e),new ie(t,e)}}te.jsonID("text",ie);class se{constructor(t,e){this.anchor=t,this.head=e}map(t){return new se(t.map(this.anchor),t.map(this.head))}resolve(t){return ie.between(t.resolve(this.anchor),t.resolve(this.head))}}class oe extends te{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),i=t.resolve(r);return n?te.near(i):new oe(i)}content(){return new a(i.from(this.node),0,0)}eq(t){return t instanceof oe&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new le(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(t.resolve(e.anchor))}static create(t,e){return new oe(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}oe.prototype.visible=!1,te.jsonID("node",oe);class le{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new se(n,n):new le(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&oe.isSelectable(n)?new oe(e):te.near(e)}}class ue extends te{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=a.empty){if(e==a.empty){t.delete(0,t.doc.content.size);let e=te.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new ue(t)}map(t){return new ue(t)}eq(t){return t instanceof ue}getBookmark(){return he}}te.jsonID("all",ue);const he={map(){return this},resolve:t=>new ue(t)};function ae(t,e,n,r,i,s=!1){if(e.inlineContent)return ie.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let r=e.child(o);if(r.isAtom){if(!s&&oe.isSelectable(r))return oe.create(t,n-(i<0?r.nodeSize:0))}else{let e=ae(t,r,n+i,i<0?r.childCount:0,i,s);if(e)return e}n+=r.nodeSize*i}return null}function ce(t,e,n){let r=t.steps.length-1;if(r<e)return;let i,s=t.steps[r];(s instanceof Tt||s instanceof St)&&(t.mapping.maps[r].forEach(((t,e,n,r)=>{null==i&&(i=r)})),t.setSelection(te.near(t.doc.resolve(i),n)))}class fe extends Yt{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return u.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||u.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),!t)return this.deleteRange(e,n);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,i)),this.selection.empty||this.selection.to!=e+t.length||this.setSelection(te.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function de(t,e){return e&&t?t.bind(e):t}class pe{constructor(t,e,n){this.name=t,this.init=de(e.init,n),this.apply=de(e.apply,n)}}const me=[new pe("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new pe("selection",{init:(t,e)=>t.selection||te.atStart(e.doc),apply:t=>t.selection}),new pe("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new pe("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class ge{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=me.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new pe(t.key,t.spec.state,t))}))}}class we{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=e){let e=this.config.plugins[n];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],n=this.applyInner(t),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=r?r[s].n:0,u=r?r[s].state:this,h=l<e.length&&o.spec.appendTransaction.call(o,l?e.slice(l):e,u,n);if(h&&n.filterTransaction(h,s)){if(h.setMeta("appendedTransaction",t),!r){r=[];for(let t=0;t<this.config.plugins.length;t++)r.push(t<s?{state:n,n:e.length}:{state:this,n:0})}e.push(h),n=n.applyInner(h),i=!0}r&&(r[s]={state:n,n:e.length})}}if(!i)return{state:n,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new we(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];e[i.name]=i.apply(t,this[i.name],this,e)}return e}get tr(){return new fe(this)}static create(t){let e=new ge(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new we(e);for(let r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n}reconfigure(t){let e=new ge(this.schema,t.plugins),n=e.fields,r=new we(e);for(let e=0;e<n.length;e++){let i=n[e].name;r[i]=this.hasOwnProperty(i)?this[i]:n[e].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((t=>t.toJSON()))),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[n],i=r.spec.state;i&&i.toJSON&&(e[n]=i.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let r=new ge(t.schema,t.plugins),i=new we(r);return r.fields.forEach((r=>{if("doc"==r.name)i.doc=L.fromJSON(t.schema,e.doc);else if("selection"==r.name)i.selection=te.fromJSON(i.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let s in n){let o=n[s],l=o.spec.state;if(o.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,s))return void(i[r.name]=l.fromJSON.call(o,t,e[s],i))}i[r.name]=r.init(t,i)}})),i}}function be(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):"handleDOMEvents"==r&&(i=be(i,e,{})),n[r]=i}return n}class ve{constructor(t){this.spec=t,this.props={},t.props&&be(t.props,this,this.props),this.key=t.key?t.key.key:ke("plugin")}getState(t){return t[this.key]}}const ye=Object.create(null);function ke(t){return t in ye?t+"$"+ ++ye[t]:(ye[t]=0,t+"$")}class Me{constructor(t="key"){this.key=ke(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function xe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}function Te(t,e,n){let r=e.nodeBefore,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let t=r.lastChild;if(!t)return!1;r=t}let s=e.nodeAfter,o=e.pos+1;for(;!s.isTextblock;o++){if(s.type.spec.isolating)return!1;let t=s.firstChild;if(!t)return!1;s=t}let l=Bt(t.doc,i,o,a.empty);if(!l||l.from!=i||l instanceof Tt&&l.slice.size>=o-i)return!1;if(n){let e=t.tr.step(l);e.setSelection(ie.create(e.doc,i)),n(e.scrollIntoView())}return!0}function Se(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function Ee(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Oe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}function Ae(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Le(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Ce(t,e,n,r){let s,o,l=e.nodeBefore,u=e.nodeAfter,h=l.type.spec.isolating||u.type.spec.isolating;if(!h&&function(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(s,s+1)||!i.isTextblock&&!It(t.doc,e.pos)||(n&&n(t.tr.join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let c=!h&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(o=l.contentMatchAt(l.childCount)).findWrapping(u.type))&&o.matchType(s[0]||u.type).validEnd){if(n){let r=e.pos+u.nodeSize,o=i.empty;for(let t=s.length-1;t>=0;t--)o=i.from(s[t].create(null,o));o=i.from(l.copy(o));let h=t.tr.step(new St(e.pos-1,r,e.pos,r,new a(o,1,0),s.length,!0)),c=h.doc.resolve(r+2*s.length);c.nodeAfter&&c.nodeAfter.type==l.type&&It(h.doc,c.pos)&&h.join(c.pos),n(h.scrollIntoView())}return!0}let f=u.type.spec.isolating||r>0&&h?null:te.findFrom(e,1),d=f&&f.$from.blockRange(f.$to),p=d&&Lt(d);if(null!=p&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&Se(u,"start",!0)&&Se(l,"end")){let r=l,s=[];for(;s.push(r),!r.isTextblock;)r=r.lastChild;let o=u,h=1;for(;!o.isTextblock;o=o.firstChild)h++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=i.empty;for(let t=s.length-1;t>=0;t--)r=i.from(s[t].copy(r));n(t.tr.step(new St(e.pos-s.length,e.pos+u.nodeSize,e.pos+h,e.pos+u.nodeSize-h,new a(r,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function $e(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(e.tr.setSelection(ie.create(e.doc,t<0?i.start(s):i.end(s)))),!0)}}const Re=$e(-1),Ne=$e(1);function Pe(t,e=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(s,o,((r,s)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)i=!0;else{let e=n.doc.resolve(s),r=e.index();i=e.parent.canReplaceWith(r,r+1,t)}}))}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(s,o,t,e)}r(i.scrollIntoView())}return!0}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Ie=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},He=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let De=null;const je=function(t,e,n){let r=De||(De=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Be=function(t,e,n,r){return n&&(Fe(t,e,n,r,-1)||Fe(t,e,n,r,1))},ze=/^(img|br|input|textarea|hr)$/i;function Fe(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ue(t))){let n=t.parentNode;if(!n||1!=n.nodeType||_e(t)||ze.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Ie(t)+(i<0?0:1),t=n}else{if(1!=t.nodeType)return!1;{let n=t.childNodes[e+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(s=n.pmViewDesc)||void 0===s?void 0:s.ignoreForSelection))return!1;e+=i}else t=n,e=i<0?Ue(t):0}}}}function Ue(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function _e(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Je=function(t){return t.focusNode&&Be(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ke(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const qe="undefined"!=typeof navigator?navigator:null,We="undefined"!=typeof document?document:null,Ge=qe&&qe.userAgent||"",Ve=/Edge\/(\d+)/.exec(Ge),Qe=/MSIE \d/.exec(Ge),Ze=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ge),Ye=!!(Qe||Ze||Ve),Xe=Qe?document.documentMode:Ze?+Ze[1]:Ve?+Ve[1]:0,tn=!Ye&&/gecko\/(\d+)/i.test(Ge),en=!Ye&&/Chrome\/(\d+)/.exec(Ge),nn=!!en,rn=en?+en[1]:0,sn=!Ye&&!!qe&&/Apple Computer/.test(qe.vendor),on=sn&&(/Mobile\/\w+/.test(Ge)||!!qe&&qe.maxTouchPoints>2),ln=on||!!qe&&/Mac/.test(qe.platform),un=!!qe&&/Win/.test(qe.platform),hn=/Android \d/.test(Ge),an=!!We&&"webkitFontSmoothing"in We.documentElement.style,cn=an?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fn(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function dn(t,e){return"number"==typeof t?t:t[e]}function pn(t){let e=t.getBoundingClientRect();return{left:e.left,right:e.left+t.clientWidth*(e.width/t.offsetWidth||1),top:e.top,bottom:e.top+t.clientHeight*(e.height/t.offsetHeight||1)}}function mn(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(1!=o.nodeType){o=He(o);continue}let t=o,n=t==s.body,l=n?fn(s):pn(t),u=0,h=0;if(e.top<l.top+dn(r,"top")?h=-(l.top-e.top+dn(i,"top")):e.bottom>l.bottom-dn(r,"bottom")&&(h=e.bottom-e.top>l.bottom-l.top?e.top+dn(i,"top")-l.top:e.bottom-l.bottom+dn(i,"bottom")),e.left<l.left+dn(r,"left")?u=-(l.left-e.left+dn(i,"left")):e.right>l.right-dn(r,"right")&&(u=e.right-l.right+dn(i,"right")),u||h)if(n)s.defaultView.scrollBy(u,h);else{let n=t.scrollLeft,r=t.scrollTop;h&&(t.scrollTop+=h),u&&(t.scrollLeft+=u);let i=t.scrollLeft-n,s=t.scrollTop-r;e={left:e.left-i,top:e.top-s,right:e.right-i,bottom:e.bottom-s}}let a=n?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(a))break;o="absolute"==a?o.offsetParent:He(o)}}function gn(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=He(r));return e}function wn(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let bn=null;function vn(t,e){let n,r,i,s,o=2e8,l=0,u=e.top,h=e.top;for(let a=t.firstChild,c=0;a;a=a.nextSibling,c++){let t;if(1==a.nodeType)t=a.getClientRects();else{if(3!=a.nodeType)continue;t=je(a).getClientRects()}for(let f=0;f<t.length;f++){let d=t[f];if(d.top<=u&&d.bottom>=h){u=Math.max(d.bottom,u),h=Math.min(d.top,h);let t=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(t<o){n=a,o=t,r=t&&3==n.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==a.nodeType&&t&&(l=c+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!i&&d.left<=e.left&&d.right>=e.left&&(i=a,s={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!n&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(l=c+1)}}return!n&&i&&(n=i,r=s,o=0),n&&3==n.nodeType?function(t,e){let n,r=t.nodeValue.length,i=document.createRange();for(let s=0;s<r;s++){i.setEnd(t,s+1),i.setStart(t,s);let r=Tn(i,1);if(r.top!=r.bottom&&yn(e,r)){n={node:t,offset:s+(e.left>=(r.left+r.right)/2?1:0)};break}}return i.detach(),n||{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:l}:vn(n,r)}function yn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function kn(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let n=t.childNodes[s];if(1==n.nodeType){let t=n.getClientRects();for(let r=0;r<t.length;r++){let i=t[r];if(yn(e,i))return kn(n,e,i)}}if((s=(s+1)%r)==i)break}return t}function Mn(t,e){let n,r=t.dom.ownerDocument,i=0,s=function(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ue(r.offsetNode),r.offset)}}catch(t){}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ue(r.startContainer),r.startOffset)}}}(r,e.left,e.top);s&&({node:n,offset:i}=s);let o,l=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!l||!t.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=t.dom.getBoundingClientRect();if(!yn(e,n))return null;if(l=kn(t.dom,e,n),!l)return null}if(sn)for(let t=l;n&&t;t=He(t))t.draggable&&(n=void 0);if(l=function(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(l,e),n){if(tn&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let t,r=n.childNodes[i];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&i++}let r;an&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=e.top&&i--,n==t.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(o=function(t,e,n,r){let i=-1;for(let n=e,s=!1;n!=t.dom;){let e,o=t.docView.nearestDesc(n,!0);if(!o)return null;if(1==o.dom.nodeType&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((e=o.dom.getBoundingClientRect()).width||e.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&e.left>r.left||e.top>r.top?i=o.posBefore:(!s&&e.right<r.left||e.bottom<r.top)&&(i=o.posAfter),s=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?o.posBefore:o.posAfter;n=o.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}(t,n,i,e))}null==o&&(o=function(t,e,n){let{node:r,offset:i}=vn(e,n),s=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();s=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:o,inside:u?u.posAtStart-u.border:-1}}function xn(t){return t.top<t.bottom||t.left<t.right}function Tn(t,e){let n=t.getClientRects();if(n.length){let t=n[e<0?0:n.length-1];if(xn(t))return t}return Array.prototype.find.call(n,xn)||t.getBoundingClientRect()}const Sn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function En(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=an||tn;if(3==r.nodeType){if(!o||!Sn.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let t=i,e=i,s=n<0?1:-1;return n<0&&!i?(e++,s=-1):n>=0&&i==r.nodeValue.length?(t--,s=1):n<0?t--:e++,On(Tn(je(r,t,e),s),s<0)}{let t=Tn(je(r,i,i),n);if(tn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let e=Tn(je(r,i-1,i-1),-1);if(e.top==t.top){let n=Tn(je(r,i,i+1),-1);if(n.top!=t.top)return On(n,n.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==Ue(r))){let t=r.childNodes[i-1];if(1==t.nodeType)return An(t.getBoundingClientRect(),!1)}if(null==s&&i<Ue(r)){let t=r.childNodes[i];if(1==t.nodeType)return An(t.getBoundingClientRect(),!0)}return An(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==Ue(r))){let t=r.childNodes[i-1],e=3==t.nodeType?je(t,Ue(t)-(o?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return On(Tn(e,1),!1)}if(null==s&&i<Ue(r)){let t=r.childNodes[i];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?je(t,0,o?0:1):1==t.nodeType?t:null:null;if(e)return On(Tn(e,-1),!0)}return On(Tn(3==r.nodeType?je(r):r,-n),n>=0)}function On(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function An(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ln(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}const Cn=/[\u0590-\u08ac]/;let $n=null,Rn=null,Nn=!1;class Pn{constructor(t,e,n,r){this.parent=t,this.children=e,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,n=this.posAtStart;;e++){let r=this.children[e];if(r==t)return n;n+=r.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(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){let n,r;if(t==this.contentDOM)n=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(t==this.contentDOM)n=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>Ie(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,r=t;r;r=r.parentNode){let i,s=this.getDesc(r);if(s&&(!e||s.node)){if(!n||!(i=s.nodeDOM)||(1==i.nodeType?i.contains(1==t.nodeType?t:t.parentNode):i==t))return s;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,n){for(let r=t;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;e<this.children.length;e++){let r=this.children[e],i=n+r.size;if(n==t&&i!=n){for(;!r.border&&r.children.length;)for(let t=0;t<r.children.length;t++){let e=r.children[t];if(e.size){r=e;break}}return r}if(t<i)return r.descAt(t-n-r.border);n=i}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let n=0,r=0;for(let e=0;n<this.children.length;n++){let i=this.children[n],s=e+i.size;if(s>t||i instanceof Fn){r=t-e;break}e=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(let t;n&&!(t=this.children[n-1]).size&&t instanceof In&&t.side>=0;n--);if(e<=0){let t,r=!0;for(;t=n?this.children[n-1]:null,t&&t.dom.parentNode!=this.contentDOM;n--,r=!1);return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?Ie(t.dom)+1:0}}{let t,r=!0;for(;t=n<this.children.length?this.children[n]:null,t&&t.dom.parentNode!=this.contentDOM;n++,r=!1);return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?Ie(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,n=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=n,o=0;;o++){let n=this.children[o],l=s+n.size;if(-1==r&&t<=l){let i=s+n.border;if(t>=i&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,i);t=s;for(let e=o;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Ie(n.dom)+1;break}t-=n.size}-1==r&&(r=0)}if(r>-1&&(l>e||o==this.children.length-1)){e=l;for(let t=o+1;t<this.children.length;t++){let n=this.children[t];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Ie(n.dom);break}e+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:n}=this.domFromPos(t,0);if(1!=e.nodeType||n==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[n]}setSelection(t,e,n,r=!1){let i=Math.min(t,e),s=Math.max(t,e);for(let o=0,l=0;o<this.children.length;o++){let u=this.children[o],h=l+u.size;if(i>l&&s<h)return u.setSelection(t-l-u.border,e-l-u.border,n,r);l=h}let o=this.domFromPos(t,t?-1:1),l=e==t?o:this.domFromPos(e,e?-1:1),u=n.root.getSelection(),h=n.domSelectionRange(),a=!1;if((tn||sn)&&t==e){let{node:t,offset:e}=o;if(3==t.nodeType){if(a=!(!e||"\n"!=t.nodeValue[e-1]),a&&e==t.nodeValue.length)for(let e,n=t;n;n=n.parentNode){if(e=n.nextSibling){"BR"==e.nodeName&&(o=l={node:e.parentNode,offset:Ie(e)+1});break}let t=n.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let n=t.childNodes[e-1];a=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(tn&&h.focusNode&&h.focusNode!=l.node&&1==h.focusNode.nodeType){let t=h.focusNode.childNodes[h.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||a&&sn)&&Be(o.node,o.offset,h.anchorNode,h.anchorOffset)&&Be(l.node,l.offset,h.focusNode,h.focusOffset))return;let c=!1;if((u.extend||t==e)&&(!a||!tn)){u.collapse(o.node,o.offset);try{t!=e&&u.extend(l.node,l.offset),c=!0}catch(t){}}if(!c){if(t>e){let t=o;o=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],s=n+i.size;if(n==s?t<=s&&e>=n:t<s&&e>n){let r=n+i.border,o=s-i.border;if(t>=r&&e<=o)return this.dirty=t==n||e==s?2:1,void(t!=r||e!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(t-r,e-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?2:1;e.dirty<n&&(e.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class In extends Pn{constructor(t,e,n,r){let i,s=e.type.toDOM;if("function"==typeof s&&(s=s(n,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r))),!e.type.spec.raw){if(1!=s.nodeType){let t=document.createElement("span");t.appendChild(s),s=t}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,i=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||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 Hn extends Pn{constructor(t,e,n,r){super(t,[],e,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class Dn extends Pn{constructor(t,e,n,r,i){super(t,[],n,r),this.mark=e,this.spec=i}static create(t,e,n,r){let i=r.nodeViews[e.type.name],s=i&&i(e,r,n);return s&&s.dom||(s=ot.renderSpec(document,e.type.spec.toDOM(e,n),null,e.attrs)),new Dn(t,e,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,n){let r=Dn.create(this.parent,this.mark,!0,n),i=this.children,s=this.size;e<s&&(i=tr(i,e,s,n)),t>0&&(i=tr(i,0,t,n));for(let t=0;t<i.length;t++)i[t].parent=r;return r.children=i,r}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class jn extends Pn{constructor(t,e,n,r,i,s,o,l,u){super(t,[],i,s),this.node=e,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,e,n,r,i,s){let o,l=i.nodeViews[e.type.name],u=l&&l(e,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:s),n,r),h=u&&u.dom,a=u&&u.contentDOM;if(e.isText)if(h){if(3!=h.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else h=document.createTextNode(e.text);else if(!h){let t=ot.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:h,contentDOM:a}=t)}a||e.isText||"BR"==h.nodeName||(h.hasAttribute("contenteditable")||(h.contentEditable="false"),e.type.spec.draggable&&(h.draggable=!0));let c=h;return h=Vn(h,n,e),u?o=new Un(t,e,n,r,h,a||null,c,u,i,s+1):e.isText?new zn(t,e,n,r,h,c,i):new jn(t,e,n,r,h,a||null,c,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>i.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,n){return 0==this.dirty&&t.eq(this.node)&&Qn(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,r=e,i=t.composing?this.localCompositionInfo(t,e):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,l=new Yn(this,s&&s.node,t);!function(t,e,n,r){let i=e.locals(t),s=0;if(0==i.length){for(let n=0;n<t.childCount;n++){let o=t.child(n);r(o,i,e.forChild(s,o),n),s+=o.nodeSize}return}let o=0,l=[],u=null;for(let h=0;;){let a,c,f,d;for(;o<i.length&&i[o].to==s;){let t=i[o++];t.widget&&(a?(c||(c=[a])).push(t):a=t)}if(a)if(c){c.sort(Xn);for(let t=0;t<c.length;t++)n(c[t],h,!!u)}else n(a,h,!!u);if(u)d=-1,f=u,u=null;else{if(!(h<t.childCount))break;d=h,f=t.child(h++)}for(let t=0;t<l.length;t++)l[t].to<=s&&l.splice(t--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let t=p;o<i.length&&i[o].from<t&&(t=i[o].from);for(let e=0;e<l.length;e++)l[e].to<t&&(t=l[e].to);t<p&&(u=f.cut(t-s),f=f.cut(0,t-s),p=t,d=-1)}else for(;o<i.length&&i[o].to<p;)o++;r(f,f.isInline&&!f.isLeaf?l.filter((t=>!t.inline)):l.slice(),e.forChild(s,f),d),s=p}}(this.node,this.innerDeco,((e,i,s)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t,i):e.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?u.none:this.node.child(i).marks,n,t,i),l.placeWidget(e,t,r)}),((e,s,u,h)=>{let a;l.syncToMarks(e.marks,n,t,h),l.findNodeMatch(e,s,u,h)||o&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(a=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,s,u,a,t)||l.updateNextNode(e,s,u,t,h,r)||l.addNode(e,s,u,t,r),r+=e.nodeSize})),l.syncToMarks([],n,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),_n(this.contentDOM,this.children,t),on&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t),t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:n,to:r}=t.state.selection;if(!(t.state.selection instanceof ie)||n<e||r>e+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let t=i.nodeValue,s=function(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let e=t.child(i++);if(s+=e.nodeSize,!e.isText)break;u+=e.text}if(s>=n){if(s>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let t=l<r?u.lastIndexOf(e,r-l-1):-1;if(t>=0&&t+e.length+l>=n)return l+t;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}(this.node.content,t,n-e,r-e);return s<0?null:{node:i,pos:s,text:t}}return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:r}){if(this.getDesc(e))return;let i=e;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Hn(this,i,e,r);t.input.compositionNodes.push(s),this.children=tr(this.children,n,n+r.length,t,s)}update(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node)||(this.updateInner(t,e,n,r),0))}updateInner(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Qn(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Wn(this.dom,this.nodeDOM,qn(this.outerDeco,this.node,e),qn(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Bn(t,e,n,r,i){Vn(r,e,t);let s=new jn(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class zn extends jn{constructor(t,e,n,r,i,s,o){super(t,e,n,r,i,null,s,o,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node)||(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,0))}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let r=this.node.cut(t,e),i=document.createTextNode(r.text);return new zn(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class Fn extends Pn{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Un extends jn{constructor(t,e,n,r,i,s,o,l,u,h){super(t,e,n,r,i,s,o,u,h),this.spec=l}update(t,e,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,e,n);return i&&this.updateInner(t,e,n,r),i}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,r){this.spec.setSelection?this.spec.setSelection(t,e,n.root):super.setSelection(t,e,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function _n(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Zn(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof Dn){let e=r?r.previousSibling:t.lastChild;_n(o.contentDOM,o.children,n),r=e?e.nextSibling:t.firstChild}}for(;r;)r=Zn(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Jn=function(t){t&&(this.nodeName=t)};Jn.prototype=Object.create(null);const Kn=[new Jn];function qn(t,e,n){if(0==t.length)return Kn;let r=n?Kn[0]:new Jn,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Jn(o.nodeName));for(let t in o){let s=o[t];null!=s&&(n&&1==i.length&&i.push(r=new Jn(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+s:"style"==t?r.style=(r.style?r.style+";":"")+s:"nodeName"!=t&&(r[t]=s))}}}return i}function Wn(t,e,n,r){if(n==Kn&&r==Kn)return e;let i=e;for(let e=0;e<r.length;e++){let s=r[e],o=n[e];if(e){let e;o&&o.nodeName==s.nodeName&&i!=t&&(e=i.parentNode)&&e.nodeName.toLowerCase()==s.nodeName||(e=document.createElement(s.nodeName),e.pmIsDeco=!0,e.appendChild(i),o=Kn[0]),i=e}Gn(i,o||Kn[0],s)}return i}function Gn(t,e,n){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==i.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<i.length;e++)-1==r.indexOf(i[e])&&t.classList.add(i[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(e.style);)t.style.removeProperty(n[1])}n.style&&(t.style.cssText+=n.style)}}function Vn(t,e,n){return Wn(t,t,Kn,qn(e,n,1!=t.nodeType))}function Qn(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Zn(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Yn{constructor(t,e,n){this.lock=e,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];t:for(;i>0;){let l;for(;;)if(r){let t=n.children[r-1];if(!(t instanceof Dn)){l=t,r--;break}n=t,r=t.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,n,r){let i=0,s=this.stack.length>>1,o=Math.min(s,t.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&!1!==t[i].type.spec.spanning;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let e=this.index;e<o;e++){let n=this.top.children[e];if(n.matchesMark(t[s])&&!this.isLocked(n.dom)){i=e;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Dn.create(this.top,t[s],e,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,s++}}findNodeMatch(t,e,n,r){let i,s=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(t,e,n))s=this.top.children.indexOf(i,this.index);else for(let r=this.index,i=Math.min(this.top.children.length,r+5);r<i;r++){let i=this.top.children[r];if(i.matchesNode(t,e,n)&&!this.preMatch.matched.has(i)){s=r;break}}return!(s<0||(this.destroyBetween(this.index,s),this.index++,0))}updateNodeAt(t,e,n,r,i){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,n,r,i,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof jn){let u=this.preMatch.matched.get(l);if(null!=u&&u!=i)return!1;let h,a=l.dom,c=this.isLocked(a)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&3!=l.dirty&&Qn(e,l.outerDeco));if(!c&&l.update(t,e,n,r))return this.destroyBetween(this.index,o),l.dom!=a&&(this.changed=!0),this.index++,!0;if(!c&&(h=this.recreateWrapper(l,t,e,n,r,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=2,h.updateChildren(r,s+1),h.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,n,r,i,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Qn(n,t.outerDeco)||!r.eq(t.innerDeco))return null;let o=jn.create(this.top,e,n,r,i,s);if(o.contentDOM){o.children=t.children,t.children=[];for(let t of o.children)t.parent=o}return t.destroy(),o}addNode(t,e,n,r,i){let s=jn.create(this.top,t,e,n,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new In(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof Dn;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof zn)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((sn||nn)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let n=document.createElement(t);"IMG"==t&&(n.className="ProseMirror-separator",n.alt=""),"BR"==t&&(n.className="ProseMirror-trailingBreak");let r=new Fn(this.top,[],n,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Xn(t,e){return t.type.side-e.type.side}function tr(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let u=t[o],h=l,a=l+=u.size;h>=n||a<=e?s.push(u):(h<e&&s.push(u.slice(0,e-h,r)),i&&(s.push(i),i=void 0),a>n&&s.push(u.slice(n-h,u.size,r)))}return s}function er(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&0==i.size,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l,u,h=r.resolve(o);if(Je(n)){for(l=o;i&&!i.node;)i=i.parent;let t=i.node;if(i&&t.isAtom&&oe.isSelectable(t)&&i.parent&&(!t.isInline||!function(t,e,n){for(let r=0==e,i=e==Ue(t);r||i;){if(t==n)return!0;let e=Ie(t);if(!(t=t.parentNode))return!1;r=r&&0==e,i=i&&e==Ue(t)}}(n.focusNode,n.focusOffset,i.dom))){let t=i.posBefore;u=new oe(o==t?h:r.resolve(t))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let e=o,i=o;for(let r=0;r<n.rangeCount;r++){let s=n.getRangeAt(r);e=Math.min(e,t.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,t.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(e<0)return null;[l,o]=i==t.state.selection.anchor?[i,e]:[e,i],h=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let a=r.resolve(l);return u||(u=ar(t,a,h,"pointer"==e||t.state.selection.head<h.pos&&!s?1:-1)),u}function nr(t){return t.editable?t.hasFocus():fr(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function rr(t,e=!1){let n=t.state.selection;if(ur(t,n),nr(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&nn){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&Be(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset))return t.input.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r="IMG"==n.nodeName;r?e.collapse(n.parentNode,Ie(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Ye&&Xe<=11&&(n.disabled=!0,n.disabled=!1)}(t);else{let r,i,{anchor:s,head:o}=n;!ir||n instanceof ie||(n.$from.parent.inlineContent||(r=sr(t,n.from)),n.empty||n.$from.parent.inlineContent||(i=sr(t,n.to))),t.docView.setSelection(s,o,t,e),ir&&(r&&lr(r),i&&lr(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{nr(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ir=sn||nn&&rn<63;function sr(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(sn&&i&&"false"==i.contentEditable)return or(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return or(i);if(s)return or(s)}}function or(t){return t.contentEditable="true",sn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function lr(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function ur(t,e){if(e instanceof oe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(hr(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else hr(t)}function hr(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ar(t,e,n,r){return t.someProp("createSelectionBetween",(r=>r(t,e,n)))||ie.between(e,n,r)}function cr(t){return!(t.editable&&!t.hasFocus())&&fr(t)}function fr(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function dr(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function pr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function mr(t,e,n){let r=t.state.selection;if(!(r instanceof ie)){if(r instanceof oe&&r.node.isInline)return pr(t,new ie(e>0?r.$to:r.$from));{let n=dr(t.state,e);return!!n&&pr(t,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(n.pos+i.nodeSize*(e<0?-1:1));return pr(t,new ie(r.$anchor,s))}if(!r.empty)return!1;if(t.endOfTextblock(e>0?"forward":"backward")){let n=dr(t.state,e);return!!(n&&n instanceof oe)&&pr(t,n)}if(!(ln&&n.indexOf("m")>-1)){let n,i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let o=e<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=t.docView.descAt(o))&&!n.contentDOM)&&(oe.isSelectable(s)?pr(t,new oe(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):!!an&&pr(t,new ie(t.state.doc.resolve(e<0?o:o+s.nodeSize))))}}function gr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function wr(t,e){let n=t.pmViewDesc;return n&&0==n.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function br(t,e){return e<0?function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(tn&&1==n.nodeType&&r<gr(n)&&wr(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(wr(t,-1))i=n,s=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(vr(n))break;{let e=n.previousSibling;for(;e&&wr(e,-1);)i=n.parentNode,s=Ie(e),e=e.previousSibling;if(e)n=e,r=gr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?yr(t,n,r):i&&yr(t,i,s)}(t):function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=gr(n);for(;;)if(r<o){if(1!=n.nodeType)break;if(!wr(n.childNodes[r],1))break;i=n,s=++r}else{if(vr(n))break;{let e=n.nextSibling;for(;e&&wr(e,1);)i=e.parentNode,s=Ie(e)+1,e=e.nextSibling;if(e)n=e,r=0,o=gr(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&yr(t,i,s)}(t)}function vr(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function yr(t,e,n){if(3!=e.nodeType){let t,r;(r=function(t,e){for(;t&&e==t.childNodes.length&&!_e(t);)e=Ie(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=n,e=0}}(e,n))?(e=r,n=0):(t=function(t,e){for(;t&&!e&&!_e(t);)e=Ie(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=(t=n).childNodes.length}}(e,n))&&(e=t,n=t.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Je(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout((()=>{t.state==i&&rr(t)}),50)}function kr(t,e){let n=t.state.doc.resolve(e);if(!nn&&!un&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let n=t.coordsAtPos(e-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(e<n.end()){let n=t.coordsAtPos(e+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function Mr(t,e,n){let r=t.state.selection;if(r instanceof ie&&!r.empty||n.indexOf("s")>-1)return!1;if(ln&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=dr(t.state,e);if(n&&n instanceof oe)return pr(t,n)}if(!i.parent.inlineContent){let n=e<0?i:s,o=r instanceof ue?te.near(n,e):te.findFrom(n,e);return!!o&&pr(t,o)}return!1}function xr(t,e){if(!(t.state.selection instanceof ie))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=t.state.tr;return e<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),t.dispatch(r),!0}return!1}function Tr(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Sr(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let o=t.someProp("clipboardSerializer")||ot.fromSchema(t.state.schema),l=Ir(),u=l.createElement("div");u.appendChild(o.serializeFragment(r,{document:l}));let h,a=u.firstChild,c=0;for(;a&&1==a.nodeType&&(h=Nr[a.nodeName.toLowerCase()]);){for(let t=h.length-1;t>=0;t--){let e=l.createElement(h[t]);for(;u.firstChild;)e.appendChild(u.firstChild);u.appendChild(e),c++}a=u.firstChild}return a&&1==a.nodeType&&a.setAttribute("data-pm-slice",`${i} ${s}${c?` -${c}`:""} ${JSON.stringify(n)}`),{dom:u,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function Er(t,e,n,r,s){let o,l,u=s.parent.type.spec.code;if(!n&&!e)return null;let h=!!e&&(r||u||!n);if(h){if(t.someProp("transformPastedText",(n=>{e=n(e,u||r,t)})),u)return l=new a(i.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",(e=>{l=e(l,t,!0)})),l;let n=t.someProp("clipboardTextParser",(n=>n(e,s,r,t)));if(n)l=n;else{let n=s.marks(),{schema:r}=t.state,i=ot.fromSchema(r);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=o.appendChild(document.createElement("p"));t&&e.appendChild(i.serializeNode(r.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),o=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=Ir().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t);if((n=i&&Nr[i[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"</"+t+">")).reverse().join("")),r.innerHTML=function(t){let e=window.trustedTypes;return e?(Hr||(Hr=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Hr.createHTML(t)):t}(t),n)for(let t=0;t<n.length;t++)r=r.querySelector(n[t])||r;return r}(n),an&&function(t){let e=t.querySelectorAll(nn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let t=+f[3];t>0;t--){let t=o.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;o=t}if(!l){let e=t.someProp("clipboardParser")||t.someProp("domParser")||Q.fromSchema(t.state.schema);l=e.parseSlice(o,{preserveWhitespace:!(!h&&!f),context:s,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||Or.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(f)l=function(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:s,openStart:o,openEnd:l}=t;for(let t=n.length-2;t>=0;t-=2){let e=r.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;s=i.from(e.create(n[t+1],s)),o++,l++}return new a(s,o,l)}(Rr(l,+f[1],+f[2]),f[4]);else if(l=a.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,s=e.node(n).contentMatchAt(e.index(n)),o=[];if(t.forEach((t=>{if(!o)return;let e,n=s.findWrapping(t.type);if(!n)return o=null;if(e=o.length&&r.length&&Lr(n,r,t,o[o.length-1],0))o[o.length-1]=e;else{o.length&&(o[o.length-1]=Cr(o[o.length-1],r.length));let e=Ar(t,n);o.push(e),s=s.matchType(e.type),r=n}})),o)return i.from(o)}return t}(l.content,s),!0),l.openStart||l.openEnd){let t=0,e=0;for(let e=l.content.firstChild;t<l.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=l.content.lastChild;e<l.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);l=Rr(l,t,e)}return t.someProp("transformPasted",(e=>{l=e(l,t,h)})),l}const Or=/^(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 Ar(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,i.from(t));return t}function Lr(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let o=Lr(t,e,n,r.lastChild,s+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(i.from(Ar(n,t,s+1))))}}function Cr(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,Cr(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(i.empty,!0);return t.copy(n.append(r))}function $r(t,e,n,r,s,o){let l=e<0?t.firstChild:t.lastChild,u=l.content;return t.childCount>1&&(o=0),s<r-1&&(u=$r(u,e,n,r,s+1,o)),s>=n&&(u=e<0?l.contentMatchAt(0).fillBefore(u,o<=s).append(u):u.append(l.contentMatchAt(l.childCount).fillBefore(i.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(u))}function Rr(t,e,n){return e<t.openStart&&(t=new a($r(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new a($r(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Nr={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 Pr=null;function Ir(){return Pr||(Pr=document.implementation.createHTMLDocument("title"))}let Hr=null;const Dr={},jr={},Br={touchstart:!0,touchmove:!0};class zr{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 Fr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Ur(t){t.someProp("handleDOMEvents",(e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>_r(t,e))}))}function _r(t,e){return t.someProp("handleDOMEvents",(n=>{let r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function Jr(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Kr(t){return{left:t.clientX,top:t.clientY}}function qr(t,e,n,r,i){if(-1==r)return!1;let s=t.state.doc.resolve(r);for(let r=s.depth+1;r>0;r--)if(t.someProp(e,(e=>r>s.depth?e(t,n,s.nodeAfter,s.before(r),i,!0):e(t,n,s.node(r),s.before(r),i,!1))))return!0;return!1}function Wr(t,e){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",!0),t.dispatch(n)}function Gr(t,e,n,r){return qr(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(n=>n(t,e,r)))}function Vr(t,e,n,r){return qr(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(n=>n(t,e,r)))||function(t,e,n){if(0!=n.button)return!1;let r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Wr(t,ie.create(r,0,r.content.size)),!0);let i=r.resolve(e);for(let e=i.depth+1;e>0;e--){let n=e>i.depth?i.nodeAfter:i.node(e),s=i.before(e);if(n.inlineContent)Wr(t,ie.create(r,s+1,s+1+n.content.size));else{if(!oe.isSelectable(n))continue;Wr(t,oe.create(r,s))}return!0}}(t,n,r)}function Qr(t){return ri(t)}jr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!Xr(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!hn||!nn||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!on||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||function(t,e){let n=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==n||ln&&72==n&&"c"==r)return xr(t,-1)||br(t,-1);if(46==n&&!e.shiftKey||ln&&68==n&&"c"==r)return xr(t,1)||br(t,1);if(13==n||27==n)return!0;if(37==n||ln&&66==n&&"c"==r){let e=37==n?"ltr"==kr(t,t.state.selection.from)?-1:1:-1;return mr(t,e,r)||br(t,e)}if(39==n||ln&&70==n&&"c"==r){let e=39==n?"ltr"==kr(t,t.state.selection.from)?1:-1:1;return mr(t,e,r)||br(t,e)}return 38==n||ln&&80==n&&"c"==r?Mr(t,-1,r)||br(t,-1):40==n||ln&&78==n&&"c"==r?function(t){if(!sn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;Tr(t,n,"true"),setTimeout((()=>Tr(t,n,"false")),20)}return!1}(t)||Mr(t,1,r)||br(t,1):r==(ln?"m":"c")&&(66==n||73==n||89==n||90==n)}(t,n)?n.preventDefault():Fr(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,Ke(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},jr.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},jr.keypress=(t,e)=>{let n=e;if(Xr(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ln&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof ie&&r.$from.sameParent(r.$to))){let e=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(e).scrollIntoView();/[\r\n]/.test(e)||t.someProp("handleTextInput",(n=>n(t,r.$from.pos,r.$to.pos,e,i)))||t.dispatch(i()),n.preventDefault()}};const Zr=ln?"metaKey":"ctrlKey";Dr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Qr(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(n,t.input.lastClick)&&!n[Zr]&&t.input.lastClick.button==n.button&&("singleClick"==t.input.lastClick.type?s="doubleClick":"doubleClick"==t.input.lastClick.type&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Kr(n));o&&("singleClick"==s?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Yr(t,o,n,!!r)):("doubleClick"==s?Gr:Vr)(t,o.pos,o.inside,n)?n.preventDefault():Fr(t,"pointer"))};class Yr{constructor(t,e,n,r){let i,s;if(this.view=t,this.pos=e,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[Zr],this.allowDefault=n.shiftKey,e.inside>-1)i=t.state.doc.nodeAt(e.inside),s=e.inside;else{let n=t.state.doc.resolve(e.pos);i=n.parent,s=n.depth?n.before():0}const o=r?null:n.target,l=o?t.docView.nearestDesc(o,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:u}=t.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||u instanceof oe&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!tn||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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Fr(t,"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((()=>rr(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Kr(t))),this.updateAllowDefault(t),this.allowDefault||!e?Fr(this.view,"pointer"):function(t,e,n,r,i){return qr(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(n=>n(t,e,r)))||(i?function(t,e){if(-1==e)return!1;let n,r,i=t.state.selection;i instanceof oe&&(n=i.node);let s=t.state.doc.resolve(e);for(let t=s.depth+1;t>0;t--){let e=t>s.depth?s.nodeAfter:s.node(t);if(oe.isSelectable(e)){r=n&&i.$from.depth>0&&t>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(t);break}}return null!=r&&(Wr(t,oe.create(t.state.doc,r)),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&oe.isSelectable(r))&&(Wr(t,new oe(n)),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||sn&&this.mightDrag&&!this.mightDrag.node.isAtom||nn&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Wr(this.view,te.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Fr(this.view,"pointer")}move(t){this.updateAllowDefault(t),Fr(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function Xr(t,e){return!!t.composing||!!(sn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}Dr.touchstart=t=>{t.input.lastTouch=Date.now(),Qr(t),Fr(t,"pointer")},Dr.touchmove=t=>{t.input.lastTouch=Date.now(),Fr(t,"pointer")},Dr.contextmenu=t=>Qr(t);const ti=hn?5e3:-1;function ei(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>ri(t)),e))}function ni(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ri(t,e=!1){if(!(hn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ni(t),e||t.docView&&t.docView.dirty){let n=er(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):!t.markCursor&&!e||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}jr.compositionstart=jr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ie&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))||nn&&un&&function(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||1!=e.nodeType||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(t)))t.markCursor=t.state.storedMarks||n.marks(),ri(t,!0),t.markCursor=null;else if(ri(t,!e.selection.empty),tn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){let n=t.domSelection();n&&n.collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}ei(t,ti)},jr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,ei(t,20))};const ii=Ye&&Xe<15||on&&cn<604;function si(t,e,n,r,i){let s=Er(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,i,s||a.empty))))return!0;if(!s)return!1;let o=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function oi(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Dr.copy=jr.cut=(t,e)=>{let n=e,r=t.state.selection,i="cut"==n.type;if(r.empty)return;let s=ii?null:n.clipboardData,o=r.content(),{dom:l,text:u}=Sr(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",u)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},jr.paste=(t,e)=>{let n=e;if(t.composing&&!hn)return;let r=ii?null:n.clipboardData,i=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&si(t,oi(r),r.getData("text/html"),i,n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?si(t,r.value,null,i,e):si(t,r.textContent,r.innerHTML,i,e)}),50)}(t,n)};class li{constructor(t,e,n){this.slice=t,this.move=e,this.node=n}}const ui=ln?"altKey":"ctrlKey";function hi(t,e){let n;return t.someProp("dragCopies",(t=>{n=n||t(e)})),null!=n?!n:!e[ui]}Dr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,s=t.state.selection,o=s.empty?null:t.posAtCoords(Kr(n));if(o&&o.pos>=s.from&&o.pos<=(s instanceof oe?s.to-1:s.to));else if(r&&r.mightDrag)i=oe.create(t.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&(i=oe.create(t.state.doc,e.posBefore))}let l=(i||t.state.selection).content(),{dom:u,text:h,slice:a}=Sr(t,l);(!n.dataTransfer.files.length||!nn||rn>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ii?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",ii||n.dataTransfer.setData("text/plain",h),t.dragging=new li(a,hi(t,n),i)},Dr.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},jr.dragover=jr.dragenter=(t,e)=>e.preventDefault(),jr.drop=(t,e)=>{try{!function(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Kr(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",(e=>{s=e(s,t,!1)})):s=Er(t,oi(e.dataTransfer),ii?null:e.dataTransfer.getData("text/html"),!1,i);let o=!(!n||!hi(t,e));if(t.someProp("handleDrop",(n=>n(t,e,s||a.empty,o))))return void e.preventDefault();if(!s)return;e.preventDefault();let l=s?jt(t.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let u=t.state.tr;if(o){let{node:t}=n;t?t.replace(u):u.deleteSelection()}let h=u.mapping.map(l),c=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,f=u.doc;if(c?u.replaceRangeWith(h,h,s.content.firstChild):u.replaceRange(h,h,s),u.doc.eq(f))return;let d=u.doc.resolve(h);if(c&&oe.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new oe(d));else{let e=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach(((t,n,r,i)=>e=i)),u.setSelection(ar(t,d,u.doc.resolve(e)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}(t,e,t.dragging)}finally{t.dragging=null}},Dr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&rr(t)}),20))},Dr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Dr.beforeinput=(t,e)=>{if(nn&&hn&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,Ke(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let t in jr)Dr[t]=jr[t];function ai(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ci{constructor(t,e){this.toDOM=t,this.spec=e||gi,this.side=this.spec.side||0}map(t,e,n,r){let{pos:i,deleted:s}=t.mapResult(e.from+r,this.side<0?-1:1);return s?null:new pi(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof ci&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ai(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class fi{constructor(t,e){this.attrs=t,this.spec=e||gi}map(t,e,n,r){let i=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new pi(i,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof fi&&ai(this.attrs,t.attrs)&&ai(this.spec,t.spec)}static is(t){return t.type instanceof fi}destroy(){}}class di{constructor(t,e){this.attrs=t,this.spec=e||gi}map(t,e,n,r){let i=t.mapResult(e.from+r,1);if(i.deleted)return null;let s=t.mapResult(e.to+r,-1);return s.deleted||s.pos<=i.pos?null:new pi(i.pos-n,s.pos-n,this)}valid(t,e){let n,{index:r,offset:i}=t.content.findIndex(e.from);return i==e.from&&!(n=t.child(r)).isText&&i+n.nodeSize==e.to}eq(t){return this==t||t instanceof di&&ai(this.attrs,t.attrs)&&ai(this.spec,t.spec)}destroy(){}}class pi{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new pi(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new pi(t,t,new ci(e,n))}static inline(t,e,n,r){return new pi(t,e,new fi(n,r))}static node(t,e,n,r){return new pi(t,e,new di(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof fi}get widget(){return this.type instanceof ci}}const mi=[],gi={};class wi{constructor(t,e){this.local=t.length?t:mi,this.children=e.length?e:mi}static create(t,e){return e.length?xi(e,t,0,gi):bi}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=e&&o.to>=t&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let o=this.children[s]+1;this.children[s+2].findInner(t-o,e-o,n,r+o,i)}}map(t,e,n){return this==bi||0==t.maps.length?this:this.mapInner(t,e,0,0,n||gi)}mapInner(t,e,n,r,i){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(t,n,r);l&&l.type.valid(e,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(t,e,n,r,i,s,o){let l=t.slice();for(let t=0,e=s;t<n.maps.length;t++){let r=0;n.maps[t].forEach(((t,n,i,s)=>{let o=s-i-(n-t);for(let i=0;i<l.length;i+=3){let s=l[i+1];if(s<0||t>s+e-r)continue;let u=l[i]+e-r;n>=u?l[i+1]=t<=u?-2:-1:t>=e&&o&&(l[i]+=o,l[i+1]+=o)}r+=o})),e=n.maps[t].map(e,-1)}let u=!1;for(let e=0;e<l.length;e+=3)if(l[e+1]<0){if(-2==l[e+1]){u=!0,l[e+1]=-1;continue}let h=n.map(t[e]+s),a=h-i;if(a<0||a>=r.content.size){u=!0;continue}let c=n.map(t[e+1]+s,-1)-i,{index:f,offset:d}=r.content.findIndex(a),p=r.maybeChild(f);if(p&&d==a&&d+p.nodeSize==c){let r=l[e+2].mapInner(n,p,h+1,t[e]+s+1,o);r!=bi?(l[e]=a,l[e+1]=c,l[e+2]=r):(l[e+1]=-2,u=!0)}else u=!0}if(u){let u=function(t,e,n,r,i,s,o){function l(t,e){for(let s=0;s<t.local.length;s++){let l=t.local[s].map(r,i,e);l?n.push(l):o.onRemove&&o.onRemove(t.local[s].spec)}for(let n=0;n<t.children.length;n+=3)l(t.children[n+2],t.children[n]+e+1)}for(let n=0;n<t.length;n+=3)-1==t[n+1]&&l(t[n+2],e[n]+s+1);return n}(l,t,e,n,i,s,o),h=xi(u,r,0,o);e=h.local;for(let t=0;t<l.length;t+=3)l[t+1]<0&&(l.splice(t,3),t-=3);for(let t=0,e=0;t<h.children.length;t+=3){let n=h.children[t];for(;e<l.length&&l[e]<n;)e+=3;l.splice(e,0,h.children[t],h.children[t+1],h.children[t+2])}}return new wi(e.sort(Ti),l)}(this.children,s||[],t,e,n,r,i):s?new wi(s.sort(Ti),mi):bi}add(t,e){return e.length?this==bi?wi.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,i=0;t.forEach(((t,s)=>{let o,l=s+n;if(o=ki(e,t,l)){for(r||(r=this.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,o,l+1):r.splice(i,0,s,s+t.nodeSize,xi(o,t,l+1,gi)),i+=3}}));let s=yi(i?Mi(e):e,-n);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||s.splice(e--,1);return new wi(s.length?this.local.concat(s).sort(Ti):this.local,r||this.children)}remove(t){return 0==t.length||this==bi?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,s=n[r]+e,o=n[r+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>s&&e.to<o&&(t[n]=null,(i||(i=[])).push(e));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,s+1);l!=bi?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length)for(let n,i=0;i<t.length;i++)if(n=t[i])for(let t=0;t<r.length;t++)r[t].eq(n,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new wi(r,n):bi}forChild(t,e){if(this==bi)return this;if(e.isLeaf)return wi.empty;let n,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(n=this.children[e+2]);break}let i=t+1,s=i+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<s&&e.to>i&&e.type instanceof fi){let t=Math.max(i,e.from)-i,n=Math.min(s,e.to)-i;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let t=new wi(r.sort(Ti),mi);return n?new vi([t,n]):t}return n||bi}eq(t){if(this==t)return!0;if(!(t instanceof wi)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Si(this.localsInner(t))}localsInner(t){if(this==bi)return mi;if(t.inlineContent||!this.local.some(fi.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof fi||e.push(this.local[t]);return e}forEachSet(t){t(this)}}wi.empty=new wi([],[]),wi.removeOverlap=Si;const bi=wi.empty;class vi{constructor(t){this.members=t}map(t,e){const n=this.members.map((n=>n.map(t,e,gi)));return vi.from(n)}forChild(t,e){if(e.isLeaf)return wi.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(t,e);i!=bi&&(i instanceof vi?n=n.concat(i.members):n.push(i))}return vi.from(n)}eq(t){if(!(t instanceof vi)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(t);if(i.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<i.length;t++)e.push(i[t])}else e=i}return e?Si(n?e:e.sort(Ti)):mi}static from(t){switch(t.length){case 0:return bi;case 1:return t[0];default:return new vi(t.every((t=>t instanceof wi))?t:t.reduce(((t,e)=>t.concat(e instanceof wi?e:e.members)),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function yi(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new pi(i.from+e,i.to+e,i.type))}return n}function ki(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let e,s=0;s<t.length;s++)(e=t[s])&&e.from>n&&e.to<r&&((i||(i=[])).push(e),t[s]=null);return i}function Mi(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function xi(t,e,n,r){let i=[],s=!1;e.forEach(((e,o)=>{let l=ki(t,e,o+n);if(l){s=!0;let t=xi(l,e,n+o+1,r);t!=bi&&i.push(o,o+e.nodeSize,t)}}));let o=yi(s?Mi(t):t,-n).sort(Ti);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||(r.onRemove&&r.onRemove(o[t].spec),o.splice(t--,1));return o.length||i.length?new wi(o,i):bi}function Ti(t,e){return t.from-e.from||t.to-e.to}function Si(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from!=r.from){s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Ei(e,i,r.copy(s.from,r.to)));break}s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Ei(e,i+1,s.copy(r.to,s.to)))}}return e}function Ei(t,e,n){for(;e<t.length&&Ti(n,t[e])>0;)e++;t.splice(e,0,n)}function Oi(t){let e=[];return t.someProp("decorations",(n=>{let r=n(t.state);r&&r!=bi&&e.push(r)})),t.cursorWrapper&&e.push(wi.create(t.state.doc,[t.cursorWrapper.deco])),vi.from(e)}const Ai={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Li=Ye&&Xe<=11;class Ci{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class $i{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ci,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);Ye&&Xe<=11&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():sn&&t.composing&&e.some((t=>"childList"==t.type&&"TR"==t.target.nodeName))?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()})),Li&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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,Ai)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);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(cr(this.view)){if(this.suppressingSelectionUpdates)return rr(this.view);if(Ye&&Xe<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Be(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let e=t.focusNode;e;e=He(e))n.add(e);for(let r=t.anchorNode;r;r=He(r))if(n.has(r)){e=r;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let n=t.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&cr(t)&&!this.ignoreSelectionChange(n),i=-1,s=-1,o=!1,l=[];if(t.editable)for(let t=0;t<e.length;t++){let n=this.registerMutation(e[t],l);n&&(i=i<0?n.from:Math.min(n.from,i),s=s<0?n.to:Math.max(n.to,s),n.typeOver&&(o=!0))}if(!l.some((t=>"BR"==t.nodeName))||8!=t.input.lastKeyCode&&46!=t.input.lastKeyCode){if(tn&&l.length){let e=l.filter((t=>"BR"==t.nodeName));if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;!e||"LI"!=e.nodeName||n&&Ii(t,n)==e||r.remove()}}}}else for(let t of l)if("BR"==t.nodeName&&t.parentNode){let e=t.nextSibling;for(;e&&1==e.nodeType;){if("false"==e.contentEditable){t.parentNode.removeChild(t);break}e=e.firstChild}}let u=null;i<0&&r&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Je(n)&&(u=er(t))&&u.eq(te.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,rr(t),this.currentSelection.set(n),t.scrollToSelection()):(i>-1||r)&&(i>-1&&(t.docView.markDirty(i,s),function(t){if(!Ri.has(t)&&(Ri.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=tn,Ni)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."),Ni=!0}}(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if("TR"==(null===(n=s.parentNode)||void 0===n?void 0:n.nodeName)){let e=s.nextSibling;for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.nextSibling;if(e){let n=e;for(;;){let t=n.firstChild;if(!t||1!=t.nodeType||"false"==t.contentEditable||/^(BR|IMG)$/.test(t.nodeName))break;n=t}n.insertBefore(s,n.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}(t,l)),this.handleDOMChange(i,s,o,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||rr(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];e.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};let r=t.previousSibling,i=t.nextSibling;if(Ye&&Xe<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:n,nextSibling:s}=t.addedNodes[e];(!n||Array.prototype.indexOf.call(t.addedNodes,n)<0)&&(r=n),(!s||Array.prototype.indexOf.call(t.addedNodes,s)<0)&&(i=s)}let s=r&&r.parentNode==t.target?Ie(r)+1:0,o=n.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?Ie(i):t.target.childNodes.length;return{from:o,to:n.localPosFromDOM(t.target,l,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=t.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let Ri=new WeakMap,Ni=!1;function Pi(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Be(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Ii(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let e=t.docView.nearestDesc(n,!0);if(e&&e.node.isBlock)return n}return null}function Hi(t){let e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(sn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||sn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Di=/^(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 ji(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ar(t,e.resolve(n.anchor),e.resolve(n.head))}function Bi(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let e=t.node(r).maybeChild(t.indexAfter(r));for(;e&&!e.isLeaf;)e=e.firstChild,i++}return i}function zi(t){if(2!=t.length)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Fi{constructor(t,e){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 zr,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(qi),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Ji(this),_i(this),this.nodeViews=Ki(this),this.docView=Bn(this.state.doc,Ui(this),Oi(this),this.dom,this),this.domObserver=new $i(this,((t,e,n,r)=>function(t,e,n,r,s){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=er(t,e);if(n&&!t.state.selection.eq(n)){if(nn&&hn&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,Ke(13,"Enter")))))return;let r=t.state.tr.setSelection(n);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),o&&r.setMeta("composition",o),t.dispatch(r)}return}let l=t.state.doc.resolve(e),u=l.sharedDepth(n);e=l.before(u+1),n=t.state.doc.resolve(n).after(u+1);let h,a,c=t.state.selection,f=function(t,e,n){let r,{node:i,fromOffset:s,toOffset:o,from:l,to:u}=t.docView.parseRange(e,n),h=t.domSelectionRange(),a=h.anchorNode;if(a&&t.dom.contains(1==a.nodeType?a:a.parentNode)&&(r=[{node:a,offset:h.anchorOffset}],Je(h)||r.push({node:h.focusNode,offset:h.focusOffset})),nn&&8===t.input.lastKeyCode)for(let t=o;t>s;t--){let e=i.childNodes[t-1],n=e.pmViewDesc;if("BR"==e.nodeName&&!n){o=t;break}if(!n||n.size)break}let c=t.state.doc,f=t.someProp("domParser")||Q.fromSchema(t.state.schema),d=c.resolve(l),p=null,m=f.parse(i,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:!0,from:s,to:o,preserveWhitespace:"pre"!=d.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Hi,context:d});if(r&&null!=r[0].pos){let t=r[0].pos,e=r[1]&&r[1].pos;null==e&&(e=t),p={anchor:t+l,head:e+l}}return{doc:m,sel:p,from:l,to:u}}(t,e,n),d=t.state.doc,p=d.slice(f.from,f.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,a="end"):(h=t.state.selection.from,a="start"),t.input.lastKeyCode=null;let m=function(t,e,n,r,i){let s=t.findDiffStart(e,n);if(null==s)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if("end"==i&&(r-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&t.size<e.size){let t=r<=s&&r>=o?s-r:0;s-=t,s&&s<e.size&&zi(e.textBetween(s-1,s+1))&&(s+=t?1:-1),l=s+(l-o),o=s}else if(l<s){let e=r<=s&&r>=l?s-r:0;s-=e,s&&s<t.size&&zi(t.textBetween(s-1,s+1))&&(s+=e?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}(p.content,f.doc.content,f.from,h,a);if(m&&t.input.domChangeCount++,(on&&t.input.lastIOSEnter>Date.now()-225||hn)&&s.some((t=>1==t.nodeType&&!Di.test(t.nodeName)))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",(e=>e(t,Ke(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!m){if(!(r&&c instanceof ie&&!c.empty&&c.$head.sameParent(c.$anchor))||t.composing||f.sel&&f.sel.anchor!=f.sel.head){if(f.sel){let e=ji(t,t.state.doc,f.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);o&&n.setMeta("composition",o),t.dispatch(n)}}return}m={start:c.from,endA:c.to,endB:c.to}}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ie&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Ye&&Xe<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>f.from&&" "==f.doc.textBetween(m.start-f.from-1,m.start-f.from+1)&&(m.start--,m.endA--,m.endB--);let g=f.doc.resolveNoCache(m.start-f.from),w=f.doc.resolveNoCache(m.endB-f.from),b=d.resolve(m.start),v=g.sameParent(w)&&g.parent.inlineContent&&b.end()>=m.endA;if((on&&t.input.lastIOSEnter>Date.now()-225&&(!v||s.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!v&&g.pos<f.doc.content.size&&(!g.sameParent(w)||!g.parent.inlineContent)&&g.pos<w.pos&&!/\S/.test(f.doc.textBetween(g.pos,w.pos,"","")))&&t.someProp("handleKeyDown",(e=>e(t,Ke(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>m.start&&function(t,e,n,r,i){if(n-e<=i.pos-r.pos||Bi(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let t=s.nodeAfter;return null!=t&&n==e+t.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Bi(s,!0,!0));return!(!o.parent.isTextblock||o.pos>n||Bi(o,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(o.parent.content)}(d,m.start,m.endA,g,w)&&t.someProp("handleKeyDown",(e=>e(t,Ke(8,"Backspace")))))return void(hn&&nn&&t.domObserver.suppressSelectionUpdates());nn&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),hn&&!v&&g.start()!=w.start()&&0==w.parentOffset&&g.depth==w.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==m.endA&&(m.endB-=2,w=f.doc.resolveNoCache(m.endB-f.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,Ke(13,"Enter"))}))}),20));let y,k=m.start,M=m.endA,x=e=>{let n=e||t.state.tr.replace(k,M,f.doc.slice(m.start-f.from,m.endB-f.from));if(f.sel){let e=ji(t,n.doc,f.sel);e&&!(nn&&t.composing&&e.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==k||e.head==n.mapping.map(M)-1)||Ye&&e.empty&&e.head==k)&&n.setSelection(e)}return o&&n.setMeta("composition",o),n.scrollIntoView()};if(v)if(g.pos==w.pos){Ye&&Xe<=11&&0==g.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>rr(t)),20));let e=x(t.state.tr.delete(k,M)),n=d.resolve(m.start).marksAcross(d.resolve(m.endA));n&&e.ensureMarks(n),t.dispatch(e)}else if(m.endA==m.endB&&(y=function(t,e){let n,r,s,o=t.firstChild.marks,l=e.firstChild.marks,u=o,h=l;for(let t=0;t<l.length;t++)u=l[t].removeFromSet(u);for(let t=0;t<o.length;t++)h=o[t].removeFromSet(h);if(1==u.length&&0==h.length)r=u[0],n="add",s=t=>t.mark(r.addToSet(t.marks));else{if(0!=u.length||1!=h.length)return null;r=h[0],n="remove",s=t=>t.mark(r.removeFromSet(t.marks))}let a=[];for(let t=0;t<e.childCount;t++)a.push(s(e.child(t)));if(i.from(a).eq(t))return{mark:r,type:n}}(g.parent.content.cut(g.parentOffset,w.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let e=x(t.state.tr);"add"==y.type?e.addMark(k,M,y.mark):e.removeMark(k,M,y.mark),t.dispatch(e)}else if(g.parent.child(g.index()).isText&&g.index()==w.index()-(w.textOffset?0:1)){let e=g.parent.textBetween(g.parentOffset,w.parentOffset),n=()=>x(t.state.tr.insertText(e,k,M));t.someProp("handleTextInput",(r=>r(t,k,M,e,n)))||t.dispatch(n())}else t.dispatch(x());else t.dispatch(x())}(this,t,e,n,r))),this.domObserver.start(),function(t){for(let e in Dr){let n=Dr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!Jr(t,e)||_r(t,e)||!t.editable&&e.type in jr||n(t,e)},Br[e]?{passive:!0}:void 0)}sn&&t.dom.addEventListener("input",(()=>null)),Ur(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ur(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(qi),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var n;let r=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(ni(this),s=!0),this.state=t;let o=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(o||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=Ki(this);(function(t,e){let n=0,r=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let t in e)r++;return n!=r})(t,this.nodeViews)&&(this.nodeViews=t,i=!0)}(o||e.handleDOMEvents!=this._props.handleDOMEvents)&&Ur(this),this.editable=Ji(this),_i(this);let l=Oi(this),u=Ui(this),h=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",a=i||!this.docView.matchesNode(t.doc,u,l);!a&&t.selection.eq(r.selection)||(s=!0);let c="preserve"==h&&s&&null==this.dom.style.overflowAnchor&&function(t){let e,n,r=t.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let s=(r.left+r.right)/2,o=i+1;o<Math.min(innerHeight,r.bottom);o+=5){let r=t.root.elementFromPoint(s,o);if(!r||r==t.dom||!t.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){e=r,n=l.top;break}}return{refDOM:e,refTop:n,stack:gn(t.dom)}}(this);if(s){this.domObserver.stop();let e=a&&(Ye||nn)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(r.selection,t.selection);if(a){let n=nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=Ue(t=t.childNodes[e-1])}else{if(!t.parentNode||_e(t))return null;e=Ie(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),r=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0}else{if(!t.parentNode||_e(t))return null;e=Ie(t)+1,t=t.parentNode}}}(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let e=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!e||!e.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let t=n.pmViewDesc;if(t&&t.isText(n.nodeValue))return r}}return n||r}(this)),!i&&this.docView.update(t.doc,u,l,this)||(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Bn(t.doc,u,l,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(e=!0)}e||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Be(e.node,e.offset,n.anchorNode,n.anchorOffset)}(this))?rr(this,e):(ur(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():c&&function({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;wn(n,0==r?0:r-e)}(c)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof oe){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&mn(this,e.getBoundingClientRect(),t)}else mn(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(t,e){let n=t.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let t=n.from+(this.state.doc.content.size-e.doc.content.size);(t>0&&t<this.state.doc.content.size&&this.state.doc.nodeAt(t))==n.node&&(r=t)}this.dragging=new li(t.slice,t.move,r<0?void 0:oe.create(this.state.doc,r))}someProp(t,e){let n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[t];if(null!=i&&(n=e?e(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let s=i[r].props[t];if(null!=s&&(n=e?e(s):s))return n}}hasFocus(){if(Ye){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(bn)return t.focus(bn);let e=gn(t);t.focus(null==bn?{get preventScroll(){return bn={preventScroll:!0},!0}}:void 0),bn||(bn=!1,wn(e,0))}(this.dom),rr(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return Mn(this,t)}coordsAtPos(t,e=1){return En(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return function(t,e,n){return $n==e&&Rn==n?Nn:($n=e,Rn=n,Nn="up"==n||"down"==n?function(t,e,n){let r=e.selection,i="up"==n?r.$from:r.$to;return Ln(t,e,(()=>{let{node:e}=t.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let r=En(t,i.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=je(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let i=e[t];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?Cn.test(r.parent.textContent)&&l.modify?Ln(t,e,(()=>{let{focusNode:e,focusOffset:i,anchorNode:s,anchorOffset:o}=t.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:a,focusOffset:c}=t.domSelectionRange(),f=a&&!h.contains(1==a.nodeType?a:a.parentNode)||e==a&&i==c;try{l.collapse(s,o),e&&(e!=s||i!=o)&&l.extend&&l.extend(e,i)}catch(t){}return null!=u&&(l.caretBidiLevel=u),f})):"left"==n||"backward"==n?s:o:r.pos==r.start()||r.pos==r.end()}(t,e,n))}(this,e||this.state,t)}pasteHTML(t,e){return si(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return si(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return Sr(this,t)}destroy(){this.docView&&(function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Oi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,De=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){_r(t,e)||!Dr[e.type]||!t.editable&&e.type in jr||Dr[e.type](t,e)}(this,t)}domSelectionRange(){let t=this.domSelection();return t?sn&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return Pi(t,n)}let n;function r(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Pi(t,n):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Ui(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t?e.class+=" "+n[t]:"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))})),e.translate||(e.translate="no"),[pi.node(0,t.state.doc.content.size,e)]}function _i(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:pi.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Ji(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function Ki(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function qi(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Fi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};for(var Wi={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:"'"},Gi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vi="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Qi="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Zi=0;Zi<10;Zi++)Wi[48+Zi]=Wi[96+Zi]=String(Zi);for(Zi=1;Zi<=24;Zi++)Wi[Zi+111]="F"+Zi;for(Zi=65;Zi<=90;Zi++)Wi[Zi]=String.fromCharCode(Zi+32),Gi[Zi]=String.fromCharCode(Zi);for(var Yi in Wi)Gi.hasOwnProperty(Yi)||(Gi[Yi]=Wi[Yi]);const Xi="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ts="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function es(t){let e,n,r,i,s=t.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let t=0;t<s.length-1;t++){let o=s[t];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))e=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))r=!0;else{if(!/^mod$/i.test(o))throw new Error("Unrecognized modifier name: "+o);Xi?i=!0:n=!0}}return e&&(o="Alt-"+o),n&&(o="Ctrl-"+o),i&&(o="Meta-"+o),r&&(o="Shift-"+o),o}function ns(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function rs(t){let e=function(t){let e=Object.create(null);for(let n in t)e[es(n)]=t[n];return e}(t);return function(t,n){let r,i=function(t){var e=!(Vi&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Qi&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gi:Wi)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),s=e[ns(i,n)];if(s&&s(t.state,t.dispatch,t))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=e[ns(i,n,!1)];if(r&&r(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ts&&n.ctrlKey&&n.altKey)&&(r=Wi[n.keyCode])&&r!=i){let i=e[ns(r,n)];if(i&&i(t.state,t.dispatch,t))return!0}}return!1}}var is=Object.defineProperty,ss=(t,e)=>{for(var n in e)is(t,n,{get:e[n],enumerable:!0})};function ls(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;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 s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var us=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(s);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],l=!!t,u=t||i.tr,h={...Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const r=this.buildProps(u,e),i=n(...t)(r);return o.push(i),h}]))),run:()=>(l||!e||u.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(u),o.every((t=>!0===t)))};return h}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...s,dispatch:void 0})]))),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:ls({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map((([t,e])=>[t,(...t)=>e(...t)(o)])))}};return o}},hs={};ss(hs,{blur:()=>as,clearContent:()=>cs,clearNodes:()=>fs,command:()=>ds,createParagraphNear:()=>ps,cut:()=>ms,deleteCurrentNode:()=>gs,deleteNode:()=>bs,deleteRange:()=>vs,deleteSelection:()=>ks,enter:()=>Ms,exitCode:()=>xs,extendMarkRange:()=>Cs,first:()=>$s,focus:()=>Ds,forEach:()=>js,insertContent:()=>Bs,insertContentAt:()=>_s,joinBackward:()=>qs,joinDown:()=>Ks,joinForward:()=>Ws,joinItemBackward:()=>Gs,joinItemForward:()=>Vs,joinTextblockBackward:()=>Qs,joinTextblockForward:()=>Zs,joinUp:()=>Js,keyboardShortcut:()=>Xs,lift:()=>eo,liftEmptyBlock:()=>no,liftListItem:()=>ro,newlineInCode:()=>io,resetAttributes:()=>lo,scrollIntoView:()=>uo,selectAll:()=>ho,selectNodeBackward:()=>ao,selectNodeForward:()=>co,selectParentNode:()=>fo,selectTextblockEnd:()=>po,selectTextblockStart:()=>mo,setContent:()=>wo,setMark:()=>Xo,setMeta:()=>tl,setNode:()=>el,setNodeSelection:()=>nl,setTextDirection:()=>rl,setTextSelection:()=>il,sinkListItem:()=>sl,splitBlock:()=>ll,splitListItem:()=>ul,toggleList:()=>cl,toggleMark:()=>fl,toggleNode:()=>dl,toggleWrap:()=>pl,undoInputRule:()=>ml,unsetAllMarks:()=>gl,unsetMark:()=>wl,unsetTextDirection:()=>bl,updateAttributes:()=>vl,wrapIn:()=>yl,wrapInList:()=>kl});var as=()=>({editor:t,view:e})=>(requestAnimationFrame((()=>{var n;t.isDestroyed||(e.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())})),!0),cs=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),fs=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return!n||(i.forEach((({$from:n,$to:r})=>{t.doc.nodesBetween(n.pos,r.pos,((t,n)=>{if(t.type.isText)return;const{doc:r,mapping:i}=e,s=r.resolve(i.map(n)),o=r.resolve(i.map(n+t.nodeSize)),l=s.blockRange(o);if(!l)return;const u=Lt(l);if(t.type.isTextblock){const{defaultType:t}=s.parent.contentMatchAt(s.index());e.setNodeMarkup(l.start,t)}(u||0===u)&&e.lift(l,u)}))})),!0)},ds=t=>e=>t(e),ps=()=>({state:t,dispatch:e})=>((t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ue||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Le(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=t.tr.insert(n,s.createAndFill());o.setSelection(ie.create(o.doc,n+1)),e(o.scrollIntoView())}return!0})(t,e),ms=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ie(r.doc.resolve(Math.max(o-1,0)))),!0},gs=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(e){const e=i.before(n),r=i.after(n);t.delete(e,r).scrollIntoView()}return!0}return!1};function ws(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var bs=t=>({tr:e,state:n,dispatch:r})=>{const i=ws(t,n.schema),s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1)if(s.node(t).type===i){if(r){const n=s.before(t),r=s.after(t);e.delete(n,r).scrollIntoView()}return!0}return!1},vs=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},ys=(t,e,n)=>{return t.parent.isInline?"left"===n&&t.pos>t.start()||"right"===n&&t.pos<t.end()?t.pos:(r=e.nodes[t.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?t.start()-1:t.end()+1:t.pos:t.pos;var r},ks=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:i,to:s}=((t,e,n)=>({from:ys(t,n,"left"),to:ys(e,n,"right")}))(n,r,t.schema);return e&&(t.tr.deleteRange(i,s).scrollIntoView(),e(t.tr)),!0},Ms=()=>({commands:t})=>t.keyboardShortcut("Enter"),xs=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Le(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let r=n.after(),i=t.tr.replaceWith(r,r,o.createAndFill());i.setSelection(te.near(i.doc.resolve(r),1)),e(i.scrollIntoView())}return!0})(t,e);function Ts(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function Ss(t,e,n={strict:!0}){const r=Object.keys(e);return!r.length||r.every((r=>n.strict?e[r]===t[r]:Ts(e[r])?e[r].test(t[r]):e[r]===t[r]))}function Es(t,e,n={}){return t.find((t=>t.type===e&&Ss(Object.fromEntries(Object.keys(n).map((e=>[e,t.attrs[e]]))),n)))}function Os(t,e,n={}){return!!Es(t,e,n)}function As(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some((t=>t.type===e))||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some((t=>t.type===e)))return;if(!n){const t=r.node.marks.find((t=>t.type===e));t&&(n=t.attrs)}if(!Es([...r.node.marks],e,n))return;let i=r.index,s=t.start()+r.offset,o=i+1,l=s+r.node.nodeSize;for(;i>0&&Os([...t.parent.child(i-1).marks],e,n);)i-=1,s-=t.parent.child(i).nodeSize;for(;o<t.parent.childCount&&Os([...t.parent.child(o).marks],e,n);)l+=t.parent.child(o).nodeSize,o+=1;return{from:s,to:l}}function Ls(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Cs=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=Ls(t,r.schema),{doc:o,selection:l}=n,{$from:u,from:h,to:a}=l;if(i){const t=As(u,s,e);if(t&&t.from<=h&&t.to>=a){const e=ie.create(o,t.from,t.to);n.setSelection(e)}}return!0},$s=t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1};function Rs(t){return t instanceof ie}function Ns(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ps(t,e=null){if(!e)return null;const n=te.atStart(t),r=te.atEnd(t);if("start"===e||!0===e)return n;if("end"===e)return r;const i=n.from,s=r.to;return"all"===e?ie.create(t,Ns(0,i,s),Ns(t.content.size,i,s)):ie.create(t,Ns(e,i,s),Ns(e,i,s))}function Is(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Hs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Ds=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Hs()||Is())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||Hs()||Is()||r.dom.focus({preventScroll:!0}),requestAnimationFrame((()=>{n.isDestroyed||(r.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())}))};try{if(r.hasFocus()&&null===t||!1===t)return!0}catch{return!1}if(s&&null===t&&!Rs(n.state.selection))return o(),!0;const l=Ps(i.doc,t)||n.state.selection,u=n.state.selection.eq(l);return s&&(u||i.setSelection(l),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},js=(t,e)=>n=>t.every(((t,r)=>e(t,{...n,index:r}))),Bs=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),zs=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):1===r.nodeType&&zs(r)}return t};function Fs(t){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return zs(n)}function Us(t,e,n){if(t instanceof L||t instanceof i)return t;n={slice:!0,parseOptions:{},...n};const r="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return i.fromArray(t.map((t=>e.nodeFromJSON(t))));const r=e.nodeFromJSON(t);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Us("",e,n)}if(r){if(n.errorOnInvalidContent){let r=!1,i="";const s=new G({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:t=>(r=!0,i="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?Q.fromSchema(s).parseSlice(Fs(t),n.parseOptions):Q.fromSchema(s).parse(Fs(t),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const r=Q.fromSchema(e);return n.slice?r.parseSlice(Fs(t),n.parseOptions).content:r.parse(Fs(t),n.parseOptions)}return Us("",e,n)}var _s=(t,e,n)=>({tr:r,dispatch:s,editor:o})=>{var l;if(s){let s;const u=t=>{o.emit("contentError",{editor:o,error:t,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...(n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Us(e,o.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(t){u(t)}try{s=Us(e,o.schema,{parseOptions:h,errorOnInvalidContent:null!=(l=n.errorOnInvalidContent)?l:o.options.enableContentCheck})}catch(t){return u(t),!1}let a,{from:c,to:f}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},d=!0,p=!0;if(("type"in s?[s]:s).forEach((t=>{t.check(),d=!!d&&t.isText&&0===t.marks.length,p=!!p&&t.isBlock})),c===f&&p){const{parent:t}=r.doc.resolve(c);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(c-=1,f+=1)}if(d){if(Array.isArray(e))a=e.map((t=>t.text||"")).join("");else if(e instanceof i){let t="";e.forEach((e=>{e.text&&(t+=e.text)})),a=t}else a="object"==typeof e&&e&&e.text?e.text:e;r.insertText(a,c,f)}else{a=s;const t=r.doc.resolve(c),e=t.node();0===t.parentOffset&&(e.isText||e.isTextblock)&&e.content.size>0&&p&&(c=Math.max(0,c-1)),r.replaceWith(c,f,a)}n.updateSelection&&function(t,e){const n=t.steps.length-1;if(n<e)return;const r=t.steps[n];if(!(r instanceof Tt||r instanceof St))return;let i=0;t.mapping.maps[n].forEach(((t,e,n,r)=>{0===i&&(i=r)})),t.setSelection(te.near(t.doc.resolve(i),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:a}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:a})}return!0},Js=()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection,i=r instanceof oe;if(i){if(r.node.isTextblock||!It(t.doc,r.from))return!1;n=r.from}else if(n=Dt(t.doc,r.from,-1),null==n)return!1;if(e){let r=t.tr.join(n);i&&r.setSelection(oe.create(r.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0})(t,e),Ks=()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection;if(r instanceof oe){if(r.node.isTextblock||!It(t.doc,r.to))return!1;n=r.to}else if(n=Dt(t.doc,r.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),qs=()=>({state:t,dispatch:e})=>((t,e)=>{let n=xe(t,void 0);if(!n)return!1;let r=Ee(n);if(!r){let r=n.blockRange(),i=r&&Lt(r);return null!=i&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)}let i=r.nodeBefore;if(Ce(t,r,e,-1))return!0;if(0==n.parent.content.size&&(Se(i,"end")||oe.isSelectable(i)))for(let s=n.depth;;s--){let o=Bt(t.doc,n.before(s),n.after(s),a.empty);if(o&&o.slice.size<o.to-o.from){if(e){let n=t.tr.step(o);n.setSelection(Se(i,"end")?te.findFrom(n.doc.resolve(n.mapping.map(r.pos,-1)),-1):oe.create(n.doc,r.pos-i.nodeSize)),e(n.scrollIntoView())}return!0}if(1==s||n.node(s-1).childCount>1)break}return!(!i.isAtom||r.depth!=n.depth-1||(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),0))})(t,e),Ws=()=>({state:t,dispatch:e})=>((t,e)=>{let n=Oe(t,void 0);if(!n)return!1;let r=Ae(n);if(!r)return!1;let i=r.nodeAfter;if(Ce(t,r,e,1))return!0;if(0==n.parent.content.size&&(Se(i,"start")||oe.isSelectable(i))){let s=Bt(t.doc,n.before(),n.after(),a.empty);if(s&&s.slice.size<s.to-s.from){if(e){let n=t.tr.step(s);n.setSelection(Se(i,"start")?te.findFrom(n.doc.resolve(n.mapping.map(r.pos)),1):oe.create(n.doc,n.mapping.map(r.pos))),e(n.scrollIntoView())}return!0}}return!(!i.isAtom||r.depth!=n.depth-1||(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),0))})(t,e),Gs=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Dt(t.doc,t.selection.$from.pos,-1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch{return!1}},Vs=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Dt(t.doc,t.selection.$from.pos,1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch{return!1}},Qs=()=>({state:t,dispatch:e})=>((t,e)=>{let n=xe(t,void 0);if(!n)return!1;let r=Ee(n);return!!r&&Te(t,r,e)})(t,e),Zs=()=>({state:t,dispatch:e})=>((t,e)=>{let n=Oe(t,void 0);if(!n)return!1;let r=Ae(n);return!!r&&Te(t,r,e)})(t,e);function Ys(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Xs=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=function(t){const e=t.split(/-(?!$)/);let n,r,i,s,o=e[e.length-1];"Space"===o&&(o=" ");for(let t=0;t<e.length-1;t+=1){const o=e[t];if(/^(cmd|meta|m)$/i.test(o))s=!0;else if(/^a(lt)?$/i.test(o))n=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))i=!0;else{if(!/^mod$/i.test(o))throw new Error(`Unrecognized modifier name: ${o}`);Hs()||Ys()?s=!0:r=!0}}return n&&(o=`Alt-${o}`),r&&(o=`Ctrl-${o}`),s&&(o=`Meta-${o}`),i&&(o=`Shift-${o}`),o}(t).split(/-(?!$)/),o=s.find((t=>!["Alt","Ctrl","Meta","Shift"].includes(t))),l=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,l)))}));return null==u||u.steps.forEach((t=>{const e=t.map(r.mapping);e&&i&&r.maybeStep(e)})),!0};function to(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?ws(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,((t,e)=>{if(t.isText)return;const n=Math.max(r,e),s=Math.min(i,e+t.nodeSize);l.push({node:t,from:n,to:s})}));const u=i-r,h=l.filter((t=>!o||o.name===t.node.type.name)).filter((t=>Ss(t.node.attrs,n,{strict:!1})));return s?!!h.length:h.reduce(((t,e)=>t+e.to-e.from),0)>=u}var eo=(t,e={})=>({state:n,dispatch:r})=>!!to(n,ws(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Lt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)})(n,r),no=()=>({state:t,dispatch:e})=>((t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Pt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Lt(r);return null!=i&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)})(t,e),ro=t=>({state:e,dispatch:n})=>{return(r=ws(t,e.schema),function(t,e){let{$from:n,$to:s}=t.selection,o=n.blockRange(s,(t=>t.childCount>0&&t.firstChild.type==r));return!!o&&(!e||(n.node(o.depth-1).type==r?function(t,e,n,r){let s=t.tr,o=r.end,l=r.$to.end(r.depth);o<l&&(s.step(new St(o-1,l,o,l,new a(i.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new O(s.doc.resolve(r.$from.pos),s.doc.resolve(l),r.depth));const u=Lt(r);if(null==u)return!1;s.lift(r,u);let h=s.doc.resolve(s.mapping.map(o,-1)-1);return It(s.doc,h.pos)&&h.nodeBefore.type==h.nodeAfter.type&&s.join(h.pos),e(s.scrollIntoView()),!0}(t,e,r,o):function(t,e,n){let r=t.tr,s=n.parent;for(let t=n.end,e=n.endIndex-1,i=n.startIndex;e>i;e--)t-=s.child(e).nodeSize,r.delete(t-1,t+1);let o=r.doc.resolve(n.start),l=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let u=0==n.startIndex,h=n.endIndex==s.childCount,c=o.node(-1),f=o.index(-1);if(!c.canReplace(f+(u?0:1),f+1,l.content.append(h?i.empty:i.from(s))))return!1;let d=o.pos,p=d+l.nodeSize;return r.step(new St(d-(u?1:0),p+(h?1:0),d+1,p-1,new a((u?i.empty:i.from(s.copy(i.empty))).append(h?i.empty:i.from(s.copy(i.empty))),u?0:1,h?0:1),u?0:1)),e(r.scrollIntoView()),!0}(t,e,o)))})(e,n);var r},io=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))})(t,e);function so(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function oo(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{})}var lo=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=so("string"==typeof t?t:t.name,r.schema);if(!l)return!1;"node"===l&&(s=ws(t,r.schema)),"mark"===l&&(o=Ls(t,r.schema));let u=!1;return n.selection.ranges.forEach((t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,r)=>{s&&s===t.type&&(u=!0,i&&n.setNodeMarkup(r,void 0,oo(t.attrs,e))),o&&t.marks.length&&t.marks.forEach((s=>{o===s.type&&(u=!0,i&&n.addMark(r,r+t.nodeSize,o.create(oo(s.attrs,e))))}))}))})),u},uo=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),ho=()=>({tr:t,dispatch:e})=>{if(e){const e=new ue(t.doc);t.setSelection(e)}return!0},ao=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,empty:r}=t.selection,i=n;if(!r)return!1;if(n.parent.isTextblock){if(n.parentOffset>0)return!1;i=Ee(n)}let s=i&&i.nodeBefore;return!(!s||!oe.isSelectable(s)||(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),0))})(t,e),co=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:n,empty:r}=t.selection,i=n;if(!r)return!1;if(n.parent.isTextblock){if(n.parentOffset<n.parent.content.size)return!1;i=Ae(n)}let s=i&&i.nodeAfter;return!(!s||!oe.isSelectable(s)||(e&&e(t.tr.setSelection(oe.create(t.doc,i.pos)).scrollIntoView()),0))})(t,e),fo=()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:r,to:i}=t.selection,s=r.sharedDepth(i);return 0!=s&&(n=r.before(s),e&&e(t.tr.setSelection(oe.create(t.doc,n))),!0)})(t,e),po=()=>({state:t,dispatch:e})=>Ne(t,e),mo=()=>({state:t,dispatch:e})=>Re(t,e);function go(t,e,n={},r={}){return Us(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var wo=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:u}=s;if("full"!==r.preserveWhitespace){const l=go(t,i.schema,r,{errorOnInvalidContent:null!=e?e:i.options.enableContentCheck});return o&&s.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:null!=e?e:i.options.enableContentCheck})};function bo(t,e){const n=Ls(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,(t=>{o.push(...t.marks)}));const l=o.find((t=>t.type.name===n.name));return l?{...l.attrs}:{}}function vo(t,e){const n=new Yt(t);return e.forEach((t=>{t.steps.forEach((t=>{n.step(t)}))})),n}function yo(t){return e=>function(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}(e.$from,t)}function ko(t,e,n){return void 0===t.config[e]&&t.parent?ko(t.parent,e,n):"function"==typeof t.config[e]?t.config[e].bind({...n,parent:t.parent?ko(t.parent,e,n):null}):t.config[e]}function Mo(t){return t.map((t=>{const e=ko(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...Mo(e())]:t})).flat(10)}function xo(t,e){const n=ot.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function To(t){return"function"==typeof t}function So(t,e,...n){return To(t)?e?t.bind(e)(...n):t(...n):t}function Eo(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function Oo(t){const e=[],{nodeExtensions:n,markExtensions:r}=Eo(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter((t=>"text"!==t.name)).map((t=>t.name)),l=r.map((t=>t.name)),u=[...o,...l];return t.forEach((t=>{const n=ko(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:i});n&&n().forEach((t=>{let n;n=Array.isArray(t.types)?t.types:"*"===t.types?u:"nodes"===t.types?o:"marks"===t.types?l:[],n.forEach((n=>{Object.entries(t.attributes).forEach((([t,r])=>{e.push({type:n,name:t,attribute:{...s,...r}})}))}))}))})),i.forEach((t=>{const n=ko(t,"addAttributes",{name:t.name,options:t.options,storage:t.storage});if(!n)return;const r=n();Object.entries(r).forEach((([n,r])=>{const i={...s,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,e.push({type:t.name,name:n,attribute:i})}))})),e}function Ao(t){const e=[],n=function(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let l=0;l<o;l+=1){const o=t[l];if("'"!==o||i)if('"'!==o||r){if(!r&&!i){if("("===o){s+=1,n+=o;continue}if(")"===o&&s>0){s-=1,n+=o;continue}if(";"===o&&0===s){e.push(n),n="";continue}}n+=o}else i=!i,n+=o;else r=!r,n+=o}return n&&e.push(n),e}(t||""),r=n.length;for(let t=0;t<r;t+=1){const r=n[t],i=r.indexOf(":");if(-1===i)continue;const s=r.slice(0,i).trim(),o=r.slice(i+1).trim();s&&o&&e.push([s,o])}return e}function Lo(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n={...t};return Object.entries(e).forEach((([t,e])=>{if(n[t])if("class"===t){const r=e?String(e).split(" "):[],i=n[t]?n[t].split(" "):[],s=r.filter((t=>!i.includes(t)));n[t]=[...i,...s].join(" ")}else if("style"===t){const r=new Map([...Ao(n[t]),...Ao(e)]);n[t]=Array.from(r.entries()).map((([t,e])=>`${t}: ${e}`)).join("; ")}else n[t]=e;else n[t]=e})),n}),{})}function Co(t,e){return e.filter((e=>e.type===t.type.name)).filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>Lo(t,e)),{})}function $o(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const i=e.reduce(((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n):function(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}(n.getAttribute(e.name));return null==r?t:{...t,[e.name]:r}}),{});return{...r,...i}}}}function Ro(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e)))}function No(t){var e,n;const r={};return!(null==(e=null==t?void 0:t.attribute)?void 0:e.isRequired)&&"default"in((null==t?void 0:t.attribute)||{})&&(r.default=t.attribute.default),void 0!==(null==(n=null==t?void 0:t.attribute)?void 0:n.validate)&&(r.validate=t.attribute.validate),[t.name,r]}function Po(t,e){var n;const r=Oo(t),{nodeExtensions:i,markExtensions:s}=Eo(t),o=null==(n=i.find((t=>ko(t,"topNode"))))?void 0:n.name,l=Object.fromEntries(i.map((n=>{const i=r.filter((t=>t.type===n.name)),s={name:n.name,options:n.options,storage:n.storage,editor:e},o=Ro({...t.reduce(((t,e)=>{const r=ko(e,"extendNodeSchema",s);return{...t,...r?r(n):{}}}),{}),content:So(ko(n,"content",s)),marks:So(ko(n,"marks",s)),group:So(ko(n,"group",s)),inline:So(ko(n,"inline",s)),atom:So(ko(n,"atom",s)),selectable:So(ko(n,"selectable",s)),draggable:So(ko(n,"draggable",s)),code:So(ko(n,"code",s)),whitespace:So(ko(n,"whitespace",s)),linebreakReplacement:So(ko(n,"linebreakReplacement",s)),defining:So(ko(n,"defining",s)),isolating:So(ko(n,"isolating",s)),attrs:Object.fromEntries(i.map(No))}),l=So(ko(n,"parseHTML",s));l&&(o.parseDOM=l.map((t=>$o(t,i))));const u=ko(n,"renderHTML",s);u&&(o.toDOM=t=>u({node:t,HTMLAttributes:Co(t,i)}));const h=ko(n,"renderText",s);return h&&(o.toText=h),[n.name,o]}))),u=Object.fromEntries(s.map((n=>{const i=r.filter((t=>t.type===n.name)),s={name:n.name,options:n.options,storage:n.storage,editor:e},o=Ro({...t.reduce(((t,e)=>{const r=ko(e,"extendMarkSchema",s);return{...t,...r?r(n):{}}}),{}),inclusive:So(ko(n,"inclusive",s)),excludes:So(ko(n,"excludes",s)),group:So(ko(n,"group",s)),spanning:So(ko(n,"spanning",s)),code:So(ko(n,"code",s)),attrs:Object.fromEntries(i.map(No))}),l=So(ko(n,"parseHTML",s));l&&(o.parseDOM=l.map((t=>$o(t,i))));const u=ko(n,"renderHTML",s);return u&&(o.toDOM=t=>u({mark:t,HTMLAttributes:Co(t,i)})),[n.name,o]})));return new G({topNode:o,nodes:l,marks:u})}function Io(t){return t.sort(((t,e)=>{const n=ko(t,"priority")||100,r=ko(e,"priority")||100;return n>r?-1:n<r?1:0}))}function Ho(t){const e=Io(Mo(t)),n=function(t){const e=t.filter(((e,n)=>t.indexOf(e)!==n));return Array.from(new Set(e))}(e.map((t=>t.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`),e}function Do(t,e){return Po(Ho(t),e)}function jo(t,e,n){const{from:r,to:i}=e,{blockSeparator:s="\n\n",textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,((t,n,u,h)=>{var a;t.isBlock&&n>r&&(l+=s);const c=null==o?void 0:o[t.type.name];if(c)return u&&(l+=c({node:t,pos:n,parent:u,index:h,range:e})),!1;t.isText&&(l+=null==(a=null==t?void 0:t.text)?void 0:a.slice(Math.max(r,n)-n,i-n))})),l}function Bo(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}function zo(t,e){const n=so("string"==typeof e?e:e.name,t.schema);return"node"===n?function(t,e){const n=ws(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,(t=>{s.push(t)}));const o=s.reverse().find((t=>t.type.name===n.name));return o?{...o.attrs}:{}}(t,e):"mark"===n?bo(t,e):{}}function Fo(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach(((t,i)=>{const s=[];if(t.ranges.length)t.forEach(((t,e)=>{s.push({from:t,to:e})}));else{const{from:t,to:e}=n[i];if(void 0===t||void 0===e)return;s.push({from:t,to:e})}s.forEach((({from:t,to:n})=>{const s=e.slice(i).map(t,-1),o=e.slice(i).map(n),l=e.invert().map(s,-1),u=e.invert().map(o);r.push({oldRange:{from:l,to:u},newRange:{from:s,to:o}})}))})),function(t){const e=function(t,e=JSON.stringify){const n={};return t.filter((t=>{const r=e(t);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)}))}(t);return 1===e.length?e:e.filter(((t,n)=>{const r=e.filter(((t,e)=>e!==n));return!r.some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}))}(r)}function Uo(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach((e=>{const i=As(n.resolve(t),e.type);i&&r.push({mark:e,...i})})):n.nodesBetween(t,e,((t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&r.push(...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n}))))})),r}function _o(t,e){return e.nodes[t]||e.marks[t]||null}function Jo(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=t.find((t=>t.type===e&&t.name===n));return!!r&&r.attribute.keepOnSplit})))}function Ko(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Ls(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!s||s.name===t.type.name)).find((t=>Ss(t.attrs,n,{strict:!1})));let o=0;const l=[];if(i.forEach((({$from:e,$to:n})=>{const r=e.pos,i=n.pos;t.doc.nodesBetween(r,i,((t,e)=>{if(s&&t.inlineContent&&!t.type.allowsMarkType(s))return!1;if(!t.isText&&!t.marks.length)return;const n=Math.max(r,e),u=Math.min(i,e+t.nodeSize);o+=u-n,l.push(...t.marks.map((t=>({mark:t,from:n,to:u}))))}))})),0===o)return!1;const u=l.filter((t=>!s||s.name===t.mark.type.name)).filter((t=>Ss(t.mark.attrs,n,{strict:!1}))).reduce(((t,e)=>t+e.to-e.from),0),h=l.filter((t=>!s||t.mark.type!==s&&t.mark.type.excludes(s))).reduce(((t,e)=>t+e.to-e.from),0);return(u>0?u+h:u)>=o}function qo(t,e){return Array.isArray(e)?e.some((e=>("string"==typeof e?e:e.name)===t.name)):e}function Wo(t,e){const{nodeExtensions:n}=Eo(e),r=n.find((e=>e.name===t));if(!r)return!1;const i=So(ko(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function Go(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return!/\S/.test(null!=(r=t.text)?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let r=!0;return t.content.forEach((t=>{!1!==r&&(Go(t,{ignoreWhitespace:n,checkChildren:e})||(r=!1))})),r}return!1}function Vo(t){return t instanceof oe}var Qo=class t{constructor(t){this.position=t}static fromJSON(e){return new t(e.position)}toJSON(){return{position:this.position}}};function Zo(t,e){const n=e.mapping.mapResult(t.position);return{position:new Qo(n.pos),mapResult:n}}function Yo(t){return new Qo(t)}var Xo=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,u=Ls(t,r.schema);if(i)if(o){const t=bo(r,u);n.addStoredMark(u.create({...t,...e}))}else l.forEach((t=>{const i=t.$from.pos,s=t.$to.pos;r.doc.nodesBetween(i,s,((t,r)=>{const o=Math.max(r,i),l=Math.min(r+t.nodeSize,s);t.marks.find((t=>t.type===u))?t.marks.forEach((t=>{u===t.type&&n.addMark(o,l,u.create({...t.attrs,...e}))})):n.addMark(o,l,u.create(e))}))}));return function(t,e,n){var r;const{selection:i}=e;let s=null;if(Rs(i)&&(s=i.$cursor),s){const e=null!=(r=t.storedMarks)?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(e)||!e.some((t=>t.type.excludes(n))))}const{ranges:o}=i;return o.some((({$from:e,$to:r})=>{let i=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,r.pos,((t,e,r)=>{if(i)return!1;if(t.isInline){const e=!r||r.type.allowsMarkType(n),s=!!n.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(n)));i=e&&s}return!i})),i}))}(r,n,u)},tl=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),el=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=ws(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command((({commands:t})=>!!Pe(s,{...o,...e})(n)||t.clearNodes())).command((({state:t})=>Pe(s,{...o,...e})(t,r))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},nl=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=Ns(t,0,n.content.size),i=oe.create(n,r);e.setSelection(i)}return!0},rl=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,l;return"number"==typeof e?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,((e,r)=>{e.isText||n.setNodeMarkup(r,void 0,{...e.attrs,dir:t})})),!0},il=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:r,to:i}="number"==typeof t?{from:t,to:t}:t,s=ie.atStart(n).from,o=ie.atEnd(n).to,l=Ns(r,s,o),u=Ns(i,s,o),h=ie.create(n,l,u);e.setSelection(h)}return!0},sl=t=>({state:e,dispatch:n})=>{const r=ws(t,e.schema);return(s=r,function(t,e){let{$from:n,$to:r}=t.selection,o=n.blockRange(r,(t=>t.childCount>0&&t.firstChild.type==s));if(!o)return!1;let l=o.startIndex;if(0==l)return!1;let u=o.parent,h=u.child(l-1);if(h.type!=s)return!1;if(e){let n=h.lastChild&&h.lastChild.type==u.type,r=i.from(n?s.create():null),l=new a(i.from(s.create(null,i.from(u.type.create(null,r)))),n?3:1,0),c=o.start,f=o.end;e(t.tr.step(new St(c-(n?3:1),f,c,f,l,1,!0)).scrollIntoView())}return!0})(e,n);var s};function ol(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(r)}}var ll=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:u}=s,h=Jo(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(s instanceof oe&&s.node.isBlock)return!(!l.parentOffset||!Pt(o,l.pos)||(r&&(t&&ol(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),0));if(!l.parent.isBlock)return!1;const a=u.parentOffset===u.parent.content.size,c=0===l.depth?void 0:function(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=a&&c?[{type:c,attrs:h}]:void 0,d=Pt(e.doc,e.mapping.map(l.pos),1,f);if(f||d||!Pt(e.doc,e.mapping.map(l.pos),1,c?[{type:c}]:void 0)||(d=!0,f=c?[{type:c,attrs:h}]:void 0),r){if(d&&(s instanceof ie&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,f),c&&!a&&!l.parentOffset&&l.parent.type!==c)){const t=e.mapping.map(l.before()),n=e.doc.resolve(t);l.node(-1).canReplaceWith(n.index(),n.index()+1,c)&&e.setNodeMarkup(e.mapping.map(l.before()),c)}t&&ol(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return d},ul=(t,e={})=>({tr:n,state:r,dispatch:s,editor:o})=>{var l;const u=ws(t,r.schema),{$from:h,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||h.depth<2||!h.sameParent(c))return!1;const d=h.node(-1);if(d.type!==u)return!1;const p=o.extensionManager.attributes;if(0===h.parent.content.size&&h.node(-1).childCount===h.indexAfter(-1)){if(2===h.depth||h.node(-3).type!==u||h.index(-2)!==h.node(-2).childCount-1)return!1;if(s){let t=i.empty;const r=h.index(-1)?1:h.index(-2)?2:3;for(let e=h.depth-r;e>=h.depth-3;e-=1)t=i.from(h.node(e).copy(t));const s=h.indexAfter(-1)<h.node(-2).childCount?1:h.indexAfter(-2)<h.node(-3).childCount?2:3,o={...Jo(p,h.node().type.name,h.node().attrs),...e},c=(null==(l=u.contentMatch.defaultType)?void 0:l.createAndFill(o))||void 0;t=t.append(i.from(u.createAndFill(null,c)||void 0));const f=h.before(h.depth-(r-1));n.replace(f,h.after(-s),new a(t,4-r,0));let d=-1;n.doc.nodesBetween(f,n.doc.content.size,((t,e)=>{if(d>-1)return!1;t.isTextblock&&0===t.content.size&&(d=e+1)})),d>-1&&n.setSelection(ie.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const m=c.pos===h.end()?d.contentMatchAt(0).defaultType:null,g={...Jo(p,d.type.name,d.attrs),...e},w={...Jo(p,h.node().type.name,h.node().attrs),...e};n.delete(h.pos,c.pos);const b=m?[{type:u,attrs:g},{type:m,attrs:w}]:[{type:u,attrs:g}];if(!Pt(n.doc,h.pos,2))return!1;if(s){const{selection:t,storedMarks:e}=r,{splittableMarks:i}=o.extensionManager,l=e||t.$to.parentOffset&&t.$from.marks();if(n.split(h.pos,2,b).scrollIntoView(),!l||!s)return!0;const u=l.filter((t=>i.includes(t.type.name)));n.ensureMarks(u)}return!0},hl=(t,e)=>{const n=yo((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const i=t.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!It(t.doc,n.pos)||(t.join(n.pos),!0)},al=(t,e)=>{const n=yo((t=>t.type===e))(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const i=t.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!It(t.doc,r)||(t.join(r),!0)},cl=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:u,commands:h,can:a})=>{const{extensions:c,splittableMarks:f}=i.extensionManager,d=ws(t,o.schema),p=ws(e,o.schema),{selection:m,storedMarks:g}=o,{$from:w,$to:b}=m,v=w.blockRange(b),y=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const k=yo((t=>Wo(t.type.name,c)))(m),M=0===m.from&&m.to===o.doc.content.size,x=o.doc.content.content,T=1===x.length?x[0]:null,S=M&&T&&Wo(T.type.name,c)?{node:T,pos:0}:null,E=null!=k?k:S,O=!!S;if((k&&v.depth>=1&&v.depth-k.depth<=1||O)&&E){if(E.node.type===d)return M&&O?u().command((({tr:t,dispatch:e})=>{const n=function(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return ie.between(r,i)}(t);return!!n&&(t.setSelection(n),e&&e(t),!0)})).liftListItem(p).run():h.liftListItem(p);if(Wo(E.node.type.name,c)&&d.validContent(E.node.content))return u().command((()=>(s.setNodeMarkup(E.pos,d),!0))).command((()=>hl(s,d))).command((()=>al(s,d))).run()}return n&&y&&l?u().command((()=>{const t=a().wrapInList(d,r),e=y.filter((t=>f.includes(t.type.name)));return s.ensureMarks(e),!!t||h.clearNodes()})).wrapInList(d,r).command((()=>hl(s,d))).command((()=>al(s,d))).run():u().command((()=>!!a().wrapInList(d,r)||h.clearNodes())).wrapInList(d,r).command((()=>hl(s,d))).command((()=>al(s,d))).run()},fl=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Ls(t,r.schema);return Ko(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},dl=(t,e,n={})=>({state:r,commands:i})=>{const s=ws(t,r.schema),o=ws(e,r.schema),l=to(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?i.setNode(o,u):i.setNode(s,{...u,...n})},pl=(t,e={})=>({state:n,commands:r})=>{const i=ws(t,n.schema);return to(n,i,e)?r.lift(i):r.wrapIn(i,e)},ml=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const e=t.tr,n=s.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(s.text){const n=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,n))}else e.delete(s.from,s.to)}return!0}}return!1},gl=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const t=Object.values(r.schema.marks).filter((t=>i||!u.includes(t.name)));l.forEach((n=>{for(const r of t)e.removeMark(n.$from.pos,n.$to.pos,r)}))}return!0},wl=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,u=Ls(t,r.schema),{$from:h,empty:a,ranges:c}=l;if(!i)return!0;if(a&&o){let{from:t,to:e}=l;const r=null==(s=h.marks().find((t=>t.type===u)))?void 0:s.attrs,i=As(h,u,r);i&&(t=i.from,e=i.to),n.removeMark(t,e,u)}else c.forEach((t=>{n.removeMark(t.$from.pos,t.$to.pos,u)}));return n.removeStoredMark(u),!0},bl=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return"number"==typeof t?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,((t,n)=>{if(t.isText)return;const r={...t.attrs};delete r.dir,e.setNodeMarkup(n,void 0,r)})),!0},vl=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=so("string"==typeof t?t:t.name,r.schema);if(!l)return!1;"node"===l&&(s=ws(t,r.schema)),"mark"===l&&(o=Ls(t,r.schema));let u=!1;return n.selection.ranges.forEach((t=>{const l=t.$from.pos,h=t.$to.pos;let a,c,f,d;r.doc.nodesBetween(l,h,n.selection.empty?(t,e)=>{s&&s===t.type&&(u=!0,f=Math.max(e,l),d=Math.min(e+t.nodeSize,h),a=e,c=t)}:(t,r)=>{r<l&&s&&s===t.type&&(u=!0,f=Math.max(r,l),d=Math.min(r+t.nodeSize,h),a=r,c=t),r>=l&&r<=h&&(s&&s===t.type&&(u=!0,i&&n.setNodeMarkup(r,void 0,{...t.attrs,...e})),o&&t.marks.length&&t.marks.forEach((s=>{if(o===s.type&&(u=!0,i)){const i=Math.max(r,l),u=Math.min(r+t.nodeSize,h);n.addMark(i,u,o.create({...s.attrs,...e}))}})))}),c&&(void 0!==a&&i&&n.setNodeMarkup(a,void 0,{...c.attrs,...e}),o&&c.marks.length&&c.marks.forEach((t=>{o===t.type&&i&&n.addMark(f,d,o.create({...t.attrs,...e}))})))})),u},yl=(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&Ct(o,t,e);return!!l&&(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0)}}(ws(t,n.schema),e)(n,r),kl=(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:s,$to:o}=n.selection,l=s.blockRange(o);if(!l)return!1;let u=r?n.tr:null;return!!function(t,e,n,r=null){let s=!1,o=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&0==e.startIndex){if(0==e.$from.index(e.depth-1))return!1;let t=l.resolve(e.start-2);o=new O(t,t,e.depth),e.endIndex<e.parent.childCount&&(e=new O(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let u=Ct(o,n,r,e);return!!u&&(t&&function(t,e,n,r,s){let o=i.empty;for(let t=n.length-1;t>=0;t--)o=i.from(n[t].type.create(n[t].attrs,o));t.step(new St(e.start-(r?2:0),e.end,e.start,e.end,new a(o,0,0),n.length,!0));let l=0;for(let t=0;t<n.length;t++)n[t].type==s&&(l=t+1);let u=n.length-l,h=e.start+n.length-(r?2:0),c=e.parent;for(let n=e.startIndex,r=e.endIndex,i=!0;n<r;n++,i=!1)!i&&Pt(t.doc,h,u)&&(t.split(h,u),h+=2*u),h+=c.child(n).nodeSize}(t,e,u,s,n),!0)}(u,l,t,e)&&(r&&r(u.scrollIntoView()),!0)}}(ws(t,n.schema),e)(n,r),Ml=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter((t=>t!==e)):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},xl=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=null==(e=t.undoable)||e}};function Tl(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(null==(e=h.nodeBefore||h.nodeAfter)?void 0:e.marks.find((t=>t.type.spec.code))))return!1;let a=!1;const c=((t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,((t,e,i,s)=>{var o,l;const u=(null==(l=(o=t.type.spec).toText)?void 0:l.call(o,{node:t,pos:e,parent:i,index:s}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?u:u.slice(0,Math.max(0,r-e))})),n})(h)+s;return o.forEach((t=>{if(a)return;const e=((t,e)=>{if(Ts(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(c,t.find);if(!e)return;const o=u.state.tr,h=ls({state:u.state,transaction:o}),f={from:r-(e[0].length-s.length),to:i},{commands:d,chain:p,can:m}=new us({editor:n,state:h});null!==t.handler({state:h,range:f,match:e,commands:d,chain:p,can:m})&&o.steps.length&&(t.undoable&&o.setMeta(l,{transform:o,from:r,to:i,text:s}),u.dispatch(o),a=!0)})),a}function Sl(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function El(t,e){const n={...t};return Sl(t)&&Sl(e)&&Object.keys(e).forEach((r=>{n[r]=Sl(e[r])&&Sl(t[r])?El(t[r],e[r]):e[r]})),n}var Ol=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...So(ko(this,"addOptions",{name:this.name}))}}get storage(){return{...So(ko(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>El(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Al=class t extends Ol{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const i=r.marks();if(!i.find((t=>(null==t?void 0:t.type.name)===e.name)))return!1;const s=i.find((t=>(null==t?void 0:t.type.name)===e.name));return s&&n.removeStoredMark(s),n.insertText(" ",r.pos),t.view.dispatch(n),!0}return!1}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},Ll=class{constructor(t){this.find=t.find,this.handler=t.handler}};var Cl=null;function $l(t){const{editor:e,rules:n}=t;let r,s=null,o=!1,l=!1,u="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const h=({state:t,from:n,to:i,rule:s,pasteEvt:o})=>{const l=t.tr,h=ls({state:t,transaction:l});if(function(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:u,chain:h,can:a}=new us({editor:e,state:n}),c=[];return n.doc.nodesBetween(r,i,((t,e)=>{var f,d,p,m,g;if((null==(d=null==(f=t.type)?void 0:f.spec)?void 0:d.code)||!(t.isText||t.isTextblock||t.isInline))return;const w=null!=(g=null!=(m=null==(p=t.content)?void 0:p.size)?m:t.nodeSize)?g:0,b=Math.max(r,e),v=Math.min(i,e+w);if(b>=v)return;const y=((t,e,n)=>{if(Ts(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map((e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n})):[]})(t.isText?t.text||"":t.textBetween(b-e,v-e,void 0,""),s.find,o);y.forEach((t=>{if(void 0===t.index)return;const e=b+t.index+1,r=e+t[0].length,i={from:n.tr.mapping.map(e),to:n.tr.mapping.map(r)},f=s.handler({state:n,range:i,match:t,commands:u,chain:h,can:a,pasteEvent:o,dropEvent:l});c.push(f)}))})),c.every((t=>null!==t))}({editor:e,state:h,from:Math.max(n-1,0),to:i.b-1,rule:s,pasteEvent:o,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return u="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map((t=>new ve({view(t){const n=n=>{var r;s=(null==(r=t.dom.parentElement)?void 0:r.contains(n.target))?t.dom.parentElement:null,s&&(Cl=e)},r=()=>{Cl&&(Cl=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(l=s===t.dom.parentElement,r=e,!l){const t=Cl;(null==t?void 0:t.isEditable)&&setTimeout((()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})}),10)}return!1},paste:(t,e)=>{var n;const r=null==(n=e.clipboardData)?void 0:n.getData("text/html");return u=e,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(e,n,r)=>{const s=e[0],a="paste"===s.getMeta("uiEvent")&&!o,c="drop"===s.getMeta("uiEvent")&&!l,f=s.getMeta("applyPasteRules"),d=!!f;if(!a&&!c&&!d)return;if(d){let{text:e}=f;"string"==typeof e||(e=xo(i.from(e),r.schema));const{from:n}=f,s=n+e.length,o=(t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(e=n.clipboardData)||e.setData("text/html",t),n})(e);return h({rule:t,state:r,from:n,to:{b:s},pasteEvt:o})}const p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&m&&p!==m.b?h({rule:t,state:r,from:p,to:m,pasteEvt:u}):void 0}})))}var Rl=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ho(t),this.schema=Po(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce(((t,e)=>{const n=ko(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_o(e.name,this.schema)});return n?{...t,...n()}:t}),{})}get plugins(){const{editor:t}=this,e=Io([...this.extensions].reverse()).flatMap((e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:_o(e.name,this.schema)},r=[],s=ko(e,"addKeyboardShortcuts",n);let o={};if("mark"===e.type&&ko(e,"exitable",n)&&(o.ArrowRight=()=>Al.handleExit({editor:t,mark:e})),s){const e=Object.fromEntries(Object.entries(s()).map((([e,n])=>[e,()=>n({editor:t})])));o={...o,...e}}const l=new ve({props:{handleKeyDown:rs(o)}});r.push(l);const u=ko(e,"addInputRules",n);if(qo(e,t.options.enableInputRules)&&u){const e=u();if(e&&e.length){const n=function(t){const{editor:e,rules:n}=t,r=new ve({state:{init:()=>null,apply(t,s,o){const l=t.getMeta(r);if(l)return l;const u=t.getMeta("applyInputRules");return!!u&&setTimeout((()=>{let{text:t}=u;"string"==typeof t||(t=xo(i.from(t),o.schema));const{from:s}=u;Tl({editor:e,from:s,to:s+t.length,text:t,rules:n,plugin:r})})),t.selectionSet||t.docChanged?null:s}},props:{handleTextInput:(t,i,s,o)=>Tl({editor:e,from:i,to:s,text:o,rules:n,plugin:r}),handleDOMEvents:{compositionend:t=>(setTimeout((()=>{const{$cursor:i}=t.state.selection;i&&Tl({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})})),!1)},handleKeyDown(t,i){if("Enter"!==i.key)return!1;const{$cursor:s}=t.state.selection;return!!s&&Tl({editor:e,from:s.pos,to:s.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:t,rules:e}),s=Array.isArray(n)?n:[n];r.push(...s)}}const h=ko(e,"addPasteRules",n);if(qo(e,t.options.enablePasteRules)&&h){const e=h();if(e&&e.length){const n=$l({editor:t,rules:e});r.push(...n)}}const a=ko(e,"addProseMirrorPlugins",n);if(a){const t=a();r.push(...t)}return r}));return e}get attributes(){return Oo(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Eo(this.extensions);return Object.fromEntries(e.filter((t=>!!ko(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:ws(e.name,this.schema)},i=ko(e,"addNodeView",r);if(!i)return[];const s=i();return s?[e.name,(r,i,o,l,u)=>{const h=Co(r,n);return s({node:r,view:i,getPos:o,decorations:l,innerDecorations:u,editor:t,extension:e,HTMLAttributes:h})}]:[]})))}dispatchTransaction(t){const{editor:e}=this;return Io([...this.extensions].reverse()).reduceRight(((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:_o(n.name,this.schema)},i=ko(n,"dispatchTransaction",r);return i?e=>{i.call(r,{transaction:e,next:t})}:t}),t)}transformPastedHTML(t){const{editor:e}=this;return Io([...this.extensions]).reduce(((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:_o(n.name,this.schema)},i=ko(n,"transformPastedHTML",r);return i?(e,n)=>{const s=t(e,n);return i.call(r,s)}:t}),t||(t=>t))}get markViews(){const{editor:t}=this,{markExtensions:e}=Eo(this.extensions);return Object.fromEntries(e.filter((t=>!!ko(t,"addMarkView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Ls(e.name,this.schema)},i=ko(e,"addMarkView",r);return i?[e.name,(r,s,o)=>{const l=Co(r,n);return i()({mark:r,view:s,inline:o,editor:t,extension:e,HTMLAttributes:l,updateAttributes:e=>{!function(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants(((e,r)=>{const i=s.mapping.map(r),l=s.mapping.map(r)+e.nodeSize;let u=null;if(e.marks.forEach((t=>{if(t!==o)return!1;u=t})),!u)return;let h=!1;if(Object.keys(n).forEach((t=>{n[t]!==u.attrs[t]&&(h=!0)})),h){const e=t.type.create({...t.attrs,...n});s.removeMark(i,l,t.type),s.addMark(i,l,e)}})),s.docChanged&&e.view.dispatch(s)}(r,t,e)}})}]:[]})))}destroy(){this.extensions.forEach((t=>{let e=t;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}})),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map((t=>[t.name,t.storage]))),t.forEach((t=>{var e,n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:_o(t.name,this.schema)};"mark"===t.type&&((null==(e=So(ko(t,"keepOnSplit",r)))||e)&&this.splittableMarks.push(t.name),null==(n=So(ko(t,"clearable",r)))||n||this.nonClearableMarks.push(t.name));const i=ko(t,"onBeforeCreate",r),s=ko(t,"onCreate",r),o=ko(t,"onUpdate",r),l=ko(t,"onSelectionUpdate",r),u=ko(t,"onTransaction",r),h=ko(t,"onFocus",r),a=ko(t,"onBlur",r),c=ko(t,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),a&&this.editor.on("blur",a),c&&this.editor.on("destroy",c)}))}};Rl.resolve=Ho,Rl.sort=Io,Rl.flatten=Mo,ss({},{ClipboardTextSerializer:()=>Pl,Commands:()=>Il,Delete:()=>Hl,Drop:()=>Dl,Editable:()=>jl,FocusEvents:()=>zl,Keymap:()=>Fl,Paste:()=>Ul,Tabindex:()=>_l,TextDirection:()=>Jl,focusEventsPluginKey:()=>Bl});var Nl=class t extends Ol{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},Pl=Nl.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new ve({key:new Me("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=Bo(n),{blockSeparator:o}=this.options,l={...void 0!==o?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort(((t,e)=>t.$from.pos-e.$from.pos)).map((({$from:t,$to:e})=>jo(r,{from:t.pos,to:e.pos},l))).join(null!=o?o:"\n\n")}}})]}}),Il=Nl.create({name:"commands",addCommands:()=>({...hs})}),Hl=Nl.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var n,r,i,s;if(null!=(s=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,t))?s:t.getMeta("y-sync$"))return;const o=vo(t.before,[t,...e]);Fo(o).forEach((e=>{o.mapping.mapResult(e.oldRange.from).deletedAfter&&o.mapping.mapResult(e.oldRange.to).deletedBefore&&o.before.nodesBetween(e.oldRange.from,e.oldRange.to,((n,r)=>{const i=r+n.nodeSize-2,s=e.oldRange.from<=r&&i<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:o.mapping.map(r),newTo:o.mapping.map(i),deletedRange:e.oldRange,newRange:e.newRange,partial:!s,editor:this.editor,transaction:t,combinedTransform:o})}))}));const l=o.mapping;o.steps.forEach(((e,n)=>{var r,i;if(e instanceof kt){const s=l.slice(n).map(e.from,-1),u=l.slice(n).map(e.to),h=l.invert().map(s,-1),a=l.invert().map(u),c=s>0&&(null==(r=o.doc.nodeAt(s-1))?void 0:r.marks.some((t=>t.eq(e.mark)))),f=null==(i=o.doc.nodeAt(u))?void 0:i.marks.some((t=>t.eq(e.mark)));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:h,to:a},newRange:{from:s,to:u},partial:Boolean(f||c),editor:this.editor,transaction:t,combinedTransform:o})}}))};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(s,0):s()}}),Dl=Nl.create({name:"drop",addProseMirrorPlugins(){return[new ve({key:new Me("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),jl=Nl.create({name:"editable",addProseMirrorPlugins(){return[new ve({key:new Me("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Bl=new Me("focusEvents"),zl=Nl.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ve({key:Bl,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Fl=Nl.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:n,doc:r}=e,{empty:i,$anchor:s}=n,{pos:o,parent:l}=s,u=s.parent.isTextblock&&o>0?e.doc.resolve(o-1):s,h=u.parent.type.spec.isolating&&1===u.parent.childCount?s.pos-s.parentOffset===s.pos:te.atStart(r).from===o;return!(!i||!l.type.isTextblock||l.textContent.length||!h||h&&"paragraph"===s.parent.type.name)&&t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":t,"Alt-Backspace":t,"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 Hs()||Ys()?i:r},addProseMirrorPlugins(){return[new ve({key:new Me("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some((t=>t.getMeta("composition"))))return;const r=t.some((t=>t.docChanged))&&!e.doc.eq(n.doc),i=t.some((t=>t.getMeta("preventClearDocument")));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,u=te.atStart(e.doc).from,h=te.atEnd(e.doc).to;if(s||o!==u||l!==h)return;if(!Go(n.doc))return;const a=n.tr,c=ls({state:n,transaction:a}),{commands:f}=new us({editor:this.editor,state:c});return f.clearNodes(),a.steps.length?a:void 0}})]}}),Ul=Nl.create({name:"paste",addProseMirrorPlugins(){return[new ve({key:new Me("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),_l=Nl.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new ve({key:new Me("tabindex"),props:{attributes:()=>{var t;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(t=this.options.value)?t:"0"}:{}}}})]}}),Jl=Nl.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Eo(this.extensions);return[{types:t.filter((t=>"text"!==t.name)).map((t=>t.name)),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const e=t.getAttribute("dir");return!e||"ltr"!==e&&"rtl"!==e&&"auto"!==e?this.options.direction:e},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new ve({key:new Me("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Kl=class t{constructor(t,e,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=r}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 t;return null!=(t=this.actualDepth)?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}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(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new t(n,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 t(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 t(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isInline,o=this.pos+r+(n.isAtom&&!n.isText?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&!s&&l.depth<=this.depth)return;const u=new t(l,this.editor,i,i||s?n:null);i&&(u.actualDepth=this.depth+1),e.push(u)})),e}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,r=this.parent;for(;r&&!n;)r.node.type.name===t&&(Object.keys(e).length>0||(n=r)),r=r.parent;return n}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const i=Object.keys(e);return this.children.forEach((s=>{n&&r.length>0||(s.node.type.name===t&&i.every((t=>e[t]===s.node.attrs[t]))&&r.push(s),n&&r.length>0||(r=r.concat(s.querySelectorAll(t,e,n))))})),r}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}},ql=class extends Ml{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?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:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Zo,createMappablePosition:Yo},this.setOptions(t),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:t,slice:e,moved:n})=>this.options.onDrop(t,e,n))),this.on("paste",(({event:t,slice:e})=>this.options.onPaste(t,e))),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Ps(e,this.options.autofocus);this.editorState=we.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout((()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}unmount(){if(this.editorView){const t=this.editorView.dom;(null==t?void 0:t.editor)&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}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&&"undefined"!=typeof document&&(this.css=function(t,e){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',document.getElementsByTagName("head")[0].appendChild(r),r}(0,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if("state"===e)return this.editorState;if(e in t)return Reflect.get(t,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(t,e){const n=To(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach((t=>{const e="string"==typeof t?`${t}$`:t.key;n=n.filter((t=>!t.key.startsWith(e)))})),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const i=[...this.options.enableCoreExtensions?[jl,Pl.configure({blockSeparator:null==(e=null==(t=this.options.coreExtensionOptions)?void 0:t.clipboardTextSerializer)?void 0:e.blockSeparator}),Il,zl,Fl,_l.configure({value:null==(r=null==(n=this.options.coreExtensionOptions)?void 0:n.tabindex)?void 0:r.value}),Dl,Ul,Hl,Jl.configure({direction:this.options.textDirection})].filter((t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name])):[],...this.options.extensions].filter((t=>["extension","node","mark"].includes(null==t?void 0:t.type)));this.extensionManager=new Rl(i,this)}createCommandManager(){this.commandManager=new us({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=go(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&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((t=>"collaboration"!==t.name)),this.createExtensionManager()}}),t=go(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=this.extensionManager.transformPastedHTML(e.transformPastedHTML);this.editorView=new Fi(t,{...e,attributes:{role:"textbox",...null==e?void 0:e.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.prependClass(),this.injectCSS(),this.view.dom.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach((t=>{var e;return null==(e=this.capturedTransaction)?void 0:e.step(t)})):void(this.capturedTransaction=t);const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast((t=>t.getMeta("focus")||t.getMeta("blur"))),l=null==o?void 0:o.getMeta("focus"),u=null==o?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),t.getMeta("preventUpdate")||!n.some((t=>t.docChanged))||s.doc.eq(e.doc)||this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return zo(this.state,t)}isActive(t,e){return function(t,e,n={}){if(!e)return to(t,null,n)||Ko(t,null,n);const r=so(e,t.schema);return"node"===r?to(t,e,n):"mark"===r&&Ko(t,e,n)}(this.state,"string"==typeof t?t:null,"string"==typeof t?e:t)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xo(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return function(t,e){return jo(t,{from:0,to:t.content.size},e)}(this.state.doc,{blockSeparator:e,textSerializers:{...Bo(this.schema),...n}})}get isEmpty(){return Go(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return null==(e=null==(t=this.editorView)?void 0:t.isDestroyed)||e}$node(t,e){var n;return(null==(n=this.$doc)?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Kl(e,this,!1,t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null)}get $doc(){return this.$pos(0)}};function Wl(t){return new xl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=So(t.getAttributes,void 0,r);if(!1===i||null===i)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const r=l.search(/\S/),u=n.from+l.indexOf(o),h=u+o.length;if(Uo(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>u)).length)return null;h<n.to&&s.delete(h,n.to),u>n.from&&s.delete(n.from+r,u),s.addMark(n.from+r,n.from+r+o.length,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function Gl(t){return new xl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=So(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const u=t.type.create(i);if(r[1]){let t=o+r[0].lastIndexOf(r[1]);t>l?t=l:l=t+r[1].length,s.insertText(r[0][r[0].length-1],o+r[0].length-1),s.replaceWith(t,l,u)}else r[0]&&s.insert(t.type.isInline?o:o-1,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l));s.scrollIntoView()},undoable:t.undoable})}function Vl(t){return new xl({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=So(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Ql(t){return new xl({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=So(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),u=l&&Ct(l,t.type,s);if(!u)return null;if(o.wrap(l,u),t.keepMarks&&t.editor){const{selection:n,storedMarks:r}=e,{splittableMarks:i}=t.editor.extensionManager,s=r||n.$to.parentOffset&&n.$from.marks();if(s){const t=s.filter((t=>i.includes(t.type.name)));o.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";i().updateAttributes(e,s).run()}const h=o.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&It(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}var Zl=class{constructor(t){var e,n,r,i,s,o;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=t=>{this.isResizing&&this.activeHandle&&this.handleResize(t.clientX-this.startX,t.clientY-this.startY)},this.handleTouchMove=t=>{if(!this.isResizing||!this.activeHandle)return;const e=t.touches[0];e&&this.handleResize(e.clientX-this.startX,e.clientY-this.startY)},this.handleMouseUp=()=>{this.isResizing&&(this.onCommit(this.element.offsetWidth,this.element.offsetHeight),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp))},this.handleKeyDown=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(null==(e=t.options)?void 0:e.min)&&(this.minSize={...this.minSize,...t.options.min}),(null==(n=t.options)?void 0:n.max)&&(this.maxSize=t.options.max),(null==(r=null==t?void 0:t.options)?void 0:r.directions)&&(this.directions=t.options.directions),(null==(i=t.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(null==(s=t.options)?void 0:s.className)&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(null==(o=t.options)?void 0:o.createCustomHandle)&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return null!=(t=this.contentElement)?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type===this.node.type&&(this.node=t,!this.onUpdate||this.onUpdate(t,e,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),"top"!==e&&"bottom"!==e||(t.style.left="0",t.style.right="0"),"left"!==e&&"right"!==e||(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach((t=>{let e;e=this.createCustomHandle?this.createCustomHandle(t):this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",(e=>this.handleResizeStart(e,t))),e.addEventListener("touchstart",(e=>this.handleResizeStart(e,t))),this.handleMap.set(t,e),this.wrapper.appendChild(e)}))}removeHandles(){this.handleMap.forEach((t=>t.remove())),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,"touches"in t?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:u&&(i=this.startHeight-n),"right"!==t&&"left"!==t||(r=this.startWidth+(s?e:-e)),"top"!==t&&"bottom"!==t||(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,o;if(!n){let n=Math.max(this.minSize.width,t),s=Math.max(this.minSize.height,e);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(i=this.maxSize)?void 0:i.height)&&(s=Math.min(this.maxSize.height,s)),{width:n,height:s}}let l=t,u=e;return l<this.minSize.width&&(l=this.minSize.width,u=l/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,l=u*this.aspectRatio),(null==(s=this.maxSize)?void 0:s.width)&&l>this.maxSize.width&&(l=this.maxSize.width,u=l/this.aspectRatio),(null==(o=this.maxSize)?void 0:o.height)&&u>this.maxSize.height&&(u=this.maxSize.height,l=u*this.aspectRatio),{width:l,height:u}}applyAspectRatio(t,e,n){return"left"===n||"right"===n?{width:t,height:t/this.aspectRatio}:"top"===n||"bottom"===n?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function Yl(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map((t=>t.trim())).filter(Boolean),i=e.toLowerCase();for(let t=r.length-1;t>=0;t-=1){const e=r[t],n=e.indexOf(":");if(-1!==n&&e.slice(0,n).trim().toLowerCase()===i)return e.slice(n+1).trim()}return null}function Xl(t){if(!(null==t?void 0:t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,(t=>(n.push(t),`__QUOTED_${n.length-1}__`))),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const t=i.map((t=>t.trim().slice(1)));e.class=t.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach((([,t,r])=>{var i;const s=parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10),o=n[s];o&&(e[t]=o.slice(1,-1))}));const o=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 o&&o.split(/\s+/).filter(Boolean).forEach((t=>{t.match(/^[a-zA-Z][\w-]*$/)&&(e[t]=!0)})),e}function tu(t){if(!t||0===Object.keys(t).length)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach((t=>e.push(`.${t}`))),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach((([t,n])=>{"class"!==t&&"id"!==t&&(!0===n?e.push(t):!1!==n&&null!=n&&e.push(`${t}="${String(n)}"`))})),e.join(" ")}function eu(t){const{nodeName:e,name:n,parseAttributes:r=Xl,serializeAttributes:i=tu,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=t,u=n||e;return{parseMarkdown:(t,n)=>{const r={...s,...t.attributes};return n.createNode(e,r,[])},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${u}(?:\\s|$)`,"m"),r=null==(e=t.match(n))?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,i){const s=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=t.match(s);if(!l)return;const h=r(l[1]||"");return o.find((t=>!(t in h)))?void 0:{type:e,raw:l[0],attributes:h}}},renderMarkdown:t=>{const e=(t=>{if(!l)return t;const e={};return l.forEach((n=>{n in t&&(e[n]=t[n])})),e})(t.attrs||{}),n=i(e);return`:::${u}${n?` {${n}}`:""} :::`}}}function nu(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Xl,serializeAttributes:s=tu,defaultAttributes:o={},content:l="block",allowedAttributes:u}=t,h=n||e;return{parseMarkdown:(t,n)=>{let i;if(r){const e=r(t);i="string"==typeof e?[{type:"text",text:e}]:e}else i="block"===l?n.parseChildren(t.tokens||[]):n.parseInline(t.tokens||[]);const s={...o,...t.attributes};return n.createNode(e,s,i)},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${h}`,"m"),r=null==(e=t.match(n))?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,r){var s;const o=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),u=t.match(o);if(!u)return;const[a,c=""]=u,f=i(c);let d=1;const p=a.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,w=t.slice(p);for(g.lastIndex=0;;){const n=g.exec(w);if(null===n)break;const i=n.index,o=n[1];if(!(null==(s=n[2])?void 0:s.endsWith(":::")))if(o)d+=1;else if(d-=1,0===d){const s=w.slice(0,i);m=s.trim();const o=t.slice(0,p+i+n[0].length);let u=[];if(m)if("block"===l)for(u=r.blockTokens(s),u.forEach((t=>{!t.text||t.tokens&&0!==t.tokens.length||(t.tokens=r.inlineTokens(t.text))}));u.length>0;){const t=u[u.length-1];if("paragraph"!==t.type||t.text&&""!==t.text.trim())break;u.pop()}else u=r.inlineTokens(m);return{type:e,raw:o,attributes:f,content:m,tokens:u}}}}},renderMarkdown:(t,e)=>{const n=(t=>{if(!u)return t;const e={};return u.forEach((n=>{n in t&&(e[n]=t[n])})),e})(t.attrs||{}),r=s(n),i=r?` {${r}}`:"",o=e.renderChildren(t.content||[],"\n\n");return`:::${h}${i}\n\n${o}\n\n:::`}}}function ru(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;null!==r;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function iu(t){return Object.entries(t).filter((([,t])=>null!=t)).map((([t,e])=>`${t}="${e}"`)).join(" ")}function su(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=ru,serializeAttributes:s=iu,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:u}=t,h=n||e,a=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(t,n)=>{const i={...o,...t.attributes};if(l)return n.createNode(e,i);const s=r?r(t):t.content||"";return n.createNode(e,i,s?[n.createTextNode(s)]:[])},markdownTokenizer:{name:e,level:"inline",start(t){const e=l?new RegExp(`\\[${a}\\s*[^\\]]*\\]`):new RegExp(`\\[${a}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${a}\\]`),n=t.match(e),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(t,n,r){const s=l?new RegExp(`^\\[${a}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${a}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${a}\\]`),o=t.match(s);if(!o)return;let u="",h="";if(l){const[,t]=o;h=t}else{const[,t,e]=o;h=t,u=e||""}const c=i(h.trim());return{type:e,raw:o[0],content:u.trim(),attributes:c}}},renderMarkdown:t=>{let e="";r?e=r(t):t.content&&t.content.length>0&&(e=t.content.filter((t=>"text"===t.type)).map((t=>t.text)).join(""));const n=(t=>{if(!u)return t;const e={};return u.forEach((n=>{const r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in t){const n=t[r];if(void 0!==i&&n===i)return;e[r]=n}})),e})(t.attrs||{}),i=s(n),o=i?` ${i}`:"";return l?`[${h}${o}]`:`[${h}${o}]${e}[/${h}]`}}}function ou(t,e,n){var r,i,s,o;const l=t.split("\n"),u=[];let h="",a=0;const c=e.baseIndentSize||2;for(;a<l.length;){const t=l[a],f=t.match(e.itemPattern);if(!f){if(u.length>0)break;if(""===t.trim()){a+=1,h=`${h}${t}\n`;continue}return}const d=e.extractItemData(f),{indentLevel:p,mainContent:m}=d;h=`${h}${t}\n`;const g=[m];for(a+=1;a<l.length;){const t=l[a];if(""===t.trim()){const e=l.slice(a+1).findIndex((t=>""!==t.trim()));if(-1===e)break;if(((null==(i=null==(r=l[a+1+e].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>p){g.push(t),h=`${h}${t}\n`,a+=1;continue}break}if(!(((null==(o=null==(s=t.match(/^(\s*)/))?void 0:s[1])?void 0:o.length)||0)>p))break;g.push(t),h=`${h}${t}\n`,a+=1}let w;const b=g.slice(1);if(b.length>0){const t=b.map((t=>t.slice(p+c))).join("\n");t.trim()&&(w=e.customNestedParser?e.customNestedParser(t):n.blockTokens(t))}const v=e.createToken(d,w);u.push(v)}if(0!==u.length)return{items:u,raw:h}}function lu(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i="function"==typeof n?n(r):n,[s,...o]=t.content;let l=`${i}${e.renderChildren([s])}`;return o&&o.length>0&&o.forEach(((t,n)=>{var r,i;const s=null!=(i=null==(r=e.renderChild)?void 0:r.call(e,t,n+1))?i:e.renderChildren([t]);if(null!=s){const n=s.split("\n").map((t=>e.indent(t||""))).join("\n");l+="paragraph"===t.type?`\n\n${n}`:`\n${n}`}})),l}ss({},{createAtomBlockMarkdownSpec:()=>eu,createBlockMarkdownSpec:()=>nu,createInlineMarkdownSpec:()=>su,parseAttributes:()=>Xl,parseIndentedBlocks:()=>ou,renderNestedMarkdownContent:()=>lu,serializeAttributes:()=>tu});var uu=class t extends Ol{constructor(){super(...arguments),this.type="node"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}};function hu(t){return new Ll({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=So(t.getAttributes,void 0,r,i);if(!1===s||null===s)return null;const{tr:o}=e,l=r[r.length-1],u=r[0];let h=n.to;if(l){const i=u.search(/\S/),a=n.from+u.indexOf(l),c=a+l.length;if(Uo(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>a)).length)return null;c<n.to&&o.delete(c,n.to),a>n.from&&o.delete(n.from+i,a),h=n.from+i+l.length,o.addMark(n.from+i,h,t.type.create(s||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}var au=(t,e)=>{if("slot"===t)return 0;if(t instanceof Function)return t(e);const{children:n,...r}=null!=e?e:{};if("svg"===t)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},cu=/^\s*>\s$/,fu=uu.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return au("blockquote",{...Lo(this.options.HTMLAttributes,t),children:au("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=null!=(n=e.parseBlockChildren)?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(((t,r)=>{var i,s;const o=(null!=(s=null==(i=e.renderChild)?void 0:i.call(e,t,r))?s:e.renderChildren([t])).split("\n").map((t=>""===t.trim()?">":`> ${t}`));n.push(o.join("\n"))})),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ql({find:cu,type:this.type})]}}),du=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,pu=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,mu=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,gu=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,wu=Al.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return au("strong",{...Lo(this.options.HTMLAttributes,t),children:au("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Wl({find:du,type:this.type}),Wl({find:mu,type:this.type})]},addPasteRules(){return[hu({find:pu,type:this.type}),hu({find:gu,type:this.type})]}}),bu=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return e?e.index>0&&"`"===t[e.index-1]?null:{index:e.index,text:e[0],replaceWith:e[1]}:null},vu=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;null!==(r=e.exec(t));)r.index>0&&"`"===t[r.index-1]||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},yu=Al.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",Lo(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Wl({find:bu,type:this.type})]},addPasteRules(){return[hu({find:vu,type:this.type})]}}),ku=/^```([a-z]+)?[\s\n]$/,Mu=/^~~~([a-z]+)?[\s\n]$/,xu=uu.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;return[...(null==(e=t.firstElementChild)?void 0:e.classList)||[]].filter((t=>t.startsWith(n))).map((t=>t.replace(n,"")))[0]||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:t,HTMLAttributes:e}){return["pre",Lo(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return!1===(null==(n=t.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=t.raw)?void 0:r.startsWith("~~~"))&&"indented"!==t.codeBlockStyle?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=(null==(n=t.attrs)?void 0:n.language)||"";return r=t.content?[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join("\n"):`\`\`\`${i}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection;return!(!t||e.parent.type.name!==this.name)&&!(1!==e.pos&&e.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=null!=(e=this.options.tabSize)?e:4,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command((({tr:t})=>{const{from:e,to:n}=i,s=r.doc.textBetween(e,n,"\n","\n").split("\n").map((t=>l+t)).join("\n");return t.replaceWith(e,n,r.schema.text(s)),!0}))},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=null!=(e=this.options.tabSize)?e:4,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type===this.type&&t.commands.command(o?({tr:t})=>{var e;const{pos:i}=s,o=s.start(),l=s.end(),u=r.doc.textBetween(o,l,"\n","\n").split("\n");let h=0,a=0;const c=i-o;for(let t=0;t<u.length;t+=1){if(a+u[t].length>=c){h=t;break}a+=u[t].length+1}const f=(null==(e=u[h].match(/^ */))?void 0:e[0])||"",d=Math.min(f.length,n);if(0===d)return!0;let p=o;for(let t=0;t<h;t+=1)p+=u[t].length+1;return t.delete(p,p+d),i-p<=d&&t.setSelection(ie.create(t.doc,p)),!0}:({tr:t})=>{const{from:e,to:s}=i,o=r.doc.textBetween(e,s,"\n","\n").split("\n").map((t=>{var e;const r=(null==(e=t.match(/^ */))?void 0:e[0])||"",i=Math.min(r.length,n);return t.slice(i)})).join("\n");return t.replaceWith(e,s,r.schema.text(o)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith("\n\n");return!(!s||!o)&&t.chain().command((({tr:t})=>(t.delete(r.pos-2,r.pos),!0))).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type)return!1;if(i.parentOffset!==i.parent.nodeSize-2)return!1;const o=i.after();return void 0!==o&&(r.nodeAt(o)?t.commands.command((({tr:t})=>(t.setSelection(te.near(r.resolve(o))),!0))):t.commands.exitCode())}}},addInputRules(){return[Vl({find:ku,type:this.type,getAttributes:t=>({language:t[1]})}),Vl({find:Mu,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ve({key:new Me("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=null==i?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,u=l.text(n.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:s},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(ie.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Tu=uu.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n\n"):""}),Su=uu.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",Lo(this.options.HTMLAttributes,t)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command((()=>{const{selection:t,storedMarks:i}=n;if(t.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:o}=r.extensionManager,l=i||t.$to.parentOffset&&t.$from.marks();return e().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{if(e&&l&&s){const e=l.filter((t=>o.includes(t.type.name)));t.ensureMarks(e)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Eu=uu.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Lo(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(null==(n=t.attrs)?void 0:n.level)?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>Vl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}})))}}),Ou=uu.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",Lo(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!function(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof oe){const t=r.index();return r.parent.canReplaceWith(t,t+1,e)}let i=r.depth;for(;i>=0;){const t=r.index(i);if(r.node(i).contentMatchAt(t).matchType(e))return!0;i-=1}return!1}(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return Vo(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command((({state:t,tr:e,dispatch:n})=>{if(n){const{$to:n}=e.selection,r=n.end();if(n.nodeAfter)e.setSelection(n.nodeAfter.isTextblock?ie.create(e.doc,n.pos+1):n.nodeAfter.isBlock?oe.create(e.doc,n.pos):ie.create(e.doc,n.pos));else{const i=t.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,s=null==i?void 0:i.create();s&&(e.insert(r,s),e.setSelection(ie.create(e.doc,r+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[Gl({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Au=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Lu=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Cu=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,$u=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ru=Al.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Lo(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Wl({find:Au,type:this.type}),Wl({find:Cu,type:this.type})]},addPasteRules(){return[hu({find:Lu,type:this.type}),hu({find:$u,type:this.type})]}});const Nu="numeric",Pu="ascii",Iu="alpha",Hu="asciinumeric",Du="alphanumeric",ju="domain",Bu="emoji",zu="scheme",Fu="slashscheme",Uu="whitespace";function _u(t,e){return t in e||(e[t]=[]),e[t]}function Ju(t,e,n){e[Nu]&&(e[Hu]=!0,e[Du]=!0),e[Pu]&&(e[Hu]=!0,e[Iu]=!0),e[Hu]&&(e[Du]=!0),e[Iu]&&(e[Du]=!0),e[Du]&&(e[ju]=!0),e[Bu]&&(e[ju]=!0);for(const r in e){const e=_u(r,n);e.indexOf(t)<0&&e.push(t)}}function Ku(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ku.groups={},Ku.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let n=0;n<e.jr.length;n++){const r=e.jr[n][1];if(r&&e.jr[n][0].test(t))return r}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){let i;return r=r||Ku.groups,e&&e.j?i=e:(i=new Ku(e),n&&r&&Ju(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let e=0;e<s-1;e++)i=i.tt(t[e]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||Ku.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new Ku,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new Ku,s){if(r)if(o.t&&"string"==typeof o.t){const t=Object.assign(function(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}(o.t,r),n);Ju(s,t,r)}else n&&Ju(s,n,r);o.t=s}return i.j[t]=o,o}};const qu=(t,e,n,r,i)=>t.ta(e,n,r,i),Wu=(t,e,n,r,i)=>t.tr(e,n,r,i),Gu=(t,e,n,r,i)=>t.ts(e,n,r,i),Vu=(t,e,n,r,i)=>t.tt(e,n,r,i),Qu="WORD",Zu="UWORD",Yu="ASCIINUMERICAL",Xu="ALPHANUMERICAL",th="LOCALHOST",eh="TLD",nh="UTLD",rh="SCHEME",ih="SLASH_SCHEME",sh="NUM",oh="WS",lh="NL",uh="OPENBRACE",hh="CLOSEBRACE",ah="OPENBRACKET",ch="CLOSEBRACKET",fh="OPENPAREN",dh="CLOSEPAREN",ph="OPENANGLEBRACKET",mh="CLOSEANGLEBRACKET",gh="FULLWIDTHLEFTPAREN",wh="FULLWIDTHRIGHTPAREN",bh="LEFTCORNERBRACKET",vh="RIGHTCORNERBRACKET",yh="LEFTWHITECORNERBRACKET",kh="RIGHTWHITECORNERBRACKET",Mh="FULLWIDTHLESSTHAN",xh="FULLWIDTHGREATERTHAN",Th="AMPERSAND",Sh="APOSTROPHE",Eh="ASTERISK",Oh="AT",Ah="BACKSLASH",Lh="BACKTICK",Ch="CARET",$h="COLON",Rh="COMMA",Nh="DOLLAR",Ph="DOT",Ih="EQUALS",Hh="EXCLAMATION",Dh="HYPHEN",jh="PERCENT",Bh="PIPE",zh="PLUS",Fh="POUND",Uh="QUERY",_h="QUOTE",Jh="FULLWIDTHMIDDLEDOT",Kh="SEMI",qh="SLASH",Wh="TILDE",Gh="UNDERSCORE",Vh="EMOJI",Qh="SYM";var Zh=Object.freeze({__proto__:null,ALPHANUMERICAL:Xu,AMPERSAND:Th,APOSTROPHE:Sh,ASCIINUMERICAL:Yu,ASTERISK:Eh,AT:Oh,BACKSLASH:Ah,BACKTICK:Lh,CARET:Ch,CLOSEANGLEBRACKET:mh,CLOSEBRACE:hh,CLOSEBRACKET:ch,CLOSEPAREN:dh,COLON:$h,COMMA:Rh,DOLLAR:Nh,DOT:Ph,EMOJI:Vh,EQUALS:Ih,EXCLAMATION:Hh,FULLWIDTHGREATERTHAN:xh,FULLWIDTHLEFTPAREN:gh,FULLWIDTHLESSTHAN:Mh,FULLWIDTHMIDDLEDOT:Jh,FULLWIDTHRIGHTPAREN:wh,HYPHEN:Dh,LEFTCORNERBRACKET:bh,LEFTWHITECORNERBRACKET:yh,LOCALHOST:th,NL:lh,NUM:sh,OPENANGLEBRACKET:ph,OPENBRACE:uh,OPENBRACKET:ah,OPENPAREN:fh,PERCENT:jh,PIPE:Bh,PLUS:zh,POUND:Fh,QUERY:Uh,QUOTE:_h,RIGHTCORNERBRACKET:vh,RIGHTWHITECORNERBRACKET:kh,SCHEME:rh,SEMI:Kh,SLASH:qh,SLASH_SCHEME:ih,SYM:Qh,TILDE:Wh,TLD:eh,UNDERSCORE:Gh,UTLD:nh,UWORD:Zu,WORD:Qu,WS:oh});const Yh=/[a-z]/,Xh=/\p{L}/u,ta=/\p{Emoji}/u,ea=/\d/,na=/\s/;let ra=null,ia=null;function sa(t,e){const n=function(t){const e=[],n=t.length;let r=0;for(;r<n;){let i,s=t.charCodeAt(r),o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}(e.replace(/[A-Z]/g,(t=>t.toLowerCase()))),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,u=null,h=0,a=null,c=-1,f=-1;for(;o<r&&(u=l.go(n[o]));)l=u,l.accepts()?(c=0,f=0,a=l):c>=0&&(c+=n[o].length,f++),h+=n[o].length,s+=n[o].length,o++;s-=c,o-=f,h-=c,i.push({t:a.t,v:e.slice(s-h,s),s:s-h,e:s})}return i}function oa(t,e,n,r,i){let s;const o=e.length;for(let n=0;n<o-1;n++){const o=e[n];t.j[o]?s=t.j[o]:(s=new Ku(r),s.jr=i.slice(),t.j[o]=s),t=s}return s=new Ku(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function la(t){const e=[],n=[];let r=0;for(;r<t.length;){let i=0;for(;"0123456789".indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let e=parseInt(t.substring(r,r+i),10);e>0;e--)n.pop();r+=i}else n.push(t[r]),r++}return e}const ua={defaultProtocol:"http",events:null,format:aa,formatHref:aa,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ha(t,e=null){let n=Object.assign({},ua);t&&(n=Object.assign(n,t instanceof ha?t.o:t));const r=n.ignoreTags,i=[];for(let t=0;t<r.length;t++)i.push(r[t].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}function aa(t){return t}function ca(t,e){this.t="token",this.v=t,this.tk=e}function fa(t,e){class n extends ca{constructor(e,n){super(e,n),this.t=t}}for(const t in e)n.prototype[t]=e[t];return n.t=t,n}ha.prototype={o:ua,ignoreTags:[],defaultRender:t=>t,check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=null!=e;let i=this.o[t];return i?("object"==typeof i?(i=n.t in i?i[n.t]:ua[t],"function"==typeof i&&r&&(i=i(e,n))):"function"==typeof i&&r&&(i=i(e,n.t,n)),i):i},getObj(t,e,n){let r=this.o[t];return"function"==typeof r&&null!=e&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},ca.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ua.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),a=t.getObj("attributes",n,e),c=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),u&&(o.target=u),h&&(o.rel=h),a&&Object.assign(o,a),{tagName:i,attributes:o,content:s,eventListeners:c}}};const da=fa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),pa=fa("text"),ma=fa("nl"),ga=fa("url",{isLink:!0,toHref(t=ua.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==th&&t[1].t===$h}}),wa=t=>new Ku(t);function ba(t,e,n){return new t(e.slice(n[0].s,n[n.length-1].e),n)}const va="undefined"!=typeof console&&console&&console.warn||(()=>{}),ya={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ka(t,e=!1){if(ya.initialized&&va(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');ya.customSchemes.push([t,e])}function Ma(t){return ya.initialized||function(){ya.scanner=function(t=[]){const e={};Ku.groups=e;const n=new Ku;null==ra&&(ra=la("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==ia&&(ia=la("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Vu(n,"'",Sh),Vu(n,"{",uh),Vu(n,"}",hh),Vu(n,"[",ah),Vu(n,"]",ch),Vu(n,"(",fh),Vu(n,")",dh),Vu(n,"<",ph),Vu(n,">",mh),Vu(n,"(",gh),Vu(n,")",wh),Vu(n,"「",bh),Vu(n,"」",vh),Vu(n,"『",yh),Vu(n,"』",kh),Vu(n,"<",Mh),Vu(n,">",xh),Vu(n,"&",Th),Vu(n,"*",Eh),Vu(n,"@",Oh),Vu(n,"`",Lh),Vu(n,"^",Ch),Vu(n,":",$h),Vu(n,",",Rh),Vu(n,"$",Nh),Vu(n,".",Ph),Vu(n,"=",Ih),Vu(n,"!",Hh),Vu(n,"-",Dh),Vu(n,"%",jh),Vu(n,"|",Bh),Vu(n,"+",zh),Vu(n,"#",Fh),Vu(n,"?",Uh),Vu(n,'"',_h),Vu(n,"/",qh),Vu(n,";",Kh),Vu(n,"~",Wh),Vu(n,"_",Gh),Vu(n,"\\",Ah),Vu(n,"・",Jh);const r=Wu(n,ea,sh,{[Nu]:!0});Wu(r,ea,r);const i=Wu(r,Yh,Yu,{[Hu]:!0}),s=Wu(r,Xh,Xu,{[Du]:!0}),o=Wu(n,Yh,Qu,{[Pu]:!0});Wu(o,ea,i),Wu(o,Yh,o),Wu(i,ea,i),Wu(i,Yh,i);const l=Wu(n,Xh,Zu,{[Iu]:!0});Wu(l,Yh),Wu(l,ea,s),Wu(l,Xh,l),Wu(s,ea,s),Wu(s,Yh),Wu(s,Xh,s);const u=Vu(n,"\n",lh,{[Uu]:!0}),h=Vu(n,"\r",oh,{[Uu]:!0}),a=Wu(n,na,oh,{[Uu]:!0});Vu(n,"",a),Vu(h,"\n",u),Vu(h,"",a),Wu(h,na,a),Vu(a,"\r"),Vu(a,"\n"),Wu(a,na,a),Vu(a,"",a);const c=Wu(n,ta,Vh,{[Bu]:!0});Vu(c,"#"),Wu(c,ta,c),Vu(c,"️",c);const f=Vu(c,"");Vu(f,"#"),Wu(f,ta,c);const d=[[Yh,o],[ea,i]],p=[[Yh,null],[Xh,l],[ea,s]];for(let t=0;t<ra.length;t++)oa(n,ra[t],eh,Qu,d);for(let t=0;t<ia.length;t++)oa(n,ia[t],nh,Zu,p);Ju(eh,{tld:!0,ascii:!0},e),Ju(nh,{utld:!0,alpha:!0},e),oa(n,"file",rh,Qu,d),oa(n,"mailto",rh,Qu,d),oa(n,"http",ih,Qu,d),oa(n,"https",ih,Qu,d),oa(n,"ftp",ih,Qu,d),oa(n,"ftps",ih,Qu,d),Ju(rh,{scheme:!0,ascii:!0},e),Ju(ih,{slashscheme:!0,ascii:!0},e),t=t.sort(((t,e)=>t[0]>e[0]?1:-1));for(let e=0;e<t.length;e++){const r=t[e][0],i=t[e][1]?{[zu]:!0}:{[Fu]:!0};r.indexOf("-")>=0?i[ju]=!0:Yh.test(r)?ea.test(r)?i[Hu]=!0:i[Pu]=!0:i[Nu]=!0,Gu(n,r,r,i)}return Gu(n,"localhost",th,{ascii:!0}),n.jd=new Ku(Qh),{start:n,tokens:Object.assign({groups:e},Zh)}}(ya.customSchemes);for(let t=0;t<ya.tokenQueue.length;t++)ya.tokenQueue[t][1]({scanner:ya.scanner});ya.parser=function({groups:t}){const e=t.domain.concat([Th,Eh,Oh,Ah,Lh,Ch,Nh,Ih,Dh,sh,jh,Bh,zh,Fh,qh,Qh,Wh,Gh]),n=[Sh,$h,Rh,Ph,Hh,jh,Uh,_h,Kh,ph,mh,uh,hh,ch,ah,fh,dh,gh,wh,bh,vh,yh,kh,Mh,xh],r=[Th,Sh,Eh,Ah,Lh,Ch,Nh,Ih,Dh,uh,hh,jh,Bh,zh,Fh,Uh,qh,Qh,Wh,Gh],i=wa(),s=Vu(i,Wh);qu(s,r,s),qu(s,t.domain,s);const o=wa(),l=wa(),u=wa();qu(i,t.domain,o),qu(i,t.scheme,l),qu(i,t.slashscheme,u),qu(o,r,s),qu(o,t.domain,o);const h=Vu(o,Oh);Vu(s,Oh,h),Vu(l,Oh,h),Vu(u,Oh,h);const a=Vu(s,Ph);qu(a,r,s),qu(a,t.domain,s);const c=wa();qu(h,t.domain,c),qu(c,t.domain,c);const f=Vu(c,Ph);qu(f,t.domain,c);const d=wa(da);qu(f,t.tld,d),qu(f,t.utld,d),Vu(h,th,d);const p=Vu(c,Dh);Vu(p,Dh,p),qu(p,t.domain,c),qu(d,t.domain,c),Vu(d,Ph,f),Vu(d,Dh,p);const m=Vu(o,Dh),g=Vu(o,Ph);Vu(m,Dh,m),qu(m,t.domain,o),qu(g,r,s),qu(g,t.domain,o);const w=wa(ga);qu(g,t.tld,w),qu(g,t.utld,w),qu(w,t.domain,o),qu(w,r,s),Vu(w,Ph,g),Vu(w,Dh,m),Vu(w,Oh,h);const b=Vu(w,$h),v=wa(ga);qu(b,t.numeric,v);const y=wa(ga),k=wa();qu(y,e,y),qu(y,n,k),qu(k,e,y),qu(k,n,k),Vu(w,qh,y),Vu(v,qh,y);const M=Vu(l,$h),x=Vu(u,$h),T=Vu(x,qh),S=Vu(T,qh);qu(l,t.domain,o),Vu(l,Ph,g),Vu(l,Dh,m),qu(u,t.domain,o),Vu(u,Ph,g),Vu(u,Dh,m),qu(M,t.domain,y),Vu(M,qh,y),Vu(M,Uh,y),qu(S,t.domain,y),qu(S,e,y),Vu(S,qh,y);const E=[[uh,hh],[ah,ch],[fh,dh],[ph,mh],[gh,wh],[bh,vh],[yh,kh],[Mh,xh]];for(let t=0;t<E.length;t++){const[r,i]=E[t],s=Vu(y,r);Vu(k,r,s);const o=wa(ga);qu(s,e,o);const l=wa();qu(s,n,l),Vu(s,i,y),qu(o,e,o),qu(o,n,l),qu(l,e,o),qu(l,n,l),Vu(o,i,y),Vu(l,i,y)}return Vu(i,th,w),Vu(i,lh,ma),{start:i,tokens:Zh}}(ya.scanner.tokens);for(let t=0;t<ya.pluginQueue.length;t++)ya.pluginQueue[t][1]({scanner:ya.scanner,parser:ya.parser});ya.initialized=!0}(),function(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,u=null,h=null,a=0,c=null,f=-1;for(;i<r&&!(u=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(h=u||l.go(n[i].t));)u=null,l=h,l.accepts()?(f=0,c=l):f>=0&&f++,i++,a++;if(f<0)i-=a,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(ba(pa,e,o)),o=[]),i-=f,a-=f;const t=c.t,r=n.slice(i-a,i);s.push(ba(t,e,r))}}return o.length>0&&s.push(ba(pa,e,o)),s}(ya.parser.start,t,sa(ya.scanner.start,t))}function xa(t,e=null,n=null){if(e&&"object"==typeof e){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ha(n),i=Ma(t),s=[];for(let t=0;t<i.length;t++){const n=i[t];!n.isLink||e&&n.t!==e||!r.check(n)||s.push(n.toFormattedObject(r))}return s}Ma.scan=sa;var Ta="[\0- -\u2029 ]",Sa=new RegExp(Ta),Ea=new RegExp(`${Ta}$`),Oa=new RegExp(Ta,"g");function Aa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach((t=>{const e="string"==typeof t?t:t.scheme;e&&n.push(e)})),!t||t.replace(Oa,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var La=Al.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach((t=>{"string"!=typeof t?ka(t.scheme,t.optionalSlashes):ka(t)}))},onDestroy(){Ku.groups={},ya.scanner=null,ya.parser=null,ya.tokenQueue=[],ya.pluginQueue=[],ya.customSchemes=[],ya.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Aa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!(!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Aa(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:t=>!!Aa(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Lo(this.options.HTMLAttributes,t),0]:["a",Lo(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=null!=(r=null==(n=t.attrs)?void 0:n.href)?r:"",l=null!=(s=null==(i=t.attrs)?void 0:i.title)?s:"",u=e.renderChildren(t);return l?`[${u}](${o} "${l}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return!!this.options.isAllowedUri(n,{defaultValidate:t=>!!Aa(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&e().setMark(this.name,t).setMeta("preventAutolink",!0).run()},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:t=>!!Aa(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hu({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=xa(t).filter((t=>t.isLink&&this.options.isAllowedUri(t.value,{defaultValidate:t=>!!Aa(t,n),protocols:n,defaultProtocol:r})));i.length&&i.forEach((t=>{this.options.shouldAutoLink(t.value)&&e.push({text:t.value,data:{href:t.href},index:t.start})}))}return e},type:this.type,getAttributes:t=>{var e;return{href:null==(e=t.data)?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;var r;return this.options.autolink&&t.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:t=>this.options.isAllowedUri(t,{defaultValidate:t=>!!Aa(t,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new ve({key:new Me("autolink"),appendTransaction:(t,e,n)=>{const i=t.some((t=>t.docChanged))&&!e.doc.eq(n.doc),s=t.some((t=>t.getMeta("preventAutolink")));if(!i||s)return;const{tr:o}=n;return Fo(vo(e.doc,[...t])).forEach((({newRange:t})=>{const e=function(t,e){const n=[];return t.nodesBetween(e.from,e.to,((t,e)=>{(t=>t.isTextblock)(t)&&n.push({node:t,pos:e})})),n}(n.doc,t);let i,s;if(e.length>1)i=e[0],s=n.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0," ");else if(e.length){const r=n.doc.textBetween(t.from,t.to," "," ");if(!Ea.test(r))return;i=e[0],s=n.doc.textBetween(i.pos,t.to,void 0," ")}if(i&&s){const t=s.split(Sa).filter(Boolean);if(t.length<=0)return!1;const e=t[t.length-1],u=i.pos+s.lastIndexOf(e);if(!e)return!1;const h=Ma(e).map((t=>t.toObject(r.defaultProtocol)));if(!(1===(l=h).length?l[0].isLink:3===l.length&&l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;h.filter((t=>t.isLink)).map((t=>({...t,from:u+t.start+1,to:u+t.end+1}))).filter((t=>!n.schema.marks.code||!n.doc.rangeHasMark(t.from,t.to,n.schema.marks.code))).filter((t=>r.validate(t.value))).filter((t=>r.shouldAutoLink(t.value))).forEach((t=>{Uo(t.from,t.to,n.doc).some((t=>t.mark.type===r.type))||o.addMark(t.from,t.to,r.type.create({href:t.href}))}))}var l})),o.steps.length?o:void 0}}))),t.push(function(t){return new ve({key:new Me("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(0!==r.button)return!1;if(!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const e=r.target;if(!e)return!1;const n=t.editor.view.dom;o=e.closest("a"),o&&!n.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const n=zo(e.state,t.type.name),r=null!=(i=o.href)?i:n.href,u=null!=(s=o.target)?s:n.target;r&&(window.open(r,u),l=!0)}return l}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(function(t){return new ve({key:new Me("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let u="";r.content.forEach((t=>{u+=t.textContent}));const h=xa(u,{defaultProtocol:t.defaultProtocol}).find((t=>t.isLink&&t.value===u));return!(!u||!h||void 0!==i&&!i(h.value))&&t.editor.commands.setMark(t.type,{href:h.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Ca=Object.defineProperty,$a="textStyle",Ra=/^\s*([-+*])\s$/,Na=uu.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",Lo(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>"list"!==t.type||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes($a)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ql({find:Ra,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ql({find:Ra,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes($a),editor:this.editor})),[t]}}),Pa=(t,e)=>Nl.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>((t,e,n)=>((t,e,n,r)=>{const s=((t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock)return null;if(i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let t=i.depth;t>0;t-=1)if(i.node(t).type.name===e){s=t;break}if(s<0)return null;const o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;const u=o.child(l+1);if(!n.includes(u.type.name))return null;const h=t.schema.nodes[e];let a=!1;if(u.forEach((t=>{t.type===h&&t.childCount>1&&(a=!0)})),!a)return null;const c=t.doc.resolve(i.after()).nodeAfter;if(!c||!n.includes(c.type.name))return null;const f=[];return c.forEach((t=>{f.push(t)})),0===f.length?null:{listItemDepth:s,nestedList:c,nestedListPos:i.after(),insertPos:i.after(s),items:f}})(t,n,r);if(!s)return!1;const{selection:o}=t,{nestedList:l,nestedListPos:u,insertPos:h,items:a}=s,c=t.tr;c.delete(u,u+l.nodeSize);const f=c.mapping.map(h);return c.insert(f,i.from(a)),c.setSelection(o.map(c.doc,c.mapping)),e&&e(c),!0})(t.state,t.view.dispatch,e,n))(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}});function Ia(t,e){return e.parseInline(e.tokenizeInline?e.tokenizeInline(t):[{type:"text",raw:t,text:t}])}var Ha=uu.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",Lo(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if("list_item"!==t.type)return[];const r=null!=(n=e.parseBlockChildren)?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(function(t){var e,n;const r=null==(e=t.tokens)?void 0:e[0];return Boolean(t.text&&1===(null==(n=t.tokens)?void 0:n.length)&&"list"===(null==r?void 0:r.type)&&r.ordered&&r.raw===t.text)}(t))return{type:"listItem",content:[{type:"paragraph",content:Ia(t.text||"",e)}]};if(t.tokens.some((t=>"paragraph"===t.type)))i=r(t.tokens);else{const n=t.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(n.tokens)}],t.tokens.length>1){const e=r(t.tokens.slice(1));i.push(...e)}}else i=r(t.tokens)}}return 0===i.length&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>lu(t,e,(t=>{var e,n;return"bulletList"===t.parentType?"- ":"orderedList"===t.parentType?`${((null==(n=null==(e=t.meta)?void 0:e.parentAttrs)?void 0:n.start)||1)+t.index}. `:"- "}),n),addExtensions(){return[Pa(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((t,e)=>{for(var n in e)Ca(t,n,{get:e[n],enumerable:!0})})({},{findListItemPos:()=>Da,getNextListDepth:()=>ja,handleBackspace:()=>za,handleDelete:()=>_a,hasListBefore:()=>Ba,hasListItemAfter:()=>Ja,hasListItemBefore:()=>Ka,listItemHasSubList:()=>qa,nextListIsDeeper:()=>Fa,nextListIsHigher:()=>Ua});var Da=(t,e)=>{const{$from:n}=e.selection,r=ws(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&null===l;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return null===l?null:{$pos:e.doc.resolve(o),depth:l}},ja=(t,e)=>{const n=Da(t,e);if(!n)return!1;const[,r]=((t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&null===o;){const t=i.node(s);(null==t?void 0:t.type.name)===e?o=t:s-=1}return[o,s]})(e,t,n.$pos.pos+4);return r},Ba=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},za=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!to(t.state,e)&&Ba(t.state,e,n)){const{$anchor:n}=t.state.selection,r=t.state.doc.resolve(n.before()-1),i=[];r.node().descendants(((t,n)=>{t.type.name===e&&i.push({node:t,pos:n})}));const s=i.at(-1);if(!s)return!1;const o=t.state.doc.resolve(r.start()+s.pos+1);return t.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!!to(t.state,e)&&!!(t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)})(t.state)&&t.chain().liftListItem(e).run()},Fa=(t,e)=>{const n=ja(t,e),r=Da(t,e);return!(!r||!n)&&n>r.depth},Ua=(t,e)=>{const n=ja(t,e),r=Da(t,e);return!(!r||!n)&&n<r.depth},_a=(t,e)=>{if(!to(t.state,e))return!1;if(!((t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const n=yo((t=>t.type.name===e))(t.selection);if(!n)return!1;const r=t.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(Fa(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Ua(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward())},Ja=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return i.index()!==i.parent.childCount-1&&(null==(n=i.nodeAfter)?void 0:n.type.name)===t},Ka=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return 0!==i.index()&&(null==(n=i.nodeBefore)?void 0:n.type.name)===t},qa=(t,e,n)=>{if(!n)return!1;const r=ws(t,e.schema);let i=!1;return n.descendants((t=>{t.type===r&&(i=!0)})),i},Wa=Nl.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==t.state.schema.nodes[n]&&_a(t,n)&&(e=!0)})),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==t.state.schema.nodes[n]&&_a(t,n)&&(e=!0)})),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==t.state.schema.nodes[n]&&za(t,n,r)&&(e=!0)})),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==t.state.schema.nodes[n]&&za(t,n,r)&&(e=!0)})),e}}}}),Ga=/^(\s*)(\d+)\.\s+(.*)$/,Va=/^\s/;function Qa(t){const e=[],n=[];let r=!1;return t.forEach((t=>{if(!r)return""===t.trim()||e.length>0&&function(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}(t)?(r=!0,void n.push(t)):void e.push(t);n.push(t)})),{paragraphLines:e,blockLines:n}}function Za(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:l}=Qa(s.contentLines),u=o.join("\n").trim(),h=[];u&&h.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const a=l.join("\n").trim();if(a){const t=n.blockTokens(a);h.push(...t)}let c=i+1;const f=[];for(;c<t.length&&t[c].indent>e;)f.push(t[c]),c+=1;if(f.length>0){const t=Math.min(...f.map((t=>t.indent))),e=Za(f,t,n);h.push({type:"list",ordered:!0,start:f[0].number,items:e,raw:f.map((t=>t.raw)).join("\n")})}r.push({type:"list_item",raw:s.raw,tokens:h}),i=c}else i+=1}return r}var Ya="textStyle",Xa=/^(\d+)\.\s$/,tc=uu.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return 1===e?["ol",Lo(this.options.HTMLAttributes,n),0]:["ol",Lo(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if("list"!==t.type||!t.ordered)return[];const n=t.start||1,r=t.items?function(t,e){return t.map((t=>{if("list_item"!==t.type)return e.parseChildren([t])[0];const n=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach((t=>{if("paragraph"===t.type||"list"===t.type||"blockquote"===t.type||"code"===t.type)n.push(...e.parseChildren([t]));else if("text"===t.type&&t.tokens){const r=e.parseChildren([t]);n.push({type:"paragraph",content:r})}else{const r=e.parseChildren([t]);r.length>0&&n.push(...r)}})),{type:"listItem",content:n}}))}(t.items,e):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=null==e?void 0:e.index;return void 0!==n?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split("\n"),[s,o]=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(Ga);if(!s)break;const[,o,l,u]=s,h=o.length,a=[u];let c=n+1;const f=[i];let d=!1;for(;c<t.length;){const e=t[c];if(e.match(Ga))break;if(""===e.trim())f.push(e),a.push(""),d=!0,c+=1;else if(e.match(Va))f.push(e),a.push(e.slice(h+2)),c+=1;else{if(d)break;f.push(e),a.push(e),c+=1}}e.push({indent:h,number:parseInt(l,10),content:a.join("\n").trim(),contentLines:a,raw:f.join("\n")}),r=c,n=c}return[e,r]}(i);if(0===s.length)return;const l=Za(s,0,n);return 0!==l.length?{type:"list",ordered:!0,start:(null==(r=s[0])?void 0:r.number)||1,items:l,raw:i.slice(0,o).join("\n")}:void 0}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ya)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ql({find:Xa,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ql({find:Xa,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Ya)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[t]}}),ec=/^\s*(\[([( |x])?\])\s$/,nc=uu.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return""===e||"true"===e},renderHTML:t=>({"data-checked":t.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Lo(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(n.push(e.createNode("paragraph",{},t.tokens&&t.tokens.length>0?e.parseInline(t.tokens):t.text?[e.createNode("text",{text:t.text})]:[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;return lu(t,e,`- [${(null==(n=t.attrs)?void 0:n.checked)?"x":" "}] `)},addExtensions(){return this.options.nested?[Pa(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div"),h=t=>{var e,n;l.ariaLabel=(null==(n=null==(e=this.options.a11y)?void 0:e.checkboxLabel)?void 0:n.call(e,t,l.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};h(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",(t=>t.preventDefault())),l.addEventListener("change",(e=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(l.checked=!l.checked);const{checked:i}=e.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command((({tr:t})=>{const e=n();if("number"!=typeof e)return!1;const r=t.doc.nodeAt(e);return t.setNodeMarkup(e,void 0,{...null==r?void 0:r.attrs,checked:i}),!0})).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,i)||(l.checked=!l.checked))})),Object.entries(this.options.HTMLAttributes).forEach((([t,e])=>{i.setAttribute(t,e)})),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,u),Object.entries(e).forEach((([t,e])=>{i.setAttribute(t,e)}));let a=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:t=>{if(t.type!==this.type)return!1;i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,h(t);const e=Co(t,r.extensionManager.attributes),n=new Set(Object.keys(e)),s=this.options.HTMLAttributes;return a.forEach((t=>{n.has(t)||(t in s?i.setAttribute(t,s[t]):i.removeAttribute(t))})),Object.entries(e).forEach((([t,e])=>{null==e?t in s?i.setAttribute(t,s[t]):i.removeAttribute(t):i.setAttribute(t,e)})),a=n,!0}}}},addInputRules(){return[Ql({find:ec,type:this.type,getAttributes:t=>({checked:"x"===t[t.length-1]})})]}}),rc=uu.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Lo(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=null==(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:e.index;return void 0!==n?n:-1},tokenize(t,e,n){const r=t=>{const e=ou(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:t=>({indentLevel:t[1].length,mainContent:t[4],checked:"x"===t[3].toLowerCase()}),createToken:(t,e)=>({type:"taskItem",raw:"",mainContent:t.mainContent,indentLevel:t.indentLevel,checked:t.checked,text:t.mainContent,tokens:n.inlineTokens(t.mainContent),nestedTokens:e}),customNestedParser:r},n);return e?[{type:"taskList",raw:e.raw,items:e.items}]:n.blockTokens(t)},i=ou(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:t=>({indentLevel:t[1].length,mainContent:t[4],checked:"x"===t[3].toLowerCase()}),createToken:(t,e)=>({type:"taskItem",raw:"",mainContent:t.mainContent,indentLevel:t.indentLevel,checked:t.checked,text:t.mainContent,tokens:n.inlineTokens(t.mainContent),nestedTokens:e}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Nl.create({name:"listKit",addExtensions(){const t=[];return!1!==this.options.bulletList&&t.push(Na.configure(this.options.bulletList)),!1!==this.options.listItem&&t.push(Ha.configure(this.options.listItem)),!1!==this.options.listKeymap&&t.push(Wa.configure(this.options.listKeymap)),!1!==this.options.orderedList&&t.push(tc.configure(this.options.orderedList)),!1!==this.options.taskItem&&t.push(nc.configure(this.options.taskItem)),!1!==this.options.taskList&&t.push(rc.configure(this.options.taskList)),t}});var ic=" ",sc=uu.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",Lo(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(1===n.length&&"image"===n[0].type)return e.parseChildren([n[0]]);const r=e.parseInline(n);return e.createNode("paragraph",void 0,1!==n.length||"text"!==n[0].type||n[0].raw!==ic&&n[0].text!==ic&&" "!==n[0].raw&&" "!==n[0].text||1!==r.length||"text"!==r[0].type||r[0].text!==ic&&" "!==r[0].text?r:[])},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(0===s.length){const t=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return"paragraph"===(null==(i=null==n?void 0:n.previousNode)?void 0:i.type)&&0===t.length?ic:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,lc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,uc=Al.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("line-through")&&{}}],renderHTML({HTMLAttributes:t}){return["s",Lo(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Wl({find:oc,type:this.type})]},addPasteRules(){return[hu({find:lc,type:this.type})]}}),hc=uu.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),ac=Al.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("underline")&&{}}],renderHTML({HTMLAttributes:t}){return["u",Lo(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown:(t,e)=>`++${e.renderChildren(t)}++`,markdownTokenizer:{name:"underline",level:"inline",start:t=>t.indexOf("++"),tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function cc(t={}){return new ve({view:e=>new fc(e,t)})}class fc{constructor(t,e){var n;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=e.width)&&void 0!==n?n:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let n=t=>{this[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(n){let n=e.nodeBefore,r=e.nodeAfter;if(n||r){let e=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(e){let i=e.getBoundingClientRect(),s=n?i.bottom:i.top;n&&r&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*o;t={left:i.left,right:i.right,top:s-l,bottom:s+l}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*s;t={left:e.left-n,right:e.left+n,top:e.top,bottom:e.bottom}}let l,u,h=this.editorView.dom.offsetParent;if(this.element||(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!h||h==document.body&&"static"==getComputedStyle(h).position)l=-pageXOffset,u=-pageYOffset;else{let t=h.getBoundingClientRect();l=t.left-h.scrollLeft*(t.width/h.offsetWidth),u=t.top-h.scrollTop*(t.height/h.offsetHeight)}this.element.style.left=(t.left-l)/s+"px",this.element.style.top=(t.top-u)/o+"px",this.element.style.width=(t.right-t.left)/s+"px",this.element.style.height=(t.bottom-t.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,e,t):r;if(e&&!i){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=jt(this.editorView.state.doc,t,this.editorView.dragging.slice);null!=e&&(t=e)}this.setCursor(t),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class dc extends te{constructor(t){super(t,t)}map(t,e){let n=t.resolve(e.map(this.head));return dc.valid(n)?new dc(n):te.near(n)}content(){return a.empty}eq(t){return t instanceof dc&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new dc(t.resolve(e.pos))}getBookmark(){return new pc(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!function(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(0!=n)for(let t=r.child(n-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||mc(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t)||!function(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(let t=r.child(n);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||mc(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t))return!1;let n=e.type.spec.allowGapCursor;if(null!=n)return n;let r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,e,n=!1){t:for(;;){if(!n&&dc.valid(t))return t;let r=t.pos,i=null;for(let n=t.depth;;n--){let s=t.node(n);if(e>0?t.indexAfter(n)<s.childCount:t.index(n)>0){i=s.child(e>0?t.indexAfter(n):t.index(n)-1);break}if(0==n)return null;r+=e;let o=t.doc.resolve(r);if(dc.valid(o))return o}for(;;){let s=e>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!oe.isSelectable(i)){t=t.doc.resolve(r+i.nodeSize*e),n=!1;continue t}break}i=s,r+=e;let o=t.doc.resolve(r);if(dc.valid(o))return o}return null}}}dc.prototype.visible=!1,dc.findFrom=dc.findGapCursorFrom,te.jsonID("gapcursor",dc);class pc{constructor(t){this.pos=t}map(t){return new pc(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return dc.valid(e)?new dc(e):te.near(e)}}function mc(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}const gc=rs({ArrowLeft:wc("horiz",-1),ArrowRight:wc("horiz",1),ArrowUp:wc("vert",-1),ArrowDown:wc("vert",1)});function wc(t,e){const n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,i){let s=t.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ie){if(!i.endOfTextblock(n)||0==o.depth)return!1;l=!1,o=t.doc.resolve(e>0?o.after():o.before())}let u=dc.findGapCursorFrom(o,e,l);return!!u&&(r&&r(t.tr.setSelection(new dc(u))),!0)}}function bc(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!dc.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&oe.isSelectable(t.state.doc.nodeAt(i.inside))||(t.dispatch(t.state.tr.setSelection(new dc(r))),0))}function vc(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof dc))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=i.empty;for(let t=r.length-1;t>=0;t--)s=i.from(r[t].createAndFill(null,s));let o=t.state.tr.replace(n.pos,n.pos,new a(s,0,0));return o.setSelection(ie.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function yc(t){if(!(t.selection instanceof dc))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",wi.create(t.doc,[pi.widget(t.selection.head,e,{key:"gapcursor"})])}var kc=200,Mc=function(){};Mc.prototype.append=function(t){return t.length?(t=Mc.from(t),!this.length&&t||t.length<kc&&this.leafAppend(t)||this.length<kc&&t.leafPrepend(this)||this.appendInner(t)):this},Mc.prototype.prepend=function(t){return t.length?Mc.from(t).append(this):this},Mc.prototype.appendInner=function(t){return new Tc(this,t)},Mc.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Mc.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Mc.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Mc.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Mc.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Mc.from=function(t){return t instanceof Mc?t:t&&t.length?new xc(t):Mc.empty};var xc=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var i=e;i<n;i++)if(!1===t(this.values[i],r+i))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var i=e-1;i>=n;i--)if(!1===t(this.values[i],r+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=kc)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=kc)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Mc);Mc.empty=new xc([]);var Tc=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var i=this.left.length;return!(e<i&&!1===this.left.forEachInner(t,e,Math.min(n,i),r))&&!(n>i&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,r+i))&&void 0},e.prototype.forEachInvertedInner=function(t,e,n,r){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,r+i))&&!(n<i&&!1===this.left.forEachInvertedInner(t,Math.min(e,i),n,r))&&void 0},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Mc);class Sc{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}e&&(n=this.remapping(i,this.items.length),r=n.maps.length);let s,o,l=t.tr,u=[],h=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),r=n.maps.length),r--,void h.push(t);if(n){h.push(new Ec(t.map));let e,i=t.step.map(n.slice(r));i&&l.maybeStep(i).doc&&(e=l.mapping.maps[l.mapping.maps.length-1],u.push(new Ec(e,void 0,void 0,u.length+h.length))),r--,e&&n.appendMap(e,r)}else l.maybeStep(t.step);return t.selection?(s=n?t.selection.map(n.slice(r)):t.selection,o=new Sc(this.items.slice(0,i).append(h.reverse().concat(u)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:l,selection:s}}addTransform(t,e,n,r){let i=[],s=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let n=0;n<t.steps.length;n++){let u,h=t.steps[n].invert(t.docs[n]),a=new Ec(t.mapping.maps[n],h,e);(u=l&&l.merge(a))&&(a=u,n?i.pop():o=o.slice(0,o.length-1)),i.push(a),e&&(s++,e=void 0),r||(l=a)}let u=s-n.depth;return u>Ac&&(o=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(o,u),s-=u),new Sc(o.append(i),s)}remapping(t,e){let n=new mt;return this.items.forEach(((e,r)=>{n.appendMap(e.map,null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new Sc(this.items.append(t.map((t=>new Ec(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),i=t.mapping,s=t.steps.length,o=this.eventCount;this.items.forEach((t=>{t.selection&&o--}),r);let l=e;this.items.forEach((e=>{let r=i.getMirror(--l);if(null==r)return;s=Math.min(s,r);let u=i.maps[r];if(e.step){let s=t.steps[r].invert(t.docs[r]),h=e.selection&&e.selection.map(i.slice(l+1,r));h&&o++,n.push(new Ec(u,s,h))}else n.push(new Ec(u))}),r);let u=[];for(let t=e;t<s;t++)u.push(new Ec(i.maps[t]));let h=this.items.slice(0,r).append(u).append(n),a=new Sc(h,o);return a.emptyItemCount()>500&&(a=a.compress(this.items.length-n.length)),a}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],i=0;return this.items.forEach(((s,o)=>{if(o>=t)r.push(s),s.selection&&i++;else if(s.step){let t=s.step.map(e.slice(n)),o=t&&t.getMap();if(n--,o&&e.appendMap(o,n),t){let l=s.selection&&s.selection.map(e.slice(n));l&&i++;let u,h=new Ec(o.invert(),t,l),a=r.length-1;(u=r.length&&r[a].merge(h))?r[a]=u:r.push(h)}}else s.map&&n--}),this.items.length,0),new Sc(Mc.from(r.reverse()),i)}}Sc.empty=new Sc(Mc.empty,0);class Ec{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Ec(e.getMap().invert(),e,this.selection)}}}class Oc{constructor(t,e,n,r,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const Ac=20;function Lc(t){let e=[];for(let n=t.length-1;n>=0&&0==e.length;n--)t[n].forEach(((t,n,r,i)=>e.push(r,i)));return e}function Cc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}let $c=!1,Rc=null;function Nc(t){let e=t.plugins;if(Rc!=e){$c=!1,Rc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){$c=!0;break}}return $c}const Pc=new Me("history"),Ic=new Me("closeHistory");function Hc(t={}){return new ve({key:Pc,state:{init:()=>new Oc(Sc.empty,Sc.empty,null,0,-1),apply:(e,n,r)=>function(t,e,n,r){let i,s=n.getMeta(Pc);if(s)return s.historyState;n.getMeta(Ic)&&(t=new Oc(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(o&&o.getMeta(Pc))return o.getMeta(Pc).redo?new Oc(t.done.addTransform(n,void 0,r,Nc(e)),t.undone,Lc(n.mapping.maps),t.prevTime,t.prevComposition):new Oc(t.done,t.undone.addTransform(n,void 0,r,Nc(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Oc(t.done.rebased(n,i),t.undone.rebased(n,i),Cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Oc(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),s=0==t.prevTime||!o&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let i=0;i<e.length;i+=2)t<=e[i+1]&&r>=e[i]&&(n=!0)})),n}(n,t.prevRanges)),l=o?Cc(t.prevRanges,n.mapping):Lc(n.mapping.maps);return new Oc(t.done.addTransform(n,s?e.selection.getBookmark():void 0,r,Nc(e)),Sc.empty,l,n.time,null==i?t.prevComposition:i)}}(n,r,e,t)},config:t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?jc:"historyRedo"==n?Bc:null;return!(!r||!t.editable)&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}function Dc(t,e){return(n,r)=>{let i=Pc.getState(n);if(!i||0==(t?i.undone:i.done).eventCount)return!1;if(r){let s=function(t,e,n){let r=Nc(e),i=Pc.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new Oc(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Pc,{redo:n,historyState:u})}(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const jc=Dc(!1,!0),Bc=Dc(!0,!0);var zc=Nl.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter((t=>""!==t)).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=t=>{const e=(null==t?void 0:t.node)||this.editor.state.doc;if("textSize"===((null==t?void 0:t.mode)||this.options.mode)){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=t=>{const e=(null==t?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ve({key:new Me("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(null==i||0===i||!1===this.options.autoTrim)return void(t=!0);const s=this.storage.characters({node:r.doc});if(s>i){const e=0,n=s-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const o=r.tr.deleteRange(e,n);return t=!0,o}t=!0},filterTransaction:(t,e)=>{const n=this.options.limit;if(!t.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:e.doc}),i=this.storage.characters({node:t.doc});if(i<=n)return!0;if(r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r)return!1;if(!t.getMeta("paste"))return!1;const s=t.selection.$head.pos;return t.deleteRange(s-(i-n),s),!(this.storage.characters({node:t.doc})>n)}})]}}),Fc=Nl.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[cc(this.options)]}});Nl.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new ve({key:new Me("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return wi.create(t,[]);let o=0;"deepest"===this.options.mode&&t.descendants(((t,e)=>{if(!t.isText)return i>=e&&i<=e+t.nodeSize-1&&void(o+=1)}));let l=0;return t.descendants(((t,e)=>!t.isText&&(i>=e&&i<=e+t.nodeSize-1&&(l+=1,"deepest"===this.options.mode&&o-l>0||"shallowest"===this.options.mode&&l>1?"deepest"===this.options.mode:void s.push(pi.node(e,e+t.nodeSize,{class:this.options.className})))))),wi.create(t,s)}}})]}});var Uc=Nl.create({name:"gapCursor",addProseMirrorPlugins:()=>[new ve({props:{decorations:yc,createSelectionBetween:(t,e,n)=>e.pos==n.pos&&dc.valid(n)?new dc(n):null,handleClick:bc,handleKeyDown:gc,handleDOMEvents:{beforeinput:vc}}})],extendNodeSchema(t){var e;return{allowGapCursor:null!=(e=So(ko(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage})))?e:null}}}),_c="placeholder",Jc=new Me("tiptap__placeholder");function Kc(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:u,emptyEditor:h}}=t,a=[u];return o&&a.push(h),pi.node(i,i+s.nodeSize,{class:a.join(" "),[r]:"function"==typeof n?n({editor:e,node:s,pos:i,hasAnchor:l}):n})}function qc(t,e){return"function"==typeof t?t(e):t}function Wc(t){const e=getComputedStyle(t);return/auto|scroll|overlay/.test(`${e.overflow} ${e.overflowY} ${e.overflowX}`)}var Gc={init:()=>({topPos:null,bottomPos:null}),apply(t,e){const n=t.getMeta(Jc);return(null==n?void 0:n.positions)?{topPos:n.positions.top,bottomPos:n.positions.bottom}:t.docChanged?{topPos:null!==e.topPos?t.mapping.map(e.topPos):null,bottomPos:null!==e.bottomPos?t.mapping.map(e.bottomPos):null}:e}};function Vc(t){const e=function(t){let e=t;for(;e;){if(Wc(e))return e;const t=e.parentElement;if(!t){const t=e.getRootNode();if(t instanceof ShadowRoot){e=t.host;continue}return window}e=t}return window}(t.dom),n=()=>{const n=function({doc:t,view:e,scrollContainer:n}){const r=e.dom.getBoundingClientRect(),i=n?(s=n)===window?{top:0,bottom:window.innerHeight}:s.getBoundingClientRect():{top:0,bottom:window.innerHeight};var s;const o=Math.max(r.top,i.top)-200,l=Math.min(r.bottom,i.bottom)+200;if(o>=l)return{top:0,bottom:t.content.size};const u="rtl"===getComputedStyle(e.dom).direction?Math.max(r.right-2,r.left+2):r.left+2,h=e.posAtCoords({left:u,top:o+2}),a=e.posAtCoords({left:u,top:l-2});return{top:h?h.pos:0,bottom:a?a.pos:t.content.size}}({view:t,doc:t.state.doc,scrollContainer:e}),r=Jc.getState(t.state);if((null==r?void 0:r.topPos)===n.top&&(null==r?void 0:r.bottomPos)===n.bottom)return;const i=t.state.tr.setMeta(Jc,{positions:n});t.dispatch(i)};let r=null,i=0;const s=()=>{null===r&&(r=requestAnimationFrame((()=>{r=null;const t=performance.now();t-i>=150?(i=t,n()):s()})))};return e.addEventListener("scroll",s,{passive:!0}),n(),{update(e,n){t.state.doc.content.size!==n.doc.content.size&&s()},destroy:()=>{null!==r&&cancelAnimationFrame(r),e.removeEventListener("scroll",s)}}}function Qc({editor:t,options:e}){const n=e.dataAttribute?`data-${r=e.dataAttribute,r.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${_c}`;var r;return new ve({key:Jc,state:Gc,view:Vc,props:{decorations:({doc:r,selection:i})=>function({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){var s,o;if(!t.isEditable&&e.showOnlyWhenEditable)return null;const{anchor:l}=i,u=[],h=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const i=r.resolve(l),s=i.depth>0?i.node(1):i.nodeAfter,o=i.depth>0?i.before(1):l;if(s&&s.type.isTextblock&&Go(s)){const r=l>=o&&l<=o+s.nodeSize;u.push(Kc({editor:t,isEmptyDoc:h,dataAttribute:n,hasAnchor:r,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qc(e.emptyNodeClass,{editor:t,node:s,pos:o,hasAnchor:r})},node:s,pos:o}))}}else{const i=Jc.getState(t.state),a=null!=(s=null==i?void 0:i.topPos)?s:0,c=null!=(o=null==i?void 0:i.bottomPos)?o:r.content.size;r.nodesBetween(a,c,((r,i)=>{const s=l>=i&&l<=i+r.nodeSize,o=!r.isLeaf&&Go(r);return r.type.isTextblock?(!s&&e.showOnlyCurrent||!o||u.push(Kc({editor:t,isEmptyDoc:h,dataAttribute:n,hasAnchor:s,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:qc(e.emptyNodeClass,{editor:t,node:r,pos:i,hasAnchor:s})},node:r,pos:i})),e.includeChildren):e.includeChildren}))}return wi.create(r,u)}({editor:t,options:e,dataAttribute:n,doc:r,selection:i})}})}var Zc=Nl.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:_c,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[Qc({editor:this.editor,options:this.options})]}});function Yc({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(null==e?void 0:e.type)===t}Nl.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ve({key:new Me("selection"),props:{decorations:n=>n.selection.empty||t.isFocused||!t.isEditable||Vo(n.selection)||t.view.dragging?null:wi.create(n.doc,[pi.inline(n.selection.from,n.selection.to,{class:e.className})])}})]}});var Xc=Nl.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var t;const e=new Me(this.name),n=this.options.node||(null==(t=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map((([,t])=>t)).filter((t=>(this.options.notAfter||[]).concat(n).includes(t.name)));return[new ve({key:e,appendTransaction:(t,r,i)=>{const{doc:s,tr:o,schema:l}=i,u=e.getState(i),h=s.content.size,a=l.nodes[n];if(!t.some((t=>t.getMeta("skipTrailingNode")))&&u)return o.insert(h,a.create())},state:{init:(t,e)=>!Yc({node:e.tr.doc.lastChild,types:r}),apply:(t,e)=>t.docChanged?t.getMeta("__uniqueIDTransaction")?e:!Yc({node:t.doc.lastChild,types:r}):e}})]}}),tf=Nl.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>jc(t,e),redo:()=>({state:t,dispatch:e})=>Bc(t,e)}),addProseMirrorPlugins(){return[Hc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ef=Nl.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return!1!==this.options.bold&&i.push(wu.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(fu.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(Na.configure(this.options.bulletList)),!1!==this.options.code&&i.push(yu.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(xu.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(Tu.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(Fc.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(Uc.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(Su.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(Eu.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(tf.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(Ou.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(Ru.configure(this.options.italic)),!1!==this.options.listItem&&i.push(Ha.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(Wa.configure(null==(t=this.options)?void 0:t.listKeymap)),!1!==this.options.link&&i.push(La.configure(null==(e=this.options)?void 0:e.link)),!1!==this.options.orderedList&&i.push(tc.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(sc.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(uc.configure(this.options.strike)),!1!==this.options.text&&i.push(hc.configure(this.options.text)),!1!==this.options.underline&&i.push(ac.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(Xc.configure(null==(r=this.options)?void 0:r.trailingNode)),i}}),nf=(t,e=0)=>{const n=[];return!t.children.length||e>20||Array.from(t.children).forEach((t=>{"SPAN"===t.tagName?n.push(t):t.children.length&&n.push(...nf(t,e+1))})),n},rf=Al.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>!!t.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(t=>{if(!t.children.length)return;const e=nf(t);e&&e.forEach((t=>{var e,n;const r=t.getAttribute("style"),i=null==(n=null==(e=t.parentElement)?void 0:e.closest("span"))?void 0:n.getAttribute("style");t.setAttribute("style",`${i};${r}`)}))})(t),{})}]},renderHTML({HTMLAttributes:t}){return["span",Lo(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,((e,n)=>{if(e.isTextblock)return!0;e.marks.filter((t=>t.type===this.type)).some((t=>Object.values(t.attrs).some((t=>!!t))))||t.removeMark(n,n+e.nodeSize,this.type)})),!0}}}}),sf=Nl.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=null!=(e=Yl(t,"background-color"))?e:t.style.backgroundColor;return null==n?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands:()=>({setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()})}),of=Nl.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=null!=(e=Yl(t,"color"))?e:t.style.color;return null==n?void 0:n.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands:()=>({setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()})}),lf=Nl.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return null!=(e=Yl(t,"font-family"))?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands:()=>({setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()})}),uf=Nl.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return null!=(e=Yl(t,"font-size"))?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands:()=>({setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})}),hf=Nl.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return null!=(e=Yl(t,"line-height"))?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands:()=>({setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()})});Nl.create({name:"textStyleKit",addExtensions(){const t=[];return!1!==this.options.backgroundColor&&t.push(sf.configure(this.options.backgroundColor)),!1!==this.options.color&&t.push(of.configure(this.options.color)),!1!==this.options.fontFamily&&t.push(lf.configure(this.options.fontFamily)),!1!==this.options.fontSize&&t.push(uf.configure(this.options.fontSize)),!1!==this.options.lineHeight&&t.push(hf.configure(this.options.lineHeight)),!1!==this.options.textStyle&&t.push(rf.configure(this.options.textStyle)),t}});var af=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,cf=uu.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Lo(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,i,s,o;const l=null!=(n=null==(e=t.attrs)?void 0:e.src)?n:"",u=null!=(i=null==(r=t.attrs)?void 0:r.alt)?i:"",h=null!=(o=null==(s=t.attrs)?void 0:s.title)?o:"";return h?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"undefined"==typeof document)return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:s,HTMLAttributes:o,editor:l})=>{const u=document.createElement("img");u.draggable=!1;const h=Lo(this.options.HTMLAttributes,o);Object.entries(h).forEach((([t,e])=>{if(null!=e)switch(t){case"width":case"height":break;default:u.setAttribute(t,e)}})),null!==h.src&&(u.src=h.src);const a=new Zl({element:u,editor:l,node:i,getPos:s,onResize:(t,e)=>{u.style.width=`${t}px`,u.style.height=`${e}px`},onCommit:(t,e)=>{const n=s();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:t,height:e}).run()},onUpdate:t=>t.type===i.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:!0===r}}),c=a.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",u.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},a}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Gl({find:af,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});const ff=uu.create({name:"variable",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes:()=>({name:{default:null,parseHTML:t=>t.getAttribute("data-variable"),renderHTML:t=>t.name?{"data-variable":t.name}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-variable-label"),renderHTML:t=>t.label?{"data-variable-label":t.label}:{}}}),parseHTML:()=>[{tag:"span[data-variable]"},{tag:'span[data-type="variable"]'}],renderHTML({node:t,HTMLAttributes:e}){const n=t.attrs.label||t.attrs.name||"";return["span",Lo(e,{"data-type":"variable",class:"co-rte-variable",contenteditable:"false"}),n]},renderText:({node:t})=>`{{${t.attrs.name||""}}}`,addCommands(){return{insertVariable:(t,e)=>({commands:n})=>n.insertContent({type:this.name,attrs:{name:t,label:e??null}})}}}),df=uu.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes:()=>({id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-mention-label"),renderHTML:t=>t.label?{"data-mention-label":t.label}:{}}}),parseHTML:()=>[{tag:"span[data-mention-id]"}],renderHTML({node:t,HTMLAttributes:e}){const n=t.attrs.label||"";return["span",Lo(e,{"data-type":"mention",class:"co-rte-mention",contenteditable:"false"}),`@${n}`]},renderText:({node:t})=>`@${t.attrs.label||""}`,addCommands(){return{insertMention:(t,e)=>({commands:n})=>n.insertContent({type:this.name,attrs:{id:t,label:e}})}}}),pf={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer nofollow",target:"_blank"}},mf={comment:{heading:!1,code:!1,codeBlock:!1,blockquote:!1,bulletList:!1,orderedList:!1,listItem:!1,horizontalRule:!1,strike:!1,underline:!1,link:pf},task:{heading:!1,codeBlock:!1,horizontalRule:!1,link:pf},email:{heading:{levels:[2,3]},code:!1,codeBlock:!1,horizontalRule:!1,link:pf},document:{heading:{levels:[1,2,3,4]},codeBlock:!1,link:pf}},gf={comment:"compact",task:"basic",email:"full",document:"full"},wf={comment:2e3,task:1e4,email:null,document:null};function bf(t="task",e={}){const{placeholder:n,maxLength:r,features:i={},includeUiExtensions:s=!0,allowBase64:o=!0}=e,l=[ef.configure(mf[t]??mf.task)];if("email"!==t&&"document"!==t||l.push(rf,of),(i.variables??("email"===t||"document"===t))&&l.push(ff),i.mentions&&l.push(df),(i.image??"document"===t)&&l.push(cf.configure({inline:!1,allowBase64:o})),s){n&&l.push(Zc.configure({placeholder:n}));const t=r??i.characterCount;t&&l.push(zc.configure({limit:t}))}return l}function vf(t="task"){return gf[t]??"basic"}function yf(t="task"){return wf[t]??null}const kf=["comment","task","email","document"];function Mf(t,e){const n=t=>Array.from(t??[]).filter((t=>t.type.startsWith("image/"))),r=async(n,r,i)=>{if(n.state.schema.nodes.image)try{const e=await t(r),s=n.state.schema.nodes.image.create({src:e}),o=null!=i?n.state.tr.insert(i,s):n.state.tr.replaceSelectionWith(s);n.dispatch(o)}catch(t){e?.(t,r)}};return{handlePaste(t,e){const i=n(e.clipboardData?.files);return!(!i.length||!t.state.schema.nodes.image||(e.preventDefault(),i.forEach((e=>r(t,e))),0))},handleDrop(t,e){const i=n(e.dataTransfer?.files);if(!i.length||!t.state.schema.nodes.image)return!1;e.preventDefault();const s=t.posAtCoords({left:e.clientX,top:e.clientY});return i.forEach((e=>r(t,e,s?.pos))),!0}}}function xf(e={}){const{preset:n="task",element:r=null,content:i=null,editable:s=!0,placeholder:o,maxLength:l,features:u,customExtensions:h=[],imageUpload:a,onImageUploadError:c,onUpdate:f,onSelectionUpdate:d,onFocus:p,onBlur:m,onCreate:g,onDestroy:w,onContentError:b}=e,v=[...bf(n,{placeholder:o,maxLength:l,features:u,allowBase64:!a}),...h];return new ql({...r?{element:r}:{},editorProps:{transformPastedHTML:e=>t(e,n,u),...a?Mf(a,c):{}},extensions:v,content:i??"",editable:s,injectCSS:!1,enableContentCheck:!0,onContentError:({error:t})=>b?.(t),onCreate:({editor:t})=>g?.(t),onUpdate:({editor:t})=>f?.(t),onSelectionUpdate:({editor:t})=>d?.(t),onFocus:({editor:t})=>p?.(t),onBlur:({editor:t})=>m?.(t),onDestroy:()=>w?.()})}function Tf(t,e){return bf(t,{includeUiExtensions:!1,features:e})}function Sf(e,n="task",r){if(function(t){if(!t)return!0;const e=t.content;return!Array.isArray(e)||0===e.length||e.every((t=>"paragraph"===t?.type&&(!t.content||0===t.content.length)))}(e))return"";const i=function(t,e){if("undefined"==typeof window)throw new Error("generateHTML can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");const n=Do(e);return function(t,e){if("undefined"==typeof window)throw new Error("getHTMLFromFragment can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");const n=window.document.createElement("div");return ot.fromSchema(e).serializeFragment(t.content,{document:window.document},n),n.innerHTML}(L.fromJSON(n,t),n)}(e,Tf(n,r));return t(i,n,r)}function Ef(e,n="task",r){return function(t,e){if("undefined"==typeof window)throw new Error("generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");const n=Do(e),r=(new window.DOMParser).parseFromString(t,"text/html");if(!r)throw new Error("Failed to parse HTML string");return Q.fromSchema(n).parse(r.body,void 0).toJSON()}(t(e??"",n,r),Tf(n,r))}function Of(t){if(!t)return"";const e=new Set(["paragraph","heading","blockquote","listItem","bulletList","orderedList","codeBlock","horizontalRule"]),n=[],r=t=>{t&&("text"!==t.type||"string"!=typeof t.text?"variable"!==t.type?"mention"!==t.type?"hardBreak"!==t.type?(Array.isArray(t.content)&&t.content.forEach(r),e.has(t.type)&&n.push("\n")):n.push("\n"):n.push(`@${t.attrs?.label??""}`):n.push(`{{${t.attrs?.name??""}}}`):n.push(t.text))};return r(t),n.join("").replace(/\n{3,}/g,"\n\n").trim()}const Af={bold:{action:"bold",icon:"text-b",label:"Bold",type:"toggle"},italic:{action:"italic",icon:"text-italic",label:"Italic",type:"toggle"},underline:{action:"underline",icon:"text-underline",label:"Underline",type:"toggle"},strike:{action:"strike",icon:"text-strikethrough",label:"Strikethrough",type:"toggle"},h2:{action:"heading",icon:"text-h-two",label:"Heading 2",type:"toggle",payload:{level:2}},h3:{action:"heading",icon:"text-h-three",label:"Heading 3",type:"toggle",payload:{level:3}},bulletList:{action:"bulletList",icon:"list-bullets",label:"Bullet list",type:"toggle"},orderedList:{action:"orderedList",icon:"list-numbers",label:"Numbered list",type:"toggle"},blockquote:{action:"blockquote",icon:"quotes",label:"Quote",type:"toggle"},link:{action:"link",icon:"link",label:"Link",type:"toggle"},image:{action:"image",icon:"image",label:"Image",type:"button"},undo:{action:"undo",icon:"arrow-counter-clockwise",label:"Undo",type:"button"},redo:{action:"redo",icon:"arrow-clockwise",label:"Redo",type:"button"}},Lf={none:[],compact:[Af.bold,Af.italic,Af.link],basic:[Af.bold,Af.italic,Af.underline,Af.bulletList,Af.orderedList,Af.link],full:[Af.h2,Af.h3,Af.bold,Af.italic,Af.underline,Af.strike,Af.bulletList,Af.orderedList,Af.blockquote,Af.link,Af.image,Af.undo,Af.redo]};function Cf(t){return Lf[t]??Lf.basic}export{df as MentionNode,kf as PRESETS,ff as VariableNode,xf as createEditor,vf as defaultToolbarForPreset,bf as getExtensions,Ef as htmlToJson,Sf as jsonToHtml,Of as jsonToText,yf as maxLengthForPreset,t as sanitize,Cf as toolbarItems}
|