@novaprose/tinymce-compat 0.6.0 → 0.8.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/README.md +10 -3
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/ai-XVSDIIQI.js +127 -0
- package/dist/ai-XVSDIIQI.js.map +1 -0
- package/dist/dialog-3UZZZW6Y.js +300 -0
- package/dist/dialog-3UZZZW6Y.js.map +1 -0
- package/dist/index.cjs +1351 -397
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -48
- package/dist/index.d.ts +109 -48
- package/dist/index.js +856 -363
- package/dist/index.js.map +1 -1
- package/dist/novaprose.css +440 -508
- package/dist/tinymce-chunks/a11ychecker-fe78c552.js +2 -0
- package/dist/tinymce-chunks/a11ychecker-fe78c552.js.map +7 -0
- package/dist/tinymce-chunks/accordion-ui-4272c63b.js +2 -0
- package/dist/tinymce-chunks/accordion-ui-4272c63b.js.map +7 -0
- package/dist/tinymce-chunks/advcode-840793ca.js +2 -0
- package/dist/tinymce-chunks/advcode-840793ca.js.map +7 -0
- package/dist/tinymce-chunks/advcode-editor-37bc0a02.js +26 -0
- package/dist/tinymce-chunks/advcode-editor-37bc0a02.js.map +7 -0
- package/dist/tinymce-chunks/advlist-67b98670.js +2 -0
- package/dist/tinymce-chunks/advlist-67b98670.js.map +7 -0
- package/dist/tinymce-chunks/advtable-ui-db2e667d.js +2 -0
- package/dist/tinymce-chunks/advtable-ui-db2e667d.js.map +7 -0
- package/dist/tinymce-chunks/ai-e0658729.js +6 -0
- package/dist/tinymce-chunks/ai-e0658729.js.map +7 -0
- package/dist/tinymce-chunks/ai2-ddf912a7.js +34 -0
- package/dist/tinymce-chunks/ai2-ddf912a7.js.map +7 -0
- package/dist/tinymce-chunks/anchor-ui-da0966bb.js +2 -0
- package/dist/tinymce-chunks/anchor-ui-da0966bb.js.map +7 -0
- package/dist/tinymce-chunks/autocorrect-907e1296.js +3 -0
- package/dist/tinymce-chunks/autocorrect-907e1296.js.map +7 -0
- package/dist/tinymce-chunks/autolink-897e8650.js +2 -0
- package/dist/tinymce-chunks/autolink-897e8650.js.map +7 -0
- package/dist/tinymce-chunks/autoresize-f8a4a52a.js +2 -0
- package/dist/tinymce-chunks/autoresize-f8a4a52a.js.map +7 -0
- package/dist/tinymce-chunks/autosave-60381295.js +2 -0
- package/dist/tinymce-chunks/autosave-60381295.js.map +7 -0
- package/dist/tinymce-chunks/bash-f3f8783a.js +2 -0
- package/dist/tinymce-chunks/bash-f3f8783a.js.map +7 -0
- package/dist/tinymce-chunks/c-8e3b278b.js +2 -0
- package/dist/tinymce-chunks/c-8e3b278b.js.map +7 -0
- package/dist/tinymce-chunks/casechange-8ad6a2c3.js +6 -0
- package/dist/tinymce-chunks/casechange-8ad6a2c3.js.map +7 -0
- package/dist/tinymce-chunks/charmap-5deb524c.js +2 -0
- package/dist/tinymce-chunks/charmap-5deb524c.js.map +7 -0
- package/dist/tinymce-chunks/checklist-5a0c95d3.js +2 -0
- package/dist/tinymce-chunks/checklist-5a0c95d3.js.map +7 -0
- package/dist/tinymce-chunks/codesample-b91dcd91.js +4 -0
- package/dist/tinymce-chunks/codesample-b91dcd91.js.map +7 -0
- package/dist/tinymce-chunks/comments-panel-152e9cbe.js +2 -0
- package/dist/tinymce-chunks/comments-panel-152e9cbe.js.map +7 -0
- package/dist/tinymce-chunks/core-f5b3fd3e.js +4 -0
- package/dist/tinymce-chunks/core-f5b3fd3e.js.map +7 -0
- package/dist/tinymce-chunks/cpp-525b2c81.js +2 -0
- package/dist/tinymce-chunks/cpp-525b2c81.js.map +7 -0
- package/dist/tinymce-chunks/csharp-b95db858.js +2 -0
- package/dist/tinymce-chunks/csharp-b95db858.js.map +7 -0
- package/dist/tinymce-chunks/css-bb736f0c.js +2 -0
- package/dist/tinymce-chunks/css-bb736f0c.js.map +7 -0
- package/dist/tinymce-chunks/de-eb649701.js +2 -0
- package/dist/tinymce-chunks/de-eb649701.js.map +7 -0
- package/dist/tinymce-chunks/dialog-126a0355.js +2 -0
- package/dist/tinymce-chunks/dialog-126a0355.js.map +7 -0
- package/dist/tinymce-chunks/diff-02578ed2.js +2 -0
- package/dist/tinymce-chunks/diff-02578ed2.js.map +7 -0
- package/dist/tinymce-chunks/directionality-185b3810.js +2 -0
- package/dist/tinymce-chunks/directionality-185b3810.js.map +7 -0
- package/dist/tinymce-chunks/dockerfile-ff44475c.js +2 -0
- package/dist/tinymce-chunks/dockerfile-ff44475c.js.map +7 -0
- package/dist/tinymce-chunks/draghandle-a1d99987.js +4 -0
- package/dist/tinymce-chunks/draghandle-a1d99987.js.map +7 -0
- package/dist/tinymce-chunks/editimage-36199bc6.js +2 -0
- package/dist/tinymce-chunks/editimage-36199bc6.js.map +7 -0
- package/dist/tinymce-chunks/email-1926dd8a.js +62 -0
- package/dist/tinymce-chunks/email-1926dd8a.js.map +7 -0
- package/dist/tinymce-chunks/email2-e9c49586.js +2 -0
- package/dist/tinymce-chunks/email2-e9c49586.js.map +7 -0
- package/dist/tinymce-chunks/emoticons-a5ab437d.js +2 -0
- package/dist/tinymce-chunks/emoticons-a5ab437d.js.map +7 -0
- package/dist/tinymce-chunks/es-b9c95169.js +2 -0
- package/dist/tinymce-chunks/es-b9c95169.js.map +7 -0
- package/dist/tinymce-chunks/exportpdf-0c6647bc.js +2 -0
- package/dist/tinymce-chunks/exportpdf-0c6647bc.js.map +7 -0
- package/dist/tinymce-chunks/exportword-8a03f24d.js +2 -0
- package/dist/tinymce-chunks/exportword-8a03f24d.js.map +7 -0
- package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js +2 -0
- package/dist/tinymce-chunks/footnotes-ui-3f167c2c.js.map +7 -0
- package/dist/tinymce-chunks/form-dialog-9eb62199.js +2 -0
- package/dist/tinymce-chunks/form-dialog-9eb62199.js.map +7 -0
- package/dist/tinymce-chunks/formatpainter-cbeeffa7.js +2 -0
- package/dist/tinymce-chunks/formatpainter-cbeeffa7.js.map +7 -0
- package/dist/tinymce-chunks/fr-724ffe36.js +2 -0
- package/dist/tinymce-chunks/fr-724ffe36.js.map +7 -0
- package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js +2 -0
- package/dist/tinymce-chunks/fullpagehtml-ui-9dd804af.js.map +7 -0
- package/dist/tinymce-chunks/go-14612282.js +2 -0
- package/dist/tinymce-chunks/go-14612282.js.map +7 -0
- package/dist/tinymce-chunks/graphql-032121b4.js +2 -0
- package/dist/tinymce-chunks/graphql-032121b4.js.map +7 -0
- package/dist/tinymce-chunks/history-diff-a0db052c.js +2 -0
- package/dist/tinymce-chunks/history-diff-a0db052c.js.map +7 -0
- package/dist/tinymce-chunks/importcss-28610ab5.js +3 -0
- package/dist/tinymce-chunks/importcss-28610ab5.js.map +7 -0
- package/dist/tinymce-chunks/importword-ec0b2213.js +2 -0
- package/dist/tinymce-chunks/importword-ec0b2213.js.map +7 -0
- package/dist/tinymce-chunks/index-330c7726.js +5 -0
- package/dist/tinymce-chunks/index-330c7726.js.map +7 -0
- package/dist/tinymce-chunks/index2-610900bb.js +2 -0
- package/dist/tinymce-chunks/index2-610900bb.js.map +7 -0
- package/dist/tinymce-chunks/insertdatetime-a48ee6e0.js +2 -0
- package/dist/tinymce-chunks/insertdatetime-a48ee6e0.js.map +7 -0
- package/dist/tinymce-chunks/it-f4816bbc.js +2 -0
- package/dist/tinymce-chunks/it-f4816bbc.js.map +7 -0
- package/dist/tinymce-chunks/java-e051279c.js +2 -0
- package/dist/tinymce-chunks/java-e051279c.js.map +7 -0
- package/dist/tinymce-chunks/javascript-d7a6fb3d.js +2 -0
- package/dist/tinymce-chunks/javascript-d7a6fb3d.js.map +7 -0
- package/dist/tinymce-chunks/json-08c0b631.js +2 -0
- package/dist/tinymce-chunks/json-08c0b631.js.map +7 -0
- package/dist/tinymce-chunks/kotlin-b34d5ff2.js +3 -0
- package/dist/tinymce-chunks/kotlin-b34d5ff2.js.map +7 -0
- package/dist/tinymce-chunks/linkchecker-820845fd.js +2 -0
- package/dist/tinymce-chunks/linkchecker-820845fd.js.map +7 -0
- package/dist/tinymce-chunks/lua-9b0ae20a.js +2 -0
- package/dist/tinymce-chunks/lua-9b0ae20a.js.map +7 -0
- package/dist/tinymce-chunks/markdown-5698ebec.js +34 -0
- package/dist/tinymce-chunks/markdown-5698ebec.js.map +7 -0
- package/dist/tinymce-chunks/markdown2-943bcf90.js +2 -0
- package/dist/tinymce-chunks/markdown2-943bcf90.js.map +7 -0
- package/dist/tinymce-chunks/math-ui-1b57f7eb.js +2 -0
- package/dist/tinymce-chunks/math-ui-1b57f7eb.js.map +7 -0
- package/dist/tinymce-chunks/media-ui-de819f11.js +2 -0
- package/dist/tinymce-chunks/media-ui-de819f11.js.map +7 -0
- package/dist/tinymce-chunks/mediaembed-ui-7be11324.js +2 -0
- package/dist/tinymce-chunks/mediaembed-ui-7be11324.js.map +7 -0
- package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js +2 -0
- package/dist/tinymce-chunks/mentions-ui-b1bb2d15.js.map +7 -0
- package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js +2 -0
- package/dist/tinymce-chunks/mergetags-ui-f5bdd1f9.js.map +7 -0
- package/dist/tinymce-chunks/nonbreaking-f15226ad.js +2 -0
- package/dist/tinymce-chunks/nonbreaking-f15226ad.js.map +7 -0
- package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js +2 -0
- package/dist/tinymce-chunks/pagebreak-ui-7476f5c2.js.map +7 -0
- package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js +2 -0
- package/dist/tinymce-chunks/pageembed-ui-da39f1ee.js.map +7 -0
- package/dist/tinymce-chunks/pagelayout-ui-01757669.js +2 -0
- package/dist/tinymce-chunks/pagelayout-ui-01757669.js.map +7 -0
- package/dist/tinymce-chunks/paste-office-d6821891.js +3 -0
- package/dist/tinymce-chunks/paste-office-d6821891.js.map +7 -0
- package/dist/tinymce-chunks/permanentpen-fc96f445.js +2 -0
- package/dist/tinymce-chunks/permanentpen-fc96f445.js.map +7 -0
- package/dist/tinymce-chunks/php-6b723470.js +3 -0
- package/dist/tinymce-chunks/php-6b723470.js.map +7 -0
- package/dist/tinymce-chunks/powershell-e6c3fdb8.js +2 -0
- package/dist/tinymce-chunks/powershell-e6c3fdb8.js.map +7 -0
- package/dist/tinymce-chunks/print-86762549.js +27 -0
- package/dist/tinymce-chunks/print-86762549.js.map +7 -0
- package/dist/tinymce-chunks/pt-BR-abebbb34.js +2 -0
- package/dist/tinymce-chunks/pt-BR-abebbb34.js.map +7 -0
- package/dist/tinymce-chunks/python-a20cacce.js +2 -0
- package/dist/tinymce-chunks/python-a20cacce.js.map +7 -0
- package/dist/tinymce-chunks/quickbars-35c87c0e.js +2 -0
- package/dist/tinymce-chunks/quickbars-35c87c0e.js.map +7 -0
- package/dist/tinymce-chunks/revisionhistory-741dfb24.js +2 -0
- package/dist/tinymce-chunks/revisionhistory-741dfb24.js.map +7 -0
- package/dist/tinymce-chunks/ru-f1d19f4f.js +2 -0
- package/dist/tinymce-chunks/ru-f1d19f4f.js.map +7 -0
- package/dist/tinymce-chunks/ruby-93c325c7.js +2 -0
- package/dist/tinymce-chunks/ruby-93c325c7.js.map +7 -0
- package/dist/tinymce-chunks/rust-d80fbab5.js +2 -0
- package/dist/tinymce-chunks/rust-d80fbab5.js.map +7 -0
- package/dist/tinymce-chunks/save-a65e56cd.js +2 -0
- package/dist/tinymce-chunks/save-a65e56cd.js.map +7 -0
- package/dist/tinymce-chunks/scss-7cffeb15.js +2 -0
- package/dist/tinymce-chunks/scss-7cffeb15.js.map +7 -0
- package/dist/tinymce-chunks/search-bar-3ea04183.js +3 -0
- package/dist/tinymce-chunks/search-bar-3ea04183.js.map +7 -0
- package/dist/tinymce-chunks/spellchecker-91509fc1.js +6 -0
- package/dist/tinymce-chunks/spellchecker-91509fc1.js.map +7 -0
- package/dist/tinymce-chunks/sql-eeac1a81.js +2 -0
- package/dist/tinymce-chunks/sql-eeac1a81.js.map +7 -0
- package/dist/tinymce-chunks/suggestions-panel-c29362cf.js +2 -0
- package/dist/tinymce-chunks/suggestions-panel-c29362cf.js.map +7 -0
- package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js +2 -0
- package/dist/tinymce-chunks/suggestions-ui-c5f6bad4.js.map +7 -0
- package/dist/tinymce-chunks/swift-2b081f3e.js +2 -0
- package/dist/tinymce-chunks/swift-2b081f3e.js.map +7 -0
- package/dist/tinymce-chunks/table-4d43f60d.js +2 -0
- package/dist/tinymce-chunks/table-4d43f60d.js.map +7 -0
- package/dist/tinymce-chunks/table-dialogs-0445847c.js +2 -0
- package/dist/tinymce-chunks/table-dialogs-0445847c.js.map +7 -0
- package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js +2 -0
- package/dist/tinymce-chunks/tableofcontents-ui-01a9af06.js.map +7 -0
- package/dist/tinymce-chunks/temml-d637f801.js +97 -0
- package/dist/tinymce-chunks/temml-d637f801.js.map +7 -0
- package/dist/tinymce-chunks/template-b522c8ed.js +2 -0
- package/dist/tinymce-chunks/template-b522c8ed.js.map +7 -0
- package/dist/tinymce-chunks/typescript-fa085d66.js +2 -0
- package/dist/tinymce-chunks/typescript-fa085d66.js.map +7 -0
- package/dist/tinymce-chunks/typography-469ce11a.js +3 -0
- package/dist/tinymce-chunks/typography-469ce11a.js.map +7 -0
- package/dist/tinymce-chunks/visualblocks-8b7cba25.js +2 -0
- package/dist/tinymce-chunks/visualblocks-8b7cba25.js.map +7 -0
- package/dist/tinymce-chunks/visualchars-7cda4c00.js +2 -0
- package/dist/tinymce-chunks/visualchars-7cda4c00.js.map +7 -0
- package/dist/tinymce-chunks/xml-77617a8f.js +2 -0
- package/dist/tinymce-chunks/xml-77617a8f.js.map +7 -0
- package/dist/tinymce-chunks/yaml-5bb3ad37.js +2 -0
- package/dist/tinymce-chunks/yaml-5bb3ad37.js.map +7 -0
- package/dist/tinymce.global.js +36 -29
- package/dist/tinymce.global.js.map +7 -1
- package/dist/tinymce.licenses.txt +1094 -0
- package/package.json +11 -6
package/dist/tinymce.global.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
"use strict";(()=>{var mm=Object.defineProperty;var P=(n,e)=>()=>(n&&(e=n(n=0)),e);var He=(n,e)=>{for(var t in e)mm(n,t,{get:e[t],enumerable:!0})};function se(n,e){Ai.set(n,e)}function Ti(n){return Ai.has(n)}function Ql(n){return typeof n=="function"}function Zl(n){let e=[],t=[],r=[];for(let o of n)if(typeof o=="string"){let i=Ai.get(o);i?Ql(i)?t.push(i):e.push(i):r.push(`Plugin "${o}" is not registered`)}else Ql(o)?t.push(o):e.push(o);return{plugins:e,loaders:t,errors:r}}function Ni(n,e=new Set){let t=new Map(n.map(l=>[l.name,l])),r=[],o=[],i=new Map,s=(l,a)=>{let c=i.get(l.name);if(c==="done")return!0;if(c==="failed")return!1;if(c==="visiting")return o.push(`Plugin dependency cycle: ${[...a,l.name].join(" \u2192 ")}`),!1;i.set(l.name,"visiting");for(let u of l.requires??[]){if(e.has(u))continue;let d=t.get(u);if(!d)return o.push(`Plugin "${l.name}" requires "${u}", which is not loaded`),i.set(l.name,"failed"),!1;if(!s(d,[...a,l.name]))return i.set(l.name,"failed"),!1}return i.set(l.name,"done"),r.push(l),!0};for(let l of n)s(l,[]);return{ordered:r,errors:o}}async function ea(n){let e=await n();return"default"in e&&e.default?e.default:e}var Ai,Hr=P(()=>{"use strict";Ai=new Map});var L,M,j=P(()=>{"use strict";L=n=>`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,M={undo:L('<path d="M9 14 4 9l5-5" /><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" />'),redo:L('<path d="m15 14 5-5-5-5" /><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" />'),bold:L('<path d="M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8" />'),italic:L('<line x1="19" x2="10" y1="4" y2="4" /><line x1="14" x2="5" y1="20" y2="20" /><line x1="15" x2="9" y1="4" y2="20" />'),underline:L('<path d="M6 4v6a6 6 0 0 0 12 0V4" /><line x1="4" x2="20" y1="20" y2="20" />'),strike:L('<path d="M16 4H9a3 3 0 0 0-2.83 4" /><path d="M14 12a4 4 0 0 1 0 8H6" /><line x1="4" x2="20" y1="12" y2="12" />'),code:L('<path d="m16 18 6-6-6-6" /><path d="m8 6-6 6 6 6" />'),subscript:L('<path d="m4 5 8 8" /><path d="m12 5-8 8" /><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" />'),superscript:L('<path d="m4 19 8-8" /><path d="m12 19-8-8" /><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" />'),bulletList:L('<path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" />'),orderedList:L('<path d="M11 5h10" /><path d="M11 12h10" /><path d="M11 19h10" /><path d="M4 4h1v5" /><path d="M4 9h2" /><path d="M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" />'),indent:L('<path d="M21 5H11" /><path d="M21 12H11" /><path d="M21 19H11" /><path d="m3 8 4 4-4 4" />'),outdent:L('<path d="M21 5H11" /><path d="M21 12H11" /><path d="M21 19H11" /><path d="m7 8-4 4 4 4" />'),blockquote:L('<path d="M17 5H3" /><path d="M21 12H8" /><path d="M21 19H8" /><path d="M3 12v7" />'),codeBlock:L('<path d="m10 9-3 3 3 3" /><path d="m14 15 3-3-3-3" /><rect x="3" y="3" width="18" height="18" rx="2" />'),alignLeft:L('<path d="M21 5H3" /><path d="M15 12H3" /><path d="M17 19H3" />'),alignCenter:L('<path d="M21 5H3" /><path d="M17 12H7" /><path d="M19 19H5" />'),alignRight:L('<path d="M21 5H3" /><path d="M21 12H9" /><path d="M21 19H7" />'),alignJustify:L('<path d="M3 5h18" /><path d="M3 12h18" /><path d="M3 19h18" />'),horizontalRule:L('<path d="m16 16-4 4-4-4" /><path d="M3 12h18" /><path d="m8 8 4-4 4 4" />'),link:L('<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />'),unlink:L('<path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" /><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" /><line x1="8" x2="8" y1="2" y2="5" /><line x1="2" x2="5" y1="8" y2="8" /><line x1="16" x2="16" y1="19" y2="22" /><line x1="19" x2="22" y1="16" y2="16" />'),image:L('<rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" /><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />'),clearFormatting:L('<path d="M4 7V4h16v3" /><path d="M5 20h6" /><path d="M13 4 8 20" /><path d="m15 15 5 5" /><path d="m20 15-5 5" />'),formatMore:L('<path d="M12 4v16" /><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" /><path d="M9 20h6" />'),imageLeft:L('<rect width="9" height="6" x="6" y="14" rx="2" /><rect width="16" height="6" x="6" y="4" rx="2" /><path d="M2 2v20" />'),imageCenter:L('<path d="M12 2v20" /><path d="M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" /><path d="M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" /><path d="M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" /><path d="M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" />'),imageRight:L('<rect width="16" height="6" x="2" y="4" rx="2" /><rect width="9" height="6" x="9" y="14" rx="2" /><path d="M22 22V2" />'),resize:L('<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="M14 15H9v-5" /><path d="M16 3h5v5" /><path d="M21 3 9 15" />'),altText:L('<rect width="18" height="14" x="3" y="5" rx="2" ry="2" /><path d="M7 15h4M15 15h2M7 11h2M13 11h4" />'),trash:L('<path d="M10 11v6" /><path d="M14 11v6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /><path d="M3 6h18" /><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />'),paragraph:L('<path d="M13 4v16" /><path d="M17 4v16" /><path d="M19 4H9.5a4.5 4.5 0 0 0 0 9H13" />'),h1:L('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="m17 12 3-2v8" />'),h2:L('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1" />'),h3:L('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2" /><path d="M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2" />'),pasteText:L('<rect width="8" height="4" x="8" y="2" rx="1" ry="1" /><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" /><path d="M9 12v-1h6v1" /><path d="M11 17h2" /><path d="M12 11v6" />'),table:L('<path d="M12 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" />'),rowBefore:L('<path d="M12 2v6" /><path d="M18.464 3H19a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h.535" /><path d="M21 12H3" /><path d="M9 5h6" />'),rowAfter:L('<path d="M12 22v-6" /><path d="M18.464 21H19a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h.535" /><path d="M21 12H3" /><path d="M9 19h6" />'),rowDelete:L('<path d="M16 5H3" /><path d="M11 12H3" /><path d="M16 19H3" /><path d="m15.5 9.5 5 5" /><path d="m20.5 9.5-5 5" />'),colBefore:L('<path d="M12 3v18" /><path d="M3 5.536V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-.535" /><path d="M5 15V9" /><path d="M8 12H2" />'),colAfter:L('<path d="M12 3v18" /><path d="M16 12h6" /><path d="M19 15V9" /><path d="M21 5.536V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-.535" />'),colDelete:L('<g transform="rotate(90 12 12)"><path d="M16 5H3" /><path d="M11 12H3" /><path d="M16 19H3" /><path d="m15.5 9.5 5 5" /><path d="m20.5 9.5-5 5" /></g>'),merge:L('<path d="M12 21v-6" /><path d="M12 9V3" /><path d="M3 15h18" /><path d="M3 9h18" /><rect width="18" height="18" x="3" y="3" rx="2" />'),split:L('<path d="M12 15V9" /><path d="M3 15h18" /><path d="M3 9h18" /><rect width="18" height="18" x="3" y="3" rx="2" />'),rowHeader:L('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" />'),colHeader:L('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M9 3v18" />'),sort:L('<path d="m3 16 4 4 4-4" /><path d="M7 20V4" /><path d="M11 4h10" /><path d="M11 8h7" /><path d="M11 12h4" />'),tableProps:L('<path d="M15 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M21 9H3" /><path d="M21 15H3" />'),cellProps:L('<path d="M10.6 21H5a2 2 0 01-2-2V5a2 2 0 012-2h14a2 2 0 012 2v5.6" /><path d="m14.305 19.53.923-.382" /><path d="M15 3v7.6" /><path d="m15.229 16.852-.924-.383" /><path d="m16.852 15.228-.383-.923" /><path d="m16.852 20.772-.383.924" /><path d="m19.148 15.228.383-.923" /><path d="m19.53 21.696-.382-.924" /><path d="m20.773 16.852.922-.383" /><path d="m20.773 19.148.922.383" /><path d="M9 3v18" /><circle cx="18" cy="18" r="3" />'),tableDelete:L('<path d="M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3" /><path d="m16.5 16.5 5 5" /><path d="m16.5 21.5 5-5" />'),chevronUp:L('<path d="m18 15-6-6-6 6" />'),search:L('<path d="m21 21-4.34-4.34" /><circle cx="11" cy="11" r="8" />'),fullscreen:L('<path d="M8 3H5a2 2 0 0 0-2 2v3" /><path d="M21 8V5a2 2 0 0 0-2-2h-3" /><path d="M3 16v3a2 2 0 0 0 2 2h3" /><path d="M16 21h3a2 2 0 0 0 2-2v-3" />'),fullscreenExit:L('<path d="M8 3v3a2 2 0 0 1-2 2H3" /><path d="M21 8h-3a2 2 0 0 1-2-2V3" /><path d="M3 16h3a2 2 0 0 1 2 2v3" /><path d="M16 21v-3a2 2 0 0 1 2-2h3" />'),preview:L('<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" />'),sourceCode:L('<path d="m18 16 4-4-4-4" /><path d="m6 8-4 4 4 4" /><path d="m14.5 4-5 16" />'),help:L('<circle cx="12" cy="12" r="10" /><path d="M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5" /><path d="M12 17h.01" />'),print:L('<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" /><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" /><rect x="6" y="14" width="12" height="8" rx="1" />'),check:L('<path d="M20 6 9 17l-5-5" />'),close:L('<path d="M18 6 6 18" /><path d="m6 6 12 12" />'),chevronDown:L('<path d="m6 9 6 6 6-6" />'),more:L('<circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" />'),textColor:L('<path d="M4 20h16" /><path d="m6 16 6-12 6 12" /><path d="M8 12h8" />'),highlight:L('<path d="m9 11-6 6v3h9l3-3" /><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4" />'),lineHeight:L('<path d="M15 14H9" /><path d="M21 21H3" /><path d="M21 3H3" /><path d="m8 16 3.453-7.648a.6.6 0 011.094.001L16 16" />'),upload:L('<path d="M12 3v12" /><path d="m17 8-5-5-5 5" /><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />'),externalLink:L('<path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6" /><path d="m21 3-9 9" /><path d="M15 3h6v6" />'),copy:L('<rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />'),edit:L('<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" />'),resizeHandle:L('<circle cx="12" cy="9" r="1" /><circle cx="19" cy="9" r="1" /><circle cx="5" cy="9" r="1" /><circle cx="12" cy="15" r="1" /><circle cx="19" cy="15" r="1" /><circle cx="5" cy="15" r="1" />'),browse:L('<path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />'),mergeTags:L('<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" /><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" />'),resizeHandleBoth:L('<path d="M19 13v6h-6" /><path d="M5 11V5h6" /><path d="m5 5 14 14" />'),anchor:L('<path d="M12 6v16" /><path d="m19 13 2-1a9 9 0 0 1-18 0l2 1" /><path d="M9 11h6" /><circle cx="12" cy="4" r="2" />'),save:L('<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" /><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" /><path d="M7 3v4a1 1 0 0 0 1 1h7" />'),charmap:L('<path d="M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21" />'),commentAdd:L('<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" /><path d="M12 8v6" /><path d="M9 11h6" />'),comments:L('<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" /><path d="M7 11h10" /><path d="M7 15h6" /><path d="M7 7h8" />'),emoji:L('<path d="M15 10V9" /><path d="M16.472 15a6 6 0 01-8.943 0" /><path d="M9 10V9" /><circle cx="12" cy="12" r="10" />'),dateTime:L('<path d="M16 2v3" /><path d="M17 15.5v1.7l1 .625" /><path d="M21 8.936V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h3.935" /><path d="M3 9h9.873" /><path d="M8 2v3" /><circle cx="17" cy="17" r="5" />'),media:L('<rect x="3" y="3" width="18" height="18" rx="2" /><path d="M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z" />'),nonBreaking:L('<path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1" />'),pageBreak:L('<path d="M5.42 9.42 8 12" /><circle cx="4" cy="8" r="2" /><path d="m14 6-8.58 8.58" /><circle cx="4" cy="16" r="2" /><path d="M10.8 14.8 14 18" /><path d="M16 12h-2" /><path d="M22 12h-2" />'),history:L('<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" /><path d="M12 7v5l4 2" />'),suggest:L('<path d="M13 21h8" /><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" />'),review:L('<path d="M13 5h8" /><path d="M13 12h8" /><path d="M13 19h8" /><path d="m3 17 2 2 4-4" /><path d="m3 7 2 2 4-4" />'),visualBlocks:L('<path d="M5 3a2 2 0 0 0-2 2" /><path d="M19 3a2 2 0 0 1 2 2" /><path d="M21 19a2 2 0 0 1-2 2" /><path d="M5 21a2 2 0 0 1-2-2" /><path d="M9 3h1" /><path d="M9 21h1" /><path d="M14 3h1" /><path d="M14 21h1" /><path d="M3 9v1" /><path d="M21 9v1" /><path d="M3 14v1" /><path d="M21 14v1" />'),ltr:L('<path d="M10 3v11" /><path d="M10 9H7a1 1 0 0 1 0-6h8" /><path d="M14 3v11" /><path d="m18 14 4 4H2" /><path d="m22 18-4 4" />'),rtl:L('<path d="M14 3v11" /><path d="M14 9h-3a3 3 0 0 1 0-6h9" /><path d="M18 3v11" /><path d="M22 18H2l4-4" /><path d="m6 22-4-4" />')}});function ye(n){this.content=n}var Li,ta=P(()=>{"use strict";ye.prototype={constructor:ye,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new ye(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ye(t)},addToStart:function(n,e){return new ye([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ye(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new ye(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ye.from(n),n.size?new ye(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ye.from(n),n.size?new ye(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ye.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ye.from=function(n){if(n instanceof ye)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ye(e)};Li=ye});function pa(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)t++;return a&&a<s.length&&a<l.length&&ga(s.charCodeAt(a-1))&&ma(s.charCodeAt(a))&&t--,t}if(o.content.size||i.content.size){let s=pa(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function ha(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&ga(c.charCodeAt(d-1))&&ma(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(s.content.size||l.content.size){let c=ha(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}function ma(n){return n>=56320&&n<57344}function ga(n){return n>=55296&&n<56320}function zr(n,e){return Oi.index=n,Oi.offset=e,Oi}function _r(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!_r(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!_r(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}function ba(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(ba(i.content,e-o-1,t-o-1)))}function ya(n,e,t,r,o,i){let{index:s,offset:l}=n.findIndex(e),a=n.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=ya(a.content,e-l-1,t,s==0?r-1:0,s==n.childCount-1?o-1:0,a);return c&&n.replaceChild(s,a.copy(c))}function gm(n,e,t){if(t.openStart>n.depth)throw new xt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new xt("Inconsistent open depths");return va(n,e,t,0)}function va(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=va(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Ft(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=bm(t,n);return Ft(i,wa(n,s,l,e,r))}else return Ft(i,Vr(n,e,r))}function ka(n,e){if(!e.type.compatibleContent(n.type))throw new xt("Cannot join "+e.type.name+" onto "+n.type.name)}function Di(n,e,t){let r=n.node(t);return ka(r,e.node(t)),r}function zt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qn(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(zt(n.nodeAfter,r),i++));for(let l=i;l<s;l++)zt(o.child(l),r);e&&e.depth==t&&e.textOffset&&zt(e.nodeBefore,r)}function Ft(n,e){if(!n.type.validContent(e))throw new xt("Invalid content for node "+n.type.name);return n.copy(e)}function wa(n,e,t,r,o){let i=n.depth>o&&Di(n,e,o+1),s=r.depth>o&&Di(t,r,o+1),l=[];return qn(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(ka(i,s),zt(Ft(i,wa(n,e,t,r,o+1)),l)):(i&&zt(Ft(i,Vr(n,e,o+1)),l),qn(e,t,o,l),s&&zt(Ft(s,Vr(t,r,o+1)),l)),qn(r,null,o,l),new A(l)}function Vr(n,e,t){let r=[];if(qn(null,n,t,r),n.depth>t){let o=Di(n,e,t+1);zt(Ft(o,Vr(n,e,t+1)),r)}return qn(e,null,t,r),new A(r)}function bm(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(A.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}function xa(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function oa(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${r}`);for(let o in n)n[o].validate&&n[o].validate(e[o])}function Sa(n){let e=[];do e.push(km(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function km(n){let e=[];do e.push(wm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function wm(n){let e=Mm(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=xm(n,e);else break;return e}function ia(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function xm(n,e){let t=ia(n),r=t;return n.eat(",")&&(n.next!="}"?r=ia(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Sm(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Mm(n){if(n.eat("(")){let e=Sa(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Sm(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Cm(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Ma(n,e){return e-n}function sa(n,e){let t=[];return r(e),t.sort(Ma);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Em(n){let e=Object.create(null);return t(sa(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);sa(n,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new _t(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Ma);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function Am(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ca(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ea(n,e){let t=Object.create(null);for(let r in n){let o=n[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);t[r]=i}return t}function Aa(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Bi(n,r,e[r]);return t}function Tm(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}function la(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Nm(n){return n.tag!=null}function Lm(n){return n.style!=null}function aa(n,e,t){return e!=null?(e?Kn:0)|(e==="full"?Hi:0):n&&n.whitespace=="pre"?Kn|Hi:t&~Wn}function Dm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Na.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Rm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ca(n){let e={};for(let t in n)e[t]=n[t];return e}function ua(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}function da(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Fr(n){return n.document||window.document}function Pm(n){let e=fa.get(n);return e===void 0&&fa.set(n,e=Im(n)),e}function Im(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function $r(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Pm(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 s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(n.createTextNode(f));else{let{dom:p,contentDOM:h}=$r(n,f,t,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}var A,Oi,W,xt,O,qr,Ri,ym,na,$t,vm,De,ra,Pi,_t,Ii,lt,Bi,Un,jn,St,Ta,Om,Na,Kn,Hi,Wn,fn,Wr,je,fa,de=P(()=>{"use strict";ta();A=class n{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new n(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new n(r,o)}cutByIndex(e,t){return e==t?n.empty:e==0&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new n(o,i)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return pa(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return ha(this,e,t,r)}findIndex(e){if(e==0)return zr(0,e);if(e==this.size)return zr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),i=r+o.nodeSize;if(i>=e)return i==e?zr(t+1,i):zr(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return n.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new n(t||e,r)}static from(e){if(!e)return n.empty;if(e instanceof n)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new n([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};A.empty=new A([],0);Oi={index:0,offset:0};W=class n{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_r(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return n.none;if(e instanceof n)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};W.none=[];xt=class extends Error{},O=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ya(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(ba(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return n.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(A.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new n(e,r,o)}};O.empty=new O(A.empty,0,0);qr=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return W.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new $t(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new n(t,r,i)}static resolveCached(e,t){let r=na.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==t)return s}else na.set(e,r=new Ri);let o=r.elts[r.i]=n.resolve(e,t);return r.i=(r.i+1)%ym,o}},Ri=class{constructor(){this.elts=[],this.i=0}},ym=12,na=new WeakMap,$t=class{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},vm=Object.create(null),De=class n{constructor(e,t,r,o=W.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&_r(this.attrs,t||e.defaultAttrs||vm)&&W.sameSet(this.marks,r||W.none)}copy(e=null){return e==this.content?this:new n(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return O.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new O(c,o.depth-s,i.depth-s)}replace(e,t,r){return gm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return qr.resolveCached(this,e)}resolveNoCache(e){return qr.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),xa(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),oa(this.type.attrs,this.attrs,"node",this.type.name);let e=W.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];oa(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!W.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=A.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};De.prototype.text=void 0;ra=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})(),Pi=class n extends De{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return ra(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(ra(this.text.slice(e,t)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};_t=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ii(e,t);if(r.next==null)return n.empty;let o=Sa(r);r.next&&r.err("Unexpected trailing text");let i=Em(Cm(o));return Am(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
|
-
|
|
3
|
-
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Na.hasOwnProperty(s)&&this.parser.normalizeLists&&Dm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Om.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Ta.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
-
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)t=this.enterInner(o[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=W.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):ua(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,r,o){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,o)),i}enterInner(e,t,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=aa(e,i,s.options);s.options&Wn&&s.content.length==0&&(l|=Wn);let a=W.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):ua(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new fn(e,t,a,o,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Kn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};je=class n{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Fr(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){if(e.isText)return Fr(t).createTextNode(e.text);let{dom:r,contentDOM:o}=$r(Fr(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&$r(Fr(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return typeof t=="string"?{dom:e.createTextNode(t)}:$r(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=da(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return da(e.marks)}};fa=new WeakMap});function Bm(n,e){return n+e*Ia}function La(n){return n&Pa}function Hm(n){return(n-(n&Pa))/Ia}function Vi(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Vi(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return A.fromArray(r)}function jr(n,e,t,r,o){let i=o.length?o[o.length-1]:null;i&&i instanceof n&&i.to==e&&i.mark.eq(r)?o[o.length-1]=new n(i.from,t,r):o.push(new n(e,t,r))}function $i(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function zm(n,e,t,r){let o=[];n.doc.nodesBetween(e,t,(i,s,l)=>{if(!i.isInline)return;let a=i.marks;if(!r.isInSet(a)&&l.type.allowsMarkType(r.type)){let c=Math.max(s,e),u=Math.min(s+i.nodeSize,t);jr(Vt,c,u,r,o)}}),o.forEach(i=>n.step(i))}function Fm(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline||!s.isAtom)return;i++;let a=null;if(r instanceof Un){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new Mt(s.from,s.to,s.style)))}function qi(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ve(l,u,O.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Mt(l,u,c.marks[f]));if(o&&c.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new O(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new ve(l+f.index,l+f.index+f[0].length,h))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new O(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function $m(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function qt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,o=0,i=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+o,a=n.$to.indexAfter(r)-i;if(r<n.depth&&s.canReplace(l,a,t))return r;if(r==0||s.type.spec.isolating||!$m(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function _m(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=A.empty,d=0;for(let h=i,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,u=A.from(r.node(h).copy(u)),d++):a--;let f=A.empty,p=0;for(let h=i,m=!1;h>t;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=A.from(o.node(h).copy(f)),p++):c++;n.step(new he(a,c,s,l,new O(u.append(f),d,p),u.size-d,!0))}function gn(n,e,t=null,r=n){let o=Vm(n,e),i=o&&qm(r,e);return i?o.map(Oa).concat({type:e,attrs:t}).concat(i.map(Oa)):null}function Oa(n){return{type:n,attrs:null}}function Vm(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function qm(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Wm(n,e,t){let r=A.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new he(o,i,o,i,new O(r,0,0),t.length,!0))}function Um(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&jm(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&$a(n,s,l,i),qi(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return n.step(new he(d,f,d+1,f-1,new O(A.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Fa(n,s,l,i),!1}})}function Fa(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function $a(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function jm(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Km(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new he(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new O(A.from(s),0,0),1,!0))}function Ct(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=t-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function Jm(n,e,t=1,r){let o=n.doc.resolve(e),i=A.empty,s=A.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=A.from(o.node(l).copy(i));let u=r&&r[c];s=A.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}n.step(new ve(e,e,new O(i.append(s),t,t),!0))}function Wt(n,e){let t=n.resolve(e),r=t.index();return Xm(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Gm(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Xm(n,e){return!!(n&&e&&!n.isLeaf&&Gm(n,e))}function Ym(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);$a(n,u.node(),u.before(),l)}s.inlineContent&&qi(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new ve(c,a.map(e+t,-1),O.empty,!0)),r===!0){let u=n.doc.resolve(c);Fa(n,u.node(),u.before(),n.steps.length)}return n}function Qm(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Gr(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1;for(let a=0;a<2;a++){if(a){if(!l)break;l=-l}let c=r.index(s)+(l>0?1:0),u=r.node(s),d=!1;if(i==1)d=u.canReplace(c,c,o);else{let f=u.contentMatchAt(c).findWrapping(o.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}}return null}function Xr(n,e,t=e,r=O.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return _a(o,i,r)?new ve(e,t,r):new _i(o,i,r).fit()}function _a(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}function Jn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Jn(n.firstChild.content,e-1,t)))}function Gn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Gn(n.lastChild.content,e-1,t)))}function Da(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Va(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Va(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),n.copy(r)}function Fi(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!Zm(t,i.content,s)?l:null}function Zm(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function eg(n){return n.spec.defining||n.spec.definingForContent}function Ra(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function tg(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(_a(o,i,r))return n.step(new ve(e,t,r));let s=Wa(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=eg(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],b=!0;g<0&&(b=!1,g=-g);let x=o.node(g-1),w=o.index(g-1);if(x.canReplaceWith(w,w,h.type,h.marks))return n.replace(o.before(g),b?i.after(g):t,new O(qa(r.content,0,r.openStart,p),p,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),t=i.after(p))}}function qa(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(qa(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return n}function ng(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Qm(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new O(A.from(r),0,0))}function rg(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(t),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=o.depth;a>s;a--)o.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=o.depth;a>0&&t==o.start(a);a--)t=o.before(a);r=n.doc.resolve(e),o=n.doc.resolve(t)}}let i=Wa(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Wa(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}var Pa,Ia,Ba,Ha,Ur,za,Xn,at,Yn,zi,le,pe,Vt,Mt,Qn,Zn,pn,ve,he,_i,Kr,Jr,hn,mn,Ye=P(()=>{"use strict";de();Pa=65535,Ia=Math.pow(2,16);Ba=1,Ha=2,Ur=4,za=8,Xn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&za)>0}get deletedBefore(){return(this.delInfo&(Ba|Ur))>0}get deletedAfter(){return(this.delInfo&(Ha|Ur))>0}get deletedAcross(){return(this.delInfo&Ur)>0}},at=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=La(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Hm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,p=a+o+(f<0?0:u);if(r)return p;let h=e==(t<0?a:d)?null:Bm(l/3,e-a),m=0;return c&&(m|=e==a?Ha:e==d?Ba:Ur,(t<0?e!=a:e!=d)&&(m|=za)),new Xn(p,m,h)}o+=u-c}return r?e+o:new Xn(e+o,0,null)}touches(e,t){let r=0,o=La(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?n.empty:new n(e<0?[0,-e,0]:[0,0,e])}};at.empty=new at([]);Yn=class n{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new n(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=e.from,r=this._maps.length;t<e.to;t++){let o=e.getMirror(t);o!=null&&(o=o<t&&o>=e.from?r+(o-e.from):void 0),this.appendMap(e._maps[t],o)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.to-1,r=this._maps.length+e._maps.length;t>=e.from;t--){let o=e.getMirror(t);o!=null&&(o=o>t&&o<e.to?r-(o-e.from)-1:void 0),this.appendMap(e._maps[t].invert(),o)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Xn(e,o,null)}},zi=Object.create(null),le=class{getMap(){return at.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zi[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in zi)throw new RangeError("Duplicate use of step JSON ID "+e);return zi[e]=t,t.prototype.jsonID=e,t}},pe=class n{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new n(e,null)}static fail(e){return new n(null,e)}static fromReplace(e,t,r,o){try{return n.ok(e.replace(t,r,o))}catch(i){if(i instanceof xt)return n.fail(i.message);throw i}}};Vt=class n extends le{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new O(Vi(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return pe.fromReplace(e,this.from,this.to,i)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!W.sameSet(i,r.marks)){let s=Math.max(this.from,o),l=Math.min(this.to,o+r.nodeSize);jr(Mt,s,l,this.mark,t);for(let a of r.marks)a.isInSet(i)||jr(n,s,l,a,t)}}}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};le.jsonID("addMark",Vt);Mt=class n extends le{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new O(Vi(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&jr(Vt,Math.max(this.from,o),Math.min(this.to,o+r.nodeSize),this.mark,t)}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};le.jsonID("removeMark",Mt);Qn=class n extends le{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let r=t.apply(e);if(!r.doc)return r;e=r.doc}return new pe(e,null)}invert(e){return new n(this.steps.map(t=>t.invert(e)))}map(e){let t=[];for(let r of this.steps){let o=r.map(e);o&&t.push(o)}return t.length?new n(t):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,t){if(!Array.isArray(t.steps)||!t.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new n(t.steps.map(r=>le.fromJSON(e,r)))}};le.jsonID("markSet",Qn);Zn=class n extends le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return pe.fromReplace(e,this.pos,this.pos+1,new O(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new pn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};le.jsonID("addNodeMark",Zn);pn=class n extends le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return pe.fromReplace(e,this.pos,this.pos+1,new O(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Zn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};le.jsonID("removeNodeMark",pn);ve=class n extends le{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&$i(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new at([this.from,this.to-this.from,this.slice.size])}invert(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&n.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new n(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}};ve.MAP_BIAS=1;le.jsonID("replace",ve);he=class n extends le{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&($i(e,this.from,this.gapFrom)||$i(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new at([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos||o>i?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}};le.jsonID("replaceAround",he);_i=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=A.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new O(i,s,l);return e>-1?new he(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new ve(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Da(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(A.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return Ra(e,-1)<=t?!1:(this.unplaced.size>1&&Ra(e,1)>r&&r++,this.unplaced=new O(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Da(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new O(Jn(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new O(Jn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(d=g,u.push(Va(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=Gn(this.placed,t,A.from(u)),this.frontier[t].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=u[u.length-1];g&&m<p;m++)this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),g=g.lastChild;this.unplaced=h?e==0?O.empty:new O(Jn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new O(Jn(s.content,e,c),e,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Fi(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Fi(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Fi(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Gn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Gn(this.placed,this.depth,A.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(A.empty,!0);t.childCount&&(this.placed=Gn(this.placed,this.frontier.length,t))}};Kr=class n extends le{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return pe.fromReplace(e,this.pos,this.pos+1,new O(A.from(o),0,t.isLeaf?0:1))}getMap(){return at.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};le.jsonID("attr",Kr);Jr=class n extends le{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return pe.ok(r)}getMap(){return at.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};le.jsonID("docAttr",Jr);hn=class extends Error{};hn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};hn.prototype=Object.create(Error.prototype);hn.prototype.constructor=hn;hn.prototype.name="TransformError";mn=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Yn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new hn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(e=o.map(e,1),t=o.map(t,-1)),o.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=O.empty){let o=Xr(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new O(A.from(r),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return tg(this,e,t,r),this}replaceRangeWith(e,t,r){return ng(this,e,t,r),this}deleteRange(e,t){return rg(this,e,t),this}lift(e,t){return _m(this,e,t),this}join(e,t=1){return Ym(this,e,t),this}wrap(e,t){return Wm(this,e,t),this}setBlockType(e,t=e,r,o=null){return Um(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Km(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Kr(e,t,r)),this}setDocAttribute(e,t){return this.step(new Jr(e,t)),this}addNodeMark(e,t){return this.step(new Zn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof W)t.isInSet(r.marks)&&this.step(new pn(e,t));else{let o=r.marks,i,s=[];for(;i=t.isInSet(o);)s.push(new pn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return Jm(this,e,t,r),this}addMark(e,t,r){return zm(this,e,t,r),this}removeMark(e,t,r){return Fm(this,e,t,r),this}clearIncompatible(e,t,r){return qi(this,e,t,r),this}}});function ja(n){!Ua&&!n.parent.inlineContent&&(Ua=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}function bn(n,e,t,r,o,i=!1){if(e.inlineContent)return H.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&B.isSelectable(l))return B.create(n,t-(o<0?l.nodeSize:0))}else{let a=bn(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function Ka(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof ve||o instanceof he))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(F.near(n.doc.resolve(s),t))}function Xa(n,e){return!e||!n?n:n.bind(e)}function Ya(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ya(o,e,{})),t[r]=o}return t}function Qa(n){return n in Ui?n+"$"+ ++Ui[n]:(Ui[n]=0,n+"$")}var Wi,F,Et,Ua,H,Qr,B,ji,me,og,Ja,Yr,Ga,Ki,Ut,ig,er,yn,_,Ui,J,K=P(()=>{"use strict";de();Ye();Wi=Object.create(null),F=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Et(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=O.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?O.empty:t),l==0&&Ka(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Ka(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new H(e):bn(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?bn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):bn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new me(e.node(0))}static atStart(e){return bn(e,e,0,0,1)||new me(e)}static atEnd(e){return bn(e,e,e.content.size,e.childCount,-1)||new me(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Wi[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Wi)throw new RangeError("Duplicate use of selection JSON ID "+e);return Wi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}};F.prototype.visible=!0;Et=class{constructor(e,t){this.$from=e,this.$to=t}},Ua=!1;H=class n extends F{constructor(e,t=e){ja(e),ja(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return F.near(r);let o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Qr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=F.findFrom(t,r,!0)||F.findFrom(t,-r,!0);if(i)t=i.$head;else return F.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(F.findFrom(e,-r,!0)||F.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new n(e,t)}};F.jsonID("text",H);Qr=class n{constructor(e,t){this.anchor=e,this.head=t}map(e){return new n(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}},B=class n extends F{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?F.near(i):new n(i)}content(){return new O(A.from(this.node),0,0)}eq(e){return e instanceof n&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ji(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}static create(e,t){return new n(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};B.prototype.visible=!1;F.jsonID("node",B);ji=class n{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Qr(r,r):new n(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&B.isSelectable(r)?new B(t):F.near(t)}},me=class n extends F{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let r=F.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new n(e)}map(e){return new n(e)}eq(e){return e instanceof n}getBookmark(){return og}};F.jsonID("all",me);og={map(){return this},resolve(n){return new me(n)}};Ja=1,Yr=2,Ga=4,Ki=class extends mn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Ja)&~Yr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ja)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Yr,this}ensureMarks(e){return W.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Yr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Yr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||W.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(F.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ga,this}get scrolledIntoView(){return(this.updated&Ga)>0}};Ut=class{constructor(e,t,r){this.name=e,this.init=Xa(t.init,r),this.apply=Xa(t.apply,r)}},ig=[new Ut("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ut("selection",{init(n,e){return n.selection||F.atStart(e.doc)},apply(n){return n.selection}}),new Ut("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ut("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],er=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ig.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ut(r.key,r.spec.state,r))})}},yn=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new n(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new Ki(this)}static create(e){let t=new er(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new n(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new er(this.schema,e.plugins),r=t.fields,o=new n(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new er(e.schema,e.plugins),i=new n(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=De.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=F.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}};_=class{constructor(e){this.spec=e,this.props={},e.props&&Ya(e.props,this,this.props),this.key=e.key?e.key.key:Qa("plugin")}getState(e){return e[this.key]}},Ui=Object.create(null);J=class{constructor(e="key"){this.key=Qa(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}});function v(n,e={},...t){let r=document.createElement(n);for(let[o,i]of Object.entries(e))i==null||i===!1||(typeof i=="function"?r.addEventListener(o.replace(/^on/,"").toLowerCase(),i):o==="className"?r.className=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of t.flat())o==null||o===!1||r.append(o);return r}function X(n){let e=document.createElement("span");return e.className="nova-icon",e.innerHTML=n,e}function Ce(n="nova"){return Za+=1,`${n}-${Za}`}function Qe(n){let e=n.split("-"),t=e.pop(),r=t.length===1?t.toUpperCase():t;if(sg){let i={Mod:"\u2318",Shift:"\u21E7",Alt:"\u2325",Ctrl:"\u2303"};return e.map(s=>i[s]??s).join("")+r}let o={Mod:"Ctrl",Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl"};return[...e.map(i=>o[i]??i),r].join("+")}var Za,sg,Ji,Z=P(()=>{"use strict";Za=0;sg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);Ji='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'});function ec(n){let e=Ce("nova-dialog-title"),t=v("p",{className:"nova-dialog-error",role:"alert",hidden:!0}),r=v("button",{type:"submit",className:"nova-button nova-button-primary",hidden:!n.submitLabel},n.submitLabel??""),o=v("button",{type:"button",className:"nova-button"},n.cancelLabel),i=v("button",{type:"button",className:"nova-btn nova-dialog-close","aria-label":n.closeLabel},X(M.close)),s=v("form",{className:n.size==="large"?"nova-dialog nova-dialog-large":"nova-dialog",role:"dialog","aria-modal":"true","aria-labelledby":e,novalidate:!0},v("header",{className:"nova-dialog-header"},v("h2",{id:e},n.title),i),v("div",{className:"nova-dialog-body"},n.body,t),v("footer",{className:"nova-dialog-footer"},o,r)),l=v("div",{className:"nova-dialog-backdrop"},s);n.host.append(l);let a=!1,c=()=>{a||(a=!0,l.remove(),document.removeEventListener("focusin",f,!0),n.onClose?.(),n.returnFocus?.())},u=h=>{t.hidden=!h,t.textContent=h??""},d=h=>{r.disabled=h,s.setAttribute("aria-busy",String(h))};s.addEventListener("submit",async h=>{h.preventDefault(),u(null),d(!0);try{let m=n.onSubmit?await n.onSubmit():!0;typeof m=="string"?u(m):m!==!1&&c()}finally{a||d(!1)}}),o.addEventListener("click",c),i.addEventListener("click",c),l.addEventListener("mousedown",h=>{h.target===l&&c()}),s.addEventListener("keydown",h=>{if(h.key==="Escape")h.preventDefault(),h.stopPropagation(),c();else if(h.key==="Tab"){let m=[...s.querySelectorAll(Ji)].filter(x=>!x.hidden),g=m[0],b=m[m.length-1];if(!g||!b)return;h.shiftKey&&document.activeElement===g?(h.preventDefault(),b.focus()):!h.shiftKey&&document.activeElement===b&&(h.preventDefault(),g.focus())}});let f=h=>{s.contains(h.target)||(s.querySelector(Ji)??s).focus()};return document.addEventListener("focusin",f,!0),(n.initialFocus??s.querySelector(".nova-dialog-body input, .nova-dialog-body textarea")??(n.submitLabel?r:o)).focus(),{el:s,close:c,setError:u,setBusy:d}}function ce(n){let e=Ce("nova-field"),t=n.hint?`${e}-hint`:void 0,r=v("input",{id:e,type:n.type??"text",className:"nova-input",value:n.value??"",placeholder:n.placeholder,required:n.required??!1,autocomplete:n.autocomplete??"off",spellcheck:"false","aria-describedby":t});return r.value=n.value??"",{el:v("div",{className:"nova-field"},v("label",{for:e,className:"nova-label"},n.label),r,n.hint?v("p",{id:t,className:"nova-hint"},n.hint):null),input:r}}function tc(n,e=!1){let t=Ce("nova-check"),r=v("input",{id:t,type:"checkbox",className:"nova-checkbox"});return r.checked=e,{el:v("div",{className:"nova-field nova-field-inline"},r,v("label",{for:t},n)),input:r}}function tr(n){let e=Ce("nova-field"),t=v("select",{id:e,className:"nova-input nova-select"},...n.options.map(o=>v("option",{value:o.value},o.label)));return t.value=n.value,{el:v("div",{className:"nova-field"},v("label",{for:e,className:"nova-label"},n.label),t),select:t}}var At=P(()=>{"use strict";Z();j()});function V(n,e){let t=(n.options.language??"en").toLowerCase();return e[t]??e[t.split("-")[0]]??e.en}function vn(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.insertText(e).scrollIntoView()),n.focus()}function Zr(n){let e=v("input",{type:"search",className:"nova-input nova-symbols-search",placeholder:n.searchLabel,"aria-label":n.searchLabel}),t=v("div",{className:"nova-symbols-list"}),r=v("div",{className:`nova-symbols ${n.className}`},e,t),o=i=>{let s=i.trim().toLowerCase(),l=n.groups.map(a=>({title:a.title,items:s?a.items.filter(([c,u])=>u.includes(s)||c===s):a.items})).filter(a=>a.items.length);if(!l.length){t.replaceChildren(v("div",{className:"nova-symbols-empty"},n.emptyText));return}t.replaceChildren(...l.map(a=>v("div",{className:"nova-symbols-group",role:"group","aria-label":a.title},v("div",{className:"nova-symbols-title"},a.title),v("div",{className:"nova-symbols-grid"},...a.items.map(([c,u])=>v("button",{type:"button",className:"nova-symbols-cell",title:u,"aria-label":u,onclick:()=>n.onPick(c)},c))))))};return e.addEventListener("input",()=>o(e.value)),e.addEventListener("keydown",i=>{i.key==="ArrowDown"?(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.focus()):i.key==="Enter"&&(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.click())}),t.addEventListener("keydown",i=>{let s=[...t.querySelectorAll(".nova-symbols-cell")],l=s.indexOf(document.activeElement);if(l<0)return;let a=Math.max(1,s.filter(d=>d.offsetTop===s[0].offsetTop).length),c={ArrowRight:1,ArrowLeft:-1,ArrowDown:a,ArrowUp:-a};if(!(i.key in c))return;i.preventDefault();let u=l+c[i.key];u<0?e.focus():s[Math.min(s.length-1,u)]?.focus()}),o(""),queueMicrotask(()=>e.focus()),r}function eo(n,e,t){let r=null,o=t(()=>r?.close());r=n.ui.openDialog({title:e,body:o,cancelLabel:n.ui.t("dialog.close")})}var ke=P(()=>{"use strict";Z()});function Sn(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e}function ut(n,e,t){let r=Zi||(Zi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r}function ag(){Zi=null}function no(n,e,t,r){return t&&(ic(n,e,t,r,-1)||ic(n,e,t,r,1))}function ic(n,e,t,r,o){for(var i;;){if(n==t&&e==r)return!0;if(e==(o<0?0:xe(n))){let s=n.parentNode;if(!s||!$(s)||ro(n)||oc.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ee(n)+(o<0?0:1),n=s}else if($(n)){let s=n.childNodes[e+(o<0?-1:0)];if($(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else{if(ro(s)||oc.test(s.nodeName))return!1;n=s,e=o<0?xe(n):0}}else return!1}}function xe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $(n){return n.nodeType==1}function ge(n){return n.nodeType==3}function Mn(n,e){return e?n.contains($(e)?e:e.parentNode):!1}function Hc(n,e){for(;;){if(ge(n)&&e)return n;if($(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=xe(n)}else if(n.parentNode&&!ro(n,!0))e=Ee(n),n=n.parentNode;else return null}}function zc(n,e){for(;;){if(ge(n)&&e<n.nodeValue.length)return n;if($(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!ro(n,!0))e=Ee(n)+1,n=n.parentNode;else return null}}function cg(n,e,t){for(let r=e==0,o=e==xe(n);r||o;){if(n==t)return!0;let i=Ee(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==xe(n)}}function ro(n,e=!1){let t;for(let r=n;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&(!e||t.node.isBlock)&&(t.dom==n||t.contentDOM==n)}function po(n){return n.focusNode&&no(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)}function Fc(n,e){n.collapse(e.anchorNode,e.anchorOffset),(e.focusNode!=e.anchorNode||e.focusOffset!=e.anchorOffset)&&n.extend(e.focusNode,e.focusOffset)}function ug(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function dg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(xe(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(xe(r.startContainer),r.startOffset)}}}function hg(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ct(n,e){return typeof n=="number"?n:n[e]}function mg(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function lc(n,e,t){if(!ts(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(!$(s)){s=Sn(s);continue}let l=s==i.body,a=l?hg(i):mg(s),c=0,u=0;if(e.top<a.top+ct(r,"top")?u=-(a.top-e.top+ct(o,"top")):e.bottom>a.bottom-ct(r,"bottom")&&(u=e.bottom-e.top>a.bottom-a.top?e.top+ct(o,"top")-a.top:e.bottom-a.bottom+ct(o,"bottom")),e.left<a.left+ct(r,"left")?c=-(a.left-e.left+ct(o,"left")):e.right>a.right-ct(r,"right")&&(c=e.right-a.right+ct(o,"right")),c||u)if(l)i.defaultView.scrollBy(c,u);else{let f=s.scrollLeft,p=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);let h=s.scrollLeft-f,m=s.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:Sn(s)}}function gg(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Vc(n.dom)}}function Vc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Sn(r));return e}function bg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;qc(t,r==0?0:r-e)}function qc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}function Wc(n){if(n.setActive)return n.setActive();if(kn)return n.focus(kn);let e=Vc(n);n.focus(kn==null?{get preventScroll(){return kn={preventScroll:!0},!0}}:void 0),kn||(kn=!1,qc(e,0))}function Uc(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if($(u))f=u.getClientRects();else if(ge(u))f=ut(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){t=u,r=m,o=m&&ge(t)?{left:h.right<e.left?h.right:h.left,top:e.top}:e,$(u)&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!t&&a&&(t=a,o=c,r=0),t&&ge(t)?yg(t,o):!t||r?{node:n,offset:i}:Uc(t,o)}function yg(n,e){let t=n.nodeValue.length,r=document.createRange(),o;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Tt(r,1);if(s.top!=s.bottom&&gs(e,s)){o={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:n,offset:0}}function gs(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function vg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function kg(n,e,t){let{node:r,offset:o}=Uc(e,t),i=-1;if($(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function wg(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if($(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function jc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if($(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(gs(e,c))return jc(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function xg(n,e){let t=n.dom.ownerDocument,r,o=0,i=fg(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s)){let c=n.dom.getBoundingClientRect();if(!gs(e,c)||(s=jc(n.dom,e,c),!s))return null}if(Te)for(let c=s;r&&c;c=Sn(c))c.draggable&&(r=void 0);if(s=vg(s,e),r){if(Ke&&$(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;ho&&o&&$(r)&&$(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&$(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||!$(r)||r.childNodes[o-1].nodeName!="BR")&&(l=wg(n,r,o,e))}l==null&&(l=kg(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ts(n){return n.top<n.bottom||n.left<n.right}function Tt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(ts(r))return r}return Array.prototype.find.call(t,ts)||n.getBoundingClientRect()}function Kc(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=ho||Ke;if(ge(r))if(s&&(Sg.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=Tt(ut(r,o,o),t);if(Ke&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Tt(ut(r,o-1,o-1),-1);if(c.top==a.top){let u=Tt(ut(r,o,o+1),-1);if(u.top!=a.top)return nr(u,u.left<c.left)}}return a}else{let a=o,c=o,u=t<0?1:-1;return t<0&&!o?(c++,u=-1):t>=0&&o==r.nodeValue.length?(a--,u=1):t<0?a--:c++,nr(Tt(ut(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==xe(r))){let a=r.childNodes[o-1];if($(a))return Gi(a.getBoundingClientRect(),!1)}if(i==null&&o<xe(r)){let a=r.childNodes[o];if($(a))return Gi(a.getBoundingClientRect(),!0)}return Gi(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==xe(r))){let a=r.childNodes[o-1],c=ge(a)?ut(a,xe(a)-(s?0:1)):$(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return nr(Tt(c,1),!1)}if(i==null&&o<xe(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?ge(a)?ut(a,0,s?0:1):$(a)?a:null:null;if(c)return nr(Tt(c,-1),!0)}return nr(Tt(ge(r)?ut(r):r,-t),t>=0)}function nr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Gi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Jc(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Mg(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Jc(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Kc(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if($(l))a=l.getClientRects();else if(ge(l))a=ut(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}function Eg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return l?!Cg.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Jc(n,e,()=>{let a=n.domSel.readRange(),c=l.caretBidiLevel;l.modify("move",t,"character");let u=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:d,focusOffset:f}=n.domSel.readRange(),p=d&&!Mn(u,d)||a.focusNode==d&&a.focusOffset==f;return Fc(l,a),c!=null&&(l.caretBidiLevel=c),p}):r.pos==r.start()||r.pos==r.end()}function Ag(n,e,t){return ac==e&&cc==t?uc:(ac=e,cc=t,uc=t=="up"||t=="down"?Mg(n,e,t):Eg(n,e,t))}function dc(n,e,t,r,o,i){i?bs(r,r,lr(i,n,!1),lr(e,n,!1)):Xc(r,e,n);let s=new Dt(void 0,n,e,t,r,r,r);return s.contentDOM&&s.updateChildren(o,0),s}function Gc(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=fc(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(l,r);if(s instanceof Kt){let a=r?r.previousSibling:n.lastChild;Gc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=fc(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}function lr(n,e,t){if(n.length==0)return jt;let r=t?jt[0]:new or,o=[r];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&o.push(r=new or(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&o.length==1&&o.push(r=new or(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function bs(n,e,t,r){if(t==jt&&r==jt)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=jt[0]),o=a}Tg(o,l||jt[0],s)}return o}function Tg(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function Xc(n,e,t){return bs(n,n,jt,lr(e,t,!$(n)))}function lo(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function fc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}function Ng(n,e){let t=e,r=t.children.length,o=[],i=n.childCount,s=new Map,l=[];e:for(;i>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof Kt)o.push(r-1),t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=o.pop(),t=t.parent}let c=a.node;if(c){if(c!=n.child(i-1))break;--i,s.set(a,i),l.push(a)}}return{index:i,matched:s,matches:l.reverse()}}function Lg(n,e){return n.type.side-e.type.side}function Og(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let g=o[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(Lg);for(let g=0;g<d.length;g++)t(d[g],c,!!a)}else t(u,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<n.childCount)p=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let g=h;s<o.length&&o[s].from<g&&(g=o[s].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<h&&(a=f.cut(g-i),f=f.cut(0,g-i),h=g,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(i,f),p),i=h}}function Dg(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Rg(n,e,t,r){for(let o=0,i=0;o<n.childCount&&i<=r;){let s=n.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function is(n,e,t,r,o){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>t&&i.push(a.slice(t-c,a.size,r)))}return i}function ss(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&F.findFrom(i,e)}function Nt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function pc(n,e,t){let r=n.state.selection;if(r instanceof H)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Nt(n,new H(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=ss(n.state,e);return o&&o instanceof B?Nt(n,o):!1}else if(!qe||t.indexOf("m")<0){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?B.isSelectable(i)?Nt(n,new B(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):Nt(n,new H(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Nt(n,new H(e>0?r.$to:r.$from));{let o=ss(n.state,e);return o?Nt(n,o):!1}}}function ir(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):$(n)&&n.contentEditable=="false"}function wn(n,e){return e<0?Pg(n):Ig(n)}function Pg(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ke&&$(t)&&r<xe(t)&&ir(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(!$(t))break;let l=t.childNodes[r-1];if(ir(l,-1))o=t,i=--r;else if(ge(l))t=l,r=t.nodeValue.length;else break}else{if(Yc(t))break;{let l=t.previousSibling;for(;l&&ir(l,-1);)o=t.parentNode,i=Ee(l),l=l.previousSibling;if(l)t=l,r=xe(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?ls(n,t,r):o&&ls(n,o,i)}function Ig(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=xe(t),i,s;for(;;)if(r<o){if(!$(t))break;let l=t.childNodes[r];if(ir(l,1))i=t,s=++r;else break}else{if(Yc(t))break;{let l=t.nextSibling;for(;l&&ir(l,1);)i=l.parentNode,s=Ee(l)+1,l=l.nextSibling;if(l)t=l,r=0,o=xe(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}i&&ls(n,i,s)}function Yc(n){for(let e=n;e;e=e.parentNode){let t=e.pmViewDesc;if(t)return t.node?t.node.isBlock:!1}return!1}function ls(n,e,t){if(!ge(e)){let s,l;(l=zc(e,t))?(e=l,t=0):(s=Hc(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection(),o=n.domSel.readRange();if(!r)return;po(o)?r.collapse(e,t):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(e,t)),n.domSel.ignore();let{state:i}=n;setTimeout(()=>{n.state==i&&n.domSel.sync()},50)}function hc(n,e){let t=n.state.doc.resolve(e);if(!(Ae||_c)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}let r=n.dom;for(let i=t.depth;i>0;i--)if(t.node(i).isBlock){r=n.nodeDOM(t.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function mc(n,e,t){let r=n.state.selection;if(r instanceof H&&!r.empty||t.indexOf("s")>-1||qe&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=ss(n.state,e);if(s&&s instanceof B)return Nt(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof me?F.near(s,e):F.findFrom(s,e);return l?Nt(n,l):!1}return!1}function gc(n,e){if(!(n.state.selection instanceof H))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function bc(n,e,t){n.domObserver.stopped(()=>e.contentEditable=t)}function Bg(n){if(!Te||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSel.readRange();if(e&&$(e)&&t==0&&e.firstChild&&$(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;bc(n,r,"true"),setTimeout(()=>bc(n,r,"false"),20)}return!1}function Hg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function zg(n,e){let t=e.keyCode,r=Hg(e);if(t==8||qe&&t==72&&r=="c")return gc(n,-1)||wn(n,-1);if(t==46&&!e.shiftKey||qe&&t==68&&r=="c")return gc(n,1)||wn(n,1);if(t==13||t==27)return!0;if(t==37||qe&&t==66&&r=="c"){let o=t==37?hc(n,n.state.selection.from)=="ltr"?-1:1:-1;return pc(n,o,r)||wn(n,o)}else if(t==39||qe&&t==70&&r=="c"){let o=t==39?hc(n,n.state.selection.from)=="ltr"?1:-1:1;return pc(n,o,r)||wn(n,o)}else{if(t==38||qe&&t==80&&r=="c")return mc(n,-1,r)||wn(n,-1);if(t==40||qe&&t==78&&r=="c")return Bg(n)||mc(n,1,r)||wn(n,1);if(r==(qe?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ys(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||je.fromSchema(n.state.schema),l=ru(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&$(c)&&(u=nu[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=l.createElement(u[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}c=a.firstChild}c&&$(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
|
|
1
|
+
/*! NovaProse 0.8.0 | MIT | third-party licenses: tinymce.licenses.txt */
|
|
2
|
+
var __novaChunkBase=typeof document!=="undefined"&&(document.currentScript&&document.currentScript.src||document.baseURI)||"";function __novaChunk(p){return new URL(p,__novaChunkBase).href}
|
|
3
|
+
(()=>{var wy=Object.create;var So=Object.defineProperty;var Sy=Object.getOwnPropertyDescriptor;var My=Object.getOwnPropertyNames;var Ey=Object.getPrototypeOf,Cy=Object.prototype.hasOwnProperty;var Ay=(n,e,t)=>e in n?So(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var _=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var j=(n,e)=>{for(var t in e)So(n,t,{get:e[t],enumerable:!0})},Ty=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of My(e))!Cy.call(n,o)&&o!==t&&So(n,o,{get:()=>e[o],enumerable:!(r=Sy(e,o))||r.enumerable});return n};var I=(n,e,t)=>(t=n!=null?wy(Ey(n)):{},Ty(e||!n||!n.__esModule?So(t,"default",{value:n,enumerable:!0}):t,n));var S=(n,e,t)=>Ay(n,typeof e!="symbol"?e+"":e,t);var sm={};var Rs={};j(Rs,{definePlugin:()=>mu,isPluginRegistered:()=>Mo,loadPlugin:()=>Ps,orderPlugins:()=>On,pageHandlerOf:()=>yr,registerPlugin:()=>V,resolveEntries:()=>br});function yr(n,e){for(let t of n)if(t.page)try{return typeof t.page=="function"?t.page(e):t.page}catch(r){console.error(`[nova] Plugin "${t.name}" failed to set up its page`,r)}return null}function mu(n){return n}var Ls=new Map;function V(n,e){Ls.set(n,e)}function Mo(n){return Ls.has(n)}function hu(n){return typeof n=="function"}function br(n){let e=[],t=[],r=[];for(let o of n)if(typeof o=="string"){let i=Ls.get(o);i?hu(i)?t.push(i):e.push(i):r.push(`Plugin "${o}" is not registered`)}else hu(o)?t.push(o):e.push(o);return{plugins:e,loaders:t,errors:r}}function On(n,e=new Set){let t=new Map(n.map(l=>[l.name,l])),r=[],o=[],i=new Map,s=(l,a)=>{let c=i.get(l.name);if(c==="done")return!0;if(c==="failed")return!1;if(c==="visiting")return o.push(`Plugin dependency cycle: ${[...a,l.name].join(" \u2192 ")}`),!1;i.set(l.name,"visiting");for(let d of l.requires??[]){if(e.has(d))continue;let u=t.get(d);if(!u)return o.push(`Plugin "${l.name}" requires "${d}", which is not loaded`),i.set(l.name,"failed"),!1;if(!s(u,[...a,l.name]))return i.set(l.name,"failed"),!1}return i.set(l.name,"done"),r.push(l),!0};for(let l of n)s(l,[]);return{ordered:r,errors:o}}async function Ps(n){let e=await n();return"default"in e&&e.default?e.default:e}var dl={};j(dl,{LABELS:()=>il,default:()=>cl,detailsAround:()=>Mb,isOpen:()=>sl,setOpen:()=>Ep,summaryEnd:()=>ll});var Qs={};j(Qs,{AllSelection:()=>ue,EditorState:()=>cn,NodeSelection:()=>R,Plugin:()=>z,PluginKey:()=>Z,Selection:()=>K,SelectionRange:()=>an,TextSelection:()=>F,Transaction:()=>_o});var Vs={};j(Vs,{ContentMatch:()=>Ft,DOMParser:()=>St,DOMSerializer:()=>Ve,Fragment:()=>N,Mark:()=>Q,MarkType:()=>Pn,Node:()=>Te,NodeRange:()=>Bt,NodeType:()=>it,ReplaceError:()=>wt,ResolvedPos:()=>xr,Schema:()=>Rn,Slice:()=>D});function we(n){this.content=n}we.prototype={constructor:we,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new we(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new we(t)},addToStart:function(n,e){return new we([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new we(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new we(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=we.from(n),n.size?new we(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=we.from(n),n.size?new we(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=we.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};we.from=function(n){if(n instanceof we)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new we(e)};var Ds=we;function Au(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)t++;return a&&a<s.length&&a<l.length&&Ou(s.charCodeAt(a-1))&&Nu(s.charCodeAt(a))&&t--,t}if(o.content.size||i.content.size){let s=Au(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Tu(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=s.text,d=l.text,u=c.length,p=d.length;for(;u>0&&p>0&&c[u-1]==d[p-1];)u--,p--,t--,r--;return u&&p&&u<c.length&&Ou(c.charCodeAt(u-1))&&Nu(c.charCodeAt(u))&&(t++,r++),{a:t,b:r}}if(s.content.size||l.content.size){let c=Tu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}function Nu(n){return n>=56320&&n<57344}function Ou(n){return n>=55296&&n<56320}var N=class n{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new n(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new n(r,o)}cutByIndex(e,t){return e==t?n.empty:e==0&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new n(o,i)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Au(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Tu(this,e,t,r)}findIndex(e){if(e==0)return Eo(0,e);if(e==this.size)return Eo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),i=r+o.nodeSize;if(i>=e)return i==e?Eo(t+1,i):Eo(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return n.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new n(t||e,r)}static from(e){if(!e)return n.empty;if(e instanceof n)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new n([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};N.empty=new N([],0);var _s={index:0,offset:0};function Eo(n,e){return _s.index=n,_s.offset=e,_s}function To(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!To(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!To(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}var Q=class n{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&To(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return n.none;if(e instanceof n)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Q.none=[];var wt=class extends Error{},D=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Pu(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(Lu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return n.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(N.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new n(e,r,o)}};D.empty=new D(N.empty,0,0);function Lu(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Lu(i.content,e-o-1,t-o-1)))}function Pu(n,e,t,r,o,i){let{index:s,offset:l}=n.findIndex(e),a=n.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=Pu(a.content,e-l-1,t,s==0?r-1:0,s==n.childCount-1?o-1:0,a);return c&&n.replaceChild(s,a.copy(c))}function Ny(n,e,t){if(t.openStart>n.depth)throw new wt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new wt("Inconsistent open depths");return Ru(n,e,t,0)}function Ru(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=Ru(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return tn(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Oy(t,n);return tn(i,_u(n,s,l,e,r))}else return tn(i,No(n,e,r))}function Du(n,e){if(!e.type.compatibleContent(n.type))throw new wt("Cannot join "+e.type.name+" onto "+n.type.name)}function Is(n,e,t){let r=n.node(t);return Du(r,e.node(t)),r}function en(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function kr(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(en(n.nodeAfter,r),i++));for(let l=i;l<s;l++)en(o.child(l),r);e&&e.depth==t&&e.textOffset&&en(e.nodeBefore,r)}function tn(n,e){if(!n.type.validContent(e))throw new wt("Invalid content for node "+n.type.name);return n.copy(e)}function _u(n,e,t,r,o){let i=n.depth>o&&Is(n,e,o+1),s=r.depth>o&&Is(t,r,o+1),l=[];return kr(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(Du(i,s),en(tn(i,_u(n,e,t,r,o+1)),l)):(i&&en(tn(i,No(n,e,o+1)),l),kr(e,t,o,l),s&&en(tn(s,No(t,r,o+1)),l)),kr(r,null,o,l),new N(l)}function No(n,e,t){let r=[];if(kr(null,n,t,r),n.depth>t){let o=Is(n,e,t+1);en(tn(o,No(n,e,t+1)),r)}return kr(e,null,t,r),new N(r)}function Oy(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(N.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}var xr=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Q.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Bt(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new n(t,r,i)}static resolveCached(e,t){let r=gu.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==t)return s}else gu.set(e,r=new Hs);let o=r.elts[r.i]=n.resolve(e,t);return r.i=(r.i+1)%Ly,o}},Hs=class{constructor(){this.elts=[],this.i=0}},Ly=12,gu=new WeakMap,Bt=class{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Py=Object.create(null),Te=class n{constructor(e,t,r,o=Q.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||N.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&To(this.attrs,t||e.defaultAttrs||Py)&&Q.sameSet(this.marks,r||Q.none)}copy(e=null){return e==this.content?this:new n(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return D.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new D(c,o.depth-s,i.depth-s)}replace(e,t,r){return Ny(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return xr.resolveCached(this,e)}resolveNoCache(e){return xr.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Iu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=N.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),bu(this.type.attrs,this.attrs,"node",this.type.name);let e=Q.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];bu(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Q.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=N.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Te.prototype.text=void 0;var yu=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})(),Bs=class n extends Te{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Iu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return yu(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(yu(this.text.slice(e,t)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Iu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function bu(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${r}`);for(let o in n)n[o].validate&&n[o].validate(e[o])}var Ft=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Fs(e,t);if(r.next==null)return n.empty;let o=Hu(r);r.next&&r.err("Unexpected trailing text");let i=Fy(By(o));return zy(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return N.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let p=i(u,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
4
|
+
`)}};Ft.empty=new Ft(!0);var Fs=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function Hu(n){let e=[];do e.push(Ry(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ry(n){let e=[];do e.push(Dy(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Dy(n){let e=Hy(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=_y(n,e);else break;return e}function ku(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function _y(n,e){let t=ku(n),r=t;return n.eat(",")&&(n.next!="}"?r=ku(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Iy(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Hy(n){if(n.eat("(")){let e=Hu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Iy(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function By(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=t();o(i(s.expr,a),d),a=d}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=t();r(a,d),o(i(s.expr,a),d),a=d}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Bu(n,e){return e-n}function vu(n,e){let t=[];return r(e),t.sort(Bu);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Fy(n){let e=Object.create(null);return t(vu(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);vu(n,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new Ft(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Bu);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function zy(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Fu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function zu(n,e){let t=Object.create(null);for(let r in n){let o=n[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);t[r]=i}return t}function $u(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new zs(n,r,e[r]);return t}var it=class n{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=$u(e,r.attrs),this.defaultAttrs=Fu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ft.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:zu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Te(this,this.computeAttrs(e),N.from(t),Q.setFrom(r))}createChecked(e=null,t,r){return t=N.from(t),this.checkContent(t),new Te(this,this.computeAttrs(e),t,Q.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=N.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(N.empty,!0);return i?new Te(this,e,t.append(i),Q.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Q.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new n(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function $y(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}var zs=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$y(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Pn=class n{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=$u(e,o.attrs),this.excluded=null;let i=Fu(this.attrs);this.instance=i?new Q(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Q(this,zu(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new n(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}},Rn=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Ds.from(e.nodes),t.marks=Ds.from(e.marks||{}),this.nodes=it.compile(this.spec.nodes,this),this.marks=Pn.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Ft.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?xu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:xu(this,s.split(" "))}this.nodeFromJSON=o=>Te.fromJSON(this,o),this.markFromJSON=o=>Q.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof it){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Bs(r,r.defaultAttrs,e,Q.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function xu(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Vy(n){return n.tag!=null}function qy(n){return n.style!=null}var St=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(Vy(o))this.tags.push(o);else if(qy(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Oo(this,t,!1);return r.addAll(e,Q.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Oo(this,t,!0);return r.addAll(e,Q.none,t.from,t.to),D.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Ky(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Su(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Su(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},Vu={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},jy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},qu={ol:!0,ul:!0},wr=1,$s=2,vr=4;function wu(n,e,t){return e!=null?(e?wr:0)|(e==="full"?$s:0):n&&n.whitespace=="pre"?wr|$s:t&~vr}var Ln=class{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Q.none,this.match=i||(s&vr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(N.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=N.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(N.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Oo=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=wu(null,t.preserveWhitespace,0)|(r?vr:0);o?i=new Ln(o.type,o.attrs,Q.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new Ln(null,null,Q.none,!0,null,s):i=new Ln(e.schema.topNodeType,null,Q.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&$s?"full":this.localPreserveWS||(o.options&wr)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
5
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;qu.hasOwnProperty(s)&&this.parser.normalizeLists&&Wy(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:jy.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Vu.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
6
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)t=this.enterInner(o[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Q.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Mu(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,r,o){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,o)),i}enterInner(e,t,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=wu(e,i,s.options);s.options&vr&&s.content.length==0&&(l|=vr);let a=Q.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Mu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ln(e,t,a,o,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};function Wy(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&qu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ky(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Su(n){let e={};for(let t in n)e[t]=n[t];return e}function Mu(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||i.indexOf(d)<0&&s(d))return!0}};if(s(o.contentMatch))return!0}}var Ve=class n{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Co(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],d=this.serializeMark(c,s.isInline,t);d&&(i.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){if(e.isText)return Co(t).createTextNode(e.text);let{dom:r,contentDOM:o}=Ao(Co(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Ao(Co(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return typeof t=="string"?{dom:e.createTextNode(t)}:Ao(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Eu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Eu(e.marks)}};function Eu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Co(n){return n.document||window.document}var Cu=new WeakMap;function Uy(n){let e=Cu.get(n);return e===void 0&&Cu.set(n,e=Jy(n)),e}function Jy(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function Ao(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Uy(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 s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let p=e[u];if(p===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof p=="string")a.appendChild(n.createTextNode(p));else{let{dom:f,contentDOM:h}=Ao(n,p,t,r);if(a.appendChild(f),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}var Gs={};j(Gs,{AddMarkStep:()=>Ue,AddNodeMarkStep:()=>In,AttrStep:()=>rn,DocAttrStep:()=>Cr,MapResult:()=>Dn,Mapping:()=>_n,RemoveMarkStep:()=>Je,RemoveNodeMarkStep:()=>nn,ReplaceAroundStep:()=>re,ReplaceStep:()=>le,Step:()=>oe,StepMap:()=>st,StepResult:()=>me,Transform:()=>Mt,TransformError:()=>on,canJoin:()=>at,canSplit:()=>Et,dropPoint:()=>Ar,findWrapping:()=>sn,insertPoint:()=>rp,joinPoint:()=>np,liftTarget:()=>lt,replaceStep:()=>Tr});var Ju=65535,Gu=Math.pow(2,16);function Gy(n,e){return n+e*Gu}function ju(n){return n&Ju}function Yy(n){return(n-(n&Ju))/Gu}var Yu=1,Xu=2,Lo=4,Zu=8,Dn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Zu)>0}get deletedBefore(){return(this.delInfo&(Yu|Lo))>0}get deletedAfter(){return(this.delInfo&(Xu|Lo))>0}get deletedAcross(){return(this.delInfo&Lo)>0}},st=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=ju(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Yy(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],d=this.ranges[l+s],u=a+c;if(e<=u){let p=c?e==a?-1:e==u?1:t:t,f=a+o+(p<0?0:d);if(r)return f;let h=e==(t<0?a:u)?null:Gy(l/3,e-a),m=0;return c&&(m|=e==a?Xu:e==u?Yu:Lo,(t<0?e!=a:e!=u)&&(m|=Zu)),new Dn(f,m,h)}o+=d-c}return r?e+o:new Dn(e+o,0,null)}touches(e,t){let r=0,o=ju(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],d=a+c;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],d=this.ranges[o+r];e(l,l+c,a,a+d),i+=d-c}}invert(){return new n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?n.empty:new n(e<0?[0,-e,0]:[0,0,e])}};st.empty=new st([]);var _n=class n{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new n(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=e.from,r=this._maps.length;t<e.to;t++){let o=e.getMirror(t);o!=null&&(o=o<t&&o>=e.from?r+(o-e.from):void 0),this.appendMap(e._maps[t],o)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.to-1,r=this._maps.length+e._maps.length;t>=e.from;t--){let o=e.getMirror(t);o!=null&&(o=o>t&&o<e.to?r-(o-e.from)-1:void 0),this.appendMap(e._maps[t].invert(),o)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Dn(e,o,null)}},qs=Object.create(null),oe=class{getMap(){return st.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=qs[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in qs)throw new RangeError("Duplicate use of step JSON ID "+e);return qs[e]=t,t.prototype.jsonID=e,t}},me=class n{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new n(e,null)}static fail(e){return new n(null,e)}static fromReplace(e,t,r,o){try{return n.ok(e.replace(t,r,o))}catch(i){if(i instanceof wt)return n.fail(i.message);throw i}}};function Us(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Us(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return N.fromArray(r)}var Ue=class n extends oe{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new D(Us(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,i)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!Q.sameSet(i,r.marks)){let s=Math.max(this.from,o),l=Math.min(this.to,o+r.nodeSize);Po(Je,s,l,this.mark,t);for(let a of r.marks)a.isInSet(i)||Po(n,s,l,a,t)}}}),t.length==1?t[0]:new Er(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};oe.jsonID("addMark",Ue);var Je=class n extends oe{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new D(Us(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&Po(Ue,Math.max(this.from,o),Math.min(this.to,o+r.nodeSize),this.mark,t)}),t.length==1?t[0]:new Er(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};oe.jsonID("removeMark",Je);function Po(n,e,t,r,o){let i=o.length?o[o.length-1]:null;i&&i instanceof n&&i.to==e&&i.mark.eq(r)?o[o.length-1]=new n(i.from,t,r):o.push(new n(e,t,r))}var Er=class n extends oe{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let r=t.apply(e);if(!r.doc)return r;e=r.doc}return new me(e,null)}invert(e){return new n(this.steps.map(t=>t.invert(e)))}map(e){let t=[];for(let r of this.steps){let o=r.map(e);o&&t.push(o)}return t.length?new n(t):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,t){if(!Array.isArray(t.steps)||!t.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new n(t.steps.map(r=>oe.fromJSON(e,r)))}};oe.jsonID("markSet",Er);var In=class n extends oe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new D(N.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new nn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};oe.jsonID("addNodeMark",In);var nn=class n extends oe{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new D(N.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new In(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};oe.jsonID("removeNodeMark",nn);var le=class n extends oe{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Ws(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new st([this.from,this.to-this.from,this.slice.size])}invert(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&n.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new n(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,D.fromJSON(e,t.slice),!!t.structure)}};le.MAP_BIAS=1;oe.jsonID("replace",le);var re=class n extends oe{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ws(e,this.from,this.gapFrom)||Ws(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?me.fromReplace(e,this.from,this.to,r):me.fail("Content does not fit in gap")}getMap(){return new st([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos||o>i?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,D.fromJSON(e,t.slice),t.insert,!!t.structure)}};oe.jsonID("replaceAround",re);function Ws(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Xy(n,e,t,r){let o=[];n.doc.nodesBetween(e,t,(i,s,l)=>{if(!i.isInline)return;let a=i.marks;if(!r.isInSet(a)&&l.type.allowsMarkType(r.type)){let c=Math.max(s,e),d=Math.min(s+i.nodeSize,t);Po(Ue,c,d,r,o)}}),o.forEach(i=>n.step(i))}function Zy(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline||!s.isAtom)return;i++;let a=null;if(r instanceof Pn){let c=s.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],p;for(let f=0;f<o.length;f++){let h=o[f];h.step==i-1&&u.eq(o[f].style)&&(p=h)}p?(p.to=c,p.step=i):o.push({style:u,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new Je(s.from,s.to,s.style)))}function Js(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new le(l,d,D.empty));else{r=u;for(let p=0;p<c.marks.length;p++)t.allowsMarkType(c.marks[p].type)||n.step(new Je(l,d,c.marks[p]));if(o&&c.isText&&t.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new D(N.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new le(l+p.index,l+p.index+p[0].length,h))}}l=d}if(!r.validEnd){let a=r.fillBefore(N.empty,!0);n.replace(l,l,new D(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Qy(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function lt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,o=0,i=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+o,a=n.$to.indexAfter(r)-i;if(r<n.depth&&s.canReplace(l,a,t))return r;if(r==0||s.type.spec.isolating||!Qy(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function eb(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,d=N.empty,u=0;for(let h=i,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,d=N.from(r.node(h).copy(d)),u++):a--;let p=N.empty,f=0;for(let h=i,m=!1;h>t;h--)m||o.after(h+1)<o.end(h)?(m=!0,p=N.from(o.node(h).copy(p)),f++):c++;n.step(new re(a,c,s,l,new D(d.append(p),u,f),d.size-u,!0))}function sn(n,e,t=null,r=n){let o=tb(n,e),i=o&&nb(r,e);return i?o.map(Wu).concat({type:e,attrs:t}).concat(i.map(Wu)):null}function Wu(n){return{type:n,attrs:null}}function tb(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function nb(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function rb(n,e,t){let r=N.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=N.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new re(o,i,o,i,new D(r,0,0),t.length,!0))}function ob(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&ib(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&ep(n,s,l,i),Js(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new re(u,p,u+1,p-1,new D(N.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Qu(n,s,l,i),!1}})}function Qu(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ep(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
7
|
+
`))}})}function ib(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function sb(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new re(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(N.from(s),0,0),1,!0))}function Et(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),p=o.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(p,u.childCount),h=r&&r[d+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[d]||u;if(!u.canReplace(p+1,u.childCount)||!m.type.validContent(f))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function lb(n,e,t=1,r){let o=n.doc.resolve(e),i=N.empty,s=N.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=N.from(o.node(l).copy(i));let d=r&&r[c];s=N.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}n.step(new le(e,e,new D(i.append(s),t,t),!0))}function at(n,e){let t=n.resolve(e),r=t.index();return tp(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function ab(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function tp(n,e){return!!(n&&e&&!n.isLeaf&&ab(n,e))}function np(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):t>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&tp(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function cb(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);ep(n,d.node(),d.before(),l)}s.inlineContent&&Js(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new le(c,a.map(e+t,-1),D.empty,!0)),r===!0){let d=n.doc.resolve(c);Qu(n,d.node(),d.before(),n.steps.length)}return n}function rp(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Ar(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1;for(let a=0;a<2;a++){if(a){if(!l)break;l=-l}let c=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(i==1)u=d.canReplace(c,c,o);else{let p=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}}return null}function Tr(n,e,t=e,r=D.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return op(o,i,r)?new le(e,t,r):new Ks(o,i,r).fit()}function op(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}var Ks=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=N.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=N.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new D(i,s,l);return e>-1?new re(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new le(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Ku(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(N.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:u};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return Uu(e,-1)<=t?!1:(this.unplaced.size>1&&Uu(e,1)>r&&r++,this.unplaced=new D(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Ku(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new D(Sr(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new D(Sr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,d=[],{match:u,type:p}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)d.push(o.child(m));u=u.matchFragment(o)}let f=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,d.push(ip(m.mark(p.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let h=c==l.childCount;h||(f=-1),this.placed=Mr(this.placed,t,N.from(d)),this.frontier[t].match=u,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=d[d.length-1];g&&m<f;m++)this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),g=g.lastChild;this.unplaced=h?e==0?D.empty:new D(Sr(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new D(Sr(s.content,e,c),e,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!js(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=js(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=js(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Mr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Mr(this.placed,this.depth,N.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(N.empty,!0);t.childCount&&(this.placed=Mr(this.placed,this.frontier.length,t))}};function Sr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Sr(n.firstChild.content,e-1,t)))}function Mr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Mr(n.lastChild.content,e-1,t)))}function Ku(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ip(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ip(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(N.empty,!0)))),n.copy(r)}function js(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!db(t,i.content,s)?l:null}function db(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function ub(n){return n.spec.defining||n.spec.definingForContent}function Uu(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function pb(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(op(o,i,r))return n.step(new le(e,t,r));let s=lp(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let h=o.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?l=p:o.before(p)==f&&s.splice(1,0,-p)}let a=s.indexOf(l),c=[],d=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=d-1;p>=0;p--){let f=c[p],h=ub(f.type);if(h&&!f.sameMarkup(o.node(Math.abs(l)-1)))d=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+d+1)%(r.openStart+1),h=c[f];if(h)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let x=o.node(g-1),M=o.index(g-1);if(x.canReplaceWith(M,M,h.type,h.marks))return n.replace(o.before(g),y?i.after(g):t,new D(sp(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,r),!(n.steps.length>u));p--){let f=s[p];f<0||(e=o.before(f),t=i.after(f))}}function sp(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(sp(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(N.empty,!0))}return n}function fb(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=rp(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new D(N.from(r),0,0))}function hb(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(t),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=o.depth;a>s;a--)o.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=o.depth;a>0&&t==o.start(a);a--)t=o.before(a);r=n.doc.resolve(e),o=n.doc.resolve(t)}}let i=lp(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function lp(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}var rn=class n extends oe{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return me.fromReplace(e,this.pos,this.pos+1,new D(N.from(o),0,t.isLeaf?0:1))}getMap(){return st.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};oe.jsonID("attr",rn);var Cr=class n extends oe{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return me.ok(r)}getMap(){return st.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};oe.jsonID("docAttr",Cr);var on=class extends Error{};on=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};on.prototype=Object.create(Error.prototype);on.prototype.constructor=on;on.prototype.name="TransformError";var Mt=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new _n}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new on(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(e=o.map(e,1),t=o.map(t,-1)),o.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=D.empty){let o=Tr(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new D(N.from(r),0,0))}delete(e,t){return this.replace(e,t,D.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return pb(this,e,t,r),this}replaceRangeWith(e,t,r){return fb(this,e,t,r),this}deleteRange(e,t){return hb(this,e,t),this}lift(e,t){return eb(this,e,t),this}join(e,t=1){return cb(this,e,t),this}wrap(e,t){return rb(this,e,t),this}setBlockType(e,t=e,r,o=null){return ob(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return sb(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new rn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Cr(e,t)),this}addNodeMark(e,t){return this.step(new In(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Q)t.isInSet(r.marks)&&this.step(new nn(e,t));else{let o=r.marks,i,s=[];for(;i=t.isInSet(o);)s.push(new nn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return lb(this,e,t,r),this}addMark(e,t,r){return Xy(this,e,t,r),this}removeMark(e,t,r){return Zy(this,e,t,r),this}clearIncompatible(e,t,r){return Js(this,e,t,r),this}};var Ys=Object.create(null),K=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new an(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=D.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?D.empty:t),l==0&&dp(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),dp(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new F(e):Hn(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?Hn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Hn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ue(e.node(0))}static atStart(e){return Hn(e,e,0,0,1)||new ue(e)}static atEnd(e){return Hn(e,e,e.content.size,e.childCount,-1)||new ue(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ys[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ys)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ys[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}};K.prototype.visible=!0;var an=class{constructor(e,t){this.$from=e,this.$to=t}},ap=!1;function cp(n){!ap&&!n.parent.inlineContent&&(ap=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var F=class n extends K{constructor(e,t=e){cp(e),cp(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return K.near(r);let o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}replace(e,t=D.empty){if(super.replace(e,t),t==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Do(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=K.findFrom(t,r,!0)||K.findFrom(t,-r,!0);if(i)t=i.$head;else return K.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(K.findFrom(e,-r,!0)||K.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new n(e,t)}};K.jsonID("text",F);var Do=class n{constructor(e,t){this.anchor=e,this.head=t}map(e){return new n(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}},R=class n extends K{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?K.near(i):new n(i)}content(){return new D(N.from(this.node),0,0)}eq(e){return e instanceof n&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zs(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}static create(e,t){return new n(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};R.prototype.visible=!1;K.jsonID("node",R);var Zs=class n{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Do(r,r):new n(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&R.isSelectable(r)?new R(t):K.near(t)}},ue=class n extends K{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=D.empty){if(t==D.empty){e.delete(0,e.doc.content.size);let r=K.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new n(e)}map(e){return new n(e)}eq(e){return e instanceof n}getBookmark(){return mb}};K.jsonID("all",ue);var mb={map(){return this},resolve(n){return new ue(n)}};function Hn(n,e,t,r,o,i=!1){if(e.inlineContent)return F.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&R.isSelectable(l))return R.create(n,t-(o<0?l.nodeSize:0))}else{let a=Hn(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function dp(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof le||o instanceof re))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,d)=>{s==null&&(s=d)}),n.setSelection(K.near(n.doc.resolve(s),t))}var up=1,Ro=2,pp=4,_o=class extends Mt{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|up)&~Ro,this.storedMarks=null,this}get selectionSet(){return(this.updated&up)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ro,this}ensureMarks(e){return Q.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ro)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ro,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Q.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(K.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=pp,this}get scrolledIntoView(){return(this.updated&pp)>0}};function fp(n,e){return!e||!n?n:n.bind(e)}var ln=class{constructor(e,t,r){this.name=e,this.init=fp(t.init,r),this.apply=fp(t.apply,r)}},gb=[new ln("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ln("selection",{init(n,e){return n.selection||K.atStart(e.doc)},apply(n){return n.selection}}),new ln("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ln("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],Nr=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gb.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ln(r.key,r.spec.state,r))})}},cn=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<s?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new n(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new _o(this)}static create(e){let t=new Nr(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new n(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Nr(this.schema,e.plugins),r=t.fields,o=new n(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Nr(e.schema,e.plugins),i=new n(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Te.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=K.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}};function hp(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=hp(o,e,{})),t[r]=o}return t}var z=class{constructor(e){this.spec=e,this.props={},e.props&&hp(e.props,this,this.props),this.key=e.key?e.key.key:mp("plugin")}getState(e){return e[this.key]}},Xs=Object.create(null);function mp(n){return n in Xs?n+"$"+ ++Xs[n]:(Xs[n]=0,n+"$")}var Z=class{constructor(e="key"){this.key=mp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var tl={};j(tl,{FOCUSABLE:()=>zt,activeElement:()=>te,eventTarget:()=>el,formatShortcut:()=>Ct,h:()=>w,icon:()=>ee,isMac:()=>yp,isRtl:()=>Bn,listenDocument:()=>ct,logicalKey:()=>Ne,uniqueId:()=>qe});function w(n,e={},...t){let r=document.createElement(n);for(let[o,i]of Object.entries(e))i==null||i===!1||(typeof i=="function"?r.addEventListener(o.replace(/^on/,"").toLowerCase(),i):o==="className"?r.className=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of t.flat())o==null||o===!1||r.append(o);return r}function ee(n){let e=document.createElement("span");return e.className="nova-icon",e.innerHTML=n,e}var gp=0;function qe(n="nova"){return gp+=1,`${n}-${gp}`}var yp=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),yb={ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192"};function Ct(n){let e=n.split("-"),t=e.pop(),r=t.length===1?t.toUpperCase():yb[t]??t;if(yp){let i={Mod:"\u2318",Shift:"\u21E7",Alt:"\u2325",Ctrl:"\u2303"};return e.map(s=>i[s]??s).join("")+r}let o={Mod:"Ctrl",Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl"};return[...e.map(i=>o[i]??i),r].join("+")}var zt='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function te(n){let e=n.getRootNode(),t=("activeElement"in e?e.activeElement:null)??document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function el(n){return n.composedPath?.()[0]??n.target}function ct(n,e,t){let r=n.getRootNode(),o=typeof ShadowRoot<"u"&&r instanceof ShadowRoot?r:null,i=l=>{o&&l.composedPath().includes(o.host)||t(l,el(l))},s=l=>t(l,el(l));return document.addEventListener(e,i,!0),o?.addEventListener(e,s,!0),()=>{document.removeEventListener(e,i,!0),o?.removeEventListener(e,s,!0)}}function Bn(n){return n.closest("[dir]")?.getAttribute("dir")?.toLowerCase()==="rtl"}function Ne(n,e){return n.key!=="ArrowLeft"&&n.key!=="ArrowRight"||!Bn(e)?n.key:n.key==="ArrowLeft"?"ArrowRight":"ArrowLeft"}var nl={};j(nl,{icons:()=>C});var T=n=>`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,C={undo:T('<path d="M9 14 4 9l5-5" /><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" />'),redo:T('<path d="m15 14 5-5-5-5" /><path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" />'),bold:T('<path d="M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8" />'),italic:T('<line x1="19" x2="10" y1="4" y2="4" /><line x1="14" x2="5" y1="20" y2="20" /><line x1="15" x2="9" y1="4" y2="20" />'),underline:T('<path d="M6 4v6a6 6 0 0 0 12 0V4" /><line x1="4" x2="20" y1="20" y2="20" />'),strike:T('<path d="M16 4H9a3 3 0 0 0-2.83 4" /><path d="M14 12a4 4 0 0 1 0 8H6" /><line x1="4" x2="20" y1="12" y2="12" />'),code:T('<path d="m16 18 6-6-6-6" /><path d="m8 6-6 6 6 6" />'),subscript:T('<path d="m4 5 8 8" /><path d="m12 5-8 8" /><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" />'),superscript:T('<path d="m4 19 8-8" /><path d="m12 19-8-8" /><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" />'),bulletList:T('<path d="M3 5h.01" /><path d="M3 12h.01" /><path d="M3 19h.01" /><path d="M8 5h13" /><path d="M8 12h13" /><path d="M8 19h13" />'),orderedList:T('<path d="M11 5h10" /><path d="M11 12h10" /><path d="M11 19h10" /><path d="M4 4h1v5" /><path d="M4 9h2" /><path d="M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" />'),indent:T('<path d="M21 5H11" /><path d="M21 12H11" /><path d="M21 19H11" /><path d="m3 8 4 4-4 4" />'),outdent:T('<path d="M21 5H11" /><path d="M21 12H11" /><path d="M21 19H11" /><path d="m7 8-4 4 4 4" />'),blockquote:T('<path d="M17 5H3" /><path d="M21 12H8" /><path d="M21 19H8" /><path d="M3 12v7" />'),codeBlock:T('<path d="m10 9-3 3 3 3" /><path d="m14 15 3-3-3-3" /><rect x="3" y="3" width="18" height="18" rx="2" />'),alignLeft:T('<path d="M21 5H3" /><path d="M15 12H3" /><path d="M17 19H3" />'),alignCenter:T('<path d="M21 5H3" /><path d="M17 12H7" /><path d="M19 19H5" />'),alignRight:T('<path d="M21 5H3" /><path d="M21 12H9" /><path d="M21 19H7" />'),alignJustify:T('<path d="M3 5h18" /><path d="M3 12h18" /><path d="M3 19h18" />'),horizontalRule:T('<path d="m16 16-4 4-4-4" /><path d="M3 12h18" /><path d="m8 8 4-4 4 4" />'),link:T('<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />'),unlink:T('<path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" /><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" /><line x1="8" x2="8" y1="2" y2="5" /><line x1="2" x2="5" y1="8" y2="8" /><line x1="16" x2="16" y1="19" y2="22" /><line x1="19" x2="22" y1="16" y2="16" />'),image:T('<rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" /><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />'),clearFormatting:T('<path d="M4 7V4h16v3" /><path d="M5 20h6" /><path d="M13 4 8 20" /><path d="m15 15 5 5" /><path d="m20 15-5 5" />'),formatMore:T('<path d="M12 4v16" /><path d="M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" /><path d="M9 20h6" />'),imageLeft:T('<rect width="9" height="6" x="6" y="14" rx="2" /><rect width="16" height="6" x="6" y="4" rx="2" /><path d="M2 2v20" />'),imageCenter:T('<path d="M12 2v20" /><path d="M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4" /><path d="M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4" /><path d="M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1" /><path d="M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1" />'),imageRight:T('<rect width="16" height="6" x="2" y="4" rx="2" /><rect width="9" height="6" x="9" y="14" rx="2" /><path d="M22 22V2" />'),resize:T('<path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" /><path d="M14 15H9v-5" /><path d="M16 3h5v5" /><path d="M21 3 9 15" />'),altText:T('<rect width="18" height="14" x="3" y="5" rx="2" ry="2" /><path d="M7 15h4M15 15h2M7 11h2M13 11h4" />'),imageCaption:T('<rect width="18" height="14" x="3" y="5" rx="2" ry="2" /><path d="M7 15h4M15 15h2M7 11h2M13 11h4" />'),trash:T('<path d="M10 11v6" /><path d="M14 11v6" /><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /><path d="M3 6h18" /><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />'),paragraph:T('<path d="M13 4v16" /><path d="M17 4v16" /><path d="M19 4H9.5a4.5 4.5 0 0 0 0 9H13" />'),h1:T('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="m17 12 3-2v8" />'),h2:T('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1" />'),h3:T('<path d="M4 12h8" /><path d="M4 18V6" /><path d="M12 18V6" /><path d="M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2" /><path d="M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2" />'),pasteText:T('<rect width="8" height="4" x="8" y="2" rx="1" ry="1" /><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" /><path d="M9 12v-1h6v1" /><path d="M11 17h2" /><path d="M12 11v6" />'),table:T('<path d="M12 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" /><path d="M3 15h18" />'),rowBefore:T('<path d="M12 2v6" /><path d="M18.464 3H19a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h.535" /><path d="M21 12H3" /><path d="M9 5h6" />'),rowAfter:T('<path d="M12 22v-6" /><path d="M18.464 21H19a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h.535" /><path d="M21 12H3" /><path d="M9 19h6" />'),rowDelete:T('<path d="M16 5H3" /><path d="M11 12H3" /><path d="M16 19H3" /><path d="m15.5 9.5 5 5" /><path d="m20.5 9.5-5 5" />'),colBefore:T('<path d="M12 3v18" /><path d="M3 5.536V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-.535" /><path d="M5 15V9" /><path d="M8 12H2" />'),colAfter:T('<path d="M12 3v18" /><path d="M16 12h6" /><path d="M19 15V9" /><path d="M21 5.536V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-.535" />'),colDelete:T('<g transform="rotate(90 12 12)"><path d="M16 5H3" /><path d="M11 12H3" /><path d="M16 19H3" /><path d="m15.5 9.5 5 5" /><path d="m20.5 9.5-5 5" /></g>'),merge:T('<path d="M12 21v-6" /><path d="M12 9V3" /><path d="M3 15h18" /><path d="M3 9h18" /><rect width="18" height="18" x="3" y="3" rx="2" />'),split:T('<path d="M12 15V9" /><path d="M3 15h18" /><path d="M3 9h18" /><rect width="18" height="18" x="3" y="3" rx="2" />'),rowHeader:T('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M3 9h18" />'),colHeader:T('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M9 3v18" />'),sort:T('<path d="m3 16 4 4 4-4" /><path d="M7 20V4" /><path d="M11 4h10" /><path d="M11 8h7" /><path d="M11 12h4" />'),tableProps:T('<path d="M15 3v18" /><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M21 9H3" /><path d="M21 15H3" />'),cellProps:T('<path d="M10.6 21H5a2 2 0 01-2-2V5a2 2 0 012-2h14a2 2 0 012 2v5.6" /><path d="m14.305 19.53.923-.382" /><path d="M15 3v7.6" /><path d="m15.229 16.852-.924-.383" /><path d="m16.852 15.228-.383-.923" /><path d="m16.852 20.772-.383.924" /><path d="m19.148 15.228.383-.923" /><path d="m19.53 21.696-.382-.924" /><path d="m20.773 16.852.922-.383" /><path d="m20.773 19.148.922.383" /><path d="M9 3v18" /><circle cx="18" cy="18" r="3" />'),tableDelete:T('<path d="M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3" /><path d="m16.5 16.5 5 5" /><path d="m16.5 21.5 5-5" />'),chevronUp:T('<path d="m18 15-6-6-6 6" />'),search:T('<path d="m21 21-4.34-4.34" /><circle cx="11" cy="11" r="8" />'),fullscreen:T('<path d="M8 3H5a2 2 0 0 0-2 2v3" /><path d="M21 8V5a2 2 0 0 0-2-2h-3" /><path d="M3 16v3a2 2 0 0 0 2 2h3" /><path d="M16 21h3a2 2 0 0 0 2-2v-3" />'),fullscreenExit:T('<path d="M8 3v3a2 2 0 0 1-2 2H3" /><path d="M21 8h-3a2 2 0 0 1-2-2V3" /><path d="M3 16h3a2 2 0 0 1 2 2v3" /><path d="M16 21v-3a2 2 0 0 1 2-2h3" />'),preview:T('<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" />'),sourceCode:T('<path d="m18 16 4-4-4-4" /><path d="m6 8-4 4 4 4" /><path d="m14.5 4-5 16" />'),help:T('<circle cx="12" cy="12" r="10" /><path d="M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5" /><path d="M12 17h.01" />'),print:T('<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" /><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" /><rect x="6" y="14" width="12" height="8" rx="1" />'),check:T('<path d="M20 6 9 17l-5-5" />'),close:T('<path d="M18 6 6 18" /><path d="m6 6 12 12" />'),chevronDown:T('<path d="m6 9 6 6 6-6" />'),more:T('<circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" />'),textColor:T('<path d="M4 20h16" /><path d="m6 16 6-12 6 12" /><path d="M8 12h8" />'),highlight:T('<path d="m9 11-6 6v3h9l3-3" /><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4" />'),lineHeight:T('<path d="M15 14H9" /><path d="M21 21H3" /><path d="M21 3H3" /><path d="m8 16 3.453-7.648a.6.6 0 011.094.001L16 16" />'),upload:T('<path d="M12 3v12" /><path d="m17 8-5-5-5 5" /><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />'),externalLink:T('<path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6" /><path d="m21 3-9 9" /><path d="M15 3h6v6" />'),copy:T('<rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />'),edit:T('<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" />'),resizeHandle:T('<circle cx="12" cy="9" r="1" /><circle cx="19" cy="9" r="1" /><circle cx="5" cy="9" r="1" /><circle cx="12" cy="15" r="1" /><circle cx="19" cy="15" r="1" /><circle cx="5" cy="15" r="1" />'),browse:T('<path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />'),mergeTags:T('<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" /><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" />'),resizeHandleBoth:T('<path d="M19 13v6h-6" /><path d="M5 11V5h6" /><path d="m5 5 14 14" />'),sidebar:T('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M15 3v18" />'),anchor:T('<path d="M12 6v16" /><path d="m19 13 2-1a9 9 0 0 1-18 0l2 1" /><path d="M9 11h6" /><circle cx="12" cy="4" r="2" />'),save:T('<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" /><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" /><path d="M7 3v4a1 1 0 0 0 1 1h7" />'),charmap:T('<path d="M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21" />'),commentAdd:T('<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" /><path d="M12 8v6" /><path d="M9 11h6" />'),comments:T('<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" /><path d="M7 11h10" /><path d="M7 15h6" /><path d="M7 7h8" />'),emoji:T('<path d="M15 10V9" /><path d="M16.472 15a6 6 0 01-8.943 0" /><path d="M9 10V9" /><circle cx="12" cy="12" r="10" />'),dateTime:T('<path d="M16 2v3" /><path d="M17 15.5v1.7l1 .625" /><path d="M21 8.936V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h3.935" /><path d="M3 9h9.873" /><path d="M8 2v3" /><circle cx="17" cy="17" r="5" />'),media:T('<rect x="3" y="3" width="18" height="18" rx="2" /><path d="M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z" />'),checklist:T('<path d="M13 5h8" /><path d="M13 12h8" /><path d="M13 19h8" /><path d="m3 17 2 2 4-4" /><rect x="3" y="4" width="6" height="6" rx="1" />'),codeSample:T('<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /><path d="M14 2v5a1 1 0 0 0 1 1h5" /><path d="M10 12.5 8 15l2 2.5" /><path d="m14 12.5 2 2.5-2 2.5" />'),dragHandle:T('<circle cx="9" cy="12" r="1" /><circle cx="9" cy="5" r="1" /><circle cx="9" cy="19" r="1" /><circle cx="15" cy="12" r="1" /><circle cx="15" cy="5" r="1" /><circle cx="15" cy="19" r="1" />'),accordion:T('<path d="M10 5h11" /><path d="M10 12h11" /><path d="M10 19h11" /><path d="m3 10 3-3-3-3" /><path d="m3 20 3-3-3-3" />'),tableOfContents:T('<path d="M16 5H3" /><path d="M16 12H3" /><path d="M16 19H3" /><path d="M21 5h.01" /><path d="M21 12h.01" /><path d="M21 19h.01" />'),math:T('<path d="M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2" />'),duplicate:T('<line x1="15" x2="15" y1="12" y2="18" /><line x1="12" x2="18" y1="15" y2="15" /><rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />'),nonBreaking:T('<path d="M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1" />'),pageBreak:T('<path d="M5.42 9.42 8 12" /><circle cx="4" cy="8" r="2" /><path d="m14 6-8.58 8.58" /><circle cx="4" cy="16" r="2" /><path d="M10.8 14.8 14 18" /><path d="M16 12h-2" /><path d="M22 12h-2" />'),history:T('<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" /><path d="M12 7v5l4 2" />'),suggest:T('<path d="M13 21h8" /><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" />'),review:T('<path d="M13 5h8" /><path d="M13 12h8" /><path d="M13 19h8" /><path d="m3 17 2 2 4-4" /><path d="m3 7 2 2 4-4" />'),visualBlocks:T('<path d="M5 3a2 2 0 0 0-2 2" /><path d="M19 3a2 2 0 0 1 2 2" /><path d="M21 19a2 2 0 0 1-2 2" /><path d="M5 21a2 2 0 0 1-2-2" /><path d="M9 3h1" /><path d="M9 21h1" /><path d="M14 3h1" /><path d="M14 21h1" /><path d="M3 9v1" /><path d="M21 9v1" /><path d="M3 14v1" /><path d="M21 14v1" />'),ltr:T('<path d="M10 3v11" /><path d="M10 9H7a1 1 0 0 1 0-6h8" /><path d="M14 3v11" /><path d="m18 14 4 4H2" /><path d="m22 18-4 4" />'),rtl:T('<path d="M14 3v11" /><path d="M14 9h-3a3 3 0 0 1 0-6h9" /><path d="M18 3v11" /><path d="M22 18H2l4-4" /><path d="m6 22-4-4" />'),caseChange:T('<path d="m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16" /><path d="M22 9v7" /><path d="M3.304 13h6.392" /><circle cx="18.5" cy="12.5" r="3.5" />'),formatPainter:T('<path d="m14.622 17.897-10.68-2.913" /><path d="M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z" /><path d="M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15" />'),permanentPen:T('<path d="m9 11-6 6v3h9l3-3" /><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4" />'),visualChars:T('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M12 12H9.5a2.5 2.5 0 0 1 0-5H17" /><path d="M12 7v10" /><path d="M16 7v10" />'),cancelChanges:T('<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" />'),template:T('<rect width="18" height="7" x="3" y="3" rx="1" /><rect width="9" height="7" x="3" y="14" rx="1" /><rect width="5" height="7" x="16" y="14" rx="1" />'),footnote:T('<rect width="18" height="18" x="3" y="3" rx="2" /><path d="M12 8v8" /><path d="m8.5 14 7-4" /><path d="m8.5 10 7 4" />'),footnotesUpdate:T('<path d="M21 5H3" /><path d="M7 12H3" /><path d="M7 19H3" /><path d="M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14" /><path d="M11 10v4h4" />')};var bp='.nova-details{position:relative;margin:0 0 .75em;padding-block:6px;padding-inline:34px 12px;border:1px solid var(--nova-border);border-radius:var(--nova-radius-sm)}.nova-details-toggle{position:absolute;top:7px;inset-inline-start:6px;display:flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:0;border-radius:4px;background:none;color:var(--nova-muted);cursor:pointer}.nova-details-toggle:hover{background:var(--nova-hover);color:var(--nova-fg)}.nova-details-toggle:focus-visible{outline:2px solid var(--nova-accent);outline-offset:1px}.nova-details-toggle svg{width:16px;height:16px;transition:transform .12s ease}.nova-details:not(.nova-details-open)>.nova-details-toggle svg{transform:rotate(-90deg)}[dir=rtl] .nova-details:not(.nova-details-open)>.nova-details-toggle svg{transform:rotate(90deg)}.nova-details-content>summary{position:relative;display:block;margin:0;font-weight:600;cursor:text;list-style:none}.nova-details-content>summary::-webkit-details-marker{display:none}.nova-details-content>summary:has(>br.ProseMirror-trailingBreak:only-child):before{content:var(--nova-summary-placeholder, "");position:absolute;color:var(--nova-muted);font-weight:400;pointer-events:none}.nova-details-open>.nova-details-content>summary{margin-bottom:.4em}.nova-details:not(.nova-details-open)>.nova-details-content>:not(summary){display:none}.nova-details-content>:last-child{margin-bottom:0}.nova-details.ProseMirror-selectednode{outline:2px solid var(--nova-accent);outline-offset:2px}@media(prefers-reduced-motion:reduce){.nova-details-toggle svg{transition:none}}';var ol={};j(ol,{insertText:()=>vb,openSymbolDialog:()=>wb,pickLabels:()=>Oe,symbolPanel:()=>xb});var dn={"toolbar.label":"Formatting","toolbar.options":"options","editor.label":"Rich text editor","editor.required":"Please fill in this field.",undo:"Undo",redo:"Redo",bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Inline code",subscript:"Subscript",superscript:"Superscript",link:"Link",unlink:"Remove link",image:"Image",bulletList:"Bulleted list",orderedList:"Numbered list",indent:"Increase indent",outdent:"Decrease indent",align:"Alignment",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Justify",blockquote:"Quote",codeBlock:"Code block",moveBlockUp:"Move block up",moveBlockDown:"Move block down",horizontalRule:"Horizontal line",clearFormatting:"Clear formatting",more:"More",moreFormats:"More formatting",blocks:"Text style",styles:"Formats","styles.headings":"Headings","styles.inline":"Inline","styles.blocks":"Blocks","styles.align":"Align",paragraph:"Paragraph",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",fontFamily:"Font",fontSize:"Font size",lineHeight:"Line height",default:"Default",textColor:"Text color",backgroundColor:"Highlight color",removeColor:"Remove color",customColor:"Custom color","dialog.cancel":"Cancel","dialog.save":"Save","dialog.insert":"Insert","dialog.close":"Close","dialog.required":"This field is required","dialog.invalid":"Check the format","link.title":"Insert link","link.editTitle":"Edit link","link.url":"URL","link.text":"Text to display","link.tooltip":"Title (tooltip)","link.newTab":"Open in new tab","link.open":"Open link","link.edit":"Edit link","link.copy":"Copy link","link.copied":"Link copied","link.invalid":"This URL is not allowed","image.title":"Insert image","image.url":"Image URL","image.alt":"Alternative text","image.altHint":"Describe the image for people using screen readers","image.upload":"Upload","image.drop":"Drop an image here or click to choose","image.uploading":"Uploading image\u2026","image.uploadFailed":"Image upload failed","image.retry":"Retry","image.retrying":"Connection problem \u2014 retrying the upload\u2026","image.invalid":"This image URL is not allowed","image.or":"or","image.toolbar":"Image options","image.alignLeft":"Float left","image.alignCenter":"Center","image.alignRight":"Float right","image.editAlt":"Alternative text","image.size":"Size","image.sizeSmall":"Small (25%)","image.sizeMedium":"Medium (50%)","image.sizeLarge":"Large (75%)","image.sizeFull":"Full width","image.sizeOriginal":"Original size","image.delete":"Remove image","image.caption":"Caption","image.captionPlaceholder":"Add a caption\u2026","status.words":"{count} words","announce.on":"{name} on","announce.off":"{name} off","status.resize":"Resize editor","dialog.browse":"Browse","dialog.dropFiles":"Drop files here or","dialog.fileType":"This file type is not allowed","dialog.fileTooLarge":"The file is too large","dialog.removeFile":"Remove",pasteAsText:"Paste as text","menu.label":"Menu","menu.file":"File","menu.edit":"Edit","menu.view":"View","menu.insert":"Insert","menu.format":"Format","menu.table":"Table","menu.tools":"Tools","menu.help":"Help",selectAll:"Select all",print:"Print","table.rows":"Rows","table.cols":"Columns","table.invalidSize":"Enter a number from 1 to 50","quickbars.selection":"Quick formatting","quickbars.insert":"Quick insert","search.title":"Find and replace","search.find":"Find","search.replace":"Replace with","search.next":"Next match","search.prev":"Previous match","search.replaceOne":"Replace","search.replaceAll":"Replace all","search.matchCase":"Match case","search.wholeWord":"Whole words only","search.count":"{current} of {total}","search.none":"No results",fullscreen:"Fullscreen",preview:"Preview",sourceCode:"Source code",help:"Keyboard shortcuts","help.formatting":"Text formatting","help.blocks":"Paragraphs and lists","help.editing":"Editing","help.navigation":"Navigation","help.slash":"Insert block (slash commands)","help.toMenubar":"Move to the menu bar","help.toToolbar":"Move to the toolbar","help.toContextToolbar":"Move to the image/table toolbar","help.toEditor":"Back to the text","help.nextCell":"Next table cell",table:"Table","table.insert":"Insert table","table.size":"{rows} \xD7 {cols}","table.toolbar":"Table options","table.rowBefore":"Insert row above","table.rowAfter":"Insert row below","table.rowDelete":"Delete row","table.colBefore":"Insert column left","table.colAfter":"Insert column right","table.colDelete":"Delete column","table.merge":"Merge cells","table.split":"Split cell","table.rowHeader":"Header row","table.colHeader":"Header column","table.cellBackground":"Cell background","table.delete":"Delete table","table.sort":"Sort","table.sortAsc":"Sort A \u2192 Z, 1 \u2192 9","table.sortDesc":"Sort Z \u2192 A, 9 \u2192 1","table.props":"Table properties","table.style":"Style","table.styleDefault":"Default","table.width":"Width","table.widthHint":"For example 100% or 600px. Leave empty to fit the content.","table.invalidWidth":"Enter a width such as 100% or 600px","table.align":"Alignment on the page","table.alignDefault":"Default","table.alignCenter":"Center","table.alignRight":"Right","table.cellProps":"Cell properties","table.valign":"Vertical alignment","table.valignTop":"Top","table.valignMiddle":"Middle","table.valignBottom":"Bottom","table.cellType":"Cell type","table.cellData":"Data cell","table.cellHeader":"Header cell","table.colWidth":"Column width, px","table.colWidthHint":"Leave empty to fit the content.","table.invalidColWidth":"Enter a number from 24 to 4000","slash.label":"Commands","slash.empty":"No matching commands"};var Fn={},Or={en:dn},kp=new Set,Ho={};function kb(n){let e={};for(let[t,r]of Object.entries(n))typeof r=="string"?e[t]=r:r.forEach((o,i)=>e[`${t}.${i}`]=o);return e}var zn={},Io={};function xp(n,e,t=!1){Fn[n]=t?{...e,...Fn[n]}:{...Fn[n],...e},Or[n]={...dn,...Fn[n]}}function $t(n,e){let t=n.toLowerCase();typeof e=="function"?zn[t]=e:xp(t,e)}function wp(n){let e=n.toLowerCase();return e in Or||e.split("-")[0]in Or}function rl(n){let e=n.toLowerCase(),t=e.split("-")[0],r=e in zn?e:t in zn?t:null;return r?Io[r]??(Io[r]=zn[r]().then(o=>(xp(r,o.default??o,!0),!0),o=>{throw Io[r]=void 0,o})):Promise.resolve(wp(e))}function Sp(n,e){let t=Ho[n]??(Ho[n]={});for(let[r,o]of Object.entries(e))o&&(t[r]={...t[r],...kb(o)})}var vp=(n,e)=>e?n.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`)):n;function Mp(n="en",e={}){let t=n.toLowerCase(),r=t.split("-")[0],o=Or[t]??Or[r]??dn;o===dn&&r!=="en"&&!kp.has(r)&&(kp.add(r),console.warn(t in zn||r in zn?`[nova] language "${n}" is not loaded yet, using English. Load it before creating the editor: await loadLanguage('${n}');`:`[nova] language "${n}" is not registered, using English. import pack from '@novaprose/core/i18n/${r}'; registerLanguage('${r}', pack);`));let i={...dn,...o,...e},s={...Fn[r],...Fn[t]},l=e;return(a,c)=>{let d=i[a];if(d!==void 0)return vp(d,c);let u=a.indexOf("."),p=u>0?Ho[a.slice(0,u)]:void 0,f=a.slice(u+1),h=l[a]??s[a]??p?.[t]?.[f]??p?.[r]?.[f]??p?.en?.[f]??a;return vp(h,c)}}function Oe(n,e,t){Sp(e,t);let r={};for(let[o,i]of Object.entries(t.en))r[o]=typeof i=="string"?n.ui.t(`${e}.${o}`):i.map((s,l)=>n.ui.t(`${e}.${o}.${l}`));return r}function vb(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.insertText(e).scrollIntoView()),n.focus()}function xb(n){let e=w("input",{type:"search",className:"nova-input nova-symbols-search",placeholder:n.searchLabel,"aria-label":n.searchLabel}),t=w("div",{className:"nova-symbols-list"}),r=w("div",{className:`nova-symbols ${n.className}`},e,t),o=i=>{let s=i.trim().toLowerCase(),l=n.groups.map(a=>({title:a.title,items:s?a.items.filter(([c,d])=>d.includes(s)||c===s):a.items})).filter(a=>a.items.length);if(!l.length){t.replaceChildren(w("div",{className:"nova-symbols-empty"},n.emptyText));return}t.replaceChildren(...l.map(a=>w("div",{className:"nova-symbols-group",role:"group","aria-label":a.title},w("div",{className:"nova-symbols-title"},a.title),w("div",{className:"nova-symbols-grid"},...a.items.map(([c,d])=>w("button",{type:"button",className:"nova-symbols-cell",title:d,"aria-label":d,onclick:()=>n.onPick(c)},c))))))};return e.addEventListener("input",()=>o(e.value)),e.addEventListener("keydown",i=>{i.key==="ArrowDown"?(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.focus()):i.key==="Enter"&&(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.click())}),t.addEventListener("keydown",i=>{let s=[...t.querySelectorAll(".nova-symbols-cell")],l=s.indexOf(te(t));if(l<0)return;let a=Math.max(1,s.filter(p=>p.offsetTop===s[0].offsetTop).length),c={ArrowRight:1,ArrowLeft:-1,ArrowDown:a,ArrowUp:-a},d=Ne(i,t);if(!(d in c))return;i.preventDefault();let u=l+c[d];u<0?e.focus():s[Math.min(s.length-1,u)]?.focus()}),o(""),queueMicrotask(()=>e.focus()),r}function wb(n,e,t){let r=null,o=t(()=>r?.close());r=n.ui.openDialog({title:e,body:o,cancelLabel:n.ui.t("dialog.close")})}var il={en:{accordion:"Accordion",summary:"Summary",expand:"Expand",collapse:"Collapse"}};function Sb(n){let e=n.options.pluginOptions?.accordion??{},t=e.initialState??"inherited",r=e.serializedState??"inherited";return{details:{group:"block",content:"details_summary block+",defining:!0,attrs:{open:{default:!0}},parseDOM:[{tag:"details",getAttrs:o=>({open:t==="inherited"?o.hasAttribute("open"):t==="expanded"})}],toDOM:o=>["details",(r==="inherited"?o.attrs.open!==!1:r==="expanded")?{open:""}:{},0]},details_summary:{content:"inline*",defining:!0,isolating:!0,parseDOM:[{tag:"summary",context:"details/"}],toDOM:()=>["summary",0]}}}function Mb(n){for(let e=n.depth;e>0;e--){let t=n.node(e);if(t.type.name==="details")return{node:t,pos:n.before(e)}}return null}var sl=n=>n.attrs.open!==!1,ll=n=>n.pos+2+n.node.firstChild.content.size;function Ep(n,e,t){return n.setNodeAttribute(e.pos,"open",t).setMeta("addToHistory",!1)}var al=class{constructor(e,t,r,o){S(this,"node",e);S(this,"labels",o);S(this,"dom");S(this,"contentDOM");S(this,"toggle");this.toggle=w("button",{type:"button",className:"nova-details-toggle",contentEditable:"false",tabIndex:-1}),this.toggle.append(ee(C.chevronDown)),this.toggle.addEventListener("mousedown",i=>i.preventDefault()),this.toggle.addEventListener("click",()=>{let i=r();if(i===void 0)return;let s=t.state.doc.nodeAt(i);if(s?.type.name!=="details")return;let l={node:s,pos:i},a=sl(s),c=Ep(t.state.tr,l,!a),{from:d}=t.state.selection;a&&d>ll(l)&&d<i+s.nodeSize&&c.setSelection(F.create(c.doc,ll(l))),t.dispatch(c)}),this.contentDOM=w("div",{className:"nova-details-content"}),this.dom=w("div",{className:"nova-details"},this.toggle,this.contentDOM),this.sync()}sync(){let e=sl(this.node);this.dom.classList.toggle("nova-details-open",e),this.toggle.setAttribute("aria-expanded",String(e)),this.toggle.setAttribute("aria-label",e?this.labels.collapse:this.labels.expand)}update(e){return e.type!==this.node.type?!1:(this.node=e,this.sync(),!0)}stopEvent(e){return e.target instanceof Node&&this.toggle.contains(e.target)}ignoreMutation(e){return e.type!=="selection"&&!this.contentDOM.contains(e.target)}},cl={name:"accordion",nodes:Sb,prosemirrorPlugins:n=>{let e=Oe(n,"accordion",il);return[new z({key:new Z("nova-accordion"),props:{nodeViews:{details:(t,r,o)=>new al(t,r,o,e)}}})]},setup(n){n.ui.addStyles("nova-accordion",bp);let{summary:e}=Oe(n,"accordion",il);n.root.style.setProperty("--nova-summary-placeholder",JSON.stringify(e))},load:()=>import(__novaChunk("tinymce-chunks/accordion-ui-4272c63b.js") )};var ul={};j(ul,{ELEMENT_ID_RE:()=>Bo,elementId:()=>$n});var Bo=/^[A-Za-z][\w.-]{0,63}$/;function $n(n){return typeof n=="string"&&Bo.test(n)?n:null}var pl=Bo,Cp={name:"anchor",toolbar:"anchor",nodes:{anchor:{group:"inline",inline:!0,atom:!0,selectable:!0,attrs:{id:{}},parseDOM:[{tag:"a[id]:not([href])",getAttrs:n=>{let e=n.getAttribute("id")??"";return pl.test(e)?{id:e}:!1}},{tag:"a[name]:not([href])",getAttrs:n=>{let e=n.getAttribute("name")??"";return pl.test(e)?{id:e}:!1}}],toDOM:n=>["a",{id:pl.test(n.attrs.id)?n.attrs.id:null}]}},load:()=>import(__novaChunk("tinymce-chunks/anchor-ui-da0966bb.js") )};var hl={};j(hl,{LABELS:()=>Np,default:()=>fl,loadTemml:()=>Op,mathLatex:()=>Vn,renderMath:()=>Lp});var Ap='.nova-math{border-radius:4px;cursor:pointer}.nova-math-inline{display:inline-block;padding:0 2px}.nova-math-block{display:block;margin:0 0 .75em;padding:6px 8px;overflow-x:auto;text-align:center}.nova-math:hover{background:var(--nova-hover)}.nova-math.is-selected{outline:2px solid var(--nova-accent)}.nova-math:not(:has(math)){font-family:var(--nova-mono);font-size:.9em}.nova-math-error{color:var(--nova-danger);text-decoration:underline wavy;text-underline-offset:3px}.nova-math-empty:before{content:var(--nova-math-empty, "");color:var(--nova-muted);font-family:var(--nova-font)}.nova-math-preview{min-height:2.5em;padding:8px;overflow-x:auto;border:1px dashed var(--nova-border);border-radius:var(--nova-radius-sm);text-align:center}';var Np={en:{empty:"Formula"}};function Vn(n){return typeof n=="string"?n.slice(0,1e4):""}var Fo=null;function Op(){return Fo??(Fo=import(__novaChunk("tinymce-chunks/temml-d637f801.js") ).then(n=>n.default,n=>(Fo=null,console.warn("[nova] math: could not load the formula renderer",n),null))),Fo}function Lp(n,e,t,r){try{return n.render(e,t,{displayMode:r,throwOnError:!0,trust:!1,annotate:!0}),null}catch(o){return t.textContent=e,o instanceof Error?o.message.replace(/^ParseError:\s*/,""):String(o)}}function Tp(n){let e=n?"block-math":"inline-math",t=n?"div":"span";return{...n?{group:"block"}:{group:"inline",inline:!0},atom:!0,selectable:!0,draggable:!0,attrs:{latex:{default:""}},parseDOM:[{tag:`${t}[data-type="${e}"]`,getAttrs:r=>({latex:Vn(r.getAttribute("data-latex"))})}],toDOM:r=>{let o=Vn(r.attrs.latex);return[t,{"data-type":e,"data-latex":o},n?`\\[${o}\\]`:`\\(${o}\\)`]},leafText:r=>n?`$$${Vn(r.attrs.latex)}$$`:`$${Vn(r.attrs.latex)}$`}}var zo=class{constructor(e,t,r,o){S(this,"node",e);S(this,"view",t);S(this,"getPos",r);S(this,"editor",o);S(this,"dom");S(this,"latex","");let i=e.type.name==="math_block";this.dom=document.createElement(i?"div":"span"),this.dom.className=`nova-math ${i?"nova-math-block":"nova-math-inline"}`,this.dom.contentEditable="false",this.dom.addEventListener("click",()=>this.edit()),this.render()}render(){let e=Vn(this.node.attrs.latex);if(e===this.latex&&this.dom.childNodes.length)return;this.latex=e;let t=this.node.type.name==="math_block";this.dom.classList.toggle("nova-math-empty",!e.trim()),this.dom.textContent=e.trim()?e:"",e.trim()&&Op().then(r=>{if(!r||this.latex!==e)return;let o=Lp(r,e,this.dom,t);this.dom.classList.toggle("nova-math-error",!!o),o?this.dom.title=o:this.dom.removeAttribute("title")})}edit(){let e=this.getPos();if(e===void 0||!this.editor.isEditable())return;this.view.dispatch(this.view.state.tr.setSelection(R.create(this.view.state.doc,e)));let t=this.editor.ui.registry.get("math");t?.type==="button"&&t.onAction(this.editor)}update(e){return e.type!==this.node.type?!1:(this.node=e,this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}ignoreMutation(){return!0}},fl={name:"math",nodes:{math_inline:Tp(!1),math_block:Tp(!0)},prosemirrorPlugins:n=>[new z({key:new Z("nova-math"),props:{nodeViews:{math_inline:(e,t,r)=>new zo(e,t,r,n),math_block:(e,t,r)=>new zo(e,t,r,n)}}})],setup(n){n.ui.addStyles("nova-math",Ap);let{empty:e}=Oe(n,"math",Np);n.root.style.setProperty("--nova-math-empty",JSON.stringify(e))},load:()=>import(__novaChunk("tinymce-chunks/math-ui-1b57f7eb.js") )};var yl={};j(yl,{LABELS:()=>Rp,default:()=>gl,tocEntries:()=>ml,tocSettings:()=>Dp});var Pp='.nova-prosemirror nav[data-toc]{margin:0 0 .75em;padding:10px 14px;border-inline-start:3px solid var(--nova-accent);border-radius:var(--nova-radius-sm);background:var(--nova-code-bg)}.nova-prosemirror nav[data-toc]>:is(p,h1,h2,h3,h4,h5,h6):first-child{margin:0 0 6px;font-size:1em;font-weight:600}.nova-prosemirror nav[data-toc] :is(ul,ol){margin:0;padding-inline-start:1.2em}.nova-prosemirror nav[data-toc]>:is(ul,ol){padding-inline-start:0}.nova-prosemirror nav[data-toc] ul{list-style:none}.nova-prosemirror nav[data-toc] li{margin:2px 0}.nova-prosemirror nav[data-toc] a{color:var(--nova-accent);text-decoration:none;cursor:pointer}.nova-prosemirror nav[data-toc] a:hover{text-decoration:underline}.nova-prosemirror nav[data-toc]:not(:has(a)):after{content:var(--nova-toc-empty, "");color:var(--nova-muted)}.nova-prosemirror nav[data-toc].ProseMirror-selectednode{outline:2px solid var(--nova-accent);outline-offset:2px}';var Rp={en:{title:"Contents",insert:"Table of contents",update:"Update table of contents",empty:"Add headings \u2014 they will appear here"}},Ab=/^[A-Za-z_][\w-]{0,63}$/;function Dp(n){let e=n.options.pluginOptions?.tableofcontents??{},t=Number(e.depth);return{depth:Number.isInteger(t)&&t>=1&&t<=6?t:3,className:typeof e.className=="string"&&Ab.test(e.className)?e.className:"nova-toc",titleTag:typeof e.titleTag=="string"&&/^(p|h[1-6])$/i.test(e.titleTag)?e.titleTag.toLowerCase():"p",title:typeof e.title=="string"?e.title.slice(0,200):null,list:e.orderedList?"ol":"ul"}}function ml(n){if(!Array.isArray(n))return[];let e=[];for(let t of n.slice(0,1e3)){if(!t||typeof t!="object")continue;let{level:r,id:o,text:i}=t,s=Number(r),l=$n(o);!Number.isInteger(s)||s<1||s>6||!l||typeof i!="string"||e.push({level:s,id:l,text:i.slice(0,300)})}return e}function Tb(n,e){if(!n.length)return null;let t=[e],r=[{level:n[0].level,list:t,last:null}];for(let o of n){let i=r[r.length-1];if(o.level>i.level&&i.last){let l=[e];i.last.push(l),r.push({level:o.level,list:l,last:null})}else for(;r.length>1&&o.level<r[r.length-1].level;)r.pop();i=r[r.length-1];let s=["li",["a",{href:`#${o.id}`},o.text]];i.list.push(s),i.last=s}return t}function Nb(n){let e=[];for(let t of n.querySelectorAll('a[href^="#"]')){let r=0;for(let o=t;o&&o!==n;o=o.parentElement)(o.tagName==="UL"||o.tagName==="OL")&&r++;e.push({level:Math.min(Math.max(r,1),6),id:t.getAttribute("href").slice(1),text:(t.textContent??"").trim()})}return ml(e)}function Ob(n){let e=Dp(n);return{toc:{group:"block",atom:!0,selectable:!0,attrs:{entries:{default:[]},title:{default:null}},parseDOM:[...["nav[data-toc]","div.mce-toc",`.${e.className}`].map(t=>({tag:t,getAttrs:r=>{let o=r.querySelector(":scope > h1, :scope > h2, :scope > h3, :scope > h4, :scope > h5, :scope > h6, :scope > p");return{entries:Nb(r),title:o?.textContent?.trim()||null}}}))],toDOM:t=>{let r=typeof t.attrs.title=="string"?t.attrs.title.slice(0,200):"",o=Tb(ml(t.attrs.entries),e.list);return["nav",{class:e.className,"data-toc":""},...r?[[e.titleTag,r]]:[],...o?[o]:[]]}}}}var gl={name:"tableofcontents",nodes:Ob,setup(n){n.ui.addStyles("nova-tableofcontents",Pp);let{empty:e}=Oe(n,"tableofcontents",Rp);n.root.style.setProperty("--nova-toc-empty",JSON.stringify(e))},load:()=>import(__novaChunk("tinymce-chunks/tableofcontents-ui-01a9af06.js") )};var la={};j(la,{LABELS:()=>Qf,commentsKey:()=>pt,default:()=>sa,getComments:()=>li});var Kl={};j(Kl,{Decoration:()=>ge,DecorationSet:()=>ae,EditorView:()=>Xn,__endComposition:()=>nv,__parseFromClipboard:()=>tv});var Le=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e};function Kn(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e}var wl=null;function Tt(n,e,t){let r=wl||(wl=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r}function Lb(){wl=null}function $o(n,e,t,r){return t&&(Ip(n,e,t,r,-1)||Ip(n,e,t,r,1))}var _p=/^(img|br|input|textarea|hr)$/i;function Ip(n,e,t,r,o){for(var i;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Me(n))){let s=n.parentNode;if(!s||!W(s)||Vo(n)||_p.test(n.nodeName)||n.contentEditable=="false")return!1;e=Le(n)+(o<0?0:1),n=s}else if(W(n)){let s=n.childNodes[e+(o<0?-1:0)];if(W(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else{if(Vo(s)||_p.test(s.nodeName))return!1;n=s,e=o<0?Me(n):0}}else return!1}}function Me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function W(n){return n.nodeType==1}function ke(n){return n.nodeType==3}function Un(n,e){return e?n.contains(W(e)?e:e.parentNode):!1}function mf(n,e){for(;;){if(ke(n)&&e)return n;if(W(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Me(n)}else if(n.parentNode&&!Vo(n,!0))e=Le(n),n=n.parentNode;else return null}}function gf(n,e){for(;;){if(ke(n)&&e<n.nodeValue.length)return n;if(W(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Vo(n,!0))e=Le(n)+1,n=n.parentNode;else return null}}function Pb(n,e,t){for(let r=e==0,o=e==Me(n);r||o;){if(n==t)return!0;let i=Le(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==Me(n)}}function Vo(n,e=!1){let t;for(let r=n;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&(!e||t.node.isBlock)&&(t.dom==n||t.contentDOM==n)}function Xo(n){return n.focusNode&&$o(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)}function yf(n,e){n.collapse(e.anchorNode,e.anchorOffset),(e.focusNode!=e.anchorNode||e.focusOffset!=e.anchorOffset)&&n.extend(e.focusNode,e.focusOffset)}function Rb(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Db(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function _b(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Me(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Me(r.startContainer),r.startOffset)}}}var dt=typeof navigator<"u"?navigator:null,Hp=typeof document<"u"?document:null,Jn=dt&&dt.userAgent||"",Ge=/gecko\/(\d+)/i.test(Jn)&&!/edge?\//i.test(Jn);Ge&&+(/Firefox\/(\d+)/.exec(Jn)||[0,0])[1];var Sl=/Chrome\/(\d+)/.exec(Jn),Pe=!!Sl,bf=Sl?+Sl[1]:0,Re=!!dt&&/Apple Computer/.test(dt.vendor),Gn=Re&&(/Mobile\/\w+/.test(Jn)||!!dt&&dt.maxTouchPoints>2),je=Gn||(dt?/Mac/.test(dt.platform):!1),kf=dt?/Win/.test(dt.platform):!1,Nt=/Android \d/.test(Jn),Zo=!!Hp&&"webkitFontSmoothing"in Hp.documentElement.style,Ib=Zo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hb(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function At(n,e){return typeof n=="number"?n:n[e]}function Bb(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Bp(n,e,t){if(!Ml(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(!W(s)){s=Kn(s);continue}let l=s==i.body,a=l?Hb(i):Bb(s),c=0,d=0;if(e.top<a.top+At(r,"top")?d=-(a.top-e.top+At(o,"top")):e.bottom>a.bottom-At(r,"bottom")&&(d=e.bottom-e.top>a.bottom-a.top?e.top+At(o,"top")-a.top:e.bottom-a.bottom+At(o,"bottom")),e.left<a.left+At(r,"left")?c=-(a.left-e.left+At(o,"left")):e.right>a.right-At(r,"right")&&(c=e.right-a.right+At(o,"right")),c||d)if(l)i.defaultView.scrollBy(c,d);else{let p=s.scrollLeft,f=s.scrollTop;d&&(s.scrollTop+=d),c&&(s.scrollLeft+=c);let h=s.scrollLeft-p,m=s.scrollTop-f;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}let u=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(u))break;s=u=="absolute"?s.offsetParent:Kn(s)}}function Fb(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:vf(n.dom)}}function vf(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Kn(r));return e}function zb({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;xf(t,r==0?0:r-e)}function xf(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}var qn=null;function wf(n){if(n.setActive)return n.setActive();if(qn)return n.focus(qn);let e=vf(n);n.focus(qn==null?{get preventScroll(){return qn={preventScroll:!0},!0}}:void 0),qn||(qn=!1,xf(e,0))}function Sf(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let p;if(W(d))p=d.getClientRects();else if(ke(d))p=Tt(d).getClientRects();else continue;for(let f=0;f<p.length;f++){let h=p[f];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){t=d,r=m,o=m&&ke(t)?{left:h.right<e.left?h.right:h.left,top:e.top}:e,W(d)&&m&&(i=u+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=u+1)}}return!t&&a&&(t=a,o=c,r=0),t&&ke(t)?$b(t,o):!t||r?{node:n,offset:i}:Sf(t,o)}function $b(n,e){let t=n.nodeValue.length,r=document.createRange(),o;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Vt(r,1);if(s.top!=s.bottom&&Bl(e,s)){o={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:n,offset:0}}function Bl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Vb(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function qb(n,e,t){let{node:r,offset:o}=Sf(e,t),i=-1;if(W(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function jb(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(W(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Mf(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(W(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Bl(e,c))return Mf(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function Wb(n,e){let t=n.dom.ownerDocument,r,o=0,i=_b(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s)){let c=n.dom.getBoundingClientRect();if(!Bl(e,c)||(s=Mf(n.dom,e,c),!s))return null}if(Re)for(let c=s;r&&c;c=Kn(c))c.draggable&&(r=void 0);if(s=Vb(s,e),r){if(Ge&&W(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++}let c;Zo&&o&&W(r)&&W(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&W(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||!W(r)||r.childNodes[o-1].nodeName!="BR")&&(l=jb(n,r,o,e))}l==null&&(l=qb(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ml(n){return n.top<n.bottom||n.left<n.right}function Vt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ml(r))return r}return Array.prototype.find.call(t,Ml)||n.getBoundingClientRect()}var Kb=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ef(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=Zo||Ge;if(ke(r))if(s&&(Kb.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=Vt(Tt(r,o,o),t);if(Ge&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Vt(Tt(r,o-1,o-1),-1);if(c.top==a.top){let d=Vt(Tt(r,o,o+1),-1);if(d.top!=a.top)return Lr(d,d.left<c.left)}}return a}else{let a=o,c=o,d=t<0?1:-1;return t<0&&!o?(c++,d=-1):t>=0&&o==r.nodeValue.length?(a--,d=1):t<0?a--:c++,Lr(Vt(Tt(r,a,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1];if(W(a))return bl(a.getBoundingClientRect(),!1)}if(i==null&&o<Me(r)){let a=r.childNodes[o];if(W(a))return bl(a.getBoundingClientRect(),!0)}return bl(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==Me(r))){let a=r.childNodes[o-1],c=ke(a)?Tt(a,Me(a)-(s?0:1)):W(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Lr(Vt(c,1),!1)}if(i==null&&o<Me(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?ke(a)?Tt(a,0,s?0:1):W(a)?a:null:null;if(c)return Lr(Vt(c,-1),!0)}return Lr(Vt(ke(r)?Tt(r):r,-t),t>=0)}function Lr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function bl(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Cf(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Ub(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Cf(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Ef(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(W(l))a=l.getClientRects();else if(ke(l))a=Tt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}var Jb=/[\u0590-\u08ac]/;function Gb(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return l?!Jb.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Cf(n,e,()=>{let a=n.domSel.readRange(),c=l.caretBidiLevel;l.modify("move",t,"character");let d=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:u,focusOffset:p}=n.domSel.readRange(),f=u&&!Un(d,u)||a.focusNode==u&&a.focusOffset==p;return yf(l,a),c!=null&&(l.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Fp=null,zp=null,$p=!1;function Yb(n,e,t){return Fp==e&&zp==t?$p:(Fp=e,zp=t,$p=t=="up"||t=="down"?Ub(n,e,t):Gb(n,e,t))}var mn=class{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.damage=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&Un(this.contentDOM,e))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Le(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?o=t>Array.from(e.childNodes).findIndex(s=>s.contains(this.contentDOM)):o=!(i&4)}else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(W(s)?Un(s,e):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof jo||i instanceof qo&&i.side>=0))break}if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Le(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Le(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let d=s+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let u=l;u>0;u--){let p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=Le(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=Le(u.dom);break}t+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!W(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDamage(e){e&&(this.damage|=e,this.markParentDamage())}markParentDamage(){for(let e=this;;){let{parent:t}=e;if(!t||t.damage&1)break;t.damage|=1,e=t}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},qo=class extends mn{constructor(e,t,r,o){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let l=W(s)?s:document.createElement("span");l!=s&&(l.appendChild(s),s=l),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return!this.damage&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},El=class extends mn{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},pn=class n extends mn{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=Ve.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.damage&4||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return!(this.damage&4)&&this.mark.eq(e)}markDamage(e){var t;this.damage|=e,(t=this.parent)===null||t===void 0||t.markDamage(2)}slice(e,t,r){let o=n.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=Al(i,t,s,r)),e>0&&(i=Al(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Kt=class n extends mn{constructor(e,t,r,o,i,s,l){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,t,r,o,i,s){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(!ke(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=Ve.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=Tf(d,r,t),c?a=new Wo(e,t,r,o,d,u||null,p,c):t.isText?new _r(e,t,r,o,d,p):new n(e,t,r,o,d,u||null,p)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){t.contentElement=o.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(o=>W(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?t.contentElement=r:t.getContent=()=>N.empty}}return t}matchesNode(e,t,r){return!this.damage&&e.eq(this.node)&&Ko(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new Cl(this,s&&s.node,e),c=this.node.inlineContent,d=c&&this.node.isBlock;ek(this.node,this.innerDeco,(u,p,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e,p):u.type.side>=0&&!f&&a.syncToMarks(p==this.node.childCount?Q.none:this.node.child(p).marks,r,e,p),a.placeWidget(u,e,o)},(u,p,f,h)=>{a.syncToMarks(u.marks,r,e,h),d&&u.isAtom&&!u.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(u,p,f,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+u.nodeSize&&(m=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,p,f,m,e,o)||a.updateNextNode(u,p,f,e,h,o)||a.addNode(u,p,f,e,o),o+=u.nodeSize,c&&(d=u.isAtom&&!u.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.damage&2)&&(s&&this.protectLocalComposition(e,s),Af(this.contentDOM,this.children,e),Gn&&tk(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof F)||r<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=nk(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;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 El(this,i,t,o);e.input.compositionNodes.push(s),this.children=Al(this.children,r,r+o.length,e,s)}update(e,t,r,o,i){return this.damage&4||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o,i),!0)}updateInner(e,t,r,o,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,i+1),this.damage=0}updateOuterDeco(e){if(Ko(e,this.outerDeco))return;let t=!W(this.nodeDOM),r=this.dom;this.dom=Fl(this.dom,this.nodeDOM,Ir(this.outerDeco,this.node,t),Ir(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){W(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){W(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Vp(n,e,t,r,o,i){i?Fl(r,r,Ir(i,n,!1),Ir(e,n,!1)):Tf(r,e,n);let s=new Kt(void 0,n,e,t,r,r,r);return s.contentDOM&&s.updateChildren(o,0),s}var _r=class n extends Kt{constructor(e,t,r,o,i,s){super(e,t,r,o,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.damage&4||this.damage&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.damage&8||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.damage=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return!1}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i)}get domAtom(){return!1}isText(e){return this.node.text==e}},jo=class extends mn{parseRule(){return{ignore:!0}}matchesHack(e){return!this.damage&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Wo=class extends Kt{constructor(e,t,r,o,i,s,l,a){super(e,t,r,o,i,s,l),this.spec=a}update(e,t,r,o,i){if(this.damage&4)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Af(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=qp(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(l,r);if(s instanceof pn){let a=r?r.previousSibling:n.lastChild;Af(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=qp(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}var Rr=function(n){n&&(this.nodeName=n)};Rr.prototype=Object.create(null);var un=[new Rr];function Ir(n,e,t){if(n.length==0)return un;let r=t?un[0]:new Rr,o=[r];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&o.push(r=new Rr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&o.length==1&&o.push(r=new Rr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Fl(n,e,t,r){if(t==un&&r==un)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=un[0]),o=a}Xb(o,l||un[0],s)}return o}function Xb(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function Tf(n,e,t){return Fl(n,n,un,Ir(e,t,!W(n)))}function Ko(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function qp(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}var Cl=class{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Zb(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,o){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.damage=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){a=d;break}}if(a<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof pn&&!(d.damage&4)&&d.mark.type==e[s].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[s])&&(d.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let d=pn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,o,i,s){let l=this.top.children[o];return l.damage&4&&l.dom==l.contentDOM&&(l.damage=2),l.update(e,t,r,i,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Kt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let d=a.dom,u,p=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&!(a.damage&4)&&Ko(t,a.outerDeco));if(!p&&a.update(e,t,r,o,s))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!p&&(u=this.recreateWrapper(a,e,t,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.damage|=2,u.updateChildren(o,s+1),u.damage=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,i,s){if(e.damage&3||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ko(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Kt.create(this.top,t,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,o,i){let s=Kt.create(this.top,e,t,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new qo(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof pn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof _r)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Re||Pe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new jo(this.top,[],r,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||W(e)&&e.contains(this.lock.parentNode))}};function Zb(n,e){let t=e,r=t.children.length,o=[],i=n.childCount,s=new Map,l=[];e:for(;i>0;){let a;for(;;)if(r){let d=t.children[r-1];if(d instanceof pn)o.push(r-1),t=d,r=d.children.length;else{a=d,r--;break}}else{if(t==e)break e;r=o.pop(),t=t.parent}let c=a.node;if(c){if(c!=n.child(i-1))break;--i,s.set(a,i),l.push(a)}}return{index:i,matched:s,matches:l.reverse()}}function Qb(n,e){return n.type.side-e.type.side}function ek(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,o,e.forChild(i,d),c),i+=d.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,u;for(;s<o.length&&o[s].to==i;){let g=o[s++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(Qb);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(d,c,!!a);let p,f;if(a)f=-1,p=a,a=null;else if(c<n.childCount)f=c,p=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let h=i+p.nodeSize;if(p.isText){let g=h;s<o.length&&o[s].from<g&&(g=o[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<h&&(a=p.cut(g-i),p=p.cut(0,g-i),h=g,f=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();r(p,m,e.forChild(i,p),f),i=h}}function tk(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function nk(n,e,t,r){for(let o=0,i=0;o<n.childCount&&i<=r;){let s=n.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Al(n,e,t,r,o){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,d=l+=a.size;c>=t||d<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),d>t&&i.push(a.slice(t-c,a.size,r)))}return i}function Tl(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&K.findFrom(i,e)}function qt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function jp(n,e,t){let r=n.state.selection;if(r instanceof F)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return qt(n,new F(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=Tl(n.state,e);return o&&o instanceof R?qt(n,o):!1}else if(!je||t.indexOf("m")<0){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?R.isSelectable(i)?qt(n,new R(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):qt(n,new F(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1}}else return!1;else{if(r instanceof R&&r.node.isInline)return qt(n,new F(e>0?r.$to:r.$from));{let o=Tl(n.state,e);return o?qt(n,o):!1}}}function Dr(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):W(n)&&n.contentEditable=="false"}function jn(n,e){return e<0?rk(n):ok(n)}function rk(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ge&&W(t)&&r<Me(t)&&Dr(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(!W(t))break;let l=t.childNodes[r-1];if(Dr(l,-1))o=t,i=--r;else if(ke(l))t=l,r=t.nodeValue.length;else break}else{if(Nf(t))break;{let l=t.previousSibling;for(;l&&Dr(l,-1);)o=t.parentNode,i=Le(l),l=l.previousSibling;if(l)t=l,r=Me(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Nl(n,t,r):o&&Nl(n,o,i)}function ok(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=Me(t),i,s;for(;;)if(r<o){if(!W(t))break;let l=t.childNodes[r];if(Dr(l,1))i=t,s=++r;else break}else{if(Nf(t))break;{let l=t.nextSibling;for(;l&&Dr(l,1);)i=l.parentNode,s=Le(l)+1,l=l.nextSibling;if(l)t=l,r=0,o=Me(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}i&&Nl(n,i,s)}function Nf(n){for(let e=n;e;e=e.parentNode){let t=e.pmViewDesc;if(t)return t.node?t.node.isBlock:!1}return!1}function Nl(n,e,t){if(!ke(e)){let s,l;(l=gf(e,t))?(e=l,t=0):(s=mf(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection(),o=n.domSel.readRange();if(!r)return;Xo(o)?r.collapse(e,t):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(e,t)),n.domSel.ignore();let{state:i}=n;setTimeout(()=>{n.state==i&&n.domSel.sync()},50)}function Wp(n,e){let t=n.state.doc.resolve(e);if(!(Pe||kf)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}let r=n.dom;for(let i=t.depth;i>0;i--)if(t.node(i).isBlock){r=n.nodeDOM(t.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function Kp(n,e,t){let r=n.state.selection;if(r instanceof F&&!r.empty||t.indexOf("s")>-1||je&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Tl(n.state,e);if(s&&s instanceof R)return qt(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof ue?K.near(s,e):K.findFrom(s,e);return l?qt(n,l):!1}return!1}function Up(n,e){if(!(n.state.selection instanceof F))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Jp(n,e,t){n.domObserver.stopped(()=>e.contentEditable=t)}function ik(n){if(!Re||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSel.readRange();if(e&&W(e)&&t==0&&e.firstChild&&W(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jp(n,r,"true"),setTimeout(()=>Jp(n,r,"false"),20)}return!1}function sk(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function lk(n,e){let t=e.keyCode,r=sk(e);if(t==8||je&&t==72&&r=="c")return Up(n,-1)||jn(n,-1);if(t==46&&!e.shiftKey||je&&t==68&&r=="c")return Up(n,1)||jn(n,1);if(t==13||t==27)return!0;if(t==37||je&&t==66&&r=="c"){let o=t==37?Wp(n,n.state.selection.from)=="ltr"?-1:1:-1;return jp(n,o,r)||jn(n,o)}else if(t==39||je&&t==70&&r=="c"){let o=t==39?Wp(n,n.state.selection.from)=="ltr"?1:-1:1;return jp(n,o,r)||jn(n,o)}else{if(t==38||je&&t==80&&r=="c")return Kp(n,-1,r)||jn(n,-1);if(t==40||je&&t==78&&r=="c")return ik(n)||Kp(n,1,r)||jn(n,1);if(r==(je?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function zl(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=n.someProp("clipboardSerializer")||Ve.fromSchema(n.state.schema),l=Df(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&W(c)&&(d=Rf[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let h=l.createElement(d[f]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),u++}c=a.firstChild}c&&W(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
6
8
|
|
|
7
|
-
`);return{dom:a,text:
|
|
8
|
-
`))),0,0),n.someProp("transformPasted",
|
|
9
|
-
`),s&&c==a.nodeValue.length)for(let u=a,d;u;u=u.parentNode){if(d=u.nextSibling){d.nodeName=="BR"&&(t=r={node:d.parentNode,offset:Ee(d)+1});break}let f=u.pmViewDesc;if(f&&f.node&&f.node.isBlock)break}}else{let u=a.childNodes[c-1];s=u&&(u.nodeName=="BR"||u.contentEditable=="false")}}let l=o.domSel.readRange();if(Ke&&l.focusNode&&l.focusNode!=r.node&&$(l.focusNode)){let a=l.focusNode.childNodes[l.focusOffset];a&&a.contentEditable=="false"&&(i=!0)}!(i||s&&Te)&&no(t.node,t.offset,l.anchorNode,l.anchorOffset)&&no(r.node,r.offset,l.focusNode,l.focusOffset)||Fc(o.domSelection(),{focusNode:r.node,focusOffset:r.offset,anchorNode:t.node,anchorOffset:t.offset})}function wc(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Te&&o&&o.contentEditable=="false")return Xi(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Xi(o);if(i)return Xi(i)}}function Xi(n){return n.contentEditable="true",Te&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function xc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Jg(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSel.readRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ou(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Gg(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom;t.nodeName=="IMG"?e.collapse(t.parentNode,Ee(t)+1):e.collapse(t,0)}function Xg(n,e){if(e instanceof B){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Sc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Sc(n)}function Sc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function An(n,e,t,r){let o=n.someProp("createSelectionBetween",i=>i(n,e,t))||H.between(e,t,r);return n.someProp("adjustSelectionFromDOM",i=>{o=i(n,o)}),o}function su(n){if(n.editable&&!n.hasFocus())return null;let e=n.domSel.readRange();return e&&lu(n,e)?e:null}function lu(n,e){if(!e.anchorNode)return!1;try{return Mn(n.dom,e.anchorNode)&&(n.editable||Mn(n.dom,e.focusNode))}catch{return!1}}function Qg(n){for(let e in Ne){let t=Ne[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{eb(n,r)&&(n.input.composing&&(r.type=="keydown"||r.type=="beforeinput")&&r.isComposing===!1&&uu(n,!0),!ks(n,r)&&(n.editable||!(r.type in Le))&&t(n,r))},Yg[e]?{passive:!0}:void 0)}Te&&n.dom.addEventListener("input",()=>null),ds(n)}function mo(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Zg(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function ds(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ks(n,r))})}function ks(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function eb(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function tb(n,e){!ks(n,e)&&Ne[e.type]&&(n.editable||!(e.type in Le))&&Ne[e.type](n,e)}function Lt(n,e){let{input:t}=n;return t.lastKeyDispatched||n.composing?!1:(t.lastKeyDispatched=!0,typeof e=="string"&&(e=ug(e=="Backspace"?8:13,e)),n.someProp("handleKeyDown",r=>r(n,e)))}function ar(n){return{left:n.clientX,top:n.clientY}}function nb(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ws(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function au(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function rb(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(au(n,new B(t)),!0):!1}function ob(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof B&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(B.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(au(n,B.create(n.state.doc,o)),!0):!1}function ib(n,e,t,r,o){return ws(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?ob(n,t):rb(n,t))}function sb(n,e,t,r){return ws(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function lb(n,e,t,r){return ws(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))}function Mc(n,e,t){if(e==-1)return n.inlineContent?H.create(n,0,n.content.size):null;let r=n.resolve(e);for(let o=r.depth+1;o>0;o--){let i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)return H.create(n,s+1,s+1+i.content.size);if(t&&B.isSelectable(i))return B.create(n,s)}return null}function Cc(n,e){let t=n.resolve(e),r=t.node(),o="",i=e,s=e;for(let m=t.indexAfter(),g=!1;m>0;m--){let b=r.child(m-1);if(!b.text)break;let x=i==e?e-t.posAtIndex(m-1):b.text.length,w=x;for(;w>0;w--)if(/\S/.test(b.text[w-1]))g=!0;else if(g)break;if(o=b.text.slice(w,x)+o,i-=x-w,w||i<e-50)break}for(let m=t.index(),g=!1;m<r.childCount;m++){let b=r.child(m);if(!b.text)break;let x=s==e?e-t.posAtIndex(m):0,w=x;for(;w<b.text.length;w++)if(/\S/.test(b.text[w]))g=!0;else if(g)break;if(o+=b.text.slice(x,w),s+=w-x,w<b.text.length||s>e+50)break}let l=i,a=s;if(Intl.Segmenter){for(let m of new Intl.Segmenter(void 0,{granularity:"word"}).segment(o))if(m.isWordLike){let g=m.index+i,b=g+m.segment.length;if(b<e)l=b;else if(g>e){a=g;break}else return H.create(n,g,b)}}else{fs.lastIndex=0;for(let m;m=fs.exec(o);){let g=m.index+i,b=g+m[0].length;if(b<e)l=b;else if(g>e){a=g;break}else return H.create(n,g,b)}}let c=o.slice(l-i,e-i),u=o.slice(e-i,a-i),d=/\S*$/.exec(c)[0].length,f=/^\S*/.exec(u)[0].length;if(d||f)return H.create(n,e-d,e+f);let p=/\s*$/.exec(c)[0].length,h=/^\s*/.exec(u)[0].length;return H.create(n,e-p,e+h)}function Ec(n){let e=n.dom.getBoundingClientRect();return{x:e.left-n.dom.scrollLeft,y:e.top-n.dom.scrollTop}}function Ac(n,e,t){if(t.inside>-1){let o=e.nodeAt(t.inside);if(o.isAtom&&B.isSelectable(o))return B.create(e,t.inside)}let r=e.resolve(t.pos);return An(n,r,r)}function ab(n,e){let{selection:t}=n.state;if(t.empty)return!1;let r=n.domSelection();if(!r||r.rangeCount==0)return!0;let o=r.getRangeAt(0).getClientRects();for(let i=0;i<o.length;i++){let s=o[i];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function cb(n,e){return n.composing?!0:Te&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}function db(n){let{focusNode:e,focusOffset:t}=n.domSel.range;if(!e||!$(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return $(r)&&r.contentEditable=="false"}function uu(n,e=!1){n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,e?Yt(n):du(n,20)}function du(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Yt(n),e))}function fu(n){n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());for(let e;e=n.input.compositionNodes.pop();)e.markParentDamage()}function fb(n){let e=n.domSel.range;if(!n.domSel.active||!e.focusNode)return null;let t=Hc(e.focusNode,e.focusOffset),r=zc(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Yt(n,e=!1){if(!(dt&&n.domObserver.flushingSoon>=0)&&(n.domObserver.forceFlush(),fu(n),e||n.docView&&n.docView.damage)){let t=vs(n,n.domSel.readRange()),r=n.state.selection;t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state)}}function pb(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}function hb(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function mb(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ur(n,r.value,null,o,e):ur(n,r.textContent,r.innerHTML,o,e)},50)}function ur(n,e,t,r,o){let i=Qc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||O.empty)))return!0;if(!i)return!1;let s=hb(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pu(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}function hu(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[gb]}function bb(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(ar(e));if(!r)return;let o=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=Qc(n,pu(e.dataTransfer),cr?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(t&&hu(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||O.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Gr(n.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=n.state.tr;if(s){let{node:p}=t;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&B.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new B(f));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((h,m,g,b)=>p=b),a.setSelection(An(n,f,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}function dr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}function yb(n,e,t,r,o,i,s){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,p,h,m)=>{let g=m-h-(p-f);for(let b=0;b<l.length;b+=3){let x=l[b+1];if(x<0||f>x+u-d)continue;let w=l[b]+u-d;p>=w?l[b+1]=f<=w?-2:-1:f>=u&&g&&(l[b]+=g,l[b+1]+=g)}d+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),g=r.maybeChild(h);if(g&&m==d&&m+g.nodeSize==p){let b=l[c+2].mapInner(t,g,u+1,n[c]+i+1,s);b!=we?(l[c]=d,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=vb(l,n,e,t,o,i,s),u=fo(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Y(e.sort(Ot),l)}function mu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new re(o.from+e,o.to+e,o.type))}return t}function vb(n,e,t,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?t.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function gu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<r&&((o||(o=[])).push(s),n[i]=null);return o}function bu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function fo(n,e,t,r){let o=[],i=!1;e.forEach((l,a)=>{let c=gu(n,l,a+t);if(c){i=!0;let u=fo(c,l,t+a+1,r);u!=we&&o.push(a,a+l.nodeSize,u)}});let s=mu(i?bu(n):n,-t).sort(Ot);if(s.length){let l=new fr(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1))}return s.length||o.length?new Y(s,o):we}function Ot(n,e){return n.from-e.from||n.to-e.to}function xs(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,r.to),Tc(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),Tc(e,o,r.copy(i.from,r.to)));break}}}return e}function Tc(n,e,t){for(;e<n.length&&Ot(t,n[e])>0;)e++;n.splice(e,0,t)}function Yi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=we&&e.push(r)}),n.cursorWrapper&&e.push(Y.create(n.state.doc,[n.cursorWrapper.deco])),uo.from(e)}function kb(n,e,t,r){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSel.range,u,d=c.anchorNode;if(d&&Mn(n.dom,d)&&(u=[{node:d,offset:c.anchorOffset}],po(c)||u.push({node:c.focusNode,offset:c.focusOffset})),Ae&&n.input.lastKeyCode===8)for(let b=s;b>i;b--){let x=o.childNodes[b-1],w=x.pmViewDesc;if(x.nodeName=="BR"&&!w){s=b;break}if(!w||w.size)break}let f=n.state.doc,p=n.someProp("domParser")||St.fromSchema(n.state.schema),h=f.resolve(l),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:wb(r),context:h});if(u&&u[0].pos!=null){let b=u[0].pos,x=u[1]&&u[1].pos;x==null&&(x=b),m={anchor:b+l,head:x+l}}return{doc:g,sel:m,from:l,to:a}}function Sb(n,e,t,r,o,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,y=vs(n,n.domSel.range,S);if(y&&!n.state.selection.eq(y)&&n.domSel.active){if(Ae&&dt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&Lt(n,"Enter"))return;let k=n.state.tr.setSelection(y);S=="pointer"?k.setMeta("pointer",!0):S=="key"&&k.scrollIntoView(),s&&k.setMeta("composition",s),n.dispatch(k)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=kb(n,e,t,i),d=n.state.doc,f=d.slice(u.from,u.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Ab(f.content,u.doc.content,u.from,p,h);if(m&&n.input.domChangeCount++,(En&&n.input.lastIOSEnter>Date.now()-225||dt)&&i.some(S=>$(S)&&!xb.test(S.nodeName))&&(!m||m.endA>=m.endB)&&Lt(n,"Enter")){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof H&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let S=Nc(n,n.state.doc,u.sel);if(S&&!S.eq(n.state.selection)){let y=n.state.tr.setSelection(S);s&&y.setMeta("composition",s),n.dispatch(y)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof H&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to));let g=u.doc.resolveNoCache(m.start-u.from),b=u.doc.resolveNoCache(m.endB-u.from),x=d.resolve(m.start),w=g.sameParent(b)&&g.parent.inlineContent&&x.end()>=m.endA;if((En&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!w&&Eb(u.doc,g.pos,b.pos))&&Lt(n,"Enter")){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&(w?m.endA>m.start&&m.endB==m.start:Cb(d,m.start,m.endA,g,b))&&Lt(n,"Backspace")){dt&&Ae&&n.domSel.suppressChanges();return}Ae&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),dt&&!w&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,b=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>Lt(n,"Enter"),20));let E=m.start,D=m.endA,C=S=>{let y=S||n.state.tr.replace(E,D,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let k=Nc(n,y.doc,u.sel);k&&!(Ae&&n.composing&&k.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(k.head==E||k.head==y.mapping.map(D)-1))&&y.setSelection(k)}return s&&y.setMeta("composition",s),y.scrollIntoView()},N;if(w)if(g.pos==b.pos){let S=C(n.state.tr.delete(E,D)),y=d.resolve(m.start).marksAcross(d.resolve(m.endA));y&&S.ensureMarks(y),n.dispatch(S)}else if(m.endA==m.endB&&(N=Mb(g.parent.content.cut(g.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let S=C(n.state.tr);N.type=="add"?S.addMark(E,D,N.mark):S.removeMark(E,D,N.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,b.parentOffset),y=()=>C(n.state.tr.insertText(S,E,D));n.someProp("handleTextInput",k=>k(n,E,D,S,y))||n.dispatch(y())}else n.dispatch(C());else n.dispatch(C())}function Nc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:An(n,e.resolve(t.anchor),e.resolve(t.head))}function Mb(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(A.from(c).eq(n))return{mark:l,type:s}}function Cb(n,e,t,r,o){if(t-e<=o.pos-r.pos||Qi(r,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!r.parent.inlineContent){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(Qi(i,!0,!0));return!s.parent.isTextblock||s.pos>t||Qi(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Eb(n,e,t){let r=0,o=0;return n.nodesBetween(e,t,(i,s)=>{i.isTextblock&&s>=e&&s<t?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-s),Math.min(i.nodeSize,t-s))):i.isLeaf)&&o++}),o==0&&r==1}function Qi(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Ab(n,e,t,r,o){let i=n.findDiffStart(e,t),s=t+n.size,l=t+e.size;if(i==null)return null;let{a,b:c}=n.findDiffEnd(e,s,l);if(o=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&s<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}function Nb(n){if(!Lc.has(n)&&(Lc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ke,Oc)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."),Oc=!0}}function Lb(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Ob(n,e){var t;let{focusNode:r,focusOffset:o}=n.domSel.range;for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||!$(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&n.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function Dc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[re.node(0,n.state.doc.content.size,e)]}function Rc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:re.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Pc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Db(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ic(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Rb(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Bc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ee,Zi,oc,Ze,sc,Cn,Ke,es,Ae,$c,Te,En,qe,_c,dt,ho,pg,kn,Sg,Cg,ac,cc,uc,Xt,oo,ns,Kt,Dt,sr,io,so,or,jt,rs,Fg,nu,rr,ze,cs,kc,Ne,Le,Yg,us,fs,cu,ps,ub,cr,ao,gb,fr,co,Jt,hs,re,xn,Gt,Y,we,uo,wb,xb,Tb,ms,Lc,Oc,Qt,Rt=P(()=>{"use strict";K();de();Ye();Ee=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e};Zi=null;oc=/^(img|br|input|textarea|hr)$/i;Ze=typeof navigator<"u"?navigator:null,sc=typeof document<"u"?document:null,Cn=Ze&&Ze.userAgent||"",Ke=/gecko\/(\d+)/i.test(Cn)&&!/edge?\//i.test(Cn);Ke&&+(/Firefox\/(\d+)/.exec(Cn)||[0,0])[1];es=/Chrome\/(\d+)/.exec(Cn),Ae=!!es,$c=es?+es[1]:0,Te=!!Ze&&/Apple Computer/.test(Ze.vendor),En=Te&&(/Mobile\/\w+/.test(Cn)||!!Ze&&Ze.maxTouchPoints>2),qe=En||(Ze?/Mac/.test(Ze.platform):!1),_c=Ze?/Win/.test(Ze.platform):!1,dt=/Android \d/.test(Cn),ho=!!sc&&"webkitFontSmoothing"in sc.documentElement.style,pg=ho?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;kn=null;Sg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;Cg=/[\u0590-\u08ac]/;ac=null,cc=null,uc=!1;Xt=class{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.damage=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&Mn(this.contentDOM,e))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Ee(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?o=t>Array.from(e.childNodes).findIndex(s=>s.contains(this.contentDOM)):o=!(i&4)}else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!($(s)?Mn(s,e):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof io||i instanceof oo&&i.side>=0))break}if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Ee(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Ee(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ee(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Ee(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!$(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDamage(e){e&&(this.damage|=e,this.markParentDamage())}markParentDamage(){for(let e=this;;){let{parent:t}=e;if(!t||t.damage&1)break;t.damage|=1,e=t}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},oo=class extends Xt{constructor(e,t,r,o){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let l=$(s)?s:document.createElement("span");l!=s&&(l.appendChild(s),s=l),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return!this.damage&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},ns=class extends Xt{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Kt=class n extends Xt{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=je.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.damage&4||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return!(this.damage&4)&&this.mark.eq(e)}markDamage(e){var t;this.damage|=e,(t=this.parent)===null||t===void 0||t.markDamage(2)}slice(e,t,r){let o=n.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=is(i,t,s,r)),e>0&&(i=is(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Dt=class n extends Xt{constructor(e,t,r,o,i,s,l){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,t,r,o,i,s){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(!ge(u))throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=je.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Xc(u,r,t),c?a=new so(e,t,r,o,u,d||null,f,c):t.isText?new sr(e,t,r,o,u,f):new n(e,t,r,o,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){t.contentElement=o.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(o=>$(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?t.contentElement=r:t.getContent=()=>A.empty}}return t}matchesNode(e,t,r){return!this.damage&&e.eq(this.node)&&lo(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new rs(this,s&&s.node,e),c=this.node.inlineContent,u=c&&this.node.isBlock;Og(this.node,this.innerDeco,(d,f,p)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e,f):d.type.side>=0&&!p&&a.syncToMarks(f==this.node.childCount?W.none:this.node.child(f).marks,r,e,f),a.placeWidget(d,e,o)},(d,f,p,h)=>{a.syncToMarks(d.marks,r,e,h),u&&d.isAtom&&!d.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(d,f,p,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(m=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(d,f,p,m,e,o)||a.updateNextNode(d,f,p,e,h,o)||a.addNode(d,f,p,e,o),o+=d.nodeSize,c&&(u=d.isAtom&&!d.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.damage&2)&&(s&&this.protectLocalComposition(e,s),Gc(this.contentDOM,this.children,e),En&&Dg(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof H)||r<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Rg(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;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 ns(this,i,t,o);e.input.compositionNodes.push(s),this.children=is(this.children,r,r+o.length,e,s)}update(e,t,r,o,i){return this.damage&4||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o,i),!0)}updateInner(e,t,r,o,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,i+1),this.damage=0}updateOuterDeco(e){if(lo(e,this.outerDeco))return;let t=!$(this.nodeDOM),r=this.dom;this.dom=bs(this.dom,this.nodeDOM,lr(this.outerDeco,this.node,t),lr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){$(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){$(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};sr=class n extends Dt{constructor(e,t,r,o,i,s){super(e,t,r,o,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.damage&4||this.damage&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.damage&8||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.damage=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return!1}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i)}get domAtom(){return!1}isText(e){return this.node.text==e}},io=class extends Xt{parseRule(){return{ignore:!0}}matchesHack(e){return!this.damage&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},so=class extends Dt{constructor(e,t,r,o,i,s,l,a){super(e,t,r,o,i,s,l),this.spec=a}update(e,t,r,o,i){if(this.damage&4)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};or=function(n){n&&(this.nodeName=n)};or.prototype=Object.create(null);jt=[new or];rs=class{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ng(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,o){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.damage=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof Kt&&!(u.damage&4)&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Kt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,o,i,s){let l=this.top.children[o];return l.damage&4&&l.dom==l.contentDOM&&(l.damage=2),l.update(e,t,r,i,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Dt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&!(a.damage&4)&&lo(t,a.outerDeco));if(!f&&a.update(e,t,r,o,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.damage|=2,d.updateChildren(o,s+1),d.damage=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,i,s){if(e.damage&3||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!lo(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Dt.create(this.top,t,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,o,i){let s=Dt.create(this.top,e,t,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new oo(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Kt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof sr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Te||Ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new io(this.top,[],r,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||$(e)&&e.contains(this.lock.parentNode))}};Fg=/^(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;nu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};rr=null;ze=class n{constructor(e,t,r,o){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=o}static from(e){return e instanceof n?e:new n(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};ze.null=new ze(null,0,null,0);cs=class{constructor(e){this.view=e,this.range=ze.null,this.active=!1,this.synced=!1,this.suppress=!1,this.currentDocument=null,this.onSelectionChange=this.onSelectionChange.bind(this)}ensureListener(){let e=this.view.dom.ownerDocument;e!=this.currentDocument&&(this.currentDocument&&this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=e,e.addEventListener("selectionchange",this.onSelectionChange))}destroy(){this.currentDocument&&(this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=null),this.active=!1,this.range=ze.null}suppressChanges(){this.suppress=!0,setTimeout(()=>this.suppress=!1,50)}onSelectionChange(){if(this.suppress&&this.view.hasFocus())return this.sync();this.read()&&this.view.domObserver.flush(!1)}readRange(){let{view:e}=this,t=e.dom.isConnected!==!1&&e.domSelection();return t?Te&&e.root.nodeType===11&&dg(e.dom.ownerDocument)==e.dom?ze.from(Ug(e,t)||t):ze.from(t):ze.null}read(){this.ensureListener();let e=su(this.view);if(!e){this.active=!1,this.range=ze.null;return}return this.active=!0,this.range.eq(e)?!1:(this.range=e,this.synced=!1,!0)}sync(e=!1){let{view:t}=this;t.docView&&(this.ensureListener(),t.domObserver.stopped(()=>{Xg(t,t.state.selection);let r=t.state.selection;if(t.input.mouseDown||ou(t)){let{desc:o,start:i}=iu(t.docView,r.from,r.to,0);t.cursorWrapper?Gg(t):o instanceof so&&o.spec.setSelection?o.spec.setSelection(r.anchor-i,r.head-i,t.root):jg(t,e,o,i),this.synced=this.active=!0}r.visible==t.dom.classList.contains("ProseMirror-hideselection")&&(r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),Jg(t))),this.range=this.readRange()}))}ignore(e=this.readRange()){this.range=ze.from(e),this.synced=!0}deactivate(){this.range=ze.null,this.active=this.synced=!1}};kc=Te||Ae&&$c<63;Ne={},Le={},Yg={touchstart:!0,touchmove:!0},us=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,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}};Le.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),n.input.lastKeyDispatched=!1,!(dt&&Ae&&t.keyCode==13)){if(En&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(Lt(n,"Enter"),n.input.lastIOSEnter=0)},200);return}t.keyCode!=229&&n.domObserver.forceFlush(!0),Lt(n,t)||zg(n,t)?t.preventDefault():mo(n,"key")}};Le.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Le.keypress=(n,e)=>{let t=e;if(cb(n)||!t.charCode||t.ctrlKey&&!t.altKey||qe&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,o,i))&&n.dispatch(i()),t.preventDefault()}};fs=/[\w_\u00a1-\uffff]+/g;try{fs=new RegExp("[\\p{L}\\p{N}_]+","gu")}catch{}cu=qe?"metaKey":"ctrlKey";Ne.mousedown=(n,e)=>{let t=e,r=Date.now();if(n.input.shiftKey=t.shiftKey,n.input.lastTouch>r-500)return!1;Yt(n);let o="singleClick";r-n.input.lastClick.time<500&&nb(t,n.input.lastClick)&&!t[cu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:o,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let i=n.posAtCoords(ar(t));if(i)if(t.button==0){if(!n.hasFocus()){Wc(n.dom);let l=n.root.activeElement;l&&!l.contains(n.dom)&&l.blur()}(n.input.mouseDown=new ps(n,i,t,o)).mightDrag||t.preventDefault()}else mo(n,"pointer")};ps=class{constructor(e,t,r,o){var i;this.view=e,this.startPos=t,this.event=r,this.type=o,this.didMove=!1,this.lastPos=-1,this.anchorRange=null,this.startDoc=e.state.doc,this.selectNode=!!r[cu],this.extend=r.shiftKey,this.anchorDoc=this.startDoc;let s=Ec(e);if(this.extend){let l=e.state.selection;this.anchorRange=l instanceof B?{from:l.from,to:l.to}:{from:l.anchor,to:l.anchor};let a=l instanceof B?e.nodeDOM(l.from).getBoundingClientRect():e.coordsAtPos(l.anchor);this.anchorOffset={x:(a.left+a.right)/2-s.x,y:(a.top+a.bottom)/2-s.y}}else this.anchorOffset={x:r.clientX-s.x,y:r.clientY-s.y};if(o=="singleClick"){let{selection:l}=e.state,a,c,u=!1;if(l instanceof B&&l.from<=t.pos&&l.to>=t.pos)c=l.from,a=l.node,u=!0;else if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),c=t.inside;else{let d=e.state.doc.resolve(t.pos);a=d.parent,c=d.depth?d.before():-1}if(u||c>-1&&a.type.spec.draggable&&a.type.spec.selectable!==!1){let d=(i=e.docView.descAt(c))===null||i===void 0?void 0:i.nodeDOM;this.mightDrag={node:a,elt:d,pos:c,addAttr:!1},d&&!d.draggable&&(this.mightDrag.addAttr=!0,e.domObserver.stopped(()=>d.draggable=!0))}else this.mightDrag=ab(e,r)}else this.mightDrag=!1;e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),this.mightDrag||this.select(this.startPos,!0)}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null),typeof this.mightDrag=="object"&&this.mightDrag.addAttr&&this.view.domObserver.stopped(()=>this.mightDrag.elt.removeAttribute("draggable"))}maybeRunHandler(e,t){return(this.type=="singleClick"?ib:this.type=="doubleClick"?sb:lb)(this.view,e.pos,e.inside,t,this.selectNode)}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.startPos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ar(e))),t&&(this.didMove||this.maybeRunHandler(t,e)||this.select(t,!0),e.preventDefault())}move(e){if(e.buttons==0){this.done();return}if(!this.didMove&&(Math.abs(this.event.x-e.clientX)>8||Math.abs(this.event.y-e.clientY)>8)&&(this.didMove=!0,this.mightDrag=!1),!this.mightDrag){let t=this.view.posAtCoords(ar(e));t&&this.select(t,!1)}e.preventDefault()}select(e,t){if(e.pos==this.lastPos)return;this.lastPos=e.pos;let{view:r}=this,{doc:o}=r.state,i=this.type=="singleClick"?Ac(r,o,e):this.type=="doubleClick"?Cc(o,e.pos):Mc(o,e.inside,t);i&&(t&&!this.extend?this.anchorRange=i:(!t||this.extend)&&(o.eq(this.anchorDoc)||this.restoreAnchor(),this.anchorRange&&this.anchorRange.from<i.from?i=An(r,o.resolve(this.anchorRange.from),o.resolve(i.to)):this.anchorRange&&this.anchorRange.to>i.to&&(i=An(r,o.resolve(this.anchorRange.to),o.resolve(i.from)))),i.eq(r.state.selection)||r.dispatch(r.state.tr.setSelection(i).setMeta("pointer",!0).scrollIntoView()))}restoreAnchor(){let e=Ec(this.view),t=this.view.posAtCoords({left:this.anchorOffset.x+e.x,top:this.anchorOffset.y+e.y});if(!t)this.anchorRange=null;else{let{doc:r}=this.view.state;this.anchorRange=this.type=="singleClick"?Ac(this.view,r,t):this.type=="doubleClick"?Cc(r,t.pos):Mc(r,t.inside,!1),this.anchorDoc=this.view.state.doc}}};Ne.touchstart=n=>{n.input.lastTouch=Date.now(),Yt(n),mo(n,"pointer")};Ne.touchmove=n=>{n.input.lastTouch=Date.now(),mo(n,"pointer")};Ne.contextmenu=n=>Yt(n);ub=dt?5e3:-1;Le.compositionstart=Le.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof H&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ae&&_c&&db(n)))n.markCursor=n.state.storedMarks||t.marks(),Yt(n,!0),n.markCursor=null;else if(Yt(n,!e.selection.empty),Ke&&n.domSel.active&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length)for(let{focusNode:r,focusOffset:o}=n.domSel.range;r&&$(r)&&o!=0;){let i=o<0?r.lastChild:r.childNodes[o-1];if(!i)break;if(ge(i)){let s=n.domSelection();s&&s.collapse(i,i.nodeValue.length);break}else r=i,o=-1}n.input.composing=!0}du(n,ub)};Le.compositionend=(n,e)=>{n.composing&&uu(n)};cr=En&&pg<604;Ne.copy=Le.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=cr?null:t.clipboardData,s=r.content(),{dom:l,text:a}=ys(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):pb(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};Le.paste=(n,e)=>{let t=e;if(n.composing&&!dt)return;let r=cr?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ur(n,pu(r),r.getData("text/html"),o,t)?t.preventDefault():mb(n,t)};ao=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},gb=qe?"altKey":"ctrlKey";Ne.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(ar(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof B?o.to-1:o.to))){if(r&&typeof r.mightDrag=="object")s=B.create(n.state.doc,r.mightDrag.pos);else if(t.target&&$(t.target)){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=B.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=ys(n,l);(!t.dataTransfer.files.length||!Ae||$c>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(cr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",cr||t.dataTransfer.setData("text/plain",c),n.dragging=new ao(u,hu(n,t),s)};Ne.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Le.dragover=Le.dragenter=(n,e)=>e.preventDefault();Le.drop=(n,e)=>{try{bb(n,e,n.dragging)}finally{n.dragging=null}};Ne.focus=n=>{if(n.input.lastFocus=Date.now(),!n.focused&&(n.domObserver.stopped(()=>n.dom.classList.add("ProseMirror-focused")),n.focused=!0,n.domSel.read(),!n.domSel.synced)){let e=n.domSel.range;setTimeout(()=>{let t=n.domSel.readRange();t&&e.eq(t)&&n.domSel.sync()},20)}};Ne.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stopped(()=>n.dom.classList.remove("ProseMirror-focused")),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domSel.deactivate(),n.focused=!1)};Ne.beforeinput=(n,e)=>{if(dt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||n.domObserver.pendingRecords().length||(n.dom.blur(),n.focus(),Lt(n,"Backspace")))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Le)Ne[n]=Le[n];fr=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let t=this.frag.child(this.index);if(this.off==e)return t;this.off+=t.nodeSize,this.index++}return null}},co=class n{constructor(e,t){this.toDOM=e,this.spec=t||Gt,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new re(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&dr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Jt=class n{constructor(e,t){this.attrs=e,this.spec=t||Gt}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new re(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}static is(e){return e.type instanceof n}destroy(){}},hs=class n{constructor(e,t){this.attrs=e,this.spec=t||Gt}map(e,t,r,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=i.pos?null:new re(i.pos-r,s.pos-r,this)}valid(e,t,r){let o=r.nodeAt(t.from);return!!o&&!o.isText&&t.from+o.nodeSize==t.to}eq(e){return this==e||e instanceof n&&dr(this.attrs,e.attrs)&&dr(this.spec,e.spec)}destroy(){}},re=class n{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new n(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new n(e,e,new co(t,r))}static inline(e,t,r,o){return new n(e,t,new Jt(r,o))}static node(e,t,r,o){return new n(e,t,new hs(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Jt}get widget(){return this.type instanceof co}},xn=[],Gt={},Y=class n{constructor(e,t){this.local=e.length?e:xn,this.children=t.length?t:xn}static create(e,t){return t.length?fo(t,e,0,Gt):we}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from>t)break;l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length&&!(this.children[s]>=t);s+=3)if(this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==we||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Gt)}mapInner(e,t,r,o,i){let s;if(this.local.length){let l=new fr(t.content);for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c,l)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}}return this.children.length?yb(this.children,s||[],e,t,r,o,i):s?new n(s.sort(Ot),xn):we}add(e,t){return t.length?this==we?n.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=gu(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,fo(u,l,c+1,Gt)),i+=3}});let s=mu(i?bu(t):t,-r).sort(Ot);if(s.length){let l=new fr(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||s.splice(a--,1)}return new n(s.length?this.local.concat(s).sort(Ot):this.local,o||this.children)}remove(e){return e.length==0||this==we?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=we?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new n(o,r):we}forChild(e,t){if(this==we)return this;if(t.isLeaf)return n.empty;let r,o,i=0,s=this.children.length/3;for(;i<s;){let c=i+s>>>1,u=c*3,d=this.children[u];if(d<e)i=c+1;else if(d>e)s=c;else{r=this.children[u+2];break}}let l=e+1,a=l+t.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<a&&u.to>l&&u.type instanceof Jt){let d=Math.max(l,u.from)-l,f=Math.min(a,u.to)-l;d<f&&(o||(o=[])).push(u.copy(d,f))}}if(o){let c=new n(o.sort(Ot),xn);return r?new uo([c,r]):c}return r||we}eq(e){if(this==e)return!0;if(!(e instanceof n)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return xs(this.localsInner(e))}localsInner(e){if(this==we)return xn;if(e.inlineContent||!this.local.some(Jt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Jt||t.push(this.local[r]);return t}forEachSet(e){e(this)}};Y.empty=new Y([],[]);Y.removeOverlap=xs;we=Y.empty,uo=class n{constructor(e){this.members=e}map(e,t){let r=this.members.map(o=>o.map(e,t,Gt));return n.from(r)}forChild(e,t){if(t.isLeaf)return Y.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=we&&(i instanceof n?r=r.concat(i.members):r.push(i))}return n.from(r)}eq(e){if(!(e instanceof n)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?xs(r?t:t.sort(Ot)):xn}static from(e){switch(e.length){case 0:return we;case 1:return e[0];default:return new n(e.every(t=>t instanceof Y)?e:e.reduce((t,r)=>t.concat(r instanceof Y?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};wb=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(Te&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Te&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},xb=/^(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;Tb={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ms=class{constructor(e){this.view=e,this.queue=[],this.flushingSoon=-1,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.started=!1,this.observer=new window.MutationObserver(t=>{for(let r=0;r<t.length;r++)this.queue.push(t[r]);Te&&e.composing&&t.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()})}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(e=!1){this.flushingSoon>-1?(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush(!0)):e&&this.flush(!0)}start(){this.observer.takeRecords(),this.observer.observe(this.view.dom,Tb),this.started=!0}stop(){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect(),this.started=!1}stopped(e){if(!this.started)return e();this.stop();try{return e()}finally{this.start()}}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=Sn(i))t.add(i);for(let i=e.anchorNode;i;i=Sn(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:ge(r)?r.parentNode:r}))return this.view.domSel.ignore(e),!0}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(e=!0){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]),e&&t.domSel.read();let o=!t.domSel.suppress&&!t.domSel.synced&&!!su(t)&&!this.ignoreSelectionChange(t.domSel.range),i=-1,s=-1,l=!1,a=[];if(t.editable)for(let u=0;u<r.length;u++){let d=this.registerMutation(r[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Ae&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&$(d);){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ke&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=t.domSel.range;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||Lb(t,d)!=p)&&f.remove()}}}let c=null;i<0&&o&&t.domSel.active&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&po(t.domSel.range)&&(c=vs(t,t.domSel.range))&&c.eq(F.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,t.domSel.sync(),t.scrollToSelection()):(i>-1||o)&&(i>-1&&Nb(t),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,Ob(t,a)),Sb(this.view,i,s,o,l,a),t.docView&&t.docView.damage?t.updateState(t.state):o&&t.domSel.sync())}registerMutation(e,t){var r;if(t.indexOf(e.target)>-1)return null;let o;for(let i=e.target;i&&!(o=this.view.docView.getDesc(i));i=i.parentNode);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),ge(f)&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return o.markDamage(4),{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling,l=i&&i.parentNode==e.target?Ee(i)+1:0,a=o.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?Ee(s):e.target.childNodes.length,u=o.localPosFromDOM(e.target,c,1);return o.markDamage(!((r=o.contentDOM)===null||r===void 0)&&r.contains(e.target)?2:4),{from:a,to:u}}else return e.type=="attributes"?(o.markDamage(4),{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}):(this.lastChangedTextNode=e.target,o.markDamage(o instanceof sr&&e.target==o.nodeDOM?8:4),{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Lc=new WeakMap,Oc=!1;Qt=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new us,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Bc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Pc(this),Rc(this),this.nodeViews=Ic(this),this.docView=dc(this.state.doc,Dc(this),Yi(this),this.dom,this),this.domObserver=new ms(this),this.domSel=new cs(this),this.domObserver.start(),this.domSel.read(),Qg(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ds(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Bc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(fu(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Ic(this);Rb(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ds(this),this.editable=Pc(this),Rc(this);let a=Yi(this),c=Dc(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&gg(this);s&&this.domObserver.stopped(()=>{let p=d&&Ae&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Db(o.selection,e.selection);if(d){let h=Ae?this.trackWrites=this.domSel.range.focusNode:null;if(this.composing&&(this.input.compositionNode=fb(this)),i||!this.docView.update(e.doc,c,a,this,-1)){let m=this.docView.outerDeco;this.docView.destroy(),this.docView=dc(e.doc,c,a,this.dom,this,m)}h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}this.domSel.sync(p)}),this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&bg(f)}scrollToSelection(){let e=this.domSel.range.focusNode;if(!(!e||!this.domSel.active)){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof B){let t=this.docView.domAfterPos(this.state.selection.from);$(t)&&lc(this,t.getBoundingClientRect(),e)}else lc(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new ao(e.slice,e.move,o<0?void 0:B.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){return this.root.activeElement==this.dom}focus(){this.editable&&Wc(this.dom),this.domSel.sync()}get root(){let e=this.dom.isConnected!==!1;e||(this._root=null);let t=this._root;if(t==null&&e){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(e){return xg(this,e)}coordsAtPos(e,t=1){return Kc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Ag(this,t||this.state,e)}pasteHTML(e,t){return ur(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ur(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ys(this,e)}destroy(){this.docView&&(Zg(this),this.domSel.destroy(),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yi(this),this,-1),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ag())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return tb(this,e)}domSelection(){return this.root.getSelection()}};Qt.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))}});function yu(n){var e=Pb&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ib&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?bo:ft)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var ft,bo,Pb,Ib,ue,ue,ue,go,vu=P(()=>{"use strict";ft={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:"'"},bo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Pb=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ib=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ue=0;ue<10;ue++)ft[48+ue]=ft[96+ue]=String(ue);for(ue=1;ue<=24;ue++)ft[ue+111]="F"+ue;for(ue=65;ue<=90;ue++)ft[ue]=String.fromCharCode(ue+32),bo[ue]=String.fromCharCode(ue);for(go in ft)bo.hasOwnProperty(go)||(bo[go]=ft[go])});function zb(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Bb?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Fb(n){let e=Object.create(null);for(let t in n)e[zb(t)]=n[t];return e}function Ss(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Fe(n){return new _({props:{handleKeyDown:pr(n)}})}function pr(n){let e=Fb(n);return function(t,r){let o=yu(r),i,s=e[Ss(o,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Ss(o,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Hb&&r.ctrlKey&&r.altKey)&&(i=ft[r.keyCode])&&i!=o){let l=e[Ss(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Bb,Hb,pt=P(()=>{"use strict";vu();K();Bb=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Hb=typeof navigator<"u"&&/Win/.test(navigator.platform)});function Cs(n="c"){let e=new Uint8Array(9);return globalThis.crypto.getRandomValues(e),n+Array.from(e,t=>(t%36).toString(36)).join("")}function ku(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!hr.test(e.id))return null;let t=Array.isArray(e.comments)?e.comments.map(wu).filter(o=>o!==null):[],r=e.resolved;return{id:e.id,createdAt:Number(e.createdAt)||0,comments:t,resolved:r&&typeof r=="object"?{by:Ms(r.by),at:Number(r.at)||0}:null}}function Ms(n){let e=n&&typeof n=="object"?n:{};return{id:String(e.id??"").slice(0,128),name:String(e.name??"").slice(0,80)}}function wu(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!hr.test(e.id))return null;let t={id:e.id,author:Ms(e.author),text:String(e.text??"").slice(0,5e3),createdAt:Number(e.createdAt)||0};if(e.editedAt&&(t.editedAt=Number(e.editedAt)||0),Array.isArray(e.mentions)){let r=e.mentions.slice(0,20).map(Ms).filter(o=>/^[\w.@:+-]{1,128}$/.test(o.id)&&o.name);r.length&&(t.mentions=r)}return t}function xu(n=[],e){let t=n.map(ku).filter(s=>s!==null),r=new Set,o=s=>{t=s,e?.(t),r.forEach(l=>l())},i=(s,l)=>o(t.map(a=>a.id===s?l(a):a));return{threads:()=>t,subscribe(s){return r.add(s),()=>r.delete(s)},createThread(s){let l=ku(s);!l||t.some(a=>a.id===l.id)||o([...t,l])},reply(s,l){let a=wu(l);a&&i(s,c=>({...c,comments:[...c.comments,a]}))},editComment(s,l,a){i(s,c=>({...c,comments:c.comments.map(u=>u.id===l?{...u,text:a.slice(0,5e3),editedAt:Date.now()}:u)}))},deleteComment(s,l){i(s,a=>({...a,comments:a.comments.filter(c=>c.id!==l)}))},setResolved(s,l){i(s,a=>({...a,resolved:l??null}))},deleteThread(s){o(t.filter(l=>l.id!==s))}}}var hr,Su=P(()=>{"use strict";hr=/^[A-Za-z0-9_-]{1,64}$/});var Eu={};He(Eu,{createCommentsPanel:()=>Wb});function Vb(n){let e=0;for(let t of n)e=e*31+t.charCodeAt(0)|0;return Cu[Math.abs(e)%Cu.length]}function qb(n){return n.trim().split(/\s+/).filter(Boolean).slice(0,2).map(t=>[...t][0].toUpperCase()).join("")||"?"}function Wb(n){let{editor:e,store:t,labels:r}=n,o=e.options.language??"en",i=new Intl.RelativeTimeFormat(o,{numeric:"auto"}),s=new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}),l=Ce("nova-comments-title"),a=new Map,c=new Map,u=null,d=!1,f=v("div",{className:"nova-comments-list"}),p=v("span",{className:"nova-comments-count"}),h=v("input",{type:"checkbox"});h.addEventListener("change",()=>{d=h.checked,N()});let m=v("aside",{className:"nova-comments","aria-labelledby":l,hidden:!0,onKeydown:(S=>{S.key==="Escape"&&(S.stopPropagation(),n.pending()?n.cancelPending():n.closePanel())})},v("div",{className:"nova-comments-head"},v("h2",{id:l,className:"nova-comments-title"},r.panel),p,v("button",{type:"button",className:"nova-btn nova-comments-close","aria-label":r.close,title:r.close,onClick:()=>n.closePanel()},"\xD7")),v("label",{className:"nova-comments-filter"},h,r.showResolved),f);function g(S){let y=Math.round((S-Date.now())/1e3),k=Math.abs(y),T=k<45?i.format(0,"second"):k<3600?i.format(Math.round(y/60),"minute"):k<86400?i.format(Math.round(y/3600),"hour"):k<86400*7?i.format(Math.round(y/86400),"day"):s.format(S);return v("time",{dateTime:new Date(S).toISOString(),title:s.format(S)},T)}function b(S,y){let k=v("span",{className:"nova-comment-avatar","aria-hidden":"true"},qb(y));return k.style.backgroundColor=Vb(S||y),k}function x(S){let y=Ce("nova-mention-list"),k=v("textarea",{className:"nova-input nova-comment-input",rows:2,maxlength:5e3,placeholder:S.placeholder,"aria-label":S.placeholder,"data-draft":S.key});k.value=a.get(S.key)??S.initial??"";let T=c.get(S.key)??new Map((S.initialMentions??[]).map(q=>[q.id,q]));c.set(S.key,T);let I=v("button",{type:"button",className:"nova-button nova-button-primary"},S.submitLabel),R=v("ul",{id:y,className:"nova-mention-list",role:"listbox","aria-label":r.people,hidden:!0}),z=[],te=0,fe=null,Br=0;n.findUsers&&(k.setAttribute("role","combobox"),k.setAttribute("aria-autocomplete","list"),k.setAttribute("aria-controls",y),k.setAttribute("aria-expanded","false"));let Vn=()=>{fe=null,z=[],R.hidden=!0,R.replaceChildren(),k.setAttribute("aria-expanded","false"),k.removeAttribute("aria-activedescendant")},Kl=()=>{if(!fe)return Vn();R.replaceChildren(...z.length?z.map((q,Be)=>{let Bt=v("li",{id:`${y}-${Be}`,role:"option",className:"nova-mention-option","aria-selected":String(Be===te)},b(q.id,q.name),v("span",{className:"nova-mention-name"},q.name),q.description?v("span",{className:"nova-mention-detail"},q.description):null);return Bt.addEventListener("mousedown",Ht=>{Ht.preventDefault(),Gl(Be)}),Bt}):[v("li",{className:"nova-mention-empty",role:"presentation"},r.noPeople)]),R.hidden=!1,k.setAttribute("aria-expanded","true"),z.length?k.setAttribute("aria-activedescendant",`${y}-${te}`):k.removeAttribute("aria-activedescendant")},Jl=()=>{let q=n.findUsers;if(!q)return;let Be=k.selectionStart??0,Bt=k.value.slice(0,Be),Ht=/(?:^|\s)@([\p{L}\p{N}_.-]{0,30})$/u.exec(Bt);if(!Ht)return Vn();let Yl=Ht[1]??"";fe={start:Be-Yl.length-1,end:Be};let pm=++Br;q(Yl).then(hm=>{pm!==Br||!fe||(z=hm,te=0,Kl())})},Gl=q=>{let Be=z[q];if(!Be||!fe)return;let Bt=`@${Be.name} `;k.value=k.value.slice(0,fe.start)+Bt+k.value.slice(fe.end);let Ht=fe.start+Bt.length;k.setSelectionRange(Ht,Ht),T.set(Be.id,{id:Be.id,name:Be.name}),Vn(),Ei(),k.focus()},Ei=()=>{a.set(S.key,k.value),I.disabled=k.value.trim()===""},Xl=()=>{let q=k.value;q.trim()&&(a.delete(S.key),c.delete(S.key),S.onSubmit(q,[...T.values()]))};k.addEventListener("input",()=>{Ei(),Jl()}),k.addEventListener("click",Jl),k.addEventListener("blur",()=>setTimeout(Vn,0)),k.addEventListener("keydown",q=>{if(fe&&!R.hidden){if(q.key==="ArrowDown"||q.key==="ArrowUp"){if(q.preventDefault(),!z.length)return;te=(te+(q.key==="ArrowDown"?1:-1)+z.length)%z.length,Kl();return}if((q.key==="Enter"&&!q.ctrlKey&&!q.metaKey||q.key==="Tab")&&z.length){q.preventDefault(),Gl(te);return}if(q.key==="Escape"){q.preventDefault(),q.stopPropagation(),Vn();return}}q.key==="Enter"&&(q.ctrlKey||q.metaKey)&&(q.preventDefault(),Xl())}),I.addEventListener("click",Xl),Ei();let fm=S.onCancel?v("button",{type:"button",className:"nova-button",onClick:()=>{a.delete(S.key),c.delete(S.key),S.onCancel()}},r.cancel):null;return v("div",{className:"nova-comment-composer"},v("div",{className:"nova-mention-wrap"},k,R),v("div",{className:"nova-comment-actions"},fm,I))}function w(S){let y=v("p",{className:"nova-comment-text"}),k=(S.mentions??[]).map(R=>`@${R.name}`).sort((R,z)=>z.length-R.length);if(!k.length)return y.textContent=S.text,y;let T=k.map(R=>R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),I=S.text.split(new RegExp(`(${T.join("|")})`,"g"));return y.append(...I.map(R=>k.includes(R)?v("span",{className:"nova-comment-mention"},R):R)),y}function E(S,y,k){let T=n.canEdit(y),I=u?.threadId===S.id&&u.commentId===y.id&&T,R=y.author.id===n.author.id,z=v("div",{className:"nova-comment-head"},b(y.author.id,y.author.name),v("span",{className:"nova-comment-author"},y.author.name||r.guest,R?v("span",{className:"nova-comment-you"},` (${r.you})`):null),g(y.createdAt),y.editedAt?v("span",{className:"nova-comment-edited"},r.edited):null),te=I?x({key:`edit:${S.id}:${y.id}`,placeholder:r.placeholder,submitLabel:r.save,initial:y.text,initialMentions:y.mentions??[],onSubmit:Br=>{u=null,t.editComment(S.id,y.id,Br.trim())},onCancel:()=>{u=null,N()}}):w(y),fe=T&&!I?v("div",{className:"nova-comment-tools"},v("button",{type:"button",className:"nova-link-btn",onClick:()=>{u={threadId:S.id,commentId:y.id},N(),C(`edit:${S.id}:${y.id}`)}},r.edit),k>0?v("button",{type:"button",className:"nova-link-btn",onClick:()=>t.deleteComment(S.id,y.id)},r.remove):null):null;return v("div",{className:"nova-comment-item"},z,te,fe)}function D(S){let y=n.active()===S.id,k=n.quote(S.id),T=S.comments[0],I=T?n.canEdit(T):!0,R=v("article",{className:["nova-thread",y?"is-active":"",S.resolved?"is-resolved":"",k?"":"is-orphan"].filter(Boolean).join(" "),"data-thread":S.id,tabindex:"-1","aria-current":y?"true":null},k?v("blockquote",{className:"nova-thread-quote"},k.slice(0,140)):v("p",{className:"nova-thread-orphan"},r.orphan),S.comments.map((z,te)=>E(S,z,te)),S.resolved?v("p",{className:"nova-thread-resolved"},r.resolvedBy.replace("{name}",S.resolved.by.name||r.guest)):null,y&&!S.resolved?x({key:`reply:${S.id}`,placeholder:r.replyPlaceholder,submitLabel:r.reply,onSubmit:(z,te)=>n.reply(S.id,z,te)}):null,v("div",{className:"nova-thread-tools"},v("button",{type:"button",className:"nova-button",onClick:()=>n.setResolved(S.id,!S.resolved)},S.resolved?r.reopen:r.resolve),I?v("button",{type:"button",className:"nova-button nova-button-danger",onClick:()=>n.deleteThread(S.id)},r.deleteThread):null));return R.addEventListener("click",z=>{z.target.closest("button, textarea, input, a")||n.active()!==S.id&&n.setActive(S.id,!0)}),R}function C(S){let y=f.querySelector(`textarea[data-draft="${S}"]`);y&&(y.focus(),y.setSelectionRange(y.value.length,y.value.length))}function N(){let S=f.contains(document.activeElement)?document.activeElement.getAttribute("data-draft"):null,y=[...t.threads()].sort((R,z)=>n.positionOf(R.id)-n.positionOf(z.id)||R.createdAt-z.createdAt),k=y.filter(R=>!R.resolved),T=d?y:k;p.textContent=k.length?String(k.length):"",p.setAttribute("aria-label",r.count.replace("{count}",String(k.length)));let I=[];n.pending()&&I.push(v("article",{className:"nova-thread is-active is-new"},v("div",{className:"nova-comment-head"},b(n.author.id,n.author.name),v("span",{className:"nova-comment-author"},n.author.name)),x({key:"new",placeholder:r.placeholder,submitLabel:r.comment,onSubmit:(R,z)=>n.submitPending(R,z),onCancel:()=>n.cancelPending()}))),I.push(...T.map(D)),I.length===0&&I.push(v("p",{className:"nova-comments-empty"},r.empty.replace("{shortcut}",Qe(n.shortcut)))),f.replaceChildren(...I),S&&C(S),f.querySelector(".nova-thread.is-active")?.scrollIntoView?.({block:"nearest"})}return{el:m,render:N,focusComposer:()=>C("new"),destroy:()=>m.remove()}}var Cu,Au=P(()=>{"use strict";Z();Cu=["#2563eb","#db2777","#16a34a","#ea580c","#7c3aed","#0891b2","#ca8a04","#dc2626"]});function Nn(n,e,t,r){let{filePicker:o,filePickerTypes:i}=n.options;if(!o||i&&!i.includes(t))return;let{input:s}=e,l=v("button",{type:"button",className:"nova-btn nova-input-action","aria-label":n.ui.t("dialog.browse"),title:n.ui.t("dialog.browse")},X(M.browse)),a=v("div",{className:"nova-input-group"});s.replaceWith(a),a.append(s,l),l.addEventListener("click",async()=>{l.disabled=!0;try{let c=await o({type:t,value:s.value});if(!c?.url)return;s.value=c.url,s.removeAttribute("aria-invalid"),r?.(c)}catch(c){console.error("[nova] filePicker failed:",c)}finally{l.disabled=!1,s.isConnected&&s.focus()}})}var xo=P(()=>{"use strict";Z();j()});function ry(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=oy(n),t=n.childCount,r=[],o=0,i=null,s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let d=n.child(c);u++;for(let h=0;;h++){for(;o<r.length&&r[o]!=0;)o++;if(h==d.childCount)break;let m=d.child(h),{colspan:g,rowspan:b,colwidth:x}=m.attrs;for(let w=0;w<b;w++){if(w+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-w});break}let E=o+w*e;for(let D=0;D<g;D++){r[E+D]==0?r[E+D]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:g-D});let C=x&&x[D];if(C){let N=(E+D)%e*2,S=s[N];S==null||S!=C&&s[N+1]==1?(s[N]=C,s[N+1]=1):S==C&&s[N+1]++}}}o+=g,u+=m.nodeSize}let f=(c+1)*e,p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});let l=new ie(e,t,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&iy(l,s,n),l}function oy(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let o=n.child(r),i=0;if(t)for(let s=0;s<r;s++){let l=n.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){let l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function iy(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o<n.map.length;o++){let i=n.map[o];if(r[i])continue;r[i]=!0;let s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null,a=s.attrs;for(let c=0;c<a.colspan;c++){let u=e[(o+c)%n.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=sy(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function sy(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ju(n,e){if(typeof n=="string")return{};let t=n.getAttribute("data-colwidth"),r=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(s=>Number(s)):null,o=Number(n.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(let s in e){let l=e[s].getFromDOM,a=l&&l(n);a!=null&&(i[s]=a)}return i}function Ku(n,e){let t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(let r in e){let o=e[r].setDOMAttr;o&&o(n.attrs[r],t)}return t}function ly(n){if(n!==null){if(!Array.isArray(n))throw new TypeError("colwidth must be null or an array");for(let e of n)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function rd(n){let e=n.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:ly}};for(let r in e)t[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>ju(r,e)}],toDOM(r){return["td",Ku(r,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>ju(r,e)}],toDOM(r){return["th",Ku(r,e),0]}}}}function Se(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}function Zt(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function ay(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ne(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function To(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=Zt(e.$head)||cy(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function cy(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Vs(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function uy(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Us(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function od(n,e,t){let r=n.node(-1),o=ie.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function en(n,e,t=1){let r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function id(n,e,t=1){let r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function dy(n,e,t){let r=Se(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}function py(n){if(!(n.selection instanceof ee))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(re.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Y.create(n.doc,e)}function hy({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function my({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function gy(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof B&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ee.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=ee.rowSelection(l,l)}else if(!t){let l=ie.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=ee.create(o,a+1,c)}}else r instanceof H&&hy(r)?i=H.create(o,r.from):r instanceof H&&my(r)&&(i=H.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function ld(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){let a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<o&&n.child(l).sameMarkup(a)?ld(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function yy(n,e){let t,r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=vy(n,o,i,t))};return e?e.doc!=n.doc&&ld(e.doc,n.doc,0,r):n.doc.descendants(r),t}function vy(n,e,t,r){let o=ie.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){let c=o.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);if(!u)continue;let d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,en(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){let u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);let h=[];for(let g=0;g<f;g++){let b=Se(n.schema)[p].createAndFill();b&&h.push(b)}let m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),h)}c=d}return r.setMeta(by,{fixTables:!0})}function Ln(n){return ky(e=>e.type.spec.tableRole==="table",n)}function ky(n,e){for(let t=e.depth;t>=0;t-=1){let r=e.node(t);if(n(r))return{node:r,pos:t===0?0:e.before(t),start:e.start(t),depth:t}}return null}function _e(n){let e=n.selection,t=To(n),r=t.node(-1),o=t.start(-1),i=ie.get(r);return{...e instanceof ee?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:r}}function ad(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;dy(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,id(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=i==null?Se(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function cd(n,e){if(!ne(n))return!1;if(e){let t=_e(n);e(ad(n.tr,t,t.left))}return!0}function ud(n,e){if(!ne(n))return!1;if(e){let t=_e(n);e(ad(n.tr,t,t.right))}return!0}function wy(n,{map:e,table:t,tableStart:r},o){let i=n.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+o,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(r+a),null,en(u,o-e.colCount(a)));else{let d=n.mapping.slice(i).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function dd(n,e){if(!ne(n))return!1;if(e){let t=_e(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;wy(r,t,o),o!=t.left;o--){let i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=ie.get(i)}e(r)}return!0}function xy(n,e,t){var r;let o=Se(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((r=e.nodeAt(n.map[i+t*n.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function fd(n,{map:e,tableStart:t,table:r},o){let i=t;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;let s=[],l=o>0?-1:0;xy(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){let d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;let d=l==null?Se(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&s.push(f)}return n.insert(i,Se(r.type.schema).row.create(null,s)),n}function pd(n,e){if(!ne(n))return!1;if(e){let t=_e(n);e(fd(n.tr,t,t.top))}return!0}function js(n,e){if(!ne(n))return!1;if(e){let t=_e(n);e(fd(n.tr,t,t.bottom))}return!0}function Sy(n,{map:e,table:t,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=t.child(c).nodeSize;let s=i+t.child(o).nodeSize,l=n.mapping.maps.length;n.delete(i+r,s+r);let a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){let d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){let f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){let f=t.nodeAt(d),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,t);n.insert(n.mapping.slice(l).map(r+m),h),c+=p.colspan-1}}}}function hd(n,e){if(!ne(n))return!1;if(e){let t=_e(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;Sy(r,t,o),o!=t.top;o--){let i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=ie.get(t.table)}e(r)}return!0}function Ju(n){let e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function My({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function md(n,e){let t=n.selection;if(!(t instanceof ee)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=_e(n),{map:o}=r;if(My(o,r))return!1;if(e){let i=n.tr,s={},l=A.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){let f=o.map[u*o.width+d],p=r.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,a==null)a=f,c=p;else{Ju(p)||(l=l.append(p.content));let h=i.mapping.map(f+r.tableStart);i.delete(h,h+p.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...id(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let u=a+1+c.content.size,d=Ju(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new ee(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function gd(n,e){let t=Se(n.schema);return Cy(({node:r})=>t[r.type.spec.tableRole])(n,e)}function Cy(n){return(e,t)=>{let r=e.selection,o,i;if(r instanceof ee){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=ay(r.$from),!o)return!1;i=(s=Zt(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=_e(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let f;for(let p=u.top;p<u.bottom;p++){let h=u.map.positionAt(p,u.left,u.table);p==u.top&&(h+=o.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&p==u.top||d.insert(f=d.mapping.map(h+u.tableStart,1),n({node:o,row:p,col:m}).createAndFill(a[g]))}d.setNodeMarkup(i,n({node:o,row:u.top,col:u.left}),a[0]),r instanceof ee&&d.setSelection(new ee(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function bd(n,e){return function(t,r){if(!ne(t))return!1;let o=To(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ee?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(i)}return!0}}function Ey(n){return function(e,t){if(!ne(e))return!1;if(t){let r=Se(e.schema),o=_e(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);t(i)}return!0}}function Gu(n,e,t){let r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){let i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function On(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Ey(n):function(t,r){if(!ne(t))return!1;if(r){let o=Se(t.schema),i=_e(t),s=t.tr,l=Gu("row",i,o),a=Gu("column",i,o),c=(n==="column"?l:n==="row"&&a)?1:0,u=n=="column"?{left:0,top:c,right:1,bottom:i.map.height}:n=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{let p=f+i.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,d,h.attrs)}),r(s)}return!0}}function Ay(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function No(n){return function(e,t){if(!ne(e))return!1;let r=Ay(To(e),n);if(r==null)return!1;if(t){let o=e.doc.resolve(r);t(e.tr.setSelection(H.between(o,uy(o))).scrollIntoView())}return!0}}function yd(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function So(n,e){let t=n.selection;if(!(t instanceof ee))return!1;if(e){let r=n.tr,o=Se(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new O(o,0,0))}),r.docChanged&&e(r)}return!0}function Ty(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=qs(Se(s).row,new O(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||r?qs(Se(s).row,new O(e,t,r)).content:e);else return null;return Ny(s,l)}function Ny(n,e){let t=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(A.empty),t[o]<r){let i=Se(n).cell.createAndFill(),s=[];for(let l=t[o];l<r;l++)s.push(i);e[o]=e[o].append(A.from(s))}return{height:e.length,width:r,rows:e}}function qs(n,e){let t=n.createAndFill();return new mn(t).replace(0,t.content.size,e).doc}function Ly({width:n,height:e,rows:t},r,o){if(n!=r){let i=[],s=[];for(let l=0;l<t.length;l++){let a=t[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(en(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[l+p]=(i[l+p]||0)+f.attrs.colspan}s.push(A.from(c))}t=s,n=r}if(e!=o){let i=[];for(let s=0,l=0;s<o;s++,l++){let a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(A.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function Oy(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=Se(l),c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){let p=t.child(d);f+=p.nodeSize;let h=[],m;p.lastChild==null||p.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<o;g++)h.push(m);n.insert(n.mapping.slice(s).map(f-1+r),h)}if(i>e.height){let d=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,o);h++){let g=h>=e.width?!1:t.nodeAt(e.map[m+h]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,A.from(d)),p=[];for(let h=e.height;h<i;h++)p.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),p)}return!!(c||u)}function Xu(n,e,t,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){let u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;let f=t.nodeAt(d),{top:p,left:h}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-p}),n.insert(n.mapping.slice(l).map(e.positionAt(s,h,t)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function Yu(n,e,t,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){let u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;let f=t.nodeAt(d),p=e.colCount(d),h=n.mapping.slice(l).map(d+r);n.setNodeMarkup(h,null,en(f.attrs,s-p,f.attrs.colspan-(s-p))),n.insert(h+f.nodeSize,f.type.createAndFill(en(f.attrs,0,s-p))),c+=f.attrs.rowspan-1}}return a}function Qu(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=ie.get(i),{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=n.tr,f=0;function p(){if(i=t?d.doc.nodeAt(t-1):d.doc,!i)throw new Error("No table found");s=ie.get(i),f=d.mapping.maps.length}Oy(d,s,i,t,c,u,f)&&p(),Xu(d,s,i,t,a,c,l,f)&&p(),Xu(d,s,i,t,a,c,u,f)&&p(),Yu(d,s,i,t,l,u,a,f)&&p(),Yu(d,s,i,t,l,u,c,f)&&p();for(let h=l;h<u;h++){let m=s.positionAt(h,a,i),g=s.positionAt(h,c,i);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(g+t),new O(o.rows[h-l],0,0))}p(),d.setSelection(new ee(d.doc.resolve(t+s.positionAt(l,a,i)),d.doc.resolve(t+s.positionAt(u-1,c-1,i)))),e(d)}function Eo(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Mo(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection;if(i instanceof ee)return Eo(t,r,F.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=vd(o,n,e);if(s==null)return!1;if(n=="horiz")return Eo(t,r,F.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=od(l,n,e),c;return a?c=F.near(a,1):e<0?c=F.near(t.doc.resolve(l.before(-1)),-1):c=F.near(t.doc.resolve(l.after(-1)),1),Eo(t,r,c)}}}function Co(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof ee)s=i;else{let a=vd(o,n,e);if(a==null)return!1;s=new ee(t.doc.resolve(a))}let l=od(s.$headCell,n,e);return l?Eo(t,r,new ee(s.$anchorCell,l)):!1}}function Ry(n,e){let t=n.state.doc,r=Zt(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ee(r))),!0):!1}function Py(n,e,t){if(!ne(n.state))return!1;let r=Ty(t),o=n.state.selection;if(o instanceof ee){r||(r={width:1,height:1,rows:[A.from(qs(Se(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=ie.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=Ly(r,l.right-l.left,l.bottom-l.top),Qu(n.state,n.dispatch,s,l,r),!0}else if(r){let i=To(n.state),s=i.start(-1);return Qu(n.state,n.dispatch,s,ie.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function Iy(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Zu(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof ee)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Zt(n.state.selection.$anchor))!=null&&((t=Fs(n,e))===null||t===void 0?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=Fs(n,c),d=Pt.getState(n.state)==null;if(!u||!Us(a,u))if(d)u=a;else return;let f=new ee(a,u);if(d||!n.state.selection.eq(f)){let p=n.state.tr.setSelection(f);d&&p.setMeta(Pt,a.pos),n.dispatch(p)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Pt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Pt,-1))}function l(a){let c=a,u=Pt.getState(n.state),d;if(u!=null)d=n.state.doc.resolve(u);else if(Zu(n,c.target)!=r&&(d=Fs(n,e),!d))return s();d&&i(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function vd(n,e,t){if(!(n.state.selection instanceof H))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let s=r.before(o),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function Zu(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fs(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:r,pos:o}=t;return r>=0&&Zt(n.state.doc.resolve(r))||Zt(n.state.doc.resolve(o))}function Ws(n,e,t,r,o,i){let s=0,l=!0,a=e.firstChild,c=n.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){let{colspan:p,colwidth:h}=c.child(d).attrs;for(let m=0;m<p;m++,f++){let g=o==f?i:h&&h[m],b=g?g+"px":"";if(s+=g||r,g||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{let x=document.createElement("col");x.style.width=b,e.appendChild(x)}}}for(;a;){var u;let d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}function kd({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=Ks,lastColumnResizable:o=!0}={}){let i=new _({key:$e,state:{init(s,l){var a;let c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Se(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,t,f)),new By(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=$e.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{Hy(s,l,n,o)},mouseleave:s=>{zy(s)},mousedown:(s,l)=>{Fy(s,l,e,t)}},decorations:s=>{let l=$e.getState(s);if(l&&l.activeHandle>-1)return Wy(s,l.activeHandle)},nodeViews:{}}});return i}function Hy(n,e,t,r){if(!n.editable)return;let o=$e.getState(n.state);if(o&&!o.dragging){let i=_y(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=ed(n,e,"left",t):a-e.clientX<=t&&(s=ed(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=ie.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}wd(n,s)}}}function zy(n){if(!n.editable)return;let e=$e.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&wd(n,-1)}function Fy(n,e,t,r){var o;if(!n.editable)return!1;let i=(o=n.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=$e.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=$y(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta($e,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);let f=$e.getState(n.state);f?.dragging&&(Vy(n,f.activeHandle,td(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta($e,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=$e.getState(n.state);if(f&&f.dragging){let p=td(f.dragging,d,t);nd(n,f.activeHandle,p,r)}}return nd(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function $y(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),s=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let a=0;a<t;a++)r[a]&&(s-=r[a],l--);return s/l}function _y(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ed(n,e,t,r){let o=t=="right"?-r:r,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;let{pos:s}=i,l=Zt(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;let a=ie.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function td(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function wd(n,e){n.dispatch(n.state.tr.setMeta($e,{setHandle:e}))}function Vy(n,e,t){let r=n.state.doc.resolve(e),o=r.node(-1),i=ie.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;let d=i.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[p]==t)continue;let h=f.colwidth?f.colwidth.slice():qy(f.colspan);h[p]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:h})}a.docChanged&&n.dispatch(a)}function nd(n,e,t,r){let o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=ie.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ws(i,a.firstChild,a,r,l,t)}function qy(n){return Array(n).fill(0)}function Wy(n,e){let t=[],r=n.doc.resolve(e),o=r.node(-1);if(!o)return Y.empty;let i=ie.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){let u=l+c*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var a;let d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((a=$e.getState(n))===null||a===void 0)&&a.dragging&&t.push(re.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),t.push(re.widget(f,p))}}return Y.create(n.doc,t)}function xd({allowTableNodeSelection:n=!1}={}){return new _({key:Pt,state:{init(){return null},apply(e,t){let r=e.getMeta(Pt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:py,handleDOMEvents:{mousedown:Iy},createSelectionBetween(e){return Pt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Ry,handleKeyDown:Dy,handlePaste:Py},appendTransaction(e,t,r){return gy(r,yy(r,t),n)}})}var $s,_s,ie,Pt,ee,fy,by,ex,tx,nx,Dy,Ks,$e,By,Js=P(()=>{"use strict";K();de();Rt();pt();Ye();if(typeof WeakMap<"u"){let n=new WeakMap;$s=e=>n.get(e),_s=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;$s=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},_s=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}ie=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){let t=this.map[e];if(t!=n)continue;let r=e%this.width,o=e/this.width|0,i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){let{left:r,right:o,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[i*this.width+(t<0?r-1:o)]:(t<0?i==0:s==this.height)?null:this.map[r+this.width*(t<0?i-1:s)]}rectBetween(n,e){let{left:t,right:r,top:o,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(n){let e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){let i=r*this.width+o,s=this.map[i];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[i-1]==s||r==n.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){let i=o+t.child(r).nodeSize;if(r==n){let s=e+n*this.width,l=(n+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(n){return $s(n)||_s(n,ry(n))}};Pt=new J("selectingCells");ee=class mt extends F{constructor(e,t=e){let r=e.node(-1),o=ie.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);let c=a.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=i+u+1;return new Et(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Vs(r)&&Vs(o)&&Us(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?mt.rowSelection(r,o):i&&this.isColSelection()?mt.colSelection(r,o):new mt(r,o)}return H.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=ie.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){let c=[];for(let u=a*t.width+o.left,d=o.left;d<o.right;d++,u++){let f=t.map[u];if(i[f])continue;i[f]=!0;let p=t.findCell(f),h=e.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);let m=o.left-p.left,g=p.right-o.right;if(m>0||g>0){let b=h.attrs;if(m>0&&(b=en(b,0,m)),g>0&&(b=en(b,b.colspan-g,g)),p.left<o.left){if(h=h.type.createAndFill(b),!h)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else h=h.type.create(b,h.content)}if(p.top<o.top||p.bottom>o.bottom){let b={...h.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?h=h.type.createAndFill(b):h=h.type.create(b,h.content)}c.push(h)}s.push(e.child(a).copy(A.from(c)))}let l=this.isColSelection()&&this.isRowSelection()?e:s;return new O(A.from(l),1,1)}replace(e,t=O.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?O.empty:t)}let i=F.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new O(A.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=ie.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=ie.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new mt(e,t)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ie.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),i=t.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof mt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=ie.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new mt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new mt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new mt(e.resolve(t),e.resolve(r))}getBookmark(){return new fy(this.$anchorCell.pos,this.$headCell.pos)}};ee.prototype.visible=!1;F.jsonID("cell",ee);fy=class sd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sd(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Us(t,r)?new ee(t,r):F.near(r,1)}};by=new J("fix-tables");ex=On("row",{useDeprecatedLogic:!0}),tx=On("column",{useDeprecatedLogic:!0}),nx=On("cell",{useDeprecatedLogic:!0});Dy=pr({ArrowLeft:Mo("horiz",-1),ArrowRight:Mo("horiz",1),ArrowUp:Mo("vert",-1),ArrowDown:Mo("vert",1),"Shift-ArrowLeft":Co("horiz",-1),"Shift-ArrowRight":Co("horiz",1),"Shift-ArrowUp":Co("vert",-1),"Shift-ArrowDown":Co("vert",1),Backspace:So,"Mod-Backspace":So,Delete:So,"Mod-Delete":So});Ks=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ws(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Ws(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};$e=new J("tableColumnResizing");By=class Ao{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta($e);if(r&&r.setHandle!=null)return new Ao(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ao(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Vs(e.doc.resolve(o))||(o=-1),new Ao(o,t.dragging)}return t}}});function Sd(n){let t=n.replace(/[\u0000- \u007f-\u009f]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);return t?`${t[1].toLowerCase()}:`:null}function Re(n){let e=Sd(n);return e===null||Uy.has(e)}function Pe(n){if(Ky.test(n.trim()))return!0;let e=Sd(n);return e===null||jy.has(e)}var Uy,jy,Ky,gt=P(()=>{"use strict";Uy=new Set(["http:","https:","mailto:","tel:"]),jy=new Set(["http:","https:","blob:"]),Ky=/^data:image\/(png|jpe?g|gif|webp|avif|bmp);base64,/i});function Qy(n){let e=n.trim().toLowerCase(),t=e.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(1|1\.0+)\s*)?\)$/);if(t)return"#"+t.slice(1,4).map(o=>Math.min(255,Number(o)).toString(16).padStart(2,"0")).join("");let r=e.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/);return r?`#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`:e}function Zy(n){let e=n.getAttribute("dir")?.toLowerCase();return e==="rtl"||e==="ltr"?e:null}function Md(n){let e=n.style.textAlign;return{align:Po.includes(e)?e:null,lineHeight:U.lineHeight(n.style.lineHeight),dir:Zy(n)}}function Cd(n){let e={};(n.dir==="rtl"||n.dir==="ltr")&&(e.dir=n.dir);let t=[],r=n.align;r&&Po.includes(r)&&t.push(`text-align: ${r};`);let o=U.lineHeight(n.lineHeight);return o&&t.push(`line-height: ${o};`),t.length&&(e.style=t.join(" ")),e}function Ad(n,e,t){let r=n.style.listStyleType.toLowerCase(),o=ev[n.getAttribute("type")??""]??"",i=e.includes(r)?r:e.includes(o)?o:null;return i===t?null:i}function Td(n,e){return typeof n=="string"&&e.includes(n)?{style:`list-style-type: ${n};`}:{}}function nv(n){let e=n.style.float||n.getAttribute("align");return e==="left"||e==="right"?e:n.style.display==="block"&&n.style.marginLeft==="auto"&&n.style.marginRight==="auto"?"center":null}function Ie(n){if(n==null||n==="")return null;let e=String(n).trim().match(/^(\d{1,5})(px)?$/);if(!e)return null;let t=Number(e[1]);return t>=1&&t<=1e4?t:null}function rv(n){let e=[],t=U.length(n.width);return t&&e.push(`width: ${t};`),n.align==="center"?e.push("margin-left: auto; margin-right: auto;"):n.align==="right"&&e.push("margin-left: auto;"),e.join(" ")}function iv(n){let e=rd({tableGroup:"block",cellContent:"block+",cellAttributes:{class:{default:null,getFromDOM:t=>tn(t,n),setDOMAttr:(t,r)=>{let o=Ve(t).class;o&&(r.class=o)}},background:{default:null,getFromDOM:t=>U.color(t.getAttribute("data-nova-cell-bg")??t.style.backgroundColor),setDOMAttr:(t,r)=>{let o=U.color(t);o&&(r.style=`${r.style??""}background-color: ${o};`)}},valign:{default:null,getFromDOM:t=>{let r=t,o=(r.style.verticalAlign||r.getAttribute("valign")||"").toLowerCase();return Nd.includes(o)?o:null},setDOMAttr:(t,r)=>{Nd.includes(t)&&(r.style=`${r.style??""}vertical-align: ${t};`)}}}});e.table.attrs={width:{default:null},align:{default:null},class:{default:null}},e.table.parseDOM=[{tag:"table",getAttrs:t=>{let r=t,o=U.length(r.style.width)??U.length(`${r.getAttribute("width")??""}px`),i=l=>l==="auto",s=r.getAttribute("align")==="center"||i(r.style.marginLeft)&&i(r.style.marginRight)?"center":r.getAttribute("align")==="right"||i(r.style.marginLeft)?"right":null;return{width:o,align:s,class:tn(r,n)}}}],e.table.toDOM=t=>{let r=rv(t.attrs);return["table",{...Ve(t.attrs.class),...r?{style:r}:{}},["tbody",0]]};for(let t of["table_cell","table_header"]){let r=e[t],o=r.parseDOM[0],i=o.getAttrs;o.getAttrs=l=>{let a=i(l);if(!a)return a;let c=u=>Math.min(ov,Math.max(1,Number.isFinite(u)?Math.floor(u):1));return{...a,colspan:c(a.colspan),rowspan:c(a.rowspan)}};let s=r.toDOM;r.toDOM=l=>{let a=s(l),c=l.attrs.colwidth;if(c?.every(u=>u>0)){let u=c.reduce((f,p)=>f+p,0),d=a[1].style?` ${a[1].style}`:"";a[1]={...a[1],style:`width: ${u}px;${d}`}}return a}}return e}function tn(n,e){let t=[...n.classList].filter(r=>Od.test(r)&&e(r));return t.length?t.join(" "):null}function Ve(n){if(typeof n!="string")return{};let e=n.split(/\s+/).filter(t=>Od.test(t));return e.length?{class:e.join(" ")}:{}}function br(n){return n?{value:n}:!1}function Oo(n,e){return e?["span",{style:`${n}: ${e};`},0]:["span",0]}function Ys(n={},e){let t=Object.entries(n.nodes??{}),r=Object.entries(n.marks??{});if(!t.length&&!r.length&&!e)return nn;let o=e?Dd(e):Gs,i=e?Rd(e):Xs;for(let[s]of t)if(s in Gs)throw new Error(`[nova] node "${s}" already exists in the base schema`);for(let[s]of r)if(s in Xs)throw new Error(`[nova] mark "${s}" already exists in the base schema`);return new jn({nodes:{...o,...Object.fromEntries(t)},marks:{...i,...Object.fromEntries(r)}})}var Po,Jy,Gy,Xy,Yy,U,Ed,Do,Ro,ev,tv,Nd,ov,Ld,Od,Lo,Dd,Gs,Rd,Xs,nn,et=P(()=>{"use strict";de();Js();gt();Po=["left","center","right","justify"],Jy=/^(#[0-9a-f]{3,8}|rgba?\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*(,\s*[\d.]+%?\s*)?\)|[a-z]{3,20})$/i,Gy=/^\d{1,4}(\.\d{1,3})?(px|pt|em|rem|%)$/,Xy=/^\d{1,2}(\.\d{1,3})?(px|em|%)?$/,Yy=/^[\w\s,'"-]{1,200}$/;U={color:n=>typeof n=="string"&&Jy.test(n.trim())&&!/^(inherit|initial|unset|currentcolor|transparent|windowtext|window|auto|none)$/i.test(n.trim())?Qy(n):null,length:n=>typeof n=="string"&&Gy.test(n.trim())?n.trim():null,lineHeight:n=>typeof n=="string"&&Xy.test(n.trim())&&n.trim()!=="normal"?n.trim():null,fontFamily:n=>typeof n=="string"&&Yy.test(n.trim())?n.trim():null};Ed={align:{default:null},lineHeight:{default:null},dir:{default:null}},Do=["disc","circle","square"],Ro=["decimal","lower-alpha","upper-alpha","lower-roman","upper-roman","lower-greek"],ev={1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};tv={left:"float: left; margin: 0 1em 1em 0;",right:"float: right; margin: 0 0 1em 1em;",center:"display: block; margin-left: auto; margin-right: auto;"};Nd=["top","middle","bottom"];ov=100;Ld=()=>!1,Od=/^-?[_a-zA-Z][\w-]*$/;Lo={class:{default:null}},Dd=n=>({doc:{content:"block+"},paragraph:{group:"block",content:"inline*",attrs:{...Ed,...Lo},parseDOM:[{tag:"p",getAttrs:e=>({...Md(e),class:tn(e,n)})}],toDOM:e=>["p",{...Ve(e.attrs.class),...Cd(e.attrs)},0]},heading:{group:"block",content:"inline*",defining:!0,attrs:{level:{default:1},...Ed,...Lo},parseDOM:[1,2,3,4,5,6].map(e=>({tag:`h${e}`,getAttrs:t=>({level:e,...Md(t),class:tn(t,n)})})),toDOM:e=>[`h${e.attrs.level}`,{...Ve(e.attrs.class),...Cd(e.attrs)},0]},blockquote:{group:"block",content:"block+",defining:!0,attrs:{...Lo},parseDOM:[{tag:"blockquote",getAttrs:e=>({class:tn(e,n)})}],toDOM:e=>["blockquote",Ve(e.attrs.class),0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},code_block:{group:"block",content:"text*",marks:"",code:!0,defining:!0,attrs:{language:{default:null}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({language:e.querySelector("code")?.className.match(/language-([\w-]+)/)?.[1]??null})}],toDOM:e=>["pre",["code",e.attrs.language?{class:`language-${e.attrs.language}`}:{},0]]},bullet_list:{group:"block",content:"list_item+",attrs:{listStyle:{default:null}},parseDOM:[{tag:"ul",getAttrs:e=>({listStyle:Ad(e,Do,"disc")})}],toDOM:e=>["ul",Td(e.attrs.listStyle,Do),0]},ordered_list:{group:"block",content:"list_item+",attrs:{start:{default:1},listStyle:{default:null}},parseDOM:[{tag:"ol",getAttrs:e=>{let t=e.getAttribute("start");return{start:t?Number(t):1,listStyle:Ad(e,Ro,"decimal")}}}],toDOM:e=>["ol",{...e.attrs.start===1?{}:{start:e.attrs.start},...Td(e.attrs.listStyle,Ro)},0]},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]},text:{group:"inline"},image:{group:"inline",inline:!0,draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},align:{default:null},...Lo},parseDOM:[{tag:"img[src]",getAttrs:e=>{let t=e;return Pe(t.getAttribute("src")??"")?{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title"),width:Ie(t.getAttribute("width")??t.style.width),height:Ie(t.getAttribute("height")??t.style.height),align:nv(t),class:tn(t,n)}:!1}}],toDOM:e=>{let{alt:t,title:r}=e.attrs,o=Pe(e.attrs.src)?e.attrs.src:"",i=Ie(e.attrs.width),s=Ie(e.attrs.height),l=tv[e.attrs.align];return["img",{src:o,...Ve(e.attrs.class),...t?{alt:t}:{},...r?{title:r}:{},...i?{width:String(i)}:{},...s?{height:String(s)}:{},...l?{style:l}:{}}]}},hard_break:{group:"inline",inline:!0,selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},...iv(n)}),Gs=Dd(Ld),Rd=n=>({link:{attrs:{href:{},title:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return Re(t.getAttribute("href")??"")?{href:t.getAttribute("href"),title:t.getAttribute("title"),target:t.getAttribute("target")}:!1}}],toDOM:e=>{let{title:t,target:r}=e.attrs;return["a",{href:Re(e.attrs.href)?e.attrs.href:"#",...t?{title:t}:{},...r?{target:r,rel:"noopener noreferrer"}:{}},0]}},bold:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:()=>["strong",0]},italic:{parseDOM:[{tag:"em"},{tag:"i"},{style:"font-style=italic"}],toDOM:()=>["em",0]},underline:{parseDOM:[{tag:"u"},{style:"text-decoration=underline"}],toDOM:()=>["u",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration=line-through"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code",0]},subscript:{excludes:"superscript",parseDOM:[{tag:"sub"},{style:"vertical-align=sub"}],toDOM:()=>["sub",0]},superscript:{excludes:"subscript",parseDOM:[{tag:"sup"},{style:"vertical-align=super"}],toDOM:()=>["sup",0]},color:{attrs:{value:{}},parseDOM:[{style:"color",getAttrs:e=>br(U.color(e))},{tag:"font[color]",getAttrs:e=>br(U.color(e.getAttribute("color")))}],toDOM:e=>Oo("color",U.color(e.attrs.value))},background:{attrs:{value:{}},parseDOM:[{style:"background-color",getAttrs:e=>br(U.color(e))},{tag:"mark",getAttrs:()=>({value:"yellow"})}],toDOM:e=>Oo("background-color",U.color(e.attrs.value))},font_family:{attrs:{value:{}},parseDOM:[{style:"font-family",getAttrs:e=>br(U.fontFamily(e))}],toDOM:e=>Oo("font-family",U.fontFamily(e.attrs.value))},font_size:{attrs:{value:{}},parseDOM:[{style:"font-size",getAttrs:e=>br(U.length(e))}],toDOM:e=>Oo("font-size",U.length(e.attrs.value))},span_class:{attrs:{class:{}},parseDOM:[{tag:"span[class]",consuming:!1,getAttrs:e=>{let t=tn(e,n);return t?{class:t}:!1}}],toDOM:e=>["span",Ve(e.attrs.class),0]}}),Xs=Rd(Ld);nn=new jn({nodes:Gs,marks:Xs})});var Vd={};He(Vd,{default:()=>pv});function _d(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.insertText(e).scrollIntoView()),n.focus()}var Fd,$d,fv,pv,qd=P(()=>{"use strict";j();Fd=M.dateTime,$d={en:{title:"Insert date/time",date:"Date",time:"Time",dateTime:"Date and time",long:"Long date"},ru:{title:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0434\u0430\u0442\u0443/\u0432\u0440\u0435\u043C\u044F",date:"\u0414\u0430\u0442\u0430",time:"\u0412\u0440\u0435\u043C\u044F",dateTime:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",long:"\u0414\u0430\u0442\u0430 \u043F\u0440\u043E\u043F\u0438\u0441\u044C\u044E"}},fv={date:{dateStyle:"short"},long:{dateStyle:"long"},time:{timeStyle:"short"},dateTime:{dateStyle:"short",timeStyle:"short"}};pv={name:"insertdatetime",toolbar:"insertdatetime",setup(n){let e=n.options.language??"en",t=$d[e.split("-")[0]]??$d.en,r=()=>n.options.pluginOptions?.insertdatetime?.now?.()??new Date,o=i=>new Intl.DateTimeFormat(e,fv[i]).format(r());n.ui.registry.addMenuItem("insertdatetime",{text:t.title,icon:Fd,onAction:i=>_d(i,o("dateTime"))}),n.ui.registry.addMenuButton("insertdatetime",{icon:Fd,tooltip:t.title,items:i=>["date","long","time","dateTime"].map(s=>{let l=o(s);return{id:s,label:`${t[s]}: ${l}`,onSelect:()=>_d(i,l)}})})}}});function hv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}function Dn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}function jd(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function bv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}function Kd(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}function Zs(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Sv(n){return(e,t)=>{if(e.selection instanceof B&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!Ct(e.doc,p.pos)?!1:(t&&t(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof H||e.selection instanceof me)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,c=!1,u=!1;for(let p=o.depth;;p--)if(o.node(p).isBlock){c=o.end(p)==o.pos+(o.depth-p),u=o.start(p)==o.pos-(o.depth-p),a=Zs(o.node(p-1).contentMatchAt(o.indexAfter(p-1)));let m=n&&n(o.parent,c,o);s.unshift(m||(c&&a?{type:a}:null)),l=p;break}else{if(p==1)return!1;s.unshift(null)}let d=o.pos,f=Ct(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Ct(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!c&&u&&o.node(l).type!=a){let p=r.mapping.slice(i),h=p.map(o.before(l)),m=r.doc.resolve(h);a&&o.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(p.map(o.before(l)),a)}return t&&t(r.scrollIntoView()),!0}}function Ev(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Wt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Jd(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Ev(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,h=A.empty;for(let b=s.length-1;b>=0;b--)h=A.from(s[b].create(null,h));h=A.from(o.copy(h));let m=n.tr.step(new he(e.pos-1,p,e.pos,p,new O(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Wt(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:F.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&qt(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Dn(i,"start",!0)&&Dn(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let b=A.empty;for(let w=h.length-1;w>=0;w--)b=A.from(h[w].copy(b));let x=n.tr.step(new he(e.pos-h.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new O(b,h.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function Gd(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(H.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}function Ho(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&gn(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function tl(n,e=null){return function(t,r){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let u=t.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}r(i.scrollIntoView())}return!0}}function Nv(n,e,t,r){for(let o=0;o<e.length;o++){let{$from:i,$to:s}=e[o],l=i.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(i.pos,s.pos,(a,c)=>{if(l||!r&&a.isAtom&&a.isInline&&c>=i.pos&&c+a.nodeSize<=s.pos)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function Lv(n){let e=[];for(let t=0;t<n.length;t++){let{$from:r,$to:o}=n[t];r.doc.nodesBetween(r.pos,o.pos,(i,s)=>{if(i.isAtom&&i.content.size&&i.isInline&&s>=r.pos&&s+i.nodeSize<=o.pos)return s+1>r.pos&&e.push(new Et(r,r.doc.resolve(s+1))),r=r.doc.resolve(s+1+i.content.size),!1}),r.pos<o.pos&&e.push(new Et(r,o))}return e}function It(n,e=null,t){let r=(t&&t.removeWhenPresent)!==!1,o=(t&&t.enterInlineAtoms)!==!1,i=!(t&&t.includeWhitespace);return function(s,l){let{empty:a,$cursor:c,ranges:u}=s.selection;if(a&&!c||!Nv(s.doc,u,n,o))return!1;if(l)if(c)n.isInSet(s.storedMarks||c.marks())?l(s.tr.removeStoredMark(n)):l(s.tr.addStoredMark(n.create(e)));else{let d,f=s.tr;o||(u=Lv(u)),r?d=!u.some(p=>s.doc.rangeHasMark(p.$from.pos,p.$to.pos,n)):d=!u.every(p=>{let h=!1;return f.doc.nodesBetween(p.$from.pos,p.$to.pos,(m,g,b)=>{if(h)return!1;h=!n.isInSet(m.marks)&&!!b&&b.type.allowsMarkType(n)&&!(m.isText&&/^\s*$/.test(m.textBetween(Math.max(0,p.$from.pos-g),Math.min(m.nodeSize,p.$to.pos-g))))}),!h});for(let p=0;p<u.length;p++){let{$from:h,$to:m}=u[p];if(!d)f.removeMark(h.pos,m.pos,n);else{let g=h.pos,b=m.pos,x=h.nodeAfter,w=m.nodeBefore,E=i&&x&&x.isText?/^\s*/.exec(x.text)[0].length:0,D=i&&w&&w.isText?/\s*$/.exec(w.text)[0].length:0;g+E<b&&(g+=E,b-=D),f.addMark(g,b,n.create(e))}}l(f.scrollIntoView())}return!0}}function yr(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}var Ud,mv,gv,yv,vv,Bo,kv,el,wv,xv,Mv,Cv,Av,Tv,Qs,Wd,bt,Xd,Ov,Yd,zo=P(()=>{"use strict";Ye();de();K();Ud=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);mv=(n,e,t)=>{let r=hv(n,t);if(!r)return!1;let o=jd(r);if(!o){let s=r.blockRange(),l=s&&qt(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(Jd(n,o,e,-1))return!0;if(r.parent.content.size==0&&(Dn(i,"end")||B.isSelectable(i)))for(let s=r.depth;;s--){let l=Xr(n.doc,r.before(s),r.after(s),O.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Dn(i,"end")?F.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):B.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};gv=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=jd(r)}let s=i&&i.nodeBefore;return!s||!B.isSelectable(s)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};yv=(n,e,t)=>{let r=bv(n,t);if(!r)return!1;let o=Kd(r);if(!o)return!1;let i=o.nodeAfter;if(Jd(n,o,e,1))return!0;if(r.parent.content.size==0&&(Dn(i,"start")||B.isSelectable(i))){let s=Xr(n.doc,r.before(),r.after(),O.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Dn(i,"start")?F.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):B.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},vv=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=Kd(r)}let s=i&&i.nodeAfter;return!s||!B.isSelectable(s)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,i.pos)).scrollIntoView()),!0)};Bo=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&qt(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},kv=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
10
|
-
`).scrollIntoView()),!0)};el=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=Zs(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(F.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},wv=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof me||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Zs(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(H.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},xv=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Ct(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&qt(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};Mv=Sv(),Cv=(n,e)=>(e&&e(n.tr.setSelection(new me(n.doc))),!0);Av=Gd(-1),Tv=Gd(1);Qs=yr(Ud,mv,gv),Wd=yr(Ud,yv,vv),bt={Enter:yr(kv,wv,xv,Mv),"Mod-Enter":el,Backspace:Qs,"Mod-Backspace":Qs,"Shift-Backspace":Qs,Delete:Wd,"Mod-Delete":Wd,"Mod-a":Cv},Xd={"Ctrl-h":bt.Backspace,"Alt-Backspace":bt["Mod-Backspace"],"Ctrl-d":bt.Delete,"Ctrl-Alt-Backspace":bt["Mod-Delete"],"Alt-Delete":bt["Mod-Delete"],"Alt-d":bt["Mod-Delete"],"Ctrl-a":Av,"Ctrl-e":Tv};for(let n in bt)Xd[n]=bt[n];Ov=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,Yd=Ov?Xd:bt});var Fo,be,Qd,Dv,nl,Zd=P(()=>{"use strict";Fo=200,be=function(){};be.prototype.append=function(e){return e.length?(e=be.from(e),!this.length&&e||e.length<Fo&&this.leafAppend(e)||this.length<Fo&&e.leafPrepend(this)||this.appendInner(e)):this};be.prototype.prepend=function(e){return e.length?be.from(e).append(this):this};be.prototype.appendInner=function(e){return new Dv(this,e)};be.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};be.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};be.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};be.from=function(e){return e instanceof be?e:e&&e.length?new Qd(e):be.empty};Qd=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Fo)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Fo)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(be);be.empty=new Qd([]);Dv=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(be),nl=be});function Pv(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}function Bv(n,e,t,r){let o=t.getMeta(rn),i;if(o)return o.historyState;t.getMeta(rf)&&(n=new nt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(rn))return s.getMeta(rn).redo?new nt(n.done.addTransform(t,void 0,r,$o(e)),n.undone,ef(t.mapping.maps),n.prevTime,n.prevComposition):new nt(n.done,n.undone.addTransform(t,void 0,r,$o(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Hv(t,n.prevRanges)),c=s?rl(n.prevRanges,t.mapping):ef(t.mapping.maps);return new nt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,$o(e)),on.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new nt(n.done.rebased(t,i),n.undone.rebased(t,i),rl(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new nt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),rl(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Hv(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function ef(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function rl(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function zv(n,e){for(let t=0;t<e.steps.length;t++){let r=e.mapping.maps[t],o=-1;if(r.forEach((i,s)=>o=s),o<0){let i=e.steps[t];(i instanceof Vt||i instanceof Mt)&&(o=i.to)}if(o>-1)return F.near(n.doc.resolve(o))}return n.selection}function Fv(n,e,t){let r=$o(e),o=rn.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,zv(e,i.transform).getBookmark(),o,r),a=new nt(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(rn,{redo:t,historyState:a})}function $o(n){let e=n.plugins;if(tf!=e){ol=!1,tf=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ol=!0;break}}return ol}function nf(n){return n.setMeta(rf,!0)}function of(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new _({key:rn,state:{init(){return new nt(on.empty,on.empty,null,0,-1)},apply(e,t,r){return Bv(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?il:r=="historyRedo"?sl:null;return!o||!e.editable?!1:(t.preventDefault(),o(e.state,e.dispatch))}}}})}function _o(n,e){return(t,r)=>{let o=rn.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=Fv(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Rv,on,tt,nt,Iv,ol,tf,rn,rf,il,sl,Dx,Rx,Vo=P(()=>{"use strict";Zd();Ye();K();Rv=500,on=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new tt(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new tt(h,void 0,void 0,c.length+u.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new n(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new tt(e.mapping.maps[u],d,t),p;(p=a&&a.merge(f))&&(f=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),t&&(s++,t=void 0),o||(a=f)}let c=s-r.depth;return c>Iv&&(l=Pv(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new Yn;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new tt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],o=this.items.length-t,i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(i.slice(a+1,p));g&&l++,r.push(new tt(h,m,g))}else r.push(new tt(h))},o);let c=[];for(let f=t;f<s;f++)c.push(new tt(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new n(u,l);return d.emptyItemCount()>Rv&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&i++;let d=new tt(c.invert(),a,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new n(nl.from(o.reverse()),i)}};on.empty=new on(nl.empty,0);tt=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},nt=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},Iv=20;ol=!1,tf=null;rn=new J("history"),rf=new J("closeHistory");il=_o(!1,!0),sl=_o(!0,!0),Dx=_o(!1,!1),Rx=_o(!0,!1)});function sf(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i);if(!s)return!1;let l=r?t.tr:null;return $v(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function $v(n,e,t,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new $t(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new $t(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=gn(i,t,r,e);return l?(n&&_v(n,e,l,o,t),!0):!1}function _v(n,e,t,r,o){let i=A.empty;for(let u=t.length-1;u>=0;u--)i=A.from(t[u].type.create(t[u].attrs,i));n.step(new he(e.start-(r?2:0),e.end,e.start,e.end,new O(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==o&&(s=u+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&l&&Ct(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function Rn(n,e){return n instanceof lt?e==n:n.indexOf(e)>-1}function lf(n,e){return function(t,r){let{$from:o,$to:i,node:s}=t.selection;if(s&&s.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(!Rn(n,l.type))return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||!Rn(n,o.node(-3).type)||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let d=A.empty,f=o.index(-1)?1:o.index(-2)?2:3;for(let b=o.depth-f;b>=o.depth-3;b--)d=A.from(o.node(b).copy(d));let p=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;d=d.append(A.from(o.node(-3).type.createAndFill()));let h=o.before(o.depth-(f-1)),m=t.tr.replace(h,o.after(-p),new O(d,4-f,0)),g=-1;m.doc.nodesBetween(h,m.doc.content.size,(b,x)=>{if(g>-1)return!1;b.isTextblock&&b.content.size==0&&(g=x+1)}),g>-1&&m.setSelection(F.near(m.doc.resolve(g))),r(m.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,i.pos),u=a||e?[e?{type:l.type,attrs:e}:null,a?{type:a}:null]:void 0;return Ct(c.doc,o.pos,2,u)?(r&&r(c.split(o.pos,2,u).scrollIntoView()),!0):!1}}function ll(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&Rn(n,s.firstChild.type));return i?t?Rn(n,r.node(i.depth-1).type)?Vv(e,t,i):qv(e,t,i):!0:!1}}function Vv(n,e,t){let r=n.tr,o=t.end,i=t.$to.end(t.depth),s=t.parent.child(t.endIndex-1).type;o<i&&(r.step(new he(o-1,i,o,i,new O(A.from(s.create(null,t.parent.copy())),1,0),1,!0)),t=new $t(r.doc.resolve(t.$from.pos),r.doc.resolve(i),t.depth));let l=qt(t);if(l==null)return!1;r.lift(t,l);let a=r.doc.resolve(r.mapping.map(o,-1)-1);return Wt(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function qv(n,e,t){let r=n.tr,o=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?A.empty:A.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new he(d-(l?1:0),f+(a?1:0),d+1,f-1,new O((l?A.empty:A.from(o.copy(A.empty))).append(a?A.empty:A.from(o.copy(A.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function af(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&Rn(n,c.firstChild.type));if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(!Rn(n,a.type))return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=A.from(c?a.lastChild.lastChild.type.create():null),d=new O(A.from(a.type.create(null,A.from(l.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;t(e.tr.step(new he(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}var al=P(()=>{"use strict";Ye();de();K()});function qo(n){return(e,t)=>{let{from:r,to:o}=e.selection,i=e.tr,s=!1;return e.doc.nodesBetween(r,o,(l,a)=>{let c=G(e);(l.type===c.paragraph||l.type===c.heading)&&(s=!0,i=i.setNodeMarkup(a,void 0,{...l.attrs,align:n}))}),s?(t?.(i),!0):!1}}function uf(n,e={}){let t=tl(n,e);return(r,o)=>{if(!t(r))return!1;if(o){let i=r.tr;for(let s of r.selection.ranges)i.setBlockType(s.$from.pos,s.$to.pos,n,l=>({...e,..."align"in n.spec.attrs&&l.attrs.align?{align:l.attrs.align}:{},..."lineHeight"in n.spec.attrs&&l.attrs.lineHeight?{lineHeight:l.attrs.lineHeight}:{},..."dir"in n.spec.attrs&&l.attrs.dir?{dir:l.attrs.dir}:{}}));o(i.scrollIntoView())}return!0}}function Pn(n){return ln("heading",e=>uf(e,{level:n}))}function cf(n){return(e,t)=>rt(e,n)?ll(G(e).list_item)(e,t):sf(n)(e,t)}function df(n,e){return(t,r)=>Pe(n)?(r?.(t.tr.replaceSelectionWith(G(t).image.create({src:n,alt:e??null})).scrollIntoView()),!0):!1}function vr(n,e){let{from:t,$from:r,to:o,empty:i}=n.selection;return i?!!e.isInSet(n.storedMarks??r.marks()):n.doc.rangeHasMark(t,o,e)}function rt(n,e,t){let{$from:r,to:o}=n.selection;for(let i=r.depth;i>0;i--){let s=r.node(i);if(s.type===e&&(!t||Object.entries(t).every(([l,a])=>s.attrs[l]===a)))return o<=r.end(i)}return!1}function an(n){return n.selection.$from.parent.attrs.align??"left"}function ff(n,e){let t=n.selection.$from.parent,r=G(n),o=oe(n);switch(e){case"bold":case"italic":case"underline":case"strike":case"code":case"subscript":case"superscript":return vr(n,o[e]);case"paragraph":return t.type===r.paragraph;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return t.type===r.heading&&t.attrs.level===Number(e[1]);case"codeBlock":return t.type===r.code_block;case"blockquote":return rt(n,r.blockquote);case"bulletList":return rt(n,r.bullet_list);case"orderedList":return rt(n,r.ordered_list);case"alignLeft":return an(n)==="left";case"alignCenter":return an(n)==="center";case"alignRight":return an(n)==="right";case"alignJustify":return an(n)==="justify";default:return!1}}function In(n){let{$from:e}=n.selection,t=oe(n),r=t.link.isInSet(e.marks())??t.link.isInSet(e.nodeAfter?.marks??[]);return r?r.attrs:null}function kr(n,e,t){let r=n.doc.resolve(t),o=r.start(),i=[];return r.parent.forEach((s,l)=>{if(!e.isInSet(s.marks))return;let a=o+l,c=a+s.nodeSize,u=i[i.length-1];u&&u.to===a?u.to=c:i.push({from:a,to:c})}),i.find(s=>s.from<=t&&t<=s.to)??null}var G,oe,ln,sn,Wv,Uv,jv,Q,Oe=P(()=>{"use strict";zo();Vo();al();gt();G=n=>n.schema.nodes,oe=n=>n.schema.marks,ln=(n,e)=>(t,r,o)=>e(G(t)[n])(t,r,o),sn=(n,e)=>(t,r,o)=>e(oe(t)[n])(t,r,o);Wv=(n,e)=>(e?.(n.tr.replaceSelectionWith(G(n).horizontal_rule.create()).scrollIntoView()),!0),Uv=(n,e)=>{let{from:t,to:r,empty:o,$from:i}=n.selection,s=oe(n);if(o){let l=kr(n,s.link,i.pos);return l?(e?.(n.tr.removeMark(l.from,l.to,s.link)),!0):!1}return n.doc.rangeHasMark(t,r,s.link)?(e?.(n.tr.removeMark(t,r,s.link)),!0):!1},jv=(n,e)=>{let{from:t,to:r,empty:o}=n.selection;if(o)return!1;if(e){let i=oe(n),s=n.tr;for(let l of Object.values(i))l!==i.link&&(s=s.removeMark(t,r,l));e(s)}return!0};Q={bold:sn("bold",It),italic:sn("italic",It),underline:sn("underline",It),strike:sn("strike",It),code:sn("code",It),subscript:sn("subscript",It),superscript:sn("superscript",It),paragraph:ln("paragraph",n=>uf(n)),h1:Pn(1),h2:Pn(2),h3:Pn(3),h4:Pn(4),h5:Pn(5),h6:Pn(6),blockquote:(n,e)=>rt(n,G(n).blockquote)?Bo(n,e):Ho(G(n).blockquote)(n,e),codeBlock:ln("code_block",n=>tl(n)),bulletList:ln("bullet_list",cf),orderedList:ln("ordered_list",cf),indent:ln("list_item",af),outdent:ln("list_item",ll),alignLeft:qo(null),alignCenter:qo("center"),alignRight:qo("right"),alignJustify:qo("justify"),horizontalRule:Wv,unlink:Uv,clearFormatting:jv,undo:il,redo:sl}});function Bn(n){return Kv.test(n.type)}function Jv(n){return new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>t(r.error??new Error("FileReader failed")),r.readAsDataURL(n)})}function pf(n,e){let t=null;return n.state.doc.descendants((r,o)=>t!==null?!1:(r.type===G(n.state).image&&r.attrs.src===e&&(t=o),!0)),t}function wr(n,e,t){let r=e.filter(Bn),o=n.view;for(let i of r){let s=URL.createObjectURL(i),l=G(o.state).image.create({src:s,alt:null}),a=o.state.tr;t!==void 0?a.insert(Math.min(t,a.doc.content.size),l):a.replaceSelectionWith(l),o.dispatch(a.scrollIntoView());let c=n.options.uploadImage,u=c?n.ui.notify({text:n.ui.t("image.uploading"),timeout:0}):null;(c?c(i,f=>u?.setText(`${n.ui.t("image.uploading")} ${Math.round(f)}%`)):Jv(i)).then(f=>{if(!Pe(f))throw new Error(`Unsafe image URL returned: ${f}`);let p=pf(o,s);if(p===null)return;let h=o.state.doc.nodeAt(p);o.dispatch(o.state.tr.setNodeMarkup(p,void 0,{...h.attrs,src:f}).setMeta("addToHistory",!1))}).catch(f=>{console.error("[nova] image upload failed",f);let p=pf(o,s);p!==null&&o.dispatch(o.state.tr.delete(p,p+1).setMeta("addToHistory",!1)),n.ui.notify({text:n.ui.t("image.uploadFailed"),type:"error"})}).finally(()=>{u?.close(),URL.revokeObjectURL(s)})}}function Gv(n,e="pasted-image"){let t=n.match(mf);if(!t)return null;let r=t[1].toLowerCase();try{let o=atob(t[2]),i=new Uint8Array(o.length);for(let l=0;l<o.length;l++)i[l]=o.charCodeAt(l);let s=r.split("/")[1].replace("jpeg","jpg");return new File([i],`${e}.${s}`,{type:r})}catch{return null}}function Xv(n,e,t){let r=n.state.tr;n.state.doc.descendants((o,i)=>{o.type===G(n.state).image&&o.attrs.src===e&&r.setNodeMarkup(i,void 0,{...o.attrs,src:t})}),r.docChanged&&n.dispatch(r.setMeta("addToHistory",!1))}async function Yv(n,e){let t=n.options.uploadImage,r=t?Gv(e):null;if(!t||!r)return;let o=n.ui.notify({text:n.ui.t("image.uploading"),timeout:0});try{let i=await t(r,s=>o.setText(`${n.ui.t("image.uploading")} ${Math.round(s)}%`));if(!Pe(i))throw new Error(`Unsafe image URL returned: ${i}`);Xv(n.view,e,i)}catch(i){console.error("[nova] embedded image upload failed",i),n.ui.notify({text:n.ui.t("image.uploadFailed"),type:"error"})}finally{o.close()}}function hf(n,e){let t=new Set;return n.descendants(r=>{r.type===e&&mf.test(r.attrs.src)&&t.add(r.attrs.src)}),t}function gf(n){return new _({key:new J("nova-embedded-image-upload"),appendTransaction(e,t,r){if(!n.options.uploadImage||!e.some(a=>["paste","drop"].includes(a.getMeta("uiEvent")))||!e.some(a=>a.docChanged))return null;let i=G(r).image,s=hf(t.doc,i),l=[...hf(r.doc,i)].filter(a=>!s.has(a));return l.length&&queueMicrotask(()=>l.forEach(a=>{Yv(n,a)})),null}})}function bf(n){return new _({key:new J("nova-image-drop-paste"),props:{handlePaste(e,t){if(!n.isAllowed("image"))return!1;let r=t.clipboardData;if(!r||r.getData("text/html"))return!1;let o=[...r.files].filter(Bn);return o.length?(wr(n,o),!0):!1},handleDrop(e,t){if(!n.isAllowed("image"))return!1;let r=[...t.dataTransfer?.files??[]].filter(Bn);if(!r.length)return!1;t.preventDefault();let o=e.posAtCoords({left:t.clientX,top:t.clientY});return wr(n,r,o?.pos),!0}}})}function Wo(n){let{t:e}=n.ui,t=v("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/avif",className:"nova-visually-hidden",tabindex:"-1"}),r=v("button",{type:"button",className:"nova-dropzone"},X(M.upload),v("span",{},e("image.drop"))),o=ce({label:e("image.url"),type:"url",placeholder:"https://"}),i=ce({label:e("image.alt"),hint:e("image.altHint")});Nn(n,o,"image",c=>{c.alt&&(i.input.value=c.alt)});let s=v("div",{className:"nova-form"},r,t,v("div",{className:"nova-divider"},v("span",{},e("image.or"))),o.el,i.el),l=n.ui.openDialog({title:e("image.title"),body:s,submitLabel:e("dialog.insert"),initialFocus:o.input,onSubmit:()=>{let c=o.input.value.trim();return!c||!Pe(c)?(o.input.setAttribute("aria-invalid","true"),o.input.focus(),e("image.invalid")):(n.exec(df(c,i.input.value.trim()||void 0)),!0)}}),a=c=>{let u=c.filter(Bn);u.length&&(l.close(),wr(n,u))};r.addEventListener("click",()=>t.click()),t.addEventListener("change",()=>a([...t.files??[]])),r.addEventListener("dragover",c=>{c.preventDefault(),r.classList.add("is-dragover")}),r.addEventListener("dragleave",()=>r.classList.remove("is-dragover")),r.addEventListener("drop",c=>{c.preventDefault(),r.classList.remove("is-dragover"),a([...c.dataTransfer?.files??[]])})}function cn(n){let{selection:e}=n;return e instanceof B&&e.node.type===G(n).image?{node:e.node,pos:e.from}:null}function xr(n){return(e,t)=>{let r=cn(e);if(!r)return!1;if(t){let o=e.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,...n});o.setSelection(B.create(o.doc,r.pos)),t(o)}return!0}}function yf(n,e){let t=cn(n.view.state);if(!t)return!1;if(e===null)return n.exec(xr({width:null,height:null}));let o=n.view.nodeDOM(t.pos)?.querySelector("img")??null,i=getComputedStyle(n.view.dom),s=n.view.dom.clientWidth-parseFloat(i.paddingLeft||"0")-parseFloat(i.paddingRight||"0"),l=Math.max(24,Math.round(s*e)),a=o&&o.naturalWidth?o.naturalHeight/o.naturalWidth:null;return n.exec(xr({width:l,height:a?Math.round(l*a):null}))}function vf(n){let e=cn(n.view.state);if(!e)return;let{t}=n.ui,r=ce({label:t("image.alt"),value:e.node.attrs.alt??"",hint:t("image.altHint")}),o=ce({label:t("link.tooltip"),value:e.node.attrs.title??""});n.ui.openDialog({title:t("image.editAlt"),body:v("div",{className:"nova-form"},r.el,o.el),submitLabel:t("dialog.save"),initialFocus:r.input,onSubmit:()=>(n.exec(xr({alt:r.input.value.trim()||null,title:o.input.value.trim()||null})),!0)})}var Kv,mf,Sr=P(()=>{"use strict";xo();K();Oe();Oe();At();Z();j();gt();Kv=/^image\/(png|jpe?g|gif|webp|avif|bmp)$/;mf=/^data:(image\/(?:png|jpe?g|gif|webp|avif|bmp));base64,(.+)$/i});function kf(n){let e=n.trim();return e?/^[a-z][a-z0-9+.-]*:/i.test(e)||/^[/#?.]/.test(e)?e:/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(e)?`mailto:${e}`:/^(www\.)?[^\s/]+\.[a-z]{2,}([/:?#].*)?$/i.test(e)?`https://${e}`:e:""}function cl(n){let{from:e,to:t,empty:r,$from:o}=n.selection;return r?kr(n,oe(n).link,o.pos)??{from:e,to:t}:{from:e,to:t}}function Qv(n){return(e,t)=>{let r=kf(n.href);if(!r||!Re(r))return!1;if(!t)return!0;let{from:o,to:i}=cl(e),s=oe(e).link.create({href:r,title:n.title||null,target:n.target||null}),l=e.doc.textBetween(o,i),a=n.text?.trim()?n.text:null,c=e.tr;if(o===i||a!==null&&a!==l){let u=oe(e).link.removeFromSet(e.doc.resolve(o).marks()),d=e.schema.text(a??(l||r),s.addToSet(u));c.replaceWith(o,i,d)}else c.removeMark(o,i,oe(e).link).addMark(o,i,s);return t(c.scrollIntoView()),!0}}function Mr(){return(n,e)=>{let{from:t,to:r}=cl(n);return t===r||!n.doc.rangeHasMark(t,r,oe(n).link)?!1:(e?.(n.tr.removeMark(t,r,oe(n).link)),!0)}}function ot(n){let{t:e}=n.ui,t=n.view.state,r=In(t),o=cl(t),i=t.doc.textBetween(o.from,o.to),s=!i.includes(`
|
|
11
|
-
`)&&t.selection.$from.sameParent(t.doc.resolve(o.to)),l=ce({label:e("link.url"),type:"url",value:r?.href??"",placeholder:"https://",required:!0}),a=ce({label:e("link.text"),value:i}),c=ce({label:e("link.tooltip"),value:r?.title??""}),u=tc(e("link.newTab"),r?.target==="_blank");Nn(n,l,"file",f=>{f.text&&!a.input.value.trim()&&(a.input.value=f.text),f.title&&(c.input.value=f.title)});let d=v("div",{className:"nova-form"},l.el,s?a.el:null,c.el,u.el);n.ui.openDialog({title:e(r?"link.editTitle":"link.title"),body:d,submitLabel:e(r?"dialog.save":"dialog.insert"),initialFocus:l.input,onSubmit:()=>{let f=kf(l.input.value);return!f||!Re(f)?(l.input.setAttribute("aria-invalid","true"),l.input.focus(),e("link.invalid")):(n.exec(Qv({href:f,...s?{text:a.input.value}:{},title:c.input.value.trim()||null,target:u.input.checked?"_blank":null})),!0)}})}var Hn=P(()=>{"use strict";xo();Oe();Oe();At();Z();gt()});function Zv(n,e,t=!0,r=nn){let{table:o,table_row:i,table_cell:s,table_header:l,paragraph:a}=r.nodes,c=[];for(let u=0;u<n;u++){let d=t&&u===0?l:s,f=[];for(let p=0;p<e;p++)f.push(d.create(null,a.create()));c.push(i.create(null,f))}return o.create(null,c)}function it(n,e,t=!0){return(r,o)=>{if(n<1||e<1||n>100||e>50||ne(r))return!1;if(o){let i=Zv(n,e,t,r.schema),s=r.tr.replaceSelectionWith(i),l=-1;s.doc.descendants((a,c)=>(a===i&&(l=c),l<0)),l>=0&&s.setSelection(H.near(s.doc.resolve(l+3))),o(s.scrollIntoView())}return!0}}function wf(){return[kd({cellMinWidth:48,defaultCellMinWidth:48,View:ul}),xd(),Fe({Tab:e0,"Shift-Tab":No(-1)})]}function xf(n){return bd("background",n)}function Sf(n){if(!ne(n))return!1;let e=Ln(n.selection.$from)?.node.firstChild;if(!e||e.childCount===0)return!1;let t=!0;return e.forEach(r=>{r.type!==n.schema.nodes.table_header&&(t=!1)}),t}function Mf(n){if(!ne(n))return!1;let e=Ln(n.selection.$from)?.node;if(!e)return!1;let t=!0;return e.forEach(r=>{r.firstChild?.type!==n.schema.nodes.table_header&&(t=!1)}),t}function Cf(n){let{state:e}=n.view;if(!ne(e))return null;let t=Ln(e.selection.$from);return t?n.view.nodeDOM(t.pos)?.getBoundingClientRect()??null:null}function Ef(n,e,t){let r=1,o=1,i=[],s=v("div",{className:"nova-grid-caption","aria-live":"polite"}),l=v("div",{className:"nova-grid",role:"grid","aria-label":t}),a=()=>{for(let c of i){let u=Number(c.dataset.row),d=Number(c.dataset.col);c.classList.toggle("is-on",u<=r&&d<=o),c.tabIndex=u===r&&d===o?0:-1}s.textContent=e(r,o)};for(let c=1;c<=Cr;c++)for(let u=1;u<=Cr;u++){let d=v("button",{type:"button",className:"nova-grid-cell",role:"gridcell","aria-label":e(c,u),"data-row":String(c),"data-col":String(u)});d.addEventListener("mouseenter",()=>{r=c,o=u,a()}),d.addEventListener("click",()=>n(c,u)),i.push(d),l.append(d)}return l.addEventListener("keydown",c=>{let d={ArrowRight:[0,1],ArrowLeft:[0,-1],ArrowDown:[1,0],ArrowUp:[-1,0]}[c.key];d&&(c.preventDefault(),r=Math.min(Cr,Math.max(1,r+d[0])),o=Math.min(Cr,Math.max(1,o+d[1])),a(),i[(r-1)*Cr+(o-1)].focus())}),a(),v("div",{className:"nova-grid-panel"},l,s)}function t0(n){let e=n.replace(/\s/g,"").replace(/^[^\d+-]+|[^\d]+$/g,"").replace(/,(?=\d{3}(?:\D|$))/g,"").replace(",",".");return/^[+-]?\d+(\.\d+)?$/.test(e)?Number(e):null}function n0(n){if(!ne(n))return null;let e=_e(n),t=e.table,r=!1;if(t.descendants(s=>((s.attrs.colspan>1||s.attrs.rowspan>1)&&(r=!0),!r&&s.type.spec.tableRole!=="cell"&&s.type.spec.tableRole!=="header_cell")),r)return null;let o=n.schema.nodes,i=0;for(let s=0;s<t.childCount;s++){let l=!0;if(t.child(s).forEach(a=>{a.type!==o.table_header&&(l=!1)}),!l)break;i++}return t.childCount-i<2?null:{pos:e.tableStart-1,table:t,column:e.left,headerRows:i}}function dl(n,e){return(t,r)=>{let o=n0(t);if(!o)return!1;if(r){let{table:i,column:s,headerRows:l,pos:a}=o,c=[];i.forEach(x=>c.push(x));let u=c.slice(0,l),d=c.slice(l),f=d.map(x=>s<x.childCount?x.child(s).textContent.trim():""),p=f.map(t0),h=f.every((x,w)=>x===""||p[w]!==null),m=new Intl.Collator(e,{numeric:!0,sensitivity:"base"}),g=d.map((x,w)=>({row:x,i:w})).sort((x,w)=>{let E=f[x.i],D=f[w.i];if(!E||!D)return E?-1:D?1:x.i-w.i;let C=h?p[x.i]-p[w.i]:m.compare(E,D);return(n==="asc"?C:-C)||x.i-w.i}).map(({row:x})=>x),b=i.copy(A.from([...u,...g]));r(t.tr.replaceWith(a,a+i.nodeSize,b).scrollIntoView())}return!0}}function Af(n){let e=Ln(n.selection.$from);return e?{width:e.node.attrs.width??null,align:e.node.attrs.align??null,class:e.node.attrs.class??null}:null}function Tf(n){return(e,t)=>{let r=Ln(e.selection.$from);if(!r||n.width!==null&&!U.length(n.width))return!1;let o={...r.node.attrs,width:n.width,align:n.align};return n.class!==void 0&&(o.class=Ve(n.class).class??null),t?.(e.tr.setNodeMarkup(r.pos,void 0,o)),!0}}function Nf(n){let e=[];if(n.selection instanceof ee)return n.selection.forEachCell((r,o)=>e.push({node:r,pos:o})),e;let{$from:t}=n.selection;for(let r=t.depth;r>0;r--){let o=t.node(r),i=o.type.spec.tableRole;if(i==="cell"||i==="header_cell"){e.push({node:o,pos:t.before(r)});break}}return e}function Lf(n){let e=Nf(n)[0];if(!e)return null;let t=e.node.attrs.colwidth;return{valign:e.node.attrs.valign??null,header:e.node.type===n.schema.nodes.table_header,width:t?.[0]??null,class:e.node.attrs.class??null}}function Of(n){return(e,t)=>{let r=Nf(e);if(!r.length||n.width!=null&&!(n.width>=24&&n.width<=4e3))return!1;if(!t)return!0;let o=e.schema.nodes,i=e.tr;for(let{pos:s,node:l}of r){let a=n.header===void 0?l.type:n.header?o.table_header:o.table_cell,c={...l.attrs,...n.valign!==void 0?{valign:n.valign}:{},...n.class!==void 0?{class:Ve(n.class).class??null}:{}};i.setNodeMarkup(s,a,c)}if(n.width!==void 0){let s=_e(e),l=s.map,a=new Set;for(let c=s.left;c<s.right;c++)for(let u=0;u<l.height;u++){let d=l.map[u*l.width+c],f=d*1e3+c;if(a.has(f))continue;a.add(f);let p=s.tableStart+d,h=i.doc.nodeAt(p);if(!h)continue;let m=c-l.colCount(d),g=[...h.attrs.colwidth??new Array(h.attrs.colspan).fill(0)];g[m]=n.width??0,i.setNodeMarkup(p,void 0,{...h.attrs,colwidth:g.every(b=>!b)?null:g})}}return t(i),!0}}var Cr,e0,We,ul,zn=P(()=>{"use strict";pt();de();K();Js();et();Z();Cr=10;e0=(n,e,t)=>{if(!ne(n))return!1;if(No(1)(n,e,t)||!e)return!0;let r=n;return js(n,o=>{r=n.apply(o),e(o)}),No(1)(r,e,t)};We={addRowBefore:pd,addRowAfter:js,deleteRow:hd,addColumnBefore:cd,addColumnAfter:ud,deleteColumn:dd,mergeCells:md,splitCell:gd,toggleHeaderRow:On("row"),toggleHeaderColumn:On("column"),deleteTable:yd};ul=class extends Ks{constructor(e,t){super(e,t),this.apply(e)}update(e){return super.update(e)?(this.apply(e),!0):!1}apply(e){let t=U.length(e.attrs.width);t&&(this.table.style.width=t,this.table.style.minWidth="");let r=e.attrs.align;this.table.style.marginLeft=r?"auto":"",this.table.style.marginRight=r==="center"?"auto":"";let o=Ve(e.attrs.class).class;o?this.table.setAttribute("class",o):this.table.removeAttribute("class")}}});var Bf={};He(Bf,{DEFAULT_INSERT:()=>Rf,DEFAULT_SELECTION:()=>Df,default:()=>o0,hasTextSelection:()=>Pf,isOnEmptyLine:()=>If});function Pf(n){let{selection:e}=n.view.state;return!(e instanceof H)||e.empty||e.$from.parent.type.spec.code?!1:n.view.state.doc.textBetween(e.from,e.to).trim().length>0}function If(n){let{selection:e}=n.view.state;if(!e.empty)return!1;let{$from:t}=e;return t.depth===1&&t.parent.type===n.schema.nodes.paragraph&&t.parent.content.size===0&&!ne(n.view.state)}function r0(n){let e=document.createElement("input");e.type="file",e.accept="image/png,image/jpeg,image/gif,image/webp,image/avif",e.addEventListener("change",()=>{let t=[...e.files??[]].filter(Bn);t.length&&wr(n,t)}),e.click()}var Df,Rf,o0,Hf=P(()=>{"use strict";K();Sr();Hn();zn();j();Df="bold italic underline | quicklink h2 h3 blockquote",Rf="quickimage quicktable";o0={name:"quickbars",setup(n){let{registry:e,t}=n.ui,r=n.options.pluginOptions?.quickbars??{};e.addButton("quicklink",{icon:M.link,tooltip:t("link"),shortcut:"Mod-k",onAction:s=>ot(s)}),e.addButton("quickimage",{icon:M.image,tooltip:t("image"),onAction:s=>r0(s)}),e.addButton("quicktable",{icon:M.table,tooltip:t("table.insert"),onAction:s=>s.exec(it(2,2))});let o=r.selection===void 0?Df:r.selection;o&&e.addContextToolbar("quickbars-selection",{label:t("quickbars.selection"),predicate:Pf,items:o,position:"selection",placement:"top-start",priority:10});let i=r.insert===void 0?Rf:r.insert;i&&e.addContextToolbar("quickbars-insert",{label:t("quickbars.insert"),predicate:If,items:i,position:"selection",placement:"bottom-start"})}}});var Ff={};He(Ff,{default:()=>l0});var zf,i0,s0,l0,$f=P(()=>{"use strict";j();ke();zf=M.charmap,i0={en:{title:"Special character",search:"Search characters",empty:"Nothing found",groups:["Currency","Typography","Math","Arrows","Latin","Greek"]},ru:{title:"\u0421\u043F\u0435\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B",search:"\u041F\u043E\u0438\u0441\u043A \u0441\u0438\u043C\u0432\u043E\u043B\u0430",empty:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",groups:["\u0412\u0430\u043B\u044E\u0442\u044B","\u0422\u0438\u043F\u043E\u0433\u0440\u0430\u0444\u0438\u043A\u0430","\u041C\u0430\u0442\u0435\u043C\u0430\u0442\u0438\u043A\u0430","\u0421\u0442\u0440\u0435\u043B\u043A\u0438","\u041B\u0430\u0442\u0438\u043D\u0438\u0446\u0430","\u0413\u0440\u0435\u0447\u0435\u0441\u043A\u0438\u0435"]}},s0=[[["\u20AC","euro"],["\xA3","pound"],["\xA5","yen"],["\u20BD","ruble"],["$","dollar"],["\xA2","cent"],["\u20B4","hryvnia"],["\u20B8","tenge"],["\u20B9","rupee"],["\u20A9","won"],["\u20BA","lira"],["\u20BF","bitcoin"]],[["\u2014","em dash"],["\u2013","en dash"],["\u2026","ellipsis"],["\xAB","left guillemet"],["\xBB","right guillemet"],["\u201E","low double quote"],["\u201C","left double quote"],["\u201D","right double quote"],["\u2018","left single quote"],["\u2019","right single quote apostrophe"],["\u2022","bullet"],["\xB7","middle dot"],["\xA7","section"],["\xB6","paragraph pilcrow"],["\u2020","dagger"],["\u2021","double dagger"],["\xA9","copyright"],["\xAE","registered"],["\u2122","trademark"],["\xB0","degree"],["\u2116","numero number"],["\u2030","per mille"],["\u2032","prime minutes"],["\u2033","double prime seconds"],["\xA1","inverted exclamation"],["\xBF","inverted question"]],[["\xB1","plus minus"],["\xD7","multiply times"],["\xF7","divide"],["\u2260","not equal"],["\u2248","approximately"],["\u2264","less or equal"],["\u2265","greater or equal"],["\u221E","infinity"],["\u221A","square root"],["\u2211","sum sigma"],["\u220F","product"],["\u222B","integral"],["\u2202","partial"],["\u2206","increment delta"],["\u2208","element of"],["\u2209","not element of"],["\u2229","intersection"],["\u222A","union"],["\u2282","subset"],["\u2200","for all"],["\u2203","exists"],["\xAC","not"],["\u2227","and"],["\u2228","or"],["\xBD","one half"],["\u2153","one third"],["\xBC","one quarter"],["\xBE","three quarters"],["\xB2","superscript two squared"],["\xB3","superscript three cubed"],["\xB5","micro"],["\u2030","per mille"]],[["\u2190","left arrow"],["\u2192","right arrow"],["\u2191","up arrow"],["\u2193","down arrow"],["\u2194","left right arrow"],["\u2195","up down arrow"],["\u21D0","left double arrow"],["\u21D2","right double arrow implies"],["\u21D4","left right double arrow iff"],["\u21A9","return arrow"],["\u2197","north east arrow"],["\u2198","south east arrow"]],[["\xE0","a grave"],["\xE1","a acute"],["\xE2","a circumflex"],["\xE4","a umlaut"],["\xE5","a ring"],["\xE6","ae ligature"],["\xE7","c cedilla"],["\xE9","e acute"],["\xE8","e grave"],["\xEA","e circumflex"],["\xEB","e umlaut"],["\xED","i acute"],["\xEF","i umlaut"],["\xF1","n tilde"],["\xF3","o acute"],["\xF4","o circumflex"],["\xF6","o umlaut"],["\xF8","o slash"],["\u0153","oe ligature"],["\xDF","sharp s eszett"],["\xFA","u acute"],["\xFC","u umlaut"],["\xFD","y acute"],["\u0142","l stroke"],["\u0161","s caron"],["\u017E","z caron"]],[["\u03B1","alpha"],["\u03B2","beta"],["\u03B3","gamma"],["\u03B4","delta"],["\u03B5","epsilon"],["\u03B8","theta"],["\u03BB","lambda"],["\u03BC","mu"],["\u03C0","pi"],["\u03C3","sigma"],["\u03C6","phi"],["\u03C9","omega"],["\u0394","capital delta"],["\u03A3","capital sigma"],["\u03A9","capital omega ohm"]]],l0={name:"charmap",toolbar:"charmap",setup(n){let e=V(n,i0),t=s0.map((o,i)=>({title:e.groups[i],items:o})),r=o=>Zr({groups:t,searchLabel:e.search,emptyText:e.empty,className:"nova-charmap",onPick:i=>{o(),vn(n,i)}});n.ui.registry.addPanelButton("charmap",{icon:zf,tooltip:e.title,isEnabled:o=>o.isEditable(),render:(o,i)=>r(i)}),n.ui.registry.addMenuItem("charmap",{text:e.title,icon:zf,onAction:()=>eo(n,e.title,r)})}}});var qf={};He(qf,{default:()=>c0});var _f,a0,Vf,c0,Wf=P(()=>{"use strict";j();ke();_f=M.emoji,a0={en:{title:"Emoji",search:"Search emoji",empty:"No emoji found",groups:["Smileys","Gestures","Hearts","Nature","Food","Activities","Objects","Symbols"]},ru:{title:"\u042D\u043C\u043E\u0434\u0437\u0438",search:"\u041F\u043E\u0438\u0441\u043A \u044D\u043C\u043E\u0434\u0437\u0438",empty:"\u042D\u043C\u043E\u0434\u0437\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B",groups:["\u0421\u043C\u0430\u0439\u043B\u044B","\u0416\u0435\u0441\u0442\u044B","\u0421\u0435\u0440\u0434\u0446\u0430","\u041F\u0440\u0438\u0440\u043E\u0434\u0430","\u0415\u0434\u0430","\u0417\u0430\u043D\u044F\u0442\u0438\u044F","\u041F\u0440\u0435\u0434\u043C\u0435\u0442\u044B","\u0421\u0438\u043C\u0432\u043E\u043B\u044B"]}},Vf=[[["\u{1F600}","grinning"],["\u{1F603}","smiley"],["\u{1F604}","smile"],["\u{1F601}","grin"],["\u{1F606}","laughing"],["\u{1F605}","sweat smile"],["\u{1F602}","joy tears"],["\u{1F642}","slight smile"],["\u{1F609}","wink"],["\u{1F60A}","blush"],["\u{1F607}","innocent halo"],["\u{1F60D}","heart eyes"],["\u{1F929}","star struck"],["\u{1F618}","kiss"],["\u{1F60B}","yum"],["\u{1F60E}","sunglasses cool"],["\u{1F914}","thinking"],["\u{1F610}","neutral"],["\u{1F60F}","smirk"],["\u{1F634}","sleeping"],["\u{1F62E}","open mouth surprised"],["\u{1F622}","cry sad"],["\u{1F62D}","sob"],["\u{1F621}","angry rage"],["\u{1F92F}","mind blown"],["\u{1F973}","party"],["\u{1F917}","hug"],["\u{1F644}","eye roll"],["\u{1F62C}","grimace"],["\u{1F913}","nerd"]],[["\u{1F44D}","thumbs up like yes"],["\u{1F44E}","thumbs down dislike no"],["\u{1F44F}","clap"],["\u{1F64C}","raised hands"],["\u{1F64F}","pray thanks please"],["\u{1F44B}","wave hello"],["\u270C\uFE0F","victory peace"],["\u{1F91D}","handshake deal"],["\u{1F4AA}","muscle strong"],["\u{1F44C}","ok"],["\u{1F91E}","fingers crossed"],["\u{1F449}","point right"],["\u{1F440}","eyes look"]],[["\u2764\uFE0F","red heart love"],["\u{1F9E1}","orange heart"],["\u{1F49B}","yellow heart"],["\u{1F49A}","green heart"],["\u{1F499}","blue heart"],["\u{1F49C}","purple heart"],["\u{1F5A4}","black heart"],["\u{1F494}","broken heart"],["\u{1F4AF}","hundred"],["\u2728","sparkles"],["\u{1F525}","fire hot"],["\u2B50","star"]],[["\u2600\uFE0F","sun"],["\u{1F319}","moon"],["\u26C5","cloud sun"],["\u{1F327}\uFE0F","rain"],["\u2744\uFE0F","snow"],["\u{1F308}","rainbow"],["\u{1F338}","blossom flower"],["\u{1F333}","tree"],["\u{1F340}","clover luck"],["\u{1F436}","dog"],["\u{1F431}","cat"],["\u{1F98A}","fox"],["\u{1F43B}","bear"],["\u{1F427}","penguin"],["\u{1F98B}","butterfly"]],[["\u{1F34E}","apple"],["\u{1F34C}","banana"],["\u{1F355}","pizza"],["\u{1F354}","burger"],["\u{1F370}","cake"],["\u{1F36A}","cookie"],["\u2615","coffee"],["\u{1F375}","tea"],["\u{1F37A}","beer"],["\u{1F377}","wine"],["\u{1F382}","birthday cake"]],[["\u26BD","soccer football"],["\u{1F3C0}","basketball"],["\u{1F3BE}","tennis"],["\u{1F3AE}","video game"],["\u{1F3B5}","music note"],["\u{1F3A8}","art palette"],["\u{1F389}","tada celebration"],["\u{1F381}","gift present"],["\u{1F3C6}","trophy winner"],["\u{1F680}","rocket launch"],["\u2708\uFE0F","airplane travel"]],[["\u{1F4A1}","bulb idea"],["\u{1F4CC}","pin"],["\u{1F4CE}","paperclip attachment"],["\u{1F4C5}","calendar date"],["\u{1F4C8}","chart up growth"],["\u{1F4C9}","chart down"],["\u{1F4DD}","memo note"],["\u{1F4DA}","books"],["\u{1F4BB}","laptop computer"],["\u{1F4F1}","phone mobile"],["\u{1F512}","lock secure"],["\u{1F511}","key"],["\u23F0","alarm clock"],["\u{1F4E7}","email mail"],["\u{1F4B0}","money bag"],["\u{1F6E0}\uFE0F","tools"]],[["\u2705","check done yes"],["\u274C","cross no"],["\u26A0\uFE0F","warning"],["\u2757","exclamation"],["\u2753","question"],["\u2795","plus"],["\u2796","minus"],["\u{1F534}","red circle"],["\u{1F7E2}","green circle"],["\u{1F535}","blue circle"],["\u2B06\uFE0F","up"],["\u2B07\uFE0F","down"],["\u{1F195}","new"],["\u{1F197}","ok button"]]],c0={name:"emoticons",toolbar:"emoticons",setup(n){let e=V(n,a0),t=Vf.map((i,s)=>({title:e.groups[s],items:i})),r=Vf.flat(),o=i=>Zr({groups:t,searchLabel:e.search,emptyText:e.empty,className:"nova-emoticons",onPick:s=>{i(),vn(n,s)}});n.ui.registry.addPanelButton("emoticons",{icon:_f,tooltip:e.title,isEnabled:i=>i.isEditable(),render:(i,s)=>o(s)}),n.ui.registry.addMenuItem("emoticons",{text:e.title,icon:_f,onAction:()=>eo(n,e.title,o)}),n.ui.registry.addAutocompleter("emoticons",{trigger:":",minChars:2,label:e.title,maxResults:8,fetch:i=>{let s=i.toLowerCase();return/^[a-z]+$/.test(s)?r.filter(([,l])=>l.split(" ").some(a=>a.startsWith(s))).map(([l,a])=>({value:l,label:a,icon:l})):[]},onSelect:(i,s,l)=>{let{state:a,dispatch:c}=l.view;c(a.tr.insertText(i.value,s.from,s.to).scrollIntoView())}})}}});var Kf={};He(Kf,{default:()=>d0});var Uf,jf,u0,d0,Jf=P(()=>{"use strict";j();pt();ke();Uf="\xA0",jf=M.nonBreaking,u0={en:{title:"Nonbreaking space"},ru:{title:"\u041D\u0435\u0440\u0430\u0437\u0440\u044B\u0432\u043D\u044B\u0439 \u043F\u0440\u043E\u0431\u0435\u043B"}},d0={name:"nonbreaking",toolbar:"nonbreaking",prosemirrorPlugins:()=>[Fe({"Mod-Shift-Space":(n,e)=>(e?.(n.tr.insertText(Uf).scrollIntoView()),!0)})],setup(n){let{title:e}=V(n,u0),t={icon:jf,tooltip:e,shortcut:"Mod-Shift-Space",isEnabled:()=>n.isEditable(),onAction:()=>vn(n,Uf)};n.ui.registry.addButton("nonbreaking",t),n.ui.registry.addMenuItem("nonbreaking",{text:e,icon:jf,onAction:t.onAction})}}});function f0(n){return function(e,t,r,o){let i=n;if(t[1]){let s=t[0].lastIndexOf(t[1]);i+=t[0].slice(s+t[1].length),r+=s;let l=r-o;l>0&&(i=t[0].slice(s-l,s)+i,r=o)}return e.tr.insertText(i,r,o)}}function Uo({rules:n}){let e=new _({state:{init(){return null},apply(t,r){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,o,i){return Gf(t,r,o,i,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:r}=t.state.selection;r&&Gf(t,r.pos,r.pos,"",n,e)})}}},isInputRules:!0});return e}function Gf(n,e,t,r,o,i){if(n.composing)return!1;let s=n.state,l=s.doc.resolve(e),a=n.state.selection,c=l.parent.textBetween(Math.max(0,l.parentOffset-p0),l.parentOffset,null,"\uFFFC")+r,u=e==a.from&&t==a.to&&n.state.storedMarks||(e==t?l.marks():l.marksAcross(s.doc.resolve(t))||[]);for(let d=0;d<o.length;d++){let f=o[d];if(!f.inCodeMark&&u.some(g=>g.type.spec.code))continue;if(l.parent.type.spec.code){if(!f.inCode)continue}else if(f.inCode==="only")continue;let p=f.match.exec(c);if(!p||p[0].length<r.length)continue;let h=e-(p[0].length-r.length);if(!f.inCodeMark){let g=!1;if(s.doc.nodesBetween(h,l.pos,b=>{b.isInline&&b.marks.some(x=>x.type.spec.code)&&(g=!0)}),g)continue}let m=f.handler(s,p,h,t,r);if(m)return f.undoable&&m.setMeta(i,{transform:m,from:e,to:t,text:r}),n.dispatch(m),!0}return!1}function jo(n,e,t,r){let o,i;return e instanceof lt?i=e:(o=e,i=e.nodeType,t=e.getAttrs,r=e.joinPredicate),new Ue(n,(s,l,a,c)=>{let u=t instanceof Function?t(l):t,d=s.tr.delete(a,c),f=d.doc.resolve(a),p=f.blockRange(),h=p&&gn(p,i,u);if(!h)return null;d.wrap(p,h);let m=d.doc.resolve(a-1).nodeBefore;return m&&m.type==i&&Wt(d.doc,a-1)&&(!r||r(l,m))&&d.join(a-1),d},o)}function fl(n,e,t){let r,o;return e instanceof lt?o=e:(r=e,o=e.nodeType,t=e.getAttrs),new Ue(n,(i,s,l,a)=>{let c=i.doc.resolve(l),u=t instanceof Function?t(s):t;return c.node(-1).canReplaceWith(c.index(-1),c.indexAfter(-1),o)?i.tr.delete(l,a).setBlockType(l,l,o,u):null},r)}var Ue,p0,Xf,Yf,TS,NS,LS,OS,pl=P(()=>{"use strict";K();Ye();de();Ue=class{constructor(e,t,r={}){this.match=e,this.match=e,this.handler=typeof t=="string"?f0(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}};p0=500;Xf=new Ue(/--$/,"\u2014",{inCodeMark:!1}),Yf=new Ue(/\.\.\.$/,"\u2026",{inCodeMark:!1}),TS=new Ue(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),NS=new Ue(/"$/,"\u201D",{inCodeMark:!1}),LS=new Ue(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),OS=new Ue(/'$/,"\u2019",{inCodeMark:!1})});var ep={};He(ep,{default:()=>g0});function Zf(n){return/^www\./i.test(n)?`https://${n}`:/^[\w.+-]+@/.test(n)?`mailto:${n}`:n}function Qf(n,e,t){let r=n.doc.resolve(t);if(!r.parent.isTextblock||r.parent.type.spec.code)return!1;let i=r.parent.textBetween(0,r.parentOffset,void 0,"\uFFFC").match(h0);if(!i)return!1;let s=i[1],l=t-i[2].length,a=l-s.length,c=oe(n).link;if(n.doc.rangeHasMark(a,l,c))return!1;let u=Zf(s);return Re(u)?(e.addMark(a,l,c.create({href:u})),!0):!1}var h0,m0,g0,tp=P(()=>{"use strict";pl();K();Oe();gt();h0=/(?:^|[\s(])((?:https?:\/\/|www\.)[^\s<>"]*[^\s<>".,;:!?)\]'"]|[\w.+-]+@[\w-]+(?:\.[\w-]+)+)([.,;:!?)\]'"]*)$/i,m0=/^(?:https?:\/\/|www\.)\S+$|^mailto:\S+$/i;g0={name:"autolink",prosemirrorPlugins:n=>[Uo({rules:[new Ue(/\S\s$/,(e,t,r,o)=>{if(!n.isAllowed("link"))return null;let i=e.tr,s=r+t[0].length-1;return Qf(e,i,s)?i.insertText(t[0].slice(-1),o).removeStoredMark(oe(e).link):null})]}),new _({appendTransaction(e,t,r){if(!n.isAllowed("link")||!e.some(a=>a.docChanged))return null;let{$from:o,empty:i}=r.selection;if(!i||o.parentOffset!==0||o.depth<1)return null;let s=F.findFrom(r.doc.resolve(o.before()),-1,!0);if(!s||!s.empty||s.$from.parentOffset!==s.$from.parent.content.size)return null;let l=r.tr;return Qf(r,l,s.from)?l:null}}),new _({props:{handlePaste(e,t){let{state:r}=e;if(r.selection.empty||!n.isAllowed("link"))return!1;let o=(t.clipboardData?.getData("text/plain")??"").trim();if(!m0.test(o))return!1;let i=Zf(o);if(!Re(i))return!1;let{from:s,to:l}=r.selection,a=oe(r).link;return e.dispatch(r.tr.removeMark(s,l,a).addMark(s,l,a.create({href:i}))),!0}}})]}});var rp={};He(rp,{default:()=>v0});function y0(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}var np,b0,v0,op=P(()=>{"use strict";j();ke();np=M.save,b0={en:{restore:"Restore last draft",found:"An unsaved draft was found. Use \u201CRestore last draft\u201D to bring it back.",restored:"Draft restored"},ru:{restore:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A",found:"\u041D\u0430\u0439\u0434\u0435\u043D \u043D\u0435\u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0439 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A. \u0415\u0433\u043E \u043C\u043E\u0436\u043D\u043E \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u043A\u043D\u043E\u043F\u043A\u043E\u0439 \xAB\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\xBB.",restored:"\u0427\u0435\u0440\u043D\u043E\u0432\u0438\u043A \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D"}};v0={name:"autosave",toolbar:"restoredraft",setup(n){let e=n.options.pluginOptions?.autosave??{},t=V(n,b0),r=y0(),o=e.key??`novaprose-draft:${typeof location>"u"?"":location.pathname}:${n.options.element.id||"editor"}`,i=e.delay??1e3,s=(e.retention??10080)*6e4,l=()=>{try{let h=JSON.parse(r?.getItem(o)??"null");return!h||typeof h.html!="string"||Date.now()-h.time>s?null:h}catch{return null}},a=l();a&&a.html===n.getHTML()&&(a=null),a&&n.ui.notify({text:t.found,timeout:8e3});let c,u=()=>{c=void 0;try{n.isEmpty()?r?.removeItem(o):r?.setItem(o,JSON.stringify({html:n.getHTML(),time:Date.now()}))}catch{}},d=n.on("change",()=>{a=null,clearTimeout(c),c=setTimeout(u,i)}),f=()=>{let h=a??l();h&&(n.setContent(h.html),a=null,n.ui.notify({text:t.restored}),n.focus())},p={icon:np,tooltip:t.restore,isEnabled:()=>n.isEditable()&&a!==null,onAction:f};return n.ui.registry.addButton("restoredraft",p),n.ui.registry.addMenuItem("restoredraft",{text:t.restore,icon:np,onAction:f}),()=>{d(),c!==void 0&&(clearTimeout(c),u())}}}});var ip={};He(ip,{default:()=>k0});var k0,sp=P(()=>{"use strict";k0={name:"autoresize",setup(n){let{minHeight:e,maxHeight:t}=n.options.pluginOptions?.autoresize??{},r=n.root.querySelector(".nova-content");if(r)return n.root.classList.add("nova-autoresize"),e!==void 0&&n.root.style.setProperty("--nova-min-height",`${e}px`),t!==void 0&&(r.style.maxHeight=`${t}px`),()=>{n.root.classList.remove("nova-autoresize"),n.root.style.removeProperty("--nova-min-height"),r.style.removeProperty("max-height")}}}});var ap={};He(ap,{default:()=>x0});var lp,w0,x0,cp=P(()=>{"use strict";j();ke();lp=M.visualBlocks,w0={en:{title:"Show blocks"},ru:{title:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u043B\u043E\u043A\u0438"}},x0={name:"visualblocks",toolbar:"visualblocks",setup(n){let{title:e}=V(n,w0),t=n.options.pluginOptions?.visualblocks??{},r=()=>n.root.classList.contains("nova-visualblocks"),o=()=>{n.root.classList.toggle("nova-visualblocks"),n.updateUI(),n.focus()};return t.default&&n.root.classList.add("nova-visualblocks"),n.ui.registry.addToggleButton("visualblocks",{icon:lp,tooltip:e,isActive:r,onAction:o}),n.ui.registry.addToggleMenuItem("visualblocks",{text:e,icon:lp,isActive:r,onAction:o}),()=>n.root.classList.remove("nova-visualblocks")}}});var fp={};He(fp,{default:()=>C0});function M0(n){return n.view.state.selection.$from.parent.attrs.dir??null}function dp(n){return(e,t)=>{let{paragraph:r,heading:o}=G(e),i=e.tr,s=!1;return e.doc.nodesBetween(e.selection.from,e.selection.to,(l,a)=>l.type!==r&&l.type!==o?!0:(s=!0,i.setNodeMarkup(a,void 0,{...l.attrs,dir:n}),!1)),s?(t?.(i),!0):!1}}var up,S0,C0,pp=P(()=>{"use strict";j();Oe();ke();up={ltr:M.ltr,rtl:M.rtl},S0={en:{ltr:"Left to right",rtl:"Right to left"},ru:{ltr:"\u0421\u043B\u0435\u0432\u0430 \u043D\u0430\u043F\u0440\u0430\u0432\u043E",rtl:"\u0421\u043F\u0440\u0430\u0432\u0430 \u043D\u0430\u043B\u0435\u0432\u043E"}};C0={name:"directionality",toolbar:"ltr rtl",setup(n){let e=V(n,S0);for(let t of["ltr","rtl"]){let r=()=>M0(n)===t,o=()=>{n.exec(dp(r()?null:t)),n.focus()};n.ui.registry.addToggleButton(t,{icon:up[t],tooltip:e[t],isActive:r,isEnabled:i=>i.can(dp(t)),onAction:o}),n.ui.registry.addToggleMenuItem(t,{text:e[t],icon:up[t],isActive:r,onAction:o})}}}});var hp={};He(hp,{default:()=>T0});function hl(n,e){let{$from:t}=n.selection;for(let r=t.depth;r>0;r--){let o=t.node(r);if(o.type===e)return{pos:t.before(r),attrs:o.attrs}}return null}function A0(n,e,t,r){let o=()=>G(n.view.state)[e];hl(n.view.state,o())||n.exec(e==="bullet_list"?"bulletList":"orderedList");let i=hl(n.view.state,o());if(!i)return;let{state:s,dispatch:l}=n.view;l(s.tr.setNodeMarkup(i.pos,void 0,{...i.attrs,listStyle:t===r?null:t})),n.focus()}var E0,T0,mp=P(()=>{"use strict";Oe();et();ke();E0={en:{disc:"Default",circle:"Circle",square:"Square",decimal:"Default (1, 2, 3)","lower-alpha":"Lower alpha (a, b, c)","upper-alpha":"Upper alpha (A, B, C)","lower-roman":"Lower roman (i, ii, iii)","upper-roman":"Upper roman (I, II, III)","lower-greek":"Lower greek (\u03B1, \u03B2, \u03B3)"},ru:{disc:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",circle:"\u041A\u0440\u0443\u0436\u043E\u043A",square:"\u041A\u0432\u0430\u0434\u0440\u0430\u0442",decimal:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E (1, 2, 3)","lower-alpha":"\u0421\u0442\u0440\u043E\u0447\u043D\u044B\u0435 \u0431\u0443\u043A\u0432\u044B (a, b, c)","upper-alpha":"\u041F\u0440\u043E\u043F\u0438\u0441\u043D\u044B\u0435 \u0431\u0443\u043A\u0432\u044B (A, B, C)","lower-roman":"\u0420\u0438\u043C\u0441\u043A\u0438\u0435 \u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0435 (i, ii, iii)","upper-roman":"\u0420\u0438\u043C\u0441\u043A\u0438\u0435 \u043F\u0440\u043E\u043F\u0438\u0441\u043D\u044B\u0435 (I, II, III)","lower-greek":"\u0413\u0440\u0435\u0447\u0435\u0441\u043A\u0438\u0435 (\u03B1, \u03B2, \u03B3)"}};T0={name:"advlist",setup(n){let e=V(n,E0),t=n.options.pluginOptions?.advlist??{},r=[{control:"bullist",kind:"bullet_list",styles:t.bullets??[...Do],fallback:"disc"},{control:"numlist",kind:"ordered_list",styles:t.numbers??[...Ro],fallback:"decimal"}];for(let{control:o,kind:i,styles:s,fallback:l}of r){let a=n.ui.registry.get(o);if(!a||a.type!=="button")continue;let{type:c,...u}=a;n.ui.registry.addSplitButton(o,{...u,items:d=>{let f=hl(d.view.state,G(d.view.state)[i]),p=f?.attrs.listStyle??(f?l:null);return s.map(h=>({id:h,label:e[h],active:p===h,onSelect:()=>A0(d,i,h,l)}))}})}}}});function Zo(n){gp.has(n)||(gp.add(n),console.warn(`[nova] formats: ${n}`))}function Je(n){return Array.isArray(n)?n.flatMap(Je):typeof n=="string"?n.split(/\s+/).filter(Boolean):[]}function Er(n){let e=[];for(let t of n)e.push(...Je(t.classes)),"items"in t&&t.items&&e.push(...Er(t.items));return e}function Xo(n){let e={};for(let[t,r]of Object.entries(n.styles??{}))t==="text-align"&&Po.includes(r)?e.align=r:t==="line-height"&&U.lineHeight(r)?e.lineHeight=U.lineHeight(r):Zo(`style "${t}" is not supported on blocks`);return e}function bl(n,e){let t=oe(n),r=[];if(e.inline&&e.inline!=="span"){let i=t[N0[e.inline]];i&&r.push(i.create())}let o=Je(e.classes);o.length&&t.span_class&&r.push(t.span_class.create({class:o.join(" ")}));for(let[i,s]of Object.entries(e.styles??{})){let l=L0[i],a=l?.read(s),c=l?t[l.mark]:void 0;c&&a?r.push(c.create({value:a})):Zo(`style "${i}: ${s}" is not supported on text`)}return r}function ti(n,e){let t=[],r=a=>e.some(c=>Qo[c](a)),{selection:o}=n;if(o instanceof B&&r(o.node))return[{node:o.node,pos:o.from}];let{$from:i,from:s,to:l}=o;for(let a=i.depth;a>0;a--){let c=i.node(a);r(c)&&t.push({node:c,pos:i.before(a)})}return n.doc.nodesBetween(s,l,(a,c)=>{r(a)&&!t.some(u=>u.pos===c)&&t.push({node:a,pos:c})}),t}function ml(n){let e=[],{from:t,to:r}=n.selection;return n.doc.nodesBetween(t,r,(o,i)=>o.isTextblock?(e.push({node:o,pos:i}),!1):!0),e}function yl(n){let{$from:e}=n.selection;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.name==="blockquote")return{node:r,pos:e.before(t)}}return null}function vp(n){return{align:n.align??null,lineHeight:n.lineHeight??null,dir:n.dir??null}}function bp(n,e){return e.selector?ti(n,ei(e)).length>0:!0}function yp(n,e){return n.type.name==="image"?!0:Object.entries(Xo(e)).every(([t,r])=>n.attrs[t]===r)}function O0(n,e){let t=Je(e.classes);if(e.block){if(e.block==="blockquote"){let o=yl(n);return!!o&&Go(o.node.attrs.class,t)}let r=n.selection.$from.parent;return Qo[e.block](r)&&Go(r.attrs.class,t)&&yp(r,e)}if(e.selector){let r=ti(n,ei(e));return r.length>0&&r.some(({node:o})=>Go(o.attrs.class,t)&&yp(o,e))}if(e.inline){let r=bl(n,e);if(!r.length)return!1;let{$from:o,empty:i,from:s,to:l}=n.selection;if(i){let u=n.storedMarks??o.marks();return r.every(d=>u.some(f=>gl(f,d)))}let a=!1,c=!0;return n.doc.nodesBetween(s,l,u=>{u.isText&&(a=!0,r.every(d=>u.marks.some(f=>gl(f,d)))||(c=!1))}),a&&c}return!1}function gl(n,e){return n.type!==e.type?!1:e.type.name==="span_class"?Go(n.attrs.class,Je(e.attrs.class)):e.attrs.value===void 0||n.attrs.value===e.attrs.value}function D0(n,e,t){let r=Je(t.classes),o=G(n);if(t.block==="blockquote"){let i=yl(n);return i?(e.setNodeMarkup(i.pos,void 0,{...i.node.attrs,class:Ko(i.node.attrs.class,r)}),!0):Ho(o.blockquote,{class:Ko(null,r)})(n,s=>s.steps.forEach(l=>e.step(l)))}if(t.block==="pre"){for(let{node:i,pos:s}of ml(n))i.type!==o.code_block&&e.setNodeMarkup(s,o.code_block,{language:null});return!0}if(t.block){let i=t.block==="p"?0:Number(t.block.slice(1)),s=i?o.heading:o.paragraph,l=Xo(t);for(let{node:a,pos:c}of ml(n)){if(a.type===o.code_block&&a.textContent.includes(`
|
|
12
|
-
`))
|
|
13
|
-
`)}function F0(n,e){return n.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi,(t,r,o)=>{if(/^(data:|https?:|\/\/|#)/i.test(o))return t;try{return`url(${r}${new URL(o,e).href}${r})`}catch{return t}})}async function kl(n,e=0){let t=new URL(n,document.baseURI).href,r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=F0(await r.text(),t);if(e>=3)return o.replace(wp,"");let i=[...o.matchAll(wp)];for(let s of i){let l=s[3].trim(),a="";try{a=await kl(new URL(s[2],t).href,e+1)}catch(c){console.warn(`[nova] contentCss: could not load ${s[2]}`,c)}o=o.replace(s[0],l?`@media ${l}{${a}}`:a)}return o}function xp(n,e){let t=n.getRootNode();if("adoptedStyleSheets"in t&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype)try{let i=new CSSStyleSheet;return i.replaceSync(e),t.adoptedStyleSheets=[...t.adoptedStyleSheets,i],()=>{t.adoptedStyleSheets=t.adoptedStyleSheets.filter(s=>s!==i)}}catch{}let o=document.createElement("style");return o.setAttribute("data-nova-content-css",""),o.textContent=e,n.prepend(o),()=>o.remove()}var P0,I0,wp,Sp=P(()=>{"use strict";P0=/^@(font-face|(-webkit-)?keyframes|property|counter-style|page|font-feature-values|font-palette-values)\b/i,I0=/^@(media|supports|container|layer|document|scope)\b/i;wp=/@import\s+(?:url\(\s*)?(['"]?)([^'")\s;]+)\1\s*\)?([^;]*);/gi});function Mp(n={}){return new _({view(e){return new wl(e,n)}})}var wl,Cp=P(()=>{"use strict";K();Ye();wl=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=d?h.bottom:h.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:h.left,right:h.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,p=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*p}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(!t||i)return null;let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Gr(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}});function Ep(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function $0(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||Ep(o.type))return!0;if(o.inlineContent)return!1}}return!0}function _0(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||Ep(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Ap(){return new _({props:{decorations:U0,createSelectionBetween(n,e,t){return e.pos==t.pos&&Me.valid(t)?new Me(t):null},handleClick:q0,handleKeyDown:V0,handleDOMEvents:{beforeinput:W0}}})}function ni(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof H){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Me.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new Me(c))),!0):!1}}function q0(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Me.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&B.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Me(r))),!0)}function W0(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Me))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new O(o,0,0));return i.setSelection(H.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function U0(n){if(!(n.selection instanceof Me))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Y.create(n.doc,[re.widget(n.selection.head,e,{key:"gapcursor"})])}var Me,xl,V0,Tp=P(()=>{"use strict";pt();K();de();Rt();Me=class n extends F{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):F.near(r)}content(){return O.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new xl(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!$0(e)||!_0(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};Me.prototype.visible=!1;Me.findFrom=Me.findGapCursorFrom;F.jsonID("gapcursor",Me);xl=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Me.valid(t)?new Me(t):F.near(t)}};V0=pr({ArrowLeft:ni("horiz",-1),ArrowRight:ni("horiz",1),ArrowUp:ni("vert",-1),ArrowDown:ni("vert",1)})});var ri,Np=P(()=>{"use strict";ri={"toolbar.label":"Formatting","toolbar.options":"options","editor.label":"Rich text editor","editor.required":"Please fill in this field.",undo:"Undo",redo:"Redo",bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Inline code",subscript:"Subscript",superscript:"Superscript",link:"Link",unlink:"Remove link",image:"Image",bulletList:"Bulleted list",orderedList:"Numbered list",indent:"Increase indent",outdent:"Decrease indent",align:"Alignment",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Justify",blockquote:"Quote",codeBlock:"Code block",horizontalRule:"Horizontal line",clearFormatting:"Clear formatting",more:"More",moreFormats:"More formatting",blocks:"Text style",styles:"Formats","styles.headings":"Headings","styles.inline":"Inline","styles.blocks":"Blocks","styles.align":"Align",paragraph:"Paragraph",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",fontFamily:"Font",fontSize:"Font size",lineHeight:"Line height",default:"Default",textColor:"Text color",backgroundColor:"Highlight color",removeColor:"Remove color",customColor:"Custom color","dialog.cancel":"Cancel","dialog.save":"Save","dialog.insert":"Insert","dialog.close":"Close","link.title":"Insert link","link.editTitle":"Edit link","link.url":"URL","link.text":"Text to display","link.tooltip":"Title (tooltip)","link.newTab":"Open in new tab","link.open":"Open link","link.edit":"Edit link","link.copy":"Copy link","link.copied":"Link copied","link.invalid":"This URL is not allowed","image.title":"Insert image","image.url":"Image URL","image.alt":"Alternative text","image.altHint":"Describe the image for people using screen readers","image.upload":"Upload","image.drop":"Drop an image here or click to choose","image.uploading":"Uploading image\u2026","image.uploadFailed":"Image upload failed","image.invalid":"This image URL is not allowed","image.or":"or","image.toolbar":"Image options","image.alignLeft":"Float left","image.alignCenter":"Center","image.alignRight":"Float right","image.editAlt":"Alternative text","image.size":"Size","image.sizeSmall":"Small (25%)","image.sizeMedium":"Medium (50%)","image.sizeLarge":"Large (75%)","image.sizeFull":"Full width","image.sizeOriginal":"Original size","image.delete":"Remove image","status.words":"{count} words","status.resize":"Resize editor","dialog.browse":"Browse",pasteAsText:"Paste as text","menu.label":"Menu","menu.file":"File","menu.edit":"Edit","menu.view":"View","menu.insert":"Insert","menu.format":"Format","menu.table":"Table","menu.help":"Help",selectAll:"Select all",print:"Print","table.rows":"Rows","table.cols":"Columns","table.invalidSize":"Enter a number from 1 to 50","quickbars.selection":"Quick formatting","quickbars.insert":"Quick insert","search.title":"Find and replace","search.find":"Find","search.replace":"Replace with","search.next":"Next match","search.prev":"Previous match","search.replaceOne":"Replace","search.replaceAll":"Replace all","search.matchCase":"Match case","search.wholeWord":"Whole words only","search.count":"{current} of {total}","search.none":"No results",fullscreen:"Fullscreen",preview:"Preview",sourceCode:"Source code",help:"Keyboard shortcuts","help.formatting":"Text formatting","help.blocks":"Paragraphs and lists","help.editing":"Editing","help.navigation":"Navigation","help.slash":"Insert block (slash commands)","help.toMenubar":"Move to the menu bar","help.toToolbar":"Move to the toolbar","help.toContextToolbar":"Move to the image/table toolbar","help.toEditor":"Back to the text","help.nextCell":"Next table cell",table:"Table","table.insert":"Insert table","table.size":"{rows} \xD7 {cols}","table.toolbar":"Table options","table.rowBefore":"Insert row above","table.rowAfter":"Insert row below","table.rowDelete":"Delete row","table.colBefore":"Insert column left","table.colAfter":"Insert column right","table.colDelete":"Delete column","table.merge":"Merge cells","table.split":"Split cell","table.rowHeader":"Header row","table.colHeader":"Header column","table.cellBackground":"Cell background","table.delete":"Delete table","table.sort":"Sort","table.sortAsc":"Sort A \u2192 Z, 1 \u2192 9","table.sortDesc":"Sort Z \u2192 A, 9 \u2192 1","table.props":"Table properties","table.style":"Style","table.styleDefault":"Default","table.width":"Width","table.widthHint":"For example 100% or 600px. Leave empty to fit the content.","table.invalidWidth":"Enter a width such as 100% or 600px","table.align":"Alignment on the page","table.alignDefault":"Default","table.alignCenter":"Center","table.alignRight":"Right","table.cellProps":"Cell properties","table.valign":"Vertical alignment","table.valignTop":"Top","table.valignMiddle":"Middle","table.valignBottom":"Bottom","table.cellType":"Cell type","table.cellData":"Data cell","table.cellHeader":"Header cell","table.colWidth":"Column width, px","table.colWidthHint":"Leave empty to fit the content.","table.invalidColWidth":"Enter a number from 24 to 4000","slash.label":"Commands","slash.empty":"No matching commands"}});var Lp,Op=P(()=>{"use strict";Lp={"toolbar.label":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","toolbar.options":"\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B","editor.label":"\u0422\u0435\u043A\u0441\u0442\u043E\u0432\u044B\u0439 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440","editor.required":"\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u044D\u0442\u043E \u043F\u043E\u043B\u0435.",undo:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",redo:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",bold:"\u0416\u0438\u0440\u043D\u044B\u0439",italic:"\u041A\u0443\u0440\u0441\u0438\u0432",underline:"\u041F\u043E\u0434\u0447\u0451\u0440\u043A\u043D\u0443\u0442\u044B\u0439",strike:"\u0417\u0430\u0447\u0451\u0440\u043A\u043D\u0443\u0442\u044B\u0439",code:"\u041A\u043E\u0434 \u0432 \u0441\u0442\u0440\u043E\u043A\u0435",subscript:"\u041F\u043E\u0434\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439",superscript:"\u041D\u0430\u0434\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439",link:"\u0421\u0441\u044B\u043B\u043A\u0430",unlink:"\u0423\u0431\u0440\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443",image:"\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",bulletList:"\u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",orderedList:"\u041D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",indent:"\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C \u043E\u0442\u0441\u0442\u0443\u043F",outdent:"\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C \u043E\u0442\u0441\u0442\u0443\u043F",align:"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435",alignLeft:"\u041F\u043E \u043B\u0435\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",alignCenter:"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443",alignRight:"\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",alignJustify:"\u041F\u043E \u0448\u0438\u0440\u0438\u043D\u0435",blockquote:"\u0426\u0438\u0442\u0430\u0442\u0430",codeBlock:"\u0411\u043B\u043E\u043A \u043A\u043E\u0434\u0430",horizontalRule:"\u0413\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u044F",clearFormatting:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",more:"\u0415\u0449\u0451",moreFormats:"\u0415\u0449\u0451 \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",blocks:"\u0421\u0442\u0438\u043B\u044C \u0442\u0435\u043A\u0441\u0442\u0430",styles:"\u0424\u043E\u0440\u043C\u0430\u0442\u044B","styles.headings":"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438","styles.inline":"\u0422\u0435\u043A\u0441\u0442","styles.blocks":"\u0411\u043B\u043E\u043A\u0438","styles.align":"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435",paragraph:"\u041E\u0431\u044B\u0447\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442",h1:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 1",h2:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 2",h3:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 3",h4:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 4",h5:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 5",h6:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 6",fontFamily:"\u0428\u0440\u0438\u0444\u0442",fontSize:"\u0420\u0430\u0437\u043C\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430",lineHeight:"\u041C\u0435\u0436\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439 \u0438\u043D\u0442\u0435\u0440\u0432\u0430\u043B",default:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",textColor:"\u0426\u0432\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430",backgroundColor:"\u0426\u0432\u0435\u0442 \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u044F",removeColor:"\u0423\u0431\u0440\u0430\u0442\u044C \u0446\u0432\u0435\u0442",customColor:"\u0421\u0432\u043E\u0439 \u0446\u0432\u0435\u0442","dialog.cancel":"\u041E\u0442\u043C\u0435\u043D\u0430","dialog.save":"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C","dialog.insert":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C","dialog.close":"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","link.title":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.editTitle":"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.url":"\u0410\u0434\u0440\u0435\u0441","link.text":"\u0422\u0435\u043A\u0441\u0442 \u0441\u0441\u044B\u043B\u043A\u0438","link.tooltip":"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 (title)","link.newTab":"\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435","link.open":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.edit":"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.copy":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.copied":"\u0421\u0441\u044B\u043B\u043A\u0430 \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u0430","link.invalid":"\u0422\u0430\u043A\u043E\u0439 \u0430\u0434\u0440\u0435\u0441 \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D","image.title":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","image.url":"\u0410\u0434\u0440\u0435\u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","image.alt":"\u0410\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442","image.altHint":"\u041E\u043F\u0438\u0448\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u043B\u044E\u0434\u0435\u0439, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0445 \u044D\u043A\u0440\u0430\u043D\u043D\u044B\u0439 \u0434\u0438\u043A\u0442\u043E\u0440","image.upload":"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C","image.drop":"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0432\u044B\u0431\u0440\u0430\u0442\u044C","image.uploading":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u2026","image.uploadFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","image.invalid":"\u0422\u0430\u043A\u043E\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D","image.or":"\u0438\u043B\u0438","image.toolbar":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","image.alignLeft":"\u041E\u0431\u0442\u0435\u043A\u0430\u043D\u0438\u0435, \u0441\u043B\u0435\u0432\u0430","image.alignCenter":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","image.alignRight":"\u041E\u0431\u0442\u0435\u043A\u0430\u043D\u0438\u0435, \u0441\u043F\u0440\u0430\u0432\u0430","image.editAlt":"\u0410\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442","image.size":"\u0420\u0430\u0437\u043C\u0435\u0440","image.sizeSmall":"\u041C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439 (25%)","image.sizeMedium":"\u0421\u0440\u0435\u0434\u043D\u0438\u0439 (50%)","image.sizeLarge":"\u0411\u043E\u043B\u044C\u0448\u043E\u0439 (75%)","image.sizeFull":"\u0412\u043E \u0432\u0441\u044E \u0448\u0438\u0440\u0438\u043D\u0443","image.sizeOriginal":"\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440","image.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","status.words":"\u0421\u043B\u043E\u0432: {count}","status.resize":"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0440\u0430\u0437\u043C\u0435\u0440 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440\u0430","dialog.browse":"\u041E\u0431\u0437\u043E\u0440",pasteAsText:"\u0412\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u043A\u0430\u043A \u0442\u0435\u043A\u0441\u0442","menu.label":"\u041C\u0435\u043D\u044E","menu.file":"\u0424\u0430\u0439\u043B","menu.edit":"\u041F\u0440\u0430\u0432\u043A\u0430","menu.view":"\u0412\u0438\u0434","menu.insert":"\u0412\u0441\u0442\u0430\u0432\u043A\u0430","menu.format":"\u0424\u043E\u0440\u043C\u0430\u0442","menu.table":"\u0422\u0430\u0431\u043B\u0438\u0446\u0430","menu.help":"\u0421\u043F\u0440\u0430\u0432\u043A\u0430",selectAll:"\u0412\u044B\u0434\u0435\u043B\u0438\u0442\u044C \u0432\u0441\u0451",print:"\u041F\u0435\u0447\u0430\u0442\u044C","table.rows":"\u0421\u0442\u0440\u043E\u043A\u0438","table.cols":"\u0421\u0442\u043E\u043B\u0431\u0446\u044B","table.invalidSize":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u043E\u0442 1 \u0434\u043E 50","quickbars.selection":"\u0411\u044B\u0441\u0442\u0440\u043E\u0435 \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","quickbars.insert":"\u0411\u044B\u0441\u0442\u0440\u0430\u044F \u0432\u0441\u0442\u0430\u0432\u043A\u0430","search.title":"\u041D\u0430\u0439\u0442\u0438 \u0438 \u0437\u0430\u043C\u0435\u043D\u0438\u0442\u044C","search.find":"\u041D\u0430\u0439\u0442\u0438","search.replace":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C \u043D\u0430","search.next":"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0435","search.prev":"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0435","search.replaceOne":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C","search.replaceAll":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C \u0432\u0441\u0435","search.matchCase":"\u0423\u0447\u0438\u0442\u044B\u0432\u0430\u0442\u044C \u0440\u0435\u0433\u0438\u0441\u0442\u0440","search.wholeWord":"\u0422\u043E\u043B\u044C\u043A\u043E \u0441\u043B\u043E\u0432\u043E \u0446\u0435\u043B\u0438\u043A\u043E\u043C","search.count":"{current} \u0438\u0437 {total}","search.none":"\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",fullscreen:"\u041D\u0430 \u0432\u0435\u0441\u044C \u044D\u043A\u0440\u0430\u043D",preview:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440",sourceCode:"HTML-\u043A\u043E\u0434",help:"\u0413\u043E\u0440\u044F\u0447\u0438\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0438","help.formatting":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0442\u0435\u043A\u0441\u0442\u0430","help.blocks":"\u0410\u0431\u0437\u0430\u0446\u044B \u0438 \u0441\u043F\u0438\u0441\u043A\u0438","help.editing":"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","help.navigation":"\u041D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044F","help.slash":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0431\u043B\u043E\u043A (\u0441\u043B\u044D\u0448-\u043A\u043E\u043C\u0430\u043D\u0434\u044B)","help.toMenubar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0433\u043B\u0430\u0432\u043D\u043E\u0435 \u043C\u0435\u043D\u044E","help.toToolbar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043D\u0430 \u043F\u0430\u043D\u0435\u043B\u044C \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u043E\u0432","help.toContextToolbar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043D\u0430 \u043F\u0430\u043D\u0435\u043B\u044C \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438/\u0442\u0430\u0431\u043B\u0438\u0446\u044B","help.toEditor":"\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u0432 \u0442\u0435\u043A\u0441\u0442","help.nextCell":"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u044F\u0447\u0435\u0439\u043A\u0430 \u0442\u0430\u0431\u043B\u0438\u0446\u044B",table:"\u0422\u0430\u0431\u043B\u0438\u0446\u0430","table.insert":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443","table.size":"{rows} \xD7 {cols}","table.toolbar":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0442\u0430\u0431\u043B\u0438\u0446\u044B","table.rowBefore":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443 \u0432\u044B\u0448\u0435","table.rowAfter":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443 \u043D\u0438\u0436\u0435","table.rowDelete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443","table.colBefore":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446 \u0441\u043B\u0435\u0432\u0430","table.colAfter":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446 \u0441\u043F\u0440\u0430\u0432\u0430","table.colDelete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446","table.merge":"\u041E\u0431\u044A\u0435\u0434\u0438\u043D\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0438","table.split":"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0443","table.rowHeader":"\u0421\u0442\u0440\u043E\u043A\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432","table.colHeader":"\u0421\u0442\u043E\u043B\u0431\u0435\u0446 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432","table.cellBackground":"\u0424\u043E\u043D \u044F\u0447\u0435\u0439\u043A\u0438","table.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443","table.sort":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430","table.sortAsc":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0410 \u2192 \u042F, 1 \u2192 9","table.sortDesc":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u042F \u2192 \u0410, 9 \u2192 1","table.props":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0442\u0430\u0431\u043B\u0438\u0446\u044B","table.style":"\u0421\u0442\u0438\u043B\u044C","table.styleDefault":"\u041E\u0431\u044B\u0447\u043D\u044B\u0439","table.width":"\u0428\u0438\u0440\u0438\u043D\u0430","table.widthHint":"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, 100% \u0438\u043B\u0438 600px. \u041F\u0443\u0441\u0442\u043E \u2014 \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443.","table.invalidWidth":"\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0448\u0438\u0440\u0438\u043D\u0443, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 100% \u0438\u043B\u0438 600px","table.align":"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435","table.alignDefault":"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E","table.alignCenter":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","table.alignRight":"\u0421\u043F\u0440\u0430\u0432\u0430","table.cellProps":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u044F\u0447\u0435\u0439\u043A\u0438","table.valign":"\u0412\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435","table.valignTop":"\u0421\u0432\u0435\u0440\u0445\u0443","table.valignMiddle":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","table.valignBottom":"\u0421\u043D\u0438\u0437\u0443","table.cellType":"\u0422\u0438\u043F \u044F\u0447\u0435\u0439\u043A\u0438","table.cellData":"\u041E\u0431\u044B\u0447\u043D\u0430\u044F","table.cellHeader":"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A","table.colWidth":"\u0428\u0438\u0440\u0438\u043D\u0430 \u0441\u0442\u043E\u043B\u0431\u0446\u0430, px","table.colWidthHint":"\u041F\u0443\u0441\u0442\u043E \u2014 \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443.","table.invalidColWidth":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u043E\u0442 24 \u0434\u043E 4000","slash.label":"\u041A\u043E\u043C\u0430\u043D\u0434\u044B","slash.empty":"\u041D\u0435\u0442 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0438\u0445 \u043A\u043E\u043C\u0430\u043D\u0434"}});function Rp(n="en",e={}){let t=n.toLowerCase(),r=Dp[t]??Dp[t.split("-")[0]]??ri,o={...ri,...r,...e};return(i,s)=>{let l=o[i]??i;return s?l.replace(/\{(\w+)\}/g,(a,c)=>String(s[c]??`{${c}}`)):l}}var Dp,Pp=P(()=>{"use strict";Np();Op();Dp={en:ri,ru:Lp}});function Ip(n=()=>!0,e=nn){let{nodes:t}=e,r=[Yf,Xf];n("blockquote")&&r.push(jo(/^\s*>\s$/,t.blockquote)),n("numlist")&&r.push(jo(/^(\d+)\.\s$/,t.ordered_list,o=>({start:Number(o[1])}),(o,i)=>i.childCount+i.attrs.start===Number(o[1]))),n("bullist")&&r.push(jo(/^\s*([-+*])\s$/,t.bullet_list)),n("codeblock")&&r.push(fl(/^```$/,t.code_block));for(let o=1;o<=6;o++)n(`h${o}`)&&r.push(fl(new RegExp(`^(#{${o}})\\s$`),t.heading,{level:o}));return Uo({rules:r})}var Bp=P(()=>{"use strict";pl();et()});function Hp(n=e=>Q[e]){let e={"Mod-z":Sl(n,"undo"),"Shift-Mod-z":Sl(n,"redo"),"Mod-b":Q.bold,"Mod-i":Q.italic,"Mod-u":Q.underline,"Mod-Shift-x":Q.strike,"Mod-e":Q.code,"Mod-,":Q.subscript,"Mod-.":Q.superscript,"Mod-Alt-0":Q.paragraph,"Mod-Alt-1":Q.h1,"Mod-Alt-2":Q.h2,"Mod-Alt-3":Q.h3,"Mod-Alt-4":Q.h4,"Mod-Alt-5":Q.h5,"Mod-Alt-6":Q.h6,"Mod-Shift-7":Q.orderedList,"Mod-Shift-8":Q.bulletList,"Mod-Shift-l":Q.alignLeft,"Mod-Shift-e":Q.alignCenter,"Mod-Shift-r":Q.alignRight,"Mod-Shift-j":Q.alignJustify,"Mod-\\":Q.clearFormatting,"Shift-Enter":K0,Enter:(t,r)=>lf(G(t).list_item)(t,r),Tab:Q.indent,"Shift-Tab":Q.outdent};return j0||(e["Mod-y"]=Sl(n,"redo")),[Fe(e),Fe(Yd)]}var j0,K0,Sl,zp=P(()=>{"use strict";zo();pt();al();Oe();j0=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),K0=yr(el,(n,e)=>(e?.(n.tr.replaceSelectionWith(G(n).hard_break.create()).scrollIntoView()),!0)),Sl=(n,e)=>(t,r,o)=>n(e)(t,r,o)});function J0(n){return/data-pm-slice=/.test(n)?"nova":/<google-sheets-html-origin|data-sheets-(root|value)/i.test(n)?"google-sheets":/id="docs-internal-guid-/.test(n)?"google-docs":/urn:schemas-microsoft-com:office:excel|ProgId"?\s+content="?Excel\.Sheet/i.test(n)?"excel":/urn:schemas-microsoft-com:office:word|class="?Mso|mso-list:|content="?Microsoft Word/i.test(n)?"word":/class="[^"]*\b(TextRun|OutlineElement|EOP|SCXW\d+|BCX\d+)\b|data-ccp-props|paraid=/.test(n)?"word-online":/content="?LibreOffice|content="?OpenOffice/i.test(n)?"libreoffice":"web"}function Vp(n,e="clean"){let t=J0(n);if(t==="nova")return n;let r=document.createElement("template");r.innerHTML=n;let o=document.createElement("div");return o.append(r.content),G0(o),Y0(o),t==="word"&&o1(o),t==="google-docs"&&c1(o),l1(o),u1(o),o.querySelectorAll("[style]").forEach(i=>p1(i,e)),e==="clean"&&h1(o),m1(o),g1(o),b1(o),y1(o),t!=="web"&&o.querySelectorAll("[class]").forEach(i=>i.removeAttribute("class")),o.innerHTML}function Ml(n){let e=new Map;for(let t of n.split(";")){let r=t.indexOf(":");if(r<0)continue;let o=t.slice(0,r).trim().toLowerCase(),i=t.slice(r+1).trim().replace(/\s*!important$/i,"");o&&i&&e.set(o,i)}return e}function qp(n){return[...n].map(([e,t])=>`${e}: ${t}`).join("; ")}function G0(n){let e=[...n.querySelectorAll("style")].map(o=>o.textContent??"");if(!e.length)return;let t=[],r=e.join(`
|
|
14
|
-
`).replace(/\/\*[\s\S]*?\*\//g,"").replace(/<!--|-->/g,"");for(let o of r.matchAll(/([^{}@]+)\{([^{}]*)\}/g)){let i=Ml(o[2]);for(let s of o[1].split(",")){let l=s.trim().match(/^([a-z][a-z0-9]*)?\.([\w-]+)$/i);l&&t.push({tag:(l[1]??"").toLowerCase(),cls:l[2],decls:i})}}t.length&&n.querySelectorAll("[class]").forEach(o=>{let i=o.className.split(/\s+/).filter(Boolean),s=new Map;for(let l of t)i.includes(l.cls)&&(l.tag&&l.tag!==o.tagName.toLowerCase()||l.decls.forEach((a,c)=>s.set(c,a)));s.size&&(Ml(o.getAttribute("style")??"").forEach((l,a)=>s.set(a,l)),o.setAttribute("style",qp(s)))})}function Y0(n){let e=document.createTreeWalker(n,NodeFilter.SHOW_COMMENT),t=[];for(;e.nextNode();)t.push(e.currentNode);t.forEach(r=>r.parentNode?.removeChild(r));for(let r of[...n.querySelectorAll("*")]){if(!n.contains(r))continue;let o=r.tagName.toUpperCase();if(X0.test(o)){r.remove();continue}if(o.includes(":")){let i=o.split(":")[0];i==="O"||i==="V"?r.remove():Fn(r)}}n.querySelectorAll("span.EOP").forEach(r=>{/^\s*$/.test(r.textContent??"")&&r.remove()}),n.querySelectorAll("a").forEach(r=>{let o=r.getAttribute("href")??"",i=o.match(/^https?:\/\/(www\.)?google\.[a-z.]+\/url\?(.*)$/i);if(i){let s=new URLSearchParams(i[2]).get("q");s&&r.setAttribute("href",s)}(!o||/^#_(ftn|edn|msocom|Toc|Ref)/i.test(o))&&Fn(r)}),n.querySelectorAll('br[style*="page-break"]').forEach(r=>r.remove()),n.querySelectorAll('[style*="mso-element:footnote-list"], [style*="mso-element:comment-list"], [style*="mso-element:endnote-list"]').forEach(r=>r.remove())}function Z0(n){let t=(n.getAttribute("style")??"").match(/mso-list:\s*(l\d+)\s+level(\d+)/i);if(!t)return null;let r=[...n.querySelectorAll("[style]")].find(a=>/mso-list:\s*Ignore/i.test(a.getAttribute("style")??"")),o=(r?.textContent??"").replace(/\s+/g,"");r?.remove();let i=Q0.test(o),{style:s,start:l}=i?n1(o):{style:r1(o),start:1};return{el:n,level:Math.max(1,Math.min(9,Number(t[2]))),ordered:i,start:l,style:s}}function t1(n){let e=0,t=n.toLowerCase();for(let r=0;r<t.length;r++){let o=Fp[t[r]],i=Fp[t[r+1]??""]??0;e+=o<i?-o:o}return e}function n1(n){let e=n.match(/\d+/);if(e)return{style:null,start:Number(e[0])};let t=n.replace(/[^a-z]/gi,"");return e1.test(t)?{style:t===t.toLowerCase()?"lower-roman":"upper-roman",start:t1(t)}:{style:t===t.toLowerCase()?"lower-alpha":"upper-alpha",start:t.toLowerCase().charCodeAt(0)-96}}function r1(n){return n==="o"?"circle":/^[§▪■]$/.test(n)?"square":null}function o1(n){let e=[...n.querySelectorAll("p, div, h1, h2, h3, h4, h5, h6")].filter(o=>/mso-list:\s*l\d+\s+level\d+/i.test(o.getAttribute("style")??""));for(let o of e.filter(i=>/^H[1-6]$/.test(i.tagName)))o.querySelectorAll("[style]").forEach(i=>{if(!/mso-list:\s*Ignore/i.test(i.getAttribute("style")??""))return;let s=(i.textContent??"").replace(/\s+/g,"");i.replaceWith(i.ownerDocument.createTextNode(`${s} `))});let t=e.filter(o=>!/^H[1-6]$/.test(o.tagName)),r=new Set;for(let o of t){if(r.has(o))continue;let i=[],s=o;for(;s instanceof HTMLElement&&t.includes(s);){let l=Z0(s);if(!l)break;i.push(l),r.add(s),s=Wp(s)}i.length&&i1(i)}}function Wp(n){let e=n.nextSibling;for(;e&&e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim();)e=e.nextSibling;return e instanceof Element?e:null}function i1(n){let e=n[0].el.ownerDocument,t=n[0].el,r=[],o=null;for(let i of n){for(;r.length&&r[r.length-1].level>i.level;)r.pop();let s=r[r.length-1];if(!s||s.level<i.level){let c=e.createElement(i.ordered?"ol":"ul");i.ordered&&i.start!==1&&c.setAttribute("start",String(i.start)),i.style&&(c.style.listStyleType=i.style),s?(s.list.lastElementChild??s.list.appendChild(e.createElement("li"))).appendChild(c):o=c,s={list:c,level:i.level},r.push(s)}let l=e.createElement("li"),a=e.createElement("p");for(;i.el.firstChild;)a.appendChild(i.el.firstChild);l.appendChild(a),s.list.appendChild(l)}t.replaceWith(o),n.slice(1).forEach(i=>i.el.remove())}function s1(n){let e=n.getAttribute("aria-level")??n.getAttribute("data-aria-level"),t=e?Number(e):NaN;return Number.isFinite(t)&&t>=1?Math.min(9,t):null}function l1(n){n.querySelectorAll("div").forEach(r=>{let o=r.children.length===1?r.firstElementChild:null;o&&/^(UL|OL)$/.test(o.tagName)&&!r.textContent?.replace(o.textContent??"","").trim()&&Fn(r)}),n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol").forEach(r=>{let o=r.previousElementSibling;o?.tagName==="LI"&&o.appendChild(r)});let e=[...n.querySelectorAll("ul, ol")].filter(r=>!r.parentElement?.closest("ul, ol")&&r.querySelector("li[aria-level], li[data-aria-level]")),t=new Set;for(let r of e){if(t.has(r)||!n.contains(r))continue;let o=[],i=r;for(;i&&/^(UL|OL)$/.test(i.tagName);){t.add(i),Up(i,1,o);let l=Wp(i);i!==r&&i.remove(),i=l}if(!o.length)continue;let s=r.ownerDocument.createElement("div");r.replaceWith(s),a1(o,s)}}function Up(n,e,t){for(let r of[...n.children]){if(r.tagName!=="LI")continue;let o=s1(r)??e,i=[...r.children].filter(l=>/^(UL|OL)$/.test(l.tagName));i.forEach(l=>l.remove());let s=r.ownerDocument.createElement("div");for(;r.firstChild;)s.appendChild(r.firstChild);t.push({el:s,level:o,ordered:n.tagName==="OL",start:Number(n.getAttribute("start")??1)||1}),i.forEach(l=>Up(l,o+1,t))}}function a1(n,e){let t=e.ownerDocument,r=[],o=null;for(let i of n){for(;r.length&&r[r.length-1].level>i.level;)r.pop();let s=r[r.length-1];if(!s||s.level<i.level){let a=t.createElement(i.ordered?"ol":"ul");i.ordered&&i.start!==1&&!s&&a.setAttribute("start",String(i.start)),s?(s.list.lastElementChild??s.list.appendChild(t.createElement("li"))).appendChild(a):o=a,s={list:a,level:i.level},r.push(s)}let l=t.createElement("li");for(;i.el.firstChild;)l.appendChild(i.el.firstChild);s.list.appendChild(l)}e.replaceWith(o)}function c1(n){n.querySelectorAll('[id^="docs-internal-guid-"]').forEach(Fn),n.querySelectorAll('li[role="checkbox"]').forEach(e=>{e.removeAttribute("role"),e.removeAttribute("aria-checked")})}function u1(n){n.querySelectorAll('p.MsoTitle, p[class*="Title"]').forEach(e=>{/\bMsoTitle\b|^Title$/.test(e.className)&&v1(e,"h1")}),n.querySelectorAll('div.WordSection1, div[class^="WordSection"], div.Section1').forEach(Fn)}function p1(n,e){let t=Ml(n.getAttribute("style")??""),r=new Map;t.forEach((s,l)=>{if(l.startsWith("mso-")){l==="mso-highlight"&&!$p.test(s)&&!t.has("background-color")&&r.set("background-color",s);return}if(!(l.startsWith("-webkit-")||l.startsWith("-moz-"))){if(l==="background"){let a=s.split(/\s+/)[0];/^(#[0-9a-f]{3,8}|rgba?\([^)]*\)|[a-z]+)$/i.test(a)&&!r.has("background-color")&&r.set("background-color",a);return}if(l==="text-decoration"||l==="text-decoration-line"){/underline/.test(s)?r.set("text-decoration","underline"):/line-through/.test(s)&&r.set("text-decoration","line-through");return}e==="clean"&&f1.test(l)||e==="clean"&&l==="vertical-align"&&/^(TD|TH)$/.test(n.tagName)||r.set(l,s)}});let o=r.get("color");o&&d1.test(o.trim())&&e==="clean"&&r.delete("color");let i=r.get("background-color");i&&$p.test(i.trim())&&r.delete("background-color"),r.get("font-weight")==="normal"&&n.tagName!=="B"&&r.delete("font-weight"),r.get("font-style")==="normal"&&r.delete("font-style"),r.get("text-decoration")==="none"&&r.delete("text-decoration"),r.get("vertical-align")==="baseline"&&r.delete("vertical-align"),/^(left|start)$/i.test(r.get("text-align")??"")&&r.delete("text-align"),e==="clean"&&n.closest("a")&&(r.delete("color"),r.get("text-decoration")==="underline"&&r.delete("text-decoration")),r.size?n.setAttribute("style",qp(r)):n.removeAttribute("style")}function h1(n){n.querySelectorAll("table, tr, td, th, col, colgroup").forEach(e=>{e.removeAttribute("width"),e.removeAttribute("height"),e.removeAttribute("valign")})}function m1(n){for(let e of[...n.querySelectorAll("span, font")].reverse()){if(!n.contains(e))continue;e.hasAttribute("style")||e.tagName==="FONT"&&e.hasAttribute("color")||Fn(e)}n.querySelectorAll("[class]").forEach(e=>e.removeAttribute("class")),n.querySelectorAll("[lang]").forEach(e=>e.removeAttribute("lang")),n.querySelectorAll("[dir]").forEach(e=>{/^rtl$/i.test(e.getAttribute("dir")??"")||e.removeAttribute("dir")})}function g1(n){n.querySelectorAll("br").forEach(e=>{let t=e.parentElement;if(!t||!(t===n||t.tagName==="DIV"||t.tagName==="TD"||t.tagName==="LI"))return;let r=_p(e,-1),o=_p(e,1);(r&&Cl.test(r.tagName)||o&&Cl.test(o.tagName)||!r&&!o&&t===n)&&e.remove()})}function _p(n,e){let t=e<0?n.previousSibling:n.nextSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!t.textContent?.trim();)t=e<0?t.previousSibling:t.nextSibling;return t instanceof Element?t:null}function b1(n){n.querySelectorAll("p").forEach(e=>{e.children.length===0&&/^\s*$/.test(e.textContent??"")&&(e.textContent="")})}function y1(n){n.querySelectorAll("td, th").forEach(e=>{let t=e.style.textAlign,r=[...e.children].some(i=>Cl.test(i.tagName));if(!t||r||!e.textContent?.trim())return;let o=e.ownerDocument.createElement("p");for(o.style.textAlign=t;e.firstChild;)o.appendChild(e.firstChild);e.appendChild(o),e.style.removeProperty("text-align"),e.getAttribute("style")||e.removeAttribute("style")})}function Fn(n){let e=n.parentNode;if(e){for(;n.firstChild;)e.insertBefore(n.firstChild,n);e.removeChild(n)}}function v1(n,e){let t=n.ownerDocument.createElement(e);for(let r of[...n.attributes])t.setAttribute(r.name,r.value);for(;n.firstChild;)t.appendChild(n.firstChild);return n.replaceWith(t),t}var X0,Q0,e1,Fp,d1,$p,f1,Cl,jp=P(()=>{"use strict";X0=/^(STYLE|SCRIPT|META|LINK|TITLE|XML|HEAD|NOSCRIPT|TEMPLATE)$/;Q0=/^[([]?(\d+(\.\d+)*[.)\]]?|[a-z]{1,4}[.)\]])$/i;e1=/^(i|ii|iii|iv|v|vi|vii|viii|ix|x|xi|xii)$/i,Fp={i:1,v:5,x:10};d1=/^(black|windowtext|auto|#000|#000000|rgb\(0,\s*0,\s*0\)|initial|inherit)$/i,$p=/^(transparent|white|window|auto|none|#fff|#ffffff|rgba?\(255,\s*255,\s*255(,\s*1)?\)|rgba\(\d+,\s*\d+,\s*\d+,\s*0\)|initial|inherit)$/i,f1=/^(font|font-family|font-size|line-height|margin|margin-.+|padding|padding-.+|text-indent|letter-spacing|word-spacing|white-space|height|width|min-height|border|border-.+|tab-stops|layout-grid-mode|page-break-.+|break-.+|orphans|widows|direction|unicode-bidi|font-variant.*|text-transform)$/i;Cl=/^(P|DIV|H[1-6]|UL|OL|TABLE|BLOCKQUOTE|PRE|HR)$/});function k1(n,e){let t=0;for(let r=e;r<n.length;r++){let o=n[r];if(o==="\\"){r++;continue}if(o==="{")t++;else if(o==="}"&&(t--,t===0))return r}return-1}function w1(n){let e="",t=0;for(let r=0;r<n.length;r++){let o=n[r];if(o==="\\"){t===0&&(e+=o+(n[r+1]??"")),r++;continue}o==="{"?t++:o==="}"?t--:t===0&&(e+=o)}return e}function S1(n){if(n.length%2!==0||n.length/2>x1||!/^[0-9a-f]+$/i.test(n))return null;let e="";for(let t=0;t<n.length;t+=2)e+=String.fromCharCode(parseInt(n.slice(t,t+2),16));return btoa(e)}function Kp(n){let e=[],t=0;for(;;){let r=n.indexOf("{\\pict",t);if(r<0)break;let o=k1(n,r);if(o<0)break;if(t=o+1,/\\nonshppict\s*$/.test(n.slice(Math.max(0,r-16),r)))continue;let i=w1(n.slice(r+1,o)),s=/\\pngblip(?![a-z])/.test(i)?"image/png":/\\jpegblip(?![a-z])/.test(i)?"image/jpeg":null;if(!s)continue;let l=i.replace(/\\[a-z]+-?\d* ?/gi,"").replace(/\s+/g,""),a=S1(l);if(!a)continue;let c=atob(a.slice(0,12));(s==="image/png"?c.startsWith("\x89PNG"):c.charCodeAt(0)===255&&c.charCodeAt(1)===216)&&e.push({type:s,base64:a})}return e}function Jp(n){return/<img[^>]+src=["']?file:/i.test(n)}function Gp(n,e){let t=document.createElement("template");t.innerHTML=n;let r=[...t.content.querySelectorAll("img")].filter(o=>/^file:/i.test(o.getAttribute("src")??""));return!r.length||r.length!==e.length?n:(r.forEach((o,i)=>{let s=e[i];o.setAttribute("src",`data:${s.type};base64,${s.base64}`)}),t.innerHTML)}var x1,Xp=P(()=>{"use strict";x1=20*1024*1024});function C1(n){let e=document.createElement("template");e.innerHTML=n;let t=/^(P|DIV|H[1-6]|LI|BLOCKQUOTE|PRE|TR|SECTION|ARTICLE|HEADER|FOOTER)$/,r="",o=i=>{if(i.nodeType===Node.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(!(i instanceof Element)){i.childNodes.forEach(o);return}if(/^(SCRIPT|STYLE|META|TITLE|HEAD)$/.test(i.tagName))return;if(i.tagName==="BR"){r+=`
|
|
9
|
+
`);return{dom:a,text:p,slice:e}}function $l(n,e,t,r,o){let i=o.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||r,n)}),i)return l=new D(N.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let u=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(u)l=u;else{let p=o.marks(),{schema:f}=n.state,h=Ve.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(f.text(m,p)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=uk(t),Zo&&pk(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let p=s.firstChild;for(;p&&!W(p);)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||St.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!ak.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=fk(Gp(l,+d[1],+d[2]),d[4]);else if(l=D.maxOpen(ck(l.content,o),!0),l.openStart||l.openEnd){let u=0,p=0;for(let f=l.content.firstChild;u<l.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=l.content.lastChild;p<l.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);l=Gp(l,u,p)}return n.someProp("transformPasted",u=>{l=u(l,n,r)}),l}var ak=/^(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 ck(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&Lf(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Pf(s[s.length-1],i.length));let d=Of(l,a);s.push(d),o=o.matchType(d.type),i=a}}),s)return N.from(s)}return n}function Of(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,N.from(n));return n}function Lf(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=Lf(n,e,t,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(N.from(Of(t,n,o+1))))}}function Pf(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Pf(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(N.empty,!0);return n.copy(t.append(r))}function Ol(n,e,t,r,o,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),o<r-1&&(l=Ol(l,e,t,r,o+1,i)),o>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(N.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Gp(n,e,t){return e<n.openStart&&(n=new D(Ol(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new D(Ol(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}var Rf={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Df(){return document.implementation.createHTMLDocument("title")}var Pr=null;function dk(n){let e=window.trustedTypes;if(!e)return n;if(!Pr){if(Pr=e.defaultPolicy)try{return Pr.createHTML(n)}catch{}Pr=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return Pr.createHTML(n)}function uk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Df(),r=t.body,o=/<([a-z][^>\s]+)/i.exec(n),i;if((i=o&&Rf[o[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=dk(n),i)for(let s=0;s<i.length;s++)r=r.querySelector(i[s])||r;for(let s=0;s<t.styleSheets.length;s++){let l=t.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let d=r.querySelectorAll(c.selectorText);for(let u=0;u<d.length;u++)d[u].style.cssText+=c.style.cssText}}}return r}function pk(n){let e=n.querySelectorAll(Pe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function fk(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs()||!a.createAndFill(null,o))break;try{o=N.from(a.create(r[l+1],o))}catch{break}i++,s++}return new D(o,i,s)}var Be=class n{constructor(e,t,r,o){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=o}static from(e){return e instanceof n?e:new n(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};Be.null=new Be(null,0,null,0);var Ll=class{constructor(e){this.view=e,this.range=Be.null,this.active=!1,this.synced=!1,this.suppress=!1,this.currentDocument=null,this.onSelectionChange=this.onSelectionChange.bind(this)}ensureListener(){let e=this.view.dom.ownerDocument;e!=this.currentDocument&&(this.currentDocument&&this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=e,e.addEventListener("selectionchange",this.onSelectionChange))}destroy(){this.currentDocument&&(this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=null),this.active=!1,this.range=Be.null}suppressChanges(){this.suppress=!0,setTimeout(()=>this.suppress=!1,50)}onSelectionChange(){if(this.suppress&&this.view.hasFocus())return this.sync();this.read()&&this.view.domObserver.flush(!1)}readRange(){let{view:e}=this,t=e.dom.isConnected!==!1&&e.domSelection();return t?Re&&e.root.nodeType===11&&Db(e.dom.ownerDocument)==e.dom?Be.from(hk(e,t)||t):Be.from(t):Be.null}read(){this.ensureListener();let e=Hf(this.view);if(!e){this.active=!1,this.range=Be.null;return}return this.active=!0,this.range.eq(e)?!1:(this.range=e,this.synced=!1,!0)}sync(e=!1){let{view:t}=this;t.docView&&(this.ensureListener(),t.domObserver.stopped(()=>{kk(t,t.state.selection);let r=t.state.selection;if(t.input.mouseDown||_f(t)){let{desc:o,start:i}=If(t.docView,r.from,r.to,0);t.cursorWrapper?bk(t):o instanceof Wo&&o.spec.setSelection?o.spec.setSelection(r.anchor-i,r.head-i,t.root):mk(t,e,o,i),this.synced=this.active=!0}r.visible==t.dom.classList.contains("ProseMirror-hideselection")&&(r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),yk(t))),this.range=this.readRange()}))}ignore(e=this.readRange()){this.range=Be.from(e),this.synced=!0}deactivate(){this.range=Be.null,this.active=this.synced=!1}};function hk(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return Yp(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Yp(n,t):null}function Yp(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return $o(s.node,s.offset,o,i)&&([t,r,o,i]=[o,i,t,r]),new Be(t,r,o,i)}function Vl(n,e,t=null){let r=n.state.doc;if(!e.focusNode)return null;let o=n.docView.nearestDesc(e.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Xo(e)){for(a=s;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&R.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&Pb(e.focusNode,e.focusOffset,o.dom))){let u=o.posBefore;c=new R(s==u?l:r.resolve(u))}else if(Ge&&t=="key"&&s>n.state.selection.to&&W(e.focusNode)&&e.focusOffset==e.focusNode.childNodes.length&&o&&o.posAtStart>n.state.selection.to)for(let u=e.focusNode;;u=u.parentNode){if(getComputedStyle(u).overflow!="visible"){c=K.findFrom(r.resolve(o.posAtStart),1);break}if(u==o.dom||u.nextSibling||!u.parentNode||!W(u.parentNode))break}}else{if(e instanceof n.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let u=s,p=s;for(let f=0;f<e.rangeCount;f++){let h=e.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(h.startContainer,h.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(u<0)return null;[a,s]=p==n.state.selection.anchor?[p,u]:[u,p],l=r.resolve(s)}else a=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let u=t=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=Yn(n,d,l,u)}return c}function _f(n){return n.editable?n.hasFocus():Bf(n,n.domSel.readRange())&&(!document.activeElement||document.activeElement.contains(n.dom))}function mk(n,e,t,r){let o=n.state.selection,{anchor:i,head:s}=o,l,a;Xp&&!(o instanceof F)&&(o.$from.parent.inlineContent||(l=Zp(n,o.from)),!o.empty&&!o.$from.parent.inlineContent&&(a=Zp(n,o.to)));let c=t.domFromPos(i-r,i>r?-1:1),d=s==i?c:t.domFromPos(s-r,s>r?-1:1);gk(i,s,c,d,n,e),Xp&&(l&&Qp(l),a&&Qp(a))}function If(n,e,t,r=0){for(let o=0,i=r;o<n.children.length;o++){let s=n.children[o],l=i+s.size;if(e>i&&t<l)return If(s,e,t,i+s.border);i=l}return{desc:n,start:r}}function gk(n,e,t,r,o,i){let s=!1;if((Ge||Re)&&n==e){let{node:a,offset:c}=t;if(ke(a)){if(s=!!(c&&a.nodeValue[c-1]==`
|
|
11
|
+
`),s&&c==a.nodeValue.length)for(let d=a,u;d;d=d.parentNode){if(u=d.nextSibling){u.nodeName=="BR"&&(t=r={node:u.parentNode,offset:Le(u)+1});break}let p=d.pmViewDesc;if(p&&p.node&&p.node.isBlock)break}}else{let d=a.childNodes[c-1];s=d&&(d.nodeName=="BR"||d.contentEditable=="false")}}let l=o.domSel.readRange();if(Ge&&l.focusNode&&l.focusNode!=r.node&&W(l.focusNode)){let a=l.focusNode.childNodes[l.focusOffset];a&&a.contentEditable=="false"&&(i=!0)}!(i||s&&Re)&&$o(t.node,t.offset,l.anchorNode,l.anchorOffset)&&$o(r.node,r.offset,l.focusNode,l.focusOffset)||yf(o.domSelection(),{focusNode:r.node,focusOffset:r.offset,anchorNode:t.node,anchorOffset:t.offset})}var Xp=Re||Pe&&bf<63;function Zp(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Re&&o&&o.contentEditable=="false")return kl(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return kl(o);if(i)return kl(i)}}function kl(n){return n.contentEditable="true",Re&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Qp(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function yk(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSel.readRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!_f(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function bk(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom;t.nodeName=="IMG"?e.collapse(t.parentNode,Le(t)+1):e.collapse(t,0)}function kk(n,e){if(e instanceof R){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ef(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ef(n)}function ef(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Yn(n,e,t,r){let o=n.someProp("createSelectionBetween",i=>i(n,e,t))||F.between(e,t,r);return n.someProp("adjustSelectionFromDOM",i=>{o=i(n,o)}),o}function Hf(n){if(n.editable&&!n.hasFocus())return null;let e=n.domSel.readRange();return e&&Bf(n,e)?e:null}function Bf(n,e){if(!e.anchorNode)return!1;try{return Un(n.dom,e.anchorNode)&&(n.editable||Un(n.dom,e.focusNode))}catch{return!1}}var De={},_e={},vk={touchstart:!0,touchmove:!0},Pl=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,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 xk(n){for(let e in De){let t=De[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Sk(n,r)&&(n.input.composing&&(r.type=="keydown"||r.type=="beforeinput")&&r.isComposing===!1&&$f(n,!0),!ql(n,r)&&(n.editable||!(r.type in _e))&&t(n,r))},vk[e]?{passive:!0}:void 0)}Re&&n.dom.addEventListener("input",()=>null),Rl(n)}function Qo(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function wk(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Rl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ql(n,r))})}function ql(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Sk(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Mk(n,e){!ql(n,e)&&De[e.type]&&(n.editable||!(e.type in _e))&&De[e.type](n,e)}function jt(n,e){let{input:t}=n;return t.lastKeyDispatched||n.composing?!1:(t.lastKeyDispatched=!0,typeof e=="string"&&(e=Rb(e=="Backspace"?8:13,e)),n.someProp("handleKeyDown",r=>r(n,e)))}_e.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),n.input.lastKeyDispatched=!1,!(Nt&&Pe&&t.keyCode==13)){if(Gn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(jt(n,"Enter"),n.input.lastIOSEnter=0)},200);return}t.keyCode!=229&&n.domObserver.forceFlush(!0),jt(n,t)||lk(n,t)?t.preventDefault():Qo(n,"key")}};_e.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};_e.keypress=(n,e)=>{let t=e;if(Pk(n)||!t.charCode||t.ctrlKey&&!t.altKey||je&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,o,i))&&n.dispatch(i()),t.preventDefault()}};function Hr(n){return{left:n.clientX,top:n.clientY}}function Ek(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function jl(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function Ff(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Ck(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&R.isSelectable(r)?(Ff(n,new R(t)),!0):!1}function Ak(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof R&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(R.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(Ff(n,R.create(n.state.doc,o)),!0):!1}function Tk(n,e,t,r,o){return jl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?Ak(n,t):Ck(n,t))}function Nk(n,e,t,r){return jl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function Ok(n,e,t,r){return jl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))}function tf(n,e,t){if(e==-1)return n.inlineContent?F.create(n,0,n.content.size):null;let r=n.resolve(e);for(let o=r.depth+1;o>0;o--){let i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)return F.create(n,s+1,s+1+i.content.size);if(t&&R.isSelectable(i))return R.create(n,s)}return null}var Dl=/[\w_\u00a1-\uffff]+/g;try{Dl=new RegExp("[\\p{L}\\p{N}_]+","gu")}catch{}function nf(n,e){let t=n.resolve(e),r=t.node(),o="",i=e,s=e;for(let m=t.indexAfter(),g=!1;m>0;m--){let y=r.child(m-1);if(!y.text)break;let x=i==e?e-t.posAtIndex(m-1):y.text.length,M=x;for(;M>0;M--)if(/\S/.test(y.text[M-1]))g=!0;else if(g)break;if(o=y.text.slice(M,x)+o,i-=x-M,M||i<e-50)break}for(let m=t.index(),g=!1;m<r.childCount;m++){let y=r.child(m);if(!y.text)break;let x=s==e?e-t.posAtIndex(m):0,M=x;for(;M<y.text.length;M++)if(/\S/.test(y.text[M]))g=!0;else if(g)break;if(o+=y.text.slice(x,M),s+=M-x,M<y.text.length||s>e+50)break}let l=i,a=s;if(Intl.Segmenter){for(let m of new Intl.Segmenter(void 0,{granularity:"word"}).segment(o))if(m.isWordLike){let g=m.index+i,y=g+m.segment.length;if(y<e)l=y;else if(g>e){a=g;break}else return F.create(n,g,y)}}else{Dl.lastIndex=0;for(let m;m=Dl.exec(o);){let g=m.index+i,y=g+m[0].length;if(y<e)l=y;else if(g>e){a=g;break}else return F.create(n,g,y)}}let c=o.slice(l-i,e-i),d=o.slice(e-i,a-i),u=/\S*$/.exec(c)[0].length,p=/^\S*/.exec(d)[0].length;if(u||p)return F.create(n,e-u,e+p);let f=/\s*$/.exec(c)[0].length,h=/^\s*/.exec(d)[0].length;return F.create(n,e-f,e+h)}var zf=je?"metaKey":"ctrlKey";De.mousedown=(n,e)=>{let t=e,r=Date.now();if(n.input.shiftKey=t.shiftKey,n.input.lastTouch>r-500)return!1;Ut(n);let o="singleClick";r-n.input.lastClick.time<500&&Ek(t,n.input.lastClick)&&!t[zf]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:o,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let i=n.posAtCoords(Hr(t));if(i)if(t.button==0){if(!n.hasFocus()){wf(n.dom);let l=n.root.activeElement;l&&!l.contains(n.dom)&&l.blur()}(n.input.mouseDown=new _l(n,i,t,o)).mightDrag||t.preventDefault()}else Qo(n,"pointer")};var _l=class{constructor(e,t,r,o){var i;this.view=e,this.startPos=t,this.event=r,this.type=o,this.didMove=!1,this.lastPos=-1,this.anchorRange=null,this.startDoc=e.state.doc,this.selectNode=!!r[zf],this.extend=r.shiftKey,this.anchorDoc=this.startDoc;let s=rf(e);if(this.extend){let l=e.state.selection;this.anchorRange=l instanceof R?{from:l.from,to:l.to}:{from:l.anchor,to:l.anchor};let a=l instanceof R?e.nodeDOM(l.from).getBoundingClientRect():e.coordsAtPos(l.anchor);this.anchorOffset={x:(a.left+a.right)/2-s.x,y:(a.top+a.bottom)/2-s.y}}else this.anchorOffset={x:r.clientX-s.x,y:r.clientY-s.y};if(o=="singleClick"){let{selection:l}=e.state,a,c,d=!1;if(l instanceof R&&l.from<=t.pos&&l.to>=t.pos)c=l.from,a=l.node,d=!0;else if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),c=t.inside;else{let u=e.state.doc.resolve(t.pos);a=u.parent,c=u.depth?u.before():-1}if(d||c>-1&&a.type.spec.draggable&&a.type.spec.selectable!==!1){let u=(i=e.docView.descAt(c))===null||i===void 0?void 0:i.nodeDOM;this.mightDrag={node:a,elt:u,pos:c,addAttr:!1},u&&!u.draggable&&(this.mightDrag.addAttr=!0,e.domObserver.stopped(()=>u.draggable=!0))}else this.mightDrag=Lk(e,r)}else this.mightDrag=!1;e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),this.mightDrag||this.select(this.startPos,!0)}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null),typeof this.mightDrag=="object"&&this.mightDrag.addAttr&&this.view.domObserver.stopped(()=>this.mightDrag.elt.removeAttribute("draggable"))}maybeRunHandler(e,t){return(this.type=="singleClick"?Tk:this.type=="doubleClick"?Nk:Ok)(this.view,e.pos,e.inside,t,this.selectNode)}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.startPos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Hr(e))),t&&(this.didMove||this.maybeRunHandler(t,e)||this.select(t,!0),e.preventDefault())}move(e){if(e.buttons==0){this.done();return}if(!this.didMove&&(Math.abs(this.event.x-e.clientX)>8||Math.abs(this.event.y-e.clientY)>8)&&(this.didMove=!0,this.mightDrag=!1),!this.mightDrag){let t=this.view.posAtCoords(Hr(e));t&&this.select(t,!1)}e.preventDefault()}select(e,t){if(e.pos==this.lastPos)return;this.lastPos=e.pos;let{view:r}=this,{doc:o}=r.state,i=this.type=="singleClick"?of(r,o,e):this.type=="doubleClick"?nf(o,e.pos):tf(o,e.inside,t);i&&(t&&!this.extend?this.anchorRange=i:(!t||this.extend)&&(o.eq(this.anchorDoc)||this.restoreAnchor(),this.anchorRange&&this.anchorRange.from<i.from?i=Yn(r,o.resolve(this.anchorRange.from),o.resolve(i.to)):this.anchorRange&&this.anchorRange.to>i.to&&(i=Yn(r,o.resolve(this.anchorRange.to),o.resolve(i.from)))),i.eq(r.state.selection)||r.dispatch(r.state.tr.setSelection(i).setMeta("pointer",!0).scrollIntoView()))}restoreAnchor(){let e=rf(this.view),t=this.view.posAtCoords({left:this.anchorOffset.x+e.x,top:this.anchorOffset.y+e.y});if(!t)this.anchorRange=null;else{let{doc:r}=this.view.state;this.anchorRange=this.type=="singleClick"?of(this.view,r,t):this.type=="doubleClick"?nf(r,t.pos):tf(r,t.inside,!1),this.anchorDoc=this.view.state.doc}}};function rf(n){let e=n.dom.getBoundingClientRect();return{x:e.left-n.dom.scrollLeft,y:e.top-n.dom.scrollTop}}function of(n,e,t){if(t.inside>-1){let o=e.nodeAt(t.inside);if(o.isAtom&&R.isSelectable(o))return R.create(e,t.inside)}let r=e.resolve(t.pos);return Yn(n,r,r)}function Lk(n,e){let{selection:t}=n.state;if(t.empty)return!1;let r=n.domSelection();if(!r||r.rangeCount==0)return!0;let o=r.getRangeAt(0).getClientRects();for(let i=0;i<o.length;i++){let s=o[i];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}De.touchstart=n=>{n.input.lastTouch=Date.now(),Ut(n),Qo(n,"pointer")};De.touchmove=n=>{n.input.lastTouch=Date.now(),Qo(n,"pointer")};De.contextmenu=n=>Ut(n);function Pk(n,e){return n.composing?!0:Re&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var Rk=Nt?5e3:-1;_e.compositionstart=_e.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof F&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Pe&&kf&&Dk(n)))n.markCursor=n.state.storedMarks||t.marks(),Ut(n,!0),n.markCursor=null;else if(Ut(n,!e.selection.empty),Ge&&n.domSel.active&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length)for(let{focusNode:r,focusOffset:o}=n.domSel.range;r&&W(r)&&o!=0;){let i=o<0?r.lastChild:r.childNodes[o-1];if(!i)break;if(ke(i)){let s=n.domSelection();s&&s.collapse(i,i.nodeValue.length);break}else r=i,o=-1}n.input.composing=!0}Vf(n,Rk)};function Dk(n){let{focusNode:e,focusOffset:t}=n.domSel.range;if(!e||!W(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return W(r)&&r.contentEditable=="false"}_e.compositionend=(n,e)=>{n.composing&&$f(n)};function $f(n,e=!1){n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,e?Ut(n):Vf(n,20)}function Vf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ut(n),e))}function qf(n){n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());for(let e;e=n.input.compositionNodes.pop();)e.markParentDamage()}function _k(n){let e=n.domSel.range;if(!n.domSel.active||!e.focusNode)return null;let t=mf(e.focusNode,e.focusOffset),r=gf(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Ut(n,e=!1){if(!(Nt&&n.domObserver.flushingSoon>=0)&&(n.domObserver.forceFlush(),qf(n),e||n.docView&&n.docView.damage)){let t=Vl(n,n.domSel.readRange()),r=n.state.selection;t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state)}}function Ik(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}var Br=Gn&&Ib<604;De.copy=_e.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Br?null:t.clipboardData,s=r.content(),{dom:l,text:a}=zl(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Ik(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Hk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Bk(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Fr(n,r.value,null,o,e):Fr(n,r.textContent,r.innerHTML,o,e)},50)}function Fr(n,e,t,r,o){let i=$l(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||D.empty)))return!0;if(!i)return!1;let s=Hk(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function jf(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}_e.paste=(n,e)=>{let t=e;if(n.composing&&!Nt)return;let r=Br?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Fr(n,jf(r),r.getData("text/html"),o,t)?t.preventDefault():Bk(n,t)};var Uo=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},Fk=je?"altKey":"ctrlKey";function Wf(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Fk]}De.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(Hr(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof R?o.to-1:o.to))){if(r&&typeof r.mightDrag=="object")s=R.create(n.state.doc,r.mightDrag.pos);else if(t.target&&W(t.target)){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=R.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=zl(n,l);(!t.dataTransfer.files.length||!Pe||bf>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Br?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Br||t.dataTransfer.setData("text/plain",c),n.dragging=new Uo(d,Wf(n,t),s)};De.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};_e.dragover=_e.dragenter=(n,e)=>e.preventDefault();_e.drop=(n,e)=>{try{zk(n,e,n.dragging)}finally{n.dragging=null}};function zk(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Hr(e));if(!r)return;let o=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",f=>{i=f(i,n,!1)}):i=$l(n,jf(e.dataTransfer),Br?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(t&&Wf(n,e));if(n.someProp("handleDrop",f=>f(n,e,i||D.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Ar(n.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=n.state.tr;if(s){let{node:f}=t;f?f.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=a.doc;if(d?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(u))return;let p=a.doc.resolve(c);if(d&&R.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new R(p));else{let f=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((h,m,g,y)=>f=y),a.setSelection(Yn(n,p,a.doc.resolve(f)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}De.focus=n=>{if(n.input.lastFocus=Date.now(),!n.focused&&(n.domObserver.stopped(()=>n.dom.classList.add("ProseMirror-focused")),n.focused=!0,n.domSel.read(),!n.domSel.synced)){let e=n.domSel.range;setTimeout(()=>{let t=n.domSel.readRange();t&&e.eq(t)&&n.domSel.sync()},20)}};De.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stopped(()=>n.dom.classList.remove("ProseMirror-focused")),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domSel.deactivate(),n.focused=!1)};De.beforeinput=(n,e)=>{if(Nt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||n.domObserver.pendingRecords().length||(n.dom.blur(),n.focus(),jt(n,"Backspace")))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in _e)De[n]=_e[n];function zr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}var $r=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let t=this.frag.child(this.index);if(this.off==e)return t;this.off+=t.nodeSize,this.index++}return null}},Jo=class n{constructor(e,t){this.toDOM=e,this.spec=t||hn,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new ge(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&zr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},fn=class n{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ge(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n&&zr(this.attrs,e.attrs)&&zr(this.spec,e.spec)}static is(e){return e.type instanceof n}destroy(){}},Il=class n{constructor(e,t){this.attrs=e,this.spec=t||hn}map(e,t,r,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=i.pos?null:new ge(i.pos-r,s.pos-r,this)}valid(e,t,r){let o=r.nodeAt(t.from);return!!o&&!o.isText&&t.from+o.nodeSize==t.to}eq(e){return this==e||e instanceof n&&zr(this.attrs,e.attrs)&&zr(this.spec,e.spec)}destroy(){}},ge=class n{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new n(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new n(e,e,new Jo(t,r))}static inline(e,t,r,o){return new n(e,t,new fn(r,o))}static node(e,t,r,o){return new n(e,t,new Il(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof fn}get widget(){return this.type instanceof Jo}},Wn=[],hn={},ae=class n{constructor(e,t){this.local=e.length?e:Wn,this.children=t.length?t:Wn}static create(e,t){return t.length?Yo(t,e,0,hn):Se}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from>t)break;l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length&&!(this.children[s]>=t);s+=3)if(this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==Se||e.maps.length==0?this:this.mapInner(e,t,0,0,r||hn)}mapInner(e,t,r,o,i){let s;if(this.local.length){let l=new $r(t.content);for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c,l)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}}return this.children.length?$k(this.children,s||[],e,t,r,o,i):s?new n(s.sort(Wt),Wn):Se}add(e,t){return t.length?this==Se?n.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,d;if(d=Uf(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,d,c+1):o.splice(i,0,a,a+l.nodeSize,Yo(d,l,c+1,hn)),i+=3}});let s=Kf(i?Jf(t):t,-r).sort(Wt);if(s.length){let l=new $r(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||s.splice(a--,1)}return new n(s.length?this.local.concat(s).sort(Wt):this.local,o||this.children)}remove(e){return e.length==0||this==Se?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+t,a=r[i+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Se?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new n(o,r):Se}forChild(e,t){if(this==Se)return this;if(t.isLeaf)return n.empty;let r,o,i=0,s=this.children.length/3;for(;i<s;){let c=i+s>>>1,d=c*3,u=this.children[d];if(u<e)i=c+1;else if(u>e)s=c;else{r=this.children[d+2];break}}let l=e+1,a=l+t.content.size;for(let c=0;c<this.local.length;c++){let d=this.local[c];if(d.from<a&&d.to>l&&d.type instanceof fn){let u=Math.max(l,d.from)-l,p=Math.min(a,d.to)-l;u<p&&(o||(o=[])).push(d.copy(u,p))}}if(o){let c=new n(o.sort(Wt),Wn);return r?new Go([c,r]):c}return r||Se}eq(e){if(this==e)return!0;if(!(e instanceof n)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Wl(this.localsInner(e))}localsInner(e){if(this==Se)return Wn;if(e.inlineContent||!this.local.some(fn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof fn||t.push(this.local[r]);return t}forEachSet(e){e(this)}};ae.empty=new ae([],[]);ae.removeOverlap=Wl;var Se=ae.empty,Go=class n{constructor(e){this.members=e}map(e,t){let r=this.members.map(o=>o.map(e,t,hn));return n.from(r)}forChild(e,t){if(t.isLeaf)return ae.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=Se&&(i instanceof n?r=r.concat(i.members):r.push(i))}return n.from(r)}eq(e){if(!(e instanceof n)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?Wl(r?t:t.sort(Wt)):Wn}static from(e){switch(e.length){case 0:return Se;case 1:return e[0];default:return new n(e.every(t=>t instanceof ae)?e:e.reduce((t,r)=>t.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function $k(n,e,t,r,o,i,s){let l=n.slice();for(let c=0,d=i;c<t.maps.length;c++){let u=0;t.maps[c].forEach((p,f,h,m)=>{let g=m-h-(f-p);for(let y=0;y<l.length;y+=3){let x=l[y+1];if(x<0||p>x+d-u)continue;let M=l[y]+d-u;f>=M?l[y+1]=p<=M?-2:-1:p>=d&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=t.map(n[c]+i),u=d-o;if(u<0||u>=r.content.size){a=!0;continue}let p=t.map(n[c+1]+i,-1),f=p-o,{index:h,offset:m}=r.content.findIndex(u),g=r.maybeChild(h);if(g&&m==u&&m+g.nodeSize==f){let y=l[c+2].mapInner(t,g,d+1,n[c]+i+1,s);y!=Se?(l[c]=u,l[c+1]=f,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Vk(l,n,e,t,o,i,s),d=Yo(c,r,0,s);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,p=0;u<d.children.length;u+=3){let f=d.children[u];for(;p<l.length&&l[p]<f;)p+=3;l.splice(p,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ae(e.sort(Wt),l)}function Kf(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new ge(o.from+e,o.to+e,o.type))}return t}function Vk(n,e,t,r,o,i,s){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(r,o,c);u?t.push(u):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Uf(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<r&&((o||(o=[])).push(s),n[i]=null);return o}function Jf(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Yo(n,e,t,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Uf(n,l,a+t);if(c){i=!0;let d=Yo(c,l,t+a+1,r);d!=Se&&o.push(a,a+l.nodeSize,d)}});let s=Kf(i?Jf(n):n,-t).sort(Wt);if(s.length){let l=new $r(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1))}return s.length||o.length?new ae(s,o):Se}function Wt(n,e){return n.from-e.from||n.to-e.to}function Wl(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,r.to),sf(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),sf(e,o,r.copy(i.from,r.to)));break}}}return e}function sf(n,e,t){for(;e<n.length&&Wt(t,n[e])>0;)e++;n.splice(e,0,t)}function vl(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Se&&e.push(r)}),n.cursorWrapper&&e.push(ae.create(n.state.doc,[n.cursorWrapper.deco])),Go.from(e)}function qk(n,e,t,r){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSel.range,d,u=c.anchorNode;if(u&&Un(n.dom,u)&&(d=[{node:u,offset:c.anchorOffset}],Xo(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Pe&&n.input.lastKeyCode===8)for(let y=s;y>i;y--){let x=o.childNodes[y-1],M=x.pmViewDesc;if(x.nodeName=="BR"&&!M){s=y;break}if(!M||M.size)break}let p=n.state.doc,f=n.someProp("domParser")||St.fromSchema(n.state.schema),h=p.resolve(l),m=null,g=f.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:jk(r),context:h});if(d&&d[0].pos!=null){let y=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=y),m={anchor:y+l,head:x+l}}return{doc:g,sel:m,from:l,to:a}}var jk=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(Re&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Re&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Wk=/^(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 Kk(n,e,t,r,o,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let P=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,v=Vl(n,n.domSel.range,P);if(v&&!n.state.selection.eq(v)&&n.domSel.active){if(Pe&&Nt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&jt(n,"Enter"))return;let k=n.state.tr.setSelection(v);P=="pointer"?k.setMeta("pointer",!0):P=="key"&&k.scrollIntoView(),s&&k.setMeta("composition",s),n.dispatch(k)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,d=qk(n,e,t,i),u=n.state.doc,p=u.slice(d.from,d.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Yk(p.content,d.doc.content,d.from,f,h);if(m&&n.input.domChangeCount++,(Gn&&n.input.lastIOSEnter>Date.now()-225||Nt)&&i.some(P=>W(P)&&!Wk.test(P.nodeName))&&(!m||m.endA>=m.endB)&&jt(n,"Enter")){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof F&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let P=lf(n,n.state.doc,d.sel);if(P&&!P.eq(n.state.selection)){let v=n.state.tr.setSelection(P);s&&v.setMeta("composition",s),n.dispatch(v)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof F&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to));let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),M=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((Gn&&n.input.lastIOSEnter>Date.now()-225&&(!M||i.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!M&&Gk(d.doc,g.pos,y.pos))&&jt(n,"Enter")){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&(M?m.endA>m.start&&m.endB==m.start:Jk(u,m.start,m.endA,g,y))&&jt(n,"Backspace")){Nt&&Pe&&n.domSel.suppressChanges();return}Pe&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Nt&&!M&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>jt(n,"Enter"),20));let L=m.start,O=m.endA,B=P=>{let v=P||n.state.tr.replace(L,O,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let k=lf(n,v.doc,d.sel);k&&!(Pe&&n.composing&&k.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(k.head==L||k.head==v.mapping.map(O)-1))&&v.setSelection(k)}return s&&v.setMeta("composition",s),v.scrollIntoView()},J;if(M)if(g.pos==y.pos){let P=B(n.state.tr.delete(L,O)),v=u.resolve(m.start).marksAcross(u.resolve(m.endA));v&&P.ensureMarks(v),n.dispatch(P)}else if(m.endA==m.endB&&(J=Uk(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let P=B(n.state.tr);J.type=="add"?P.addMark(L,O,J.mark):P.removeMark(L,O,J.mark),n.dispatch(P)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let P=g.parent.textBetween(g.parentOffset,y.parentOffset),v=()=>B(n.state.tr.insertText(P,L,O));n.someProp("handleTextInput",k=>k(n,L,O,P,v))||n.dispatch(v())}else n.dispatch(B());else n.dispatch(B())}function lf(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Yn(n,e.resolve(t.anchor),e.resolve(t.head))}function Uk(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(N.from(c).eq(n))return{mark:l,type:s}}function Jk(n,e,t,r,o){if(t-e<=o.pos-r.pos||xl(r,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!r.parent.inlineContent){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(xl(i,!0,!0));return!s.parent.isTextblock||s.pos>t||xl(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Gk(n,e,t){let r=0,o=0;return n.nodesBetween(e,t,(i,s)=>{i.isTextblock&&s>=e&&s<t?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-s),Math.min(i.nodeSize,t-s))):i.isLeaf)&&o++}),o==0&&r==1}function xl(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Yk(n,e,t,r,o){let i=n.findDiffStart(e,t),s=t+n.size,l=t+e.size;if(i==null)return null;let{a,b:c}=n.findDiffEnd(e,s,l);if(o=="end"){let d=Math.max(0,i-Math.min(a,c));r-=a+d-i}if(a<i&&s<l){let d=r<=i&&r>=a?i-r:0;i-=d,c=i+(c-a),a=i}else if(c<i){let d=r<=i&&r>=c?i-r:0;i-=d,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}var Xk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Hl=class{constructor(e){this.view=e,this.queue=[],this.flushingSoon=-1,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.started=!1,this.observer=new window.MutationObserver(t=>{for(let r=0;r<t.length;r++)this.queue.push(t[r]);Re&&e.composing&&t.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()})}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(e=!1){this.flushingSoon>-1?(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush(!0)):e&&this.flush(!0)}start(){this.observer.takeRecords(),this.observer.observe(this.view.dom,Xk),this.started=!0}stop(){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect(),this.started=!1}stopped(e){if(!this.started)return e();this.stop();try{return e()}finally{this.start()}}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=Kn(i))t.add(i);for(let i=e.anchorNode;i;i=Kn(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:ke(r)?r.parentNode:r}))return this.view.domSel.ignore(e),!0}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(e=!0){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]),e&&t.domSel.read();let o=!t.domSel.suppress&&!t.domSel.synced&&!!Hf(t)&&!this.ignoreSelectionChange(t.domSel.range),i=-1,s=-1,l=!1,a=[];if(t.editable)for(let d=0;d<r.length;d++){let u=this.registerMutation(r[d],a);u&&(i=i<0?u.from:Math.min(u.from,i),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(l=!0))}if(a.some(d=>d.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Pe&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of a)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&W(u);){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(Ge&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,p]=d;u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}else{let{focusNode:u}=t.domSel.range;for(let p of d){let f=p.parentNode;f&&f.nodeName=="LI"&&(!u||Qk(t,u)!=f)&&p.remove()}}}let c=null;i<0&&o&&t.domSel.active&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Xo(t.domSel.range)&&(c=Vl(t,t.domSel.range))&&c.eq(K.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,t.domSel.sync(),t.scrollToSelection()):(i>-1||o)&&(i>-1&&Zk(t),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,ev(t,a)),Kk(this.view,i,s,o,l,a),t.docView&&t.docView.damage?t.updateState(t.state):o&&t.domSel.sync())}registerMutation(e,t){var r;if(t.indexOf(e.target)>-1)return null;let o;for(let i=e.target;i&&!(o=this.view.docView.getDesc(i));i=i.parentNode);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let p=e.addedNodes[u];t.push(p),ke(p)&&(this.lastChangedTextNode=p)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return o.markDamage(4),{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling,l=i&&i.parentNode==e.target?Le(i)+1:0,a=o.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?Le(s):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return o.markDamage(!((r=o.contentDOM)===null||r===void 0)&&r.contains(e.target)?2:4),{from:a,to:d}}else return e.type=="attributes"?(o.markDamage(4),{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}):(this.lastChangedTextNode=e.target,o.markDamage(o instanceof _r&&e.target==o.nodeDOM?8:4),{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},af=new WeakMap,cf=!1;function Zk(n){if(!af.has(n)&&(af.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ge,cf)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."),cf=!0}}function Qk(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function ev(n,e){var t;let{focusNode:r,focusOffset:o}=n.domSel.range;for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||!W(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&n.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}var tv=$l,nv=Ut,Xn=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Pl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(hf),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=pf(this),uf(this),this.nodeViews=ff(this),this.docView=Vp(this.state.doc,df(this),vl(this),this.dom,this),this.domObserver=new Hl(this),this.domSel=new Ll(this),this.domObserver.start(),this.domSel.read(),xk(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(hf),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(qf(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=ff(this);ov(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Rl(this),this.editable=pf(this),uf(this);let a=vl(this),c=df(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Fb(this);s&&this.domObserver.stopped(()=>{let f=u&&Pe&&!this.composing&&!o.selection.empty&&!e.selection.empty&&rv(o.selection,e.selection);if(u){let h=Pe?this.trackWrites=this.domSel.range.focusNode:null;if(this.composing&&(this.input.compositionNode=_k(this)),i||!this.docView.update(e.doc,c,a,this,-1)){let m=this.docView.outerDeco;this.docView.destroy(),this.docView=Vp(e.doc,c,a,this.dom,this,m)}h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}this.domSel.sync(f)}),this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&zb(p)}scrollToSelection(){let e=this.domSel.range.focusNode;if(!(!e||!this.domSel.active)){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof R){let t=this.docView.domAfterPos(this.state.selection.from);W(t)&&Bp(this,t.getBoundingClientRect(),e)}else Bp(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Uo(e.slice,e.move,o<0?void 0:R.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){return this.root.activeElement==this.dom}focus(){this.editable&&wf(this.dom),this.domSel.sync()}get root(){let e=this.dom.isConnected!==!1;e||(this._root=null);let t=this._root;if(t==null&&e){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(e){return Wb(this,e)}coordsAtPos(e,t=1){return Ef(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Yb(this,t||this.state,e)}pasteHTML(e,t){return Fr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Fr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return zl(this,e)}destroy(){this.docView&&(wk(this),this.domSel.destroy(),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vl(this),this,-1),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Lb())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Mk(this,e)}domSelection(){return this.root.getSelection()}};Xn.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function df(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ge.node(0,n.state.doc.content.size,e)]}function uf(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ge.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function pf(n){return!n.someProp("editable",e=>e(n.state)===!1)}function rv(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function ff(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function ov(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function hf(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Yl={};j(Yl,{keydownHandler:()=>ti,keymap:()=>We});var Jl={};j(Jl,{base:()=>ut,keyName:()=>Ul,shift:()=>Vr});var ut={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:"'"},Vr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},iv=typeof navigator<"u"&&/Mac/.test(navigator.platform),sv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(pe=0;pe<10;pe++)ut[48+pe]=ut[96+pe]=String(pe);var pe;for(pe=1;pe<=24;pe++)ut[pe+111]="F"+pe;var pe;for(pe=65;pe<=90;pe++)ut[pe]=String.fromCharCode(pe+32),Vr[pe]=String.fromCharCode(pe);var pe;for(ei in ut)Vr.hasOwnProperty(ei)||(Vr[ei]=ut[ei]);var ei;function Ul(n){var e=iv&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||sv&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Vr:ut)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var lv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),av=typeof navigator<"u"&&/Win/.test(navigator.platform);function cv(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))lv?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function dv(n){let e=Object.create(null);for(let t in n)e[cv(t)]=n[t];return e}function Gl(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function We(n){return new z({props:{handleKeyDown:ti(n)}})}function ti(n){let e=dv(n);return function(t,r){let o=Ul(r),i,s=e[Gl(o,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Gl(o,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(av&&r.ctrlKey&&r.altKey)&&(i=ut[r.keyCode])&&i!=o){let l=e[Gl(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var ta={};j(ta,{COMMENT_ID_RE:()=>gn,COMMENT_MAX_LENGTH:()=>ni,COMMENT_NAME_MAX_LENGTH:()=>Ql,createCommentStore:()=>ea,newCommentId:()=>ri,sanitizeThread:()=>Xl});var gn=/^[A-Za-z0-9_-]{1,64}$/,ni=5e3,Ql=80;function ri(n="c"){let e=new Uint8Array(9);return globalThis.crypto.getRandomValues(e),n+Array.from(e,t=>(t%36).toString(36)).join("")}function Xl(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!gn.test(e.id))return null;let t=Array.isArray(e.comments)?e.comments.map(Gf).filter(i=>i!==null):[],r=e.resolved,o={id:e.id,createdAt:Number(e.createdAt)||0,comments:t,resolved:r&&typeof r=="object"?{by:Zl(r.by),at:Number(r.at)||0}:null};return typeof e.suggestion=="string"&&gn.test(e.suggestion)&&(o.suggestion=e.suggestion),o}function Zl(n){let e=n&&typeof n=="object"?n:{};return{id:String(e.id??"").slice(0,128),name:String(e.name??"").slice(0,80)}}function Gf(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!gn.test(e.id))return null;let t={id:e.id,author:Zl(e.author),text:String(e.text??"").slice(0,5e3),createdAt:Number(e.createdAt)||0};if(e.editedAt&&(t.editedAt=Number(e.editedAt)||0),Array.isArray(e.mentions)){let r=e.mentions.slice(0,20).map(Zl).filter(o=>/^[\w.@:+-]{1,128}$/.test(o.id)&&o.name);r.length&&(t.mentions=r)}return t}function ea(n=[],e){let t=n.map(Xl).filter(s=>s!==null),r=new Set,o=s=>{t=s,e?.(t),r.forEach(l=>l())},i=(s,l)=>o(t.map(a=>a.id===s?l(a):a));return{threads:()=>t,subscribe(s){return r.add(s),()=>r.delete(s)},createThread(s){let l=Xl(s);!l||t.some(a=>a.id===l.id)||o([...t,l])},reply(s,l){let a=Gf(l);a&&i(s,c=>({...c,comments:[...c.comments,a]}))},editComment(s,l,a){i(s,c=>({...c,comments:c.comments.map(d=>d.id===l?{...d,text:a.slice(0,5e3),editedAt:Date.now()}:d)}))},deleteComment(s,l){i(s,a=>({...a,comments:a.comments.filter(c=>c.id!==l)}))},setResolved(s,l){i(s,a=>({...a,resolved:l??null}))},deleteThread(s){o(t.filter(l=>l.id!==s))}}}var oa={};j(oa,{MENTION_ID_RE:()=>ii,default:()=>ra,findMentionUsers:()=>na,getMentions:()=>pv});var ii=/^[\w.@:+-]{1,128}$/,uv=80,oi=n=>n.replace(/^@/,"").trim().slice(0,uv);async function na(n,e,t=8){let r=await n(e);return Array.isArray(r)?r.filter(o=>o&&typeof o.id=="string"&&ii.test(o.id)&&o.name).slice(0,t).map(o=>({id:o.id,name:oi(String(o.name)),...o.description?{description:String(o.description).slice(0,120)}:{}})):[]}function pv(n){let e="view"in n?n.view.state.doc:n,t=new Map;return e.descendants(r=>{r.type.name==="mention"&&!t.has(r.attrs.id)&&t.set(r.attrs.id,{id:r.attrs.id,name:r.attrs.name})}),[...t.values()]}var ra={name:"mentions",nodes:{mention:{group:"inline",inline:!0,atom:!0,selectable:!1,attrs:{id:{},name:{default:""}},parseDOM:[{tag:"span[data-mention]",getAttrs:n=>{let e=n,t=e.getAttribute("data-mention")??"";return ii.test(t)?{id:t,name:oi(e.textContent??"")}:!1}}],toDOM:n=>["span",{"data-mention":ii.test(n.attrs.id)?n.attrs.id:null},`@${oi(String(n.attrs.name))}`],leafText:n=>`@${oi(String(n.attrs.name))}`}},load:()=>import(__novaChunk("tinymce-chunks/mentions-ui-b1bb2d15.js") )};var Qf={en:{add:"Add comment",show:"Comments",panel:"Comments",guest:"Guest",newComment:"New comment",placeholder:"Add a comment\u2026",replyPlaceholder:"Reply\u2026",comment:"Comment",reply:"Reply",cancel:"Cancel",save:"Save",edit:"Edit",remove:"Delete",resolve:"Resolve",reopen:"Reopen",deleteThread:"Delete thread",close:"Close comments",showResolved:"Show resolved",resolvedBy:"Resolved by {name}",orphan:"The commented text was deleted",empty:"No comments yet. Select text and press \u201CAdd comment\u201D ({shortcut}).",people:"People",noPeople:"No matches",edited:"edited",you:"you",count:"{count} comments"}},Yf=C.commentAdd,Xf=C.comments,si="Mod-Alt-m",pt=new Z("nova-comments"),ia=new WeakMap;function li(n){return ia.get(n)}function Zf(n){let e=new Map;return n.descendants((t,r)=>{if(t.isInline)for(let o of t.marks){if(o.type.name!=="comment")continue;let i=o.attrs.id,s=e.get(i)??[],l=s[s.length-1];l&&l.to===r?l.to=r+t.nodeSize:s.push({from:r,to:r+t.nodeSize}),e.set(i,s)}}),e}function fv(n){let{$from:e,empty:t}=n.selection;return(t?[...e.nodeBefore?.marks??[],...e.nodeAfter?.marks??[]]:e.nodeAfter?.marks??[]).filter(o=>o.type.name==="comment").map(o=>o.attrs.id)}var sa={name:"comments",toolbar:"addcomment showcomments",marks:{comment:{attrs:{id:{}},inclusive:!1,excludes:"",parseDOM:[{tag:"span[data-comment]",getAttrs:n=>{let e=n.getAttribute("data-comment")??"";return gn.test(e)?{id:e}:!1}}],toDOM:n=>["span",{"data-comment":gn.test(n.attrs.id)?n.attrs.id:null},0]}},prosemirrorPlugins:n=>{let e=null;return[We({[si]:()=>li(n)?.startComment()??!1}),new z({key:pt,state:{init:()=>({pending:null,active:null}),apply(t,r){let o=t.getMeta(pt),i=r;if(t.docChanged&&i.pending){let s=t.mapping.map(i.pending.from,1),l=t.mapping.map(i.pending.to,-1);i={...i,pending:s<l?{from:s,to:l}:null}}return o&&("pending"in o||"active"in o)&&(i={...i,...o}),i}},props:{decorations(t){let r=li(n),o=pt.getState(t),i=r?.store.threads();if(e&&e.doc===t.doc&&e.threads===i&&e.state===o)return e.set;let s=new Set((i??[]).filter(c=>!c.resolved).map(c=>c.id)),l=[];for(let[c,d]of Zf(t.doc)){if(!s.has(c))continue;let u=c===o.active?"nova-comment is-active":"nova-comment";for(let{from:p,to:f}of d)l.push(ge.inline(p,f,{class:u}))}if(o.pending){let{from:c,to:d}=o.pending;l.push(ge.inline(c,d,{class:"nova-comment is-active is-pending"}))}let a=ae.create(t.doc,l);return e={doc:t.doc,threads:i,state:o,set:a},a}},view:()=>({update(t,r){if(r.selection.eq(t.state.selection)||r.doc!==t.state.doc)return;let o=li(n);if(!o||pt.getState(t.state).pending)return;let i=new Set(o.store.threads().filter(l=>!l.resolved).map(l=>l.id)),s=fv(t.state).find(l=>i.has(l));s&&(s!==o.active()||!o.isPanelOpen())&&queueMicrotask(()=>{o.setActive(s),o.openPanel()})}})})]},setup(n){let e=Oe(n,"comments",Qf),t=n.options.pluginOptions?.comments??{},r=t.store??ea(t.threads??[],t.onChange),o={id:String(t.author?.id??"guest").slice(0,128),name:String(t.author?.name||e.guest).slice(0,80)},i=()=>n.schema.marks.comment,s=t.mentions??n.options.pluginOptions?.mentions?.fetch,l=(M,L=[])=>[...new Map(L.map(B=>[B.id,B])).values()].filter(B=>M.includes(`@${B.name}`)),a=(M,L)=>{let O=l(M,L);return{id:ri(),author:o,text:M,createdAt:Date.now(),...O.length?{mentions:O}:{}}},c=(M,L)=>{L.mentions?.length&&t.onMention?.({threadId:M,comment:L,users:L.mentions})},d=()=>pt.getState(n.view.state),u=M=>n.view.dispatch(n.view.state.tr.setMeta(pt,M)),p=null,f=!1;n.ui.registry.addSidebar("comments",{title:e.panel,button:!1,header:!1,render:async M=>{let{createCommentsPanel:L}=await import(__novaChunk("tinymce-chunks/comments-panel-152e9cbe.js") );return p=L(h),M.append(p.el),()=>p?.destroy()},onShow:()=>{f=!0,p&&(p.el.hidden=!1),n.root.classList.add("nova-comments-open"),p?.render()},onHide:()=>{f=!1,p&&(p.el.hidden=!0),n.root.classList.remove("nova-comments-open"),d().pending&&u({pending:null})}});let h={editor:n,store:r,author:o,labels:e,shortcut:si,pending:()=>d().pending,active:()=>d().active,setActive(M,L=!1){d().active!==M&&u({active:M}),p?.render();let O=M?h.ranges(M)[0]:void 0;if(L&&O){let{node:B}=n.view.domAtPos(O.from);(B instanceof Element?B:B.parentElement)?.scrollIntoView({block:"nearest"})}},startComment(){let{selection:M}=n.view.state;return M.empty||!n.isEditable()?!1:(u({pending:{from:M.from,to:M.to},active:null}),h.openPanel().then(()=>{p?.render(),p?.focusComposer()}),!0)},cancelPending(){u({pending:null}),p?.render(),n.focus()},findUsers:s?M=>na(s,M):null,submitPending(M,L){let O=d().pending,B=M.trim().slice(0,5e3);if(!O||!B)return null;let J=ri("t"),P=a(B,L);r.createThread({id:J,createdAt:P.createdAt,comments:[P],resolved:null});let{state:v}=n.view;return n.view.dispatch(v.tr.addMark(O.from,O.to,i().create({id:J})).setMeta(pt,{pending:null,active:J}).setMeta("addToHistory",!1)),p?.render(),c(J,P),J},reply(M,L,O){let B=L.trim().slice(0,5e3);if(!B)return;let J=a(B,O);r.reply(M,J),c(M,J)},ranges:M=>Zf(n.view.state.doc).get(M)??[],quote(M){let{doc:L}=n.view.state;return h.ranges(M).map(({from:O,to:B})=>L.textBetween(O,B," ")).join(" \u2026 ")},positionOf:M=>h.ranges(M)[0]?.from??Number.MAX_SAFE_INTEGER,deleteThread(M){let{state:L}=n.view,O=L.tr;for(let{from:B,to:J}of h.ranges(M))O.removeMark(B,J,i().create({id:M}));d().active===M&&O.setMeta(pt,{active:null}),(O.docChanged||O.getMeta(pt))&&n.view.dispatch(O.setMeta("addToHistory",!1)),r.deleteThread(M)},setResolved(M,L){r.setResolved(M,L?{by:o,at:Date.now()}:null),L&&d().active===M&&u({active:null})},canEdit:M=>t.canEdit?t.canEdit(M,o):M.author.id===o.id,isPanelOpen:()=>f,openPanel:()=>n.ui.sidebar.show("comments"),closePanel(){f&&(n.ui.sidebar.hide({restoreFocus:!1}),n.focus())}};ia.set(n,h);let m=r.subscribe(()=>{n.view.isDestroyed||(u({refresh:!0}),p?.render())}),g=()=>h.startComment(),y=()=>h.isPanelOpen()?h.closePanel():void h.openPanel(),x=M=>M.isEditable()&&!M.view.state.selection.empty;return n.ui.registry.addButton("addcomment",{icon:Yf,tooltip:e.add,shortcut:si,isEnabled:x,onAction:g}),n.ui.registry.addToggleButton("showcomments",{icon:Xf,tooltip:e.show,isActive:()=>f,onAction:y}),n.ui.registry.addMenuItem("addcomment",{text:e.add,icon:Yf,shortcut:si,isEnabled:x,onAction:g}),n.ui.registry.addMenuItem("showcomments",{text:e.show,icon:Xf,isActive:()=>f,onAction:y}),()=>{m(),ia.delete(n)}}};var da={};j(da,{LABELS:()=>th,default:()=>ca,flatList:()=>rh,isGroup:()=>nh,optionsOf:()=>ai});var th={en:{insert:"Insert variable",search:"Variables",empty:"No variables found",unknown:"Unknown variable"}},eh=/^[\w.:-]{1,100}$/,hv=/^data-[a-z0-9-]{1,40}$/;function ai(n){return n.options.pluginOptions?.mergetags??{}}function mv(n){let e=ai(n).attribute??"data-mergetag";return hv.test(e)?e:(console.warn(`[nova] mergetags: attribute "${e}" must look like data-name; using data-mergetag`),"data-mergetag")}var nh=n=>Array.isArray(n.items);function rh(n){return(ai(n).list??[]).flatMap(e=>nh(e)?e.items:[e])}function oh(n,e){return rh(n).find(t=>t.key===e)?.label}function gv(n){let e=mv(n);return{mergetag:{group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!0,ignoreStyles:!0,attrs:{key:{},label:{default:""}},parseDOM:[{tag:`span[${e}]`,priority:60,getAttrs:t=>{let r=t,o=r.getAttribute(e)??"";return eh.test(o)?{key:o,label:oh(n,o)??r.textContent?.trim()??o}:!1}}],toDOM:t=>{let r=eh.test(t.attrs.key)?t.attrs.key:"",o=t.attrs.label==null||t.attrs.label===""?r:String(t.attrs.label);return["span",{[e]:r,contenteditable:"false"},o]}}}}var aa=class{constructor(e,t,r){S(this,"node",e);S(this,"editor",t);S(this,"unknownTitle",r);S(this,"dom");this.dom=document.createElement("span"),this.dom.className="nova-mergetag",this.dom.contentEditable="false",this.render()}render(){let e=this.node.attrs.key,t=oh(this.editor,e);this.dom.textContent=t??(this.node.attrs.label||e),this.dom.dataset.key=e;let o=!!ai(this.editor).list?.length&&t===void 0;this.dom.classList.toggle("is-unknown",o),this.dom.title=o?`${this.unknownTitle}: ${e}`:e}update(e){return e.type!==this.node.type?!1:(this.node=e,this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(){return!1}ignoreMutation(){return!0}},ca={name:"mergetags",toolbar:"mergetags",nodes:gv,prosemirrorPlugins:n=>{let e=Oe(n,"mergetags",th);return[new z({props:{nodeViews:{mergetag:(t,r)=>new aa(t,n,e.unknown)}}})]},load:()=>import(__novaChunk("tinymce-chunks/mergetags-ui-f5bdd1f9.js") )};var Ea={};j(Ea,{LABELS:()=>ga,OWN:()=>yi,RESOLVED:()=>yh,around:()=>gi,attrValue:()=>ka,blockSuggestion:()=>Ee,cleanFormat:()=>jr,default:()=>Ma,formatMarks:()=>bi,hasInline:()=>fi,isSuggesting:()=>xa,listSuggestions:()=>Sa,markup:()=>ba,resolveSuggestions:()=>Sh,setStructureTrackers:()=>Cv,setSuggesting:()=>Eh,suggestTransaction:()=>wh,suggestionColor:()=>bh,suggestionsKey:()=>Qn,suggestionsResult:()=>Fv});var fa={};j(fa,{addListNodes:()=>vv,bulletList:()=>sh,liftListItem:()=>yn,listItem:()=>lh,orderedList:()=>ih,sinkListItem:()=>di,splitListItem:()=>ci,splitListItemKeepMarks:()=>wv,wrapInList:()=>pa,wrapRangeInList:()=>ah});var yv=["ol",0],bv=["ul",0],kv=["li",0],ih={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs(n){return{order:n.hasAttribute("start")?+n.getAttribute("start"):1}}}],toDOM(n){return n.attrs.order==1?yv:["ol",{start:n.attrs.order},0]}},sh={parseDOM:[{tag:"ul"}],toDOM(){return bv}},lh={parseDOM:[{tag:"li"}],toDOM(){return kv},defining:!0};function ua(n,e){let t={};for(let r in n)t[r]=n[r];for(let r in e)t[r]=e[r];return t}function vv(n,e,t){return n.append({ordered_list:ua(ih,{content:"list_item+",group:t}),bullet_list:ua(sh,{content:"list_item+",group:t}),list_item:ua(lh,{content:e})})}function pa(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i);if(!s)return!1;let l=r?t.tr:null;return ah(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function ah(n,e,t,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Bt(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Bt(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=sn(i,t,r,e);return l?(n&&xv(n,e,l,o,t),!0):!1}function xv(n,e,t,r,o){let i=N.empty;for(let d=t.length-1;d>=0;d--)i=N.from(t[d].type.create(t[d].attrs,i));n.step(new re(e.start-(r?2:0),e.end,e.start,e.end,new D(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==o&&(s=d+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,p=!0;d<u;d++,p=!1)!p&&l&&Et(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Zn(n,e){return n instanceof it?e==n:n.indexOf(e)>-1}function ci(n,e){return function(t,r){let{$from:o,$to:i,node:s}=t.selection;if(s&&s.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(!Zn(n,l.type))return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||!Zn(n,o.node(-3).type)||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let u=N.empty,p=o.index(-1)?1:o.index(-2)?2:3;for(let y=o.depth-p;y>=o.depth-3;y--)u=N.from(o.node(y).copy(u));let f=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;u=u.append(N.from(o.node(-3).type.createAndFill()));let h=o.before(o.depth-(p-1)),m=t.tr.replace(h,o.after(-f),new D(u,4-p,0)),g=-1;m.doc.nodesBetween(h,m.doc.content.size,(y,x)=>{if(g>-1)return!1;y.isTextblock&&y.content.size==0&&(g=x+1)}),g>-1&&m.setSelection(K.near(m.doc.resolve(g))),r(m.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,i.pos),d=a||e?[e?{type:l.type,attrs:e}:null,a?{type:a}:null]:void 0;return Et(c.doc,o.pos,2,d)?(r&&r(c.split(o.pos,2,d).scrollIntoView()),!0):!1}}function wv(n,e){let t=ci(n,e);return(r,o)=>t(r,o&&(i=>{let s=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();s&&i.ensureMarks(s),o(i)}))}function yn(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&Zn(n,s.firstChild.type));return i?t?Zn(n,r.node(i.depth-1).type)?Sv(e,t,i):Mv(e,t,i):!0:!1}}function Sv(n,e,t){let r=n.tr,o=t.end,i=t.$to.end(t.depth),s=t.parent.child(t.endIndex-1).type;o<i&&(r.step(new re(o-1,i,o,i,new D(N.from(s.create(null,t.parent.copy())),1,0),1,!0)),t=new Bt(r.doc.resolve(t.$from.pos),r.doc.resolve(i),t.depth));let l=lt(t);if(l==null)return!1;r.lift(t,l);let a=r.doc.resolve(r.mapping.map(o,-1)-1);return at(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function Mv(n,e,t){let r=n.tr,o=t.parent;for(let f=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)f-=o.child(h).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?N.empty:N.from(o))))return!1;let u=i.pos,p=u+s.nodeSize;return r.step(new re(u-(l?1:0),p+(a?1:0),u+1,p-1,new D((l?N.empty:N.from(o.copy(N.empty))).append(a?N.empty:N.from(o.copy(N.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function di(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&Zn(n,c.firstChild.type));if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(!Zn(n,a.type))return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=N.from(c?a.lastChild.lastChild.type.create():null),u=new D(N.from(a.type.create(null,N.from(l.type.create(null,d)))),c?3:1,0),p=i.start,f=i.end;t(e.tr.step(new re(p-(c?3:1),f,p,f,u,1,!0)).scrollIntoView())}return!0}}var ui="nova:set-content";var qr=/^[A-Za-z0-9_-]{1,64}$/,tr=/^[\w.@:+-]{1,128}$/,ga={en:{toggle:"Suggest edits",review:"Review suggestions",accept:"Accept",reject:"Reject",acceptAll:"Accept all suggestions",rejectAll:"Reject all suggestions",next:"Next suggestion",previous:"Previous suggestion",inserted:"Inserted by {name}",deleted:"Deleted by {name}",formatted:"Formatted by {name}",toolbar:"Suggestion",guest:"Guest",none:"No suggestions",unsupported:"This change can\u2019t be a suggestion",unsupportedDirect:"This change can\u2019t be a suggestion. To make it, turn off Suggest edits."}},Qn=new Z("nova-suggestions"),yi="nova-suggestions-own",yh="nova-suggestions-resolved",ch=["#116329","#6639ba","#99286e","#0550ae","#953800","#0e5b5e"];function bh(n){let e=0;for(let t of String(n??""))e=e*31+t.charCodeAt(0)|0;return ch[Math.abs(e)%ch.length]}function pi(){let n=new Uint8Array(9);return globalThis.crypto.getRandomValues(n),"s"+Array.from(n,e=>(e%36).toString(36)).join("")}function dh(n){let e=n==="insert"?"ins":"del";return{attrs:{id:{},author:{default:""},name:{default:""},time:{default:0}},inclusive:!1,excludes:"",parseDOM:[{tag:`${e}[data-suggestion]`,priority:60,getAttrs:t=>{let r=t,o=r.getAttribute("data-suggestion")??"";if(!qr.test(o))return!1;let i=r.getAttribute("data-author")??"";return{id:o,author:tr.test(i)?i:"",name:(r.getAttribute("data-name")??"").slice(0,80),time:Number(r.getAttribute("data-time"))||0}}}],toDOM:t=>[e,{"data-suggestion":qr.test(t.attrs.id)?t.attrs.id:null,"data-author":tr.test(t.attrs.author)?t.attrs.author:null,"data-name":String(t.attrs.name??"").slice(0,80)||null,"data-time":Number(t.attrs.time)||null},0]}}function jr(n){let e;try{e=typeof n=="string"?JSON.parse(n):n}catch{return"[]"}if(!Array.isArray(e))return"[]";let t=[];for(let r of e.slice(0,16)){let o=r?.type;if(typeof o!="string"||!/^[a-z][a-z0-9_]{0,39}$/.test(o))continue;let i=kh(r.attrs,8);t.push(Object.keys(i).length?{type:o,attrs:i}:{type:o})}return JSON.stringify(t)}function kh(n,e){let t={};if(n&&typeof n=="object"&&!Array.isArray(n))for(let[r,o]of Object.entries(n).slice(0,e))!/^[A-Za-z][\w-]{0,39}$/.test(r)||r==="suggestion"||(typeof o=="string"?t[r]=o.slice(0,2e3):(typeof o=="number"||typeof o=="boolean"||o===null)&&(t[r]=o));return t}function Ee(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!qr.test(e.id))return null;let t=String(e.author??""),r={id:e.id,author:tr.test(t)?t:"",name:String(e.name??"").slice(0,80),time:Number(e.time)||0};if(e.change==="split"||e.change==="join"){let i=e.change==="join"&&e.before!=null?uh(e.before):null;return{...r,change:e.change,depth:Math.min(4,Math.max(1,Math.trunc(Number(e.depth))||1)),...i?{before:i}:{}}}if(e.change==="insert"||e.change==="delete")return{...r,change:e.change};if(e.change==="wrap"||e.change==="unwrap")return{...r,change:e.change,depth:Math.min(9,Math.max(1,Math.trunc(Number(e.depth))||1))};let o=uh(e.before);return o?{...r,change:"block",before:o}:null}function uh(n){let e=n;try{typeof e=="string"&&(e=JSON.parse(e))}catch{return null}let t=e?.type;return typeof t!="string"||!/^[a-z][a-z0-9_]{0,39}$/.test(t)?null:{type:t,attrs:kh(e.attrs,12)}}var Ev={nodes:"all",default:null,parse:n=>n.hasAttribute("data-before")||n.hasAttribute("data-change")?Ee({id:n.getAttribute("data-suggestion"),author:n.getAttribute("data-author"),name:n.getAttribute("data-name"),time:n.getAttribute("data-time"),before:n.getAttribute("data-before"),change:n.getAttribute("data-change"),depth:n.getAttribute("data-depth")}):null,render(n){let e=Ee(n);if(!e)return{};let t={"data-suggestion":e.id};return e.change!=="block"&&(t["data-change"]=e.change),e.before&&(t["data-before"]=JSON.stringify(e.before)),(e.depth??1)>1&&(t["data-depth"]=String(e.depth)),e.author&&(t["data-author"]=e.author),e.name&&(t["data-name"]=e.name),e.time&&(t["data-time"]=String(e.time)),t}},hi=null;function Cv(n){hi=n}function Av(){return{attrs:{id:{},author:{default:""},name:{default:""},time:{default:0},before:{default:"[]"}},inclusive:!1,excludes:"",parseDOM:[{tag:"span[data-suggestion][data-format]",priority:60,getAttrs:n=>{let e=n,t=e.getAttribute("data-suggestion")??"";if(!qr.test(t))return!1;let r=e.getAttribute("data-author")??"";return{id:t,author:tr.test(r)?r:"",name:(e.getAttribute("data-name")??"").slice(0,80),time:Number(e.getAttribute("data-time"))||0,before:jr(e.getAttribute("data-format"))}}}],toDOM:n=>["span",{"data-suggestion":qr.test(n.attrs.id)?n.attrs.id:null,"data-format":jr(n.attrs.before),"data-author":tr.test(n.attrs.author)?n.attrs.author:null,"data-name":String(n.attrs.name??"").slice(0,80)||null,"data-time":Number(n.attrs.time)||null},0]}}var Wr=n=>({insert:n.marks.suggestion_insert,delete:n.marks.suggestion_delete,format:n.marks.suggestion_format}),wa=new Set(["suggestion_insert","suggestion_delete","suggestion_format","comment"]),mi=n=>n.filter(e=>!wa.has(e.type.name));function bi(n,e){let t=[];for(let r of JSON.parse(jr(e)))if(!(wa.has(r.type)||!n.marks[r.type]))try{let o=n.markFromJSON(r);o.isInSet(t)||t.push(o)}catch{}return t}var ya=(n,e)=>n.length===e.length&&n.every(t=>t.isInSet(e));function Tv(n){return!n.docChanged||n.getMeta(yi)||n.getMeta("addToHistory")===!1||n.getMeta(ui)||n.getMeta("history$")?!1:!n.getMeta("y-sync$")?.isChangeOrigin}var er=n=>!!n.type.spec.attrs&&"suggestion"in n.type.spec.attrs;function bn(n,e,t,r,o=1){return{id:e,author:t.id,name:t.name,time:r,change:n,...o>1?{depth:o}:{}}}function gi(n,e,t){let r=n.resolve(e),o={own:!1,deleted:!1};for(let i=r.depth;i>0;i--){let s=Ee(r.node(i).attrs.suggestion);s?.change==="insert"&&s.author===t&&(o.own=!0),s?.change==="delete"&&(o.deleted=!0)}return o}function fi(n){let e=!1;return n.descendants(t=>(t.isInline&&(e=!0),!e)),e}function ba(n){let e={};for(let[t,r]of Object.entries(n.attrs))t!=="suggestion"&&(r===null||["string","number","boolean"].includes(typeof r))&&(e[t]=r);return{type:n.type.name,attrs:e}}function ka(n,e,t){return e.attrs[t]??n.nodes[e.type]?.spec.attrs?.[t]?.default??null}function ph(n,e,t){return[...new Set([...Object.keys(e.attrs),...Object.keys(t.attrs)])].filter(r=>ka(n,e,r)!==ka(n,t,r))}function Nv(n,e){if(n instanceof rn)return e.nodeAt(n.pos)?n.pos:null;if(n instanceof re){let t=e.nodeAt(n.from),r=n.slice.content.firstChild;return!!t&&!!r&&!r.isLeaf&&n.slice.content.childCount===1&&n.slice.openStart===0&&n.slice.openEnd===0&&n.insert===1&&n.to===n.from+t.nodeSize&&n.gapFrom===n.from+1&&n.gapTo===n.to-1&&r.content.size===0?n.from:null}if(n instanceof le){let{from:t,to:r,slice:o}=n,i=e.nodeAt(t),s=o.content.firstChild;return i?.isLeaf&&!i.isText&&s?.isLeaf&&i.type===s.type&&r===t+i.nodeSize&&o.content.childCount===1&&o.openStart===0&&o.openEnd===0&&ya(i.marks,s.marks)&&!i.eq(s)?t:null}return null}var Ov=new Set(["colwidth"]);function Lv(n,e,t,r,o,i){let s=n.doc.nodeAt(e);if(!s||!er(s)||!er(t))return!1;let l=n.doc.type.schema,a=m=>n.setNodeMarkup(e,t.type,{...t.attrs,suggestion:m},t.marks),c=Ee(s.attrs.suggestion),d=ba(s),u=ba(t);if(s.marks.some(m=>m.type.name==="suggestion_insert"&&m.attrs.author===r.id)||(c?.change==="insert"||c?.change==="split")&&c.author===r.id||gi(n.doc,e,r.id).own||d.type===u.type&&ph(l,d,u).every(m=>Ov.has(m)))return a(s.attrs.suggestion),!0;if(c&&c.change!=="block")return!1;let f=c?.before??d,h=f.type===u.type&&ph(l,f,u).length===0;return a(h?null:{id:c?.id??o(),author:r.id,name:r.name,time:i,change:"block",before:f}),!0}function va(n,e){let t=n.doc.nodeAt(e);if(!t||t.isLeaf)return null;let r=n.steps.length,o=n.doc.type.schema.nodes.list_item;if(t.type===o&&o){let i=cn.create({doc:n.doc,selection:F.near(n.doc.resolve(e+1))}),s=!1;if(yn(o)(i,l=>{for(let a of l.steps)n.step(a);s=!0}),!s)return null}else{let i=n.doc.resolve(e+1).blockRange(n.doc.resolve(e+t.nodeSize-1)),s=i&<(i);if(s==null)return null;n.lift(i,s)}return n.mapping.slice(r).map(e+1,1)}function vh(n,e){let t=n.resolve(e);return t.depth>0&&e===t.start()?t.before():null}function fh(n,e){return[...e].sort((t,r)=>r-t).every(t=>va(n,t)!==null)}function Pv(n,e,t,r,o,i,s){let l=hi?.structure(t,n.doc);if(!l?.nodes.length)return null;let a=(h,...m)=>!!h&&h.author===o.id&&m.includes(h.change);if(l.change==="wrap"){let h=new Mt(n.doc);if(!fh(h,l.nodes)||!h.doc.eq(t))return null;for(let m of l.nodes){let g=Ee(n.doc.nodeAt(m).attrs.suggestion);if(!a(g,"insert")){if(g&&!a(g,"wrap"))return null;n.setNodeAttribute(m,"suggestion",bn("wrap",g?.id??i(),o,s,(g?.depth??0)+1))}}return n}let c=new Mt(t);if(!fh(c,l.nodes)||!c.doc.eq(n.doc))return null;let d=l.nodes.map(h=>({pos:h,node:t.nodeAt(h)})),u=({node:h})=>{let m=h.childCount===1?h.firstChild:null,g=Ee(h.attrs.suggestion)??Ee(m?.attrs.suggestion),y=!0;return m?.descendants(x=>(x.isInline&&!x.marks.some(M=>M.type.name==="suggestion_insert"&&M.attrs.author===o.id)&&(y=!1),y)),!!m?.isTextblock&&a(g,"split","insert")&&y},p=({node:h})=>a(Ee(h.attrs.suggestion),"wrap");if(d.every(h=>u(h)||p(h))){let h=n.mapping.slice(e);for(let m of d){let g=h.map(m.pos+1,1),y=vh(n.doc,g),x=y===null?null:n.doc.nodeAt(y);if(p(m)){let O=Ee(m.node.attrs.suggestion);x?.type===m.node.type&&n.setNodeAttribute(y,"suggestion",(O.depth??1)>1?bn("wrap",O.id,o,O.time,O.depth-1):null);continue}let M=n.doc.nodeAt(g),L=Ee(m.node.attrs.suggestion)??Ee(m.node.firstChild.attrs.suggestion);M?.isTextblock&&x?.type.name!=="list_item"&&n.setNodeAttribute(g,"suggestion",bn("insert",L.id,o,L.time))}return n}let f=r.tr;for(let h of n.steps.slice(0,e))f.step(h);if(!f.doc.eq(t))return null;for(let{pos:h,node:m}of d){let g=Ee(m.attrs.suggestion);if(g&&!a(g,"unwrap"))return null;f.setNodeAttribute(h,"suggestion",bn("unwrap",g?.id??i(),o,s,(g?.depth??0)+1))}return f}function Rv(n,e,t,r,o,i,s){let l=Wr(n.doc.type.schema),a=(u,p)=>r==="add"?n.addMark(u,p,o):n.removeMark(u,p,o);if(wa.has(o.type.name)||!l.format){a(e,t);return}let c=[];n.doc.nodesBetween(e,t,(u,p,f)=>{if(!u.isInline)return!0;let h=Math.max(p,e),m=Math.min(p+u.nodeSize,t);return h<m&&f?.type.allowsMarkType(o.type)&&c.push({from:h,to:m,node:u}),!1});let d=null;for(let{from:u,to:p,node:f}of c){let h=r==="add"?o.addToSet(f.marks):o.removeFromSet(f.marks);if(ya(h,f.marks)||(a(u,p),f.marks.some(x=>x.type===l.insert&&x.attrs.author===i.id)||l.delete.isInSet(f.marks)))continue;let g=f.marks.find(x=>x.type===l.format);if(g){let x=bi(n.doc.type.schema,g.attrs.before);ya(mi(h),x)&&n.removeMark(u,p,g);continue}d??(d=pi());let y=jr(mi(f.marks).map(x=>x.toJSON()));n.addMark(u,p,l.format.create({id:d,author:i.id,name:i.name,time:s,before:y}))}}function ha(n,e,t,r){let o=n.resolve(e);for(let i of[o.nodeBefore,o.nodeAfter]){let s=i?.marks.find(l=>l.type===t&&l.attrs.author===r);if(s)return s}return null}function xh(n,e,t,r,o,i){let s=[];return n.forEach((l,a,c)=>{if(l.isInline){s.push(t&&!t.allowsMarkType(e.type)?l:l.mark(e.addToSet(l.marks)));return}let d=c===0&&r>0,u=c===n.childCount-1&&o>0;if(!d&&!u&&er(l)){s.push(l.type.create({...l.attrs,suggestion:i()},l.content,l.marks));return}s.push(l.copy(xh(l.content,e,l.type,d?r-1:0,u?o-1:0,i)))}),N.from(s)}function hh(n,e,t){n.maybeStep(new le(e,e,t)).failed&&n.replace(e,e,t)}function ma(n,e,t){if(n instanceof R){let r=t(n.from),o=e.nodeAt(r);if(o&&R.isSelectable(o))return R.create(e,r)}return F.between(e.resolve(t(n.anchor)),e.resolve(t(n.head)))}function wh(n,e,t,r){if(!Tv(n))return n;let o=()=>(r?.(),e.tr),i=hi?.breaks(n,e,t);if(i)return i;let s=Wr(e.schema),l=e.tr,a=Date.now(),c=null,d=()=>c??(c=pi()),u=L=>L,p=null,f=null,h=null,m=!1,g=!1,y=!1,x=null,M=null;for(let L=0;L<n.steps.length;L++){let O=n.steps[L],B=n.docs[L];if(O instanceof Ue||O instanceof Je){if(x!==null)return o();let U=O instanceof Ue?"add":"remove";Rv(l,u(O.from),u(O.to),U,O.mark,t,a);continue}let J=Nv(O,B);if(J!==null){if(x!==null||g)return o();y=!0;let U=(n.docs[L+1]??n.doc).nodeAt(J);if(!U||!Lv(l,u(J),U,t,d,a))return o();continue}if(O instanceof re||x!==null){let U=O instanceof le&&(fi(B.slice(O.from,O.to).content)||fi(O.slice.content));if(!hi||U||!(O instanceof re||O instanceof le))return o();if(x===null){if(!l.doc.eq(B))return o();x=l.steps.length,M=l.doc}if(l.maybeStep(O).failed)return o();continue}if(!(O instanceof le))return o();m=!0;let P=O,v=l.steps.length,k=u,E=k(P.from),b=Math.max(E,k(P.to)),A=!1;if(b>E){let U=[],se=[],Ae=[];l.doc.nodesBetween(E,b,(de,he)=>{let be=Math.max(he,E),Os=Math.min(he+de.nodeSize,b);if(be>=Os)return!1;if(!de.isInline){if(he<E||he+de.nodeSize>b)return!0;let Qt=Ee(de.attrs.suggestion);return Qt?.change==="insert"&&Qt.author===t.id?(U.push({from:he,to:he+de.nodeSize}),!1):Qt?.change==="delete"?!1:!er(de)||Qt?!0:(Ae.push(he),!1)}let fu=gi(l.doc,he,t.id);return fu.deleted||(fu.own||de.marks.some(Qt=>Qt.type===s.insert&&Qt.attrs.author===t.id)?U.push({from:be,to:Os}):s.delete.isInSet(de.marks)||se.push({from:be,to:Os})),!1});let rt=null;if(se.length){let de=se[0],he=ha(l.doc,de.from,s.delete,t.id)??ha(l.doc,se[se.length-1].to,s.delete,t.id)??s.delete.create({id:pi(),author:t.id,name:t.name,time:a});for(let be of se)l.addMark(be.from,be.to,he);rt=he.attrs.id}for(let de of Ae)l.setNodeAttribute(de,"suggestion",bn("delete",rt??d(),t,a));let $e=l.doc.resolve(E),xt=l.doc.resolve(b),ot=xt.parent;if($e.parent!==ot&&$e.parent.isTextblock&&ot.isTextblock&&$e.depth===xt.depth&&xt.start()>E&&er(ot)&&!ot.attrs.suggestion&&!Ae.includes(xt.before())&&l.setNodeAttribute(xt.before(),"suggestion",{id:rt??d(),author:t.id,name:t.name,time:a,change:"join",depth:xt.depth-$e.sharedDepth(b)}),(se.length||Ae.length)&&(g=!0,y))return o();A=Ae.length>0;for(let de of U.sort((he,be)=>be.from-he.from))l.delete(de.from,de.to);let ye=l.mapping.slice(v);E=ye.map(E,1),b=ye.map(b,-1);let He=e.selection;n.steps.length===1&&P.slice.size===0&&(He.empty&&He.from===P.from&&n.selection.head===P.from&&(p=b),He instanceof R&&Ae.includes(k(He.from))&&(f=ye.map(k(He.to),1)))}let H=A&&P.slice.content.childCount===1&&!P.slice.openStart&&!!P.slice.content.firstChild.isTextblock&&!P.slice.content.firstChild.content.size;if(P.slice.size>0&&!H){let U=b;if(gi(l.doc,U,t.id).own){let ye=l.doc.resolve(U),He=ye.parent.isTextblock?Ee(ye.parent.attrs.suggestion):null;if(hh(l,U,P.slice),He?.change==="insert"&&P.slice.openEnd>0){let be=l.doc.resolve(U+P.slice.size);be.parent.isTextblock&&!be.parent.attrs.suggestion&&l.setNodeAttribute(be.before(),"suggestion",He)}n.steps.length===1&&(h={at:U,from:P.from,size:P.slice.size});let de=P.getMap().invert(),he=l.mapping.slice(v);u=be=>he.map(k(de.map(be,-1)),1);continue}if(!P.slice.openStart)for(let ye=l.doc.resolve(U).nodeAfter;ye&&s.delete.isInSet(ye.marks);)U+=ye.nodeSize,ye=l.doc.resolve(U).nodeAfter;let se=ha(l.doc,U,s.insert,t.id)??s.insert.create({id:pi(),author:t.id,name:t.name,time:a}),Ae=l.doc.resolve(U),rt=()=>bn("insert",fi(P.slice.content)?se.attrs.id:d(),t,a),$e=xh(P.slice.content,se,P.slice.openStart?null:Ae.parent.type,P.slice.openStart,P.slice.openEnd,rt);hh(l,U,new D($e,P.slice.openStart,P.slice.openEnd)),n.steps.length===1&&(h={at:U,from:P.from,size:P.slice.size});let{openStart:xt,openEnd:ot}=P.slice;if(xt>0&&xt===ot&&Ae.parent.isTextblock){let ye=l.doc.resolve(U+P.slice.size),He=ye.depth>=ot?ye.before(ye.depth-ot+1):-1,de=Ae.parentOffset===Ae.parent.content.size&&He>=0&&He+l.doc.nodeAt(He).nodeSize===U+P.slice.size+ot,he=de?He:ye.depth>0?ye.before():-1,be=he>=0?l.doc.nodeAt(he):null;ye.parent.isTextblock&&be&&er(be)&&l.setNodeAttribute(he,"suggestion",de?bn("insert",se.attrs.id,t,a):{id:se.attrs.id,author:t.id,name:t.name,time:a,change:"split",depth:ot})}}let $=P.getMap().invert(),G=l.mapping.slice(v);u=U=>G.map(k($.map(U,-1)),1)}if(x!==null){let L=Pv(l,x,M,e,t,d,a);if(!L)return o();L===l?l.setSelection(n.selection.map(l.doc,l.mapping.slice(l.steps.length))):(l=L,l.setSelection(e.selection.map(l.doc,l.mapping)))}else if(!m)l.setSelection(n.selection.map(l.doc,l.mapping.slice(l.steps.length)));else if(p!==null)l.setSelection(F.create(l.doc,p));else if(f!==null)l.setSelection(K.near(l.doc.resolve(f),1));else if(h){let{at:L,from:O,size:B}=h,{anchor:J,head:P,empty:v}=n.selection,k=E=>E>=O&&E<=O+B;if(v&&P===O+B)l.setSelection(F.create(l.doc,L+B));else if(k(J)&&k(P))l.setSelection(ma(n.selection,l.doc,E=>E-O+L));else if(v){let E=l.doc.resolve(L+B);l.setSelection(F.between(E,E))}else l.setSelection(ma(n.selection,l.doc,u))}else l.setSelection(ma(n.selection,l.doc,u));for(let L of["addToHistory","uiEvent","paste","scrollIntoView"]){let O=n.getMeta(L);O!==void 0&&l.setMeta(L,O)}return n.scrolledIntoView&&l.scrollIntoView(),l}function Dv(n,e){let t=bi(n.type.schema,e.attrs.before),r=mi(n.marks),o=r.filter(s=>!s.isInSet(t)).map(s=>s.type.name),i=t.filter(s=>!s.isInSet(r)&&!o.includes(s.type.name)).map(s=>s.type.name);return{added:o,removed:i}}var mh=(n,e)=>{for(let t of e)n.includes(t)||n.push(t)};function Sa(n){let e=Wr(n.type.schema),t=[];return n.descendants((r,o)=>{if(!r.isText){let i=Ee(r.attrs.suggestion);if(i&&t.push({id:i.id,kind:i.change,author:{id:i.author,name:i.name},time:i.time,from:o,to:o+r.nodeSize,text:r.isLeaf?r.type.spec.leafText?.(r)??"":r.textContent,node:r.type.name,...i.before?{before:i.before}:{},...i.depth?{depth:i.depth}:{}}),!r.isInline)return!0}for(let i of r.marks){let s=i.type===e.insert?"insert":i.type===e.delete?"delete":i.type===e.format?"format":null;if(!s)continue;let l=t[t.length-1],a=r.isText?r.text:r.type.spec.leafText?.(r)??"",c=s==="format"?Dv(r,i):null;l&&l.id===i.attrs.id&&l.kind===s&&l.to===o?(l.to=o+r.nodeSize,l.text+=a,c&&(mh(l.added,c.added),mh(l.removed,c.removed))):t.push({id:i.attrs.id,kind:s,author:{id:i.attrs.author,name:i.attrs.name},time:Number(i.attrs.time)||0,from:o,to:o+r.nodeSize,text:a,...c??{}})}return!1}),t}function _v(n,e,t){let r=Wr(n.doc.type.schema).format,o=[];n.doc.nodesBetween(e.from,e.to,(i,s)=>{if(!i.isInline)return!0;let l=i.marks.find(a=>a.type===r&&a.attrs.id===e.id);return l&&o.push({from:Math.max(s,e.from),to:Math.min(s+i.nodeSize,e.to),node:i,mark:l}),!1});for(let{from:i,to:s,node:l,mark:a}of o){if(t==="reject"){let c=bi(n.doc.type.schema,a.attrs.before);for(let d of mi(l.marks))d.isInSet(c)||n.removeMark(i,s,d);for(let d of c)d.isInSet(l.marks)||n.addMark(i,s,d)}n.removeMark(i,s,a)}}function Iv(n,e,t){let r=e.from,o=n.doc.nodeAt(r);if(!o)return;let i=t==="reject"?n.doc.type.schema.nodes[e.before.type]:void 0,s=n.doc.resolve(r);if(i?.spec.attrs&&"suggestion"in i.spec.attrs&&s.parent.canReplaceWith(s.index(),s.index()+1,i)&&(o.isLeaf?i.isLeaf:!i.isLeaf&&i.validContent(o.content))){let l=Object.fromEntries(Object.entries(e.before.attrs).filter(([a])=>a in i.spec.attrs));try{n.setNodeMarkup(r,i,{...o.attrs,...l,suggestion:null},o.marks);return}catch{}}n.setNodeAttribute(r,"suggestion",null)}function Hv(n,e){let t=n.doc.nodeAt(e);if(!t)return;let r=n.doc.resolve(e),o=e,i=e+t.nodeSize;for(let s=r.depth;;s--){let l=r.node(s),a=r.index(s);if(l.canReplace(a,a+1)){n.delete(o,i);return}if(s===0||l.childCount>1||l.type.spec.isolating){let c=l.type.contentMatch.defaultType?.createAndFill();c&&l.canReplace(a,a+1,N.from(c))&&n.replaceWith(o,i,c);return}o=r.before(s),i=r.after(s)}}function Sh(n,e,t){let r=Wr(n.schema),o=n.tr.setMeta(yi,!0),i=Sa(n.doc).filter(p=>!t||t.includes(p.id));o.setMeta(yh,{action:e,ids:[...new Set(i.map(p=>p.id))]});for(let p of i)p.kind==="format"&&_v(o,p,e);let s=[],l=[];for(let p of i){if(!p.node)continue;let f=e==="reject",h=p.kind==="block"?f&&"style":p.kind==="join"?f?!!p.before&&"style":"join":p.kind==="split"?f&&"join":p.kind==="insert"?f&&"remove":p.kind==="delete"?!f&&"remove":p.kind==="wrap"?f&&"lift":!f&&"lift";h?h==="remove"?s.push(p):l.push({s:p,op:h}):o.setNodeAttribute(p.from,"suggestion",null)}for(let p of[...i].sort((f,h)=>h.from-f.from))p.kind!=="insert"&&p.kind!=="delete"||p.node||(p.kind==="insert"==(e==="reject")?o.delete(p.from,p.to):o.removeMark(p.from,p.to,p.kind==="insert"?r.insert:r.delete));let a=p=>{let f=o.mapping.mapResult(p.from,1);return(f.deleted?null:o.doc.nodeAt(f.pos))?.type.name===p.node?f.pos:null};for(let p of s.sort((f,h)=>h.from-f.from)){let f=a(p);f!==null&&Hv(o,f)}let c=({s:p,op:f},h)=>{let m=a(p);if(m===null)return!0;if(f==="join"){let y=m-((p.depth??1)-1);if(!at(o.doc,y))return!1;try{o.join(y,p.depth??1)}catch{return!1}return!0}if(f==="style")return!h&&!Bv(o.doc,m,p)?!1:(Iv(o,{...p,from:m},"reject"),!0);if(va(new Mt(o.doc),m)===null)return!1;o.setNodeAttribute(m,"suggestion",null);let g=m;for(let y=0;y<(p.depth??1)&&g!==null;y++){let x=va(o,g);g=x===null?null:vh(o.doc,x)}return!0},d={join:0,style:1,lift:2},u=l.sort((p,f)=>d[p.op]-d[f.op]||f.s.from-p.s.from);for(let p=0;p>=0;)p=u.findIndex(f=>c(f,!1)),p>=0&&u.splice(p,1);for(let p of u)if(p.op==="style")c(p,!0);else{let f=a(p.s);f!==null&&o.setNodeAttribute(f,"suggestion",null)}return o}function Bv(n,e,t){let r=n.nodeAt(e),o=t.before?n.type.schema.nodes[t.before.type]:void 0;if(!r||!o)return!1;let i=n.resolve(e);return i.parent.canReplaceWith(i.index(),i.index()+1,o)&&(r.isLeaf?o.isLeaf:!o.isLeaf&&o.validContent(r.content))}function Fv(n,e){return Sh(n.view.state,e).doc}function Mh(n){let e=[];return n.forEach(t=>{let r=t.marks.filter(i=>!i.type.name.startsWith("suggestion_"));if(t.isText){e.push(t.mark(r));return}let o=t.attrs.suggestion!=null?{...t.attrs,suggestion:null}:t.attrs;e.push(t.type.create(o,Mh(t.content),r))}),N.from(e)}var gh=new WeakMap;function xa(n){return Qn.getState(n)?.enabled??!1}function Eh(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.setMeta(Qn,{enabled:e}).setMeta(yi,!0)),n.updateUI()}var Ma={name:"suggestions",toolbar:"suggestions reviewsuggestions suggestionspanel",marks:{suggestion_insert:dh("insert"),suggestion_delete:dh("delete"),suggestion_format:Av()},nodeAttributes:{suggestion:Ev},prosemirrorPlugins:n=>{let e=n.options.pluginOptions?.suggestions??{},t=null;return[new z({key:Qn,state:{init:()=>({enabled:!!(e.enabled||e.force)}),apply(r,o){let i=r.getMeta(Qn);return i?{enabled:e.force?!0:i.enabled}:o}},props:{attributes:r=>Qn.getState(r)?.enabled?{class:"nova-suggesting"}:{},transformPasted:r=>new D(Mh(r.content),r.openStart,r.openEnd),decorations(r){if(t?.doc===r.doc)return t.set;let o=Oe(n,"suggestions",ga),i=new Intl.DateTimeFormat(n.options.language??"en",{dateStyle:"medium",timeStyle:"short"}),s=ae.create(r.doc,Sa(r.doc).map(l=>(l.node?ge.node:ge.inline)(l.from,l.to,{title:(l.kind==="insert"||l.kind==="split"?o.inserted:l.kind==="delete"||l.kind==="join"?o.deleted:o.formatted).replace("{name}",l.author.name||o.guest)+(l.time?` \xB7 ${i.format(l.time)}`:""),class:l.node&&(l.kind==="insert"||l.kind==="delete")?`nova-sugg-${l.kind} nova-sugg-node`:`nova-sugg-${l.kind}`,style:`--nova-suggestion: ${bh(l.author.id||l.author.name)}`})));return t={doc:r.doc,set:s},s}}}),We({"Mod-Alt-Shift-e":()=>e.force?!1:(Eh(n,!xa(n.view.state)),!0)})]},transformTransaction(n,e,t){if(!xa(e))return n;let r=t.options.pluginOptions?.suggestions??{},o=Oe(t,"suggestions",ga),i={id:tr.test(r.author?.id??"")?r.author.id:"guest",name:String(r.author?.name||o.guest).slice(0,80)};return wh(n,e,i,()=>{let s=Date.now();s-(gh.get(t)??0)<3e3||(gh.set(t,s),t.ui.notify(r.force?o.unsupported:o.unsupportedDirect))})},load:()=>import(__novaChunk("tinymce-chunks/suggestions-ui-c5f6bad4.js") )};var Ba={};j(Ba,{default:()=>Ha,embedResolvers:()=>ux,parseMediaUrl:()=>xi});var Ia={};j(Ia,{ALIGNMENTS:()=>Jr,BULLET_STYLES:()=>Ta,CELL_VALIGN:()=>La,IMAGE_ALIGN_STYLES:()=>Oa,INDENT_STEP:()=>Da,MAX_INDENT:()=>Dh,ORDERED_STYLES:()=>Na,classAttr:()=>Ye,createSchema:()=>vi,cssValue:()=>Y,imageSize:()=>ne,indentLevel:()=>nr,preText:()=>Hh,schema:()=>Ot,tableStyle:()=>_h});function zv(n,e){if(typeof n=="string")return{};let t=n.getAttribute("data-colwidth"),r=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(s=>Number(s)):null,o=Number(n.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:r&&r.length===o?r:null};for(let[s,l]of Object.entries(e)){let a=l.getFromDOM?.(n);a!=null&&(i[s]=a)}return i}function $v(n,e){let t={};n.attrs.colspan!==1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!==1&&(t.rowspan=n.attrs.rowspan),Array.isArray(n.attrs.colwidth)&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(let[r,o]of Object.entries(e))o.setDOMAttr?.(n.attrs[r],t);return t}function Vv(n){if(n!==null&&(!Array.isArray(n)||n.some(e=>typeof e!="number")))throw new TypeError("colwidth must be null or an array of numbers")}function Ch(n){let e=n.cellAttributes,t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Vv}};for(let[o,i]of Object.entries(e))t[o]={default:i.default};let r=(o,i)=>({content:n.cellContent,attrs:t,tableRole:i,isolating:!0,parseDOM:[{tag:o,getAttrs:s=>zv(s,e)}],toDOM:s=>[o,$v(s,e),0]});return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:r("td","cell"),table_header:r("th","header_cell")}}function Jt(n){let{$head:e}=n.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole==="row")return!0;return!1}var Ca={};j(Ca,{isSafeImageUrl:()=>fe,isSafeLinkUrl:()=>Ie});var qv=new Set(["http:","https:","mailto:","tel:"]),jv=new Set(["http:","https:","blob:"]),Wv=/^data:image\/(png|jpe?g|gif|webp|avif|bmp);base64,/i;function Ah(n){if(typeof n!="string")return null;let t=n.replace(/[\u0000- \u007f-\u009f]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);return t?`${t[1].toLowerCase()}:`:null}function Ie(n){if(typeof n!="string")return!1;let e=Ah(n);return e===null||qv.has(e)}function fe(n){if(typeof n!="string")return!1;if(Wv.test(n.trim()))return!0;let e=Ah(n);return e===null||jv.has(e)}var Aa={};j(Aa,{codeLanguage:()=>kn});function kn(n){return typeof n=="string"&&/^[A-Za-z0-9_+#.-]{1,32}$/.test(n)?n:null}var Jr=["left","center","right","justify"],Kv=/^(#[0-9a-f]{3,8}|rgba?\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*(,\s*[\d.]+%?\s*)?\)|[a-z]{3,20})$/i,Uv=/^\d{1,4}(\.\d{1,3})?(px|pt|em|rem|%)$/,Jv=/^\d{1,2}(\.\d{1,3})?(px|em|%)?$/,Gv=/^[\w\s,'"-]{1,200}$/;function Yv(n){let e=n.trim().toLowerCase(),t=e.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(1|1\.0+)\s*)?\)$/);if(t)return"#"+t.slice(1,4).map(o=>Math.min(255,Number(o)).toString(16).padStart(2,"0")).join("");let r=e.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/);return r?`#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`:e}var Y={color:n=>typeof n=="string"&&Kv.test(n.trim())&&!/^(inherit|initial|unset|currentcolor|transparent|windowtext|window|auto|none)$/i.test(n.trim())?Yv(n):null,length:n=>typeof n=="string"&&Uv.test(n.trim())?n.trim():null,lineHeight:n=>typeof n=="string"&&Jv.test(n.trim())&&n.trim()!=="normal"?n.trim():null,fontFamily:n=>typeof n=="string"&&Gv.test(n.trim())?n.trim():null},Da=40,Dh=10;function nr(n){let e=Math.trunc(Number(n));return Number.isFinite(e)?Math.min(Dh,Math.max(0,e)):0}var Xv=/^(\d+(?:\.\d+)?)(px|pt|em|rem)$/,Zv={px:1,pt:4/3,em:16,rem:16};function Qv(n,e){if(n.parentElement?.tagName==="LI")return 0;let t=n.style,r=e==="rtl"?t.marginRight||t.paddingRight:t.marginLeft||t.paddingLeft,o=Xv.exec(r?.trim()??"");return o?nr(Math.round(Number(o[1])*Zv[o[2]]/Da)):0}function ex(n){let e=n.getAttribute("dir")?.toLowerCase();return e==="rtl"||e==="ltr"?e:null}function Th(n,e=!1){let t=n.style.textAlign,r=ex(n);return{align:Jr.includes(t)?t:null,lineHeight:Y.lineHeight(n.style.lineHeight),dir:r,indent:Qv(n,r??(e?"rtl":null))}}function Nh(n,e=!1){let t={};(n.dir==="rtl"||n.dir==="ltr")&&(t.dir=n.dir);let r=n.dir==="rtl"||e&&n.dir!=="ltr",o=[],i=n.align;i&&Jr.includes(i)&&o.push(`text-align: ${i};`);let s=Y.lineHeight(n.lineHeight);s&&o.push(`line-height: ${s};`);let l=nr(n.indent);return l&&o.push(`margin-${r?"right":"left"}: ${l*Da}px;`),o.length&&(t.style=o.join(" ")),t}var Oh={align:{default:null},lineHeight:{default:null},dir:{default:null},indent:{default:0}},Ta=["disc","circle","square"],Na=["decimal","lower-alpha","upper-alpha","lower-roman","upper-roman","lower-greek"],tx={1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};function Lh(n,e,t){let r=n.style.listStyleType.toLowerCase(),o=tx[n.getAttribute("type")??""]??"",i=e.includes(r)?r:e.includes(o)?o:null;return i===t?null:i}function Ph(n,e){return typeof n=="string"&&e.includes(n)?{style:`list-style-type: ${n};`}:{}}var Oa={left:"float: left; margin: 0 1em 1em 0;",right:"float: right; margin: 0 0 1em 1em;",center:"display: block; margin-left: auto; margin-right: auto;"};function Rh(n){let e=n.style.float||n.getAttribute("align");return e==="left"||e==="right"?e:n.style.display==="block"&&n.style.marginLeft==="auto"&&n.style.marginRight==="auto"?"center":null}function ne(n){if(n==null||n==="")return null;let e=String(n).trim().match(/^(\d{1,5})(px)?$/);if(!e)return null;let t=Number(e[1]);return t>=1&&t<=1e4?t:null}var La=["top","middle","bottom"];function _h(n){let e=[],t=Y.length(n.width);return t&&e.push(`width: ${t};`),n.align==="center"?e.push("margin-left: auto; margin-right: auto;"):n.align==="right"&&e.push("margin-left: auto;"),e.join(" ")}var nx=100;function rx(n){let e=Ch({tableGroup:"block",cellContent:"block+",cellAttributes:{class:{default:null,getFromDOM:t=>Gt(t,n),setDOMAttr:(t,r)=>{let o=Ye(t).class;o&&(r.class=o)}},background:{default:null,getFromDOM:t=>Y.color(t.getAttribute("data-nova-cell-bg")??t.style?.backgroundColor),setDOMAttr:(t,r)=>{let o=Y.color(t);o&&(r.style=`${r.style??""}background-color: ${o};`)}},valign:{default:null,getFromDOM:t=>{let r=t,o=(r.style.verticalAlign||r.getAttribute("valign")||"").toLowerCase();return La.includes(o)?o:null},setDOMAttr:(t,r)=>{La.includes(t)&&(r.style=`${r.style??""}vertical-align: ${t};`)}}}});e.table.attrs={width:{default:null},align:{default:null},class:{default:null}},e.table.parseDOM=[{tag:"table",getAttrs:t=>{let r=t,o=Y.length(r.style.width)??Y.length(`${r.getAttribute("width")??""}px`),i=l=>l==="auto",s=r.getAttribute("align")==="center"||i(r.style.marginLeft)&&i(r.style.marginRight)?"center":r.getAttribute("align")==="right"||i(r.style.marginLeft)?"right":null;return{width:o,align:s,class:Gt(r,n)}}}],e.table.toDOM=t=>{let r=_h(t.attrs);return["table",{...Ye(t.attrs.class),...r?{style:r}:{}},["tbody",0]]};for(let t of["table_cell","table_header"]){let r=e[t],o=r.parseDOM[0],i=o.getAttrs;o.getAttrs=l=>{let a=i(l);if(!a)return a;let c=d=>Math.min(nx,Math.max(1,Number.isFinite(d)?Math.floor(d):1));return{...a,colspan:c(a.colspan),rowspan:c(a.rowspan)}};let s=r.toDOM;r.toDOM=l=>{let a=s(l),c=l.attrs.colwidth;if(c?.every(d=>d>0)){let d=c.reduce((p,f)=>p+f,0),u=a[1].style?` ${a[1].style}`:"";a[1]={...a[1],style:`width: ${d}px;${u}`}}return a}}return e}var _a=()=>!1,Ih=/^-?[_a-zA-Z][\w-]*$/,ox=/(?:^|\s)lang(?:uage)?-(\S+)/;function ix(n){for(let e of[n.querySelector("code"),n]){if(!e)continue;let t=kn(ox.exec(e.getAttribute("class")??"")?.[1])??kn(e.getAttribute("data-language"));if(t)return t}return null}var sx=/^(?:P|DIV|H[1-6]|LI|UL|OL|DL|DT|DD|TABLE|TR|BLOCKQUOTE|PRE|SECTION|ARTICLE|HEADER|FOOTER)$/;function Hh(n){let e="",t=!1,r=i=>{i&&(t&&(e+=`
|
|
12
|
+
`),t=!1,e+=i)},o=i=>{for(let s of i.childNodes)if(s.nodeType===3)r(s.data);else if(s.nodeType===1){let l=s.tagName;l==="BR"?(t=!1,e+=`
|
|
13
|
+
`):sx.test(l)?(e&&(t||!e.endsWith(`
|
|
14
|
+
`))&&(e+=`
|
|
15
|
+
`),t=!1,o(s),t=!0):o(s)}};return o(n),e}function Bh(n){return n.getAttribute("data-type")==="taskList"||n.classList.contains("tox-checklist")||n.classList.contains("contains-task-list")}function lx(n){let e=n.parentElement;if(!e||!Bh(e))return null;let t=n.getAttribute("data-checked");if(t==="true"||t==="false")return t==="true";if(n.classList.contains("tox-checklist--checked"))return!0;let r=[...n.querySelectorAll('input[type="checkbox"]')].find(o=>o.closest("li")===n);return r?r.hasAttribute("checked"):!1}function ax(n){let e=Math.trunc(Number(n));return e>=1&&e<=6?e:1}function Gt(n,e){let t=[...n.classList].filter(r=>Ih.test(r)&&e(r));return t.length?t.join(" "):null}function Ye(n){if(typeof n!="string")return{};let e=n.split(/\s+/).filter(t=>Ih.test(t));return e.length?{class:e.join(" ")}:{}}var Kr={class:{default:null}},Fh=(n,e=!1)=>({doc:{content:"block+"},paragraph:{group:"block",content:"inline*",attrs:{...Oh,...Kr},parseDOM:[{tag:"p",getAttrs:t=>({...Th(t,e),class:Gt(t,n)})}],toDOM:t=>["p",{...Ye(t.attrs.class),...Nh(t.attrs,e)},0]},heading:{group:"block",content:"inline*",defining:!0,attrs:{level:{default:1},id:{default:null},...Oh,...Kr},parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,getAttrs:r=>({level:t,id:$n(r.getAttribute("id")),...Th(r,e),class:Gt(r,n)})})),toDOM:t=>[`h${ax(t.attrs.level)}`,{...$n(t.attrs.id)?{id:t.attrs.id}:{},...Ye(t.attrs.class),...Nh(t.attrs,e)},0]},blockquote:{group:"block",content:"block+",defining:!0,attrs:{...Kr},parseDOM:[{tag:"blockquote",getAttrs:t=>({class:Gt(t,n)})}],toDOM:t=>["blockquote",Ye(t.attrs.class),0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},code_block:{group:"block",content:"text*",marks:"",code:!0,defining:!0,attrs:{language:{default:null}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({language:ix(t)}),getContent:(t,r)=>{let o=Hh(t);return o?N.from(r.text(o)):N.empty}}],toDOM:t=>{let r=kn(t.attrs.language);return["pre",["code",r?{class:`language-${r}`}:{},0]]}},bullet_list:{group:"block",content:"list_item+",attrs:{listStyle:{default:null},checklist:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>{let r=Bh(t);return{listStyle:r?null:Lh(t,Ta,"disc"),checklist:r}}}],toDOM:t=>t.attrs.checklist===!0?["ul",{"data-type":"taskList"},0]:["ul",Ph(t.attrs.listStyle,Ta),0]},ordered_list:{group:"block",content:"list_item+",attrs:{start:{default:1},listStyle:{default:null}},parseDOM:[{tag:"ol",getAttrs:t=>{let r=t.getAttribute("start");return{start:r?Number(r):1,listStyle:Lh(t,Na,"decimal")}}}],toDOM:t=>["ol",{...t.attrs.start===1?{}:{start:t.attrs.start},...Ph(t.attrs.listStyle,Na)},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>({checked:lx(t)})}],toDOM:t=>typeof t.attrs.checked=="boolean"?["li",{"data-type":"taskItem","data-checked":String(t.attrs.checked)},0]:["li",0]},text:{group:"inline"},figure:{group:"block",content:"figure_image figcaption",draggable:!0,isolating:!0,attrs:{align:{default:null},...Kr},parseDOM:[{tag:"figure",getAttrs:t=>{let r=t,o=r.querySelector("img");return!o||!fe(o.getAttribute("src")??"")?!1:{align:Rh(r),class:Gt(r,n)}}}],toDOM:t=>{let r=ne(t.firstChild?.attrs.width),o=Oa[t.attrs.align]??"",i=`${o}${r?`${o?" ":""}width: ${r}px;`:""}`;return["figure",{...Ye(t.attrs.class),...i?{style:i}:{}},0]}},figure_image:{atom:!0,selectable:!1,attrs:{src:{default:""},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},parseDOM:[{tag:"img[src]",context:"figure/",priority:60,getAttrs:t=>{let r=t;return fe(r.getAttribute("src")??"")?{src:r.getAttribute("src"),alt:r.getAttribute("alt"),title:r.getAttribute("title"),width:ne(r.getAttribute("width")??r.style.width),height:ne(r.getAttribute("height")??r.style.height)}:!1}}],toDOM:t=>{let{alt:r,title:o}=t.attrs,i=fe(t.attrs.src)?t.attrs.src:"",s=ne(t.attrs.width),l=ne(t.attrs.height);return["img",{src:i,...r==null?{}:{alt:String(r)},...o?{title:o}:{},...s?{width:String(s)}:{},...l?{height:String(l)}:{}}]}},figcaption:{content:"inline*",parseDOM:[{tag:"figcaption",context:"figure/"}],toDOM:()=>["figcaption",0]},image:{group:"inline",inline:!0,draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},align:{default:null},...Kr},parseDOM:[{tag:"img[src]",getAttrs:t=>{let r=t;return fe(r.getAttribute("src")??"")?{src:r.getAttribute("src"),alt:r.getAttribute("alt"),title:r.getAttribute("title"),width:ne(r.getAttribute("width")??r.style.width),height:ne(r.getAttribute("height")??r.style.height),align:Rh(r),class:Gt(r,n)}:!1}}],toDOM:t=>{let{alt:r,title:o}=t.attrs,i=fe(t.attrs.src)?t.attrs.src:"",s=ne(t.attrs.width),l=ne(t.attrs.height),a=Oa[t.attrs.align];return["img",{src:i,...Ye(t.attrs.class),...r==null?{}:{alt:String(r)},...o?{title:o}:{},...s?{width:String(s)}:{},...l?{height:String(l)}:{},...a?{style:a}:{}}]}},hard_break:{group:"inline",inline:!0,selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},...rx(n)}),Pa=Fh(_a),zh=n=>({link:{attrs:{href:{},title:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{let t=e;return Ie(t.getAttribute("href")??"")?{href:t.getAttribute("href"),title:t.getAttribute("title"),target:t.getAttribute("target")}:!1}}],toDOM:e=>{let{title:t,target:r}=e.attrs;return["a",{href:Ie(e.attrs.href)?e.attrs.href:"#",...t?{title:t}:{},...r?{target:r,rel:"noopener noreferrer"}:{}},0]}},bold:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:e=>e.style?.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:()=>["strong",0]},italic:{parseDOM:[{tag:"em"},{tag:"i"},{style:"font-style=italic"}],toDOM:()=>["em",0]},underline:{parseDOM:[{tag:"u"},{style:"text-decoration=underline"}],toDOM:()=>["u",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration=line-through"}],toDOM:()=>["s",0]},code:{code:!0,parseDOM:[{tag:"code"}],toDOM:()=>["code",0]},subscript:{excludes:"superscript",parseDOM:[{tag:"sub"},{style:"vertical-align=sub"}],toDOM:()=>["sub",0]},superscript:{excludes:"subscript",parseDOM:[{tag:"sup"},{style:"vertical-align=super"}],toDOM:()=>["sup",0]},color:{attrs:{value:{}},parseDOM:[{style:"color",getAttrs:e=>Ur(Y.color(e))},{tag:"font[color]",getAttrs:e=>Ur(Y.color(e.getAttribute("color")))}],toDOM:e=>ki("color",Y.color(e.attrs.value))},background:{attrs:{value:{}},parseDOM:[{style:"background-color",getAttrs:e=>Ur(Y.color(e))},{tag:"mark",getAttrs:()=>({value:"yellow"})}],toDOM:e=>ki("background-color",Y.color(e.attrs.value))},font_family:{attrs:{value:{}},parseDOM:[{style:"font-family",getAttrs:e=>Ur(Y.fontFamily(e))}],toDOM:e=>ki("font-family",Y.fontFamily(e.attrs.value))},font_size:{attrs:{value:{}},parseDOM:[{style:"font-size",getAttrs:e=>Ur(Y.length(e))}],toDOM:e=>ki("font-size",Y.length(e.attrs.value))},span_class:{attrs:{class:{}},parseDOM:[{tag:"span[class]",consuming:!1,getAttrs:e=>{let t=Gt(e,n);return t?{class:t}:!1}}],toDOM:e=>["span",Ye(e.attrs.class),0]}}),Ra=zh(_a);function Ur(n){return n?{value:n}:!1}function ki(n,e){return e?["span",{style:`${n}: ${e};`},0]:["span",0]}var Ot=new Rn({nodes:Pa,marks:Ra});function cx(n,e,t){let r=t.toDOM;return{...t,attrs:{...t.attrs,[n]:{default:e.default}},parseDOM:t.parseDOM?.map(o=>{if(!o.tag)return o;let i=o.getAttrs;return{...o,getAttrs:s=>{let l=i?i(s):o.attrs??null;if(l===!1)return!1;let a=e.parse(s);return a==null?l:{...l,[n]:a}}}}),...r?{toDOM:o=>{let i=r(o),s=e.render(o.attrs[n]);if(!Array.isArray(i)||typeof i[0]!="string"||!Object.keys(s).length)return i;let l=i[1],a=!!l&&typeof l=="object"&&!Array.isArray(l)&&l.nodeType===void 0;return[i[0],{...a?l:{},...s},...i.slice(a?2:1)]}}:{}}}var dx=n=>/\b(inline|text)\b/.test(n.content??"");function vi(n={},e,t,r="ltr"){let o=r==="rtl",i=Object.entries(n.nodes??{}),s=Object.entries(n.marks??{}),l=Object.entries(n.attributes??{});if(!i.length&&!s.length&&!l.length&&!e&&!t&&!o)return Ot;let a=e||o?Fh(e??_a,o):Pa,c=e?zh(e):Ra,d={};t&&({nodes:a,marks:c}=t.apply({nodes:a,marks:c},d));for(let[f]of i)if(f in Pa)throw new Error(`[nova] node "${f}" already exists in the base schema`);for(let[f]of s)if(f in Ra)throw new Error(`[nova] mark "${f}" already exists in the base schema`);let u={...a,...Object.fromEntries(i)},p=(f,h,m)=>f.nodes==="all"?h!=="doc"&&h!=="text":f.nodes==="textblock"?dx(m):f.nodes.includes(h);for(let[f,h]of l)u=Object.fromEntries(Object.entries(u).map(([m,g])=>[m,p(h,m,g)&&!g.attrs?.[f]?cx(f,h,g):g]));return d.schema=new Rn({nodes:u,marks:{...c,...Object.fromEntries(s)}}),d.schema}var ux=new WeakMap,px=/^https?:\/\/(?:www\.|m\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch\?(?:[^#]*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{11})(?:[?&#]|$)/i,fx=/^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{1,12})(?:[/?#]|$)/i,hx=/^https:\/\/[^\s"'<>]+\.(?:mp4|webm|ogv|ogg)(?:\?[^\s"'<>#]*)?$/i;function xi(n){if(typeof n!="string")return null;let e=n.trim(),t=e.match(px);if(t)return{kind:"youtube",src:`https://www.youtube-nocookie.com/embed/${t[1]}`};let r=e.match(fx);return r?{kind:"vimeo",src:`https://player.vimeo.com/video/${r[1]}`}:hx.test(e)?{kind:"video",src:e}:null}function $h(n,e){let t=e?xi(e):null;return t?{...t,width:ne(n.getAttribute("width"))??560,height:ne(n.getAttribute("height"))??315,title:n.getAttribute("title")??""}:!1}function mx(n){let e=xi(n.attrs.src);if(!e)return null;let t=String(ne(n.attrs.width)??560),r=String(ne(n.attrs.height)??315);return e.kind==="video"?w("video",{src:e.src,controls:!0,width:t,height:r,preload:"metadata"}):w("iframe",{src:e.src,width:t,height:r,title:n.attrs.title||"Video",allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:!0,loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"})}var Ha={name:"media",toolbar:"media",nodes:{media:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{kind:{default:"youtube"},src:{},width:{default:560},height:{default:315},title:{default:""}},parseDOM:[{tag:"iframe[src]",getAttrs:n=>$h(n,n.getAttribute("src"))},{tag:"video",getAttrs:n=>{let e=n,t=e.getAttribute("src")??e.querySelector("source[src]")?.getAttribute("src")??null;return $h(e,t)}}],toDOM:n=>{let e=xi(n.attrs.src),t=String(ne(n.attrs.width)??560),r=String(ne(n.attrs.height)??315);return e?e.kind==="video"?["video",{src:e.src,controls:"",width:t,height:r}]:["iframe",{src:e.src,width:t,height:r,title:n.attrs.title||null,allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:"",loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"}]:["p"]}}},prosemirrorPlugins:()=>[new z({props:{nodeViews:{media:n=>{let e=mx(n);return{dom:w("div",{className:"nova-media",contenteditable:"false"},e,w("div",{className:"nova-media-overlay","aria-hidden":"true"})),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}})],load:()=>import(__novaChunk("tinymce-chunks/media-ui-de819f11.js") )};var $a={};j($a,{DEFAULT_SANDBOX:()=>qh,FIXED:()=>Lt,default:()=>za,embeddableUrl:()=>wi,pageEmbedOptions:()=>Fa,ratioOf:()=>Gr});var qh="allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation",gx=["21by9","16by9","4by3","1by1"].map(n=>({value:`nova-pageembed--${n}`})),Lt={width:350,height:260},Vh=/^[\w-]{1,60}$/,yx=/--(\d{1,3})by(\d{1,3})$/;function Fa(n){let e=n.options.pluginOptions?.pageembed??{},t=Array.isArray(e.sizes)?e.sizes.filter(o=>!!o&&typeof o.value=="string"&&Vh.test(o.value)):gx,r=e.sandbox===!1?!1:typeof e.sandbox=="string"?e.sandbox.split(/\s+/).filter(o=>/^allow-[a-z-]{1,40}$/.test(o)).join(" "):qh;return{sizes:t,inlineStyles:e.inlineStyles!==!1,className:typeof e.className=="string"&&Vh.test(e.className)?e.className:"nova-pageembed",sandbox:r,allowUrl:typeof e.allowUrl=="function"?e.allowUrl:void 0}}function Gr(n){let e=yx.exec(n);if(!e)return null;let t=Number(e[1]),r=Number(e[2]);return t>0&&r>0?[t,r]:null}function wi(n,e){if(typeof n!="string")return null;let t=n.trim();if(t.length>2e3||!/^https?:\/\/[^\s/?#]/i.test(t))return null;let r;try{r=new URL(t)}catch{return null}if(r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password)return null;try{if(e&&!e(r.href))return null}catch{return null}return t}function jh(n,e){if(typeof n=="string"&&n.trim())return n.trim().slice(0,300);try{return new URL(e).hostname}catch{return e}}function Wh(n,e){return typeof n=="string"&&e.sizes.some(t=>t.value===n)?n:""}function bx(n,e){let t=n.find(r=>e.sizes.some(o=>o.value===r));if(t)return t;for(let r of n){let o=/^(?:nova|tiny)-pageembed--/.test(r)?Gr(r):null;if(!o)continue;let i=e.sizes.find(s=>{let l=Gr(s.value);return!!l&&l[0]*o[1]===l[1]*o[0]});if(i)return i.value}return""}function kx(n,e){return n.some(t=>t===e.className||/^(?:nova|tiny)-pageembed(?:--[\w-]+)?$/.test(t)||e.sizes.some(r=>r.value===t))}function Kh(n,e,t){return{src:e,title:jh(n.attrs.title,e),sandbox:t.sandbox===!1?null:t.sandbox,allow:"fullscreen",allowfullscreen:"",loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin",frameborder:n.attrs.border===!0?"1":"0",scrolling:n.attrs.scrolling===!1?"no":null}}function vx(n){let e=Fa(n);return{pageembed:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{src:{default:""},size:{default:""},width:{default:Lt.width},height:{default:Lt.height},title:{default:""},border:{default:!1},scrolling:{default:!0}},parseDOM:[{tag:"div",priority:70,getAttrs:t=>{let r=t,o=[...r.classList];if(!kx(o,e))return!1;let i=r.querySelector("iframe"),s=wi(i?.getAttribute("src"),e.allowUrl);if(!i||!s)return!1;let l=i.getAttribute("frameborder");return{src:s,size:bx(o,e),width:ne(i.getAttribute("width"))??Lt.width,height:ne(i.getAttribute("height"))??Lt.height,title:(i.getAttribute("title")??"").trim().slice(0,300),border:l!==null&&l!=="0"&&l.toLowerCase()!=="no",scrolling:i.getAttribute("scrolling")?.toLowerCase()!=="no"}}}],toDOM:t=>{let r=wi(t.attrs.src,e.allowUrl);if(!r)return["div",{class:e.className}];let o=Kh(t,r,e),i=Wh(t.attrs.size,e);if(!i)return o.width=String(ne(t.attrs.width)??Lt.width),o.height=String(ne(t.attrs.height)??Lt.height),["div",{class:e.className},["iframe",o]];let s=e.inlineStyles?Gr(i):null;if(s){let l=Math.round(s[1]/s[0]*1e6)/1e4;return o.style=`position: absolute; top: 0; left: 0; width: 100%; height: 100%${t.attrs.border===!0?"":"; border: 0"}`,["div",{class:`${e.className} ${i}`,style:`position: relative; width: 100%; padding-top: ${l}%; overflow: hidden`},["iframe",o]]}return["div",{class:`${e.className} ${i}`},["iframe",o]]}}}}function xx(n,e){let t=w("div",{className:"nova-media nova-pageembed-view",contenteditable:"false"}),r=w("div",{className:"nova-media-overlay","aria-hidden":"true"}),o=null,i=null,s=l=>{let a=wi(l.attrs.src,e.allowUrl),c=Wh(l.attrs.size,e),d=c?Gr(c):null;if(t.classList.toggle("is-responsive",!!c),t.classList.toggle("has-border",l.attrs.border===!0),!a){o?.remove(),o=null,i=null,t.replaceChildren(w("div",{className:"nova-pageembed-missing"},typeof l.attrs.src=="string"?l.attrs.src:""),r);return}if(!o||i!==a){let u=Kh(l,a,e);o=w("iframe",{src:a,title:u.title,...u.sandbox===null?{}:{sandbox:u.sandbox},allow:"fullscreen",loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin",tabindex:"-1"}),i=a,t.replaceChildren(o,r)}o.title=jh(l.attrs.title,a),l.attrs.scrolling===!1?o.setAttribute("scrolling","no"):o.removeAttribute("scrolling"),c?(o.removeAttribute("width"),o.removeAttribute("height"),o.style.aspectRatio=d?`${d[0]} / ${d[1]}`:"16 / 9"):(o.style.aspectRatio="",o.setAttribute("width",String(ne(l.attrs.width)??Lt.width)),o.setAttribute("height",String(ne(l.attrs.height)??Lt.height)))};return s(n),{dom:t,update(l){return l.type!==n.type?!1:(n=l,s(l),!0)},ignoreMutation:()=>!0,stopEvent:()=>!1}}var za={name:"pageembed",toolbar:"pageembed",nodes:vx,prosemirrorPlugins:n=>{let e=Fa(n);return[new z({props:{nodeViews:{pageembed:t=>xx(t,e)}}})]},load:()=>import(__novaChunk("tinymce-chunks/pageembed-ui-da39f1ee.js") )};var ja={};j(ja,{default:()=>qa,seriesName:()=>Va});var wx=/^[a-z][\w-]{0,39}$/i;function Va(n){return typeof n=="string"&&wx.test(n)?n:null}var Sx={nodes:["table_cell","table_header"],default:null,parse:n=>Va(n.getAttribute("data-series")),render:n=>{let e=Va(n);return e?{"data-series":e}:{}}},qa={name:"advtable",nodeAttributes:{series:Sx},load:()=>import(__novaChunk("tinymce-chunks/advtable-ui-db2e667d.js") )};var Xa={};j(Xa,{cardFields:()=>Ga,cardHref:()=>Ua,cardImage:()=>Ja,cardText:()=>Pt,default:()=>Ya,hostOf:()=>Wa,mediaEmbedOptions:()=>Ka});var Mx=/^[\w-]{1,60}$/;function Ka(n){let e=n.options.pluginOptions?.mediaembed??{},t=Number(e.maxWidth);return{className:typeof e.className=="string"&&Mx.test(e.className)?e.className:"nova-card",inlineStyles:e.inlineStyles!==!1,maxWidth:Number.isFinite(t)&&t>=200?Math.min(2e3,Math.round(t)):650}}function Pt(n,e){return typeof n=="string"?n.replace(/\s+/g," ").trim().slice(0,e):""}function Ua(n){if(typeof n!="string")return null;let e=n.trim();return/^https?:\/\/[^\s/?#]/i.test(e)&&e.length<=2e3&&Ie(e)?e:null}function Ja(n){if(typeof n!="string")return null;let e=n.trim();return/^https?:\/\/[^\s/?#]/i.test(e)&&e.length<=2e3&&fe(e)?e:null}function Wa(n){try{return new URL(n).hostname.replace(/^www\./,"")}catch{return""}}function Ga(n){let e=Ua(n.href);return{href:e,title:Pt(n.title,300)||(e?Wa(e):""),description:Pt(n.description,500),image:Ja(n.image),site:Pt(n.site,100)||(e?Wa(e):""),author:Pt(n.author,100)}}function Ex(n){let e=Ka(n),t=[...new Set([e.className,"nova-card","ephox-summary-card"])],r=(o,i)=>o.querySelector(t.map(s=>`.${s}-${i}`).join(", "));return{link_card:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{href:{default:""},title:{default:""},description:{default:""},image:{default:""},site:{default:""},author:{default:""}},parseDOM:[{tag:"a, div",priority:70,getAttrs:o=>{let i=o;if(!t.some(c=>i.classList.contains(c)))return!1;let s=Ua(i.getAttribute("href")??i.querySelector("a[href]")?.getAttribute("href"));if(!s)return!1;let l=r(i,"thumbnail"),a=l?.getAttribute("src")??l?.querySelector("img")?.getAttribute("src")??"";return{href:s,title:Pt(r(i,"title")?.textContent,300),description:Pt(r(i,"description")?.textContent,500),image:Ja(a)??"",site:Pt(r(i,"website")?.textContent,100),author:Pt(r(i,"author")?.textContent,100)}}}],toDOM:o=>Cx(o,e)}}}var vn=(n,e)=>n.inlineStyles?e:null;function Cx(n,e){let t=Ga(n.attrs),r=e.className;if(!t.href)return["div",{class:r},t.title];let o="display: block; opacity: 0.75; font-size: 0.875em",i=[["span",{class:`${r}-title`,style:vn(e,"display: block; font-weight: 600")},t.title]];return t.description&&i.push(["span",{class:`${r}-description`,style:vn(e,o)},t.description]),i.push(["span",{class:`${r}-website`,style:vn(e,o)},t.site]),t.author&&i.push(["span",{class:`${r}-author`,style:vn(e,o)},t.author]),["a",{class:r,href:t.href,rel:"noopener noreferrer",style:vn(e,`display: flex; flex-wrap: wrap; gap: 12px; max-width: ${e.maxWidth}px; margin: 0.5em 0; padding: 12px; border: 1px solid rgb(127 127 127 / 0.35); border-radius: 8px; color: inherit; text-decoration: none; overflow: hidden`)},...t.image?[["img",{class:`${r}-thumbnail`,src:t.image,alt:"",loading:"lazy",style:vn(e,"flex: none; width: 120px; height: 90px; object-fit: cover; border-radius: 4px")}]]:[],["span",{style:vn(e,"display: block; flex: 1 1 180px; min-width: 0")},...i]]}function Ax(n,e){let t=w("div",{className:"nova-card-view",contenteditable:"false"});t.style.maxWidth=`${e.maxWidth}px`;let r=o=>{let i=Ga(o.attrs);t.replaceChildren(...i.image?[w("img",{className:"nova-card-view-image",src:i.image,alt:""})]:[],w("div",{className:"nova-card-view-text"},w("div",{className:"nova-card-view-title"},i.title),i.description?w("div",{className:"nova-card-view-description"},i.description):null,w("div",{className:"nova-card-view-site"},[i.site,i.author].filter(Boolean).join(" \xB7 ")))),t.title=i.href??""};return r(n),{dom:t,update(o){return o.type!==n.type?!1:(n=o,r(o),!0)},ignoreMutation:()=>!0,stopEvent:()=>!1}}var Ya={name:"mediaembed",nodes:Ex,prosemirrorPlugins:n=>{let e=Ka(n);return[new z({props:{nodeViews:{link_card:t=>Ax(t,e)}}})]},load:()=>import(__novaChunk("tinymce-chunks/mediaembed-ui-7be11324.js") )};var oc={};j(oc,{bodyStyle:()=>tc,cleanPage:()=>nc,default:()=>rc,fullPageOptions:()=>Qh});var Qa={};j(Qa,{HTMLSerializer:()=>Xr,escapeAttr:()=>Zr,escapeText:()=>xn});var Tx=new Set(["href","xlink:href","action","formaction","cite"]),Nx=new Set(["src","poster","data","background"]),Ox=/url\s*\(|expression\s*\(|javascript:|@import|behavior\s*:|-moz-binding/i;function Yr(n,e){let t=n.toLowerCase();return t.startsWith("on")?null:Tx.has(t)?Ie(e)?e:null:Nx.has(t)?fe(e)?e:null:t==="srcset"?e.split(",").map(o=>o.trim().split(/\s+/)[0]??"").every(o=>fe(o))?e:null:t==="style"&&Ox.test(e)?null:e}var Lx=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Jh=new RegExp("\xA0","g");function xn(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(Jh," ")}var Px="\xA0";function Rx(n){let e=null,t=!0,r=n.childCount;for(let o=0;o<r;o++){let i=n.child(o);if(!i.isText){t=i.type.name==="hard_break"||!i.isInline;continue}let s=i.text??"";if(!s.includes(" ")){t=!1;continue}let l=o===r-1||!n.child(o+1).isInline,a="";for(let c=0;c<s.length;c++){let d=s[c];d!==" "?(a+=d,t=!1):t||l&&c===s.length-1?(a+=Px,t=!1):(a+=" ",t=!0)}a!==s&&(e??(e=new Map)).set(o,a)}return e}function Zr(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(Jh," ")}var Dx=/^[a-z][a-z0-9-]*$/i,_x=new Set(["script","style","base","link","meta","object","embed","applet","frame","frameset","template","noscript"]),Uh=new Set;function Ix(n){Uh.has(n)||(Uh.add(n),console.error(`[nova] toDOM produced <${n}>, which is not allowed in output; the tag was dropped`))}var Hx=/^[a-z_:][a-z0-9_.:-]*$/i;function Za(n){if(typeof n=="string")return{open:"",close:"",hole:!1,html:xn(n)};if(typeof n=="number"||typeof n=="boolean")return{open:"",close:"",hole:!1,html:xn(String(n))};if(n==null)return{open:"",close:"",hole:!1,html:""};if(!Array.isArray(n))throw new Error("[nova] serializer supports only array/string toDOM specs");let[e,...t]=n,r=e.includes(" ")?e.split(" ")[1]:e;if(!Dx.test(r))throw new Error(`[nova] invalid tag in toDOM: ${r}`);let o=_x.has(r.toLowerCase());o&&Ix(r.toLowerCase());let i="",s=t,l=t[0];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let[f,h]of Object.entries(l)){if(h==null)continue;let m=f.includes(" ")?f.split(" ")[1]:f;if(!Hx.test(m))continue;let g=Yr(m,String(h));g!==null&&(i+=` ${m}="${Zr(g)}"`)}s=t.slice(1)}let a=o?"":`<${r}${i}>`;if(Lx.has(r.toLowerCase()))return{open:a,close:"",hole:!1,html:a};let c="",d="",u=!1;for(let f of s){if(f===0){if(u)throw new Error("[nova] toDOM spec has more than one content hole");u=!0;continue}let h=Za(f);if(u){if(h.hole)throw new Error("[nova] toDOM spec has more than one content hole");d+=h.html}else h.hole?(c+=h.open,d+=h.close,u=!0):c+=h.html}if(o)return{open:"",close:"",hole:u,html:""};let p=`</${r}>`;return{open:a+c,close:d+p,hole:u,html:a+c+d+p}}var Xr=class{constructor(){S(this,"cache",new WeakMap)}serializeFragment(e,{pre:t=!1}={}){let r=t?null:Rx(e),o="",i=[],s=[],l=a=>{for(;i.length>a;)o+=s.pop(),i.pop()};return e.forEach((a,c,d)=>{if(!a.isInline){l(0),o+=this.serializeNode(a);return}let u=0;for(;u<i.length&&u<a.marks.length&&i[u].eq(a.marks[u]);)u++;l(u);for(let p=u;p<a.marks.length;p++){let f=a.marks[p],h=this.renderMark(f,a.isText);o+=h.open,s.push(h.close),i.push(f)}o+=a.isText?xn(r?.get(d)??a.text??""):this.serializeNode(a)}),l(0),i=[],s=[],o}serializeNode(e){let t=e.type.spec.toDOM;if(!t)throw new Error(`[nova] node "${e.type.name}" has no toDOM`);let r=Za(t(e));if(!r.hole)return r.html;let o=!!e.type.spec.code||e.type.spec.whitespace==="pre";return r.open+this.serializeFragment(e.content,{pre:o})+r.close}renderMark(e,t){let r=e.type.spec.toDOM;if(!r)throw new Error(`[nova] mark "${e.type.name}" has no toDOM`);let o=this.cache.get(e.type);o||this.cache.set(e.type,o=new Map);let i=JSON.stringify(e.attrs),s=o.get(i);return s||(s=Za(r(e,t)),o.size>500&&o.clear(),o.set(i,s)),s}};var Bx=/^[a-z]{1,8}(?:-[a-z0-9]{1,8}){0,4}$/i,Gh=/^[\w.:-]{1,100}$/,Yh=/^<!doctype html(?:\s+(?:public|system)(?:\s+(?:"[^"<>]{0,300}"|'[^'<>]{0,300}')){1,2})?\s*>$/i,Fx=new Set(["content-type","content-language","x-ua-compatible","default-style"]),zx=new Set(["stylesheet","icon","shortcut","apple-touch-icon","canonical","alternate","author","license","next","prev"]),$x="<!DOCTYPE html>";function wn(n,e){return typeof n!="string"||n.length>e||/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/.test(n)?null:n.replace(/\r\n?/g,`
|
|
16
|
+
`)}var Si=n=>Bx.test(n)?n:null,Xh=n=>["ltr","rtl","auto"].includes(n.toLowerCase())?n.toLowerCase():null,ec=n=>wn(n,300),Vx=n=>{let e=n.split(/\s+/).filter(Boolean);return e.length&&e.length<=20&&e.every(t=>/^[\w-]{1,60}$/.test(t))?e.join(" "):null},qx=n=>{let e=n.trim(),t=/^([a-z][a-z0-9+.-]*):/i.exec(e.replace(/[\u0000- ]/g,""))?.[1];return e&&e.length<=2e3&&(!t||/^https?$/i.test(t))?e:null},ft=n=>{let e=n.trim().split(/\s+/);return e.length<=4&&e.every(t=>t==="0"||t==="auto"||Y.length(t))?e.join(" "):null},jx={"background-color":Y.color,color:Y.color,"font-family":Y.fontFamily,"font-size":Y.length,"line-height":Y.lineHeight,"text-align":n=>["left","center","right","justify"].includes(n)?n:null,"max-width":Y.length,margin:ft,"margin-top":ft,"margin-right":ft,"margin-bottom":ft,"margin-left":ft,padding:ft,"padding-top":ft,"padding-right":ft,"padding-bottom":ft,"padding-left":ft};function tc(n){if(typeof n!="string")return"";let e=new Map;for(let t of n.slice(0,2e3).split(";")){let r=t.indexOf(":");if(r<0)continue;let o=t.slice(0,r).trim().toLowerCase();o==="background"&&(o="background-color");let i=jx[o]?.(t.slice(r+1).trim());i&&(e.delete(o),e.set(o,i))}return[...e].map(([t,r])=>`${t}: ${r}`).join("; ")}var Wx={lang:Si,dir:Xh,xmlns:n=>n==="http://www.w3.org/1999/xhtml"?n:null,"xml:lang":Si},Kx={style:n=>tc(n)||null,class:Vx,dir:Xh,lang:Si},Zh={charset:n=>/^[\w.:-]{1,40}$/.test(n)?n:null,name:n=>Gh.test(n)?n:null,property:n=>Gh.test(n)?n:null,"http-equiv":n=>Fx.has(n.toLowerCase())?n:null,content:n=>wn(n,2e3)},Ux={rel:n=>{let e=n.toLowerCase().split(/\s+/).filter(Boolean);return e.length&&e.every(t=>zx.has(t))?e.join(" "):null},href:qx,type:n=>/^[\w.+-]{1,60}\/[\w.+-]{1,60}$/.test(n)?n:null,media:ec,sizes:n=>/^(?:any|\d{1,4}x\d{1,4}(?:\s+\d{1,4}x\d{1,4}){0,9})$/i.test(n)?n:null,hreflang:Si,title:ec},Jx={media:ec,type:n=>n.toLowerCase()==="text/css"?"text/css":null};function Qr(n,e){if(!n||typeof n!="object"||Array.isArray(n))return null;let t=n,r={};for(let[o,i]of Object.entries(e)){let s=typeof t[o]=="string"?i(t[o]):null;s!==null&&(r[o]=s)}return Object.keys(r).length?r:null}function Gx(n){if(!n||typeof n!="object")return null;let{tag:e,attrs:t,text:r}=n;if(e==="title"){let o=wn(r,1e3);return o===null?null:{tag:e,text:o.replace(/\s+/g," ").trim()}}if(e==="meta"){let o=Qr(t,Zh),i=o&&(o.name??o.property??o["http-equiv"])&&o.content!==void 0;return o&&(o.charset||i)?{tag:e,attrs:o}:null}if(e==="link"){let o=Qr(t,Ux);return o?.rel&&o.href?{tag:e,attrs:o}:null}if(e==="style"){let o=wn(r,2e5);return o===null?null:{tag:e,attrs:Qr(t,Jx)??{},text:o}}return null}function nc(n){if(!n||typeof n!="object"||Array.isArray(n))return{};let e=n,t={},r=wn(e.doctype,700)?.trim();r&&Yh.test(r)&&(t.doctype=r);let o=Qr(e.html,Wx);o&&(t.html=o);let i=Array.isArray(e.head)?e.head.slice(0,300).map(Gx).filter(c=>c!==null):[],s=i.findIndex(c=>c.tag==="title"),l=i.filter((c,d)=>c.tag!=="title"||d===s);l.length&&(t.head=l);let a=Qr(e.body,Kx);return a&&(t.body=a),t}var Mi=(n={})=>Object.entries(n).map(([e,t])=>` ${e}="${Zr(t)}"`).join("");function Yx(n){return n.tag==="title"?`<title>${xn(n.text)}</title>`:n.tag==="style"?`<style${Mi(n.attrs)}>${n.text.replace(/<\/(style)/gi,"<\\/$1")}</style>`:`<${n.tag}${Mi(n.attrs)}>`}function Xx(n){let e=l=>l?Object.fromEntries([...l.attributes].map(a=>[a.name.toLowerCase(),a.value])):{},t=n.doctype,r=t?`<!DOCTYPE ${t.name}${t.publicId?` PUBLIC "${t.publicId}"`:""}${t.systemId?`${t.publicId?"":" SYSTEM"} "${t.systemId}"`:""}>`:void 0,o=[...n.head.children].map(l=>{let a=l.tagName.toLowerCase();return a==="title"||a==="style"?{tag:a,attrs:e(l),text:l.textContent??""}:{tag:a,attrs:e(l)}}),i=e(n.body),s=[i.bgcolor&&`background-color: ${i.bgcolor}`,i.text&&`color: ${i.text}`,i.style].filter(Boolean);return s.length&&(i.style=s.join("; ")),nc({doctype:r,html:e(n.documentElement),head:o,body:i})}var Zx=/<!doctype\b|<(?:html|head|body)[\s>/]/i;function Qh(n){let e=n.options.pluginOptions?.fullpagehtml??{},t=wn(e.doctype,700)?.trim();return{doctype:t&&Yh.test(t)?t:$x,title:wn(e.title,1e3)?.replace(/\s+/g," ").trim()??"",encoding:typeof e.encoding=="string"?Zh.charset(e.encoding)??"":"",bodyStyle:tc(e.bodyStyle),hideInSourceView:e.hideInSourceView===!0}}function Qx(n,e){let t=nc(n),r=(t.head??[]).map(Yx);e.encoding&&!t.head?.some(i=>i.tag==="meta"&&i.attrs.charset)&&r.unshift(`<meta charset="${Zr(e.encoding)}">`),e.title&&!t.head?.some(i=>i.tag==="title")&&r.push(`<title>${xn(e.title)}</title>`);let o={...t.body};return!o.style&&e.bodyStyle&&(o.style=e.bodyStyle),[t.doctype??e.doctype,`<html${Mi(t.html)}>`,"<head>",...r,"</head>",`<body${Mi(o)}>`].join(`
|
|
17
|
+
`)}function e1(n){let e=Qh(n);return{inSource:!e.hideInSourceView,read(t){if(!Zx.test(t))return null;let r=new DOMParser().parseFromString(t,"text/html");return{content:r.body.innerHTML,attrs:{page:Xx(r)}}},write:(t,r)=>`${Qx(r.page,e)}
|
|
18
|
+
${t}
|
|
19
|
+
</body>
|
|
20
|
+
</html>`}}var rc={name:"fullpagehtml",toolbar:"fullpagehtml",nodeAttributes:{page:{nodes:["doc"],default:null,parse:()=>null,render:()=>({})}},page:e1,load:()=>import(__novaChunk("tinymce-chunks/fullpagehtml-ui-9dd804af.js") )};var em={name:"pagebreak",toolbar:"pagebreak",nodes:{pagebreak:{group:"block",atom:!0,selectable:!0,parseDOM:[{tag:"div.nova-pagebreak"},{tag:"div",getAttrs:n=>{let e=n;return(e.style.breakAfter==="page"||e.style.pageBreakAfter==="always")&&!e.textContent?.trim()?null:!1}}],toDOM:()=>["div",{class:"nova-pagebreak",style:"break-after: page;"}]}},load:()=>import(__novaChunk("tinymce-chunks/pagebreak-ui-7476f5c2.js") )};var dc={};j(dc,{PAGE_SIZES:()=>sc,default:()=>cc,fillBand:()=>r1,pageLayout:()=>o1,resolveBand:()=>lc,resolvePageLayout:()=>ac,setPageCount:()=>i1});var tm=".nova-pages{--nova-desk: #e6e9ed}[data-theme=dark] .nova-pages{--nova-desk: #010409}@media(prefers-color-scheme:dark){.nova-pages:not([data-theme=light] *){--nova-desk: #010409}}.nova-pages .nova-content{position:relative;padding:24px 12px 32px;background:var(--nova-desk)}.nova-pages .nova-prosemirror{box-sizing:border-box;width:var(--nova-page-width);max-width:100%;min-height:max(var(--nova-page-height),var(--nova-pages-height, 0px));margin:0 auto;padding:var(--nova-page-margins);background:var(--nova-bg);color:var(--nova-fg);box-shadow:0 1px 3px #0000002e,0 8px 24px #00000014}@media(max-width:600px){.nova-pages .nova-content{padding:0}.nova-pages .nova-prosemirror{padding:16px;box-shadow:none}}";var sc={A3:[297,420],A4:[210,297],A5:[148,210],A6:[105,148],Letter:[215.9,279.4],Legal:[215.9,355.6]},n1=20;function ic(n,e,t,r){let o=typeof n=="number"?n:typeof n=="string"?Number(n):NaN;return Number.isFinite(o)?Math.min(t,Math.max(e,Math.round(o*10)/10)):r}function Ei(n){return typeof n=="string"?n.replace(/\s+/g," ").trim().slice(0,200):""}function lc(n){let e=null;if(typeof n=="string")e={left:"",center:Ei(n),right:""};else if(typeof n=="object"&&n!==null){let t=n;e={left:Ei(t.left),center:Ei(t.center),right:Ei(t.right)}}return e&&(e.left||e.center||e.right)?e:null}function r1(n,e,t){return n.replace(/\{page\}/g,String(e)).replace(/\{pages\}/g,String(t))}function ac(n={}){let e=typeof n.size=="object"&&n.size!==null,t=!e&&typeof n.size=="string"&&n.size in sc?n.size:"A4",r=n.size,[o,i]=e?[ic(r?.width,30,2e3,210),ic(r?.height,30,2e3,297)]:sc[t];if(n.orientation==="landscape"||n.orientation==="portrait"){let c=n.orientation==="landscape",d=o>i;c!==d&&([o,i]=[i,o])}let s=Math.min(o,i)/3,l=n.margins,a=c=>ic(typeof l=="object"&&l!==null?l[c]:l,0,s,Math.min(n1,s));return{size:e?"custom":t,orientation:o>i?"landscape":"portrait",width:o,height:i,margins:{top:a("top"),right:a("right"),bottom:a("bottom"),left:a("left")},header:lc(n.header),footer:lc(n.footer),differentFirstPage:n.differentFirstPage===!0}}var Ci=new WeakMap;function nm(n){for(let e of[...n.listeners])try{e()}catch(t){console.error("[nova] pagelayout: listener failed",t)}}function rm(n,e){let{style:t}=n.root,{top:r,right:o,bottom:i,left:s}=e.margins;t.setProperty("--nova-page-width",`${e.width}mm`),t.setProperty("--nova-page-height",`${e.height}mm`),t.setProperty("--nova-page-margins",`${r}mm ${o}mm ${i}mm ${s}mm`)}function o1(n){let e=Ci.get(n);if(e)return{get layout(){return e.layout},get pages(){return e.pages},set(t){e.options={...e.options,...t},e.layout=ac(e.options),rm(n,e.layout),nm(e)},onChange(t){return e.listeners.add(t),()=>e.listeners.delete(t)}}}function i1(n,e){let t=Ci.get(n);!t||t.pages===e||(t.pages=e,nm(t))}var cc={name:"pagelayout",setup(n){let e=n.options.pluginOptions?.pagelayout??{},t=ac(e);return Ci.set(n,{options:e,layout:t,pages:null,listeners:new Set}),n.ui.addStyles("nova-pagelayout",tm),n.root.classList.add("nova-pages"),rm(n,t),()=>{Ci.delete(n),n.root.classList.remove("nova-pages")}},load:()=>import(__novaChunk("tinymce-chunks/pagelayout-ui-01757669.js") )};var mc={};j(mc,{default:()=>hc,footnoteId:()=>eo,footnoteNodes:()=>im,footnoteNumber:()=>Ai});var om=".nova-prosemirror sup.mce-footnote a{text-decoration:none}.nova-prosemirror .mce-footnotes{margin-top:2em;font-size:.9em}.nova-prosemirror .mce-footnotes hr{width:30%;margin:0 0 .5em;border:0;border-top:1px solid var(--nova-border)}.nova-prosemirror .mce-footnotes-backlink{margin-inline-end:.35em;text-decoration:none;cursor:pointer;user-select:none}@media print{.nova-prosemirror .mce-footnotes{break-inside:avoid}.nova-prosemirror .mce-footnotes-backlink{display:none}}";function eo(n){let e=typeof n=="string"||typeof n=="number"?String(n):"";return/^[\w-]{1,64}$/.test(e)?e:""}function Ai(n){let e=Math.trunc(Number(n));return Number.isFinite(e)&&e>0?e:1}var uc=(n,e)=>n?.startsWith(e)?eo(n.slice(e.length)):"",im={footnote_ref:{inline:!0,group:"inline",atom:!0,selectable:!0,draggable:!0,attrs:{id:{default:""},number:{default:1}},parseDOM:[{tag:"sup.mce-footnote",priority:60,getAttrs:n=>{let e=n.querySelector("a");return{id:uc(e?.getAttribute("href"),"#footnote-")||uc(e?.getAttribute("id"),"footnote-ref-"),number:Ai((e??n).textContent)}}}],toDOM:n=>{let e=eo(n.attrs.id);return["sup",{class:"mce-footnote"},["a",{href:`#footnote-${e}`,id:`footnote-ref-${e}`,role:"doc-noteref"},String(Ai(n.attrs.number))]]},leafText:n=>`[${Ai(n.attrs.number)}]`},footnotes:{group:"block",content:"footnote+",isolating:!0,selectable:!1,parseDOM:[{tag:"div.mce-footnotes",priority:60,contentElement:n=>n.querySelector("ol, ul")??n}],toDOM:()=>["div",{class:"mce-footnotes",role:"doc-endnotes"},["hr"],["ol",0]]},footnote:{content:"inline*",defining:!0,attrs:{id:{default:""}},parseDOM:[{tag:"a.mce-footnotes-backlink",priority:60,ignore:!0},{tag:"li",context:"footnotes/",priority:60,getAttrs:n=>({id:uc(n.getAttribute("id"),"footnote-")})}],toDOM:n=>{let e=eo(n.attrs.id);return["li",{id:`footnote-${e}`},["a",{class:"mce-footnotes-backlink",href:`#footnote-ref-${e}`,role:"doc-backlink"},"^"],["span",{class:"mce-footnote-text"},0]]}}},pc=class{constructor(){S(this,"dom");S(this,"contentDOM");this.dom=document.createElement("div"),this.dom.className="mce-footnotes",this.dom.setAttribute("role","doc-endnotes");let e=document.createElement("hr");e.contentEditable="false",this.contentDOM=document.createElement("ol"),this.dom.append(e,this.contentDOM)}},fc=class{constructor(e){S(this,"dom");S(this,"contentDOM");let t=eo(e.attrs.id);this.dom=document.createElement("li"),this.dom.id=`footnote-${t}`;let r=document.createElement("a");r.className="mce-footnotes-backlink",r.href=`#footnote-ref-${t}`,r.setAttribute("role","doc-backlink"),r.contentEditable="false",r.textContent="^",this.contentDOM=document.createElement("span"),this.contentDOM.className="mce-footnote-text",this.dom.append(r,this.contentDOM)}},hc={name:"footnotes",nodes:im,prosemirrorPlugins:()=>[new z({key:new Z("nova-footnotes-view"),props:{nodeViews:{footnotes:()=>new pc,footnote:n=>new fc(n)}}})],setup(n){n.ui.addStyles("nova-footnotes",om)},load:()=>import(__novaChunk("tinymce-chunks/footnotes-ui-3f167c2c.js") )};V("insertdatetime",()=>import(__novaChunk("tinymce-chunks/insertdatetime-a48ee6e0.js") ));V("casechange",()=>import(__novaChunk("tinymce-chunks/casechange-8ad6a2c3.js") ));V("formatpainter",()=>import(__novaChunk("tinymce-chunks/formatpainter-cbeeffa7.js") ));V("permanentpen",()=>import(__novaChunk("tinymce-chunks/permanentpen-fc96f445.js") ));V("visualchars",()=>import(__novaChunk("tinymce-chunks/visualchars-7cda4c00.js") ));V("save",()=>import(__novaChunk("tinymce-chunks/save-a65e56cd.js") ));V("markdown",()=>import(__novaChunk("tinymce-chunks/markdown-5698ebec.js") ));V("importcss",()=>import(__novaChunk("tinymce-chunks/importcss-28610ab5.js") ));V("template",()=>import(__novaChunk("tinymce-chunks/template-b522c8ed.js") ));V("spellchecker",()=>import(__novaChunk("tinymce-chunks/spellchecker-91509fc1.js") ));V("autocorrect",()=>import(__novaChunk("tinymce-chunks/autocorrect-907e1296.js") ));V("typography",()=>import(__novaChunk("tinymce-chunks/typography-469ce11a.js") ));V("a11ychecker",()=>import(__novaChunk("tinymce-chunks/a11ychecker-fe78c552.js") ));V("linkchecker",()=>import(__novaChunk("tinymce-chunks/linkchecker-820845fd.js") ));V("advcode",()=>import(__novaChunk("tinymce-chunks/advcode-840793ca.js") ));V("editimage",()=>import(__novaChunk("tinymce-chunks/editimage-36199bc6.js") ));V("email",()=>import(__novaChunk("tinymce-chunks/email2-e9c49586.js") ));V("quickbars",()=>import(__novaChunk("tinymce-chunks/quickbars-35c87c0e.js") ));V("charmap",()=>import(__novaChunk("tinymce-chunks/charmap-5deb524c.js") ));V("emoticons",()=>import(__novaChunk("tinymce-chunks/emoticons-a5ab437d.js") ));V("nonbreaking",()=>import(__novaChunk("tinymce-chunks/nonbreaking-f15226ad.js") ));V("checklist",()=>import(__novaChunk("tinymce-chunks/checklist-5a0c95d3.js") ));V("codesample",()=>import(__novaChunk("tinymce-chunks/codesample-b91dcd91.js") ));V("draghandle",()=>import(__novaChunk("tinymce-chunks/draghandle-a1d99987.js") ));V("autolink",()=>import(__novaChunk("tinymce-chunks/autolink-897e8650.js") ));V("autosave",()=>import(__novaChunk("tinymce-chunks/autosave-60381295.js") ));V("autoresize",()=>import(__novaChunk("tinymce-chunks/autoresize-f8a4a52a.js") ));V("visualblocks",()=>import(__novaChunk("tinymce-chunks/visualblocks-8b7cba25.js") ));V("exportword",()=>import(__novaChunk("tinymce-chunks/exportword-8a03f24d.js") ));V("exportpdf",()=>import(__novaChunk("tinymce-chunks/exportpdf-0c6647bc.js") ));V("importword",()=>import(__novaChunk("tinymce-chunks/importword-ec0b2213.js") ));V("ai",()=>import(__novaChunk("tinymce-chunks/ai2-ddf912a7.js") ));V("anchor",Cp);V("accordion",cl);V("tableofcontents",gl);V("math",fl);V("pagebreak",em);V("pagelayout",cc);V("footnotes",hc);V("media",Ha);V("pageembed",za);V("advtable",qa);V("mediaembed",Ya);V("fullpagehtml",rc);V("comments",sa);V("mentions",ra);V("mergetags",ca);V("suggestions",Ma);V("directionality",()=>import(__novaChunk("tinymce-chunks/directionality-185b3810.js") ));V("advlist",()=>import(__novaChunk("tinymce-chunks/advlist-67b98670.js") ));V("revisionhistory",()=>import(__novaChunk("tinymce-chunks/revisionhistory-741dfb24.js") ));var nu={};j(nu,{API_CHANGE_META:()=>xs,Editor:()=>bo,REMOTE_CHANGE_META:()=>tu,createEditor:()=>ws,parseContent:()=>eu});var am=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function l1(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}var a1=(n,e,t)=>{let r=l1(n,t);if(!r)return!1;let o=cm(r);if(!o){let s=r.blockRange(),l=s&<(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(um(n,o,e,-1))return!0;if(r.parent.content.size==0&&(rr(i,"end")||R.isSelectable(i)))for(let s=r.depth;;s--){let l=Tr(n.doc,r.before(s),r.after(s),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(rr(i,"end")?K.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):R.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function rr(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}var c1=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=cm(r)}let s=i&&i.nodeBefore;return!s||!R.isSelectable(s)?!1:(e&&e(n.tr.setSelection(R.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function cm(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function d1(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}var u1=(n,e,t)=>{let r=d1(n,t);if(!r)return!1;let o=dm(r);if(!o)return!1;let i=o.nodeAfter;if(um(n,o,e,1))return!0;if(r.parent.content.size==0&&(rr(i,"start")||R.isSelectable(i))){let s=Tr(n.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(rr(i,"start")?K.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):R.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},p1=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=dm(r)}let s=i&&i.nodeAfter;return!s||!R.isSelectable(s)?!1:(e&&e(n.tr.setSelection(R.create(n.doc,i.pos)).scrollIntoView()),!0)};function dm(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}var Ti=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&<(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},f1=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
21
|
+
`).scrollIntoView()),!0)};function yc(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}var bc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=yc(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(K.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},h1=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof ue||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=yc(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(F.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},m1=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Et(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&<(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function g1(n){return(e,t)=>{if(e.selection instanceof R&&e.selection.node.isBlock){let{$from:f}=e.selection;return!f.parentOffset||!Et(e.doc,f.pos)?!1:(t&&t(e.tr.split(f.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof F||e.selection instanceof ue)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,c=!1,d=!1;for(let f=o.depth;;f--)if(o.node(f).isBlock){c=o.end(f)==o.pos+(o.depth-f),d=o.start(f)==o.pos-(o.depth-f),a=yc(o.node(f-1).contentMatchAt(o.indexAfter(f-1)));let m=n&&n(o.parent,c,o);s.unshift(m||(c&&a?{type:a}:null)),l=f;break}else{if(f==1)return!1;s.unshift(null)}let u=o.pos,p=Et(r.doc,u,s.length,s);if(p||(s[0]=a?{type:a}:null,p=Et(r.doc,u,s.length,s)),!p)return!1;if(r.split(u,s.length,s),!c&&d&&o.node(l).type!=a){let f=r.mapping.slice(i),h=f.map(o.before(l)),m=r.doc.resolve(h);a&&o.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(f.map(o.before(l)),a)}return t&&t(r.scrollIntoView()),!0}}var y1=g1();var b1=(n,e)=>(e&&e(n.tr.setSelection(new ue(n.doc))),!0);function k1(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||at(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function um(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&k1(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,h=N.empty;for(let y=s.length-1;y>=0;y--)h=N.from(s[y].create(null,h));h=N.from(o.copy(h));let m=n.tr.step(new re(e.pos-1,f,e.pos,f,new D(h,1,0),s.length,!0)),g=m.doc.resolve(f+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&at(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&a?null:K.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),p=u&<(u);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(u,p).scrollIntoView()),!0;if(c&&rr(i,"start",!0)&&rr(o,"end")){let f=o,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let m=i,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let y=N.empty;for(let M=h.length-1;M>=0;M--)y=N.from(h[M].copy(y));let x=n.tr.step(new re(e.pos-h.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new D(y,h.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function pm(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(F.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}var v1=pm(-1),x1=pm(1);function Ni(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&sn(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function kc(n,e=null){return function(t,r){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}r(i.scrollIntoView())}return!0}}function w1(n,e,t,r){for(let o=0;o<e.length;o++){let{$from:i,$to:s}=e[o],l=i.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(i.pos,s.pos,(a,c)=>{if(l||!r&&a.isAtom&&a.isInline&&c>=i.pos&&c+a.nodeSize<=s.pos)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function S1(n){let e=[];for(let t=0;t<n.length;t++){let{$from:r,$to:o}=n[t];r.doc.nodesBetween(r.pos,o.pos,(i,s)=>{if(i.isAtom&&i.content.size&&i.isInline&&s>=r.pos&&s+i.nodeSize<=o.pos)return s+1>r.pos&&e.push(new an(r,r.doc.resolve(s+1))),r=r.doc.resolve(s+1+i.content.size),!1}),r.pos<o.pos&&e.push(new an(r,o))}return e}function Yt(n,e=null,t){let r=(t&&t.removeWhenPresent)!==!1,o=(t&&t.enterInlineAtoms)!==!1,i=!(t&&t.includeWhitespace);return function(s,l){let{empty:a,$cursor:c,ranges:d}=s.selection;if(a&&!c||!w1(s.doc,d,n,o))return!1;if(l)if(c)n.isInSet(s.storedMarks||c.marks())?l(s.tr.removeStoredMark(n)):l(s.tr.addStoredMark(n.create(e)));else{let u,p=s.tr;o||(d=S1(d)),r?u=!d.some(f=>s.doc.rangeHasMark(f.$from.pos,f.$to.pos,n)):u=!d.every(f=>{let h=!1;return p.doc.nodesBetween(f.$from.pos,f.$to.pos,(m,g,y)=>{if(h)return!1;h=!n.isInSet(m.marks)&&!!y&&y.type.allowsMarkType(n)&&!(m.isText&&/^\s*$/.test(m.textBetween(Math.max(0,f.$from.pos-g),Math.min(m.nodeSize,f.$to.pos-g))))}),!h});for(let f=0;f<d.length;f++){let{$from:h,$to:m}=d[f];if(!u)p.removeMark(h.pos,m.pos,n);else{let g=h.pos,y=m.pos,x=h.nodeAfter,M=m.nodeBefore,L=i&&x&&x.isText?/^\s*/.exec(x.text)[0].length:0,O=i&&M&&M.isText?/\s*$/.exec(M.text)[0].length:0;g+L<y&&(g+=L,y-=O),p.addMark(g,y,n.create(e))}}l(p.scrollIntoView())}return!0}}function or(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}var gc=or(am,a1,c1),lm=or(am,u1,p1),Rt={Enter:or(f1,h1,m1,y1),"Mod-Enter":bc,Backspace:gc,"Mod-Backspace":gc,"Shift-Backspace":gc,Delete:lm,"Mod-Delete":lm,"Mod-a":b1},fm={"Ctrl-h":Rt.Backspace,"Alt-Backspace":Rt["Mod-Backspace"],"Ctrl-d":Rt.Delete,"Ctrl-Alt-Backspace":Rt["Mod-Delete"],"Alt-Delete":Rt["Mod-Delete"],"Alt-d":Rt["Mod-Delete"],"Ctrl-a":v1,"Ctrl-e":x1};for(let n in Rt)fm[n]=Rt[n];var M1=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,hm=M1?fm:Rt;var Lc={};j(Lc,{commands:()=>Ke,convertList:()=>Sm,findParentList:()=>wm,getActiveAlign:()=>Xt,getLinkAt:()=>En,insertImage:()=>Oc,isCommandActive:()=>lr,isMarkActive:()=>sr,isNodeActive:()=>Xe,listIndent:()=>Tc,listOutdent:()=>Nc,markRange:()=>Cn,marksOf:()=>ce,nodesOf:()=>X,replaceSelectionWithBlock:()=>Hi,setLink:()=>U1});var Mc={};j(Mc,{closeHistory:()=>R1,history:()=>Sc,isHistoryTransaction:()=>B1,redo:()=>Di,redoDepth:()=>H1,redoNoScroll:()=>_1,undo:()=>Ri,undoDepth:()=>I1,undoNoScroll:()=>D1});var Oi=200,ve=function(){};ve.prototype.append=function(e){return e.length?(e=ve.from(e),!this.length&&e||e.length<Oi&&this.leafAppend(e)||this.length<Oi&&e.leafPrepend(this)||this.appendInner(e)):this};ve.prototype.prepend=function(e){return e.length?ve.from(e).append(this):this};ve.prototype.appendInner=function(e){return new E1(this,e)};ve.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ve.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ve.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ve.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ve.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};ve.from=function(e){return e instanceof ve?e:e&&e.length?new mm(e):ve.empty};var mm=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Oi)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Oi)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ve);ve.empty=new mm([]);var E1=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ve),vc=ve;var C1=500,Sn=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((u,p)=>{if(!u.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new ht(u.map));let f=u.step.map(o.slice(i)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new ht(h,void 0,void 0,c.length+d.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(i)):u.selection,a=new n(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),p=new ht(e.mapping.maps[d],u,t),f;(f=a&&a.merge(p))&&(p=f,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),o||(a=p)}let c=s-r.depth;return c>T1&&(l=A1(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new _n;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new ht(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],o=this.items.length-t,i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},o);let a=t;this.items.forEach(p=>{let f=i.getMirror(--a);if(f==null)return;s=Math.min(s,f);let h=i.maps[f];if(p.step){let m=e.steps[f].invert(e.docs[f]),g=p.selection&&p.selection.map(i.slice(a+1,f));g&&l++,r.push(new ht(h,m,g))}else r.push(new ht(h))},o);let c=[];for(let p=t;p<s;p++)c.push(new ht(i.maps[p]));let d=this.items.slice(0,o).append(c).append(r),u=new n(d,l);return u.emptyItemCount()>C1&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=s.selection&&s.selection.map(t.slice(r));d&&i++;let u=new ht(c.invert(),a,d),p,f=o.length-1;(p=o.length&&o[f].merge(u))?o[f]=p:o.push(u)}}else s.map&&r--},this.items.length,0),new n(vc.from(o.reverse()),i)}};Sn.empty=new Sn(vc.empty,0);function A1(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}var ht=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},mt=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},T1=20;function N1(n,e,t,r){let o=t.getMeta(gt),i;if(o)return o.historyState;t.getMeta(bm)&&(n=new mt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(gt))return s.getMeta(gt).redo?new mt(n.done.addTransform(t,void 0,r,Li(e)),n.undone,gm(t.mapping.maps),n.prevTime,n.prevComposition):new mt(n.done,n.undone.addTransform(t,void 0,r,Li(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!O1(t,n.prevRanges)),c=s?xc(n.prevRanges,t.mapping):gm(t.mapping.maps);return new mt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Li(e)),Sn.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new mt(n.done.rebased(t,i),n.undone.rebased(t,i),xc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new mt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),xc(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function O1(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function gm(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function xc(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function L1(n,e){for(let t=0;t<e.steps.length;t++){let r=e.mapping.maps[t],o=-1;if(r.forEach((i,s)=>o=s),o<0){let i=e.steps[t];(i instanceof Ue||i instanceof Je)&&(o=i.to)}if(o>-1)return K.near(n.doc.resolve(o))}return n.selection}function P1(n,e,t){let r=Li(e),o=gt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,L1(e,i.transform).getBookmark(),o,r),a=new mt(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(gt,{redo:t,historyState:a})}var wc=!1,ym=null;function Li(n){let e=n.plugins;if(ym!=e){wc=!1,ym=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){wc=!0;break}}return wc}function R1(n){return n.setMeta(bm,!0)}var gt=new Z("history"),bm=new Z("closeHistory");function Sc(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new z({key:gt,state:{init(){return new mt(Sn.empty,Sn.empty,null,0,-1)},apply(e,t,r){return N1(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Ri:r=="historyRedo"?Di:null;return!o||!e.editable?!1:(t.preventDefault(),o(e.state,e.dispatch))}}}})}function Pi(n,e){return(t,r)=>{let o=gt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=P1(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Ri=Pi(!1,!0),Di=Pi(!0,!0),D1=Pi(!1,!1),_1=Pi(!0,!1);function I1(n){let e=gt.getState(n);return e?e.done.eventCount:0}function H1(n){let e=gt.getState(n);return e?e.undone.eventCount:0}function B1(n){return n.getMeta(gt)!=null}var Ac={};j(Ac,{blockUnitAt:()=>Ec,duplicateBlock:()=>$1,moveBlock:()=>_i,selectedBlockUnit:()=>Cc});function Ec(n){for(let e=n.depth;e>0;e--){let t=n.node(e);if(t.type.name==="list_item")return{node:t,pos:n.before(e),depth:e}}if(n.depth===0){let e=n.nodeAfter;return e?{node:e,pos:n.pos,depth:1}:null}return{node:n.node(1),pos:n.before(1),depth:1}}function Cc(n){let{selection:e}=n;return e instanceof R?{node:e.node,pos:e.from,depth:e.$from.depth+1}:e instanceof F?Ec(e.$from):null}function F1(n){let e=Cc(n);if(!e)return null;let{selection:t}=n;if(!(t instanceof R)&&e.node.type.spec.tableRole==="table")return null;let r=n.doc.resolve(e.pos),o=r.parent,i=r.index(),s=i;if(!t.empty&&!(t instanceof R)){let a=Ec(t.$to);if(a&&a.depth===e.depth){let c=n.doc.resolve(a.pos);c.start()===r.start()&&(s=Math.max(i,c.index()))}}let l=e.pos;for(let a=i;a<=s;a++)l+=o.child(a).nodeSize;return{parent:o,startIndex:i,endIndex:s,from:e.pos,to:l}}function z1(n,e,t){let{selection:r}=e;n.setSelection(r instanceof R?R.create(n.doc,r.from+t):F.create(n.doc,r.anchor+t,r.head+t))}function _i(n){return(e,t)=>{let r=F1(e);if(!r)return!1;let{parent:o,startIndex:i,endIndex:s,from:l,to:a}=r,c=n<0?i-1:s+1;if(c<0||c>=o.childCount)return!1;let d=o.child(c),u=[];for(let g=i;g<=s;g++)u.push(o.child(g));let p=N.fromArray(u),f=n<0?p.append(N.from(d)):N.from(d).append(p),h=Math.min(i,c),m=Math.max(s,c);if(!o.canReplace(h,m+1,f))return!1;if(t){let g=n<0?e.tr.replaceWith(l-d.nodeSize,a,f):e.tr.replaceWith(l,a+d.nodeSize,f);z1(g,e,n*d.nodeSize),t(g.scrollIntoView())}return!0}}var $1=(n,e)=>{let t=Cc(n);if(!t||t.node.type.spec.tableRole==="table"&&!(n.selection instanceof R))return!1;let r=t.pos+t.node.nodeSize,o=n.doc.resolve(r);if(!o.parent.canReplaceWith(o.index(),o.index(),t.node.type))return!1;if(e){let i=n.tr.insert(r,t.node);i.setSelection(R.create(i.doc,r)),e(i.scrollIntoView())}return!0};var X=n=>n.schema.nodes,ce=n=>n.schema.marks,to=(n,e)=>(t,r,o)=>e(X(t)[n])(t,r,o),Mn=(n,e)=>(t,r,o)=>e(ce(t)[n])(t,r,o);function Ii(n){return(e,t)=>{let{from:r,to:o}=e.selection,i=e.tr,s=!1;return e.doc.nodesBetween(r,o,(l,a)=>{let c=X(e);(l.type===c.paragraph||l.type===c.heading)&&(s=!0,i=i.setNodeMarkup(a,void 0,{...l.attrs,align:n}))}),s?(t?.(i),!0):!1}}function Hi(n,e){let{$from:t}=n.selection;if(e.isBlock)for(let r=t.depth-1;r>0;r--){let o=t.node(r);if(!o.type.spec.isolating)continue;let i=!1;for(let l=0;l<=o.childCount&&!i;l++)i=o.canReplaceWith(l,l,e.type);if(i)break;let s=t.after(r);return n.insert(s,e),n.setSelection(K.near(n.doc.resolve(s+e.nodeSize)))}return n.replaceSelectionWith(e)}var V1=(n,e)=>(e?.(Hi(n.tr,X(n).horizontal_rule.create()).scrollIntoView()),!0),q1=(n,e)=>{let{from:t,to:r,empty:o,$from:i}=n.selection,s=ce(n);if(o){let l=Cn(n,s.link,i.pos);return l?(e?.(n.tr.removeMark(l.from,l.to,s.link)),!0):!1}return n.doc.rangeHasMark(t,r,s.link)?(e?.(n.tr.removeMark(t,r,s.link)),!0):!1},j1=(n,e)=>{let{from:t,to:r,empty:o}=n.selection;if(o)return!1;if(e){let i=ce(n),s=n.tr;for(let l of Object.values(i))l!==i.link&&(s=s.removeMark(t,r,l));e(s)}return!0};function vm(n){return(e,t)=>{let r=X(e),o=[],{from:i,to:s}=e.selection;if(e.doc.nodesBetween(i,s,(l,a,c)=>{if(l.type!==r.paragraph&&l.type!==r.heading)return!0;if(c?.type!==r.list_item){let d=nr(l.attrs.indent),u=nr(d+n);u!==d&&o.push({pos:a,attrs:{...l.attrs,indent:u}})}return!1}),!o.length)return!1;if(t){let l=e.tr;for(let{pos:a,attrs:c}of o)l.setNodeMarkup(a,void 0,c);t(l.scrollIntoView())}return!0}}var W1=(n,e,t)=>di(X(n).list_item)(n,e,t)||vm(1)(n,e,t),K1=(n,e,t)=>yn(X(n).list_item)(n,e,t)||vm(-1)(n,e,t),Tc=(n,e,t)=>di(X(n).list_item)(n,e,t),Nc=(n,e,t)=>yn(X(n).list_item)(n,e,t);function xm(n,e={}){let t=kc(n,e);return(r,o)=>{if(!t(r))return!1;if(o){let i=r.tr;for(let s of r.selection.ranges)i.setBlockType(s.$from.pos,s.$to.pos,n,l=>({...e,..."align"in n.spec.attrs&&l.attrs.align?{align:l.attrs.align}:{},..."lineHeight"in n.spec.attrs&&l.attrs.lineHeight?{lineHeight:l.attrs.lineHeight}:{},..."dir"in n.spec.attrs&&l.attrs.dir?{dir:l.attrs.dir}:{},..."indent"in n.spec.attrs&&l.attrs.indent?{indent:l.attrs.indent}:{},..."id"in n.spec.attrs&&l.attrs.id?{id:l.attrs.id}:{}}));o(i.scrollIntoView())}return!0}}function ir(n){return to("heading",e=>xm(e,{level:n}))}var Ke={bold:Mn("bold",Yt),italic:Mn("italic",Yt),underline:Mn("underline",Yt),strike:Mn("strike",Yt),code:Mn("code",Yt),subscript:Mn("subscript",Yt),superscript:Mn("superscript",Yt),paragraph:to("paragraph",n=>xm(n)),h1:ir(1),h2:ir(2),h3:ir(3),h4:ir(4),h5:ir(5),h6:ir(6),blockquote:(n,e)=>Xe(n,X(n).blockquote)?Ti(n,e):Ni(X(n).blockquote)(n,e),codeBlock:to("code_block",n=>kc(n)),bulletList:to("bullet_list",km),orderedList:to("ordered_list",km),indent:W1,outdent:K1,alignLeft:Ii(null),alignCenter:Ii("center"),alignRight:Ii("right"),alignJustify:Ii("justify"),horizontalRule:V1,unlink:q1,clearFormatting:j1,undo:Ri,redo:Di,moveBlockUp:_i(-1),moveBlockDown:_i(1)};function wm(n){let e=X(n),{$from:t}=n.selection;for(let r=t.depth;r>0;r--){let o=t.node(r);if(o.type===e.bullet_list||o.type===e.ordered_list)return{node:o,pos:t.before(r)}}return null}function Sm(n,e,t,r=!1){let o=n.doc.type.schema.nodes,i=t===o.bullet_list&&r;return n.setNodeMarkup(e.pos,t,t===o.bullet_list?{listStyle:null,checklist:i}:{start:1}),e.node.forEach((s,l)=>{let a=s.attrs.checked,c=i?typeof a=="boolean"?a:!1:null;c!==a&&n.setNodeMarkup(e.pos+1+l,void 0,{...s.attrs,checked:c})}),n}function km(n){return(e,t)=>{let r=X(e),o=n===r.bullet_list?{checklist:!1}:void 0;if(Xe(e,n,o))return yn(r.list_item)(e,t);let i=wm(e);return i?(t&&t(Sm(e.tr,i,n).scrollIntoView()),!0):pa(n)(e,t)}}function U1(n,e={}){return(t,r)=>{if(!Ie(n))return!1;let{from:o,to:i,empty:s,$from:l}=t.selection,a=ce(t),c=a.link.create({href:n,title:e.title??null,target:e.target??null});if(s){let d=Cn(t,a.link,l.pos);return d?(r?.(t.tr.removeMark(d.from,d.to,a.link).addMark(d.from,d.to,c)),!0):(r?.(t.tr.insert(o,t.schema.text(n,[c]))),!0)}return r?.(t.tr.removeMark(o,i,a.link).addMark(o,i,c)),!0}}function Oc(n,e){return(t,r)=>fe(n)?(r?.(t.tr.replaceSelectionWith(X(t).image.create({src:n,alt:e??null})).scrollIntoView()),!0):!1}function sr(n,e){let{from:t,$from:r,to:o,empty:i}=n.selection;return i?!!e.isInSet(n.storedMarks??r.marks()):n.doc.rangeHasMark(t,o,e)}function Xe(n,e,t){let{$from:r,to:o}=n.selection;for(let i=r.depth;i>0;i--){let s=r.node(i);if(s.type===e&&(!t||Object.entries(t).every(([l,a])=>s.attrs[l]===a)))return o<=r.end(i)}return!1}function Xt(n){return n.selection.$from.parent.attrs.align??"left"}function lr(n,e){let t=n.selection.$from.parent,r=X(n),o=ce(n);switch(e){case"bold":case"italic":case"underline":case"strike":case"code":case"subscript":case"superscript":return sr(n,o[e]);case"paragraph":return t.type===r.paragraph;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return t.type===r.heading&&t.attrs.level===Number(e[1]);case"codeBlock":return t.type===r.code_block;case"blockquote":return Xe(n,r.blockquote);case"bulletList":return Xe(n,r.bullet_list,{checklist:!1});case"orderedList":return Xe(n,r.ordered_list);case"alignLeft":return Xt(n)==="left";case"alignCenter":return Xt(n)==="center";case"alignRight":return Xt(n)==="right";case"alignJustify":return Xt(n)==="justify";default:return!1}}function En(n){let{$from:e}=n.selection,t=ce(n),r=t.link.isInSet(e.marks())??t.link.isInSet(e.nodeAfter?.marks??[]);return r?r.attrs:null}function Cn(n,e,t){let r=n.doc.resolve(t),o=r.start(),i=[];return r.parent.forEach((s,l)=>{if(!e.isInSet(s.marks))return;let a=o+l,c=a+s.nodeSize,d=i[i.length-1];d&&d.to===a?d.to=c:i.push({from:a,to:c})}),i.find(s=>s.from<=t&&t<=s.to)??null}var J1={strong:"bold",b:"bold",em:"italic",i:"italic",u:"underline",s:"strike",strike:"strike",del:"strike",code:"code",sub:"subscript",sup:"superscript"},G1={color:{mark:"color",read:Y.color},"background-color":{mark:"background",read:Y.color},"font-family":{mark:"font_family",read:Y.fontFamily},"font-size":{mark:"font_size",read:Y.length}},qi={p:n=>n.type.name==="paragraph",h1:n=>n.type.name==="heading"&&n.attrs.level===1,h2:n=>n.type.name==="heading"&&n.attrs.level===2,h3:n=>n.type.name==="heading"&&n.attrs.level===3,h4:n=>n.type.name==="heading"&&n.attrs.level===4,h5:n=>n.type.name==="heading"&&n.attrs.level===5,h6:n=>n.type.name==="heading"&&n.attrs.level===6,blockquote:n=>n.type.name==="blockquote",pre:n=>n.type.name==="code_block",img:n=>n.type.name==="image"},Mm=new Set;function ji(n){Mm.has(n)||(Mm.add(n),console.warn(`[nova] formats: ${n}`))}function Ze(n){return Array.isArray(n)?n.flatMap(Ze):typeof n=="string"?n.split(/\s+/).filter(Boolean):[]}function no(n){let e=[];for(let t of n)e.push(...Ze(t.classes)),"items"in t&&t.items&&e.push(...no(t.items));return e}var zi=(n,e)=>{let t=Ze(n);return e.every(r=>t.includes(r))},Bi=(n,e)=>{let t=[...new Set([...Ze(n),...e])];return t.length?t.join(" "):null},Fi=(n,e)=>{let t=Ze(n).filter(r=>!e.includes(r));return t.length?t.join(" "):null};function $i(n){let e={};for(let[t,r]of Object.entries(n.styles??{}))t==="text-align"&&Jr.includes(r)?e.align=r:t==="line-height"&&Y.lineHeight(r)?e.lineHeight=Y.lineHeight(r):ji(`style "${t}" is not supported on blocks`);return e}function Dc(n,e){let t=ce(n),r=[];if(e.inline&&e.inline!=="span"){let i=t[J1[e.inline]];i&&r.push(i.create())}let o=Ze(e.classes);o.length&&t.span_class&&r.push(t.span_class.create({class:o.join(" ")}));for(let[i,s]of Object.entries(e.styles??{})){let l=G1[i],a=l?.read(s),c=l?t[l.mark]:void 0;c&&a?r.push(c.create({value:a})):ji(`style "${i}: ${s}" is not supported on text`)}return r}var Wi=n=>(n.selector??"").split(",").map(e=>e.trim().toLowerCase()).filter(e=>qi[e]?!0:(ji(`selector "${e}" is not supported`),!1));function Ki(n,e){let t=[],r=a=>e.some(c=>qi[c](a)),{selection:o}=n;if(o instanceof R&&r(o.node))return[{node:o.node,pos:o.from}];let{$from:i,from:s,to:l}=o;for(let a=i.depth;a>0;a--){let c=i.node(a);r(c)&&t.push({node:c,pos:i.before(a)})}return n.doc.nodesBetween(s,l,(a,c)=>{r(a)&&!t.some(d=>d.pos===c)&&t.push({node:a,pos:c})}),t}function Pc(n){let e=[],{from:t,to:r}=n.selection;return n.doc.nodesBetween(t,r,(o,i)=>o.isTextblock?(e.push({node:o,pos:i}),!1):!0),e}function _c(n){let{$from:e}=n.selection;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.name==="blockquote")return{node:r,pos:e.before(t)}}return null}function Am(n){return{align:n.align??null,lineHeight:n.lineHeight??null,dir:n.dir??null}}var Vi=class{constructor(e,t){S(this,"editor",e);S(this,"allowedClasses",t);S(this,"registry",new Map)}register(e,t){let r=Array.isArray(t)?t:[t];this.registry.set(e,r),no(r).forEach(o=>this.allowedClasses.add(o))}unregister(e){this.registry.delete(e)}has(e){return this.registry.has(e)}get(e){return this.registry.get(e)}resolve(e){if(typeof e!="string")return[e];let t=this.registry.get(e);return t||ji(`unknown format "${e}"`),t??[]}canApply(e){if(!this.editor.isEditable())return!1;let t=this.editor.view.state;return this.resolve(e).some(r=>Em(t,r))}match(e){let t=this.editor.view.state;return this.resolve(e).some(r=>Y1(t,r))}apply(e){if(!this.editor.isEditable())return!1;let t=this.resolve(e);if(!t.length)return!1;let r=t.find(o=>Em(this.editor.view.state,o))??t[0];return this.run((o,i)=>X1(o,i,r))}remove(e){if(!this.editor.isEditable())return!1;let t=this.resolve(e);return t.length?this.run((r,o)=>t.forEach(i=>Z1(r,o,i))):!1}toggle(e){return this.match(e)?this.remove(e):this.apply(e)}run(e){let{view:t}=this.editor,r=t.state.tr;return e(t.state,r)===!1?!1:((r.docChanged||r.storedMarksSet)&&t.dispatch(r.scrollIntoView()),t.focus(),!0)}};function Em(n,e){return e.selector?Ki(n,Wi(e)).length>0:!0}function Cm(n,e){return n.type.name==="image"?!0:Object.entries($i(e)).every(([t,r])=>n.attrs[t]===r)}function Y1(n,e){let t=Ze(e.classes);if(e.block){if(e.block==="blockquote"){let o=_c(n);return!!o&&zi(o.node.attrs.class,t)}let r=n.selection.$from.parent;return qi[e.block](r)&&zi(r.attrs.class,t)&&Cm(r,e)}if(e.selector){let r=Ki(n,Wi(e));return r.length>0&&r.some(({node:o})=>zi(o.attrs.class,t)&&Cm(o,e))}if(e.inline){let r=Dc(n,e);if(!r.length)return!1;let{$from:o,empty:i,from:s,to:l}=n.selection;if(i){let d=n.storedMarks??o.marks();return r.every(u=>d.some(p=>Rc(p,u)))}let a=!1,c=!0;return n.doc.nodesBetween(s,l,d=>{d.isText&&(a=!0,r.every(u=>d.marks.some(p=>Rc(p,u)))||(c=!1))}),a&&c}return!1}function Rc(n,e){return n.type!==e.type?!1:e.type.name==="span_class"?zi(n.attrs.class,Ze(e.attrs.class)):e.attrs.value===void 0||n.attrs.value===e.attrs.value}function X1(n,e,t){let r=Ze(t.classes),o=X(n);if(t.block==="blockquote"){let i=_c(n);return i?(e.setNodeMarkup(i.pos,void 0,{...i.node.attrs,class:Bi(i.node.attrs.class,r)}),!0):Ni(o.blockquote,{class:Bi(null,r)})(n,s=>s.steps.forEach(l=>e.step(l)))}if(t.block==="pre"){for(let{node:i,pos:s}of Pc(n))i.type!==o.code_block&&e.setNodeMarkup(s,o.code_block,{language:null});return!0}if(t.block){let i=t.block==="p"?0:Number(t.block.slice(1)),s=i?o.heading:o.paragraph,l=$i(t);for(let{node:a,pos:c}of Pc(n)){if(a.type===o.code_block&&a.textContent.includes(`
|
|
22
|
+
`))continue;let d=a.type===s&&(!i||a.attrs.level===i);e.setNodeMarkup(c,s,{...Am(a.attrs),...i?{level:i}:{},...l,class:Bi(d?a.attrs.class:null,r)})}return!0}if(t.selector){let i=$i(t),s=Ki(n,Wi(t));if(!s.length)return!1;for(let{node:l,pos:a}of s){let c=l.type.name==="image"?{}:i;e.setNodeMarkup(a,void 0,{...l.attrs,...c,class:Bi(l.attrs.class,r)})}return n.selection instanceof R&&e.setSelection(R.create(e.doc,n.selection.from)),!0}if(t.inline){let i=Dc(n,t);if(!i.length)return!1;let{empty:s,ranges:l}=n.selection;if(s){let a=n.storedMarks??n.selection.$from.marks();for(let c of i)a=c.addToSet(a);return e.setStoredMarks(a),!0}for(let{$from:a,$to:c}of l)for(let d of i)e.addMark(a.pos,c.pos,d);return!0}return!1}function Z1(n,e,t){let r=Ze(t.classes),o=X(n);if(t.block==="blockquote"){let i=_c(n);if(!i)return;let s=Fi(i.node.attrs.class,r);if(r.length&&s!==null){e.setNodeMarkup(i.pos,void 0,{...i.node.attrs,class:s});return}Ti(n,l=>l.steps.forEach(a=>e.step(a)));return}if(t.block){for(let{node:i,pos:s}of Pc(n))qi[t.block](i)&&e.setNodeMarkup(s,o.paragraph,{...Am(i.attrs),class:t.block==="p"?Fi(i.attrs.class,r):null});return}if(t.selector){let i=$i(t);for(let{node:s,pos:l}of Ki(n,Wi(t))){let a={};s.type.name!=="image"&&("align"in i&&s.attrs.align===i.align&&(a.align=null),"lineHeight"in i&&s.attrs.lineHeight===i.lineHeight&&(a.lineHeight=null)),e.setNodeMarkup(l,void 0,{...s.attrs,...a,class:Fi(s.attrs.class,r)})}n.selection instanceof R&&e.setSelection(R.create(e.doc,n.selection.from));return}if(t.inline){let i=Dc(n,t),{empty:s,from:l,to:a,$from:c}=n.selection;if(s){let d=(n.storedMarks??c.marks()).filter(u=>!i.some(p=>Rc(u,p)));e.setStoredMarks(d);return}for(let d of i){if(d.type.name!=="span_class"){e.removeMark(l,a,d.type);continue}n.doc.nodesBetween(l,a,(u,p)=>{if(!u.isText)return;let f=u.marks.find(y=>y.type===d.type);if(!f)return;let h=Math.max(p,l),m=Math.min(p+u.nodeSize,a);e.removeMark(h,m,d.type);let g=Fi(f.attrs.class,Ze(d.attrs.class));g&&e.addMark(h,m,d.type.create({class:g}))})}}}var Hc={};j(Hc,{absolutizeUrls:()=>Pm,attachCss:()=>Ic,loadCss:()=>Ji,scopeCss:()=>Ui,scopeSelector:()=>Lm,splitSelectors:()=>Om,splitTopLevel:()=>Nm});var Q1=/^@(font-face|(-webkit-)?keyframes|property|counter-style|page|font-feature-values|font-palette-values)\b/i,e0=/^@(media|supports|container|layer|document|scope)\b/i;function Nm(n){let e=[],t=0,r=0,o=0,i="";for(;t<n.length;){let s=n[t];if(s==="/"&&n[t+1]==="*"){let l=n.indexOf("*/",t+2),a=l===-1?n.length:l+2;if(o===0){n=n.slice(0,t)+n.slice(a);continue}t=a;continue}if(s==='"'||s==="'"){for(t++;t<n.length&&n[t]!==s;)t+=n[t]==="\\"?2:1;t++;continue}if(s==="{")o===0&&(i=n.slice(r,t).trim(),r=t+1),o++;else if(s==="}")o--,o===0&&(e.push({prelude:i,body:n.slice(r,t)}),r=t+1),o<0&&(o=0);else if(s===";"&&o===0){let l=n.slice(r,t).trim();l&&e.push({prelude:l,body:null}),r=t+1}t++}return e}function Om(n){let e=[],t=0,r="",o=0;for(let i=0;i<n.length;i++){let s=n[i];r?s==="\\"?i++:s===r&&(r=""):s==='"'||s==="'"?r=s:s==="("||s==="["?t++:s===")"||s==="]"?t--:s===","&&t===0&&(e.push(n.slice(o,i)),o=i+1)}return e.push(n.slice(o)),e.map(i=>i.trim()).filter(Boolean)}function Lm(n,e){let t=n,r=!1;for(;;){let o=t.match(/^(html|body|:root)(?![\w-])\s*/i);if(!o)break;r=!0,t=t.slice(o[0].length)}if(!r)return`${e} ${n}`;if(/^[.#[:]/.test(t)){let o=t.search(/[\s>+~]/);return o===-1?`${e}${t}`:`${e}${t.slice(0,o)} ${t.slice(o).trim()}`}return t?`${e} ${t}`:e}function Ui(n,e){let t=[];for(let{prelude:r,body:o}of Nm(n)){if(o===null){/^@layer\b/i.test(r)&&t.push(`${r};`);continue}if(Q1.test(r))t.push(`${r}{${o}}`);else if(e0.test(r))t.push(`${r}{${Ui(o,e)}}`);else{if(r.startsWith("@"))continue;{let i=Om(r).map(s=>Lm(s,e));i.length&&t.push(`${i.join(", ")}{${o}}`)}}}return t.join(`
|
|
23
|
+
`)}function Pm(n,e){return n.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi,(t,r,o)=>{if(/^(data:|https?:|\/\/|#)/i.test(o))return t;try{return`url(${r}${new URL(o,e).href}${r})`}catch{return t}})}var Tm=/@import\s+(?:url\(\s*)?(['"]?)([^'")\s;]+)\1\s*\)?([^;]*);/gi;async function Ji(n,e=0){let t=new URL(n,document.baseURI).href,r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=Pm(await r.text(),t);if(e>=3)return o.replace(Tm,"");let i=[...o.matchAll(Tm)];for(let s of i){let l=s[3].trim(),a="";try{a=await Ji(new URL(s[2],t).href,e+1)}catch(c){console.warn(`[nova] contentCss: could not load ${s[2]}`,c)}o=o.replace(s[0],l?`@media ${l}{${a}}`:a)}return o}function Ic(n,e){let t=n.getRootNode();if("adoptedStyleSheets"in t&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype)try{let i=new CSSStyleSheet;return i.replaceSync(e),t.adoptedStyleSheets=[...t.adoptedStyleSheets,i],()=>{t.adoptedStyleSheets=t.adoptedStyleSheets.filter(s=>s!==i)}}catch{}let o=document.createElement("style");return o.setAttribute("data-nova-content-css",""),o.textContent=e,n.prepend(o),()=>o.remove()}function Rm(n={}){return new z({view(e){return new Bc(e,n)}})}var Bc=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(t){let u=e.nodeBefore,p=e.nodeAfter;if(u||p){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=u?h.bottom:h.top;u&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:h.left,right:h.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:u.left-p,right:u.left+p,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),p=u.width/a.offsetWidth,f=u.height/a.offsetHeight;c=u.left-a.scrollLeft*p,d=u.top-a.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(!t||i)return null;let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ar(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var Ce=class n extends K{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):K.near(r)}content(){return D.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new Fc(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!t0(e)||!n0(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!R.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};Ce.prototype.visible=!1;Ce.findFrom=Ce.findGapCursorFrom;K.jsonID("gapcursor",Ce);var Fc=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ce.valid(t)?new Ce(t):K.near(t)}};function Dm(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function t0(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||Dm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function n0(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||Dm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function _m(){return new z({props:{decorations:s0,createSelectionBetween(n,e,t){return e.pos==t.pos&&Ce.valid(t)?new Ce(t):null},handleClick:o0,handleKeyDown:r0,handleDOMEvents:{beforeinput:i0}}})}var r0=ti({ArrowLeft:Gi("horiz",-1),ArrowRight:Gi("horiz",1),ArrowUp:Gi("vert",-1),ArrowDown:Gi("vert",1)});function Gi(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof F){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Ce.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new Ce(c))),!0):!1}}function o0(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Ce.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&R.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Ce(r))),!0)}function i0(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Ce))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=N.empty;for(let s=r.length-1;s>=0;s--)o=N.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new D(o,0,0));return i.setSelection(F.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function s0(n){if(!(n.selection instanceof Ce))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[ge.widget(n.selection.head,e,{key:"gapcursor"})])}var ed={};j(ed,{UPLOAD_RETRY_DELAYS:()=>Bm,dataUrlToFile:()=>zm,embeddedImageUploadPlugin:()=>Uc,exitImageCaption:()=>Xc,getSelectedImage:()=>Qe,hasImageCaption:()=>Gc,imageDropPastePlugin:()=>Jc,isSupportedImage:()=>oo,openImageAltDialog:()=>Qc,openImageDialog:()=>io,setImageAttrs:()=>ar,setImageWidthFraction:()=>Zc,toggleImageCaption:()=>Yc,uploadEmbeddedImage:()=>Kc,uploadImages:()=>Yi});var zc={};j(zc,{attachFilePicker:()=>ro});function ro(n,e,t,r){let{filePicker:o,filePickerTypes:i}=n.options;if(!o||i&&!i.includes(t))return;let{input:s}=e,l=w("button",{type:"button",className:"nova-btn nova-input-action","aria-label":n.ui.t("dialog.browse"),title:n.ui.t("dialog.browse")},ee(C.browse)),a=w("div",{className:"nova-input-group"});s.replaceWith(a),a.append(s,l),l.addEventListener("click",async()=>{l.disabled=!0;try{let c=await o({type:t,value:s.value});if(!c?.url)return;s.value=c.url,s.removeAttribute("aria-invalid"),r?.(c)}catch(c){console.error("[nova] filePicker failed:",c)}finally{l.disabled=!1,s.isConnected&&s.focus()}})}var qc={};j(qc,{checkboxField:()=>Vc,openDialog:()=>$c,selectField:()=>l0,textField:()=>Fe});function $c(n){let e=qe("nova-dialog-title"),t=w("p",{className:"nova-dialog-error",role:"alert",hidden:!0}),r=w("button",{type:"submit",className:"nova-button nova-button-primary",hidden:!n.submitLabel},n.submitLabel??""),o=w("button",{type:"button",className:"nova-button"},n.cancelLabel),i=w("button",{type:"button",className:"nova-btn nova-dialog-close","aria-label":n.closeLabel},ee(C.close)),s=w("form",{className:n.size==="large"?"nova-dialog nova-dialog-large":"nova-dialog",role:"dialog","aria-modal":"true","aria-labelledby":e,novalidate:!0},w("header",{className:"nova-dialog-header"},w("h2",{id:e},n.title),i),w("div",{className:"nova-dialog-body"},n.body,t),w("footer",{className:"nova-dialog-footer"},o,r)),l=w("div",{className:"nova-dialog-backdrop"},s);n.host.append(l);let a=!1,c=()=>{a||(a=!0,l.remove(),p(),n.onClose?.(),n.returnFocus?.())},d=h=>{t.hidden=!h,t.textContent=h??""},u=h=>{r.disabled=h,s.setAttribute("aria-busy",String(h))};s.addEventListener("submit",async h=>{h.preventDefault(),d(null),u(!0);try{let m=n.onSubmit?await n.onSubmit():!0;typeof m=="string"?d(m):m!==!1&&c()}finally{a||u(!1)}}),o.addEventListener("click",c),i.addEventListener("click",c),l.addEventListener("mousedown",h=>{h.target===l&&c()}),s.addEventListener("keydown",h=>{if(h.key==="Escape"&&!h.defaultPrevented)h.preventDefault(),h.stopPropagation(),c();else if(h.key==="Tab"){let m=[...s.querySelectorAll(zt)].filter(x=>!x.hidden),g=m[0],y=m[m.length-1];if(!g||!y)return;h.shiftKey&&te(s)===g?(h.preventDefault(),y.focus()):!h.shiftKey&&te(s)===y&&(h.preventDefault(),g.focus())}}),s.tabIndex=-1,s.addEventListener("click",()=>{!a&&!s.contains(te(s))&&s.focus({preventScroll:!0})});let p=ct(s,"focusin",(h,m)=>{let g=m instanceof Element&&m.closest(".nova-dialog")!==null;!s.contains(m)&&!g&&(s.querySelector(zt)??s).focus()});return(n.initialFocus??s.querySelector(".nova-dialog-body input, .nova-dialog-body textarea")??(n.submitLabel?r:o)).focus(),{el:s,close:c,setError:d,setBusy:u}}function Fe(n){let e=qe("nova-field"),t=n.hint?`${e}-hint`:void 0,r=w("input",{id:e,type:n.type??"text",className:"nova-input",value:n.value??"",placeholder:n.placeholder,required:n.required??!1,autocomplete:n.autocomplete??"off",spellcheck:"false","aria-describedby":t});return r.value=n.value??"",{el:w("div",{className:"nova-field"},w("label",{for:e,className:"nova-label"},n.label),r,n.hint?w("p",{id:t,className:"nova-hint"},n.hint):null),input:r}}function Vc(n,e=!1){let t=qe("nova-check"),r=w("input",{id:t,type:"checkbox",className:"nova-checkbox"});return r.checked=e,{el:w("div",{className:"nova-field nova-field-inline"},r,w("label",{for:t},n)),input:r}}function l0(n){let e=qe("nova-field"),t=w("select",{id:e,className:"nova-input nova-select"},...n.options.map(o=>w("option",{value:o.value},o.label)));return t.value=n.value,{el:w("div",{className:"nova-field"},w("label",{for:e,className:"nova-label"},n.label),t),select:t}}var a0=/^image\/(png|jpe?g|gif|webp|avif|bmp)$/;function oo(n){return a0.test(n.type)}function c0(n){return new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>t(r.error??new Error("FileReader failed")),r.readAsDataURL(n)})}function jc(n,e){let t=null;return n.state.doc.descendants((r,o)=>t!==null?!1:(r.type===X(n.state).image&&r.attrs.src===e&&(t=o),!0)),t}function Yi(n,e,t){let r=e.filter(oo),o=n.view;for(let i of r){let s=URL.createObjectURL(i),l=X(o.state).image.create({src:s,alt:null}),a=o.state.tr;t!==void 0?a.insert(Math.min(t,a.doc.content.size),l):a.replaceSelectionWith(l),o.dispatch(a.scrollIntoView()),Wc(n,i,s,0)}}var Bm=[1e3,3e3],Xi=class extends Error{};function Wc(n,e,t,r){let o=n.view,{t:i}=n.ui,s=n.options.uploadImage,l=s?n.ui.notify({text:i("image.uploading"),timeout:0}):null,a=s?s(e,u=>l?.setText(`${i("image.uploading")} ${Math.round(u)}%`)):c0(e),c=()=>URL.revokeObjectURL(t),d=()=>{let u=o.isDestroyed?null:jc(o,t);u!==null&&o.dispatch(o.state.tr.delete(u,u+1).setMeta("addToHistory",!1)),c()};a.then(u=>{if(!fe(u))throw new Xi(`Unsafe image URL returned: ${u}`);let p=o.isDestroyed?null:jc(o,t);if(p!==null){let f=o.state.doc.nodeAt(p);o.dispatch(o.state.tr.setNodeMarkup(p,void 0,{...f.attrs,src:u}).setMeta("addToHistory",!1))}c()}).catch(u=>{if(o.isDestroyed||jc(o,t)===null)return c();let p=Bm[r];if(s&&p!==void 0&&!(u instanceof Xi)){let f=n.ui.notify({text:i("image.retrying"),timeout:0});setTimeout(()=>{if(f.close(),o.isDestroyed)return c();Wc(n,e,t,r+1)},p);return}console.error("[nova] image upload failed",u),n.ui.notify({text:i("image.uploadFailed"),type:"error",actions:[{label:i("image.retry"),onAction:()=>Wc(n,e,t,0)},{label:i("image.delete"),onAction:d}],onClose:d})}).finally(()=>l?.close())}var Fm=/^data:(image\/(?:png|jpe?g|gif|webp|avif|bmp));base64,(.+)$/i;function zm(n,e="pasted-image"){let t=n.match(Fm);if(!t)return null;let r=t[1].toLowerCase();try{let o=atob(t[2]),i=new Uint8Array(o.length);for(let l=0;l<o.length;l++)i[l]=o.charCodeAt(l);let s=r.split("/")[1].replace("jpeg","jpg");return new File([i],`${e}.${s}`,{type:r})}catch{return null}}function d0(n,e,t){let r=n.state.tr;n.state.doc.descendants((o,i)=>{o.type===X(n.state).image&&o.attrs.src===e&&r.setNodeMarkup(i,void 0,{...o.attrs,src:t})}),r.docChanged&&n.dispatch(r.setMeta("addToHistory",!1))}async function Kc(n,e){let t=n.options.uploadImage,r=t?zm(e):null;if(!t||!r)return;let o=n.ui.notify({text:n.ui.t("image.uploading"),timeout:0});try{let i=await t(r,s=>o.setText(`${n.ui.t("image.uploading")} ${Math.round(s)}%`));if(!fe(i))throw new Error(`Unsafe image URL returned: ${i}`);d0(n.view,e,i)}catch(i){console.error("[nova] embedded image upload failed",i),n.ui.notify({text:n.ui.t("image.uploadFailed"),type:"error",actions:[{label:n.ui.t("image.retry"),onAction:()=>{Kc(n,e)}}]})}finally{o.close()}}function Im(n,e){let t=new Set;return n.descendants(r=>{r.type===e&&Fm.test(r.attrs.src)&&t.add(r.attrs.src)}),t}function Uc(n){return new z({key:new Z("nova-embedded-image-upload"),appendTransaction(e,t,r){if(!n.options.uploadImage||!e.some(a=>["paste","drop"].includes(a.getMeta("uiEvent")))||!e.some(a=>a.docChanged))return null;let i=X(r).image,s=Im(t.doc,i),l=[...Im(r.doc,i)].filter(a=>!s.has(a));return l.length&&queueMicrotask(()=>l.forEach(a=>{Kc(n,a)})),null}})}function Jc(n){return new z({key:new Z("nova-image-drop-paste"),props:{handlePaste(e,t){if(!n.isAllowed("image"))return!1;let r=t.clipboardData;if(!r||r.getData("text/html"))return!1;let o=[...r.files].filter(oo);return o.length?(Yi(n,o),!0):!1},handleDrop(e,t){if(!n.isAllowed("image"))return!1;let r=[...t.dataTransfer?.files??[]].filter(oo);if(!r.length)return!1;t.preventDefault();let o=e.posAtCoords({left:t.clientX,top:t.clientY});return Yi(n,r,o?.pos),!0}}})}function io(n){let{t:e}=n.ui,t=w("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/avif",className:"nova-visually-hidden",tabindex:"-1","aria-label":e("image.drop"),"aria-hidden":"true"}),r=w("button",{type:"button",className:"nova-dropzone"},ee(C.upload),w("span",{},e("image.drop"))),o=Fe({label:e("image.url"),type:"url",placeholder:"https://"}),i=Fe({label:e("image.alt"),hint:e("image.altHint")});ro(n,o,"image",c=>{c.alt&&(i.input.value=c.alt)});let s=w("div",{className:"nova-form"},r,t,w("div",{className:"nova-divider"},w("span",{},e("image.or"))),o.el,i.el),l=n.ui.openDialog({title:e("image.title"),body:s,submitLabel:e("dialog.insert"),initialFocus:o.input,onSubmit:()=>{let c=o.input.value.trim();return!c||!fe(c)?(o.input.setAttribute("aria-invalid","true"),o.input.focus(),e("image.invalid")):(n.exec(Oc(c,i.input.value.trim()||void 0)),!0)}}),a=c=>{let d=c.filter(oo);d.length&&(l.close(),Yi(n,d))};r.addEventListener("click",()=>t.click()),t.addEventListener("change",()=>a([...t.files??[]])),r.addEventListener("dragover",c=>{c.preventDefault(),r.classList.add("is-dragover")}),r.addEventListener("dragleave",()=>r.classList.remove("is-dragover")),r.addEventListener("drop",c=>{c.preventDefault(),r.classList.remove("is-dragover"),a([...c.dataTransfer?.files??[]])})}function Qe(n){let{selection:e}=n,t=X(n),r=(i,s)=>i.type===t.figure?{node:i,pos:s,attrs:{...i.firstChild?.attrs,align:i.attrs.align}}:{node:i,pos:s,attrs:i.attrs};if(e instanceof R&&(e.node.type===t.image||e.node.type===t.figure))return r(e.node,e.from);let{$from:o}=e;for(let i=o.depth;i>0;i--)if(o.node(i).type===t.figure)return r(o.node(i),o.before(i));return null}function Gc(n){return Qe(n)?.node.type===X(n).figure}var u0=["src","alt","title","width","height"],Hm=n=>Object.fromEntries(u0.map(e=>[e,n[e]??null])),Yc=(n,e)=>{let t=Qe(n);if(!t)return!1;let r=X(n),{pos:o,node:i,attrs:s}=t;if(!e)return!0;let l=n.tr;if(i.type===r.figure){let f=r.image.create({...Hm(s),align:s.align??null}),h=[r.paragraph.create(null,f)],m=i.child(1);return m.content.size&&h.push(r.paragraph.create(null,m.content)),l.replaceWith(o,o+i.nodeSize,h),l.setSelection(R.create(l.doc,o+1)),e(l.scrollIntoView()),!0}let a=n.doc.resolve(o),c=a.before(a.depth),d=a.after(a.depth),u=r.figure.create({align:s.align??null},[r.figure_image.create(Hm(s)),r.figcaption.create()]),p=3;return a.parent.childCount===1?(l.replaceWith(c,d,u),l.setSelection(F.create(l.doc,c+p))):(l.insert(d,u),l.delete(o,o+i.nodeSize),l.setSelection(F.create(l.doc,l.mapping.map(d,-1)+p))),e(l.scrollIntoView()),!0},Xc=(n,e)=>{let{$from:t}=n.selection;if(t.parent.type!==X(n).figcaption)return!1;if(e){let r=t.after(t.depth-1),o=n.tr.insert(r,X(n).paragraph.create());o.setSelection(F.create(o.doc,r+1)),e(o.scrollIntoView())}return!0};function ar(n){return(e,t)=>{let r=Qe(e);if(!r)return!1;if(t){let o=e.tr;if(r.node.type===X(e).figure){let{align:i,...s}=n;if(i!==void 0&&o.setNodeMarkup(r.pos,void 0,{...r.node.attrs,align:i}),Object.keys(s).length){let l=r.node.firstChild;o.setNodeMarkup(r.pos+1,void 0,{...l.attrs,...s})}}else o.setNodeMarkup(r.pos,void 0,{...r.node.attrs,...n}),o.setSelection(R.create(o.doc,r.pos));t(o)}return!0}}function Zc(n,e){let t=Qe(n.view.state);if(!t)return!1;if(e===null)return n.exec(ar({width:null,height:null}));let o=n.view.nodeDOM(t.pos)?.querySelector("img")??null,i=getComputedStyle(n.view.dom),s=n.view.dom.clientWidth-parseFloat(i.paddingLeft||"0")-parseFloat(i.paddingRight||"0"),l=Math.max(24,Math.round(s*e)),a=o&&o.naturalWidth?o.naturalHeight/o.naturalWidth:null;return n.exec(ar({width:l,height:a?Math.round(l*a):null}))}function Qc(n){let e=Qe(n.view.state);if(!e)return;let{t}=n.ui,r=Fe({label:t("image.alt"),value:String(e.attrs.alt??""),hint:t("image.altHint")}),o=Fe({label:t("link.tooltip"),value:String(e.attrs.title??"")});n.ui.openDialog({title:t("image.editAlt"),body:w("div",{className:"nova-form"},r.el,o.el),submitLabel:t("dialog.save"),initialFocus:r.input,onSubmit:()=>(n.exec(ar({alt:r.input.value.trim()||null,title:o.input.value.trim()||null})),!0)})}function p0(n){let e=n.dom.ownerDocument.getSelection(),t=e?.focusNode;if(!e||!t||!n.dom.contains(t))return null;try{return n.posAtDOM(t,e.focusOffset)}catch{return null}}function $m(){let n=!0;return new z({props:{handleDOMEvents:{mousedown(e){return n=e.hasFocus(),!1}},handleClick(e,t,r){if(n||r.button!==0||r.shiftKey||r.detail>1)return!1;let{doc:o}=e.state,i=e.posAtCoords({left:r.clientX,top:r.clientY}),s=i&&i.inside>=0?o.nodeAt(i.inside):null;if(s&&!s.isTextblock)return!1;let l=o.resolve(t),a=p0(e);if(a!==null&&o.resolve(a).parent===l.parent)return!1;let c=K.near(l);return e.state.selection.eq(c)||e.dispatch(e.state.tr.setSelection(c).setMeta("pointer",!0)),e.focus(),!0}}})}var so=new Z("nova-announce");function ie(n){return(e,t,r)=>Ke[n](e,t&&(o=>t(o.setMeta(so,n))),r)}var f0=new Set(["bold","italic","underline","strike","code","subscript","superscript","bulletList","orderedList"]),h0=new Set(["paragraph","h1","h2","h3","h4","h5","h6"]),Vm=["alignLeft","alignCenter","alignRight","alignJustify"];function td(n){let{$from:e}=n.selection,t=[];for(let r=1;r<=e.depth;r++){let o=e.node(r),i=o.type.name;i==="bullet_list"?t.push("bulletList"):i==="ordered_list"?t.push("orderedList"):i==="blockquote"?t.push("blockquote"):i==="code_block"?t.push("codeBlock"):i==="heading"&&t.push(`h${Math.min(6,Math.max(1,Number(o.attrs.level)||1))}`)}return t}function m0(n,e,t){if(f0.has(e))return t(lr(n,e)?"announce.on":"announce.off",{name:t(e)});if(h0.has(e)){let r=td(n).filter(o=>/^h[1-6]$/.test(o)).pop();return t(r??"paragraph")}return Vm.includes(e)?t(Vm.find(r=>lr(n,r))??"alignLeft"):t(e)}function g0(n,e,t){let r=td(n),o=td(e),i=o.findIndex((s,l)=>s!==r[l]);return i<0?null:t(o[i])}function qm(n,e){return new z({key:so,state:{init:()=>null,apply(t,r,o,i){let s=t.getMeta(so);return s?{command:s}:i.plugins.some(l=>l.spec.isInputRules&&t.getMeta(l))?{typed:!0}:null}},view:()=>({update(t,r){let o=so.getState(t.state);if(!o||o===so.getState(r))return;let i="command"in o?m0(t.state,o.command,n):g0(r,t.state,n);i&&e(i)}})})}var Wm={options:{},commands:{},events:{}},Km={options:"the option",commands:"the command",events:"the event"},jm=new Set;function Um(n,e){jm.has(n)||(jm.add(n),console.warn(`[nova] ${n} is deprecated: use ${e}. Old names keep working for at least one minor version (https://novaprose.com/project/versioning/).`))}var y0=(n,e)=>Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;function lo(n,e,t=Wm){let r=y0(t[n],e);return r===void 0?e:(Um(`${Km[n]} "${e}"`,`"${r}"`),r)}function Jm(n,e=Wm){let t=n;for(let[r,o]of Object.entries(e.options))Object.prototype.hasOwnProperty.call(n,r)&&(Um(`${Km.options} "${r}"`,`"${o}"`),t===n&&(t={...t}),Object.prototype.hasOwnProperty.call(t,o)||(t[o]=t[r]),delete t[r]);return t}var id={};j(id,{InputRule:()=>et,closeDoubleQuote:()=>Xm,closeSingleQuote:()=>Qm,ellipsis:()=>od,emDash:()=>rd,inputRules:()=>nd,openDoubleQuote:()=>Ym,openSingleQuote:()=>Zm,smartQuotes:()=>x0,textblockTypeInputRule:()=>Zi,undoInputRule:()=>v0,wrappingInputRule:()=>ao});var et=class{constructor(e,t,r={}){this.match=e,this.match=e,this.handler=typeof t=="string"?b0(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}};function b0(n){return function(e,t,r,o){let i=n;if(t[1]){let s=t[0].lastIndexOf(t[1]);i+=t[0].slice(s+t[1].length),r+=s;let l=r-o;l>0&&(i=t[0].slice(s-l,s)+i,r=o)}return e.tr.insertText(i,r,o)}}var k0=500;function nd({rules:n}){let e=new z({state:{init(){return null},apply(t,r){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,o,i){return Gm(t,r,o,i,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:r}=t.state.selection;r&&Gm(t,r.pos,r.pos,"",n,e)})}}},isInputRules:!0});return e}function Gm(n,e,t,r,o,i){if(n.composing)return!1;let s=n.state,l=s.doc.resolve(e),a=n.state.selection,c=l.parent.textBetween(Math.max(0,l.parentOffset-k0),l.parentOffset,null,"\uFFFC")+r,d=e==a.from&&t==a.to&&n.state.storedMarks||(e==t?l.marks():l.marksAcross(s.doc.resolve(t))||[]);for(let u=0;u<o.length;u++){let p=o[u];if(!p.inCodeMark&&d.some(g=>g.type.spec.code))continue;if(l.parent.type.spec.code){if(!p.inCode)continue}else if(p.inCode==="only")continue;let f=p.match.exec(c);if(!f||f[0].length<r.length)continue;let h=e-(f[0].length-r.length);if(!p.inCodeMark){let g=!1;if(s.doc.nodesBetween(h,l.pos,y=>{y.isInline&&y.marks.some(x=>x.type.spec.code)&&(g=!0)}),g)continue}let m=p.handler(s,f,h,t,r);if(m)return p.undoable&&m.setMeta(i,{transform:m,from:e,to:t,text:r}),n.dispatch(m),!0}return!1}var v0=(n,e)=>{let t=n.plugins;for(let r=0;r<t.length;r++){let o=t[r],i;if(o.spec.isInputRules&&(i=o.getState(n))){if(e){let s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a--)s.step(l.steps[a].invert(l.docs[a]));if(i.text){let a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to);e(s)}return!0}}return!1},rd=new et(/--$/,"\u2014",{inCodeMark:!1}),od=new et(/\.\.\.$/,"\u2026",{inCodeMark:!1}),Ym=new et(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),Xm=new et(/"$/,"\u201D",{inCodeMark:!1}),Zm=new et(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),Qm=new et(/'$/,"\u2019",{inCodeMark:!1}),x0=[Ym,Xm,Zm,Qm];function ao(n,e,t,r){let o,i;return e instanceof it?i=e:(o=e,i=e.nodeType,t=e.getAttrs,r=e.joinPredicate),new et(n,(s,l,a,c)=>{let d=t instanceof Function?t(l):t,u=s.tr.delete(a,c),p=u.doc.resolve(a),f=p.blockRange(),h=f&&sn(f,i,d);if(!h)return null;u.wrap(f,h);let m=u.doc.resolve(a-1).nodeBefore;return m&&m.type==i&&at(u.doc,a-1)&&(!r||r(l,m))&&u.join(a-1),u},o)}function Zi(n,e,t){let r,o;return e instanceof it?o=e:(r=e,o=e.nodeType,t=e.getAttrs),new et(n,(i,s,l,a)=>{let c=i.doc.resolve(l),d=t instanceof Function?t(s):t;return c.node(-1).canReplaceWith(c.index(-1),c.indexAfter(-1),o)?i.tr.delete(l,a).setBlockType(l,l,o,d):null},r)}var eg="([A-Za-z0-9_+#.-]{0,32})";function tg(n=()=>!0,e=Ot){let{nodes:t}=e,r=[od,rd];n("blockquote")&&r.push(ao(/^\s*>\s$/,t.blockquote)),n("numlist")&&r.push(ao(/^(\d+)\.\s$/,t.ordered_list,o=>({start:Number(o[1])}),(o,i)=>i.childCount+i.attrs.start===Number(o[1]))),n("bullist")&&r.push(ao(/^\s*([-+*])\s$/,t.bullet_list)),n("codeblock")&&r.push(Zi(new RegExp(`^\`\`\`${eg}\\s$`),t.code_block,o=>({language:o[1]||null})));for(let o=1;o<=6;o++)n(`h${o}`)&&r.push(Zi(new RegExp(`^(#{${o}})\\s$`),t.heading,{level:o}));return nd({rules:r})}function ng(n=()=>!0,e=Ot){let t=new RegExp(`^\`\`\`${eg}$`);return We({Enter:(o,i)=>{let{$from:s,empty:l}=o.selection,a=s.parent;if(!l||a.type!==e.nodes.paragraph||!n("codeblock")||s.parentOffset!==a.content.size||a.childCount!==1)return!1;let c=a.firstChild.isText?t.exec(a.textContent):null;if(!c)return!1;let d=s.index(-1);if(!s.node(-1).canReplaceWith(d,d+1,e.nodes.code_block))return!1;if(i){let u=s.start(),p=o.tr.delete(u,s.pos).setBlockType(u,u,e.nodes.code_block,{language:c[1]||null});i(p.scrollIntoView())}return!0}})}var rg={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",strike:"strike",code:"code",subscript:"subscript",superscript:"superscript",p:"paragraph",paragraph:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock"};function og(n){let e=[];for(let t of n){let r=t;if(!(!r||typeof r.start!="string"||!r.start||r.start.length>40))if(typeof r.replacement=="string")e.push({start:r.start,replacement:r.replacement});else{if(typeof r.format!="string"&&!r.command)continue;typeof r.end=="string"&&r.end,e.push(r)}}return e.sort((t,r)=>r.start.length-t.start.length)}function w0(n){let{$from:e,empty:t}=n.selection;return!t||!e.parent.isTextblock||e.parent.type.spec.code||e.marks().some(r=>r.type.spec.code)?null:e.parent.textBetween(0,e.parentOffset,void 0,"\uFFFC")}function ig(n,e){let{format:t,command:r,value:o}=e;typeof r=="function"?r(n,o):typeof r=="string"?n.exec(r):t&&n.formatter.has(t)?n.formatter.apply(t):t&&rg[t]&&n.exec(rg[t])}function sg(n,e,t){let r=og(e),o=(s,l)=>{if(!t)return r;let{$from:a}=s.state.selection,c=s.nodeDOM(a.before()),d=[];try{d=t({text:l,block:c instanceof HTMLElement?c:null})}catch(u){console.error("[nova] textPatternsLookup failed:",u)}return Array.isArray(d)?og([...r,...d]):r},i=(s,l)=>{let a=w0(s.state);if(a===null||!n.isEditable())return null;let{$from:c}=s.state.selection,d=c.start();for(let u of o(s,a)){if("replacement"in u){if(!a.endsWith(u.start))continue;let f=c.pos-u.start.length;return/<[a-z]/i.test(u.replacement)?(s.dispatch(s.state.tr.delete(f,c.pos)),n.insertContent(u.replacement),s.dispatch(s.state.tr.setStoredMarks([]))):s.dispatch(s.state.tr.insertText(u.replacement,f,c.pos)),"replacement"}if("end"in u){if(!a.endsWith(u.end))continue;let f=a.lastIndexOf(u.start,a.length-u.end.length-1),h=f+u.start.length,m=a.length-u.end.length;if(f<0||m<=h||/^\s|\s$/.test(a.slice(h,m)))continue;let g=s.state.tr.delete(d+m,d+a.length).delete(d+f,d+h),y=d+f,x=y+(m-h);s.dispatch(g.setSelection(F.create(g.doc,y,x))),ig(n,u);let{state:M}=s;return s.dispatch(M.tr.setSelection(F.create(M.doc,M.selection.to))),s.dispatch(s.state.tr.setStoredMarks([])),"inline"}if(!((u.trigger??"space")!==l||!(l==="space"?a===u.start:c.parent.textContent.startsWith(u.start)&&c.parentOffset===c.parent.content.size)))return s.dispatch(s.state.tr.delete(d,d+u.start.length)),ig(n,u),"block"}return null};return new z({props:{handleTextInput(s,l,a,c){if(c!==" "||l!==a)return!1;let d=i(s,"space");return d?(d!=="block"&&s.dispatch(s.state.tr.insertText(" ")),!0):!1},handleKeyDown(s,l){return l.key!=="Enter"||l.shiftKey||l.ctrlKey||l.metaKey||i(s,"enter"),!1}}})}var S0=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),M0=or(bc,(n,e)=>(e?.(n.tr.replaceSelectionWith(X(n).hard_break.create()).scrollIntoView()),!0)),sd=(n,e)=>(t,r,o)=>n(e)(t,r,o);function lg(n=e=>Ke[e]){let e={"Mod-z":sd(n,"undo"),"Shift-Mod-z":sd(n,"redo"),"Mod-b":ie("bold"),"Mod-i":ie("italic"),"Mod-u":ie("underline"),"Mod-Shift-x":ie("strike"),"Mod-e":ie("code"),"Mod-,":ie("subscript"),"Mod-.":ie("superscript"),"Mod-Alt-0":ie("paragraph"),"Mod-Alt-1":ie("h1"),"Mod-Alt-2":ie("h2"),"Mod-Alt-3":ie("h3"),"Mod-Alt-4":ie("h4"),"Mod-Alt-5":ie("h5"),"Mod-Alt-6":ie("h6"),"Mod-Shift-7":ie("orderedList"),"Mod-Shift-8":ie("bulletList"),"Mod-Shift-l":ie("alignLeft"),"Mod-Shift-e":ie("alignCenter"),"Mod-Shift-r":ie("alignRight"),"Mod-Shift-j":ie("alignJustify"),"Mod-\\":ie("clearFormatting"),"Shift-Enter":M0,Enter:or(Xc,(t,r)=>{let i=typeof E0(t)?.attrs.checked=="boolean"?{checked:!1}:void 0;return ci(X(t).list_item,i)(t,r)}),Tab:Tc,"Shift-Tab":Nc,"Mod-]":Ke.indent,"Mod-[":Ke.outdent,"Alt-Shift-ArrowUp":Ke.moveBlockUp,"Alt-Shift-ArrowDown":Ke.moveBlockDown};return S0||(e["Mod-y"]=sd(n,"redo")),[We(e),We(hm)]}function E0(n){let{$from:e}=n.selection;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type===X(n).list_item)return r}return null}var cd={};j(cd,{applyLink:()=>ag,normalizeUrl:()=>ld,openLinkDialog:()=>Dt,removeLink:()=>cr});function ld(n){let e=n.trim();return e?/^[a-z][a-z0-9+.-]*:/i.test(e)||/^[/#?.]/.test(e)?e:/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(e)?`mailto:${e}`:/^(www\.)?[^\s/]+\.[a-z]{2,}([/:?#].*)?$/i.test(e)?`https://${e}`:e:""}function ad(n){let{from:e,to:t,empty:r,$from:o}=n.selection;return r?Cn(n,ce(n).link,o.pos)??{from:e,to:t}:{from:e,to:t}}function ag(n){return(e,t)=>{let r=ld(n.href);if(!r||!Ie(r))return!1;if(!t)return!0;let{from:o,to:i}=ad(e),s=ce(e).link.create({href:r,title:n.title||null,target:n.target||null}),l=e.doc.textBetween(o,i),a=n.text?.trim()?n.text:null,c=e.tr;if(o===i||a!==null&&a!==l){let d=ce(e).link.removeFromSet(e.doc.resolve(o).marks()),u=e.schema.text(a??(l||r),s.addToSet(d));c.replaceWith(o,i,u)}else c.removeMark(o,i,ce(e).link).addMark(o,i,s);return t(c.scrollIntoView()),!0}}function cr(){return(n,e)=>{let{from:t,to:r}=ad(n);return t===r||!n.doc.rangeHasMark(t,r,ce(n).link)?!1:(e?.(n.tr.removeMark(t,r,ce(n).link)),!0)}}function Dt(n){let{t:e}=n.ui,t=n.view.state,r=En(t),o=ad(t),i=t.doc.textBetween(o.from,o.to),s=!i.includes(`
|
|
24
|
+
`)&&t.selection.$from.sameParent(t.doc.resolve(o.to)),l=Fe({label:e("link.url"),type:"url",value:r?.href??"",placeholder:"https://",required:!0}),a=Fe({label:e("link.text"),value:i}),c=Fe({label:e("link.tooltip"),value:r?.title??""}),d=Vc(e("link.newTab"),r?.target==="_blank");ro(n,l,"file",p=>{p.text&&!a.input.value.trim()&&(a.input.value=p.text),p.title&&(c.input.value=p.title)});let u=w("div",{className:"nova-form"},l.el,s?a.el:null,c.el,d.el);n.ui.openDialog({title:e(r?"link.editTitle":"link.title"),body:u,submitLabel:e(r?"dialog.save":"dialog.insert"),initialFocus:l.input,onSubmit:()=>{let p=ld(l.input.value);return!p||!Ie(p)?(l.input.setAttribute("aria-invalid","true"),l.input.focus(),e("link.invalid")):(n.exec(ag({href:p,...s?{text:a.input.value}:{},title:c.input.value.trim()||null,target:d.input.checked?"_blank":null})),!0)}})}function cg(n){return/<img[^>]+src=["']?file:/i.test(n)}var yt=null,Qi=null;function dd(){return Qi??(Qi=import(__novaChunk("tinymce-chunks/paste-office-d6821891.js") ).then(n=>yt=n,()=>(Qi=null,null))),Qi}var C0=new Z("nova-paste");function A0(n){let e=document.createElement("template");e.innerHTML=n;let t=/^(P|DIV|H[1-6]|LI|BLOCKQUOTE|PRE|TR|SECTION|ARTICLE|HEADER|FOOTER)$/,r="",o=i=>{if(i.nodeType===Node.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(!(i instanceof Element)){i.childNodes.forEach(o);return}if(/^(SCRIPT|STYLE|META|TITLE|HEAD)$/.test(i.tagName))return;if(i.tagName==="BR"){r+=`
|
|
15
25
|
`;return}let s=t.test(i.tagName);s&&r&&!r.endsWith(`
|
|
16
26
|
`)&&(r+=`
|
|
17
27
|
`),i.childNodes.forEach(o),s&&(r+=`
|
|
@@ -19,23 +29,20 @@
|
|
|
19
29
|
`).map(i=>i.trim()).join(`
|
|
20
30
|
`).replace(/\n{3,}/g,`
|
|
21
31
|
|
|
22
|
-
`).trim()}function
|
|
32
|
+
`).trim()}function ug(n){let e=!1;return new z({key:C0,props:{transformPasted(t,r){let{selection:o}=r.state,i=o.$from.parent;return t.openStart>0&&o.empty&&i.isTextblock&&i.content.size===0&&t.content.firstChild?.isBlock?new D(t.content,0,t.openEnd):t},transformPastedHTML(t){let{pastePreprocess:r,pastePostprocess:o,pasteStyles:i}=n.options,s=r?r(t,n):t;if(yt&&(s=yt.cleanPastedHTML(s,i??"clean")),o){let l=document.createElement("template");l.innerHTML=s;let a=document.createElement("div");a.append(l.content),o(a,n),s=a.innerHTML}return s},handleDOMEvents:{paste(t,r){if(yt||e||n.isPasteAsText())return!1;let o=r.clipboardData;if(o?.getData(pg))return!1;let i=o?.getData("text/html");if(!i)return!1;let s=cg(i)?o?.getData("text/rtf")??"":"";return r.preventDefault(),dd().then(()=>{if(t.isDestroyed)return;let l=s&&yt&&n.isAllowed("image")?yt.replaceLocalImages(i,yt.extractRtfImages(s)):i;e=!0;try{t.pasteHTML(l)}finally{e=!1}}),!0}},handlePaste(t,r,o){if(e)return!1;let i=a=>{e=!0;try{t.pasteText(a)}finally{e=!1}};if(T0(t,r,n,i))return!0;let s=r.clipboardData?.getData("text/html");if(!n.isPasteAsText()){let a=s&&cg(s)?r.clipboardData?.getData("text/rtf"):"";if(!s||!a||!yt||!n.isAllowed("image"))return!1;let c=yt.replaceLocalImages(s,yt.extractRtfImages(a));if(c===s)return!1;e=!0;try{t.pasteHTML(c,r)}finally{e=!1}return!0}let l=s?A0(s):r.clipboardData?.getData("text/plain")||o.content.textBetween(0,o.content.size,`
|
|
23
33
|
|
|
24
|
-
`);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
pre { white-space: pre-wrap; background: #f5f5f5; padding: 8px; }
|
|
30
|
-
|
|
31
|
-
`});function lh(n){if(n===void 0)return null;let e=new Set;for(let t of n.split(",")){let r=t.trim().replace(/^[-#+!]+/,"").replace(/\[.*$/,"").toLowerCase();for(let o of r.split("/")){let i=o.trim();i&&e.add(ah[i]??i)}}return e}function R1(n){if(n===void 0)return null;let e=typeof n=="string"?n:Object.values(n).join(",");return new Set(e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function Tl(n){let e=[],t=[],r=()=>{t.length&&e.push(t[0].type.schema.nodes.paragraph.create(null,t)),t=[]};return n.forEach(o=>{o.isInline?t.push(o):(r(),e.push(o))}),r(),e}function P1(n){let e=[];return n.forEach(t=>{t.type===t.type.schema.nodes.list_item?t.content.forEach(r=>e.push(r)):e.push(...Tl(A.from(t)))}),e}function I1(n){let e=[];return n.forEach(t=>t.forEach(r=>r.forEach(o=>e.push(o)))),e}function ch(n){return new _({key:B1,appendTransaction(e,t,r){if(!e.some(c=>c.docChanged))return null;let o=t.doc.content.findDiffStart(r.doc.content);if(o===null)return null;let i=t.doc.content.findDiffEnd(r.doc.content)?.b??r.doc.content.size,s=r.doc,l=[];if(s.forEach((c,u)=>{let d=u,f=u+c.nodeSize;if(f<o||d>Math.max(o,i))return;let p=n.normalize(c);p.length===1&&p[0].eq(c)||l.push({from:d,to:f,nodes:p})}),!l.length)return null;let a=r.tr;for(let{from:c,to:u,nodes:d}of l.reverse())d.length?a.replaceWith(c,u,d):a.doc.childCount>1?a.delete(c,u):a.replaceWith(c,u,r.schema.nodes.paragraph.create());return a.setMeta("addToHistory",e.every(c=>c.getMeta("addToHistory")!==!1))}})}var ah,O1,D1,si,B1,uh=P(()=>{"use strict";de();K();ah={b:"strong",i:"em",strike:"s",del:"s",tbody:"table",thead:"table",tfoot:"table",caption:"table",colgroup:"table",col:"table"},O1=["p","h1","h2","h3","h4","h5","h6","blockquote","pre","hr","ul","ol","li","img","br","table","tr","td","th","strong","em","u","s","code","a","sub","sup","span"],D1={bold:["strong"],italic:["em"],underline:["u"],strikethrough:["s"],strike:["s"],inlinecode:["code"],code:["code"],subscript:["sub"],superscript:["sup"],link:["a"],unlink:["a"],quicklink:["a"],image:["img"],quickimage:["img"],table:["table"],quicktable:["table"],inserttable:["table"],tableinsertrowbefore:["table"],tableinsertrowafter:["table"],tabledeleterow:["table"],tableinsertcolbefore:["table"],tableinsertcolafter:["table"],tabledeletecol:["table"],tablemergecells:["table"],tablesplitcells:["table"],tabledelete:["table"],tablerowheader:["th"],tablecolheader:["th"],tablecellbackground:["style:background-color"],bullist:["ul"],bulletlist:["ul"],numlist:["ol"],orderedlist:["ol"],blockquote:["blockquote"],codeblock:["pre"],hr:["hr"],horizontalrule:["hr"],h1:["h1"],h2:["h2"],h3:["h3"],h4:["h4"],h5:["h5"],h6:["h6"],forecolor:["span","style:color"],backcolor:["span","style:background-color"],fontfamily:["span","style:font-family"],fontsize:["span","style:font-size"],lineheight:["style:line-height"],align:["style:text-align"],alignleft:["style:text-align"],aligncenter:["style:text-align"],alignright:["style:text-align"],alignjustify:["style:text-align"],imagealignleft:["style:float"],imagealigncenter:["style:float"],imagealignright:["style:float"]};si=class{tags;styles;constructor(e){let t=lh(e.validElements),r=lh(e.invalidElements)??new Set,o=new Set(t??O1);(o.has("ul")||o.has("ol"))&&o.add("li"),o.has("table")&&(o.add("tr"),o.add("td"));for(let i of r)o.delete(i);o.add("p"),this.tags=o,this.styles=R1(e.validStyles)}isTagAllowed(e){let t=e.toLowerCase();return this.tags.has(ah[t]??t)}isStyleAllowed(e){return!this.styles||this.styles.has(e.toLowerCase())}isAllowed(e){let t=D1[e.toLowerCase()];return t?t.every(r=>r.startsWith("style:")?this.isStyleAllowed(r.slice(6)):this.isTagAllowed(r)):!0}markAllowed(e){switch(e.type.name){case"bold":return this.isTagAllowed("strong");case"italic":return this.isTagAllowed("em");case"underline":return this.isTagAllowed("u");case"strike":return this.isTagAllowed("s");case"code":return this.isTagAllowed("code");case"link":return this.isTagAllowed("a");case"subscript":return this.isTagAllowed("sub");case"superscript":return this.isTagAllowed("sup");case"color":return this.isTagAllowed("span")&&this.isStyleAllowed("color");case"background":return this.isTagAllowed("span")&&this.isStyleAllowed("background-color");case"font_family":return this.isTagAllowed("span")&&this.isStyleAllowed("font-family");case"font_size":return this.isTagAllowed("span")&&this.isStyleAllowed("font-size");default:return!0}}blockAttrs(e){return{...e,...this.isStyleAllowed("text-align")?{}:{align:null},...this.isStyleAllowed("line-height")?{}:{lineHeight:null}}}normalize(e){let t=e.type.schema,{nodes:r}=t;if(e.isText){let l=e.marks.filter(a=>this.markAllowed(a));return[l.length===e.marks.length?e:e.mark(l)]}let o=e.marks.filter(l=>this.markAllowed(l));switch(e.type){case r.image:return this.isTagAllowed("img")?[r.image.create({...e.attrs,...this.isStyleAllowed("float")?{}:{align:null}},null,o)]:[];case r.hard_break:return this.isTagAllowed("br")?[e.mark(o)]:[t.text(" ",o)];case r.horizontal_rule:return this.isTagAllowed("hr")?[e]:[]}let i=this.normalizeChildren(e.content),s=(l=e.type,a=e.attrs)=>{try{return[l.createChecked(a,i,e.marks)]}catch{let c=l.createAndFill(a,i,e.marks);return c?[c]:i.content.length?Tl(i):[]}};switch(e.type){case r.paragraph:return s(r.paragraph,this.blockAttrs(e.attrs));case r.heading:return this.isTagAllowed(`h${e.attrs.level}`)?s(r.heading,this.blockAttrs(e.attrs)):s(r.paragraph,this.blockAttrs({align:e.attrs.align,lineHeight:e.attrs.lineHeight}));case r.blockquote:return this.isTagAllowed("blockquote")?s():Tl(i);case r.code_block:return this.isTagAllowed("pre")?s():e.textContent.split(`
|
|
32
|
-
`).map(l=>r.paragraph.create(null,l?t.text(l):null));case r.bullet_list:case r.ordered_list:return this.isTagAllowed(e.type===r.bullet_list?"ul":"ol")?s(e.type,{...e.attrs,...this.isStyleAllowed("list-style-type")?{}:{listStyle:null}}):P1(i);case r.table:return this.isTagAllowed("table")?s():I1(i);case r.table_header:return this.isTagAllowed("th")?s():s(r.table_cell,e.attrs);case r.table_cell:return s(r.table_cell,{...e.attrs,...this.isStyleAllowed("background-color")?{}:{background:null}});default:return s()}}normalizeChildren(e){let t=[];return e.forEach(r=>t.push(...this.normalize(r))),A.from(t)}normalizeDoc(e){let t=this.normalizeChildren(e.content),r=e.type.schema;return e.type.createAndFill(null,t.size?t:r.nodes.paragraph.create())}};B1=new J("nova-content-rules")});function z1({query:n,caseSensitive:e,wholeWord:t}){if(!n)return null;let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=t?`(?<![\\p{L}\\p{N}_])${r}(?![\\p{L}\\p{N}_])`:r;return new RegExp(o,e?"gu":"giu")}function dh(n,e){let t=z1(e);if(!t)return[];let r=[];return n.descendants((o,i)=>{if(r.length>=Tr)return!1;if(!o.isTextblock)return!0;let s=o.textBetween(0,o.content.size,void 0,H1);t.lastIndex=0;let l;for(;(l=t.exec(s))&&r.length<Tr;){if(l[0].length===0){t.lastIndex+=1;continue}r.push({from:i+1+l.index,to:i+1+l.index+l[0].length})}return!1}),r}function fh(n,e){if(!n.length)return-1;let t=n.findIndex(r=>r.from>=e);return t<0?0:t}function ph(){return new _({key:un,state:{init:()=>Nl,apply(n,e,t,r){let o=n.getMeta(un);if(o?.type==="clear")return Nl;if(o?.type==="set"){let i=dh(r.doc,o.options);return{...o.options,matches:i,current:fh(i,r.selection.from)}}if(o?.type==="goto")return{...e,current:o.index};if(n.docChanged&&e.query){let i=dh(r.doc,e),s=e.matches[e.current]?.from,l=s===void 0?-1:fh(i,n.mapping.map(s));return{...e,matches:i,current:l}}return e}},props:{decorations(n){let e=un.getState(n);return e?.matches.length?Y.create(n.doc,e.matches.map((t,r)=>re.inline(t.from,t.to,{class:r===e.current?"nova-search-match nova-search-current":"nova-search-match"}))):null}}})}function $n(n){return un.getState(n)??Nl}function hh(n){return(e,t)=>(t?.(e.tr.setMeta(un,{type:"set",options:n})),!0)}function F1(n,e,t){return n.setMeta(un,{type:"goto",index:t}).setSelection(H.create(n.doc,e.from,e.to)).scrollIntoView()}function Nr(n=1){return(e,t)=>{let{matches:r,current:o}=$n(e);if(!r.length)return!1;let s=o>=0&&e.selection.from===r[o].from&&e.selection.to===r[o].to||o<0?(Math.max(o,0)+n+r.length)%r.length:o;return t&&t(F1(e.tr,r[s],s)),!0}}function gh(n){return(e,t)=>{let{matches:r,current:o}=$n(e),i=r[o];if(!i)return!1;if(t){let s=e.tr,l=e.doc.resolve(i.from).marksAcross(e.doc.resolve(i.to))??[];n?s.replaceWith(i.from,i.to,e.schema.text(n,l)):s.delete(i.from,i.to);let a=s.mapping.map(i.to);t(s.setSelection(H.create(s.doc,a)).scrollIntoView())}return!0}}function bh(n){return(e,t)=>{let{matches:r}=$n(e);if(!r.length)return!1;if(t){let o=e.tr;for(let i=r.length-1;i>=0;i--){let{from:s,to:l}=r[i],a=e.doc.resolve(s).marksAcross(e.doc.resolve(l))??[];n?o.replaceWith(s,l,e.schema.text(n,a)):o.delete(s,l)}t(o.scrollIntoView())}return!0}}var Tr,H1,un,Nl,mh,Ll=P(()=>{"use strict";K();Rt();Tr=1e4,H1="\uFFFC",un=new J("nova-search"),Nl={query:"",caseSensitive:!1,wholeWord:!1,matches:[],current:-1};mh=(n,e)=>(e?.(n.tr.setMeta(un,{type:"clear"})),!0)});function yh(n,e){let{t}=n.ui,r=Ce("nova-find"),o=Ce("nova-replace"),i=v("input",{id:r,type:"search",className:"nova-input",placeholder:t("search.find"),"aria-label":t("search.find"),autocomplete:"off",spellcheck:"false"}),s=v("input",{id:o,type:"text",className:"nova-input",placeholder:t("search.replace"),"aria-label":t("search.replace"),autocomplete:"off",spellcheck:"false"}),l=v("span",{className:"nova-search-count","aria-live":"polite"}),a=(N,S)=>{let y=v("button",{type:"button",className:"nova-btn nova-search-toggle","aria-pressed":"false","aria-label":N,"data-tooltip":N},S);return n.ui.tooltip.attach(y),y.addEventListener("click",()=>{y.setAttribute("aria-pressed",String(y.getAttribute("aria-pressed")!=="true")),w(),i.focus()}),y},c=a(t("search.matchCase"),"Aa"),u=a(t("search.wholeWord"),"ab|"),d=(N,S,y)=>{let k=v("button",{type:"button",className:"nova-btn","aria-label":S,"data-tooltip":S},X(N));return n.ui.tooltip.attach(k),k.addEventListener("click",y),k},f=d(M.chevronUp,t("search.prev"),()=>{n.exec(Nr(-1)),i.focus()}),p=d(M.chevronDown,t("search.next"),()=>{n.exec(Nr(1)),i.focus()}),h=d(M.close,t("dialog.close"),()=>C.close()),m=v("button",{type:"button",className:"nova-button"},t("search.replaceOne")),g=v("button",{type:"button",className:"nova-button"},t("search.replaceAll"));m.addEventListener("click",()=>{E(),n.exec(gh(s.value)),n.exec(Nr(1)),s.focus()}),g.addEventListener("click",()=>{E(),n.exec(bh(s.value)),s.focus()});let b=v("div",{className:"nova-search",role:"search","aria-label":t("search.title"),hidden:!0},v("div",{className:"nova-search-row"},i,l,c,u,f,p,h),v("div",{className:"nova-search-row"},s,m,g));e.parentElement.insertBefore(b,e);let x=null,w=()=>{x&&clearTimeout(x),x=null,hh({query:i.value,caseSensitive:c.getAttribute("aria-pressed")==="true",wholeWord:u.getAttribute("aria-pressed")==="true"})(n.view.state,n.view.dispatch)},E=()=>{(x||$n(n.view.state).query!==i.value)&&w()};i.addEventListener("input",()=>{x&&clearTimeout(x),x=setTimeout(w,120)}),i.addEventListener("keydown",N=>{N.key==="Enter"&&(N.preventDefault(),E(),n.exec(Nr(N.shiftKey?-1:1)),i.focus())}),s.addEventListener("keydown",N=>{N.key==="Enter"&&(N.preventDefault(),m.click(),s.focus())}),b.addEventListener("keydown",N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),C.close())}),b.addEventListener("mousedown",N=>{N.target.closest("button")&&N.preventDefault()});let D=()=>{if(b.hidden)return;let{matches:N,current:S,query:y}=$n(n.view.state),k=N.length;y?k?l.textContent=t("search.count",{current:S+1,total:k>=Tr?`${Tr}+`:k}):l.textContent=t("search.none"):l.textContent="",b.classList.toggle("is-empty",!!y&&!k);for(let T of[f,p,m,g])T.disabled=!k;m.disabled=!k||!n.isEditable(),g.disabled=!k||!n.isEditable()},C={open(){let N=b.hidden;b.hidden=!1;let{from:S,to:y,empty:k}=n.view.state.selection,T=k?"":n.view.state.doc.textBetween(S,y," ");T&&!T.includes(`
|
|
33
|
-
`)&&T.length<=100&&(i.value=T),(N||T)&&w(),i.focus(),i.select(),D()},close(){b.hidden||(b.hidden=!0,x&&clearTimeout(x),mh(n.view.state,n.view.dispatch),n.focus())},isOpen:()=>!b.hidden,update:D,destroy(){x&&clearTimeout(x),b.remove()}};return C}var vh=P(()=>{"use strict";Ll();Z();j()});function Ol(n){return n.root.classList.contains("nova-fullscreen")}function Lr(n,e=!Ol(n)){n.root.classList.toggle("nova-fullscreen",e),document.documentElement.classList.toggle("nova-fullscreen-lock",e),n.ui.closePopover(),n.updateUI(),n.focus()}function kh(n){let{t:e}=n.ui,t=v("div",{className:"nova-prosemirror nova-preview"});t.append(je.fromSchema(n.schema).serializeFragment(n.view.state.doc.content)),t.querySelectorAll("a[href]").forEach(r=>{r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer")}),n.ui.openDialog({title:e("preview"),body:t,size:"large",cancelLabel:e("dialog.close")})}function $1(n){return n.replace(/(<\/(p|h[1-6]|ul|ol|li|blockquote|pre|table|tbody|tr)>|<hr>)/g,`$1
|
|
34
|
+
`);return l?(i(l),!0):!1}}})}var pg="vscode-editor-data",dg={shellscript:"bash",typescriptreact:"tsx",javascriptreact:"jsx",jsonc:"json"};function T0(n,e,t,r){let o=e.clipboardData,i=o?.getData(pg),s=o?.getData("text/plain");if(!i||!s||n.state.selection.$from.parent.type.spec.code)return!1;let l;try{l=JSON.parse(i).mode}catch{}if(l==="markdown"&&t.hasPlugin("markdown")&&!t.isPasteAsText())return!1;let a=s.replace(/\r\n?/g,`
|
|
35
|
+
`).replace(/\n$/,""),c=n.state.schema.nodes.code_block;if(!a.includes(`
|
|
36
|
+
`)||l==="markdown"||l==="plaintext"||t.isPasteAsText()||!c||!t.isAllowed("codeblock"))return r(a),!0;let d=typeof l=="string"?Object.hasOwn(dg,l)?dg[l]:kn(l):null,u=c.create({language:d},n.state.schema.text(a));return n.dispatch(n.state.tr.replaceSelection(new D(N.from(u),0,0)).setMeta("uiEvent","paste").scrollIntoView()),!0}var yd={};j(yd,{MAX_GRID:()=>dr,createTable:()=>fg,createTableGridPanel:()=>gd,getCellProps:()=>R0,getTableProps:()=>L0,hasHeaderColumn:()=>hd,hasHeaderRow:()=>fd,insertTable:()=>_t,isCellSelection:()=>O0,isInTable:()=>Jt,loadTables:()=>ud,loadedTables:()=>N0,setCellBackground:()=>pd,setCellProps:()=>D0,setTableProps:()=>P0,sortTable:()=>ts,tableCommands:()=>ze,tableRect:()=>md});var xe=null,es=null;function ud(){return es??(es=import(__novaChunk("tinymce-chunks/table-4d43f60d.js") ).then(n=>xe=n,n=>(console.warn("[nova] failed to load table editing",n),es=null,null))),es}function N0(){return xe}var tt=n=>(e,t,r)=>xe?xe.tableCommands[n](e,t,r):!1,ze={addRowBefore:tt("addRowBefore"),addRowAfter:tt("addRowAfter"),deleteRow:tt("deleteRow"),addColumnBefore:tt("addColumnBefore"),addColumnAfter:tt("addColumnAfter"),deleteColumn:tt("deleteColumn"),mergeCells:tt("mergeCells"),splitCell:tt("splitCell"),toggleHeaderRow:tt("toggleHeaderRow"),toggleHeaderColumn:tt("toggleHeaderColumn"),deleteTable:tt("deleteTable")};function pd(n){return(e,t,r)=>xe?xe.setCellBackground(n)(e,t,r):!1}function fd(n){return xe?.hasHeaderRow(n)??!1}function hd(n){return xe?.hasHeaderColumn(n)??!1}function O0(n){return xe?.isCellSelection(n)??!1}function L0(n){return xe?.getTableProps(n)??null}function P0(n){return(e,t,r)=>xe?xe.setTableProps(n)(e,t,r):!1}function R0(n){return xe?.getCellProps(n)??null}function D0(n){return(e,t,r)=>xe?xe.setCellProps(n)(e,t,r):!1}function ts(n,e){return(t,r,o)=>xe?xe.sortTable(n,e)(t,r,o):!1}var dr=10;function md(n){let{$from:e}=n.view.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole==="table")return n.view.nodeDOM(e.before(t))?.getBoundingClientRect()??null;return null}function fg(n,e,t=!0,r=Ot){let{table:o,table_row:i,table_cell:s,table_header:l,paragraph:a}=r.nodes,c=[];for(let d=0;d<n;d++){let u=t&&d===0?l:s,p=[];for(let f=0;f<e;f++)p.push(u.create(null,a.create()));c.push(i.create(null,p))}return o.create(null,c)}function _t(n,e,t=!0){return(r,o)=>{if(n<1||e<1||n>100||e>50||Jt(r))return!1;if(o){let i=fg(n,e,t,r.schema),s=Hi(r.tr,i),l=-1;s.doc.descendants((a,c)=>(a===i&&(l=c),l<0)),l>=0&&s.setSelection(F.near(s.doc.resolve(l+3))),o(s.scrollIntoView())}return!0}}function gd(n,e,t){let r=1,o=1,i=[],s=w("div",{className:"nova-grid-caption","aria-live":"polite"}),l=w("div",{className:"nova-grid",role:"grid","aria-label":t}),a=()=>{for(let c of i){let d=Number(c.dataset.row),u=Number(c.dataset.col);c.classList.toggle("is-on",d<=r&&u<=o),c.tabIndex=d===r&&u===o?0:-1}s.textContent=e(r,o)};for(let c=1;c<=dr;c++)for(let d=1;d<=dr;d++){let u=w("button",{type:"button",className:"nova-grid-cell",role:"gridcell","aria-label":e(c,d),"data-row":String(c),"data-col":String(d)});u.addEventListener("mouseenter",()=>{r=c,o=d,a()}),u.addEventListener("click",()=>n(c,d)),i.push(u),l.append(u)}return l.addEventListener("keydown",c=>{let u={ArrowRight:[0,1],ArrowLeft:[0,-1],ArrowDown:[1,0],ArrowUp:[-1,0]}[c.key];u&&(c.preventDefault(),r=Math.min(dr,Math.max(1,r+u[0])),o=Math.min(dr,Math.max(1,o+u[1])),a(),i[(r-1)*dr+(o-1)].focus())}),a(),w("div",{className:"nova-grid-panel"},l,s)}var wd={};j(wd,{createRenderer:()=>kg,htmlSerializer:()=>fr,isRtlLanguage:()=>rs,renderHTML:()=>q0,sanitizeJSON:()=>co,schemaFromOptions:()=>is});var hg={b:"strong",i:"em",strike:"s",del:"s",tbody:"table",thead:"table",tfoot:"table",caption:"table",colgroup:"table",col:"table",figcaption:"figure"},_0=["p","h1","h2","h3","h4","h5","h6","blockquote","pre","hr","ul","ol","li","img","figure","br","table","tr","td","th","strong","em","u","s","code","a","sub","sup","span"];var I0={bold:["strong"],italic:["em"],underline:["u"],strikethrough:["s"],strike:["s"],inlinecode:["code"],code:["code"],subscript:["sub"],superscript:["sup"],link:["a"],unlink:["a"],quicklink:["a"],image:["img"],quickimage:["img"],table:["table"],quicktable:["table"],inserttable:["table"],tableinsertrowbefore:["table"],tableinsertrowafter:["table"],tabledeleterow:["table"],tableinsertcolbefore:["table"],tableinsertcolafter:["table"],tabledeletecol:["table"],tablemergecells:["table"],tablesplitcells:["table"],tabledelete:["table"],tablerowheader:["th"],tablecolheader:["th"],tablecellbackground:["style:background-color"],bullist:["ul"],checklist:["ul"],accordion:["details"],bulletlist:["ul"],numlist:["ol"],orderedlist:["ol"],blockquote:["blockquote"],codeblock:["pre"],hr:["hr"],horizontalrule:["hr"],h1:["h1"],h2:["h2"],h3:["h3"],h4:["h4"],h5:["h5"],h6:["h6"],forecolor:["span","style:color"],backcolor:["span","style:background-color"],fontfamily:["span","style:font-family"],fontsize:["span","style:font-size"],lineheight:["style:line-height"],align:["style:text-align"],alignleft:["style:text-align"],aligncenter:["style:text-align"],alignright:["style:text-align"],alignjustify:["style:text-align"],imagealignleft:["style:float"],imagealigncenter:["style:float"],imagealignright:["style:float"]};function bd(n){if(n===void 0)return null;let e=new Set;for(let t of n.split(",")){let r=t.trim().replace(/^[-#+!]+/,"").replace(/\[.*$/,"").toLowerCase();for(let o of r.split("/")){let i=o.trim();i&&e.add(hg[i]??i)}}return e}function H0(n){if(n===void 0)return null;let e=typeof n=="string"?n:Object.values(n).join(",");return new Set(e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}var ur=class{constructor(e){S(this,"tags");S(this,"styles");let t=bd(e.validElements),r=bd(e.invalidElements)??new Set,o=new Set(t??_0);if(t)for(let i of bd(e.extendedValidElements)??[])o.add(i);(o.has("ul")||o.has("ol"))&&o.add("li"),o.has("table")&&(o.add("tr"),o.add("td"));for(let i of r)o.delete(i);o.add("p"),this.tags=o,this.styles=H0(e.validStyles)}isTagAllowed(e){let t=e.toLowerCase();return this.tags.has(hg[t]??t)}isStyleAllowed(e){return!this.styles||this.styles.has(e.toLowerCase())}isAllowed(e){let t=I0[e.toLowerCase()];return t?t.every(r=>r.startsWith("style:")?this.isStyleAllowed(r.slice(6)):this.isTagAllowed(r)):!0}markAllowed(e){switch(e.type.name){case"bold":return this.isTagAllowed("strong");case"italic":return this.isTagAllowed("em");case"underline":return this.isTagAllowed("u");case"strike":return this.isTagAllowed("s");case"code":return this.isTagAllowed("code");case"link":return this.isTagAllowed("a");case"subscript":return this.isTagAllowed("sub");case"superscript":return this.isTagAllowed("sup");case"color":return this.isTagAllowed("span")&&this.isStyleAllowed("color");case"background":return this.isTagAllowed("span")&&this.isStyleAllowed("background-color");case"font_family":return this.isTagAllowed("span")&&this.isStyleAllowed("font-family");case"font_size":return this.isTagAllowed("span")&&this.isStyleAllowed("font-size");default:return!0}}blockAttrs(e){return{...e,...this.isStyleAllowed("text-align")?{}:{align:null},...this.isStyleAllowed("line-height")?{}:{lineHeight:null},...this.isStyleAllowed("margin-left")?{}:{indent:0}}}normalize(e){let t=e.type.schema,{nodes:r}=t;if(e.isText){let l=e.marks.filter(a=>this.markAllowed(a));return[l.length===e.marks.length?e:e.mark(l)]}let o=e.marks.filter(l=>this.markAllowed(l));switch(e.type){case r.image:return this.isTagAllowed("img")?[r.image.create({...e.attrs,...this.isStyleAllowed("float")?{}:{align:null}},null,o)]:[];case r.figure:{let l=e.childCount>1?e.child(1).content:null,a=l?.size?[r.paragraph.create(null,this.normalizeChildren(l))]:[],c=e.firstChild;if(!this.isTagAllowed("img")||!c)return a;let d=this.isStyleAllowed("float")?e.attrs.align:null;if(!this.isTagAllowed("figure")){let u=r.image.create({...c.attrs,align:d});return[r.paragraph.create(null,u),...a]}return[r.figure.create({...e.attrs,align:d},e.content)]}case r.hard_break:return this.isTagAllowed("br")?[e.mark(o)]:[t.text(" ",o)];case r.horizontal_rule:return this.isTagAllowed("hr")?[e]:[]}let i=this.normalizeChildren(e.content),s=(l=e.type,a=e.attrs)=>{try{return[l.createChecked(a,i,e.marks)]}catch{let c=l.createAndFill(a,i,e.marks);return c?[c]:i.content.length?kd(i):[]}};if(e.type.name==="details"&&!this.isTagAllowed("details")){let l=[];return i.forEach(a=>{a.type.name!=="details_summary"?l.push(a):a.content.size&&l.push(r.paragraph.create(null,a.content))}),l}switch(e.type){case r.paragraph:return s(r.paragraph,this.blockAttrs(e.attrs));case r.heading:return this.isTagAllowed(`h${e.attrs.level}`)?s(r.heading,this.blockAttrs(e.attrs)):s(r.paragraph,this.blockAttrs({align:e.attrs.align,lineHeight:e.attrs.lineHeight}));case r.blockquote:return this.isTagAllowed("blockquote")?s():kd(i);case r.code_block:return this.isTagAllowed("pre")?s():e.textContent.split(`
|
|
37
|
+
`).map(l=>r.paragraph.create(null,l?t.text(l):null));case r.bullet_list:case r.ordered_list:return this.isTagAllowed(e.type===r.bullet_list?"ul":"ol")?s(e.type,{...e.attrs,...this.isStyleAllowed("list-style-type")?{}:{listStyle:null}}):B0(i);case r.table:return this.isTagAllowed("table")?s():F0(i);case r.table_header:return this.isTagAllowed("th")?s():s(r.table_cell,e.attrs);case r.table_cell:return s(r.table_cell,{...e.attrs,...this.isStyleAllowed("background-color")?{}:{background:null}});default:return s()}}normalizeChildren(e){let t=[];return e.forEach(r=>t.push(...this.normalize(r))),N.from(t)}normalizeDoc(e){let t=this.normalizeChildren(e.content),r=e.type.schema;return e.type.createAndFill(e.attrs,t.size?t:r.nodes.paragraph.create())}};function kd(n){let e=[],t=[],r=()=>{t.length&&e.push(t[0].type.schema.nodes.paragraph.create(null,t)),t=[]};return n.forEach(o=>{o.isInline?t.push(o):(r(),e.push(o))}),r(),e}function B0(n){let e=[];return n.forEach(t=>{t.type===t.type.schema.nodes.list_item?t.content.forEach(r=>e.push(r)):e.push(...kd(N.from(t)))}),e}function F0(n){let e=[];return n.forEach(t=>t.forEach(r=>r.forEach(o=>e.push(o)))),e}var z0=new Z("nova-content-rules");function mg(n){return new z({key:z0,appendTransaction(e,t,r){if(!e.some(c=>c.docChanged))return null;let o=t.doc.content.findDiffStart(r.doc.content);if(o===null)return null;let i=t.doc.content.findDiffEnd(r.doc.content)?.b??r.doc.content.size,s=r.doc,l=[];if(s.forEach((c,d)=>{let u=d,p=d+c.nodeSize;if(p<o||u>Math.max(o,i))return;let f=n.normalize(c);f.length===1&&f[0].eq(c)||l.push({from:u,to:p,nodes:f})}),!l.length)return null;let a=r.tr;for(let{from:c,to:d,nodes:u}of l.reverse())u.length?a.replaceWith(c,d,u):a.doc.childCount>1?a.delete(c,d):a.replaceWith(c,d,r.schema.nodes.paragraph.create());return a.setMeta("addToHistory",e.every(c=>c.getMeta("addToHistory")!==!1))}})}var ns="data-nova-own-style",vd=null;function xd(n){vd=n}var gg=!1;function yg(n){return!!n.extendedValidElements||!!n.customElements||/\[/.test(n.validElements??"")?vd?vd.create(n):(gg||(gg=!0,console.warn("[nova] attribute lists, extendedValidElements and customElements need: import { htmlRules } from '@novaprose/core/html-rules'; registerHtmlRules(htmlRules);")),null):null}var fr=new Xr,$0=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb"]);function rs(n){return!!n&&$0.has(n.toLowerCase().split(/[-_]/)[0])}function pr(n,e){console.error(`[nova] ${n}`,...e===void 0?[]:[e])}function is(n,e,t,r){let o=new Set([...no(Object.values(n.formats??{}).flat()),...no(n.styleFormats??[]),...Array.isArray(n.validClasses)?n.validClasses:[],...[...n.tableClassList??[],...n.tableCellClassList??[]].flatMap(u=>u.value.split(/\s+/).filter(Boolean))]),i=yg(n),l=n.validClasses===!0||n.validClasses===void 0&&!!i?.classOnBuiltIn?()=>!0:u=>o.has(u),a={},c={},d={};for(let u of e){Object.assign(d,u.nodeAttributes);let p;try{p=typeof u.nodes=="function"?u.nodes(r):u.nodes}catch(f){pr(`Plugin "${u.name}" failed to define its nodes`,f)}for(let[f,h]of Object.entries(p??{}))f in a?pr(`Node "${f}" is defined by several plugins`):a[f]=h;for(let[f,h]of Object.entries(u.marks??{}))f in c?pr(`Mark "${f}" is defined by several plugins`):c[f]=h}try{return{schema:vi({nodes:a,marks:c,attributes:d},l,i,t),allowedClasses:o}}catch(u){return pr("Failed to build the document schema from plugins",u),{schema:vi({},l,i,t),allowedClasses:o}}}function V0(n,e){let t=n?.validate;if(!t)return!0;if(typeof t=="function")try{return t(e),!0}catch{return!1}let r=e===null?"null":typeof e;return t.split("|").includes(r)}function bg(n,e){return!e||typeof e!="object"||!n?e:Object.fromEntries(Object.entries(e).filter(([t,r])=>V0(n[t],r)))}function co(n,e){let t=n.nodes[e.type],r={...e};return t&&(r.attrs=bg(t.spec.attrs,e.attrs)),Array.isArray(e.marks)&&(r.marks=e.marks.map(o=>{let i=o&&n.marks[o.type];return i?{...o,attrs:bg(i.spec.attrs,o.attrs)}:o})),Array.isArray(e.content)&&(r.content=e.content.map(o=>o&&typeof o=="object"?co(n,o):o)),r}function kg(n={}){let e=br(n.plugins??[]);e.errors.forEach(d=>pr(d));let{ordered:t,errors:r}=On(e.plugins);r.forEach(d=>pr(d));let o=n.direction??(rs(n.language)?"rtl":"ltr"),{schema:i}=is(n,t,o,{options:n}),l=n.validElements!==void 0||n.invalidElements!==void 0||n.validStyles!==void 0?new ur(n):null,a=d=>{let u=Te.fromJSON(i,co(i,d));return l?l.normalizeDoc(u):u},c=yr(t,{options:n});return{schema:i,doc:a,html:(d,{fullPage:u=!0}={})=>{let p=a(d),f=fr.serializeFragment(p.content);return c&&u?c.write(f,p.attrs):f},text:d=>{let u=a(d);return u.textBetween(0,u.content.size,`
|
|
38
|
+
|
|
39
|
+
`)}}}function q0(n,e={}){return kg(e).html(n)}var Sd=new WeakSet,Md=new WeakMap,vg=new WeakSet;function Ed(n){for(let e of n){let t=e.spec,r=t.view;!r||vg.has(e)||(vg.add(e),t.view=o=>{let i=Md.get(o);i||Md.set(o,i=new Map);let s=i.get(e);s||i.set(e,s=r(o));let l=s;return{update:(a,c)=>l.update?.(a,c),destroy:()=>{Sd.has(o)||(i.delete(e),l.destroy?.())}}})}}function Cd(n,e){Ed(e),Sd.add(n);try{n.updateState(n.state.reconfigure({plugins:e}))}finally{Sd.delete(n)}let t=Md.get(n);if(t)for(let[r,o]of t)e.includes(r)||(t.delete(r),o.destroy?.())}var Nd={};j(Nd,{CELL_BG_ATTR:()=>wg,novaParser:()=>K0,parserFor:()=>hr,preprocessDOM:()=>Sg});var wg="data-nova-cell-bg",Ad="http://www.w3.org/1999/xhtml",j0="http://www.w3.org/1998/Math/MathML";function W0(n){let e=[...n.querySelectorAll("*")].filter(t=>t.namespaceURI!==Ad&&(t.parentElement?.namespaceURI??Ad)===Ad);for(let t of e){let r=t.namespaceURI===j0?t.textContent??"":"";t.replaceWith(t.ownerDocument.createTextNode(r))}}function Sg(n){W0(n),n.querySelectorAll("td, th").forEach(e=>{if(!e.style)return;let t=e.style.backgroundColor;t&&(e.setAttribute(wg,t),e.style.removeProperty("background-color"),e.getAttribute("style")||e.removeAttribute("style"))})}var Td=class extends St{constructor(){super(...arguments);S(this,"atomSelector");S(this,"ownStyleSelector")}prepare(t){Sg(t),this.ownStyleSelector??(this.ownStyleSelector=Object.values(this.schema.nodes).flatMap(r=>r.spec.ownStyleTags??[]).join(", ")),this.ownStyleSelector&&"querySelectorAll"in t&&t.querySelectorAll(this.ownStyleSelector).forEach(r=>{let o=r.getAttribute("style");o!==null&&(r.setAttribute(ns,o),r.removeAttribute("style"))}),this.atomSelector??(this.atomSelector=Object.values(this.schema.nodes).filter(r=>r.spec.ignoreStyles).flatMap(r=>(r.spec.parseDOM??[]).map(o=>o.tag)).filter(r=>!!r).join(", ")),!(!this.atomSelector||!("querySelectorAll"in t))&&t.querySelectorAll(this.atomSelector).forEach(r=>{r.removeAttribute("style")})}parse(t,r){return this.prepare(t),super.parse(t,r)}parseSlice(t,r){return this.prepare(t),super.parseSlice(t,r)}},xg=new WeakMap;function hr(n){let e=xg.get(n);return e||(e=new Td(n,St.fromSchema(n).rules),xg.set(n,e)),e}var K0=hr(Ot);var Od={};j(Od,{createMenu:()=>uo,focusMenu:()=>po});function uo(n,e,t){let r=[],o=w("div",{className:"nova-menu",role:"menu","aria-label":t}),i=n.some(a=>(a.type===void 0||a.type==="item")&&a.active!==void 0);for(let a of n){if(a.type==="separator"){o.append(w("div",{className:"nova-menu-sep",role:"separator"}));continue}if(a.type==="heading"){o.append(w("div",{className:"nova-menu-heading",role:"presentation"},a.label));continue}let c=w("span",{className:"nova-menu-label"},a.label);a.labelStyle&&c.setAttribute("style",a.labelStyle);let d=w("button",{type:"button",className:"nova-menu-item",role:a.active===void 0?"menuitem":a.checkbox?"menuitemcheckbox":"menuitemradio",tabindex:"-1","data-id":a.id,disabled:a.disabled??!1,...a.active!==void 0?{"aria-checked":String(a.active)}:{}},i?w("span",{className:"nova-menu-check"},a.active?ee(C.check):null):null,a.icon?ee(a.icon):null,c,a.shortcut?w("kbd",{className:"nova-menu-shortcut"},Ct(a.shortcut)):null);d.addEventListener("click",()=>{e(),a.onSelect()}),r.push(d),o.append(d)}let s=()=>r.filter(a=>!a.disabled),l=a=>{let c=s();c.length&&c[(a+c.length)%c.length].focus()};return o.addEventListener("keydown",a=>{let c=s(),d=c.indexOf(te(o));switch(a.key){case"ArrowDown":a.preventDefault(),l(d+1);break;case"ArrowUp":a.preventDefault(),l(d-1);break;case"Home":a.preventDefault(),l(0);break;case"End":a.preventDefault(),l(c.length-1);break;case"Tab":a.preventDefault();break;default:if(a.key.length===1&&/\S/.test(a.key)){let u=a.key.toLowerCase(),p=d+1;[...c.slice(p),...c.slice(0,p)].find(h=>h.textContent?.trim().toLowerCase().startsWith(u))?.focus()}}}),o}function po(n){(n.querySelector('[aria-checked="true"]:not(:disabled)')??n.querySelector(".nova-menu-item:not(:disabled)"))?.focus()}var Mg={file:{title:"menu.file",items:"save cancel | fullpagehtml | importword exportword exportpdf | preview | print"},edit:{title:"menu.edit",items:"undo redo | selectall | searchreplace pastetext"},view:{title:"menu.view",items:"code preview | fullscreen | visualblocks visualchars"},insert:{title:"menu.insert",items:"image link media pageembed inserttable hr | insertdatetime template footnotes"},format:{title:"menu.format",items:"bold italic underline strikethrough superscript subscript inlinecode | paragraph h1 h2 h3 blockquote codeblock | alignleft aligncenter alignright alignjustify | lowercase uppercase titlecase | formatpainter permanentpen configurepermanentpen | removeformat"},table:{title:"menu.table",items:"inserttable | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | advtablesort advtablerownumbering | tabledelete"},tools:{title:"menu.tools",items:"spellchecker spellcheckdialog | autocorrect capitalization typography | linkchecker a11ycheck"},help:{title:"menu.help",items:"help"}},Eg="file edit view insert format table help";function Cg(n,e,t,r){let{t:o}=n.ui;e.className="nova-menubar",e.setAttribute("role","menubar"),e.setAttribute("aria-label",o("menu.label"));let i=new AbortController,{signal:s}=i,l=f=>f.title.startsWith("menu.")?o(f.title):f.title,a=f=>{let h=[];for(let m of f.items.split(/\s+/)){if(!m)continue;if(m==="|"){h.length&&h[h.length-1].type!=="separator"&&h.push({type:"separator"});continue}if(!n.isAllowed(m))continue;let g=n.ui.registry.getMenuItem(m);g&&h.push({id:m,label:g.text,...g.icon?{icon:g.icon}:{},...g.shortcut?{shortcut:g.shortcut}:{},...g.isActive?{active:g.isActive(n),checkbox:!0}:{},disabled:!n.isEditable()||(g.isEnabled?!g.isEnabled(n):!1),onSelect:()=>g.onAction(n)})}for(;h.length&&h[h.length-1].type==="separator";)h.pop();return h},c=[],d=null,u=()=>{d?.popover.close(),d=null},p=(f,h)=>{u();let m=c[f],g=r[m.dataset.menu],y=a(g);if(!y.length)return;let x=uo(y,()=>n.ui.closePopover(),l(g));x.addEventListener("keydown",L=>{let O=Ne(L,x);if(O!=="ArrowLeft"&&O!=="ArrowRight")return;L.preventDefault();let B=(f+(O==="ArrowRight"?1:-1)+c.length)%c.length;p(B,!0)}),m.setAttribute("aria-expanded","true");let M=n.ui.openPopover({anchor:m,content:x,ignore:[e],className:"nova-popover-menu",onClose:L=>{m.setAttribute("aria-expanded","false"),d?.popover===M&&(d=null),L==="escape"&&m.focus()}});d={index:f,popover:M},h&&po(x)};for(let f of t.split(/\s+/).filter(Boolean)){let h=r[f];if(!h)continue;let m=w("button",{type:"button",className:"nova-menubar-item",role:"menuitem","aria-haspopup":"menu","aria-expanded":"false","data-menu":f,tabindex:c.length===0?"0":"-1"},l(h)),g=c.length;m.addEventListener("click",y=>{if(d?.index===g)return u();p(g,y.detail===0)}),m.addEventListener("mouseenter",()=>{d&&d.index!==g&&p(g,!1)}),c.push(m),e.append(m)}return e.addEventListener("keydown",f=>{let h=c.indexOf(te(e));if(h<0)return;let m=y=>{f.preventDefault();let x=(y+c.length)%c.length;c.forEach((M,L)=>M.tabIndex=L===x?0:-1),c[x].focus()},g=Ne(f,e);g==="ArrowRight"?m(h+1):g==="ArrowLeft"?m(h-1):f.key==="Home"?m(0):f.key==="End"?m(c.length-1):f.key==="ArrowDown"?(f.preventDefault(),p(h,!0)):f.key==="Escape"&&(f.preventDefault(),n.focus())},{signal:s}),e.addEventListener("mousedown",f=>{f.target.closest("button")&&f.preventDefault()},{signal:s}),{focus:()=>(c.find(f=>f.tabIndex===0)??c[0])?.focus(),destroy:()=>{u(),i.abort(),e.replaceChildren()}}}function U0(n){import(__novaChunk("tinymce-chunks/print-86762549.js") ).then(e=>e.print(n),e=>console.error("[nova] print: could not load the print module",e))}function J0(n){let{t:e}=n.ui,t=Fe({label:e("table.rows"),value:"3"}),r=Fe({label:e("table.cols"),value:"3"});for(let o of[t,r])o.input.type="number",o.input.min="1",o.input.max="50",o.input.inputMode="numeric";n.ui.openDialog({title:e("table.insert"),body:w("div",{className:"nova-form nova-form-row"},t.el,r.el),submitLabel:e("dialog.insert"),initialFocus:t.input,onSubmit:()=>{let o=Number(t.input.value),i=Number(r.input.value);return!Number.isInteger(o)||!Number.isInteger(i)||o<1||i<1||o>50||i>50?e("table.invalidSize"):(n.exec(_t(o,i)),!0)}})}function Ag(n){let{registry:e,t}=n.ui;e.addToggleMenuItem("paragraph",{text:t("paragraph"),icon:C.paragraph,shortcut:"Mod-Alt-0",isActive:r=>r.view.state.selection.$from.parent.type.name==="paragraph",onAction:r=>r.exec("paragraph")}),e.addMenuItem("selectall",{text:t("selectAll"),shortcut:"Mod-a",onAction:r=>{r.view.dispatch(r.view.state.tr.setSelection(new ue(r.view.state.doc))),r.focus()}}),e.addMenuItem("print",{text:t("print"),icon:C.print,shortcut:"Mod-p",onAction:r=>U0(r)}),e.addMenuItem("inserttable",{text:t("table.insert"),icon:C.table,isEnabled:r=>r.can(_t(1,1)),onAction:r=>J0(r)})}function G0(n,e){let{selection:t,doc:r,storedMarks:o}=e;return Object.create(n,{doc:{get:()=>r},selection:{get:()=>t},storedMarks:{get:()=>o},tr:{get:()=>({selection:t,doc:r,storedMarks:o}=e,e)}})}function Tg(n){console.warn(`[nova] chain: ${n}`)}function Ng(n){let e=[],t=o=>{let i=n.view();if(!i)return!1;let{state:s}=i,l=s.tr;for(let a of e){let c=!1,d=u=>{u!==l&&(c=!0)};if(!a(G0(s,l),d,i))return!1;if(c)return Tg("a command dispatched its own transaction; build it from state.tr"),!1}return o&&(i.dispatch(l),i.focus()),!0},r={exec(o){return o==="undo"||o==="redo"?(Tg(`"${o}" runs on its own \u2014 use editor.exec()`),e.push(()=>!1)):e.push(typeof o=="string"?n.resolve(o):o),r},insertContent(o){return e.push(n.insertContent(o)),r},run:()=>t(!0),can:()=>t(!1)};return r}var Rd={};j(Rd,{pages:()=>An,setSourceHTML:()=>Pd,sourceHTML:()=>Ld});var An=new WeakMap;function Ld(n){return n.getHTML({fullPage:An.get(n)?.inSource!==!1})}function Pd(n,e){n.setContent(e,{fullPage:An.get(n)?.inSource!==!1})}var Y0=200,fo=new Z("nova-bookmarks");function Og(){return new z({key:fo,state:{init:()=>new Map,apply(n,e){let t=n.getMeta(fo);if(t)return t;if(!n.docChanged||!e.size)return e;let r=new Map;for(let[o,i]of e){let s=n.mapping.mapResult(i.from,1),l=n.mapping.mapResult(i.to,-1);r.set(o,{from:s.pos,to:Math.max(s.pos,l.pos),gone:i.gone||i.from!==i.to&&s.pos>=l.pos})}return r}}})}var X0=1;function Lg(n){let e=()=>n.view,t=i=>{let s=e().state.doc.content.size,l=typeof i=="number"&&Number.isFinite(i)?Math.round(i):0;return Math.max(0,Math.min(l,s))},r=i=>i instanceof Node&&i!==e().dom&&e().dom.contains(i),o={getRange(){let{from:i,to:s}=e().state.selection;return{from:i,to:s}},setRange(i,s=i){let{state:l,dispatch:a}=e(),c=F.between(l.doc.resolve(t(i)),l.doc.resolve(t(s)));a(l.tr.setSelection(c))},isCollapsed:()=>e().state.selection.empty,collapse(i=!1){let{from:s,to:l}=e().state.selection;o.setRange(i?s:l)},selectAll(){let{state:i,dispatch:s}=e();s(i.tr.setSelection(new ue(i.doc)))},getHTML(){let{selection:i}=e().state;return i.empty?"":fr.serializeFragment(i.content().content)},getText(){let{state:i}=e();return i.doc.textBetween(i.selection.from,i.selection.to,`
|
|
40
|
+
`)},setHTML:i=>n.insertContent(i),getNode(){let i=e(),{selection:s}=i.state;if(s instanceof R){let c=i.nodeDOM(s.from);if(c instanceof HTMLElement)return c}let l=(c,d)=>{let{node:u}=i.domAtPos(c,d);return u instanceof HTMLElement?u:u.parentElement},a=l(s.from,s.empty?0:1);if(!s.empty){let c=l(s.to,-1);for(;a&&c&&!a.contains(c);)a=a.parentElement}return a&&i.dom.contains(a)?a:null},select(i,s=!1){if(!r(i))return;let l=e(),{doc:a}=l.state,c=l.posAtDOM(i,0);for(let d of[c-1,c]){if(d<0||d>=a.content.size)continue;let u=a.nodeAt(d);if(!u||u.isText)continue;let p=l.nodeDOM(d);if(!(p!==i&&!(u.isLeaf&&p instanceof Node&&p.contains(i)))){u.isLeaf||!s&&R.isSelectable(u)?l.dispatch(l.state.tr.setSelection(R.create(a,d))):o.setRange(d+1,d+u.nodeSize-1);return}}o.setRange(c,l.posAtDOM(i,i.childNodes.length))},setCursorLocation(i,s=0){if(!r(i))return;let l=i.nodeType===3?i.length:i.childNodes.length;o.setRange(e().posAtDOM(i,Math.max(0,Math.min(s,l))))},getDOMRange(){let i=e();if(!i.dom.isConnected)return null;let{from:s,to:l}=i.state.selection;try{let a=i.domAtPos(s),c=i.domAtPos(l),d=document.createRange();return d.setStart(a.node,a.offset),d.setEnd(c.node,c.offset),d}catch{return null}},getRect(){let i=e();if(!i.dom.isConnected)return null;let{from:s,to:l,empty:a}=i.state.selection;try{if(!a){let f=o.getDOMRange()?.getBoundingClientRect?.();if(f&&(f.width||f.height))return f}let c=i.coordsAtPos(s),d=a?c:i.coordsAtPos(l),u=Math.min(c.left,d.left),p=Math.min(c.top,d.top);return new DOMRect(u,p,Math.max(c.right,d.right)-u,Math.max(c.bottom,d.bottom)-p)}catch{return null}},getBookmark(){let i=e(),s=X0++;if(i.isDestroyed)return{id:s};let l=new Map(fo.getState(i.state));for(;l.size>=Y0;)l.delete(l.keys().next().value);let{from:a,to:c}=i.state.selection;return l.set(s,{from:a,to:c,gone:!1}),i.dispatch(i.state.tr.setMeta(fo,l).setMeta("addToHistory",!1)),{id:s}},moveToBookmark(i){let s=e(),l=i?.id,a=typeof l=="number"?fo.getState(s.state)?.get(l):void 0;return!a||a.gone?!1:(o.setRange(a.from,a.to),!0)},scrollIntoView(){let{state:i,dispatch:s}=e();s(i.tr.scrollIntoView())}};return o}var Bd={};j(Bd,{MAX_MATCHES:()=>Dd,clearSearch:()=>tw,findMatches:()=>Id,findNext:()=>rw,getSearchState:()=>ss,replaceAll:()=>iw,replaceCurrent:()=>ow,searchKey:()=>Zt,searchPlugin:()=>Hd,setSearch:()=>ew});var Dd=1e4,Z0="\uFFFC",Zt=new Z("nova-search"),_d={query:"",caseSensitive:!1,wholeWord:!1,matches:[],current:-1};function Q0({query:n,caseSensitive:e,wholeWord:t}){if(!n)return null;let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=t?`(?<![\\p{L}\\p{N}_])${r}(?![\\p{L}\\p{N}_])`:r;return new RegExp(o,e?"gu":"giu")}function Id(n,e){let t=Q0(e);if(!t)return[];let r=[];return n.descendants((o,i)=>{if(r.length>=Dd)return!1;if(!o.isTextblock)return!0;let s=o.textBetween(0,o.content.size,void 0,Z0);t.lastIndex=0;let l;for(;(l=t.exec(s))&&r.length<Dd;){if(l[0].length===0){t.lastIndex+=1;continue}r.push({from:i+1+l.index,to:i+1+l.index+l[0].length})}return!1}),r}function Pg(n,e){if(!n.length)return-1;let t=n.findIndex(r=>r.from>=e);return t<0?0:t}function Hd(){return new z({key:Zt,state:{init:()=>_d,apply(n,e,t,r){let o=n.getMeta(Zt);if(o?.type==="clear")return _d;if(o?.type==="set"){let i=Id(r.doc,o.options);return{...o.options,matches:i,current:Pg(i,r.selection.from)}}if(o?.type==="goto")return{...e,current:o.index};if(n.docChanged&&e.query){let i=Id(r.doc,e),s=e.matches[e.current]?.from,l=s===void 0?-1:Pg(i,n.mapping.map(s));return{...e,matches:i,current:l}}return e}},props:{decorations(n){let e=Zt.getState(n);return e?.matches.length?ae.create(n.doc,e.matches.map((t,r)=>ge.inline(t.from,t.to,{class:r===e.current?"nova-search-match nova-search-current":"nova-search-match"}))):null}}})}function ss(n){return Zt.getState(n)??_d}function ew(n){return(e,t)=>(t?.(e.tr.setMeta(Zt,{type:"set",options:n})),!0)}var tw=(n,e)=>(e?.(n.tr.setMeta(Zt,{type:"clear"})),!0);function nw(n,e,t){return n.setMeta(Zt,{type:"goto",index:t}).setSelection(F.create(n.doc,e.from,e.to)).scrollIntoView()}function rw(n=1){return(e,t)=>{let{matches:r,current:o}=ss(e);if(!r.length)return!1;let s=o>=0&&e.selection.from===r[o].from&&e.selection.to===r[o].to||o<0?(Math.max(o,0)+n+r.length)%r.length:o;return t&&t(nw(e.tr,r[s],s)),!0}}function ow(n){return(e,t)=>{let{matches:r,current:o}=ss(e),i=r[o];if(!i)return!1;if(t){let s=e.tr,l=e.doc.resolve(i.from).marksAcross(e.doc.resolve(i.to))??[];n?s.replaceWith(i.from,i.to,e.schema.text(n,l)):s.delete(i.from,i.to);let a=s.mapping.map(i.to);t(s.setSelection(F.create(s.doc,a)).scrollIntoView())}return!0}}function iw(n){return(e,t)=>{let{matches:r}=ss(e);if(!r.length)return!1;if(t){let o=e.tr;for(let i=r.length-1;i>=0;i--){let{from:s,to:l}=r[i],a=e.doc.resolve(s).marksAcross(e.doc.resolve(l))??[];n?o.replaceWith(s,l,e.schema.text(n,a)):o.delete(s,l)}t(o.scrollIntoView())}return!0}}var $d={};j($d,{formatHTML:()=>Rg,isFullscreen:()=>ls,openHelp:()=>ho,openPreview:()=>Fd,openSourceCode:()=>zd,toggleFullscreen:()=>mr});function ls(n){return n.root.classList.contains("nova-fullscreen")}function mr(n,e=!ls(n)){n.root.classList.toggle("nova-fullscreen",e),document.documentElement.classList.toggle("nova-fullscreen-lock",e),n.ui.closePopover(),n.updateUI(),n.focus()}function Fd(n,{doc:e=n.view.state.doc,title:t}={}){let{t:r}=n.ui,o=w("div",{className:"nova-prosemirror nova-preview"});o.append(Ve.fromSchema(n.schema).serializeFragment(e.content)),o.querySelectorAll("a[href]").forEach(i=>{i.setAttribute("target","_blank"),i.setAttribute("rel","noopener noreferrer")}),n.ui.openDialog({title:t??r("preview"),body:o,size:"large",cancelLabel:r("dialog.close")})}function Rg(n){return n.replace(/(<\/(p|h[1-6]|ul|ol|li|blockquote|pre|table|tbody|tr)>|<hr>)/g,`$1
|
|
34
41
|
`).replace(/(<(ul|ol|table|tbody|tr|blockquote)( [^>]*)?>)/g,`$1
|
|
35
42
|
`).replace(/\n{2,}/g,`
|
|
36
|
-
`).trim()}function wh(n){let{t:e}=n.ui,t=$1(n.getHTML()),r=v("textarea",{className:"nova-input nova-source",spellcheck:"false","aria-label":e("sourceCode"),autocomplete:"off",rows:"18"});r.value=t,n.ui.openDialog({title:e("sourceCode"),body:r,size:"large",submitLabel:e("dialog.save"),initialFocus:r,onSubmit:()=>(r.value!==t&&n.setContent(r.value),!0)})}function li(n){let{t:e}=n.ui,t=v("div",{className:"nova-help"});for(let{group:r,rows:o}of _1)t.append(v("section",{},v("h3",{},e(r)),v("table",{className:"nova-help-table"},v("tbody",{},o.map(({label:i,keys:s})=>v("tr",{},v("td",{},e(i)),v("td",{},v("kbd",{},s.length===1?s:Qe(s)))))))));n.ui.openDialog({title:e("help"),body:t,size:"large",cancelLabel:e("dialog.close")})}var _1,Dl=P(()=>{"use strict";de();Z();_1=[{group:"help.formatting",rows:[{label:"bold",keys:"Mod-b"},{label:"italic",keys:"Mod-i"},{label:"underline",keys:"Mod-u"},{label:"strike",keys:"Mod-Shift-x"},{label:"code",keys:"Mod-e"},{label:"superscript",keys:"Mod-."},{label:"subscript",keys:"Mod-,"},{label:"link",keys:"Mod-k"},{label:"clearFormatting",keys:"Mod-\\"}]},{group:"help.blocks",rows:[{label:"paragraph",keys:"Mod-Alt-0"},{label:"h1",keys:"Mod-Alt-1"},{label:"h2",keys:"Mod-Alt-2"},{label:"h3",keys:"Mod-Alt-3"},{label:"bulletList",keys:"Mod-Shift-8"},{label:"orderedList",keys:"Mod-Shift-7"},{label:"alignCenter",keys:"Mod-Shift-e"}]},{group:"help.editing",rows:[{label:"undo",keys:"Mod-z"},{label:"redo",keys:"Mod-Shift-z"},{label:"search.title",keys:"Mod-f"},{label:"pasteAsText",keys:"Mod-Shift-v"},{label:"fullscreen",keys:"Mod-Shift-f"},{label:"help.slash",keys:"/"}]},{group:"help.navigation",rows:[{label:"help.toMenubar",keys:"Alt-F9"},{label:"help.toToolbar",keys:"Alt-F10"},{label:"help.toContextToolbar",keys:"Ctrl-F9"},{label:"help.toEditor",keys:"Escape"},{label:"help.nextCell",keys:"Tab"},{label:"help",keys:"Alt-0"}]}]});function Mh(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(Sh," ")}function q1(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(Sh," ")}function G1(n,e){let t=n.toLowerCase();return t.startsWith("on")?null:j1.has(t)?Re(e)?e:null:K1.has(t)?Pe(e)?e:null:t==="srcset"?e.split(",").map(o=>o.trim().split(/\s+/)[0]??"").every(o=>Pe(o))?e:null:t==="style"&&J1.test(e)?null:e}function X1(n){xh.has(n)||(xh.add(n),console.error(`[nova] toDOM produced <${n}>, which is not allowed in output; the tag was dropped`))}function Rl(n){if(typeof n=="string")return{open:"",close:"",hole:!1,html:Mh(n)};if(!Array.isArray(n))throw new Error("[nova] serializer supports only array/string toDOM specs");let[e,...t]=n,r=e.includes(" ")?e.split(" ")[1]:e;if(!W1.test(r))throw new Error(`[nova] invalid tag in toDOM: ${r}`);let o=U1.has(r.toLowerCase());o&&X1(r.toLowerCase());let i="",s=t,l=t[0];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let[p,h]of Object.entries(l)){if(h==null)continue;let m=p.includes(" ")?p.split(" ")[1]:p;if(!Y1.test(m))continue;let g=G1(m,String(h));g!==null&&(i+=` ${m}="${q1(g)}"`)}s=t.slice(1)}let a=o?"":`<${r}${i}>`;if(V1.has(r.toLowerCase()))return{open:a,close:"",hole:!1,html:a};let c="",u="",d=!1;for(let p of s){if(p===0){if(d)throw new Error("[nova] toDOM spec has more than one content hole");d=!0;continue}let h=Rl(p);if(d){if(h.hole)throw new Error("[nova] toDOM spec has more than one content hole");u+=h.html}else h.hole?(c+=h.open,u+=h.close,d=!0):c+=h.html}if(o)return{open:"",close:"",hole:d,html:""};let f=`</${r}>`;return{open:a+c,close:u+f,hole:d,html:a+c+u+f}}var V1,Sh,W1,U1,j1,K1,J1,xh,Y1,yt,ai=P(()=>{"use strict";gt();V1=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Sh=new RegExp("\xA0","g");W1=/^[a-z][a-z0-9-]*$/i,U1=new Set(["script","style","base","link","meta","object","embed","applet","frame","frameset","template","noscript"]),j1=new Set(["href","xlink:href","action","formaction","cite"]),K1=new Set(["src","poster","data","background"]),J1=/url\s*\(|expression\s*\(|javascript:|@import|behavior\s*:|-moz-binding/i;xh=new Set;Y1=/^[a-z_:][a-z0-9_.:-]*$/i;yt=class{cache=new Map;serializeFragment(e){let t="",r=[],o=[],i=s=>{for(;r.length>s;)t+=o.pop(),r.pop()};return e.forEach(s=>{if(!s.isInline){i(0),t+=this.serializeNode(s);return}let l=0;for(;l<r.length&&l<s.marks.length&&r[l].eq(s.marks[l]);)l++;i(l);for(let a=l;a<s.marks.length;a++){let c=s.marks[a],u=this.renderMark(c,s.isText);t+=u.open,o.push(u.close),r.push(c)}t+=s.isText?Mh(s.text??""):this.serializeNode(s)}),i(0),r=[],o=[],t}serializeNode(e){let t=e.type.spec.toDOM;if(!t)throw new Error(`[nova] node "${e.type.name}" has no toDOM`);let r=Rl(t(e));return r.hole?r.open+this.serializeFragment(e.content)+r.close:r.html}renderMark(e,t){let r=e.type.spec.toDOM;if(!r)throw new Error(`[nova] mark "${e.type.name}" has no toDOM`);let o=`${e.type.name}:${JSON.stringify(e.attrs)}`,i=this.cache.get(o);return i||(i=Rl(r(e,t)),this.cache.size>500&&this.cache.clear(),this.cache.set(o,i)),i}}});function vt(n,e){return(t,r)=>{let o=oe(t)[n],i=e===null?null:Q1[n](e);if(e!==null&&!i)return!1;let{empty:s}=t.selection;if(!r)return!0;let l=t.tr;if(s)l.removeStoredMark(o),i&&l.addStoredMark(o.create({value:i}));else for(let a of t.selection.ranges)l.removeMark(a.$from.pos,a.$to.pos,o),i&&l.addMark(a.$from.pos,a.$to.pos,o.create({value:i}));return r(l.scrollIntoView()),!0}}function st(n,e){let t=oe(n)[e],{$from:r,empty:o}=n.selection,i=o?n.storedMarks??r.marks():r.nodeAfter?.marks??r.marks(),s=t.isInSet(i);return s?s.attrs.value:null}function Or(n){return(e,t)=>{let r=n===null?null:U.lineHeight(n);if(n!==null&&!r)return!1;let{from:o,to:i}=e.selection,s=e.tr,l=!1;return e.doc.nodesBetween(o,i,(a,c)=>{(a.type===G(e).paragraph||a.type===G(e).heading)&&(l=!0,s.setNodeMarkup(c,void 0,{...a.attrs,lineHeight:r}))}),l?(t?.(s),!0):!1}}function Pl(n){return n.selection.$from.parent.attrs.lineHeight??null}var Q1,Il=P(()=>{"use strict";Oe();et();Q1={color:U.color,background:U.color,font_family:U.fontFamily,font_size:U.length}});function ui(n){let t=[],r=n.current?.toLowerCase()??null,o=v("div",{className:"nova-swatches",role:"grid","aria-label":n.label});for(let l of n.colors){let a=r===l.toLowerCase(),c=v("button",{type:"button",className:"nova-swatch",role:"gridcell","aria-label":l,"aria-selected":String(a),title:l,tabindex:"-1"},a?X(M.check):null);c.style.setProperty("--swatch",l),c.addEventListener("click",()=>n.onPick(l)),t.push(c),o.append(c)}(t.find(l=>l.getAttribute("aria-selected")==="true")??t[0])?.setAttribute("tabindex","0"),o.addEventListener("keydown",l=>{let a=t.indexOf(document.activeElement);if(a<0)return;let u={ArrowRight:1,ArrowLeft:-1,ArrowDown:8,ArrowUp:-8}[l.key];if(u===void 0)return;l.preventDefault();let d=t[Math.min(t.length-1,Math.max(0,a+u))];t[a].tabIndex=-1,d.tabIndex=0,d.focus()});let i=v("button",{type:"button",className:"nova-panel-action"},X(M.clearFormatting),n.removeLabel);i.addEventListener("click",()=>n.onPick(null));let s=v("input",{type:"color",className:"nova-color-input","aria-label":n.customLabel,value:/^#[0-9a-f]{6}$/i.test(r??"")?r:"#000000"});return s.addEventListener("change",()=>n.onPick(s.value)),v("div",{className:"nova-color-panel"},o,v("div",{className:"nova-panel-footer"},i,v("label",{className:"nova-panel-action"},s,n.customLabel)))}var ci,Bl=P(()=>{"use strict";Z();j();ci=["#000000","#434343","#666666","#999999","#b7b7b7","#d9d9d9","#efefef","#ffffff","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#fecaca","#fed7aa","#fef08a","#bbf7d0","#a5f3fc","#bfdbfe","#ddd6fe","#fbcfe8"]});function Ch(n){let{registry:e,t}=n.ui,r=(i,s)=>t("table.size",{rows:i,cols:s});e.addPanelButton("table",{icon:M.table,tooltip:t("table.insert"),isEnabled:i=>i.can(it(1,1)),render:(i,s)=>Ef((l,a)=>{s(),i.exec(it(l,a))},r,t("table.insert"))});let o=(i,s,l,a,c)=>e.addButton(i,{icon:l,tooltip:t(s),onAction:u=>u.exec(a),isEnabled:u=>u.can(a),...c?{isActive:c}:{}});o("tableinsertrowbefore","table.rowBefore",M.rowBefore,We.addRowBefore),o("tableinsertrowafter","table.rowAfter",M.rowAfter,We.addRowAfter),o("tabledeleterow","table.rowDelete",M.rowDelete,We.deleteRow),o("tableinsertcolbefore","table.colBefore",M.colBefore,We.addColumnBefore),o("tableinsertcolafter","table.colAfter",M.colAfter,We.addColumnAfter),o("tabledeletecol","table.colDelete",M.colDelete,We.deleteColumn),o("tablemergecells","table.merge",M.merge,We.mergeCells),o("tablesplitcells","table.split",M.split,We.splitCell),o("tablerowheader","table.rowHeader",M.rowHeader,We.toggleHeaderRow,i=>Sf(i.view.state)),o("tablecolheader","table.colHeader",M.colHeader,We.toggleHeaderColumn,i=>Mf(i.view.state)),o("tabledelete","table.delete",M.tableDelete,We.deleteTable),e.addPanelButton("tablecellbackground",{icon:M.highlight,tooltip:t("table.cellBackground"),isEnabled:i=>ne(i.view.state),render:(i,s)=>ui({colors:i.options.colors??ci,current:null,label:t("table.cellBackground"),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:l=>{s(),i.exec(xf(l))}})}),e.addMenuButton("advtablesort",{icon:M.sort,tooltip:t("table.sort"),isEnabled:i=>i.can(dl("asc")),items:i=>["asc","desc"].map(s=>({id:s,label:t(s==="asc"?"table.sortAsc":"table.sortDesc"),onSelect:()=>i.exec(dl(s,i.options.language))}))}),e.addButton("tableprops",{icon:M.tableProps,tooltip:t("table.props"),isEnabled:i=>ne(i.view.state),onAction:i=>Z1(i)}),e.addButton("tablecellprops",{icon:M.cellProps,tooltip:t("table.cellProps"),isEnabled:i=>ne(i.view.state),onAction:i=>ek(i)}),e.addContextToolbar("table",{label:t("table.toolbar"),predicate:i=>ne(i.view.state),anchor:i=>Cf(i),placement:"bottom-start",items:"tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | tablerowheader tablecolheader tablecellbackground | advtablesort tablecellprops tableprops | tabledelete"})}function Eh(n,e,t){if(!e?.length)return null;let{t:r}=n.ui,o=[{value:"",label:r("table.styleDefault")}];for(let i of e)i.value&&o.push({value:i.value,label:i.title});return t&&!o.some(i=>i.value===t)&&o.push({value:t,label:t}),tr({label:r("table.style"),value:t??"",options:o})}function Z1(n){let{t:e}=n.ui,t=Af(n.view.state);if(!t)return;let r=ce({label:e("table.width"),hint:e("table.widthHint"),value:t.width??""}),o=tr({label:e("table.align"),value:t.align??"",options:[{value:"",label:e("table.alignDefault")},{value:"center",label:e("table.alignCenter")},{value:"right",label:e("table.alignRight")}]}),i=Eh(n,n.options.tableClassList,t.class??null);n.ui.openDialog({title:e("table.props"),body:v("div",{className:"nova-form"},i?.el??null,r.el,o.el),submitLabel:e("dialog.save"),onSubmit:()=>{let l={width:r.input.value.trim().replace(/^(\d+(\.\d+)?)$/,"$1px")||null,align:o.select.value||null,...i?{class:i.select.value||null}:{}};return n.exec(Tf(l))||e("table.invalidWidth")}})}function ek(n){let{t:e}=n.ui,t=Lf(n.view.state);if(!t)return;let r=tr({label:e("table.valign"),value:t.valign??"",options:[{value:"",label:e("table.alignDefault")},{value:"top",label:e("table.valignTop")},{value:"middle",label:e("table.valignMiddle")},{value:"bottom",label:e("table.valignBottom")}]}),o=tr({label:e("table.cellType"),value:t.header?"th":"td",options:[{value:"td",label:e("table.cellData")},{value:"th",label:e("table.cellHeader")}]}),i=ce({label:e("table.colWidth"),hint:e("table.colWidthHint"),value:t.width?String(t.width):""}),s=Eh(n,n.options.tableCellClassList,t.class??null);n.ui.openDialog({title:e("table.cellProps"),body:v("div",{className:"nova-form"},s?.el??null,r.el,o.el,i.el),submitLabel:e("dialog.save"),onSubmit:()=>{let l=i.input.value.trim(),a=l?Number(l.replace(/px$/i,"")):null;return a!==null&&!(Number.isInteger(a)&&a>=24&&a<=4e3)?e("table.invalidColWidth"):(n.exec(Of({valign:r.select.value||null,header:o.select.value==="th",width:a,...s?{class:s.select.value||null}:{}})),!0)}})}var Ah=P(()=>{"use strict";zn();Bl();At();Z();j()});function Th(n){try{let{node:e}=n.view.domAtPos(n.view.state.selection.from),t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;return t?getComputedStyle(t):null}catch{return null}}function Nh(n){let e=n.split(",")[0].trim().replace(/["']/g,"");return ok[e.toLowerCase()]??e}function ik(n){let e=parseFloat(n);return!Number.isFinite(e)||e<=0?null:`${Math.round(e*.75*2)/2}pt`}function Oh(n){let{registry:e,t}=n.ui,r=()=>n.view.state,o=(y,k,T,I)=>e.addButton(y,{icon:T,tooltip:t(k),...Ge[k]?{shortcut:Ge[k]}:{},onAction:R=>R.exec(k),isEnabled:R=>R.can(k),...I?{isActive:I}:{}}),i=(y,k,T,I)=>o(y,k,I,()=>vr(r(),n.schema.marks[T]));o("undo","undo",M.undo),o("redo","redo",M.redo),i("bold","bold","bold",M.bold),i("italic","italic","italic",M.italic),i("underline","underline","underline",M.underline),i("strikethrough","strike","strike",M.strike),i("inlinecode","code","code",M.code),i("subscript","subscript","subscript",M.subscript),i("superscript","superscript","superscript",M.superscript),o("bullist","bulletList",M.bulletList,()=>rt(r(),n.schema.nodes.bullet_list)),o("numlist","orderedList",M.orderedList,()=>rt(r(),n.schema.nodes.ordered_list)),o("indent","indent",M.indent),o("outdent","outdent",M.outdent),o("blockquote","blockquote",M.blockquote,()=>rt(r(),n.schema.nodes.blockquote)),o("codeblock","codeBlock",M.codeBlock,()=>rt(r(),n.schema.nodes.code_block)),o("hr","horizontalRule",M.horizontalRule),o("removeformat","clearFormatting",M.clearFormatting);let s=[["alignLeft","left",M.alignLeft],["alignCenter","center",M.alignCenter],["alignRight","right",M.alignRight],["alignJustify","justify",M.alignJustify]];for(let[y,k,T]of s)o(y.toLowerCase(),y,T,()=>an(r())===k);e.addMenuButton("align",{icon:M.alignLeft,tooltip:t("align"),isEnabled:y=>y.can("alignLeft"),items:y=>s.map(([k,T,I])=>({id:k,label:t(k),icon:I,...Ge[k]?{shortcut:Ge[k]}:{},active:an(y.view.state)===T,onSelect:()=>y.exec(k)}))});let l=[{command:"paragraph",style:""},{command:"h1",style:"font-size: 1.6em; font-weight: 700"},{command:"h2",style:"font-size: 1.35em; font-weight: 700"},{command:"h3",style:"font-size: 1.15em; font-weight: 700"},{command:"h4",style:"font-size: 1em; font-weight: 700"},{command:"h5",style:"font-size: 0.9em; font-weight: 700"},{command:"h6",style:"font-size: 0.85em; font-weight: 700"},{command:"codeBlock",style:"font-family: ui-monospace, monospace"}],a=()=>{let y=r().selection.$from.parent;return y.type===n.schema.nodes.heading?`h${y.attrs.level}`:y.type===n.schema.nodes.code_block?"codeBlock":"paragraph"};for(let y=1;y<=6;y++){let k=`h${y}`;e.addToggleButton(k,{...y<=3?{icon:M[`h${y}`]}:{text:`H${y}`},tooltip:t(k),...Ge[k]?{shortcut:Ge[k]}:{},isActive:()=>a()===k,isEnabled:T=>T.can(k)||a()===k,onAction:T=>T.exec(a()===k?"paragraph":k)})}let c={p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",pre:"codeBlock"},u=()=>{let y=n.options.blockFormats;return y?.length?y.flatMap(({label:k,block:T})=>{let I=c[T],R=l.find(z=>z.command===I);return R?[{...R,label:k}]:[]}):l};e.addMenuButton("blocks",{tooltip:t("blocks"),label:()=>u().find(y=>y.command===a())?.label??t(a()),minChars:11,isEnabled:y=>u().some(({command:k})=>y.can(k)),items:y=>u().filter(({command:k})=>y.isAllowed(k)).map(({command:k,style:T,label:I})=>({id:k,label:I??t(k),labelStyle:T,...Ge[k]?{shortcut:Ge[k]}:{},active:a()===k,onSelect:()=>y.exec(k)}))});let d="p,h1,h2,h3,h4,h5,h6",f=()=>[{title:t("styles.headings"),items:[1,2,3,4,5,6].map(y=>({title:t(`h${y}`),block:`h${y}`}))},{title:t("styles.inline"),items:[{title:t("bold"),inline:"strong"},{title:t("italic"),inline:"em"},{title:t("underline"),inline:"u"},{title:t("strike"),inline:"s"},{title:t("superscript"),inline:"sup"},{title:t("subscript"),inline:"sub"},{title:t("code"),inline:"code"}]},{title:t("styles.blocks"),items:[{title:t("paragraph"),block:"p"},{title:t("blockquote"),block:"blockquote"},{title:t("codeBlock"),block:"pre"}]},{title:t("styles.align"),items:["left","center","right","justify"].map(y=>({title:t(`align${y==="justify"?"Justify":y[0].toUpperCase()+y.slice(1)}`),selector:d,styles:{"text-align":y}}))}],p=y=>y.format??y,h=y=>{let k=y.format?n.formatter.get(y.format)?.[0]:y,T=[],I=k?.block;I&&/^h[1-6]$/.test(I)&&T.push("font-weight: 700"),(k?.inline==="strong"||k?.inline==="b")&&T.push("font-weight: 700"),(k?.inline==="em"||k?.inline==="i")&&T.push("font-style: italic"),k?.inline==="u"&&T.push("text-decoration: underline"),(k?.inline==="s"||k?.inline==="strike"||k?.inline==="del")&&T.push("text-decoration: line-through"),(k?.inline==="code"||I==="pre")&&T.push("font-family: ui-monospace, monospace");for(let R of["color","background-color","font-family"]){let z=k?.styles?.[R];z&&/^[#\w\s,'"().%-]+$/.test(z)&&T.push(`${R}: ${z}`)}return T.join("; ")},m=y=>y.flatMap(k=>k.items?m(k.items):[k]),g=()=>{let y=n.options.styleFormats;return y?n.options.styleFormatsMerge?[...f(),...y]:y:f()};e.addMenuButton("styles",{tooltip:t("styles"),minChars:10,label:y=>m(g()).find(k=>y.formatter.match(p(k)))?.title??t("styles"),items:y=>{let k=[],T=(I,R)=>{I.forEach((z,te)=>{if(z.items){k.length&&k.push({type:"separator"}),k.push({type:"heading",label:z.title}),T(z.items,`${R}${te}-`);return}k.push({id:`style-${R}${te}`,label:z.title,labelStyle:h(z),active:y.formatter.match(p(z)),disabled:!y.formatter.canApply(p(z)),onSelect:()=>y.formatter.toggle(p(z))})})};return T(g(),""),k}});let b=n.options.fontFamilies??tk;e.addMenuButton("fontfamily",{tooltip:t("fontFamily"),minChars:9,label:y=>{let k=st(r(),"font_family");if(k)return b.find(I=>Lh(k,I.value))?.label??Nh(k);let T=Th(y)?.fontFamily;return T?Nh(T):t("fontFamily")},items:y=>{let k=st(y.view.state,"font_family");return[{id:"default",label:t("default"),active:k===null,onSelect:()=>y.exec(vt("font_family",null))},{type:"separator"},...b.map(T=>({id:T.label,label:T.label,labelStyle:`font-family: ${T.value}`,active:Lh(k,T.value),onSelect:()=>y.exec(vt("font_family",T.value))}))]}});let x=n.options.fontSizes??nk;e.addMenuButton("fontsize",{tooltip:t("fontSize"),minChars:4,label:y=>st(r(),"font_size")??ik(Th(y)?.fontSize??"")??"\u2014",items:y=>{let k=st(y.view.state,"font_size");return[{id:"default",label:t("default"),active:k===null,onSelect:()=>y.exec(vt("font_size",null))},{type:"separator"},...x.map(T=>({id:T,label:T,active:k===T,onSelect:()=>y.exec(vt("font_size",T))}))]}});let w=n.options.lineHeights??rk;e.addMenuButton("lineheight",{icon:M.lineHeight,tooltip:t("lineHeight"),isEnabled:y=>y.can(Or(null)),items:y=>{let k=Pl(y.view.state);return[{id:"default",label:t("default"),active:k===null,onSelect:()=>y.exec(Or(null))},...w.map(T=>({id:T,label:T,active:k===T,onSelect:()=>y.exec(Or(T))}))]}});let E=(y,k,T,I)=>e.addPanelButton(y,{icon:T,tooltip:t(I),indicator:()=>st(r(),k),render:(R,z)=>ui({colors:R.options.colors??ci,current:st(R.view.state,k),label:t(I),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:te=>{z(),R.exec(vt(k,te))}})});E("forecolor","color",M.textColor,"textColor"),E("backcolor","background",M.highlight,"backgroundColor");let D=[["superscript","superscript",M.superscript],["subscript","subscript",M.subscript],["code","code",M.code]];e.addMenuButton("moreformats",{icon:M.formatMore,tooltip:t("moreFormats"),isActive:y=>D.some(([,k])=>vr(y.view.state,n.schema.marks[k])),items:y=>[...D.filter(([k])=>y.isAllowed(k)).map(([k,T,I])=>({id:k,label:t(k),icon:I,checkbox:!0,active:vr(y.view.state,n.schema.marks[T]),disabled:!y.can(k),...Ge[k]?{shortcut:Ge[k]}:{},onSelect:()=>y.exec(k)})),{type:"separator"},{id:"clearFormatting",label:t("clearFormatting"),icon:M.clearFormatting,disabled:!y.can("clearFormatting"),shortcut:Ge.clearFormatting,onSelect:()=>y.exec("clearFormatting")},{id:"pasteAsText",label:t("pasteAsText"),icon:M.pasteText,checkbox:!0,active:y.isPasteAsText(),onSelect:()=>{y.setPasteAsText(!y.isPasteAsText()),y.focus()}}]}),e.addToggleButton("pastetext",{icon:M.pasteText,tooltip:t("pasteAsText"),isActive:y=>y.isPasteAsText(),onAction:y=>{y.setPasteAsText(!y.isPasteAsText()),y.focus()}}),e.addButton("link",{icon:M.link,tooltip:t("link"),shortcut:"Mod-k",onAction:y=>ot(y),isActive:()=>!!In(r())}),e.addButton("unlink",{icon:M.unlink,tooltip:t("unlink"),onAction:y=>y.exec(Mr()),isEnabled:y=>y.can(Mr())}),e.addButton("image",{icon:M.image,tooltip:t("image"),onAction:y=>Wo(y)});let C=()=>cn(r())?.node.attrs.align??null,N=(y,k,T,I)=>e.addToggleButton(y,{icon:T,tooltip:t(I),isActive:()=>C()===k,onAction:R=>R.exec(xr({align:C()===k?null:k}))});N("imagealignleft","left",M.imageLeft,"image.alignLeft"),N("imagealigncenter","center",M.imageCenter,"image.alignCenter"),N("imagealignright","right",M.imageRight,"image.alignRight");let S=[["image.sizeSmall",.25],["image.sizeMedium",.5],["image.sizeLarge",.75],["image.sizeFull",1],["image.sizeOriginal",null]];e.addMenuButton("imagesize",{icon:M.resize,tooltip:t("image.size"),items:y=>S.map(([k,T])=>({id:k,label:t(k),onSelect:()=>yf(y,T)}))}),e.addButton("imagealt",{icon:M.altText,tooltip:t("image.editAlt"),onAction:y=>vf(y)}),e.addButton("imagedelete",{icon:M.trash,tooltip:t("image.delete"),onAction:y=>y.exec((k,T)=>cn(k)?(T?.(k.tr.deleteSelection().scrollIntoView()),!0):!1)}),Ch(n),e.addButton("searchreplace",{icon:M.search,tooltip:t("search.title"),shortcut:"Mod-f",onAction:y=>y.openSearch()}),e.addToggleButton("fullscreen",{icon:M.fullscreen,tooltip:t("fullscreen"),shortcut:"Mod-Shift-f",isActive:y=>Ol(y),onAction:y=>Lr(y)}),e.addButton("preview",{icon:M.preview,tooltip:t("preview"),onAction:y=>kh(y)}),e.addButton("code",{icon:M.sourceCode,tooltip:t("sourceCode"),onAction:y=>wh(y)}),e.addButton("help",{icon:M.help,tooltip:t("help"),shortcut:"Alt-0",onAction:y=>li(y)}),e.addContextToolbar("image",{label:t("image.toolbar"),predicate:y=>!!cn(y.view.state),items:"imagealignleft imagealigncenter imagealignright | imagesize imagealt | imagedelete"})}var tk,nk,rk,Ge,ok,Lh,Dh=P(()=>{"use strict";Oe();Sr();Hn();Il();Bl();Ah();Dl();j();tk=[{label:"Sans Serif",value:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},{label:"Serif",value:'Georgia, "Times New Roman", serif'},{label:"Monospace",value:"ui-monospace, Menlo, Consolas, monospace"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:'"Times New Roman", Times, serif'},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Courier New",value:'"Courier New", Courier, monospace'}],nk=["8pt","10pt","12pt","14pt","16pt","18pt","24pt","36pt","48pt"],rk=["1","1.15","1.5","2","2.5","3"],Ge={undo:"Mod-z",redo:"Mod-Shift-z",bold:"Mod-b",italic:"Mod-i",underline:"Mod-u",strike:"Mod-Shift-x",code:"Mod-e",subscript:"Mod-,",superscript:"Mod-.",bulletList:"Mod-Shift-8",orderedList:"Mod-Shift-7",alignLeft:"Mod-Shift-l",alignCenter:"Mod-Shift-e",alignRight:"Mod-Shift-r",alignJustify:"Mod-Shift-j",clearFormatting:"Mod-\\",paragraph:"Mod-Alt-0",h1:"Mod-Alt-1",h2:"Mod-Alt-2",h3:"Mod-Alt-3",h4:"Mod-Alt-4",h5:"Mod-Alt-5",h6:"Mod-Alt-6"};ok={"system-ui":"Sans Serif","-apple-system":"Sans Serif","sans-serif":"Sans Serif",serif:"Serif",monospace:"Monospace","ui-monospace":"Monospace"};Lh=(n,e)=>n!==null&&n.replace(/["'\s]/g,"").toLowerCase()===e.replace(/["'\s]/g,"").toLowerCase()});function kt(n,e,t){let r=window.innerWidth,o=window.innerHeight,{width:i,height:s}=n.getBoundingClientRect(),l=o-e.bottom,a=e.top,u=t==="top-start"?a>=s+6||a>l:l<s+6&&a>l,d=u?e.top-s-6:e.bottom+6,f=t==="bottom-end"?e.right-i:t==="bottom"?e.left+e.width/2-i/2:e.left;f=Math.max(8,Math.min(f,r-i-8)),d=Math.max(8,Math.min(d,o-s-8)),n.style.left=`${Math.round(f)}px`,n.style.top=`${Math.round(d)}px`,n.dataset.side=u?"top":"bottom"}var Dr,_n,dn=P(()=>{"use strict";Dr=[],_n=class{el;options;closed=!1;constructor(e){this.options=e,this.el=document.createElement("div"),this.el.className=`nova-popover ${e.className??""}`.trim(),this.el.append(e.content),e.host.append(this.el),this.reposition(),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("pointerdown",this.onPointerDown,!0),Dr.push(this),window.addEventListener("resize",this.reposition),window.addEventListener("scroll",this.reposition,!0)}get isOpen(){return!this.closed}reposition=()=>{if(this.closed)return;let{anchor:e,placement:t="bottom-start"}=this.options,r=typeof e=="function"?e():e.getBoundingClientRect();kt(this.el,r,t)};close(e="api"){this.closed||(this.closed=!0,Dr.splice(Dr.indexOf(this),1),document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0),window.removeEventListener("resize",this.reposition),window.removeEventListener("scroll",this.reposition,!0),this.el.remove(),this.options.onClose?.(e))}focusWasInside=!1;onKeyDown=e=>{e.key!=="Escape"||e.defaultPrevented||Dr[Dr.length-1]===this&&(e.target?.closest?.(".nova-dialog")||(e.preventDefault(),e.stopPropagation(),this.focusWasInside=this.el.contains(document.activeElement),this.close("escape")))};onPointerDown=e=>{if(this.options.dismissOnOutside===!1)return;let t=e.target;this.el.contains(t)||this.options.ignore?.some(r=>r.contains(t))||this.close("outside")}}});function Rh(n){return new _({key:new J("nova-link-bubble"),view(e){let{t}=n.ui,r=v("a",{className:"nova-bubble-link",target:"_blank",rel:"noopener noreferrer"}),o=(c,u,d)=>{let f=v("button",{type:"button",className:"nova-btn","aria-label":u,"data-tooltip":u},X(c));return f.addEventListener("click",d),n.ui.tooltip.attach(f),f},i=v("div",{className:"nova-bubble",role:"toolbar","aria-label":t("link"),hidden:!0},X(M.externalLink),r,v("span",{className:"nova-bubble-sep"}),o(M.edit,t("link.edit"),()=>ot(n)),o(M.copy,t("link.copy"),()=>{navigator.clipboard?.writeText(r.href).then(()=>n.ui.notify({text:t("link.copied"),type:"success",timeout:2e3}))}),o(M.unlink,t("unlink"),()=>n.exec(Mr())));i.addEventListener("mousedown",c=>{c.target.closest("button")&&c.preventDefault()}),n.ui.overlayHost.append(i);let s=()=>{i.hidden=!0},l=()=>{let c=e.state,u=In(c),d=e.hasFocus()||i.contains(document.activeElement);if(!u||!d||!n.isEditable()||n.ui.activeDialog||!c.selection.empty){s();return}let f=kr(c,oe(c).link,c.selection.from);if(!f)return s();r.textContent=u.href,r.title=u.href,Re(u.href)?r.setAttribute("href",u.href):r.removeAttribute("href"),i.hidden=!1;let p=e.coordsAtPos(f.from),h=e.coordsAtPos(f.to),m=new DOMRect(p.left,p.top,Math.max(1,h.right-p.left),h.bottom-p.top);kt(i,m,"bottom-start")},a=c=>{i.contains(c.relatedTarget)||s()};return e.dom.addEventListener("blur",a),i.addEventListener("focusout",c=>{!i.contains(c.relatedTarget)&&!e.hasFocus()&&s()}),{update:l,destroy(){e.dom.removeEventListener("blur",a),i.remove()}}}})}var Ph=P(()=>{"use strict";K();Oe();Hn();Oe();gt();Z();j();dn()});function zl(n){let e=Array.isArray(n)?n:n.split(/\s+/),t=[[]];for(let r of e){let o=r.trim();o&&(o==="|"?t.push([]):t[t.length-1].push(o))}return t.filter(r=>r.length>0)}function Fl(n,e,t,r,{warnUnknown:o=!0}={}){let{ui:i}=n,s=i.t,l=new AbortController,{signal:a}=l;e.className=`nova-toolbar nova-toolbar-${r}`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label",s("toolbar.label"));let c=[],u=[];for(let S of zl(t)){let y=v("div",{className:"nova-tb-group",role:"group"});for(let k of S){if(!n.isAllowed(k))continue;let T=i.registry.get(k);if(!T){o&&console.warn(`[nova] Unknown toolbar item "${k}"`);continue}let I=Rr(n,k,T);c.push(I),y.append(I.el)}y.childElementCount&&(u.push(y),e.append(y))}let d=v("div",{className:"nova-toolbar nova-tb-overflow",role:"group"}),f=v("button",{type:"button",className:"nova-btn nova-tb-more","aria-label":s("more"),"aria-haspopup":"true","aria-expanded":"false","data-tooltip":s("more"),hidden:!0},X(M.more));i.tooltip.attach(f);let p=null,h=()=>{p?.close(),p=null},m=i.onDialogOpen(h);f.addEventListener("click",S=>{if(p)return h();f.setAttribute("aria-expanded","true");let y=new _n({host:i.overlayHost,anchor:f,placement:"bottom-end",content:d,className:"nova-tb-overflow-popover",ignore:[i.overlayHost,f],onClose:k=>{p=null,f.setAttribute("aria-expanded","false"),k==="escape"&&y.focusWasInside&&f.focus()}});p=y,S.detail===0&&d.querySelector("button:not(:disabled)")?.focus()}),r==="sliding"&&e.append(f);let g=()=>{if(r!=="sliding")return;for(let y of u)e.insertBefore(y,f);if(f.hidden=!0,e.scrollWidth<=e.clientWidth+1){h();return}f.hidden=!1;let S=u.length;for(;S>1&&e.scrollWidth>e.clientWidth+1;)S-=1,d.prepend(u[S]);d.childElementCount||(f.hidden=!0),p?.reposition(),D()},b=-1,x=typeof ResizeObserver<"u"&&r==="sliding"?new ResizeObserver(()=>{e.clientWidth!==b&&(b=e.clientWidth,g())}):null;x?.observe(e);let w=()=>[...e.querySelectorAll("button")].filter(S=>!S.disabled&&!S.hidden),E=null,D=()=>{let S=w();(!E||!S.includes(E))&&(E=S[0]??null);for(let y of e.querySelectorAll("button"))y.tabIndex=y===E?0:-1};e.addEventListener("focusin",S=>{let y=S.target;y instanceof HTMLButtonElement&&e.contains(y)&&(E=y,D())},{signal:a}),e.addEventListener("keydown",S=>{let y=w(),k=y.indexOf(document.activeElement);if(k<0)return;let T=null;if(S.key==="ArrowRight")T=k+1;else if(S.key==="ArrowLeft")T=k-1;else if(S.key==="Home")T=0;else if(S.key==="End")T=y.length-1;else if(S.key==="Escape"){S.preventDefault(),n.focus();return}T!==null&&(S.preventDefault(),y[(T+y.length)%y.length].focus())},{signal:a});let C=S=>{S.target.closest("button")&&S.preventDefault()};e.addEventListener("mousedown",C,{signal:a}),d.addEventListener("mousedown",C),d.addEventListener("keydown",S=>{if(S.key==="Escape")return;let y=[...d.querySelectorAll("button")].filter(T=>!T.disabled),k=y.indexOf(document.activeElement);k<0||(S.key==="ArrowRight"||S.key==="ArrowDown"?(S.preventDefault(),y[(k+1)%y.length].focus()):(S.key==="ArrowLeft"||S.key==="ArrowUp")&&(S.preventDefault(),y[(k-1+y.length)%y.length].focus()))});let N=()=>{for(let S of c)S.update();D()};return N(),g(),{update:N,focus:()=>{D(),E?.focus()},destroy:()=>{x?.disconnect(),m(),h(),l.abort(),e.replaceChildren()}}}function Rr(n,e,t){if(t.type==="split")return sk(n,e,t);let{ui:r}=n,o=v("button",{type:"button",className:`nova-btn nova-tb-${t.type}`,"aria-label":t.tooltip,"data-tooltip":t.tooltip,"data-control":e,...t.shortcut?{"data-shortcut":t.shortcut}:{}});r.tooltip.attach(o),t.icon&&o.append(X(t.icon));let i=t.type==="menu"&&(t.label||t.text)?v("span",{className:"nova-tb-label"}):null;i?(t.type==="menu"&&t.minChars&&(i.style.minWidth=`${t.minChars}ch`),o.append(i),o.classList.add("nova-tb-has-label")):!t.icon&&t.text&&o.append(t.text);let s=null;return t.type==="panel"&&t.indicator&&(s=v("span",{className:"nova-color-bar"}),o.append(s)),t.type!=="button"&&(o.setAttribute("aria-haspopup",t.type==="menu"?"menu":"dialog"),o.setAttribute("aria-expanded","false"),o.append(X(M.chevronDown)),o.lastElementChild?.classList.add("nova-chevron")),o.addEventListener("click",a=>{if(t.type==="button"){t.onAction(n);return}if(o.getAttribute("aria-expanded")==="true"){r.closePopover();return}let c=a.detail===0,u=()=>r.closePopover(),d=t.type==="menu"?oi(t.items(n),u,t.tooltip):t.render(n,u);o.setAttribute("aria-expanded","true");let f=r.openPopover({anchor:o,content:d,ignore:[o],className:t.type==="menu"?"nova-popover-menu":"nova-popover-panel",onClose:p=>{o.setAttribute("aria-expanded","false"),p==="escape"&&f.focusWasInside&&o.focus()}});t.type==="menu"?ii(d):c&&d.querySelector("button, input")?.focus()}),t.type!=="button"&&o.addEventListener("keydown",a=>{a.key==="ArrowDown"&&o.getAttribute("aria-expanded")!=="true"&&(a.preventDefault(),o.click())}),{el:o,update:()=>{let a=n.isEditable();if(o.disabled=!a||(t.isEnabled?!t.isEnabled(n):!1),t.isActive){let c=t.isActive(n);o.classList.toggle("is-active",c),t.type==="button"&&o.setAttribute("aria-pressed",String(c))}if(i&&t.type==="menu"&&(i.textContent=t.label?.(n)??t.text??""),s&&t.type==="panel"&&t.indicator){let c=t.indicator(n);s.style.background=c??"",s.classList.toggle("is-empty",!c)}}}}function sk(n,e,t){let r=Rr(n,e,{type:"button",tooltip:t.tooltip,onAction:t.onAction,...t.icon?{icon:t.icon}:{},...t.text?{text:t.text}:{},...t.shortcut?{shortcut:t.shortcut}:{},...t.isActive?{isActive:t.isActive}:{},...t.isEnabled?{isEnabled:t.isEnabled}:{}}),o=Rr(n,`${e}-options`,{type:"menu",tooltip:`${t.tooltip}: ${n.ui.t("toolbar.options")}`,items:t.items,...t.isEnabled?{isEnabled:t.isEnabled}:{}});return o.el.classList.add("nova-tb-split-more"),{el:v("span",{className:"nova-tb-split"},r.el,o.el),update:()=>{r.update(),o.update()}}}var Hl,$l=P(()=>{"use strict";Z();j();Al();dn();Hl="undo redo | blocks | bold italic underline strikethrough moreformats | forecolor backcolor | link image table | bullist numlist | align lineheight outdent indent | fontfamily fontsize | blockquote codeblock hr | removeformat | searchreplace preview code fullscreen help"});function Ih(n){return new _({key:new J("nova-context-toolbar"),view(e){let t=v("div",{className:"nova-bubble nova-context-toolbar",role:"toolbar",hidden:!0});n.ui.overlayHost.append(t);let r=new Map,o=null,i=(m,g)=>{let b=r.get(m);if(b)return b;let x=v("div",{className:"nova-context-items"}),w=[];return zl(g.items).forEach((E,D)=>{D>0&&x.append(v("span",{className:"nova-bubble-sep",role:"separator"}));for(let C of E){if(!n.isAllowed(C))continue;let N=n.ui.registry.get(C);if(!N)continue;let S=Rr(n,C,N);w.push(S),x.append(S.el)}}),b={el:x,controls:w},r.set(m,b),b},s=()=>{t.hidden=!0,o=null},l=m=>{let{selection:g}=e.state;if((m.position??"node")==="node"&&g instanceof B)return e.nodeDOM(g.from)?.getBoundingClientRect()??null;let b=e.coordsAtPos(g.from),x=e.coordsAtPos(g.to);return new DOMRect(b.left,b.top,Math.max(1,x.right-b.left),x.bottom-b.top)},a=!1,c=m=>{m.pointerType==="mouse"&&m.button===0&&(a=!0)},u=()=>{a&&(a=!1,setTimeout(()=>f(e),0))};e.dom.addEventListener("pointerdown",c),document.addEventListener("pointerup",u);let d=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,f=m=>{if(!(m.hasFocus()||t.contains(document.activeElement))||!n.isEditable()||n.ui.activeDialog||a)return s();let b=n.ui.registry.getContextToolbars().find(([,N])=>N.predicate(n));if(!b)return s();let[x,w]=b,E=i(x,w);o!==x&&(t.replaceChildren(E.el),t.setAttribute("aria-label",w.label),o=x);for(let N of E.controls)N.update();let D=w.anchor?w.anchor(n):l(w);if(!D)return s();t.hidden=!1;let C=w.placement??(w.position==="selection"?"bottom-start":"top-start");d&&w.position==="selection"&&(C="bottom-start"),kt(t,D,C)};t.addEventListener("mousedown",m=>{m.target.closest("button")&&m.preventDefault()}),t.addEventListener("keydown",m=>{let g=[...t.querySelectorAll("button:not(:disabled)")],b=g.indexOf(document.activeElement);if(m.key==="Escape")m.preventDefault(),n.focus();else if(b>=0&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();let x=m.key==="ArrowRight"?1:-1;g[(b+x+g.length)%g.length].focus()}});let p=m=>{let g=m.relatedTarget;!t.contains(g)&&!n.ui.overlayHost.contains(g)&&s()};e.dom.addEventListener("blur",p),t.addEventListener("focusout",m=>{let g=m.relatedTarget;!t.contains(g)&&!e.hasFocus()&&!n.ui.overlayHost.contains(g)&&s()});let h=()=>{t.hidden||f(e)};return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),{update:f,destroy(){e.dom.removeEventListener("blur",p),e.dom.removeEventListener("pointerdown",c),document.removeEventListener("pointerup",u),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),t.remove()}}}})}function Bh(n){let e=n.ui.overlayHost.querySelector(".nova-context-toolbar:not([hidden]) button:not(:disabled)");return e?.focus(),!!e}var Hh=P(()=>{"use strict";K();Z();dn();$l()});var zh,di,Fh=P(()=>{"use strict";K();et();gt();zh=24,di=class{constructor(e,t,r,o){this.view=t;this.getPos=r;this.editor=o;this.node=e,this.dom=document.createElement("span"),this.dom.className="nova-image",this.img=document.createElement("img"),this.img.draggable=!1,this.dom.append(this.img);for(let i of["nw","ne","sw","se"]){let s=document.createElement("span");s.className=`nova-image-handle nova-image-handle-${i}`,s.dataset.corner=i,s.addEventListener("pointerdown",l=>this.startResize(l,i)),this.dom.append(s)}this.render()}view;getPos;editor;dom;img;node;resizing=!1;render(){let{src:e,alt:t,title:r,width:o,height:i,align:s}=this.node.attrs,l=Pe(e)?e:"";this.img.getAttribute("src")!==l&&this.img.setAttribute("src",l),this.setAttr("alt",t),this.setAttr("title",r),this.setAttr("class",Ve(this.node.attrs.class).class??null);let a=Ie(o),c=Ie(i);this.img.style.width=a?`${a}px`:"",this.img.style.aspectRatio=a&&c?`${a} / ${c}`:"",this.dom.dataset.align=s??""}setAttr(e,t){t?this.img.setAttribute(e,t):this.img.removeAttribute(e)}update(e){return e.type!==this.node.type?!1:(this.node=e,this.resizing||this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(e){return e.target.classList?.contains("nova-image-handle")??!1}ignoreMutation(){return!0}startResize(e,t){if(!this.editor.isEditable())return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget;r.setPointerCapture(e.pointerId);let o=this.img.getBoundingClientRect(),i=e.clientX,s=o.width,l=o.width>0?o.height/o.width:this.img.naturalHeight/(this.img.naturalWidth||1),a=Math.max(zh,this.view.dom.clientWidth-40),c=t==="ne"||t==="se"?1:-1,u=s;this.resizing=!0,this.dom.classList.add("is-resizing");let d=p=>{u=Math.round(Math.min(a,Math.max(zh,s+c*(p.clientX-i)))),this.img.style.width=`${u}px`,this.dom.dataset.size=`${u} \xD7 ${Math.round(u*l)}`},f=()=>{r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",f),r.removeEventListener("pointercancel",f),this.resizing=!1,this.dom.classList.remove("is-resizing"),delete this.dom.dataset.size;let p=this.getPos();if(p===void 0||Math.abs(u-s)<1)return this.render();let h=this.view.state.tr.setNodeMarkup(p,void 0,{...this.node.attrs,width:u,height:Math.round(u*l)});h.setSelection(B.create(h.doc,p)),this.view.dispatch(h)};r.addEventListener("pointermove",d),r.addEventListener("pointerup",f),r.addEventListener("pointercancel",f)}}});function ak(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ck(n,e){let{selection:t}=n.state;if(!t.empty)return null;let r=t.$from;if(!r.parent.isTextblock||r.parent.type.spec.code)return null;let o=r.parent.textBetween(Math.max(0,r.parentOffset-lk-1),r.parentOffset,"\0","\0");for(let[i,s]of e.ui.registry.getAutocompleters()){let l=new RegExp(`(?:^|\\s)${ak(s.trigger)}([\\p{L}\\p{N}_-]*)$`,"u"),a=o.match(l);if(!a)continue;let c=a[1]??"";if(c.length<(s.minChars??0))continue;let u=r.parentOffset-c.length-s.trigger.length,d=u>0?r.parent.textBetween(u-1,u,"\0","\0"):"";if(!(d&&!/\s/.test(d)))return{name:i,spec:s,from:r.pos-c.length-s.trigger.length,to:r.pos,query:c}}return null}function $h(n){let e,t=[],r=0,o=null,i=null,s=0,l=Ce("nova-ac"),a=()=>!e.hidden,c=h=>{e.hidden=!0,o=null,t=[],h.dom.removeAttribute("aria-activedescendant"),h.dom.removeAttribute("aria-controls"),h.dom.setAttribute("aria-expanded","false")},u=(h,m)=>{let g=t[m];if(!g||!o)return;let{spec:b,from:x,to:w}=o;c(h),b.onSelect(g,{from:x,to:w},n)},d=h=>{if(!o)return;let{spec:m}=o;if(e.replaceChildren(),e.setAttribute("aria-label",m.label),!t.length){if(!m.emptyText)return c(h);e.append(v("div",{className:"nova-ac-empty"},m.emptyText))}t.forEach((b,x)=>{let w=v("div",{id:`${l}-${x}`,className:"nova-menu-item nova-ac-item",role:"option","aria-selected":String(x===r)},b.icon?X(b.icon):null,v("span",{className:"nova-menu-label"},b.label),b.shortcut?v("kbd",{className:"nova-menu-shortcut"},Qe(b.shortcut)):b.detail?v("span",{className:"nova-menu-shortcut"},b.detail):null);w.addEventListener("mousedown",E=>{E.preventDefault(),u(h,x)}),w.addEventListener("mousemove",()=>{r!==x&&f(h,x)}),e.append(w)}),e.hidden=!1,h.dom.setAttribute("aria-controls",l),h.dom.setAttribute("aria-expanded","true"),f(h,Math.min(r,Math.max(0,t.length-1)));let g=h.coordsAtPos(o.from);kt(e,new DOMRect(g.left,g.top,1,g.bottom-g.top),"bottom-start")},f=(h,m)=>{r=m,e.querySelectorAll('[role="option"]').forEach((b,x)=>b.setAttribute("aria-selected",String(x===m)));let g=e.querySelector(`#${l}-${m}`);g&&(h.dom.setAttribute("aria-activedescendant",g.id),g.scrollIntoView?.({block:"nearest"}))},p=h=>{let m=n.isEditable()&&h.hasFocus()?ck(h,n):null;if(!m||m.from===i){m||(i=null),(a()||o)&&c(h);return}let g=!o||o.query!==m.query||o.from!==m.from;if(o=m,!g&&a())return d(h);let b=++s;Promise.resolve(m.spec.fetch(m.query,n)).then(x=>{b!==s||!o||(t=x.slice(0,m.spec.maxResults??10),r=0,d(h))})};return new _({key:new J("nova-autocompleter"),view(h){e=v("div",{className:"nova-popover nova-ac",id:l,role:"listbox",hidden:!0}),n.ui.overlayHost.append(e),h.dom.setAttribute("aria-autocomplete","list");let m=()=>c(h);return h.dom.addEventListener("blur",m),{update:g=>p(g),destroy(){h.dom.removeEventListener("blur",m),e.remove()}}},props:{handleKeyDown(h,m){if(!a()||!o)return!1;let g=t.length;switch(m.key){case"ArrowDown":return g&&f(h,(r+1)%g),!0;case"ArrowUp":return g&&f(h,(r-1+g)%g),!0;case"Enter":case"Tab":return g?(u(h,r),!0):!1;case"Escape":return i=o.from,c(h),!0;default:return!1}}}})}var lk,_h=P(()=>{"use strict";K();Z();dn();lk=30});function dk(n,e,t){let r=e.toLowerCase();if(!r)return n;let o=[];return n.forEach((i,s)=>{let l=t(i.label).toLowerCase(),a=[l,...l.split(/\s+/),...i.keywords],c=-1;l.startsWith(r)?c=3:a.some(u=>u.startsWith(r))?c=2:a.some(u=>u.includes(r))&&(c=1),c>0&&o.push([c,s,i])}),o.sort((i,s)=>s[0]-i[0]||i[1]-s[1]).map(([,,i])=>i)}function Vh(n,e=[]){let{t}=n.ui,r=[...uk,...e].filter(o=>n.isAllowed(o.name));n.ui.registry.addAutocompleter("slashcommands",{trigger:"/",label:t("slash.label"),emptyText:t("slash.empty"),fetch:o=>dk(r,o,t).map(i=>({value:i.name,label:t(i.label),icon:i.icon,...i.shortcut?{shortcut:i.shortcut}:{}})),onSelect:(o,i,s)=>{let l=r.find(a=>a.name===o.value);l&&(s.view.dispatch(s.view.state.tr.delete(i.from,i.to)),l.run(s))}})}var wt,uk,qh=P(()=>{"use strict";Sr();Hn();zn();j();wt=n=>e=>e.exec(n),uk=[{name:"paragraph",label:"paragraph",icon:M.paragraph,keywords:["text","p","paragraph"],run:wt("paragraph")},{name:"h1",label:"h1",icon:M.h1,keywords:["h1","heading","title"],shortcut:"Mod-Alt-1",run:wt("h1")},{name:"h2",label:"h2",icon:M.h2,keywords:["h2","heading","subtitle"],shortcut:"Mod-Alt-2",run:wt("h2")},{name:"h3",label:"h3",icon:M.h3,keywords:["h3","heading"],shortcut:"Mod-Alt-3",run:wt("h3")},{name:"bullist",label:"bulletList",icon:M.bulletList,keywords:["ul","list","bullet"],shortcut:"Mod-Shift-8",run:wt("bulletList")},{name:"numlist",label:"orderedList",icon:M.orderedList,keywords:["ol","list","numbered"],shortcut:"Mod-Shift-7",run:wt("orderedList")},{name:"blockquote",label:"blockquote",icon:M.blockquote,keywords:["quote","blockquote","citation"],run:wt("blockquote")},{name:"codeblock",label:"codeBlock",icon:M.codeBlock,keywords:["code","pre","snippet"],run:wt("codeBlock")},{name:"hr",label:"horizontalRule",icon:M.horizontalRule,keywords:["hr","divider","line","separator"],run:wt("horizontalRule")},{name:"table",label:"table",icon:M.table,keywords:["table","grid"],run:n=>n.exec(it(3,3))},{name:"image",label:"image",icon:M.image,keywords:["image","picture","photo","img"],run:n=>Wo(n)},{name:"link",label:"link",icon:M.link,keywords:["link","url","href"],shortcut:"Mod-k",run:n=>ot(n)}]});var fi,Wh=P(()=>{"use strict";Z();j();fi=class{region;closeLabel;constructor(e,t){this.closeLabel=t,this.region=v("div",{className:"nova-notifications","aria-live":"polite"}),e.append(this.region)}open(e){let t=e.type??"info",r=e.timeout??(t==="error"?0:4e3),o=v("span",{className:"nova-notification-text"},e.text),i=v("button",{type:"button",className:"nova-btn","aria-label":this.closeLabel},X(M.close)),s=v("div",{className:`nova-notification nova-notification-${t}`,role:t==="error"?"alert":"status"},o,i);this.region.append(s);let l=null,a=()=>{l&&clearTimeout(l),s.remove()};return i.addEventListener("click",a),r>0&&(l=setTimeout(a,r)),{close:a,setText:c=>o.textContent=c}}destroy(){this.region.remove()}}});var pi,Uh=P(()=>{"use strict";pi=class{controls=new Map;addButton(e,t){this.controls.set(e.toLowerCase(),{type:"button",...t})}addToggleButton(e,t){this.addButton(e,t)}addMenuButton(e,t){this.controls.set(e.toLowerCase(),{type:"menu",...t})}addPanelButton(e,t){this.controls.set(e.toLowerCase(),{type:"panel",...t})}addSplitButton(e,t){this.controls.set(e.toLowerCase(),{type:"split",...t})}menuItems=new Map;addMenuItem(e,t){this.menuItems.set(e.toLowerCase(),t)}addToggleMenuItem(e,t){this.addMenuItem(e,t)}getMenuItem(e){let t=this.menuItems.get(e.toLowerCase());if(t)return t;let r=this.get(e);if(!(r?.type!=="button"&&r?.type!=="split"))return{text:r.tooltip,...r.icon?{icon:r.icon}:{},...r.shortcut?{shortcut:r.shortcut}:{},onAction:r.onAction,...r.isActive?{isActive:r.isActive}:{},...r.isEnabled?{isEnabled:r.isEnabled}:{}}}contextToolbars=new Map;autocompleters=new Map;addAutocompleter(e,t){this.autocompleters.set(e.toLowerCase(),t)}getAutocompleters(){return[...this.autocompleters]}addContextToolbar(e,t){this.contextToolbars.set(e.toLowerCase(),t)}getContextToolbars(){return[...this.contextToolbars].sort((e,t)=>(t[1].priority??0)-(e[1].priority??0))}get(e){return this.controls.get(e.toLowerCase())}has(e){return this.controls.has(e.toLowerCase())}names(){return[...this.controls.keys()]}}});var fk,hi,jh=P(()=>{"use strict";Z();dn();fk=450,hi=class{el;timer=null;target=null;constructor(e){this.el=v("div",{className:"nova-tooltip",role:"tooltip",hidden:!0}),e.append(this.el)}attach(e){e.addEventListener("pointerenter",t=>{t.pointerType==="mouse"&&this.schedule(e)}),e.addEventListener("pointerleave",()=>this.hide()),e.addEventListener("focus",()=>{e.matches(":focus-visible")&&this.show(e)}),e.addEventListener("blur",()=>this.hide()),e.addEventListener("pointerdown",()=>this.hide())}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>this.show(e),fk)}show(e){this.clearTimer();let t=e.dataset.tooltip;if(!t||e.getAttribute("aria-expanded")==="true")return;this.target=e;let r=e.dataset.shortcut;this.el.replaceChildren(v("span",{},t)),r&&this.el.append(v("kbd",{},Qe(r))),this.el.hidden=!1,kt(this.el,e.getBoundingClientRect(),"bottom")}hide(){this.clearTimer(),this.el.hidden=!0,this.target=null}get current(){return this.target}destroy(){this.hide(),this.el.remove()}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}}});var mi,Kh=P(()=>{"use strict";At();Z();Wh();dn();Uh();jh();mi=class{constructor(e,t,r){this.focusEditor=r;this.t=t,this.overlayHost=v("div",{className:"nova-overlays"}),e.append(this.overlayHost),this.tooltip=new hi(this.overlayHost),this.notifications=new fi(e,t("dialog.close"))}focusEditor;registry=new pi;t;overlayHost;tooltip;notifications;popover=null;dialog=null;openPopover(e){this.closePopover(),this.tooltip.hide();let t=new _n({...e,host:this.overlayHost,onClose:r=>{this.popover===t&&(this.popover=null),e.onClose?.(r)}});return this.popover=t,t}closePopover(){this.popover?.close("api"),this.popover=null}get activePopover(){return this.popover}dialogListeners=new Set;onDialogOpen(e){return this.dialogListeners.add(e),()=>this.dialogListeners.delete(e)}closeOverlays(){this.closePopover(),this.dialogListeners.forEach(e=>e())}openDialog(e){this.closePopover(),this.dialogListeners.forEach(r=>r()),this.dialog?.close();let t=ec({cancelLabel:this.t("dialog.cancel"),closeLabel:this.t("dialog.close"),...e,host:this.overlayHost,returnFocus:this.focusEditor,onClose:()=>{this.dialog===t&&(this.dialog=null),e.onClose?.()}});return this.dialog=t,t}get activeDialog(){return this.dialog}notify(e){return this.notifications.open(typeof e=="string"?{text:e}:e)}destroy(){this.closePopover(),this.dialog?.close(),this.tooltip.destroy(),this.notifications.destroy(),this.overlayHost.remove()}}});function mk(n){let e=n.match(/[\p{L}\p{N}]+(?:['’-][\p{L}\p{N}]+)*/gu);return e?e.length:0}function Jh(n,e){e.className="nova-statusbar";let t=v("div",{className:"nova-path","aria-hidden":"true"}),r=v("div",{className:"nova-wordcount","aria-live":"off"});e.append(t,r);let o=n.options.resize,i=o?yk(n,e,o==="both"):null,s=null,l=()=>{let c=n.view.state.doc;r.textContent=n.ui.t("status.words",{count:mk(c.textBetween(0,c.content.size," "," "))})},a=c=>{let{$from:u}=n.view.state.selection,d=[];for(let p=1;p<=u.depth;p++){let h=u.node(p),m=pk[h.type.name]?.(h);m&&d.push(m)}n.view.state.selection.node?.type.name==="image"&&d.push("img");for(let p of u.marks()){let h=hk[p.type.name];h&&d.push(h)}t.textContent=d.join(" \u203A "),c&&(s&&clearTimeout(s),s=setTimeout(l,250))};return l(),a(!1),{update:a,destroy:()=>{s&&clearTimeout(s),i?.(),e.replaceChildren()}}}function yk(n,e,t){let r=n.root,o=v("div",{className:"nova-resize-handle",role:"separator",tabIndex:0,"aria-orientation":"horizontal","aria-label":n.ui.t("status.resize")});o.append(X(t?M.resizeHandleBoth:M.resizeHandle)),r.dataset.resize=t?"both":"vertical",e.append(o);let i=(d,f)=>{if(r.style.boxSizing="border-box",r.style.height=`${Math.max(gk,Math.round(d))}px`,t&&f!==void 0){let p=r.parentElement?.clientWidth||1/0;r.style.width=`${Math.min(p,Math.max(bk,Math.round(f)))}px`}o.setAttribute("aria-valuenow",String(r.offsetHeight))},s=null,l=d=>{n.isDisabled()||(d.preventDefault(),o.setPointerCapture(d.pointerId),s={x:d.clientX,y:d.clientY,height:r.offsetHeight,width:r.offsetWidth})},a=d=>{s&&i(s.height+d.clientY-s.y,s.width+d.clientX-s.x)},c=d=>{s&&(s=null,o.hasPointerCapture(d.pointerId)&&o.releasePointerCapture(d.pointerId))},u=d=>{let f=d.key==="ArrowDown"?gi:d.key==="ArrowUp"?-gi:0,p=t?d.key==="ArrowRight"?gi:d.key==="ArrowLeft"?-gi:0:0;!p&&!f||(d.preventDefault(),i(r.offsetHeight+f,r.offsetWidth+p))};return o.addEventListener("pointerdown",l),o.addEventListener("pointermove",a),o.addEventListener("pointerup",c),o.addEventListener("pointercancel",c),o.addEventListener("keydown",u),()=>{o.remove(),delete r.dataset.resize}}var pk,hk,gk,bk,gi,Gh=P(()=>{"use strict";Z();j();pk={paragraph:()=>"p",heading:n=>`h${n.attrs.level}`,blockquote:()=>"blockquote",code_block:()=>"pre",bullet_list:()=>"ul",ordered_list:()=>"ol",list_item:()=>"li",table:()=>"table",table_row:()=>"tr",table_cell:()=>"td",table_header:()=>"th"},hk={bold:"strong",italic:"em",underline:"u",strike:"s",code:"code",link:"a",subscript:"sub",superscript:"sup"};gk=100,bk=200,gi=20});function Xe(n,e){console.error(`[nova] ${n}`,...e===void 0?[]:[e])}function yi(n,e){if(typeof e!="string")return De.fromJSON(n,e);let t=document.createElement("div"),r=document.createElement("template");return r.innerHTML=e,t.appendChild(r.content),Ar(n).parse(t)}function _l(n){return new bi(n)}var vk,kk,wk,bi,Vl=P(()=>{"use strict";kp();Sp();Cp();Tp();Vo();pt();de();K();Rt();Oe();Pp();Sr();Bp();zp();Hn();Qp();zn();eh();oh();sh();uh();Hr();Ll();vh();Dl();et();ai();Dh();Ph();Hh();Fh();_h();qh();Kh();Gh();$l();vk=new yt,kk=new Set("P H1 H2 H3 H4 H5 H6 UL OL TABLE BLOCKQUOTE PRE HR DIV FIGURE".split(" ")),wk=0,bi=class{view;root;ui;options;listeners=new Map;ready;toolbar;toolbarHost;menubar;mode;pluginsByName=new Map;commandOverrides=new Map;transactionTransforms=[];cleanups=[];contentRules;schema;formatter;statusbar;searchBar;destroyed=!1;editable;disabled;pasteAsText;constructor(e){this.options=e,this.root=document.createElement("div"),this.root.className="nova-editor",e.element.appendChild(this.root);let t=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");r.className="nova-content";let i=document.createElement("div");i.className="nova-header";let s=document.createElement("div");i.append(s,t),this.root.append(i,r,o),this.toolbarHost=t,this.mode=e.mode??"classic",this.root.classList.add(`nova-mode-${this.mode}`);let l=this.mode==="distraction-free";this.mode!=="classic"&&(this.root.addEventListener("focusin",()=>this.root.classList.add("is-focused")),this.root.addEventListener("focusout",()=>{setTimeout(()=>{this.root.contains(document.activeElement)||this.root.classList.remove("is-focused")},0)})),this.ui=new mi(this.root,Rp(e.language,e.translations),()=>this.focus());let a=Fe({"Mod-k":()=>(ot(this),!0),"Alt-F9":()=>this.menubar?(this.menubar.focus(),!0):!1,"Alt-F10":()=>this.toolbar?(this.toolbar.focus(),!0):!1,"Ctrl-F9":()=>Bh(this),"Mod-f":()=>(this.openSearch(),!0),"Mod-Shift-f":()=>(Lr(this),!0),"Alt-0":()=>(li(this),!0),Escape:()=>this.searchBar.isOpen()?(this.searchBar.close(),!0):!1}),c=[...e.plugins??[]];l&&!c.includes("quickbars")&&c.push("quickbars");let u=Zl(c);u.errors.forEach(C=>Xe(C));let{ordered:d,errors:f}=Ni(u.plugins);f.forEach(C=>Xe(C));let p=d.flatMap(C=>this.collectPmPlugins(C)),h=e.validElements!==void 0||e.invalidElements!==void 0||e.validStyles!==void 0;this.contentRules=h?new si(e):null;let m=new Set([...Er(Object.values(e.formats??{}).flat()),...Er(e.styleFormats??[]),...Array.isArray(e.validClasses)?e.validClasses:[],...[...e.tableClassList??[],...e.tableCellClassList??[]].flatMap(C=>C.value.split(/\s+/).filter(Boolean))]);this.schema=this.buildSchema(d,e.validClasses===!0?()=>!0:C=>m.has(C)),this.formatter=new Yo(this,m);for(let[C,N]of Object.entries(e.formats??{}))this.formatter.register(C,N);d.forEach(C=>this.registerCommands(C));let g=yi(this.schema,e.content??""),b=yn.create({doc:this.contentRules?this.contentRules.normalizeDoc(g):g,plugins:[$h(this),Ip(C=>this.isAllowed(C),this.schema),a,...wf(),ph(),...Hp(C=>this.resolveCommand(C)),...d.some(C=>C.replaceHistory)?[]:[of()],Mp({color:"var(--nova-accent)",width:2}),Ap(),bf(this),gf(this),Yp(this),Rh(this),Ih(this),...this.contentRules?[ch(this.contentRules)]:[],...p,...e.prosemirrorPlugins??[]]});this.editable=e.editable??!0,this.disabled=e.disabled??!1,this.pasteAsText=e.pasteAsText??!1;let x=this.handleTransaction.bind(this);this.view=new Qt(r,{state:b,editable:()=>this.isEditable(),attributes:{class:"nova-prosemirror",role:"textbox","aria-multiline":"true","aria-label":this.ui.t("editor.label"),...e.placeholder?{"data-placeholder":e.placeholder}:{}},dispatchTransaction:function(C){x(C,this)},clipboardParser:Ar(this.schema),nodeViews:{image:(C,N,S)=>new di(C,N,S,this)},handleDOMEvents:{focus:()=>(this.emit("focus"),!1),blur:()=>(this.emit("blur"),!1)}}),this.root.classList.toggle("nova-readonly",!this.editable),this.applyDisabled(),Oh(this),ih(this),e.slashCommands!==!1&&Vh(this,e.slashCommands??[]),d.forEach(C=>this.setupPlugin(C)),e.setup?.(this);let w=e.menubar===!0?nh:typeof e.menubar=="string"?e.menubar:null;this.menubar=w?rh(this,s,w,{...th,...e.menu}):null,this.menubar||s.remove(),this.toolbar=e.toolbar===!1||l&&e.toolbar===void 0?null:Fl(this,t,this.toolbarConfig(),e.toolbarMode??"sliding",{warnUnknown:u.loaders.length===0}),this.toolbar||t.remove(),!this.toolbar&&!this.menubar&&i.remove(),this.searchBar=yh(this,r);let E=e.statusbar??this.mode==="classic";this.statusbar=E?Jh(this,o):null,this.statusbar||o.remove(),e.onChange&&this.on("change",e.onChange),this.updatePlaceholder();let D=this.applyContentStyles();this.ready=Promise.all([u.loaders.length?this.loadLazyPlugins(u.loaders):void 0,D]).then(()=>{})}applyContentStyles(){let{contentStyle:e,contentCss:t}=this.options,r=t===void 0?[]:Array.isArray(t)?t:[t];if(!e&&!r.length)return;let o=`nova-cs-${++wk}`;this.root.classList.add(o);let i=`.nova-editor.${o} .nova-prosemirror`,s=r.map(()=>""),l=null,a=()=>{this.destroyed||(l?.(),l=xp(this.root,vl([...s,e??""].join(`
|
|
37
|
-
`),i)))};if(this.cleanups.push(()=>l?.()),a(),!!r.length)return Promise.all(r.map((c,
|
|
43
|
+
`).trim()}function zd(n){let{t:e}=n.ui,t=Rg(Ld(n)),r=w("textarea",{className:"nova-input nova-source",spellcheck:"false","aria-label":e("sourceCode"),autocomplete:"off",rows:"18"});r.value=t,n.ui.openDialog({title:e("sourceCode"),body:r,size:"large",submitLabel:e("dialog.save"),initialFocus:r,onSubmit:()=>(r.value!==t&&Pd(n,r.value),!0)})}var sw=[{group:"help.formatting",rows:[{label:"bold",keys:"Mod-b"},{label:"italic",keys:"Mod-i"},{label:"underline",keys:"Mod-u"},{label:"strike",keys:"Mod-Shift-x"},{label:"code",keys:"Mod-e"},{label:"superscript",keys:"Mod-."},{label:"subscript",keys:"Mod-,"},{label:"link",keys:"Mod-k"},{label:"clearFormatting",keys:"Mod-\\"}]},{group:"help.blocks",rows:[{label:"paragraph",keys:"Mod-Alt-0"},{label:"h1",keys:"Mod-Alt-1"},{label:"h2",keys:"Mod-Alt-2"},{label:"h3",keys:"Mod-Alt-3"},{label:"bulletList",keys:"Mod-Shift-8"},{label:"orderedList",keys:"Mod-Shift-7"},{label:"alignCenter",keys:"Mod-Shift-e"},{label:"indent",keys:"Mod-]"},{label:"outdent",keys:"Mod-["}]},{group:"help.editing",rows:[{label:"undo",keys:"Mod-z"},{label:"redo",keys:"Mod-Shift-z"},{label:"search.title",keys:"Mod-f"},{label:"pasteAsText",keys:"Mod-Shift-v"},{label:"fullscreen",keys:"Mod-Shift-f"},{label:"help.slash",keys:"/"},{label:"moveBlockUp",keys:"Alt-Shift-ArrowUp"},{label:"moveBlockDown",keys:"Alt-Shift-ArrowDown"}]},{group:"help.navigation",rows:[{label:"help.toMenubar",keys:"Alt-F9"},{label:"help.toToolbar",keys:"Alt-F10"},{label:"help.toContextToolbar",keys:"Ctrl-F9"},{label:"help.toEditor",keys:"Escape"},{label:"help.nextCell",keys:"Tab"},{label:"help",keys:"Alt-0"}]}];function ho(n){let{t:e}=n.ui,t=w("div",{className:"nova-help"});for(let{group:r,rows:o}of sw)t.append(w("section",{},w("h3",{},e(r)),w("ul",{className:"nova-help-list"},o.map(({label:i,keys:s})=>w("li",{},w("span",{},e(i))," ",w("kbd",{},s.length===1?s:Ct(s)))))));n.ui.openDialog({title:e("help"),body:t,size:"large",cancelLabel:e("dialog.close")})}var jd={};j(jd,{defaultFontFamilies:()=>Bg,defaultFontSizes:()=>Fg,defaultLineHeights:()=>zg,registerBuiltins:()=>qd});var lw={color:Y.color,background:Y.color,font_family:Y.fontFamily,font_size:Y.length};function It(n,e){return(t,r)=>{let o=ce(t)[n],i=e===null?null:lw[n](e);if(e!==null&&!i)return!1;let{empty:s}=t.selection;if(!r)return!0;let l=t.tr;if(s)l.removeStoredMark(o),i&&l.addStoredMark(o.create({value:i}));else for(let a of t.selection.ranges)l.removeMark(a.$from.pos,a.$to.pos,o),i&&l.addMark(a.$from.pos,a.$to.pos,o.create({value:i}));return r(l.scrollIntoView()),!0}}function bt(n,e){let t=ce(n)[e],{$from:r,empty:o}=n.selection,i=o?n.storedMarks??r.marks():r.nodeAfter?.marks??r.marks(),s=t.isInSet(i);return s?s.attrs.value:null}function mo(n){return(e,t)=>{let r=n===null?null:Y.lineHeight(n);if(n!==null&&!r)return!1;let{from:o,to:i}=e.selection,s=e.tr,l=!1;return e.doc.nodesBetween(o,i,(a,c)=>{(a.type===X(e).paragraph||a.type===X(e).heading)&&(l=!0,s.setNodeMarkup(c,void 0,{...a.attrs,lineHeight:r}))}),l?(t?.(s),!0):!1}}function Vd(n){return n.selection.$from.parent.attrs.lineHeight??null}var as=["#000000","#434343","#666666","#999999","#b7b7b7","#d9d9d9","#efefef","#ffffff","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#fecaca","#fed7aa","#fef08a","#bbf7d0","#a5f3fc","#bfdbfe","#ddd6fe","#fbcfe8"];function cs(n){let t=[],r=n.current?.toLowerCase()??null,o=w("div",{className:"nova-swatches",role:"grid","aria-label":n.label}),i=null;for(let a of n.colors){let c=r===a.toLowerCase(),d=w("button",{type:"button",className:"nova-swatch",role:"gridcell","aria-label":a,"aria-selected":String(c),title:a,tabindex:"-1"},c?ee(C.check):null);d.style.setProperty("--swatch",a),d.addEventListener("click",()=>n.onPick(a)),t.push(d),(!i||i.childElementCount===8)&&(i=w("div",{className:"nova-swatch-row",role:"row"}),o.append(i)),i.append(d)}(t.find(a=>a.getAttribute("aria-selected")==="true")??t[0])?.setAttribute("tabindex","0"),o.addEventListener("keydown",a=>{let c=t.indexOf(te(o));if(c<0)return;let u={ArrowRight:1,ArrowLeft:-1,ArrowDown:8,ArrowUp:-8}[Ne(a,o)];if(u===void 0)return;a.preventDefault();let p=t[Math.min(t.length-1,Math.max(0,c+u))];t[c].tabIndex=-1,p.tabIndex=0,p.focus()});let s=w("button",{type:"button",className:"nova-panel-action"},ee(C.clearFormatting),n.removeLabel);s.addEventListener("click",()=>n.onPick(null));let l=w("input",{type:"color",className:"nova-color-input","aria-label":n.customLabel,value:/^#[0-9a-f]{6}$/i.test(r??"")?r:"#000000"});return l.addEventListener("change",()=>n.onPick(l.value)),w("div",{className:"nova-color-panel"},o,w("div",{className:"nova-panel-footer"},s,w("label",{className:"nova-panel-action"},l,n.customLabel)))}function Dg(n){let{registry:e,t}=n.ui,r=(i,s)=>t("table.size",{rows:i,cols:s});e.addPanelButton("table",{icon:C.table,tooltip:t("table.insert"),isEnabled:i=>i.can(_t(1,1)),render:(i,s)=>gd((l,a)=>{s(),i.exec(_t(l,a))},r,t("table.insert"))});let o=(i,s,l,a,c)=>e.addButton(i,{icon:l,tooltip:t(s),onAction:d=>d.exec(a),isEnabled:d=>d.can(a),...c?{isActive:c}:{}});o("tableinsertrowbefore","table.rowBefore",C.rowBefore,ze.addRowBefore),o("tableinsertrowafter","table.rowAfter",C.rowAfter,ze.addRowAfter),o("tabledeleterow","table.rowDelete",C.rowDelete,ze.deleteRow),o("tableinsertcolbefore","table.colBefore",C.colBefore,ze.addColumnBefore),o("tableinsertcolafter","table.colAfter",C.colAfter,ze.addColumnAfter),o("tabledeletecol","table.colDelete",C.colDelete,ze.deleteColumn),o("tablemergecells","table.merge",C.merge,ze.mergeCells),o("tablesplitcells","table.split",C.split,ze.splitCell),o("tablerowheader","table.rowHeader",C.rowHeader,ze.toggleHeaderRow,i=>fd(i.view.state)),o("tablecolheader","table.colHeader",C.colHeader,ze.toggleHeaderColumn,i=>hd(i.view.state)),o("tabledelete","table.delete",C.tableDelete,ze.deleteTable),e.addPanelButton("tablecellbackground",{icon:C.highlight,tooltip:t("table.cellBackground"),isEnabled:i=>Jt(i.view.state),render:(i,s)=>cs({colors:i.options.colors??as,current:null,label:t("table.cellBackground"),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:l=>{s(),i.exec(pd(l))}})}),e.addMenuButton("advtablesort",{icon:C.sort,tooltip:t("table.sort"),isEnabled:i=>i.can(ts("asc")),items:i=>{let s=["asc","desc"].map(a=>({id:a,label:t(a==="asc"?"table.sortAsc":"table.sortDesc"),onSelect:()=>i.exec(ts(a,i.options.language))})),l=i.ui.registry.getMenuItem("advtablesort");return l?[...s,{id:"advanced",label:l.text,onSelect:()=>l.onAction(i)}]:s}}),e.addButton("tableprops",{icon:C.tableProps,tooltip:t("table.props"),isEnabled:i=>Jt(i.view.state),onAction:i=>{import(__novaChunk("tinymce-chunks/table-dialogs-0445847c.js") ).then(s=>s.openTableProps(i))}}),e.addButton("tablecellprops",{icon:C.cellProps,tooltip:t("table.cellProps"),isEnabled:i=>Jt(i.view.state),onAction:i=>{import(__novaChunk("tinymce-chunks/table-dialogs-0445847c.js") ).then(s=>s.openCellProps(i))}}),e.addContextToolbar("table",{label:t("table.toolbar"),predicate:i=>Jt(i.view.state),anchor:i=>md(i),placement:"bottom-start",items:"tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | tablerowheader tablecolheader tablecellbackground | advtablesort advtablerownumbering tablecellprops tableprops | tabledelete"})}var Bg=[{label:"Sans Serif",value:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},{label:"Serif",value:'Georgia, "Times New Roman", serif'},{label:"Monospace",value:"ui-monospace, Menlo, Consolas, monospace"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:'"Times New Roman", Times, serif'},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Courier New",value:'"Courier New", Courier, monospace'}],Fg=["8pt","10pt","12pt","14pt","16pt","18pt","24pt","36pt","48pt"],zg=["1","1.15","1.5","2","2.5","3"],nt={undo:"Mod-z",redo:"Mod-Shift-z",bold:"Mod-b",italic:"Mod-i",underline:"Mod-u",strike:"Mod-Shift-x",code:"Mod-e",subscript:"Mod-,",superscript:"Mod-.",bulletList:"Mod-Shift-8",orderedList:"Mod-Shift-7",alignLeft:"Mod-Shift-l",alignCenter:"Mod-Shift-e",alignRight:"Mod-Shift-r",alignJustify:"Mod-Shift-j",indent:"Mod-]",outdent:"Mod-[",clearFormatting:"Mod-\\",paragraph:"Mod-Alt-0",h1:"Mod-Alt-1",h2:"Mod-Alt-2",h3:"Mod-Alt-3",h4:"Mod-Alt-4",h5:"Mod-Alt-5",h6:"Mod-Alt-6"};function _g(n){try{let{node:e}=n.view.domAtPos(n.view.state.selection.from),t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;return t?getComputedStyle(t):null}catch{return null}}var aw={"system-ui":"Sans Serif","-apple-system":"Sans Serif","sans-serif":"Sans Serif",serif:"Serif",monospace:"Monospace","ui-monospace":"Monospace"};function Ig(n){let e=String(n).split(",")[0].trim().replace(/["']/g,"");return aw[e.toLowerCase()]??e}function cw(n){let e=parseFloat(n);return!Number.isFinite(e)||e<=0?null:`${Math.round(e*.75*2)/2}pt`}var Hg=(n,e)=>typeof n=="string"&&n.replace(/["'\s]/g,"").toLowerCase()===e.replace(/["'\s]/g,"").toLowerCase();function qd(n){let{registry:e,t}=n.ui,r=()=>n.view.state,o=(v,k,E,b)=>e.addButton(v,{icon:E,tooltip:t(k),...nt[k]?{shortcut:nt[k]}:{},onAction:A=>A.exec(k),isEnabled:A=>A.can(k),...b?{isActive:b}:{}}),i=(v,k,E,b)=>o(v,k,b,()=>sr(r(),n.schema.marks[E]));o("undo","undo",C.undo),o("redo","redo",C.redo),i("bold","bold","bold",C.bold),i("italic","italic","italic",C.italic),i("underline","underline","underline",C.underline),i("strikethrough","strike","strike",C.strike),i("inlinecode","code","code",C.code),i("subscript","subscript","subscript",C.subscript),i("superscript","superscript","superscript",C.superscript),o("bullist","bulletList",C.bulletList,()=>Xe(r(),n.schema.nodes.bullet_list)),o("numlist","orderedList",C.orderedList,()=>Xe(r(),n.schema.nodes.ordered_list)),o("indent","indent",C.indent),o("outdent","outdent",C.outdent),o("blockquote","blockquote",C.blockquote,()=>Xe(r(),n.schema.nodes.blockquote)),o("codeblock","codeBlock",C.codeBlock,()=>Xe(r(),n.schema.nodes.code_block)),o("hr","horizontalRule",C.horizontalRule),o("removeformat","clearFormatting",C.clearFormatting);let s=[["alignLeft","left",C.alignLeft],["alignCenter","center",C.alignCenter],["alignRight","right",C.alignRight],["alignJustify","justify",C.alignJustify]];for(let[v,k,E]of s)o(v.toLowerCase(),v,E,()=>Xt(r())===k);e.addMenuButton("align",{icon:C.alignLeft,tooltip:t("align"),isEnabled:v=>v.can("alignLeft"),items:v=>s.map(([k,E,b])=>({id:k,label:t(k),icon:b,...nt[k]?{shortcut:nt[k]}:{},active:Xt(v.view.state)===E,onSelect:()=>v.exec(k)}))});let l=[{command:"paragraph",style:""},{command:"h1",style:"font-size: 1.6em; font-weight: 700"},{command:"h2",style:"font-size: 1.35em; font-weight: 700"},{command:"h3",style:"font-size: 1.15em; font-weight: 700"},{command:"h4",style:"font-size: 1em; font-weight: 700"},{command:"h5",style:"font-size: 0.9em; font-weight: 700"},{command:"h6",style:"font-size: 0.85em; font-weight: 700"},{command:"codeBlock",style:"font-family: ui-monospace, monospace"}],a=()=>{let v=r().selection.$from.parent;return v.type===n.schema.nodes.heading?`h${v.attrs.level}`:v.type===n.schema.nodes.code_block?"codeBlock":"paragraph"};for(let v=1;v<=6;v++){let k=`h${v}`;e.addToggleButton(k,{...v<=3?{icon:C[`h${v}`]}:{text:`H${v}`},tooltip:t(k),...nt[k]?{shortcut:nt[k]}:{},isActive:()=>a()===k,isEnabled:E=>E.can(k)||a()===k,onAction:E=>E.exec(a()===k?"paragraph":k)})}let c={p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",pre:"codeBlock"},d=()=>{let v=n.options.blockFormats;return v?.length?v.flatMap(({label:k,block:E})=>{let b=c[E],A=l.find(H=>H.command===b);return A?[{...A,label:k}]:[]}):l};e.addMenuButton("blocks",{tooltip:t("blocks"),label:()=>d().find(v=>v.command===a())?.label??t(a()),minChars:11,isEnabled:v=>d().some(({command:k})=>v.can(k)),items:v=>d().filter(({command:k})=>v.isAllowed(k)).map(({command:k,style:E,label:b})=>({id:k,label:b??t(k),labelStyle:E,...nt[k]?{shortcut:nt[k]}:{},active:a()===k,onSelect:()=>v.exec(k)}))});let u="p,h1,h2,h3,h4,h5,h6",p=()=>[{title:t("styles.headings"),items:[1,2,3,4,5,6].map(v=>({title:t(`h${v}`),block:`h${v}`}))},{title:t("styles.inline"),items:[{title:t("bold"),inline:"strong"},{title:t("italic"),inline:"em"},{title:t("underline"),inline:"u"},{title:t("strike"),inline:"s"},{title:t("superscript"),inline:"sup"},{title:t("subscript"),inline:"sub"},{title:t("code"),inline:"code"}]},{title:t("styles.blocks"),items:[{title:t("paragraph"),block:"p"},{title:t("blockquote"),block:"blockquote"},{title:t("codeBlock"),block:"pre"}]},{title:t("styles.align"),items:["left","center","right","justify"].map(v=>({title:t(`align${v==="justify"?"Justify":v[0].toUpperCase()+v.slice(1)}`),selector:u,styles:{"text-align":v}}))}],f=v=>v.format??v,h=v=>{let k=v.format?n.formatter.get(v.format)?.[0]:v,E=[],b=k?.block;b&&/^h[1-6]$/.test(b)&&E.push("font-weight: 700"),(k?.inline==="strong"||k?.inline==="b")&&E.push("font-weight: 700"),(k?.inline==="em"||k?.inline==="i")&&E.push("font-style: italic"),k?.inline==="u"&&E.push("text-decoration: underline"),(k?.inline==="s"||k?.inline==="strike"||k?.inline==="del")&&E.push("text-decoration: line-through"),(k?.inline==="code"||b==="pre")&&E.push("font-family: ui-monospace, monospace");for(let A of["color","background-color","font-family"]){let H=k?.styles?.[A];H&&/^[#\w\s,'"().%-]+$/.test(H)&&E.push(`${A}: ${H}`)}return E.join("; ")},m=v=>v.flatMap(k=>k.items?m(k.items):[k]),g=()=>{let v=n.options.styleFormats,k=v?n.options.styleFormatsMerge?[...p(),...v]:v:p(),E=e.getStyleFormats();return E.items.length?E.replace?[...E.items]:[...k,...E.items]:k};e.addMenuButton("styles",{tooltip:t("styles"),minChars:10,label:v=>m(g()).find(k=>v.formatter.match(f(k)))?.title??t("styles"),items:v=>{let k=[],E=(b,A)=>{b.forEach((H,$)=>{if(H.items){k.length&&k.push({type:"separator"}),k.push({type:"heading",label:H.title}),E(H.items,`${A}${$}-`);return}k.push({id:`style-${A}${$}`,label:H.title,labelStyle:h(H),active:v.formatter.match(f(H)),disabled:!v.formatter.canApply(f(H)),onSelect:()=>v.formatter.toggle(f(H))})})};return E(g(),""),k}});let y=n.options.fontFamilies??Bg;e.addMenuButton("fontfamily",{tooltip:t("fontFamily"),minChars:9,label:v=>{let k=bt(r(),"font_family");if(k)return y.find(b=>Hg(k,b.value))?.label??Ig(k);let E=_g(v)?.fontFamily;return E?Ig(E):t("fontFamily")},items:v=>{let k=bt(v.view.state,"font_family");return[{id:"default",label:t("default"),active:k===null,onSelect:()=>v.exec(It("font_family",null))},{type:"separator"},...y.map(E=>({id:E.label,label:E.label,labelStyle:`font-family: ${E.value}`,active:Hg(k,E.value),onSelect:()=>v.exec(It("font_family",E.value))}))]}});let x=n.options.fontSizes??Fg;e.addMenuButton("fontsize",{tooltip:t("fontSize"),minChars:4,label:v=>bt(r(),"font_size")??cw(_g(v)?.fontSize??"")??"\u2014",items:v=>{let k=bt(v.view.state,"font_size");return[{id:"default",label:t("default"),active:k===null,onSelect:()=>v.exec(It("font_size",null))},{type:"separator"},...x.map(E=>({id:E,label:E,active:k===E,onSelect:()=>v.exec(It("font_size",E))}))]}});let M=n.options.lineHeights??zg;e.addMenuButton("lineheight",{icon:C.lineHeight,tooltip:t("lineHeight"),isEnabled:v=>v.can(mo(null)),items:v=>{let k=Vd(v.view.state);return[{id:"default",label:t("default"),active:k===null,onSelect:()=>v.exec(mo(null))},...M.map(E=>({id:E,label:E,active:k===E,onSelect:()=>v.exec(mo(E))}))]}});let L=(v,k,E,b)=>e.addPanelButton(v,{icon:E,tooltip:t(b),indicator:()=>bt(r(),k),render:(A,H)=>cs({colors:A.options.colors??as,current:bt(A.view.state,k),label:t(b),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:$=>{H(),A.exec(It(k,$))}})});L("forecolor","color",C.textColor,"textColor"),L("backcolor","background",C.highlight,"backgroundColor");let O=[["superscript","superscript",C.superscript],["subscript","subscript",C.subscript],["code","code",C.code]];e.addMenuButton("moreformats",{icon:C.formatMore,tooltip:t("moreFormats"),isActive:v=>O.some(([,k])=>sr(v.view.state,n.schema.marks[k])),items:v=>[...O.filter(([k])=>v.isAllowed(k)).map(([k,E,b])=>({id:k,label:t(k),icon:b,checkbox:!0,active:sr(v.view.state,n.schema.marks[E]),disabled:!v.can(k),...nt[k]?{shortcut:nt[k]}:{},onSelect:()=>v.exec(k)})),{type:"separator"},{id:"clearFormatting",label:t("clearFormatting"),icon:C.clearFormatting,disabled:!v.can("clearFormatting"),shortcut:nt.clearFormatting,onSelect:()=>v.exec("clearFormatting")},{id:"pasteAsText",label:t("pasteAsText"),icon:C.pasteText,checkbox:!0,active:v.isPasteAsText(),onSelect:()=>{v.setPasteAsText(!v.isPasteAsText()),v.focus()}}]}),e.addToggleButton("pastetext",{icon:C.pasteText,tooltip:t("pasteAsText"),isActive:v=>v.isPasteAsText(),onAction:v=>{v.setPasteAsText(!v.isPasteAsText()),v.focus()}}),e.addButton("link",{icon:C.link,tooltip:t("link"),shortcut:"Mod-k",onAction:v=>Dt(v),isActive:()=>!!En(r())}),e.addButton("unlink",{icon:C.unlink,tooltip:t("unlink"),onAction:v=>v.exec(cr()),isEnabled:v=>v.can(cr())}),e.addButton("image",{icon:C.image,tooltip:t("image"),onAction:v=>io(v)});let B=()=>Qe(r())?.attrs.align??null,J=(v,k,E,b)=>e.addToggleButton(v,{icon:E,tooltip:t(b),isActive:()=>B()===k,onAction:A=>A.exec(ar({align:B()===k?null:k}))});J("imagealignleft","left",C.imageLeft,"image.alignLeft"),J("imagealigncenter","center",C.imageCenter,"image.alignCenter"),J("imagealignright","right",C.imageRight,"image.alignRight");let P=[["image.sizeSmall",.25],["image.sizeMedium",.5],["image.sizeLarge",.75],["image.sizeFull",1],["image.sizeOriginal",null]];e.addMenuButton("imagesize",{icon:C.resize,tooltip:t("image.size"),items:v=>P.map(([k,E])=>({id:k,label:t(k),onSelect:()=>Zc(v,E)}))}),e.addButton("imagealt",{icon:C.altText,tooltip:t("image.editAlt"),onAction:v=>Qc(v)}),e.addToggleButton("imagecaption",{icon:C.imageCaption,tooltip:t("image.caption"),isActive:v=>Gc(v.view.state),onAction:v=>v.exec(Yc)}),e.addButton("imagedelete",{icon:C.trash,tooltip:t("image.delete"),onAction:v=>v.exec((k,E)=>{let b=Qe(k);return b?(E?.(k.tr.delete(b.pos,b.pos+b.node.nodeSize).scrollIntoView()),!0):!1})}),Dg(n),e.addButton("searchreplace",{icon:C.search,tooltip:t("search.title"),shortcut:"Mod-f",onAction:v=>v.openSearch()}),e.addToggleButton("fullscreen",{icon:C.fullscreen,tooltip:t("fullscreen"),shortcut:"Mod-Shift-f",isActive:v=>ls(v),onAction:v=>mr(v)}),e.addButton("preview",{icon:C.preview,tooltip:t("preview"),onAction:v=>Fd(v)}),e.addButton("code",{icon:C.sourceCode,tooltip:t("sourceCode"),onAction:v=>zd(v)}),e.addButton("help",{icon:C.help,tooltip:t("help"),shortcut:"Alt-0",onAction:v=>ho(v)}),e.addContextToolbar("image",{label:t("image.toolbar"),predicate:v=>!!Qe(v.view.state),items:"imagealignleft imagealigncenter imagealignright | imagesize imagealt imagecaption | imagedelete",anchor:v=>{let k=Qe(v.view.state);return(k?v.view.nodeDOM(k.pos):null)?.getBoundingClientRect()??null}})}var Jd={};j(Jd,{addLinkNote:()=>dw,linkBubblePlugin:()=>Ud});var Wd={};j(Wd,{Popover:()=>Tn,positionFloating:()=>kt,visibleArea:()=>ps});var ds=6,us=8;function ps(){let n=window.visualViewport;return n?{left:n.offsetLeft,top:n.offsetTop,right:n.offsetLeft+n.width,bottom:n.offsetTop+n.height}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}}function kt(n,e,t){let r=ps(),o=n.offsetWidth,i=n.offsetHeight,s=r.bottom-e.bottom,l=e.top-r.top,c=t==="top-start"||t==="top-end"?l>=i+ds||l>s:s<i+ds&&l>s,d=c?e.top-i-ds:e.bottom+ds,u=Bn(n),f=t==="bottom"?e.left+e.width/2-o/2:(t==="bottom-end"||t==="top-end")!==u?e.right-o:e.left;f=Math.max(r.left+us,Math.min(f,r.right-o-us)),d=Math.max(r.top+us,Math.min(d,r.bottom-i-us)),n.style.left=`${Math.round(f)}px`,n.style.top=`${Math.round(d)}px`,n.dataset.side=c?"top":"bottom"}var go=[],Tn=class{constructor(e){S(this,"el");S(this,"options");S(this,"closed",!1);S(this,"unlisten",[]);S(this,"reposition",()=>{if(this.closed)return;let{anchor:e,placement:t="bottom-start"}=this.options,r=typeof e=="function"?e():e.getBoundingClientRect();kt(this.el,r,t)});S(this,"focusWasInside",!1);S(this,"onKeyDown",(e,t)=>{e.key!=="Escape"||e.defaultPrevented||go[go.length-1]===this&&(t?.closest?.(".nova-dialog")||(e.preventDefault(),e.stopPropagation(),this.focusWasInside=this.el.contains(te(this.el)),this.close("escape")))});S(this,"onPointerDown",(e,t)=>{this.options.dismissOnOutside!==!1&&(this.el.contains(t)||this.options.ignore?.some(r=>r.contains(t))||this.close("outside"))});this.options=e,this.el=document.createElement("div"),this.el.className=`nova-popover ${e.className??""}`.trim(),this.el.append(e.content),e.host.append(this.el),this.reposition(),this.unlisten=[ct(this.el,"keydown",this.onKeyDown),ct(this.el,"pointerdown",this.onPointerDown)],go.push(this),window.addEventListener("resize",this.reposition),window.addEventListener("scroll",this.reposition,!0)}get isOpen(){return!this.closed}close(e="api"){this.closed||(this.closed=!0,go.splice(go.indexOf(this),1),this.unlisten.forEach(t=>t()),window.removeEventListener("resize",this.reposition),window.removeEventListener("scroll",this.reposition,!0),this.el.remove(),this.options.onClose?.(e))}};var Kd=new WeakMap;function dw(n,e){let t=Kd.get(n)??new Set;return Kd.set(n,t),t.add(e),()=>t.delete(e)}function Ud(n){return new z({key:new Z("nova-link-bubble"),view(e){let{t}=n.ui,r=w("a",{className:"nova-bubble-link",target:"_blank",rel:"noopener noreferrer"}),o=(h,m,g)=>{let y=w("button",{type:"button",className:"nova-btn","aria-label":m,"data-tooltip":m},ee(h));return y.addEventListener("click",g),n.ui.tooltip.attach(y),y},i=w("div",{className:"nova-bubble-row"},ee(C.externalLink),r,w("span",{className:"nova-bubble-sep"}),o(C.edit,t("link.edit"),()=>Dt(n)),o(C.copy,t("link.copy"),()=>{navigator.clipboard?.writeText(r.href).then(()=>n.ui.notify({text:t("link.copied"),type:"success",timeout:2e3}))}),o(C.unlink,t("unlink"),()=>n.exec(cr()))),s=w("span",{className:"nova-bubble-note-text"}),l=w("button",{type:"button",className:"nova-button nova-bubble-note-action"}),a=w("div",{className:"nova-bubble-note",hidden:!0},s,l),c=w("div",{className:"nova-bubble nova-link-bubble",role:"toolbar","aria-label":t("link"),hidden:!0},i,a),d=null;l.addEventListener("click",()=>d?.()),c.addEventListener("mousedown",h=>{h.target.closest("button")&&h.preventDefault()}),n.ui.overlayHost.append(c);let u=()=>{c.hidden=!0},p=()=>{let h=e.state,m=En(h),g=e.hasFocus()||c.contains(te(c));if(!m||!g||!n.isEditable()||n.ui.activeDialog||!h.selection.empty){u();return}let y=Cn(h,ce(h).link,h.selection.from);if(!y)return u();r.textContent=m.href,r.title=m.href;let x=null;for(let B of Kd.get(n)??[])if(x=B(m.href),x)break;a.hidden=!x,s.textContent=x?.text??"",l.hidden=!x?.action,l.textContent=x?.action?.label??"",d=x?.action?.run??null,Ie(m.href)?r.setAttribute("href",m.href):r.removeAttribute("href"),c.hidden=!1;let M=e.coordsAtPos(y.from),L=e.coordsAtPos(y.to),O=new DOMRect(M.left,M.top,Math.max(1,L.right-M.left),L.bottom-M.top);kt(c,O,"bottom-start")},f=h=>{c.contains(h.relatedTarget)||u()};return e.dom.addEventListener("blur",f),c.addEventListener("focusout",h=>{!c.contains(h.relatedTarget)&&!e.hasFocus()&&u()}),{update:p,destroy(){e.dom.removeEventListener("blur",f),c.remove()}}}})}var Gd="undo redo | blocks | bold italic underline strikethrough moreformats | forecolor backcolor | link image table | bullist numlist | align lineheight outdent indent | fontfamily fontsize | blockquote codeblock hr | removeformat | searchreplace preview code fullscreen help";function Yd(n){let e=Array.isArray(n)?n:n.split(/\s+/),t=[[]];for(let r of e){let o=r.trim();o&&(o==="|"?t.push([]):t[t.length-1].push(o))}return t.filter(r=>r.length>0)}function Xd(n,e,t,r,{warnUnknown:o=!0}={}){let{ui:i}=n,s=i.t,l=new AbortController,{signal:a}=l;e.className=`nova-toolbar nova-toolbar-${r}`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label",s("toolbar.label"));let c=[],d=[];for(let k of Yd(t)){let E=w("div",{className:"nova-tb-group",role:"group"});for(let b of k){if(!n.isAllowed(b))continue;let A=i.registry.get(b);if(!A){o&&console.warn(`[nova] Unknown toolbar item "${b}"`);continue}let H=yo(n,b,A);c.push(H),E.append(H.el)}E.childElementCount&&(d.push(E),e.append(E))}let u=r==="floating"||r==="sliding",p=r==="sliding",f=w("div",{className:p?"nova-toolbar nova-tb-strip":"nova-toolbar nova-tb-overflow",role:"group",id:qe("nova-tb-more"),"aria-label":s("more"),hidden:p}),h=w("button",{type:"button",className:"nova-btn nova-tb-more","aria-label":s("more"),"aria-expanded":"false","data-tooltip":s("more"),hidden:!0,...p?{"aria-controls":f.id}:{"aria-haspopup":"true"}},ee(C.more));i.tooltip.attach(h);let m=null,g=()=>{m?.close(),m=null,p&&!f.hidden&&(f.hidden=!0,h.setAttribute("aria-expanded","false"))},y=i.onDialogOpen(()=>{p||g()});h.addEventListener("click",k=>{if(p){let b=f.hidden;f.hidden=!b,h.setAttribute("aria-expanded",String(b)),b&&k.detail===0&&f.querySelector("button:not(:disabled)")?.focus();return}if(m)return g();h.setAttribute("aria-expanded","true");let E=new Tn({host:i.overlayHost,anchor:h,placement:"bottom-end",content:f,className:"nova-tb-overflow-popover",ignore:[i.overlayHost,h],onClose:b=>{m=null,h.setAttribute("aria-expanded","false"),b==="escape"&&E.focusWasInside&&h.focus()}});m=E,k.detail===0&&f.querySelector("button:not(:disabled)")?.focus()}),u&&e.append(h),p&&e.after(f),r==="scrolling"&&e.addEventListener("focusin",k=>k.target.scrollIntoView?.({block:"nearest",inline:"nearest"}),{signal:a});let x=()=>{if(!u)return;for(let E of d)e.insertBefore(E,h);if(h.hidden=!0,e.scrollWidth<=e.clientWidth+1){g();return}h.hidden=!1;let k=d.length;for(;k>1&&e.scrollWidth>e.clientWidth+1;)k-=1,f.prepend(d[k]);f.childElementCount||(h.hidden=!0,g()),m?.reposition(),J()},M=-1,L=typeof ResizeObserver<"u"&&u?new ResizeObserver(()=>{e.clientWidth!==M&&(M=e.clientWidth,x())}):null;L?.observe(e);let O=()=>[...e.querySelectorAll("button")].filter(k=>!k.disabled&&!k.hidden),B=null,J=()=>{let k=O();(!B||!k.includes(B))&&(B=k[0]??null);for(let E of e.querySelectorAll("button"))E.tabIndex=E===B?0:-1};e.addEventListener("focusin",k=>{let E=k.target;E instanceof HTMLButtonElement&&e.contains(E)&&(B=E,J())},{signal:a}),e.addEventListener("keydown",k=>{let E=O(),b=E.indexOf(te(e));if(b<0)return;let A=null,H=Ne(k,e);if(H==="ArrowRight")A=b+1;else if(H==="ArrowLeft")A=b-1;else if(k.key==="Home")A=0;else if(k.key==="End")A=E.length-1;else if(k.key==="Escape"){k.preventDefault(),n.focus();return}A!==null&&(k.preventDefault(),E[(A+E.length)%E.length].focus())},{signal:a});let P=k=>{k.target.closest("button")&&k.preventDefault()};e.addEventListener("mousedown",P,{signal:a}),f.addEventListener("mousedown",P),f.addEventListener("keydown",k=>{if(k.key==="Escape"){p&&(k.preventDefault(),g(),h.focus());return}let E=[...f.querySelectorAll("button")].filter(H=>!H.disabled),b=E.indexOf(te(f));if(b<0)return;let A=Ne(k,f);A==="ArrowRight"||A==="ArrowDown"?(k.preventDefault(),E[(b+1)%E.length].focus()):(A==="ArrowLeft"||A==="ArrowUp")&&(k.preventDefault(),E[(b-1+E.length)%E.length].focus())});let v=()=>{for(let k of c)k.update();J()};return v(),x(),{update:v,focus:()=>{J(),B?.focus()},destroy:()=>{L?.disconnect(),y(),g(),l.abort(),e.replaceChildren(),p&&f.remove()}}}function yo(n,e,t){if(t.type==="split")return uw(n,e,t);let{ui:r}=n,o=w("button",{type:"button",className:`nova-btn nova-tb-${t.type}`,"aria-label":t.tooltip,"data-tooltip":t.tooltip,"data-control":e,...t.shortcut?{"data-shortcut":t.shortcut}:{}});r.tooltip.attach(o),t.icon&&o.append(ee(t.icon));let i=t.type==="menu"&&(t.label||t.text)?w("span",{className:"nova-tb-label"}):null;i?(t.type==="menu"&&t.minChars&&(i.style.minWidth=`${t.minChars}ch`),o.append(i),o.classList.add("nova-tb-has-label")):!t.icon&&t.text&&o.append(t.text);let s=null;return t.type==="panel"&&t.indicator&&(s=w("span",{className:"nova-color-bar"}),o.append(s)),t.type!=="button"&&(o.setAttribute("aria-haspopup",t.type==="menu"?"menu":"dialog"),o.setAttribute("aria-expanded","false"),o.append(ee(C.chevronDown)),o.lastElementChild?.classList.add("nova-chevron")),o.addEventListener("click",a=>{if(t.type==="button"){t.onAction(n);return}if(o.getAttribute("aria-expanded")==="true"){r.closePopover();return}let c=a.detail===0,d=()=>r.closePopover(),u=t.type==="menu"?uo(t.items(n),d,t.tooltip):t.render(n,d);o.setAttribute("aria-expanded","true");let p=r.openPopover({anchor:o,content:u,ignore:[o],className:t.type==="menu"?"nova-popover-menu":"nova-popover-panel",onClose:f=>{o.setAttribute("aria-expanded","false"),f==="escape"&&p.focusWasInside&&o.focus()}});t.type==="menu"?po(u):c&&u.querySelector("button, input")?.focus()}),t.type!=="button"&&o.addEventListener("keydown",a=>{a.key==="ArrowDown"&&o.getAttribute("aria-expanded")!=="true"&&(a.preventDefault(),o.click())}),{el:o,update:()=>{let a=n.isEditable();if(o.disabled=!a||(t.isEnabled?!t.isEnabled(n):!1),t.isActive){let c=t.isActive(n);o.classList.toggle("is-active",c),t.type==="button"&&o.setAttribute("aria-pressed",String(c))}if(i&&t.type==="menu"){let c=t.label?.(n)??t.text??"";i.textContent=c,o.setAttribute("aria-label",c&&c!==t.tooltip?`${c}, ${t.tooltip}`:t.tooltip??c)}if(s&&t.type==="panel"&&t.indicator){let c=t.indicator(n);s.style.background=c??"",s.classList.toggle("is-empty",!c)}}}}function uw(n,e,t){let r=yo(n,e,{type:"button",tooltip:t.tooltip,onAction:t.onAction,...t.icon?{icon:t.icon}:{},...t.text?{text:t.text}:{},...t.shortcut?{shortcut:t.shortcut}:{},...t.isActive?{isActive:t.isActive}:{},...t.isEnabled?{isEnabled:t.isEnabled}:{}}),o=yo(n,`${e}-options`,{type:"menu",tooltip:`${t.tooltip}: ${n.ui.t("toolbar.options")}`,items:t.items,...t.isEnabled?{isEnabled:t.isEnabled}:{}});return o.el.classList.add("nova-tb-split-more"),{el:w("span",{className:"nova-tb-split"},r.el,o.el),update:()=>{r.update(),o.update()}}}function $g(n){return new z({key:new Z("nova-context-toolbar"),view(e){let t=w("div",{className:"nova-bubble nova-context-toolbar",role:"toolbar",hidden:!0});n.ui.overlayHost.append(t);let r=new Map,o=null,i=(y,x)=>{let M=r.get(y);if(M)return M;let L=w("div",{className:"nova-context-items"}),O=[];return Yd(x.items).forEach((B,J)=>{J>0&&L.append(w("span",{className:"nova-bubble-sep",role:"separator"}));for(let P of B){if(!n.isAllowed(P))continue;let v=n.ui.registry.get(P);if(!v)continue;let k=yo(n,P,v);O.push(k),L.append(k.el)}}),M={el:L,controls:O},r.set(y,M),M},s=()=>{t.hidden=!0,o=null},l=y=>{let{selection:x}=e.state;if((y.position??"node")==="node"&&x instanceof R)return e.nodeDOM(x.from)?.getBoundingClientRect()??null;let M=e.coordsAtPos(x.from),L=e.coordsAtPos(x.to);return new DOMRect(M.left,M.top,Math.max(1,L.right-M.left),L.bottom-M.top)},a=!1,c=y=>{y.pointerType==="mouse"&&y.button===0&&(a=!0)},d=()=>{a&&(a=!1,setTimeout(()=>h(e),0))};e.dom.addEventListener("pointerdown",c);let u=ct(t,"pointerup",d),p=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,f=()=>{let y=ps();t.style.left=`${Math.round(y.left)}px`,t.style.width=`${Math.round(y.right-y.left)}px`,t.style.top=`${Math.round(y.bottom-t.offsetHeight)}px`,t.dataset.side="docked"},h=y=>{if(!(y.hasFocus()||t.contains(te(t)))||!n.isEditable()||n.ui.activeDialog||a)return s();let M=n.ui.registry.getContextToolbars().find(([,k])=>k.predicate(n));if(!M)return s();let[L,O]=M,B=i(L,O);o!==L&&(t.replaceChildren(B.el),t.setAttribute("aria-label",O.label),o=L);for(let k of B.controls)k.update();let J=O.anchor?O.anchor(n):l(O);if(!J)return s();t.hidden=!1;let P=p&&O.position==="selection";if(t.classList.toggle("nova-context-toolbar-docked",P),P)return f();t.style.width="";let v=(typeof O.placement=="function"?O.placement(n):O.placement)??(O.position==="selection"?"bottom-start":"top-start");kt(t,J,v)};t.addEventListener("mousedown",y=>{y.target.closest("button")&&y.preventDefault()}),t.addEventListener("keydown",y=>{let x=[...t.querySelectorAll("button:not(:disabled)")],M=x.indexOf(te(t));if(y.key==="Escape")y.preventDefault(),n.focus();else if(M>=0&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){y.preventDefault();let L=Ne(y,t)==="ArrowRight"?1:-1;x[(M+L+x.length)%x.length].focus()}});let m=y=>{let x=y.relatedTarget;!t.contains(x)&&!n.ui.overlayHost.contains(x)&&s()};e.dom.addEventListener("blur",m),t.addEventListener("focusout",y=>{let x=y.relatedTarget;!t.contains(x)&&!e.hasFocus()&&!n.ui.overlayHost.contains(x)&&s()});let g=()=>{t.hidden||h(e)};return window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),e.dom.addEventListener("load",g,!0),window.visualViewport?.addEventListener("resize",g),window.visualViewport?.addEventListener("scroll",g),{update:h,destroy(){e.dom.removeEventListener("blur",m),e.dom.removeEventListener("pointerdown",c),u(),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),e.dom.removeEventListener("load",g,!0),window.visualViewport?.removeEventListener("resize",g),window.visualViewport?.removeEventListener("scroll",g),t.remove()}}}})}function Vg(n){let e=n.ui.overlayHost.querySelector(".nova-context-toolbar:not([hidden]) button:not(:disabled)");return e?.focus(),!!e}var qg=24,fs=class{constructor(e,t,r,o){S(this,"view",t);S(this,"getPos",r);S(this,"editor",o);S(this,"dom");S(this,"img");S(this,"node");S(this,"resizing",!1);this.node=e,this.dom=document.createElement("span"),this.dom.className="nova-image",this.img=document.createElement("img"),this.img.draggable=!1,this.dom.append(this.img);for(let i of["nw","ne","sw","se"]){let s=document.createElement("span");s.className=`nova-image-handle nova-image-handle-${i}`,s.dataset.corner=i,s.addEventListener("pointerdown",l=>this.startResize(l,i)),this.dom.append(s)}this.render()}render(){let{src:e,alt:t,title:r,width:o,height:i,align:s}=this.node.attrs,l=fe(e)?e:"";this.img.getAttribute("src")!==l&&this.img.setAttribute("src",l),this.setAttr("alt",t),this.setAttr("title",r),this.setAttr("class",Ye(this.node.attrs.class).class??null);let a=ne(o),c=ne(i);this.img.style.width=a?`${a}px`:"",this.img.style.aspectRatio=a&&c?`${a} / ${c}`:"",this.dom.dataset.align=s??""}setAttr(e,t){t?this.img.setAttribute(e,t):this.img.removeAttribute(e)}update(e){return e.type!==this.node.type?!1:(this.node=e,this.resizing||this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(e){return e.target.classList?.contains("nova-image-handle")??!1}ignoreMutation(){return!0}startResize(e,t){if(!this.editor.isEditable())return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget;r.setPointerCapture(e.pointerId);let o=this.img.getBoundingClientRect(),i=e.clientX,s=o.width,l=o.width>0?o.height/o.width:this.img.naturalHeight/(this.img.naturalWidth||1),a=Math.max(qg,this.view.dom.clientWidth-40),c=t==="ne"||t==="se"?1:-1,d=s;this.resizing=!0,this.dom.classList.add("is-resizing");let u=f=>{d=Math.round(Math.min(a,Math.max(qg,s+c*(f.clientX-i)))),this.img.style.width=`${d}px`,this.dom.dataset.size=`${d} \xD7 ${Math.round(d*l)}`},p=()=>{r.removeEventListener("pointermove",u),r.removeEventListener("pointerup",p),r.removeEventListener("pointercancel",p),this.resizing=!1,this.dom.classList.remove("is-resizing"),delete this.dom.dataset.size;let f=this.getPos();if(f===void 0||Math.abs(d-s)<1)return this.render();let h=this.view.state.tr.setNodeMarkup(f,void 0,{...this.node.attrs,width:d,height:Math.round(d*l)});h.setSelection(R.create(h.doc,f)),this.view.dispatch(h)};r.addEventListener("pointermove",u),r.addEventListener("pointerup",p),r.addEventListener("pointercancel",p)}};var Qd={};j(Qd,{FLAT_MARK_SELECTOR:()=>fw,flatMarkViews:()=>Zd});var pw=["bold","italic","strike","code","subscript","superscript"],fw="strong, em, s, code, sub, sup";function Zd(n){let e={};for(let t of pw){let r=n.marks[t]?.spec.toDOM;r&&(e[t]=(o,i,s)=>{let{dom:l,contentDOM:a}=Ve.renderSpec(i.dom.ownerDocument,r(o,s));return l.setAttribute("role","none"),{dom:l,contentDOM:a??void 0}})}return e}var hw=30;function mw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gw(n,e){let{selection:t}=n.state;if(!t.empty)return null;let r=t.$from;if(!r.parent.isTextblock||r.parent.type.spec.code)return null;let o=r.parent.textBetween(Math.max(0,r.parentOffset-hw-1),r.parentOffset,"\0","\0");for(let[i,s]of e.ui.registry.getAutocompleters()){let l=new RegExp(`(?:^|\\s)${mw(s.trigger)}([\\p{L}\\p{N}_-]*)$`,"u"),a=o.match(l);if(!a)continue;let c=a[1]??"";if(c.length<(s.minChars??0))continue;let d=r.parentOffset-c.length-s.trigger.length,u=d>0?r.parent.textBetween(d-1,d,"\0","\0"):"";if(!(u&&!/\s/.test(u)))return{name:i,spec:s,from:r.pos-c.length-s.trigger.length,to:r.pos,query:c}}return null}function jg(n){let e,t=[],r=0,o=null,i=null,s=0,l=qe("nova-ac"),a=()=>!e.hidden,c=h=>{e.hidden=!0,o=null,t=[],h.dom.removeAttribute("aria-activedescendant"),h.dom.removeAttribute("aria-controls"),h.dom.removeAttribute("aria-expanded")},d=(h,m)=>{let g=t[m];if(!g||!o)return;let{spec:y,from:x,to:M}=o;c(h),y.onSelect(g,{from:x,to:M},n)},u=h=>{if(!o)return;let{spec:m}=o;if(e.replaceChildren(),e.setAttribute("aria-label",m.label),!t.length){if(!m.emptyText)return c(h);e.append(w("div",{className:"nova-ac-empty"},m.emptyText))}t.forEach((y,x)=>{let M=w("div",{id:`${l}-${x}`,className:"nova-menu-item nova-ac-item",role:"option","aria-selected":String(x===r)},y.icon?ee(y.icon):null,w("span",{className:"nova-menu-label"},y.label),y.shortcut?w("kbd",{className:"nova-menu-shortcut"},Ct(y.shortcut)):y.detail?w("span",{className:"nova-menu-shortcut"},y.detail):null);M.addEventListener("mousedown",L=>{L.preventDefault(),d(h,x)}),M.addEventListener("mousemove",()=>{r!==x&&p(h,x)}),e.append(M)}),e.hidden=!1,h.dom.setAttribute("aria-controls",l),p(h,Math.min(r,Math.max(0,t.length-1)));let g=h.coordsAtPos(o.from);kt(e,new DOMRect(g.left,g.top,1,g.bottom-g.top),"bottom-start")},p=(h,m)=>{r=m,e.querySelectorAll('[role="option"]').forEach((y,x)=>y.setAttribute("aria-selected",String(x===m)));let g=e.querySelector(`#${l}-${m}`);g&&(h.dom.setAttribute("aria-activedescendant",g.id),g.scrollIntoView?.({block:"nearest"}))},f=h=>{let m=n.isEditable()&&h.hasFocus()?gw(h,n):null;if(!m||m.from===i){m||(i=null),(a()||o)&&c(h);return}let g=!o||o.query!==m.query||o.from!==m.from;if(o=m,!g&&a())return u(h);let y=++s;Promise.resolve(m.spec.fetch(m.query,n)).then(x=>{y!==s||!o||(t=x.slice(0,m.spec.maxResults??10),r=0,u(h))})};return new z({key:new Z("nova-autocompleter"),view(h){e=w("div",{className:"nova-popover nova-ac",id:l,role:"listbox",hidden:!0}),n.ui.overlayHost.append(e),h.dom.setAttribute("aria-autocomplete","list");let m=()=>c(h);return h.dom.addEventListener("blur",m),{update:g=>f(g),destroy(){h.dom.removeEventListener("blur",m),e.remove()}}},props:{handleKeyDown(h,m){if(!a()||!o)return!1;let g=t.length;switch(m.key){case"ArrowDown":return g&&p(h,(r+1)%g),!0;case"ArrowUp":return g&&p(h,(r-1+g)%g),!0;case"Enter":case"Tab":return g?(d(h,r),!0):!1;case"Escape":return i=o.from,c(h),!0;default:return!1}}}})}var Ht=n=>e=>e.exec(n),yw=[{name:"paragraph",label:"paragraph",icon:C.paragraph,keywords:["text","p","paragraph"],run:Ht("paragraph")},{name:"h1",label:"h1",icon:C.h1,keywords:["h1","heading","title"],shortcut:"Mod-Alt-1",run:Ht("h1")},{name:"h2",label:"h2",icon:C.h2,keywords:["h2","heading","subtitle"],shortcut:"Mod-Alt-2",run:Ht("h2")},{name:"h3",label:"h3",icon:C.h3,keywords:["h3","heading"],shortcut:"Mod-Alt-3",run:Ht("h3")},{name:"bullist",label:"bulletList",icon:C.bulletList,keywords:["ul","list","bullet"],shortcut:"Mod-Shift-8",run:Ht("bulletList")},{name:"numlist",label:"orderedList",icon:C.orderedList,keywords:["ol","list","numbered"],shortcut:"Mod-Shift-7",run:Ht("orderedList")},{name:"blockquote",label:"blockquote",icon:C.blockquote,keywords:["quote","blockquote","citation"],run:Ht("blockquote")},{name:"codeblock",label:"codeBlock",icon:C.codeBlock,keywords:["code","pre","snippet"],run:Ht("codeBlock")},{name:"hr",label:"horizontalRule",icon:C.horizontalRule,keywords:["hr","divider","line","separator"],run:Ht("horizontalRule")},{name:"table",label:"table",icon:C.table,keywords:["table","grid"],run:n=>n.exec(_t(3,3))},{name:"image",label:"image",icon:C.image,keywords:["image","picture","photo","img"],run:n=>io(n)},{name:"link",label:"link",icon:C.link,keywords:["link","url","href"],shortcut:"Mod-k",run:n=>Dt(n)}];function bw(n,e,t){let r=e.toLowerCase();if(!r)return n;let o=[];return n.forEach((i,s)=>{let l=t(i.label).toLowerCase(),a=[l,...l.split(/\s+/),...i.keywords],c=-1;l.startsWith(r)?c=3:a.some(d=>d.startsWith(r))?c=2:a.some(d=>d.includes(r))&&(c=1),c>0&&o.push([c,s,i])}),o.sort((i,s)=>s[0]-i[0]||i[1]-s[1]).map(([,,i])=>i)}function Wg(n,e=[]){let{t}=n.ui,r=[...yw,...e].filter(o=>n.isAllowed(o.name));n.ui.registry.addAutocompleter("slashcommands",{trigger:"/",label:t("slash.label"),emptyText:t("slash.empty"),fetch:o=>bw(r,o,t).map(i=>({value:i.name,label:t(i.label),icon:i.icon,...i.shortcut?{shortcut:i.shortcut}:{}})),onSelect:(o,i,s)=>{let l=r.find(a=>a.name===o.value);l&&(s.view.dispatch(s.view.state.tr.delete(i.from,i.to)),l.run(s))}})}var hs=class{constructor(e,t){S(this,"region");S(this,"closeLabel");this.closeLabel=t,this.region=w("div",{className:"nova-notifications","aria-live":"polite"}),e.append(this.region)}open(e){let t=e.type??"info",r=e.timeout??(t==="error"?0:4e3),o=w("span",{className:"nova-notification-text"},e.text),i=w("button",{type:"button",className:"nova-btn","aria-label":this.closeLabel},ee(C.close)),s=(e.actions??[]).map(p=>w("button",{type:"button",className:"nova-btn nova-notification-action"},p.label)),l=w("div",{className:`nova-notification nova-notification-${t}`,role:t==="error"?"alert":"status"},o,...s,i);this.region.append(l);let a=null,c=!1,d=()=>{c||(c=!0,a&&clearTimeout(a),l.remove())},u=()=>{c||(d(),e.onClose?.())};return s.forEach((p,f)=>p.addEventListener("click",()=>{d(),e.actions[f].onAction()})),i.addEventListener("click",u),r>0&&(a=setTimeout(u,r)),s[0]?.focus({preventScroll:!0}),{close:d,setText:p=>o.textContent=p}}destroy(){this.region.remove()}};var kw=C.sidebar,ms=class{constructor(){S(this,"controls",new Map);S(this,"menuItems",new Map);S(this,"styleFormats",{items:[],replace:!1});S(this,"contextToolbars",new Map);S(this,"autocompleters",new Map);S(this,"sidebars",new Map);S(this,"views",new Map)}addButton(e,t){this.controls.set(e.toLowerCase(),{type:"button",...t})}addToggleButton(e,t){this.addButton(e,t)}addMenuButton(e,t){this.controls.set(e.toLowerCase(),{type:"menu",...t})}addPanelButton(e,t){this.controls.set(e.toLowerCase(),{type:"panel",...t})}addSplitButton(e,t){this.controls.set(e.toLowerCase(),{type:"split",...t})}addStyleFormats(e,{replace:t=!1}={}){this.styleFormats={items:[...this.styleFormats.items,...e],replace:this.styleFormats.replace||t}}getStyleFormats(){return this.styleFormats}addMenuItem(e,t){this.menuItems.set(e.toLowerCase(),t)}addToggleMenuItem(e,t){this.addMenuItem(e,t)}getMenuItem(e){let t=this.menuItems.get(e.toLowerCase());if(t)return t;let r=this.get(e);if(!(r?.type!=="button"&&r?.type!=="split"))return{text:r.tooltip,...r.icon?{icon:r.icon}:{},...r.shortcut?{shortcut:r.shortcut}:{},onAction:r.onAction,...r.isActive?{isActive:r.isActive}:{},...r.isEnabled?{isEnabled:r.isEnabled}:{}}}addSidebar(e,t){this.sidebars.set(e,t),!(t.button===!1||this.has(e))&&this.addToggleButton(e,{tooltip:t.tooltip??t.title,icon:t.icon??kw,isActive:r=>r.ui.sidebar.isOpen(e),onAction:r=>{r.ui.sidebar.toggle(e)}})}getSidebar(e){return this.sidebars.get(e)}addView(e,t){this.views.set(e,t)}getView(e){return this.views.get(e)}addAutocompleter(e,t){this.autocompleters.set(e.toLowerCase(),t)}getAutocompleters(){return[...this.autocompleters]}addContextToolbar(e,t){this.contextToolbars.set(e.toLowerCase(),t)}getContextToolbars(){return[...this.contextToolbars].sort((e,t)=>(t[1].priority??0)-(e[1].priority??0))}get(e){return this.controls.get(e.toLowerCase())}has(e){return this.controls.has(e.toLowerCase())}names(){return[...this.controls.keys()]}};var gs=class{constructor(e){S(this,"editor",e);S(this,"current",null);S(this,"mounted",new Map);S(this,"column",null);S(this,"opening",Promise.resolve());S(this,"destroyed",!1)}get active(){return this.current}isOpen(e){return this.current===e}async show(e,t={}){let r=this.editor.ui.registry.getSidebar(e);if(!r){console.warn(`[nova] sidebar "${e}" is not registered`);return}if(this.current!==e){this.hide({restoreFocus:!1}),this.editor.ui.closeOverlays(),this.current=e;let o=this.mount(e,r);this.opening=o.ready.then(i=>{if(!i||this.current!==e||this.destroyed){this.current===e&&(this.current=null);return}o.el.hidden=!1,this.editor.root.classList.add("nova-sidebar-open"),r.onShow?.(this.editor),this.editor.updateUI()})}if(await this.opening,t.focus&&this.current===e){let o=this.mounted.get(e).el;(o.querySelector(zt)??o).focus()}}hide(e={}){let t=this.current;if(!t)return;this.current=null;let r=this.mounted.get(t);if(!r)return;let o=r.el.contains(te(r.el));r.el.hidden=!0,this.editor.root.classList.remove("nova-sidebar-open"),this.editor.ui.registry.getSidebar(t)?.onHide?.(this.editor),this.editor.updateUI(),o&&e.restoreFocus!==!1&&this.editor.focus()}toggle(e,t={}){return this.current===e?(this.hide(),Promise.resolve()):this.show(e,t)}destroy(){this.destroyed=!0,this.mounted.forEach(e=>e.cleanup?.()),this.mounted.clear()}host(){if(this.column)return this.column;let e=this.editor.view.dom.parentElement,t=w("div",{className:"nova-body"});return e.before(t),t.append(e),this.column=t,t}mount(e,t){let r=this.mounted.get(e);if(r)return r;let o=qe("nova-sidebar-title"),i=w("div",{className:"nova-sidebar-body"}),s=w("button",{type:"button",className:"nova-btn nova-sidebar-close","aria-label":this.editor.ui.t("dialog.close"),onClick:()=>this.hide()},ee(C.close)),l=t.header===!1?null:w("div",{className:"nova-sidebar-head"},w("h2",{id:o,className:"nova-sidebar-title"},t.title),s),a=w("div",{className:`nova-sidebar${l?"":" nova-sidebar-bare"}`,hidden:!0,"data-sidebar":e,...this.editor.options.language?{lang:this.editor.options.language}:{},...l?{role:"complementary","aria-labelledby":o}:{},onKeydown:(d=>{d.key!=="Escape"||d.defaultPrevented||(d.preventDefault(),this.hide())})},l,i);this.host().append(a);let c={el:a,ready:Promise.resolve(!1)};return c.ready=(async()=>{try{let d=await t.render(i,this.editor);return typeof d=="function"&&(c.cleanup=d),!0}catch(d){return console.error(`[nova] sidebar "${e}" failed to render`,d),a.remove(),this.mounted.delete(e),!1}})(),this.mounted.set(e,c),c}};var Kg=".nova-editor.nova-view-open>:not(.nova-view):not(.nova-overlays){display:none}.nova-view{display:flex;flex:1 1 auto;flex-direction:column;min-height:240px;background:var(--nova-surface);color:var(--nova-fg)}.nova-view[hidden]{display:none}.nova-view:focus{outline:none}.nova-view-head{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--nova-border);background:var(--nova-toolbar-bg)}.nova-view-title{margin:0;font-size:15px;font-weight:600}.nova-view-buttons{display:flex;gap:8px;margin-inline-start:auto}.nova-view-body{flex:1;min-height:0;padding:12px;overflow:auto}";var ys=class{constructor(e){S(this,"editor",e);S(this,"current",null);S(this,"mounted",new Map)}get active(){return this.current}isOpen(e){return this.current===e}show(e){let t=this.editor.ui.registry.getView(e);if(!t){console.warn(`[nova] view "${e}" is not registered`);return}if(this.current===e)return;this.hide({restoreFocus:!1}),this.editor.ui.closeOverlays(),this.editor.ui.addStyles("nova-editor-views",Kg);let r=this.mount(e,t);this.current=e,r.el.hidden=!1,this.editor.root.classList.add("nova-view-open");try{t.onShow?.(r.api)}catch(o){console.error(`[nova] view "${e}" failed to show`,o)}(r.el.querySelector(zt)??r.el).focus(),this.editor.updateUI()}hide(e={}){let t=this.current;if(!t)return;this.current=null;let r=this.mounted.get(t);if(!r)return;let o=r.el.contains(te(r.el));r.el.hidden=!0,this.editor.root.classList.remove("nova-view-open");try{this.editor.ui.registry.getView(t)?.onHide?.(r.api)}catch(i){console.error(`[nova] view "${t}" failed to hide`,i)}this.editor.updateUI(),o&&e.restoreFocus!==!1&&this.editor.focus()}toggle(e){this.current===e?this.hide():this.show(e)}destroy(){this.mounted.forEach(({el:e})=>e.remove()),this.mounted.clear(),this.current=null}mount(e,t){let r=this.mounted.get(e);if(r)return r;let o=w("div",{className:"nova-view-body"}),i=(t.buttons??[]).map(a=>w("button",{type:"button",className:a.buttonType==="primary"?"nova-button nova-button-primary":"nova-button",onClick:()=>{try{a.onAction(this.editor)}catch(c){console.error(`[nova] a button of view "${e}" failed`,c)}}},a.text)),s=w("section",{className:"nova-view",hidden:!0,tabindex:"-1","data-view":e,"aria-label":t.title??e,...this.editor.options.language?{lang:this.editor.options.language}:{},onKeydown:(a=>{a.key!=="Escape"||a.defaultPrevented||(a.preventDefault(),this.hide())})},w("div",{className:"nova-view-head"},t.title?w("h2",{className:"nova-view-title"},t.title):null,w("div",{className:"nova-view-buttons"},...i)),o);this.editor.root.append(s);let l={el:s,api:{getContainer:()=>o}};return this.mounted.set(e,l),l}};var xw=450,ww=150,bs=class{constructor(e){S(this,"el");S(this,"timer",null);S(this,"target",null);S(this,"offEscape",null);this.el=w("div",{className:"nova-tooltip",role:"tooltip",hidden:!0}),this.el.addEventListener("pointerenter",()=>this.clearTimer()),this.el.addEventListener("pointerleave",()=>this.hide()),this.el.addEventListener("pointerdown",()=>this.hide()),e.append(this.el)}attach(e){e.addEventListener("pointerenter",t=>{t.pointerType==="mouse"&&this.schedule(e)}),e.addEventListener("pointerleave",()=>{this.clearTimer(),this.el.hidden||(this.timer=setTimeout(()=>this.hide(),ww))}),e.addEventListener("focus",()=>{e.matches(":focus-visible")&&this.show(e)}),e.addEventListener("blur",()=>this.hide()),e.addEventListener("pointerdown",()=>this.hide())}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>this.show(e),xw)}show(e){this.clearTimer();let t=e.dataset.tooltip;if(!t||e.getAttribute("aria-expanded")==="true")return;this.target=e;let r=e.dataset.shortcut;this.el.replaceChildren(w("span",{},t)),r&&this.el.append(w("kbd",{},Ct(r))),this.el.hidden=!1,kt(this.el,e.getBoundingClientRect(),"bottom"),this.offEscape??(this.offEscape=ct(this.el,"keydown",o=>{o.key!=="Escape"||this.el.hidden||(o.preventDefault(),o.stopPropagation(),this.hide())}))}hide(){this.clearTimer(),this.el.hidden=!0,this.target=null,this.offEscape?.(),this.offEscape=null}get current(){return this.target}destroy(){this.hide(),this.el.remove()}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}};var Ug=new WeakMap,ks=class{constructor(e,t,r,o){S(this,"focusEditor",r);S(this,"registry",new ms);S(this,"t");S(this,"overlayHost");S(this,"tooltip");S(this,"sidebar");S(this,"view");S(this,"notifications");S(this,"popover",null);S(this,"currentDialog",null);S(this,"liveRegion");S(this,"announceTimer");S(this,"rootEl");S(this,"dialogListeners",new Set);this.t=t,this.rootEl=e,this.overlayHost=w("div",{className:"nova-overlays"}),e.append(this.overlayHost),this.tooltip=new bs(this.overlayHost),this.notifications=new hs(e,t("dialog.close")),this.sidebar=new gs(o),this.view=new ys(o),this.liveRegion=w("div",{className:"nova-visually-hidden nova-announcer",role:"status","aria-live":"polite","aria-atomic":"true"}),e.append(this.liveRegion)}announce(e){let t=this.liveRegion;t.textContent="",clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>{t.textContent=e},50)}addStyles(e,t){let r=this.rootEl.getRootNode(),o=Ug.get(r);if(o||Ug.set(r,o=new Set),o.has(e))return;if(o.add(e),"adoptedStyleSheets"in r&&typeof CSSStyleSheet<"u")try{let s=new CSSStyleSheet;s.replaceSync(t),r.adoptedStyleSheets=[...r.adoptedStyleSheets,s];return}catch{}let i=document.createElement("style");i.dataset.novaStyles=e,i.textContent=t,(r.head??r).append(i)}async dialog(e){let{openFormDialog:t,formDialogCss:r}=await import(__novaChunk("tinymce-chunks/form-dialog-9eb62199.js") );return this.addStyles("nova-form-dialog",r),t(e,this.t,o=>this.openDialog(o))}openPopover(e){this.closePopover(),this.tooltip.hide();let t=new Tn({...e,host:this.overlayHost,onClose:r=>{this.popover===t&&(this.popover=null),e.onClose?.(r)}});return this.popover=t,t}closePopover(){this.popover?.close("api"),this.popover=null}get activePopover(){return this.popover}onDialogOpen(e){return this.dialogListeners.add(e),()=>this.dialogListeners.delete(e)}closeOverlays(){this.closePopover(),this.dialogListeners.forEach(e=>e())}openDialog(e){this.closePopover(),this.dialogListeners.forEach(r=>r()),this.currentDialog?.close();let t=$c({cancelLabel:this.t("dialog.cancel"),closeLabel:this.t("dialog.close"),...e,host:this.overlayHost,returnFocus:this.focusEditor,onClose:()=>{this.currentDialog===t&&(this.currentDialog=null),e.onClose?.()}});return this.currentDialog=t,t}get activeDialog(){return this.currentDialog}notify(e){return this.notifications.open(typeof e=="string"?{text:e}:e)}destroy(){this.sidebar.destroy(),this.view.destroy(),this.closePopover(),this.currentDialog?.close(),this.tooltip.destroy(),this.notifications.destroy(),this.overlayHost.remove(),clearTimeout(this.announceTimer),this.liveRegion.remove()}};var Sw={paragraph:()=>"p",heading:n=>`h${n.attrs.level}`,blockquote:()=>"blockquote",code_block:()=>"pre",bullet_list:()=>"ul",ordered_list:()=>"ol",list_item:()=>"li",table:()=>"table",table_row:()=>"tr",table_cell:()=>"td",table_header:()=>"th"},Mw={bold:"strong",italic:"em",underline:"u",strike:"s",code:"code",link:"a",subscript:"sub",superscript:"sup"},Gg=String.raw`\p{sc=Han}\p{sc=Hiragana}\p{sc=Katakana}`,Jg=String.raw`(?:(?![${Gg}])[\p{L}\p{N}])`,Ew=new RegExp(`[${Gg}]|${Jg}+(?:['\u2019-]${Jg}+)*`,"gu");function Cw(n){return n.match(Ew)?.length??0}function Yg(n,e){e.className="nova-statusbar";let t=w("div",{className:"nova-path","aria-hidden":"true"}),r=w("div",{className:"nova-wordcount","aria-live":"off"});e.append(t,r);let o=n.options.resize,i=o?Nw(n,e,o==="both"):null,s=null,l=()=>{let c=n.view.state.doc;r.textContent=n.ui.t("status.words",{count:Cw(c.textBetween(0,c.content.size," "," "))})},a=c=>{let{$from:d}=n.view.state.selection,u=[];for(let f=1;f<=d.depth;f++){let h=d.node(f),m=Sw[h.type.name]?.(h);m&&u.push(m)}n.view.state.selection.node?.type.name==="image"&&u.push("img");for(let f of d.marks()){let h=Mw[f.type.name];h&&u.push(h)}t.replaceChildren(...u.flatMap((f,h)=>[...h?[" \u203A "]:[],w("span",{className:"nova-path-item"},f)])),c&&(s&&clearTimeout(s),s=setTimeout(l,250))};return l(),a(!1),{update:a,destroy:()=>{s&&clearTimeout(s),i?.(),e.replaceChildren()}}}var Aw=100,Tw=200,vs=20;function Nw(n,e,t){let r=n.root,o=w("div",{className:"nova-resize-handle",role:"separator",tabIndex:0,"aria-orientation":"horizontal","aria-label":n.ui.t("status.resize")});o.append(ee(t?C.resizeHandleBoth:C.resizeHandle)),r.dataset.resize=t?"both":"vertical",e.append(o);let i=(u,p)=>{if(r.style.boxSizing="border-box",r.style.height=`${Math.max(Aw,Math.round(u))}px`,t&&p!==void 0){let f=r.parentElement?.clientWidth||1/0;r.style.width=`${Math.min(f,Math.max(Tw,Math.round(p)))}px`}o.setAttribute("aria-valuenow",String(r.offsetHeight))},s=null,l=u=>{n.isDisabled()||(u.preventDefault(),o.setPointerCapture(u.pointerId),s={x:u.clientX,y:u.clientY,height:r.offsetHeight,width:r.offsetWidth})},a=u=>{if(!s)return;let p=(u.clientX-s.x)*(Bn(r)?-1:1);i(s.height+u.clientY-s.y,s.width+p)},c=u=>{s&&(s=null,o.hasPointerCapture(u.pointerId)&&o.releasePointerCapture(u.pointerId))},d=u=>{let p=u.key==="ArrowDown"?vs:u.key==="ArrowUp"?-vs:0,f=Ne(u,r),h=t?f==="ArrowRight"?vs:f==="ArrowLeft"?-vs:0:0;!h&&!p||(u.preventDefault(),i(r.offsetHeight+p,r.offsetWidth+h))};return o.addEventListener("pointerdown",l),o.addEventListener("pointermove",a),o.addEventListener("pointerup",c),o.addEventListener("pointercancel",c),o.addEventListener("keydown",d),()=>{o.remove(),delete r.dataset.resize}}var tu="nova:remote",xs="nova:api",Ow=new Set("P H1 H2 H3 H4 H5 H6 UL OL TABLE BLOCKQUOTE PRE HR DIV FIGURE".split(" "));function Xg(n){return(e,t)=>{if(!t)return!0;let r=document.createElement("template");r.innerHTML=n;let o=document.createElement("div");o.append(r.content);let i=hr(e.schema),l=[...o.children].some(p=>Ow.has(p.tagName))?new D(i.parse(o).content,0,0):i.parseSlice(o),a=!1;l.content.descendants(p=>(p.type.spec.tableRole==="table"&&(a=!0),!a));let{$from:c}=e.selection,d=0;for(let p=1;p<=c.depth;p++)if(c.node(p).type.spec.tableRole==="table"){d=p;break}let u=a&&d?e.tr.insert(c.after(d),l.content):e.tr.replaceSelection(l);return t(u.setMeta(xs,!0).scrollIntoView()),!0}}var Lw=0,Zg=new Set,bo=class{constructor(e){S(this,"view");S(this,"root");S(this,"ui");S(this,"options");S(this,"listeners",new Map);S(this,"ready");S(this,"toolbar");S(this,"toolbarHost");S(this,"menubar");S(this,"mode");S(this,"direction");S(this,"pluginsByName",new Map);S(this,"commandOverrides",new Map);S(this,"transactionTransforms",[]);S(this,"cleanups",[]);S(this,"contentRules");S(this,"schema");S(this,"formatter");S(this,"selection");S(this,"statusbar");S(this,"searchBar",null);S(this,"searchBarLoad",null);S(this,"contentHost");S(this,"destroyed",!1);S(this,"editable");S(this,"disabled");S(this,"pasteAsText");e=Jm(e),this.options=e,this.root=document.createElement("div"),this.root.className="nova-editor";let t=e.direction??(rs(e.language)?"rtl":void 0);t&&(this.root.dir=t),this.direction=t??(e.element.closest("[dir]")?.getAttribute("dir")==="rtl"?"rtl":"ltr"),e.element.appendChild(this.root);let r=document.createElement("div"),o=document.createElement("div"),i=document.createElement("div");o.className="nova-content";let s=document.createElement("div");s.className="nova-header";let l=document.createElement("div");s.append(l,r),this.root.append(s,o,i),this.toolbarHost=r,this.mode=e.mode??"classic",this.root.classList.add(`nova-mode-${this.mode}`);let a=this.mode==="distraction-free";if(this.mode!=="classic"&&(this.root.addEventListener("focusin",()=>this.root.classList.add("is-focused")),this.root.addEventListener("focusout",()=>{setTimeout(()=>{this.root.contains(te(this.root))||this.root.classList.remove("is-focused")},0)})),this.ui=new ks(this.root,Mp(e.language,e.translations),()=>this.focus(),this),e.language)for(let b of[s,i,this.ui.overlayHost])b.lang=e.language;this.root.style.setProperty("--nova-caption-placeholder",JSON.stringify(this.ui.t("image.captionPlaceholder")));let c=We({"Mod-k":()=>(Dt(this),!0),"Alt-F9":()=>this.menubar?(this.menubar.focus(),!0):!1,"Alt-F10":()=>this.toolbar?(this.toolbar.focus(),!0):!1,"Ctrl-F9":()=>Vg(this),"Mod-f":()=>(this.openSearch(),!0),"Mod-Shift-f":()=>(mr(this),!0),"Alt-0":()=>(ho(this),!0),Escape:()=>this.searchBar?.isOpen()?(this.searchBar.close(),!0):!1}),d=[...e.plugins??[]];a&&!d.includes("quickbars")&&d.push("quickbars");let u=br(d);u.errors.forEach(b=>vt(b));let{ordered:p,errors:f}=On(u.plugins);f.forEach(b=>vt(b));for(let b of p)b.load&&u.loaders.push(b.load);let h=p.flatMap(b=>this.collectPmPlugins(b)),m=e.validElements!==void 0||e.invalidElements!==void 0||e.validStyles!==void 0;this.contentRules=m?new ur(e):null;let{schema:g,allowedClasses:y}=is(e,p,this.direction,this);this.schema=g,this.formatter=new Vi(this,y),this.selection=Lg(this);for(let[b,A]of Object.entries(e.formats??{}))this.formatter.register(b,A);p.forEach(b=>this.registerCommands(b));let x=yr(p,this);x&&An.set(this,x);let M=eu(this.schema,e.content??"",x),L=Hd(),O=[jg(this),...e.textPatterns===!1?[]:Array.isArray(e.textPatterns)||e.textPatternsLookup?[sg(this,Array.isArray(e.textPatterns)?e.textPatterns:[],e.textPatternsLookup)]:[tg(b=>this.isAllowed(b),this.schema),ng(b=>this.isAllowed(b),this.schema)],c,L,...lg(b=>this.resolveCommand(b)),qm(this.ui.t,b=>this.ui.announce(b)),...p.some(b=>b.replaceHistory)?[]:[Sc()],Rm({color:"var(--nova-accent)",width:2}),_m(),Jc(this),Uc(this),ug(this),Ud(this),$g(this),...this.contentRules?[mg(this.contentRules)]:[],$m(),Og(),...h,...e.prosemirrorPlugins??[]];Ed(O);let B=cn.create({doc:this.contentRules?this.contentRules.normalizeDoc(M):M,plugins:O});this.editable=e.editable??!0,this.disabled=e.disabled??!1,this.pasteAsText=e.pasteAsText??!1;let J=this.handleTransaction.bind(this);this.view=new Xn(o,{state:B,editable:()=>this.isEditable(),attributes:{class:"nova-prosemirror",role:"textbox","aria-multiline":"true","aria-label":this.ui.t("editor.label"),...e.placeholder?{"data-placeholder":e.placeholder,"aria-placeholder":e.placeholder}:{}},dispatchTransaction:function(b){J(b,this)},clipboardParser:hr(this.schema),nodeViews:{image:(b,A,H)=>new fs(b,A,H,this)},markViews:Zd(this.schema),handleDOMEvents:{focus:(b,A)=>(this.emit("focus",{event:A}),!1),blur:(b,A)=>(this.emit("blur",{event:A}),!1)},handleKeyDown:(b,A)=>(this.emit("keydown",{event:A}),A.defaultPrevented)}),this.root.classList.toggle("nova-readonly",!this.editable),this.applyDisabled(),qd(this),Ag(this),e.slashCommands!==!1&&Wg(this,e.slashCommands??[]),p.forEach(b=>this.setupPlugin(b)),e.setup?.(this);let P=e.menubar===!0?Eg:typeof e.menubar=="string"?e.menubar:null;this.menubar=P?Cg(this,l,P,{...Mg,...e.menu}):null,this.menubar||l.remove(),this.toolbar=e.toolbar===!1||a&&e.toolbar===void 0?null:Xd(this,r,this.toolbarConfig(),e.toolbarMode??"floating",{warnUnknown:u.loaders.length===0}),this.toolbar||r.remove(),!this.toolbar&&!this.menubar&&s.remove(),this.contentHost=o;let v=this.loadSearchBar(),k=e.statusbar??this.mode==="classic";this.statusbar=k?Yg(this,i):null,this.statusbar||i.remove(),e.onChange&&this.on("change",e.onChange),this.updatePlaceholder();let E=this.applyContentStyles();this.ready=Promise.all([u.loaders.length?this.loadLazyPlugins(u.loaders):void 0,E,dd(),this.installTables(L),v]).then(()=>{this.destroyed||this.emit("init")})}async installTables(e){let t=await ud();if(!t||this.destroyed)return;let{state:r}=this.view,o=r.plugins.indexOf(e),i=[...r.plugins];i.splice(o<0?i.length:o,0,...t.tablePlugins()),Cd(this.view,i),this.updateUI()}applyContentStyles(){let{contentStyle:e,contentCss:t}=this.options,r=t===void 0?[]:Array.isArray(t)?t:[t];if(!e&&!r.length)return;let o=`nova-cs-${++Lw}`;this.root.classList.add(o);let i=`.nova-editor.${o} .nova-prosemirror`,s=r.map(()=>""),l=null,a=()=>{this.destroyed||(l?.(),l=Ic(this.root,Ui([...s,e??""].join(`
|
|
44
|
+
`),i)))};if(this.cleanups.push(()=>l?.()),a(),!!r.length)return Promise.all(r.map((c,d)=>Ji(c).then(u=>{s[d]=u},u=>console.warn(`[nova] contentCss: could not load ${c}`,u)))).then(a)}isAllowed(e){return this.contentRules?.isAllowed(e)??!0}hasPlugin(e){return this.pluginsByName.has(e)}collectPmPlugins(e){try{let t=e.prosemirrorPlugins?.(this)??[];if(e.nodeViews){let r=Object.fromEntries(Object.entries(e.nodeViews).map(([o,i])=>[o,i(this)]));t.push(new z({props:{nodeViews:r}}))}return t}catch(t){return vt(`Plugin "${e.name}" failed to create ProseMirror plugins`,t),[]}}setupPlugin(e){try{let t=e.setup?.(this);typeof t=="function"&&this.cleanups.push(t),this.pluginsByName.set(e.name,e)}catch(t){vt(`Plugin "${e.name}" failed during setup`,t)}}async loadLazyPlugins(e){let t=await Promise.all(e.map(l=>Ps(l).catch(a=>(vt("Failed to load plugin",a),null))));if(this.destroyed)return;let r=t.filter(l=>l?l.nodes||l.marks?(vt(`Plugin "${l.name}" defines nodes or marks and cannot be loaded lazily; pass the plugin object instead`),!1):!0:!1),{ordered:o,errors:i}=On(r,new Set(this.pluginsByName.keys()));i.forEach(l=>vt(l));let s=o.flatMap(l=>this.collectPmPlugins(l));s.length&&Cd(this.view,[...this.view.state.plugins,...s]),o.forEach(l=>{this.registerCommands(l),this.setupPlugin(l)}),this.rebuildToolbar()}updateUI(){this.destroyed||this.toolbar?.update()}rebuildToolbar(){!this.toolbar||this.destroyed||(this.toolbar.destroy(),this.toolbar=Xd(this,this.toolbarHost,this.toolbarConfig(),this.options.toolbarMode??"floating"))}toolbarConfig(){if(this.options.toolbar)return this.options.toolbar;let e=[...this.pluginsByName.values()].map(t=>t.toolbar).filter(Boolean);return e.length?`${Gd} | ${e.join(" ")}`:Gd}handleTransaction(e,t=this.view){if(!t.isDestroyed){for(let r of this.transactionTransforms)e=r(e,t.state,this);t.updateState(t.state.apply(e)),this.view&&(this.toolbar?.update(),this.statusbar?.update(e.docChanged),this.searchBar?.update(),this.updatePlaceholder(),e.docChanged&&(this.emit("change",{transaction:e}),!(e.getMeta(xs)||e.getMeta(tu))&&e.getMeta("addToHistory")!==!1&&this.emit("input",{transaction:e})),(e.selectionSet||e.docChanged)&&this.emit("selectionChange",{transaction:e}))}}updatePlaceholder(){let e=this.view.state.doc,t=e.childCount===1&&e.firstChild?.type===this.schema.nodes.paragraph&&e.firstChild.content.size===0;this.view.dom.classList.toggle("nova-empty",t)}getHTML({fullPage:e=!0}={}){let t=this.view.state.doc,r=fr.serializeFragment(t.content),o=e?An.get(this):void 0;return o?o.write(r,t.attrs):r}getJSON(){return this.view.state.doc.toJSON()}getText(){return this.view.state.doc.textBetween(0,this.view.state.doc.content.size,`
|
|
38
45
|
|
|
39
|
-
`)}setContent(e,{addToHistory:t=!0}={}){let r=yi(this.schema,e),o=this.view.state.tr.replaceWith(0,this.view.state.doc.content.size,r.content);t||o.setMeta("addToHistory",!1),this.view.dispatch(o)}insertContent(e){if(!this.isEditable())return!1;let t=document.createElement("template");t.innerHTML=e;let r=document.createElement("div");r.append(t.content);let o=Ar(this.schema),i=[...r.children].some(f=>kk.has(f.tagName)),{state:s}=this.view,l=i?new O(o.parse(r).content,0,0):o.parseSlice(r),a=!1;l.content.descendants(f=>(f.type.spec.tableRole==="table"&&(a=!0),!a));let{$from:c}=s.selection,u=0;for(let f=1;f<=c.depth;f++)if(c.node(f).type.spec.tableRole==="table"){u=f;break}let d=a&&u?s.tr.insert(c.after(u),l.content):s.tr.replaceSelection(l);return this.view.dispatch(d.scrollIntoView()),!0}isEmpty(){return this.view.dom.classList.contains("nova-empty")}resolveCommand(e){return this.commandOverrides.get(e)??Q[e]}registerCommands(e){for(let[t,r]of Object.entries(e.commands??{}))r&&this.commandOverrides.set(t,r);e.transformTransaction&&this.transactionTransforms.push(e.transformTransaction)}exec(e){let r=(typeof e=="string"?this.resolveCommand(e):e)(this.view.state,this.view.dispatch,this.view);return r&&this.view.focus(),r}can(e){return(typeof e=="string"?this.resolveCommand(e):e)(this.view.state,void 0,this.view)}isActive(e){return ff(this.view.state,e)}focus(){this.destroyed||this.view.focus()}isPasteAsText(){return this.pasteAsText}setPasteAsText(e){this.pasteAsText=e,this.toolbar?.update()}openSearch(){this.searchBar.open()}closeSearch(){this.searchBar.close()}isEditable(){return this.editable&&!this.disabled}isDisabled(){return this.disabled}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.view.setProps({}),this.applyDisabled(),e&&(this.ui.closePopover(),this.view.dom.blur()),this.toolbar?.update(),this.emit("editableChange"))}applyDisabled(){this.root.classList.toggle("nova-disabled",this.disabled),this.disabled?this.root.setAttribute("aria-disabled","true"):this.root.removeAttribute("aria-disabled"),this.disabled?this.view.dom.setAttribute("tabindex","-1"):this.view.dom.removeAttribute("tabindex")}setEditable(e){this.editable!==e&&(this.editable=e,this.view.setProps({}),this.root.classList.toggle("nova-readonly",!e),e||this.ui.closePopover(),this.toolbar?.update(),this.emit("editableChange"))}on(e,t){let r=this.listeners.get(e);return r||this.listeners.set(e,r=new Set),r.add(t),()=>this.off(e,t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e){for(let t of this.listeners.get(e)??[])t(this)}destroy(){if(!this.destroyed){this.emit("destroy"),this.destroyed=!0,this.menubar?.destroy(),this.ui.destroy(),this.toolbar?.destroy(),this.statusbar?.destroy();for(let e of this.cleanups.splice(0))try{e()}catch(t){Xe("Plugin cleanup failed",t)}this.searchBar.destroy(),this.root.classList.contains("nova-fullscreen")&&Lr(this,!1),this.view.destroy(),this.root.remove(),this.listeners.clear()}}}});function Xh(n){let e=[];return n.descendants((t,r)=>{if(!t.isTextblock)return!0;let o="",i=[];return t.forEach((s,l)=>{let a=r+1+l;if(s.isText){for(let c=0;c<s.text.length;c+=1)i.push(a+c);o+=s.text}else{let c=s.type.spec.leafText?.(s)??" ";for(let u=0;u<c.length;u+=1)i.push(a);o+=c}}),e.push({pos:r,end:r+t.nodeSize-1,depth:n.resolve(r).depth,type:t.type.name,text:o,chars:i}),!1}),e}function Qh(n,e,t){let r=n.length,o=e.length;if((r+1)*(o+1)>2e6)return null;let i=new Uint32Array((r+1)*(o+1)),s=(u,d)=>u*(o+1)+d;for(let u=r-1;u>=0;u-=1)for(let d=o-1;d>=0;d-=1)i[s(u,d)]=t(n[u],e[d])?i[s(u+1,d+1)]+1:Math.max(i[s(u+1,d)],i[s(u,d+1)]);let l=[],a=0,c=0;for(;a<r&&c<o;)t(n[a],e[c])?(l.push([a,c]),a+=1,c+=1):i[s(a+1,c)]>=i[s(a,c+1)]?a+=1:c+=1;return l}function vi(n,e,t){if(e>=t)return;let r=n.added[n.added.length-1];r&&r.to>=e?r.to=Math.max(r.to,t):n.added.push({from:e,to:t})}function xk(n,e,t){if(e.text===t.text){e.text&&vi(n,e.chars[0],e.end);return}let r=Yh(e.text),o=Yh(t.text),i=Qh(r,o,(f,p)=>f===p);if(!i){e.text&&vi(n,e.chars[0],e.end),t.text&&n.removed.push({pos:e.end,text:t.text,block:!1});return}let s=[],l=0;for(let f of r)s.push(l),l+=f.length;let a=f=>f<e.chars.length?e.chars[f]:e.end,c=0,u=0,d=(f,p)=>{let h=o.slice(u,f).join("");if(h.trim()){let m=p<r.length?a(s[p]):e.end;n.removed.push({pos:m,text:h,block:!1})}u=f};for(let[f,p]of[...i,[r.length,o.length]]){for(;c<f;c+=1){if(!r[c].trim())continue;let h=s[c];vi(n,a(h),a(h+r[c].length-1)+1)}d(p,f),c=f+1,u=p+1}}function Sk(n,e,t){return e?t>=e.depth?e.pos:n.resolve(e.pos).before(t+1):n.content.size}function Zh(n,e){let t={added:[],removed:[]},r=Xh(n),o=Xh(e),s=Qh(r,o,(c,u)=>c.type===u.type&&c.text===u.text)??[],l=0,a=0;for(let[c,u]of[...s,[r.length,o.length]]){let d=r.slice(l,c),f=o.slice(a,u),p=Math.min(d.length,f.length);for(let h=0;h<p;h+=1)xk(t,d[h],f[h]);for(let h of d.slice(p))h.text&&vi(t,h.chars[0],h.end);for(let h of f.slice(p))h.text.trim()&&t.removed.push({pos:Sk(n,r[c],h.depth),text:h.text,block:!0});l=c+1,a=u+1}return t}var Yh,em=P(()=>{"use strict";Yh=n=>n.split(/(\s+)/).filter(Boolean)});var rm={};He(rm,{default:()=>Ak});function Ck(n,e){let t=typeof e=="string"?e:Mk.serializeFragment(De.fromJSON(n.schema,e).content);return yi(n.schema,t)}function Ek(n,e){let t=V(n,nm),r=n.options.language??"en",o=new Intl.DateTimeFormat(r,{dateStyle:"medium",timeStyle:"short"}),i=Ce("nova-history-title"),s=[],l=null,a=null,c=!0,u=null,d=0,f=v("ol",{className:"nova-history-list","aria-label":t.versions}),p=v("div",{className:"nova-history-preview"}),h=v("p",{className:"nova-history-status",role:"status"}),m=v("button",{type:"button",className:"nova-button nova-button-primary",disabled:!0},t.restore),g=v("input",{type:"checkbox",checked:!0}),b=v("div",{className:"nova-history-legend"},v("label",{className:"nova-history-toggle"},g,t.highlight),v("span",{className:"nova-history-swatch is-added"},t.onlyHere),v("span",{className:"nova-history-swatch is-removed"},t.onlyNow)),x=e.save?v("button",{type:"button",className:"nova-button"},t.save):null,w=v("button",{type:"button",className:"nova-button"},t.close),E=v("section",{className:"nova-history",role:"region","aria-labelledby":i},v("header",{className:"nova-history-head"},v("h2",{id:i,className:"nova-history-title"},t.title),b,v("span",{className:"nova-history-spacer"}),x,m,w),v("div",{className:"nova-history-body"},p,v("aside",{className:"nova-history-side"},h,f))),D=I=>{if(!c||!l)return Y.empty;let{added:R,removed:z}=Zh(I,n.view.state.doc),te=[...R.map(fe=>re.inline(fe.from,fe.to,{class:"nova-diff-added"})),...z.map(fe=>re.widget(fe.pos,()=>v(fe.block?"div":"span",{className:"nova-diff-removed"},fe.text),{side:-1,ignoreSelection:!0}))];return Y.create(I,te)},C=I=>{a=I;let R=yn.create({doc:I}),z=D(I);if(u){u.setProps({state:R,decorations:()=>z});return}u=new Qt(p,{state:R,editable:()=>!1,decorations:()=>z,attributes:{class:"nova-prosemirror nova-history-doc","aria-label":t.title,"aria-readonly":"true"}})},N=()=>{let I=[{revision:null,title:t.current,detail:""},...[...s].sort((R,z)=>z.createdAt-R.createdAt).map(R=>({revision:R,title:o.format(R.createdAt),detail:(R.authors??[]).join(", "),...R.label?{label:R.label}:{}}))];f.replaceChildren(...I.map(R=>{let z=R.revision?.id===l?.id&&!!R.revision==!!l,te=v("button",{type:"button",className:"nova-history-item","aria-current":z?"true":null,tabindex:z?"0":"-1","data-revision":R.revision?.id??"current"},v("span",{className:"nova-history-time"},R.title),R.label?v("span",{className:"nova-history-label"},R.label):null,R.detail?v("span",{className:"nova-history-authors"},R.detail):null);return te.addEventListener("click",()=>{y(R.revision),S()}),v("li",{},te)}))};function S(){f.querySelector('.nova-history-item[aria-current="true"]')?.focus()}async function y(I){l=I,N(),m.disabled=!0;let R=++d;if(!I){C(n.view.state.doc);return}h.textContent=t.loading;try{let z=await e.load(I,n);if(R!==d)return;C(Ck(n,z)),h.textContent="",m.disabled=!n.isEditable()}catch{R===d&&(h.textContent=t.failed)}}async function k(){h.textContent=t.loading;try{s=(await e.list()).filter(I=>I&&typeof I.id=="string"),h.textContent=s.length?"":t.empty,N()}catch{h.replaceChildren(t.failed," ",v("button",{type:"button",className:"nova-link-btn",onClick:()=>{k()}},t.retry))}}function T(){u?.destroy(),E.remove(),n.root.classList.remove("nova-history-open"),n.focus()}return m.addEventListener("click",()=>{if(!l||!a)return;let I=l,{state:R}=n.view;n.view.dispatch(nf(R.tr.replaceWith(0,R.doc.content.size,a.content))),e.onRestore?.(I),n.ui.notify({text:t.restored.replace("{date}",o.format(I.createdAt)),type:"success"}),T()}),x?.addEventListener("click",async()=>{x.disabled=!0;try{await e.save(),n.ui.notify({text:t.saved,type:"success"}),await k(),S()}finally{x.disabled=!1}}),w.addEventListener("click",T),g.addEventListener("change",()=>{c=g.checked,a&&C(a)}),E.addEventListener("keydown",I=>{if(I.key==="Escape"){I.preventDefault(),T();return}let R=I.target;if(!R.classList.contains("nova-history-item")||I.key!=="ArrowDown"&&I.key!=="ArrowUp")return;I.preventDefault();let z=[...f.querySelectorAll(".nova-history-item")],te=z[z.indexOf(R)+(I.key==="ArrowDown"?1:-1)];te?.click(),f.querySelector(`[data-revision="${te?.dataset.revision}"]`)?.focus()}),n.ui.closeOverlays(),n.root.classList.add("nova-history-open"),n.root.append(E),y(null),k().then(()=>{f.querySelector(".nova-history-item")?.focus()}),{close:T,element:E}}var nm,tm,Mk,Ak,om=P(()=>{"use strict";j();de();Vo();K();Rt();Vl();ai();Z();em();ke();nm={en:{button:"Version history",title:"Version history",current:"Current version",restore:"Restore this version",close:"Close",save:"Save version",saved:"Version saved",highlight:"Highlight changes",onlyHere:"Only in this version",onlyNow:"Only in the current text",loading:"Loading\u2026",failed:"Could not load the version history.",retry:"Try again",empty:"No saved versions yet.",restored:"Restored the version from {date}. Undo with Ctrl+Z.",versions:"Versions"},ru:{button:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",title:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",current:"\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",restore:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u044D\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044E",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0432\u0435\u0440\u0441\u0438\u044E",saved:"\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0430",highlight:"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",onlyHere:"\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u044D\u0442\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438",onlyNow:"\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u0442\u0435\u043A\u0441\u0442\u0435",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0432\u0435\u0440\u0441\u0438\u0439.",retry:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",empty:"\u0421\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442.",restored:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430 \u0432\u0435\u0440\u0441\u0438\u044F \u043E\u0442 {date}. \u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u2014 Ctrl+Z.",versions:"\u0412\u0435\u0440\u0441\u0438\u0438"}},tm=M.history,Mk=new yt;Ak={name:"revisionhistory",toolbar:"revisionhistory",setup(n){let e=n.options.pluginOptions?.revisionhistory;if(!e?.list||!e.load){console.warn("[nova] revisionhistory: set pluginOptions.revisionhistory.list and .load");return}let t=V(n,nm),r=null,o=()=>{r?.element.isConnected||(r=Ek(n,e))};return n.ui.registry.addButton("revisionhistory",{icon:tm,tooltip:t.button,onAction:o}),n.ui.registry.addMenuItem("revisionhistory",{text:t.button,icon:tm,onAction:o}),()=>r?.close()}}});Hr();j();K();At();Z();ke();var nc=M.anchor,lg={en:{title:"Anchor",id:"ID",hint:"Letters, digits, \u201C-\u201D, \u201C_\u201D, \u201C.\u201D; must start with a letter. Link to it with #ID.",invalid:"Use letters, digits, \u201C-\u201D, \u201C_\u201D or \u201C.\u201D, starting with a letter",save:"Save"},ru:{title:"\u042F\u043A\u043E\u0440\u044C",id:"\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440",hint:"\u041B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB, \xAB.\xBB; \u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441 \u0431\u0443\u043A\u0432\u044B. \u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u044F\u043A\u043E\u0440\u044C \u2014 #\u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440.",invalid:"\u0422\u043E\u043B\u044C\u043A\u043E \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB \u0438\u043B\u0438 \xAB.\xBB, \u043F\u0435\u0440\u0432\u0430\u044F \u2014 \u0431\u0443\u043A\u0432\u0430",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C"}},to=/^[A-Za-z][\w.-]{0,63}$/,rc={name:"anchor",toolbar:"anchor",nodes:{anchor:{group:"inline",inline:!0,atom:!0,selectable:!0,attrs:{id:{}},parseDOM:[{tag:"a[id]:not([href])",getAttrs:n=>{let e=n.getAttribute("id")??"";return to.test(e)?{id:e}:!1}},{tag:"a[name]:not([href])",getAttrs:n=>{let e=n.getAttribute("name")??"";return to.test(e)?{id:e}:!1}}],toDOM:n=>["a",{id:to.test(n.attrs.id)?n.attrs.id:null}]}},setup(n){let e=V(n,lg),t=()=>{let{selection:o}=n.view.state;return o instanceof B&&o.node.type.name==="anchor"?o:null},r=()=>{let o=t(),i=ce({label:e.id,hint:e.hint,value:o?.node.attrs.id??""});n.ui.openDialog({title:e.title,body:v("div",{className:"nova-form"},i.el),submitLabel:e.save,onSubmit:()=>{let s=i.input.value.trim();if(!to.test(s))return e.invalid;let{state:l,dispatch:a}=n.view,c=n.schema.nodes.anchor,u=t();return a(u?l.tr.setNodeMarkup(u.from,void 0,{id:s}):l.tr.replaceSelectionWith(c.create({id:s}),!1).scrollIntoView()),!0}})};n.ui.registry.addToggleButton("anchor",{icon:nc,tooltip:e.title,isActive:()=>t()!==null,isEnabled:o=>o.isEditable(),onAction:r}),n.ui.registry.addMenuItem("anchor",{text:e.title,icon:nc,onAction:r})}};j();K();Rt();pt();Su();ke();var $b={en:{list:"People",empty:"No matches"},ru:{list:"\u041B\u044E\u0434\u0438",empty:"\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E"}},Es=/^[\w.@:+-]{1,128}$/,_b=80,yo=n=>n.replace(/^@/,"").trim().slice(0,_b);async function As(n,e,t=8){let r=await n(e);return Array.isArray(r)?r.filter(o=>o&&typeof o.id=="string"&&Es.test(o.id)&&o.name).slice(0,t).map(o=>({id:o.id,name:yo(String(o.name)),...o.description?{description:String(o.description).slice(0,120)}:{}})):[]}var Mu={name:"mentions",nodes:{mention:{group:"inline",inline:!0,atom:!0,selectable:!1,attrs:{id:{},name:{default:""}},parseDOM:[{tag:"span[data-mention]",getAttrs:n=>{let e=n,t=e.getAttribute("data-mention")??"";return Es.test(t)?{id:t,name:yo(e.textContent??"")}:!1}}],toDOM:n=>["span",{"data-mention":Es.test(n.attrs.id)?n.attrs.id:null},`@${yo(String(n.attrs.name))}`],leafText:n=>`@${yo(String(n.attrs.name))}`}},setup(n){let e=n.options.pluginOptions?.mentions;if(!e?.fetch){console.warn("[nova] mentions: set pluginOptions.mentions.fetch to search people");return}let t=V(n,$b),r=e.maxResults??8,o=new Map;n.ui.registry.addAutocompleter("mentions",{trigger:"@",label:t.list,emptyText:t.empty,maxResults:r,fetch:async i=>{let s=await As(e.fetch,i,r);return o=new Map(s.map(l=>[l.id,l])),s.map(l=>({value:l.id,label:l.name,...l.description?{detail:l.description}:{}}))},onSelect:(i,s,l)=>{let a=o.get(i.value)??{id:i.value,name:i.label},{state:c,dispatch:u}=l.view,d=l.schema.nodes.mention.create({id:a.id,name:a.name});u(c.tr.replaceWith(s.from,s.to,[d,c.schema.text(" ")]).scrollIntoView()),e.onMention?.(a,l)}})}};ke();var jb={en:{add:"Add comment",show:"Comments",panel:"Comments",guest:"Guest",newComment:"New comment",placeholder:"Add a comment\u2026",replyPlaceholder:"Reply\u2026",comment:"Comment",reply:"Reply",cancel:"Cancel",save:"Save",edit:"Edit",remove:"Delete",resolve:"Resolve",reopen:"Reopen",deleteThread:"Delete thread",close:"Close comments",showResolved:"Show resolved",resolvedBy:"Resolved by {name}",orphan:"The commented text was deleted",empty:"No comments yet. Select text and press \u201CAdd comment\u201D ({shortcut}).",people:"People",noPeople:"No matches",edited:"edited",you:"you",count:"{count} comments"},ru:{add:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",show:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",panel:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",guest:"\u0413\u043E\u0441\u0442\u044C",newComment:"\u041D\u043E\u0432\u044B\u0439 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\u2026",replyPlaceholder:"\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C\u2026",comment:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",reply:"\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C",cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",edit:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",remove:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",resolve:"\u0420\u0435\u0448\u0435\u043D\u043E",reopen:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u043D\u043E\u0432\u0430",deleteThread:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",showResolved:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0440\u0435\u0448\u0451\u043D\u043D\u044B\u0435",resolvedBy:"\u0420\u0435\u0448\u0435\u043D\u043E: {name}",orphan:"\u041F\u0440\u043E\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u0443\u0434\u0430\u043B\u0451\u043D",empty:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442. \u0412\u044B\u0434\u0435\u043B\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \xAB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\xBB ({shortcut}).",people:"\u041B\u044E\u0434\u0438",noPeople:"\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",edited:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E",you:"\u0432\u044B",count:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432: {count}"}},Tu=M.commentAdd,Nu=M.comments,vo="Mod-Alt-m",ht=new J("nova-comments"),Ls=new WeakMap;function Ns(n){return Ls.get(n)}function Lu(n){let e=new Map;return n.descendants((t,r)=>{if(t.isInline)for(let o of t.marks){if(o.type.name!=="comment")continue;let i=o.attrs.id,s=e.get(i)??[],l=s[s.length-1];l&&l.to===r?l.to=r+t.nodeSize:s.push({from:r,to:r+t.nodeSize}),e.set(i,s)}}),e}function Kb(n){let{$from:e,empty:t}=n.selection;return(t?[...e.nodeBefore?.marks??[],...e.nodeAfter?.marks??[]]:e.nodeAfter?.marks??[]).filter(o=>o.type.name==="comment").map(o=>o.attrs.id)}var Ou={name:"comments",toolbar:"addcomment showcomments",marks:{comment:{attrs:{id:{}},inclusive:!1,excludes:"",parseDOM:[{tag:"span[data-comment]",getAttrs:n=>{let e=n.getAttribute("data-comment")??"";return hr.test(e)?{id:e}:!1}}],toDOM:n=>["span",{"data-comment":hr.test(n.attrs.id)?n.attrs.id:null},0]}},prosemirrorPlugins:n=>{let e=null;return[Fe({[vo]:()=>Ns(n)?.startComment()??!1}),new _({key:ht,state:{init:()=>({pending:null,active:null}),apply(t,r){let o=t.getMeta(ht),i=r;if(t.docChanged&&i.pending){let s=t.mapping.map(i.pending.from,1),l=t.mapping.map(i.pending.to,-1);i={...i,pending:s<l?{from:s,to:l}:null}}return o&&("pending"in o||"active"in o)&&(i={...i,...o}),i}},props:{decorations(t){let r=Ns(n),o=ht.getState(t),i=r?.store.threads();if(e&&e.doc===t.doc&&e.threads===i&&e.state===o)return e.set;let s=new Set((i??[]).filter(c=>!c.resolved).map(c=>c.id)),l=[];for(let[c,u]of Lu(t.doc)){if(!s.has(c))continue;let d=c===o.active?"nova-comment is-active":"nova-comment";for(let{from:f,to:p}of u)l.push(re.inline(f,p,{class:d}))}if(o.pending){let{from:c,to:u}=o.pending;l.push(re.inline(c,u,{class:"nova-comment is-active is-pending"}))}let a=Y.create(t.doc,l);return e={doc:t.doc,threads:i,state:o,set:a},a}},view:()=>({update(t,r){if(r.selection.eq(t.state.selection)||r.doc!==t.state.doc)return;let o=Ns(n);if(!o||ht.getState(t.state).pending)return;let i=new Set(o.store.threads().filter(l=>!l.resolved).map(l=>l.id)),s=Kb(t.state).find(l=>i.has(l));s&&(s!==o.active()||!o.isPanelOpen())&&queueMicrotask(()=>{o.setActive(s),o.openPanel()})}})})]},setup(n){let e=V(n,jb),t=n.options.pluginOptions?.comments??{},r=t.store??xu(t.threads??[],t.onChange),o={id:String(t.author?.id??"guest").slice(0,128),name:String(t.author?.name||e.guest).slice(0,80)},i=()=>n.schema.marks.comment,s=t.mentions??n.options.pluginOptions?.mentions?.fetch,l=(C,N=[])=>[...new Map(N.map(y=>[y.id,y])).values()].filter(y=>C.includes(`@${y.name}`)),a=(C,N)=>{let S=l(C,N);return{id:Cs(),author:o,text:C,createdAt:Date.now(),...S.length?{mentions:S}:{}}},c=(C,N)=>{N.mentions?.length&&t.onMention?.({threadId:C,comment:N,users:N.mentions})},u=()=>ht.getState(n.view.state),d=C=>n.view.dispatch(n.view.state.tr.setMeta(ht,C)),f=null,p=!1,h=null,m=n.view.dom.parentElement,g=document.createElement("div");g.className="nova-body",m.parentElement.insertBefore(g,m),g.append(m);let b={editor:n,store:r,author:o,labels:e,shortcut:vo,pending:()=>u().pending,active:()=>u().active,setActive(C,N=!1){u().active!==C&&d({active:C}),f?.render();let S=C?b.ranges(C)[0]:void 0;if(N&&S){let{node:y}=n.view.domAtPos(S.from);(y instanceof Element?y:y.parentElement)?.scrollIntoView({block:"nearest"})}},startComment(){let{selection:C}=n.view.state;return C.empty||!n.isEditable()?!1:(d({pending:{from:C.from,to:C.to},active:null}),b.openPanel().then(()=>{f?.render(),f?.focusComposer()}),!0)},cancelPending(){d({pending:null}),f?.render(),n.focus()},findUsers:s?C=>As(s,C):null,submitPending(C,N){let S=u().pending,y=C.trim().slice(0,5e3);if(!S||!y)return null;let k=Cs("t"),T=a(y,N);r.createThread({id:k,createdAt:T.createdAt,comments:[T],resolved:null});let{state:I}=n.view;return n.view.dispatch(I.tr.addMark(S.from,S.to,i().create({id:k})).setMeta(ht,{pending:null,active:k}).setMeta("addToHistory",!1)),f?.render(),c(k,T),k},reply(C,N,S){let y=N.trim().slice(0,5e3);if(!y)return;let k=a(y,S);r.reply(C,k),c(C,k)},ranges:C=>Lu(n.view.state.doc).get(C)??[],quote(C){let{doc:N}=n.view.state;return b.ranges(C).map(({from:S,to:y})=>N.textBetween(S,y," ")).join(" \u2026 ")},positionOf:C=>b.ranges(C)[0]?.from??Number.MAX_SAFE_INTEGER,deleteThread(C){let{state:N}=n.view,S=N.tr;for(let{from:y,to:k}of b.ranges(C))S.removeMark(y,k,i().create({id:C}));u().active===C&&S.setMeta(ht,{active:null}),(S.docChanged||S.getMeta(ht))&&n.view.dispatch(S.setMeta("addToHistory",!1)),r.deleteThread(C)},setResolved(C,N){r.setResolved(C,N?{by:o,at:Date.now()}:null),N&&u().active===C&&d({active:null})},canEdit:C=>t.canEdit?t.canEdit(C,o):C.author.id===o.id,isPanelOpen:()=>p,async openPanel(){f||(h??=Promise.resolve().then(()=>(Au(),Eu)).then(({createCommentsPanel:C})=>{n.view.isDestroyed||(f=C(b),g.append(f.el))}),await h),!(!f||p)&&(n.ui.closeOverlays(),p=!0,f.el.hidden=!1,n.root.classList.add("nova-comments-open"),f.render(),n.updateUI())},closePanel(){!f||!p||(p=!1,f.el.hidden=!0,n.root.classList.remove("nova-comments-open"),u().pending&&d({pending:null}),n.updateUI(),n.focus())}};Ls.set(n,b);let x=r.subscribe(()=>{n.view.isDestroyed||(d({refresh:!0}),f?.render())}),w=()=>b.startComment(),E=()=>b.isPanelOpen()?b.closePanel():void b.openPanel(),D=C=>C.isEditable()&&!C.view.state.selection.empty;return n.ui.registry.addButton("addcomment",{icon:Tu,tooltip:e.add,shortcut:vo,isEnabled:D,onAction:w}),n.ui.registry.addToggleButton("showcomments",{icon:Nu,tooltip:e.show,isActive:()=>p,onAction:E}),n.ui.registry.addMenuItem("addcomment",{text:e.add,icon:Tu,shortcut:vo,isEnabled:D,onAction:w}),n.ui.registry.addMenuItem("showcomments",{text:e.show,icon:Nu,isActive:()=>p,onAction:E}),()=>{x(),f?.destroy(),Ls.delete(n)}}};K();j();ke();var Du={en:{insert:"Insert variable",search:"Variables",empty:"No variables found",unknown:"Unknown variable"},ru:{insert:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0443\u044E",search:"\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435",empty:"\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B",unknown:"\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0430\u044F"}},Ru=/^[\w.:-]{1,100}$/,Jb=/^data-[a-z0-9-]{1,40}$/;function wo(n){return n.options.pluginOptions?.mergetags??{}}function Gb(n){let e=wo(n).attribute??"data-mergetag";return Jb.test(e)?e:(console.warn(`[nova] mergetags: attribute "${e}" must look like data-name; using data-mergetag`),"data-mergetag")}var Iu=n=>Array.isArray(n.items);function ko(n){return(wo(n).list??[]).flatMap(e=>Iu(e)?e.items:[e])}function Bu(n,e){return ko(n).find(t=>t.key===e)?.label}function Xb(n){let e=Gb(n);return{mergetag:{group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!0,ignoreStyles:!0,attrs:{key:{},label:{default:""}},parseDOM:[{tag:`span[${e}]`,priority:60,getAttrs:t=>{let r=t,o=r.getAttribute(e)??"";return Ru.test(o)?{key:o,label:Bu(n,o)??r.textContent?.trim()??o}:!1}}],toDOM:t=>{let r=Ru.test(t.attrs.key)?t.attrs.key:"",o=t.attrs.label||r;return["span",{[e]:r,contenteditable:"false"},o]}}}}var Os=class{constructor(e,t,r){this.node=e;this.editor=t;this.unknownTitle=r;this.dom=document.createElement("span"),this.dom.className="nova-mergetag",this.dom.contentEditable="false",this.render()}node;editor;unknownTitle;dom;render(){let e=this.node.attrs.key,t=Bu(this.editor,e);this.dom.textContent=t??(this.node.attrs.label||e),this.dom.dataset.key=e;let o=!!wo(this.editor).list?.length&&t===void 0;this.dom.classList.toggle("is-unknown",o),this.dom.title=o?`${this.unknownTitle}: ${e}`:e}update(e){return e.type!==this.node.type?!1:(this.node=e,this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(){return!1}ignoreMutation(){return!0}};function Pu(n,e,t){let{state:r,dispatch:o}=n.view,i=n.schema.nodes.mergetag.create({key:e.key,label:e.label}),s=t?r.tr.replaceWith(t.from,t.to,i):r.tr.replaceSelectionWith(i,!1);o(s.scrollIntoView()),n.focus()}var Hu={name:"mergetags",toolbar:"mergetags",nodes:Xb,prosemirrorPlugins:n=>{let e=V(n,Du);return[new _({props:{nodeViews:{mergetag:(t,r)=>new Os(t,n,e.unknown)}}})]},setup(n){let e=V(n,Du);n.ui.registry.addMenuButton("mergetags",{icon:M.mergeTags,tooltip:e.insert,isEnabled:t=>t.isEditable()&&ko(t).length>0,items:t=>{let r=[],o=(i,s)=>({id:s,label:i.label,onSelect:()=>Pu(t,i)});return(wo(t).list??[]).forEach((i,s)=>{Iu(i)?(r.length&&r.push({type:"separator"}),r.push({type:"heading",label:i.title}),i.items.forEach((l,a)=>r.push(o(l,`mergetag-${s}-${a}`)))):r.push(o(i,`mergetag-${s}`))}),r}}),n.ui.registry.addAutocompleter("mergetags",{trigger:"{{",label:e.search,emptyText:e.empty,maxResults:12,fetch:(t,r)=>{let o=t.toLowerCase();return ko(r).filter(i=>i.label.toLowerCase().includes(o)||i.key.toLowerCase().includes(o)).map(i=>({value:i.key,label:i.label,detail:i.key}))},onSelect:(t,r,o)=>{let i=ko(o).find(s=>s.key===t.value);i&&Pu(o,i,r)}})}};j();de();K();Ye();Rt();pt();ke();var zu=/^[A-Za-z0-9_-]{1,64}$/,Bs=/^[\w.@:+-]{1,128}$/,Ds={en:{toggle:"Suggest edits",review:"Review suggestions",accept:"Accept",reject:"Reject",acceptAll:"Accept all suggestions",rejectAll:"Reject all suggestions",next:"Next suggestion",previous:"Previous suggestion",inserted:"Inserted by {name}",deleted:"Deleted by {name}",toolbar:"Suggestion",guest:"Guest",none:"No suggestions"},ru:{toggle:"\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0442\u044C \u043F\u0440\u0430\u0432\u043A\u0438",review:"\u041F\u0440\u0430\u0432\u043A\u0438",accept:"\u041F\u0440\u0438\u043D\u044F\u0442\u044C",reject:"\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C",acceptAll:"\u041F\u0440\u0438\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",rejectAll:"\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",next:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",previous:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",inserted:"\u0412\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043E: {name}",deleted:"\u0423\u0434\u0430\u043B\u0435\u043D\u043E: {name}",toolbar:"\u041F\u0440\u0430\u0432\u043A\u0430",guest:"\u0413\u043E\u0441\u0442\u044C",none:"\u041F\u0440\u0430\u0432\u043E\u043A \u043D\u0435\u0442"}},Fu=M.suggest,Yb=M.review,Qb=M.check,Zb=M.close,mr=new J("nova-suggestions"),Hs="nova-suggestions-own",$u=["#1a7f37","#8250df","#bf3989","#0969da","#bc4c00","#1b7c83"];function ey(n){let e=0;for(let t of n)e=e*31+t.charCodeAt(0)|0;return $u[Math.abs(e)%$u.length]}function _u(){let n=new Uint8Array(9);return globalThis.crypto.getRandomValues(n),"s"+Array.from(n,e=>(e%36).toString(36)).join("")}function Vu(n){let e=n==="insert"?"ins":"del";return{attrs:{id:{},author:{default:""},name:{default:""},time:{default:0}},inclusive:!1,excludes:"",parseDOM:[{tag:`${e}[data-suggestion]`,priority:60,getAttrs:t=>{let r=t,o=r.getAttribute("data-suggestion")??"";if(!zu.test(o))return!1;let i=r.getAttribute("data-author")??"";return{id:o,author:Bs.test(i)?i:"",name:(r.getAttribute("data-name")??"").slice(0,80),time:Number(r.getAttribute("data-time"))||0}}}],toDOM:t=>[e,{"data-suggestion":zu.test(t.attrs.id)?t.attrs.id:null,"data-author":Bs.test(t.attrs.author)?t.attrs.author:null,"data-name":String(t.attrs.name??"").slice(0,80)||null,"data-time":Number(t.attrs.time)||null},0]}}var zs=n=>({insert:n.marks.suggestion_insert,delete:n.marks.suggestion_delete});function ty(n){return!n.docChanged||n.getMeta(Hs)||n.getMeta("addToHistory")===!1||n.getMeta("history$")||n.getMeta("y-sync$")?.isChangeOrigin?!1:n.steps.every(t=>t instanceof ve)}function Rs(n,e,t,r){let o=n.resolve(e);for(let i of[o.nodeBefore,o.nodeAfter]){let s=i?.marks.find(l=>l.type===t&&l.attrs.author===r);if(s)return s}return null}function Wu(n,e,t){let r=[];return n.forEach(o=>{o.isInline?r.push(t&&!t.allowsMarkType(e.type)?o:o.mark(e.addToSet(o.marks))):r.push(o.copy(Wu(o.content,e,o.type)))}),A.from(r)}function ny(n,e,t){if(!ty(n))return n;let r=zs(e.schema),o=e.tr,i=Date.now(),s=c=>c,l=null,a=null;if(n.steps.forEach(c=>{let u=c,d=o.steps.length,f=s,p=f(u.from),h=Math.max(p,f(u.to));if(h>p){let b=[],x=[];if(o.doc.nodesBetween(p,h,(D,C)=>{if(!D.isInline)return!0;let N=Math.max(C,p),S=Math.min(C+D.nodeSize,h);return N>=S||(D.marks.some(k=>k.type===r.insert&&k.attrs.author===t.id)?b.push({from:N,to:S}):r.delete.isInSet(D.marks)||x.push({from:N,to:S})),!1}),x.length){let D=x[0],C=Rs(o.doc,D.from,r.delete,t.id)??Rs(o.doc,x[x.length-1].to,r.delete,t.id)??r.delete.create({id:_u(),author:t.id,name:t.name,time:i});for(let N of x)o.addMark(N.from,N.to,C)}for(let D of b.reverse())o.delete(D.from,D.to);let w=o.mapping.slice(d);p=w.map(p,1),h=w.map(h,-1);let E=e.selection;n.steps.length===1&&u.slice.size===0&&E.empty&&E.from===u.from&&n.selection.head===u.from&&(l=h)}if(u.slice.size>0){let b=h;if(!u.slice.openStart)for(let D=o.doc.resolve(b).nodeAfter;D&&r.delete.isInSet(D.marks);)b+=D.nodeSize,D=o.doc.resolve(b).nodeAfter;let x=Rs(o.doc,b,r.insert,t.id)??r.insert.create({id:_u(),author:t.id,name:t.name,time:i}),w=o.doc.resolve(b),E=Wu(u.slice.content,x,u.slice.openStart?null:w.parent.type);o.replace(b,b,new O(E,u.slice.openStart,u.slice.openEnd)),n.steps.length===1&&(a=b+u.slice.size)}let m=u.getMap().invert(),g=o.mapping.slice(d);s=b=>g.map(f(m.map(b,-1)),1)}),l!==null)o.setSelection(H.create(o.doc,l));else if(a!==null&&n.selection.empty)o.setSelection(H.create(o.doc,a));else{let c=s(n.selection.anchor),u=s(n.selection.head);try{o.setSelection(H.create(o.doc,c,u))}catch{}}for(let c of["addToHistory","uiEvent","paste","scrollIntoView"]){let u=n.getMeta(c);u!==void 0&&o.setMeta(c,u)}return n.scrolledIntoView&&o.scrollIntoView(),o}function gr(n){let e=zs(n.type.schema),t=[];return n.descendants((r,o)=>{if(!r.isInline)return!0;for(let i of r.marks){let s=i.type===e.insert?"insert":i.type===e.delete?"delete":null;if(!s)continue;let l=t[t.length-1],a=r.isText?r.text:"";l&&l.id===i.attrs.id&&l.kind===s&&l.to===o?(l.to=o+r.nodeSize,l.text+=a):t.push({id:i.attrs.id,kind:s,author:{id:i.attrs.author,name:i.attrs.name},time:Number(i.attrs.time)||0,from:o,to:o+r.nodeSize,text:a})}return!1}),t}function Ps(n,e,t){let r=zs(n.schema),o=n.tr.setMeta(Hs,!0),i=gr(n.doc).filter(s=>!t||t.includes(s.id));for(let s of[...i].sort((l,a)=>a.from-l.from))s.kind==="insert"==(e==="reject")?o.delete(s.from,s.to):o.removeMark(s.from,s.to,s.kind==="insert"?r.insert:r.delete);return o}function qu(n){let{from:e}=n.selection;return gr(n.doc).find(t=>e>=t.from&&e<=t.to&&(t.to>e||t.from<e))??null}function Tn(n){return mr.getState(n)?.enabled??!1}function Is(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.setMeta(mr,{enabled:e}).setMeta(Hs,!0)),n.updateUI()}var Uu={name:"suggestions",toolbar:"suggestions reviewsuggestions",marks:{suggestion_insert:Vu("insert"),suggestion_delete:Vu("delete")},prosemirrorPlugins:n=>{let e=n.options.pluginOptions?.suggestions??{},t=null;return[new _({key:mr,state:{init:()=>({enabled:!!(e.enabled||e.force)}),apply(r,o){let i=r.getMeta(mr);return i?{enabled:e.force?!0:i.enabled}:o}},props:{attributes:r=>mr.getState(r)?.enabled?{class:"nova-suggesting"}:{},decorations(r){if(t?.doc===r.doc)return t.set;let o=V(n,Ds),i=new Intl.DateTimeFormat(n.options.language??"en",{dateStyle:"medium",timeStyle:"short"}),s=Y.create(r.doc,gr(r.doc).map(l=>re.inline(l.from,l.to,{title:(l.kind==="insert"?o.inserted:o.deleted).replace("{name}",l.author.name||o.guest)+(l.time?` \xB7 ${i.format(l.time)}`:""),class:l.kind==="insert"?"nova-sugg-insert":"nova-sugg-delete",style:`--nova-suggestion: ${ey(l.author.id||l.author.name)}`})));return t={doc:r.doc,set:s},s}}}),Fe({"Mod-Alt-Shift-e":()=>e.force?!1:(Is(n,!Tn(n.view.state)),!0)})]},transformTransaction(n,e,t){if(!Tn(e))return n;let r=t.options.pluginOptions?.suggestions??{},o=V(t,Ds),i={id:Bs.test(r.author?.id??"")?r.author.id:"guest",name:String(r.author?.name||o.guest).slice(0,80)};return ny(n,e,i)},setup(n){let e=n.options.pluginOptions?.suggestions??{},t=V(n,Ds),r=e.canReview!==!1,o=c=>n.view.dispatch(c),i=()=>qu(n.view.state),s=c=>{let u=i();u&&o(Ps(n.view.state,c,[u.id])),n.focus()},l=c=>{let{state:u}=n.view,d=gr(u.doc),f=u.selection.from,p=c===1?d.find(h=>h.from>f)??d[0]:[...d].reverse().find(h=>h.to<f)??d[d.length-1];if(!p){n.ui.notify(t.none);return}o(u.tr.setSelection(H.create(u.doc,p.from)).scrollIntoView()),n.focus()},a=()=>gr(n.view.state.doc).length>0;n.ui.registry.addToggleButton("suggestions",{icon:Fu,tooltip:t.toggle,shortcut:"Mod-Alt-Shift-e",isActive:c=>Tn(c.view.state),isEnabled:()=>!e.force,onAction:c=>Is(c,!Tn(c.view.state))}),n.ui.registry.addMenuButton("reviewsuggestions",{icon:Yb,tooltip:t.review,isEnabled:a,items:()=>[{id:"next",label:t.next,onSelect:()=>l(1)},{id:"previous",label:t.previous,onSelect:()=>l(-1)},...r?[{type:"separator"},{id:"accept-all",label:t.acceptAll,onSelect:()=>o(Ps(n.view.state,"accept"))},{id:"reject-all",label:t.rejectAll,onSelect:()=>o(Ps(n.view.state,"reject"))}]:[]]}),r&&(n.ui.registry.addButton("acceptsuggestion",{icon:Qb,text:t.accept,tooltip:t.accept,onAction:()=>s("accept")}),n.ui.registry.addButton("rejectsuggestion",{icon:Zb,text:t.reject,tooltip:t.reject,onAction:()=>s("reject")}),n.ui.registry.addContextToolbar("suggestion",{label:t.toolbar,predicate:c=>qu(c.view.state)!==null,items:"acceptsuggestion rejectsuggestion",position:"selection",placement:"bottom-start",priority:20})),n.ui.registry.addMenuItem("suggestions",{text:t.toggle,icon:Fu,isActive:c=>Tn(c.view.state),isEnabled:()=>!e.force,onAction:c=>Is(c,!Tn(c.view.state))})}};j();xo();K();et();At();Z();ke();var sv=/^https?:\/\/(?:www\.|m\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch\?(?:[^#]*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{11})(?:[?&#]|$)/i,lv=/^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{1,12})(?:[/?#]|$)/i,av=/^https:\/\/[^\s"'<>]+\.(?:mp4|webm|ogv|ogg)(?:\?[^\s"'<>#]*)?$/i;function Io(n){let e=n.trim(),t=e.match(sv);if(t)return{kind:"youtube",src:`https://www.youtube-nocookie.com/embed/${t[1]}`};let r=e.match(lv);return r?{kind:"vimeo",src:`https://player.vimeo.com/video/${r[1]}`}:av.test(e)?{kind:"video",src:e}:null}var Pd=M.media,cv={en:{title:"Video",url:"Video URL",hint:"YouTube, Vimeo or a link to an .mp4 / .webm file",name:"Title (for screen readers)",invalid:"This video address is not supported",save:"Insert"},ru:{title:"\u0412\u0438\u0434\u0435\u043E",url:"\u0410\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E",hint:"YouTube, Vimeo \u0438\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B .mp4 / .webm",name:"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u0434\u043B\u044F \u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u0438\u043A\u0442\u043E\u0440\u0430)",invalid:"\u042D\u0442\u043E\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",save:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C"}};function Id(n,e){let t=e?Io(e):null;return t?{...t,width:Ie(n.getAttribute("width"))??560,height:Ie(n.getAttribute("height"))??315,title:n.getAttribute("title")??""}:!1}function uv(n){let e=Io(n.attrs.src);if(!e)return null;let t=String(Ie(n.attrs.width)??560),r=String(Ie(n.attrs.height)??315);return e.kind==="video"?v("video",{src:e.src,controls:!0,width:t,height:r,preload:"metadata"}):v("iframe",{src:e.src,width:t,height:r,title:n.attrs.title||"Video",allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:!0,loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"})}var Bd={name:"media",toolbar:"media",nodes:{media:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{kind:{default:"youtube"},src:{},width:{default:560},height:{default:315},title:{default:""}},parseDOM:[{tag:"iframe[src]",getAttrs:n=>Id(n,n.getAttribute("src"))},{tag:"video",getAttrs:n=>{let e=n,t=e.getAttribute("src")??e.querySelector("source[src]")?.getAttribute("src")??null;return Id(e,t)}}],toDOM:n=>{let e=Io(n.attrs.src),t=String(Ie(n.attrs.width)??560),r=String(Ie(n.attrs.height)??315);return e?e.kind==="video"?["video",{src:e.src,controls:"",width:t,height:r}]:["iframe",{src:e.src,width:t,height:r,title:n.attrs.title||null,allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:"",loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"}]:["p"]}}},prosemirrorPlugins:()=>[new _({props:{nodeViews:{media:n=>{let e=uv(n);return{dom:v("div",{className:"nova-media",contenteditable:"false"},e,v("div",{className:"nova-media-overlay","aria-hidden":"true"})),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}})],setup(n){let e=V(n,cv),t=()=>{let{selection:o}=n.view.state;return o instanceof B&&o.node.type.name==="media"?o:null},r=()=>{let o=t(),i=ce({label:e.url,type:"url",placeholder:"https://",hint:e.hint,value:o?.node.attrs.src??""}),s=ce({label:e.name,value:o?.node.attrs.title??""});Nn(n,i,"media",l=>{l.title&&(s.input.value=l.title)}),n.ui.openDialog({title:e.title,body:v("div",{className:"nova-form"},i.el,s.el),submitLabel:e.save,onSubmit:()=>{let l=Io(i.input.value);if(!l)return e.invalid;let{state:a,dispatch:c}=n.view,u={...l,title:s.input.value.trim()},d=t();return c(d?a.tr.setNodeMarkup(d.from,void 0,{...d.node.attrs,...u}):a.tr.replaceSelectionWith(n.schema.nodes.media.create(u)).scrollIntoView()),!0}})};n.ui.registry.addToggleButton("media",{icon:Pd,tooltip:e.title,isActive:()=>t()!==null,isEnabled:o=>o.isEditable(),onAction:r}),n.ui.registry.addMenuItem("media",{text:e.title,icon:Pd,onAction:r})}};j();ke();var Hd=M.pageBreak,dv={en:{title:"Page break"},ru:{title:"\u0420\u0430\u0437\u0440\u044B\u0432 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B"}},zd={name:"pagebreak",toolbar:"pagebreak",nodes:{pagebreak:{group:"block",atom:!0,selectable:!0,parseDOM:[{tag:"div.nova-pagebreak"},{tag:"div",getAttrs:n=>{let e=n;return(e.style.breakAfter==="page"||e.style.pageBreakAfter==="always")&&!e.textContent?.trim()?null:!1}}],toDOM:()=>["div",{class:"nova-pagebreak",style:"break-after: page;"}]}},setup(n){let{title:e}=V(n,dv),t=()=>{let{state:r,dispatch:o}=n.view,i=n.schema.nodes.pagebreak;o(r.tr.replaceSelectionWith(i.create()).scrollIntoView()),n.focus()};n.ui.registry.addButton("pagebreak",{icon:Hd,tooltip:e,isEnabled:r=>r.isEditable(),onAction:t}),n.ui.registry.addMenuItem("pagebreak",{text:e,icon:Hd,onAction:t})}};se("insertdatetime",()=>Promise.resolve().then(()=>(qd(),Vd)));se("quickbars",()=>Promise.resolve().then(()=>(Hf(),Bf)));se("charmap",()=>Promise.resolve().then(()=>($f(),Ff)));se("emoticons",()=>Promise.resolve().then(()=>(Wf(),qf)));se("nonbreaking",()=>Promise.resolve().then(()=>(Jf(),Kf)));se("autolink",()=>Promise.resolve().then(()=>(tp(),ep)));se("autosave",()=>Promise.resolve().then(()=>(op(),rp)));se("autoresize",()=>Promise.resolve().then(()=>(sp(),ip)));se("visualblocks",()=>Promise.resolve().then(()=>(cp(),ap)));se("anchor",rc);se("pagebreak",zd);se("media",Bd);se("comments",Ou);se("mentions",Mu);se("mergetags",Hu);se("suggestions",Uu);se("directionality",()=>Promise.resolve().then(()=>(pp(),fp)));se("advlist",()=>Promise.resolve().then(()=>(mp(),hp)));se("revisionhistory",()=>Promise.resolve().then(()=>(om(),rm)));Vl();Il();Hr();j();ai();var Tk=new Set(["lists","link","image","table","code","codesample","preview","searchreplace","fullscreen","help","wordcount","paste","hr","print","textcolor","colorpicker","contextmenu","tabfocus","textpattern","imagetools","powerpaste","importcss","accordion"]),Nk={tinycomments:"comments"},Lk=new Set(["selector","target","license_key","api_key","branding","promotion","skin","skin_url","content_css","icons","icons_url","theme","theme_url","base_url","suffix","referrer_policy","convert_urls","relative_urls","remove_script_host","document_base_url","entity_encoding","height","min_height","max_height","width","resize","content_style","setup","init_instance_callback","inline","plugins","toolbar","menubar","statusbar","placeholder","readonly","disabled","block_formats","file_picker_callback","formats","style_formats","style_formats_merge","valid_classes","table_class_list","table_cell_class_list","file_picker_types","language","images_upload_handler","paste_as_text","paste_preprocess","paste_postprocess","invalid_elements","valid_elements","valid_styles","toolbar_mode","toolbar_sticky","font_family_formats","font_size_formats","line_height_formats","color_map","autosave_interval","autosave_retention","autosave_prefix","quickbars_selection_toolbar","quickbars_insert_toolbar","mentions_fetch","tinycomments_author","tinycomments_author_name"]),ki=n=>(Array.isArray(n)?n.join(" "):String(n??"")).split(/[\s,]+/).filter(Boolean);function wi(n){if(typeof n=="string")return n.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,r]=e.includes("=")?e.split("="):[e,e];return{label:t.trim(),value:(r??t).trim()}})}function Ok(n){let e="",t=new Promise(o=>{let i=new FileReader;i.onload=()=>{e=String(i.result).replace(/^data:[^,]*,/,""),o()},i.onerror=()=>o(),i.readAsDataURL(n)}),r="";return{ready:t,info:{id:()=>n.name.replace(/\.[^.]+$/,"")||"image",name:()=>n.name.replace(/\.[^.]+$/,"")||"image",filename:()=>n.name||"image",blob:()=>n,base64:()=>e,blobUri:()=>r||=URL.createObjectURL(n),uri:()=>{}}}}var Dk=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre"]),Rk=new Set(["span","strong","b","em","i","u","s","strike","del","code","sub","sup"]);function xi(n){let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(!r||typeof r!="object")continue;let o=r,i={};typeof o.block=="string"&&Dk.has(o.block.toLowerCase())&&(i.block=o.block.toLowerCase()),typeof o.inline=="string"&&Rk.has(o.inline.toLowerCase())&&(i.inline=o.inline.toLowerCase()),typeof o.selector=="string"&&(i.selector=o.selector),(typeof o.classes=="string"||Array.isArray(o.classes))&&(i.classes=o.classes),o.styles&&typeof o.styles=="object"&&(i.styles=Object.fromEntries(Object.entries(o.styles).filter(([,s])=>typeof s=="string"&&!s.includes("%")).map(([s,l])=>[s.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`),l]))),(i.block||i.inline||i.selector)&&t.push(i)}return t}function im(n){return Array.isArray(n)?n.flatMap(e=>{if(!e||typeof e!="object")return[];let t=e,r=String(t.title??"");if(!r)return[];if(Array.isArray(t.items))return[{title:r,items:im(t.items)}];if(typeof t.format=="string")return[{title:r,format:t.format}];let[o]=xi(t);return o?[{title:r,...o}]:[]}):[]}function sm(n){let e=Object.keys(n).filter(p=>!Lk.has(p)),t=[],r=[];for(let p of ki(n.plugins)){let h=Nk[p]??p;Tk.has(p)||(Ti(h)?t.push(h):r.push(p))}let o={plugins:t};n.toolbar===!1?o.toolbar=!1:Array.isArray(n.toolbar)?o.toolbar=n.toolbar.join(" | "):typeof n.toolbar=="string"&&(o.toolbar=n.toolbar),n.menubar!==void 0&&(o.menubar=n.menubar),typeof n.statusbar=="boolean"&&(o.statusbar=n.statusbar),typeof n.placeholder=="string"&&(o.placeholder=n.placeholder),n.readonly===!0&&(o.editable=!1),typeof n.content_style=="string"&&(o.contentStyle=n.content_style);let i=p=>Array.isArray(p)?p.filter(h=>!!h&&typeof h.title=="string"&&typeof h.value=="string").map(({title:h,value:m})=>({title:h,value:m})):void 0,s=i(n.table_class_list);s&&(o.tableClassList=s);let l=i(n.table_cell_class_list);if(l&&(o.tableCellClassList=l),n.formats&&typeof n.formats=="object"&&(o.formats=Object.fromEntries(Object.entries(n.formats).map(([p,h])=>[p,xi(h)]).filter(([,p])=>p.length))),Array.isArray(n.style_formats)&&(o.styleFormats=im(n.style_formats),n.style_formats_merge===!0&&(o.styleFormatsMerge=!0)),typeof n.valid_classes=="string"?o.validClasses=ki(n.valid_classes):n.valid_classes&&typeof n.valid_classes=="object"?o.validClasses=Object.values(n.valid_classes).flatMap(p=>ki(p)):o.validClasses=!0,n.content_css!==void 0&&n.content_css!==!1){let p=new Set(["default","dark","document","writer","tinymce-5","tinymce-5-dark"]),h=(Array.isArray(n.content_css)?n.content_css:String(n.content_css).split(",")).map(m=>String(m).trim()).filter(m=>m&&!p.has(m));h.length&&(o.contentCss=h)}n.disabled===!0&&(o.disabled=!0),n.resize!==!1&&(o.resize=n.resize==="both"?"both":!0);let a=wi(n.block_formats);if(a){let p=["p","h1","h2","h3","h4","h5","h6","pre"];o.blockFormats=a.map(({label:h,value:m})=>({label:h,block:m.toLowerCase()})).filter(h=>p.includes(h.block))}if(typeof n.language=="string"&&(o.language=n.language.replace("_","-")),n.toolbar_mode==="sliding"||n.toolbar_mode==="wrap"?o.toolbarMode=n.toolbar_mode:(n.toolbar_mode==="floating"||n.toolbar_mode==="scrolling")&&(o.toolbarMode="sliding"),n.inline===!0&&(o.mode="inline"),n.paste_as_text===!0&&(o.pasteAsText=!0),typeof n.paste_preprocess=="function"){let p=n.paste_preprocess;o.pastePreprocess=(h,m)=>{let g={content:h};return p(m,g),g.content}}typeof n.invalid_elements=="string"&&(o.invalidElements=n.invalid_elements),typeof n.valid_elements=="string"&&(o.validElements=n.valid_elements),n.valid_styles&&(o.validStyles=n.valid_styles);let c=wi(n.font_family_formats);c&&(o.fontFamilies=c);let u=wi(n.font_size_formats);u&&(o.fontSizes=u.map(p=>p.value));let d=wi(n.line_height_formats);if(d&&(o.lineHeights=d.map(p=>p.value)),Array.isArray(n.color_map)&&(o.colors=n.color_map.filter((p,h)=>h%2===0).map(p=>p.startsWith("#")?p:`#${p}`)),typeof n.images_upload_handler=="function"){let p=n.images_upload_handler,h=async(m,g)=>{let{ready:b,info:x}=Ok(m);return await b,p(x,g)};o.uploadImage=h}if(typeof n.file_picker_callback=="function"){let p=n.file_picker_callback;typeof n.file_picker_types=="string"&&(o.filePickerTypes=ki(n.file_picker_types).filter(h=>h==="file"||h==="image"||h==="media")),o.filePicker=({type:h,value:m})=>new Promise(g=>p((b,x={})=>g({url:b,...x}),m,{filetype:h,fieldname:"src"}))}let f={};if(n.autosave_interval||n.autosave_retention||n.autosave_prefix){let p=h=>parseInt(String(h),10);f.autosave={...n.autosave_interval?{delay:p(n.autosave_interval)*1e3}:{},...n.autosave_retention?{retention:p(n.autosave_retention)}:{},...n.autosave_prefix?{key:String(n.autosave_prefix)}:{}}}if((n.quickbars_selection_toolbar!==void 0||n.quickbars_insert_toolbar!==void 0)&&(f.quickbars={...n.quickbars_selection_toolbar!==void 0?{selection:n.quickbars_selection_toolbar}:{},...n.quickbars_insert_toolbar!==void 0?{insert:n.quickbars_insert_toolbar}:{}}),typeof n.mentions_fetch=="function"){let p=n.mentions_fetch;f.mentions={fetch:h=>new Promise(m=>p({term:h},m))}}return n.tinycomments_author&&(f.comments={author:{id:String(n.tinycomments_author),name:String(n.tinycomments_author_name??n.tinycomments_author)}}),Object.keys(f).length&&(o.pluginOptions=f),{options:o,unknown:e,missingPlugins:r}}var Pk=0,lm=()=>`nova-compat-field-${++Pk}`;function ae(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!==void 0&&(r.textContent=t),r}function Ik(n){let e=document.createElement("template");return e.innerHTML=n,e.content.querySelectorAll("script, style, iframe, object, embed, link, meta, base, form").forEach(t=>t.remove()),e.content.querySelectorAll("*").forEach(t=>{for(let r of[...t.attributes]){let o=r.value.trim().toLowerCase();(r.name.startsWith("on")||/^(javascript|vbscript|data):/.test(o))&&t.removeAttribute(r.name)}}),e.content}function am(n,e,t){let r=new Map,o=new Map,i="",s=!1,l=null,a=g=>e.onChange?.(m,{name:g});function c(g,b){let x=lm();b.id=x;let w=ae("div","nova-field");if(g.label){let E=ae("label","nova-label",g.label);E.htmlFor=x,w.append(E)}return w.append(b),w}function u(g){let b=g.name??"",x=g.enabled!==!1&&g.disabled!==!0;switch(g.type){case"input":case"urlinput":case"colorinput":{let w=ae("input","nova-input");return w.type=g.type==="colorinput"?"color":g.type==="urlinput"?"url":"text",g.inputMode&&(w.inputMode=g.inputMode),g.placeholder&&(w.placeholder=g.placeholder),w.disabled=!x,w.addEventListener("input",()=>a(b)),b&&r.set(b,{get:()=>g.type==="urlinput"?{value:w.value}:w.value,set:E=>{w.value=String(g.type==="urlinput"&&E&&typeof E=="object"?E.value??"":E??"")},focus:()=>w.focus(),setEnabled:E=>w.disabled=!E}),c(g,w)}case"textarea":{let w=ae("textarea","nova-input");return w.rows=g.maximized?10:4,g.placeholder&&(w.placeholder=g.placeholder),w.disabled=!x,w.addEventListener("input",()=>a(b)),b&&r.set(b,{get:()=>w.value,set:E=>w.value=String(E??""),focus:()=>w.focus(),setEnabled:E=>w.disabled=!E}),c(g,w)}case"checkbox":{let w=ae("input","nova-checkbox");w.type="checkbox",w.id=lm(),w.disabled=!x,w.addEventListener("change",()=>a(b));let E=ae("label",void 0,g.label??"");E.htmlFor=w.id,b&&r.set(b,{get:()=>w.checked,set:C=>w.checked=!!C,focus:()=>w.focus(),setEnabled:C=>w.disabled=!C});let D=ae("div","nova-field nova-field-inline");return D.append(w,E),D}case"selectbox":case"listbox":{let w=ae("select","nova-input nova-select");for(let E of g.items??[]){let D=ae("option",void 0,E.text);D.value=E.value,w.append(D)}return w.disabled=!x,w.addEventListener("change",()=>a(b)),b&&r.set(b,{get:()=>w.value,set:E=>w.value=String(E??""),focus:()=>w.focus(),setEnabled:E=>w.disabled=!E}),c(g,w)}case"button":{let w=ae("button",g.primary||g.buttonType==="primary"?"nova-button nova-button-primary":"nova-button",g.text??"");return w.type="button",w.disabled=!x,w.addEventListener("click",()=>e.onAction?.(m,{name:b})),b&&r.set(b,{get:()=>{},set:()=>{},focus:()=>w.focus(),setEnabled:E=>w.disabled=!E}),w}case"htmlpanel":{let w=ae("div","nova-compat-html");return w.append(Ik(g.html??"")),w}case"alertbanner":{let w=ae("p",`nova-compat-alert is-${g.level??"info"}`,g.text??"");return w.setAttribute("role",g.level==="error"?"alert":"status"),w}case"label":{let w=ae("div","nova-compat-group");w.append(ae("p","nova-label",g.label??""));for(let E of g.items??[]){let D=u(E);D&&w.append(D)}return w}case"grid":case"bar":{let w=ae("div","nova-compat-grid"),E=g.type==="bar"?g.items?.length??1:g.columns==="auto"?2:g.columns??2;w.style.gridTemplateColumns=`repeat(${Number(E)||2}, minmax(0, 1fr))`;for(let D of g.items??[]){let C=u(D);C&&w.append(C)}return w}default:return console.warn(`[nova] tinymce-compat: dialog component "${g.type}" is not supported yet`),null}}let d=ae("div","nova-compat-dialog nova-form");if(e.body.type==="tabpanel"){let g=ae("div","nova-compat-tabs");g.setAttribute("role","tablist"),d.append(g),e.body.tabs.forEach((b,x)=>{let w=b.name??b.title,E=ae("button","nova-compat-tab",b.title);E.type="button",E.setAttribute("role","tab");let D=ae("div","nova-compat-tabpanel");D.setAttribute("role","tabpanel");for(let C of b.items){let N=u(C);N&&D.append(N)}E.addEventListener("click",()=>m.showTab(w)),o.set(w,{button:E,panel:D}),g.append(E),d.append(D),x===0&&(i=w)})}else for(let g of e.body.items){let b=u(g);b&&d.append(b)}let f=e.buttons??[],p=f.find(g=>g.type==="submit"),h=f.filter(g=>g.type==="custom");if(h.length){let g=ae("div","nova-compat-actions");for(let b of h){let x=ae("button",b.primary?"nova-button nova-button-primary":"nova-button",b.text);x.type="button",x.disabled=b.enabled===!1,x.addEventListener("click",()=>e.onAction?.(m,{name:b.name??b.text})),b.name&&r.set(b.name,{get:()=>{},set:()=>{},focus:()=>x.focus(),setEnabled:w=>x.disabled=!w}),g.append(x)}d.append(g)}let m={getData:()=>{let g={};return r.forEach((b,x)=>{let w=b.get();w!==void 0&&(g[x]=w)}),g},setData:g=>{for(let[b,x]of Object.entries(g))r.get(b)?.set(x)},close:()=>{s=!0,l?.close()},block:()=>l?.setBusy(!0),unblock:()=>l?.setBusy(!1),focus:g=>r.get(g)?.focus(),disable:g=>r.get(g)?.setEnabled(!1),enable:g=>r.get(g)?.setEnabled(!0),showTab:g=>{if(!o.has(g))return;let b=i;i=g,o.forEach(({button:x,panel:w},E)=>{let D=E===g;x.setAttribute("aria-selected",String(D)),x.tabIndex=D?0:-1,w.hidden=!D}),b&&b!==g&&e.onTabChange?.(m,{newTabName:g,oldTabName:b})},redial:g=>{m.close(),Object.assign(m,t(g))}};return e.initialData&&m.setData(e.initialData),i&&m.showTab(i),l=n.ui.openDialog({title:e.title,body:d,...p?{submitLabel:p.text}:{},...e.size==="large"?{size:"large"}:{},onSubmit:()=>(e.onSubmit?.(m),s),onClose:()=>{s||e.onCancel?.(m),e.onClose?.()}}),m}K();var Bk=new yt,Si={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",superscript:"superscript",subscript:"subscript",justifyleft:"alignLeft",justifycenter:"alignCenter",justifyright:"alignRight",justifyfull:"alignJustify",insertunorderedlist:"bulletList",insertorderedlist:"orderedList",indent:"indent",outdent:"outdent",undo:"undo",redo:"redo",removeformat:"clearFormatting",unlink:"unlink",inserthorizontalrule:"horizontalRule",mceblockquote:"blockquote"},Hk={p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock"},zk={bold:"bold",italic:"italic",underline:"underline","strike-through":"strike",link:"link",unlink:"unlink",image:"image",table:"table",undo:"undo",redo:"redo","align-left":"alignLeft","align-center":"alignCenter","align-right":"alignRight","align-justify":"alignJustify","unordered-list":"bulletList","ordered-list":"orderedList",indent:"indent",outdent:"outdent",quote:"blockquote","code-sample":"codeBlock","horizontal-rule":"horizontalRule","remove-formatting":"clearFormatting",fullscreen:"fullscreen",preview:"preview",sourcecode:"sourceCode",help:"help",print:"print",search:"search",copy:"copy","edit-block":"edit",checkmark:"check",close:"close",upload:"upload",subscript:"subscript",superscript:"superscript","paste-text":"pasteText","text-color":"textColor","highlight-bg-color":"highlight","line-height":"lineHeight"},ql={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",superscript:"superscript",subscript:"subscript",code:"code",p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock",alignleft:"alignLeft",aligncenter:"alignCenter",alignright:"alignRight",alignjustify:"alignJustify"},Fk=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre"]),$k=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre","alignleft","aligncenter","alignright","alignjustify"]),Wl={forecolor:"color",hilitecolor:"background",fontname:"font_family",fontsize:"font_size"};function Pr(n){console.warn(`[nova] tinymce-compat: editor.dom.${n} changes the editor DOM directly, which NovaProse redraws from its document model. Use setContent, insertContent or editor.formatter instead.`)}var Mi=new Map;function Ul(n){if(typeof n!="string"||!n)return;if(Mi.has(n))return Mi.get(n);let e=zk[n]??(n in M?n:void 0);return e?M[e]:void 0}function _k(n){let e=!1,t=!0;return{state:{get active(){return e},get enabled(){return t}},api:{isActive:()=>e,setActive:r=>{e=r,n.core.updateUI()},isEnabled:()=>t,setEnabled:r=>{t=r,n.core.updateUI()},isDisabled:()=>!t,setDisabled:r=>{t=!r,n.core.updateUI()}}}}var Ir=class{id;core;targetElm;settings;initialized=!1;removed=!1;handlers=new Map;dirty=!1;teardowns=[];constructor(e,t,r,o){this.core=e,this.targetElm=t,this.id=r,this.settings=o}getContent(e={}){let t={format:e.format??"html",content:""};return t.content=t.format==="text"?this.core.getText():this.core.getHTML(),this.fire("GetContent",t),t.content}setContent(e,t={}){let r={content:e,...t};return this.fire("BeforeSetContent",r),this.core.setContent(r.content),this.fire("SetContent",r),r.content}insertContent(e){this.core.insertContent(e)}resetContent(e){this.core.setContent(e??this.settings.__initialContent??"",{addToHistory:!1}),this.setDirty(!1)}getBody(){return this.core.view.dom}getElement(){return this.targetElm}getContainer(){return this.core.root}getContentAreaContainer(){return this.core.view.dom.parentElement??this.core.root}getDoc(){return this.core.root.ownerDocument}getWin(){return this.core.root.ownerDocument.defaultView}execCommand(e,t,r){let o=e.toLowerCase(),i=!1;if(Si[o])i=this.core.exec(Si[o]);else if(o==="formatblock"||o==="mcetoggleformat"){let s=Hk[String(r??"").toLowerCase()];i=s?this.core.exec(s):!1}else if(o==="mceinsertcontent"||o==="inserthtml")this.insertContent(String(r??"")),i=!0;else if(o==="mcesetcontent")this.setContent(String(r??"")),i=!0;else if(o==="selectall"){let{state:s,dispatch:l}=this.core.view;l(s.tr.setSelection(new me(s.doc))),i=!0}else if(o==="mcecleanup")i=!0;else{let s=this.commands.get(o);s&&(s(t,r),i=!0)}return i&&this.fire("ExecCommand",{command:e,ui:t,value:r}),i}queryCommandState(e){let t=Si[e.toLowerCase()];return t?this.core.isActive(t):!1}queryCommandSupported(e){let t=e.toLowerCase();return t in Si||["formatblock","mceinsertcontent","mcesetcontent"].includes(t)||this.commands.has(t)}commands=new Map;addCommand(e,t){this.commands.set(e.toLowerCase(),t)}on(e,t,r=!1){for(let o of e.toLowerCase().split(/\s+/).filter(Boolean)){let i=this.handlers.get(o)??new Set;r?this.handlers.set(o,new Set([t,...i])):this.handlers.set(o,i.add(t))}return this}off(e,t){if(!e)return this.handlers.clear(),this;for(let r of e.toLowerCase().split(/\s+/).filter(Boolean))t?this.handlers.get(r)?.delete(t):this.handlers.delete(r);return this}once(e,t){let r=o=>(this.off(e,r),t(o));return this.on(e,r)}fire(e,t={}){let r=Object.assign(t,{type:e.toLowerCase(),target:this});for(let o of[...this.handlers.get(e.toLowerCase())??[]])try{o(r)}catch(i){console.error(`[nova] tinymce-compat: "${e}" handler failed`,i)}return r}fireNative(e,t){for(let r of[...this.handlers.get(e)??[]])try{r(t)}catch(o){console.error(`[nova] tinymce-compat: "${e}" handler failed`,o)}}static registerIcon(e,t){Mi.set(e,t)}dispatch(e,t){return this.fire(e,t)}hasEventListeners(e){return(this.handlers.get(e.toLowerCase())?.size??0)>0}isDirty(){return this.dirty}setDirty(e){let t=this.dirty!==e;this.dirty=e,t&&e&&this.fire("Dirty")}save(){let e=this.getContent(),t=this.fire("SaveContent",{content:e});return this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.value=String(t.content)),this.setDirty(!1),String(t.content)}focus(){this.core.focus()}hasFocus(){return this.core.view.hasFocus()}hide(){this.core.root.hidden=!0,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!1)}show(){this.core.root.hidden=!1,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!0)}isHidden(){return this.core.root.hidden===!0}getParam(e,t){return e in this.settings?this.settings[e]:t}options={get:e=>this.settings[e],set:(e,t)=>(this.settings[e]=t,e==="disabled"&&this.core.setDisabled(t===!0),!0),isSet:e=>e in this.settings,isRegistered:()=>!0,register:()=>{}};mode={get:()=>this.core.isEditable()?"design":"readonly",set:e=>this.core.setEditable(e!=="readonly"),isReadOnly:()=>!this.core.isEditable()};undoManager={undo:()=>this.core.exec("undo"),redo:()=>this.core.exec("redo"),hasUndo:()=>this.core.can("undo"),hasRedo:()=>this.core.can("redo"),add:()=>null,clear:()=>{},transact:e=>(e(),null),ignore:e=>e()};selection={getContent:(e={})=>{let{state:t}=this.core.view,{from:r,to:o}=t.selection;return e.format==="text"?t.doc.textBetween(r,o,`
|
|
40
|
-
`):Bk.serializeFragment(t.selection.content().content)},setContent:e=>this.insertContent(e),getNode:()=>{let{from:e}=this.core.view.state.selection,{node:t}=this.core.view.domAtPos(e);return t instanceof Element?t:t.parentElement},getStart:()=>this.selection.getNode(),getEnd:()=>this.selection.getNode(),isCollapsed:()=>this.core.view.state.selection.empty,collapse:(e=!1)=>{let{state:t,dispatch:r}=this.core.view,o=e?t.selection.from:t.selection.to;r(t.tr.setSelection(H.near(t.doc.resolve(o))))},setCursorLocation:(e,t=0)=>{let{view:r}=this.core;if(!e||!r.dom.contains(e))return;let o=r.posAtDOM(e,t);r.dispatch(r.state.tr.setSelection(H.near(r.state.doc.resolve(o))))},select:(e,t=!1)=>{let{view:r}=this.core;if(!r.dom.contains(e))return;let o=r.posAtDOM(e,0),i=r.posAtDOM(e,e.childNodes.length),{doc:s}=r.state,l=!t&&e instanceof HTMLImageElement?B.create(s,Math.max(0,o-(s.resolve(o).nodeAfter?0:1))):H.between(s.resolve(o),s.resolve(i));r.dispatch(r.state.tr.setSelection(l))}};notificationManager={open:e=>this.core.ui.notify({text:e.text,...e.type?{type:e.type}:{},...e.timeout!==void 0?{timeout:e.timeout}:{}}),close:()=>{}};windowManager={alert:(e,t)=>{let r=document.createElement("p");r.textContent=e,this.core.ui.openDialog({title:"",body:r,onSubmit:()=>!0,...t?{onClose:t}:{}})},confirm:(e,t)=>{let r=document.createElement("p");r.textContent=e;let o=!1;this.core.ui.openDialog({title:"",body:r,submitLabel:"OK",onSubmit:()=>(o=!0,!0),onClose:()=>t?.(o)})},open:e=>am(this.core,e,t=>this.windowManager.open(t))};ui={registry:{addIcon:(e,t)=>{Mi.set(e,t)},addButton:(e,t)=>this.addButton(e,t,!1),addToggleButton:(e,t)=>this.addButton(e,t,!0),addMenuButton:(e,t)=>{let r=[];t.fetch(i=>r=i);let o=Ul(t.icon);this.core.ui.registry.addMenuButton(e,{tooltip:t.tooltip??t.text??e,...o?{icon:o}:{text:t.text??e},items:()=>(t.fetch(i=>r=i),r.map((i,s)=>i.type==="separator"?{type:"separator"}:{id:`${e}-${s}`,label:i.text??"",onSelect:()=>i.onAction?.({})}))})},addMenuItem:(e,t)=>{let r=Ul(t.icon);this.core.ui.registry.addMenuItem(e,{text:t.text??e,...r?{icon:r}:{},onAction:()=>t.onAction?.({})})},addContextToolbar:(e,t)=>{this.core.ui.registry.addContextToolbar(e,{label:t.label??e,items:t.items,position:t.position==="node"?"node":"selection",predicate:()=>{let r=this.selection.getNode();return!!r&&this.getBody().contains(r)&&t.predicate(r)}})},addContextForm:()=>{console.warn("[nova] tinymce-compat: addContextForm is not supported yet")},getAll:()=>({})}};addButton(e,t,r){let{api:o,state:i}=_k(this);t.enabled===!1&&o.setEnabled(!1),t.active&&o.setActive(!0);let s=Ul(t.icon);if(this.core.ui.registry.addButton(e,{tooltip:t.tooltip??t.text??e,...s?{icon:s}:{text:t.text??e},isEnabled:()=>i.enabled,...r?{isActive:()=>i.active}:{},onAction:()=>t.onAction?.(o)}),t.onSetup){let l=()=>{let a=t.onSetup(o);typeof a=="function"&&this.teardowns.push(a)};this.initialized?l():this.once("init",l)}}dom={select:(e,t)=>[...(t??this.getBody()).querySelectorAll(e)],get:e=>typeof e=="string"?this.getBody().querySelector(`#${CSS.escape(e)}`):e,getParent:(e,t)=>{let r=e instanceof Element?e:e?.parentElement??null;for(;r&&r!==this.getBody();){if(typeof t=="string"?r.matches(t):t(r))return r;r=r.parentElement}return null},getParents:(e,t)=>{let r=[],o=e instanceof Element?e:e?.parentElement??null;for(;o&&o!==this.getBody();)(!t||o.matches(t))&&r.push(o),o=o.parentElement;return r},is:(e,t)=>!!e?.matches(t),getAttrib:(e,t,r="")=>e?.getAttribute(t)??r,hasClass:(e,t)=>!!e?.classList.contains(t),getStyle:(e,t)=>e instanceof HTMLElement?e.style.getPropertyValue(t):"",getRoot:()=>this.getBody(),encode:e=>e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`),decode:e=>{let t=document.createElement("textarea");return t.innerHTML=e,t.value},create:(e,t={},r)=>{let o=document.createElement(e);for(let[i,s]of Object.entries(t))i.startsWith("on")||o.setAttribute(i,s);return r!==void 0&&(o.textContent=r),o},uniqueId:(e="mce_")=>`${e}${Math.random().toString(36).slice(2,10)}`,setAttrib:()=>Pr("setAttrib"),addClass:()=>Pr("addClass"),removeClass:()=>Pr("removeClass"),setStyle:()=>Pr("setStyle"),remove:()=>Pr("remove")};formatter={apply:(e,t={})=>this.applyFormat(e,t,"apply"),remove:e=>this.applyFormat(e,{},"remove"),toggle:(e,t={})=>this.applyFormat(e,t,this.formatter.match(e)?"remove":"apply"),match:e=>{if(this.core.formatter.has(e))return this.core.formatter.match(e);let t=e.toLowerCase();if(Fk.has(t))return this.blockMatches(t);let r=ql[t];if(r)return this.core.isActive(r);let o=Wl[t];if(!o)return!1;let{state:i}=this.core.view,{from:s,to:l,empty:a}=i.selection,c=i.schema.marks[o];return a||!c?st(i,o)!==null:i.doc.rangeHasMark(s,l,c)},canApply:e=>this.core.formatter.has(e)||e.toLowerCase()in ql||e.toLowerCase()in Wl,register:(e,t)=>{let r=typeof e=="string"?[[e,t]]:Object.entries(e);for(let[o,i]of r){let s=xi(i);s.length?this.core.formatter.register(o,s):console.warn(`[nova] tinymce-compat: format "${o}" is not supported yet`)}},unregister:e=>this.core.formatter.unregister(e),get:e=>this.core.formatter.get(e)};blockMatches(e){let{$from:t}=this.core.view.state.selection;for(let o=t.depth;o>0;o-=1){let i=t.node(o),s=i.type.name;if(e==="blockquote"&&s==="blockquote")return!0;if(o===t.depth){if(e==="p")return s==="paragraph";if(e==="pre")return s==="code_block";if(/^h[1-6]$/.test(e))return s==="heading"&&i.attrs.level===Number(e[1])}}let r=null;if(this.core.view.state.doc.descendants(o=>r||!o.isTextblock?!r:(r={name:o.type.name,level:o.attrs.level},!1)),!t.depth&&r){let o=r;if(e==="p")return o.name==="paragraph";if(e==="pre")return o.name==="code_block";if(/^h[1-6]$/.test(e))return o.name==="heading"&&o.level===Number(e[1])}return!1}applyFormat(e,t,r){if(this.core.formatter.has(e)){r==="apply"?this.core.formatter.apply(e):this.core.formatter.remove(e);return}let o=e.toLowerCase(),i=ql[o];if(i){let l=this.formatter.match(o);$k.has(o)?r==="apply"?this.core.exec(i):l&&this.core.exec("paragraph"):r==="apply"!==l&&this.core.exec(i);return}let s=Wl[o];if(s){this.core.exec(vt(s,r==="apply"?t.value??null:null));return}console.warn(`[nova] tinymce-compat: format "${e}" is not supported yet`)}remove(){if(this.removed)return;this.fire("remove"),this.save(),this.teardowns.splice(0).forEach(t=>t()),this.removed=!0,this.core.destroy(),this.core.root.remove(),this.settings.__wrapper?.remove(),this.targetElm.hidden=!1,this.off()}destroy(){this.remove()}};var cm=new Set;function jl(n){cm.has(n)||(cm.add(n),console.warn(`[nova] tinymce-compat: ${n}`))}var Vk=0,Ci=n=>typeof n=="number"?`${n}px`:String(n);function qk(){let n=[],e=new Map,t=null;async function r(i,s){let l=n.find(C=>C.targetElm===i&&!C.removed);if(l)return l;let{options:a,unknown:c,missingPlugins:u}=sm(s);c.length&&jl(`options not supported yet: ${c.join(", ")}`);let d=String(Array.isArray(s.plugins)?s.plugins.join(" "):s.plugins??"").split(/[\s,]+/).filter(C=>e.has(C)),f=u.filter(C=>!e.has(C));f.length&&jl(`plugins not available: ${f.join(", ")}`);let p=i.id||`mce_${++Vk}`;i.id||(i.id=p);let h=i instanceof HTMLTextAreaElement,m=h?i.value:i.innerHTML,g={...s,__initialContent:m},b;s.inline===!0&&!h?(i.replaceChildren(),b=i):(b=document.createElement("div"),b.className="nova-compat",i.after(b),i.hidden=!0,g.__wrapper=b);let x,w=_l({...a,element:b,content:m,setup:C=>{x=new Ir(C,i,p,g);for(let N of d)try{e.get(N)(x,"")}catch(S){console.error(`[nova] tinymce-compat: plugin "${N}" failed`,S)}s.setup?.(x)}});s.height!==void 0&&(w.root.style.height=Ci(s.height)),s.min_height!==void 0&&(w.root.style.minHeight=Ci(s.min_height)),s.max_height!==void 0&&(w.root.style.maxHeight=Ci(s.max_height)),s.width!==void 0&&(w.root.style.width=Ci(s.width));let E=!1;w.on("change",()=>{x.setDirty(!0),E=!0,x.fire("input")}),w.on("selectionChange",()=>{x.fire("NodeChange",{element:x.selection.getNode(),selectionChange:!0})}),w.on("focus",()=>{t=x,E=!1,x.fire("focus")}),w.on("blur",()=>{E&&x.fire("change",{level:{content:x.getContent()}}),E=!1,x.fire("blur")});for(let C of["keydown","keyup","keypress","click","dblclick","mousedown","mouseup","paste","copy","cut","drop"])w.view.dom.addEventListener(C,N=>x.fireNative(C,N));return(h?i.form:i.closest("form"))?.addEventListener("submit",()=>x.save()),x.on("remove",()=>{let C=n.indexOf(x);C>=0&&n.splice(C,1),t===x&&(t=n[0]??null)}),n.push(x),t??=x,await w.ready,x.removed||(x.initialized=!0,x.fire("init"),s.init_instance_callback?.(x)),x}return{majorVersion:"7",minorVersion:"0.0",novaprose:!0,get activeEditor(){return t},get editors(){return[...n]},async init(i){document.readyState==="loading"&&await new Promise(a=>document.addEventListener("DOMContentLoaded",a,{once:!0}));let s=i.target?[i.target]:i.selector?[...document.querySelectorAll(i.selector)]:[];s.length||jl(`no elements match "${i.selector??""}"`);let l=[];for(let a of s)l.push(await r(a,i));return l},get:(i=>i===void 0?[...n]:typeof i=="number"?n[i]??null:n.find(s=>s.id===i)??null),remove(i){(i===void 0?[...n]:typeof i=="string"?n.filter(l=>l.id===i.replace(/^#/,"")||l.targetElm.matches(i)):[i]).forEach(l=>l.remove())},triggerSave(){n.forEach(i=>i.save())},execCommand(i,s,l){return t?.execCommand(i,s,l)??!1},PluginManager:{add:(i,s)=>{e.set(i,s)},get:i=>e.get(i),requireLangPack:()=>{},urls:{}},IconManager:{add:(i,s)=>{for(let[l,a]of Object.entries(s.icons??{}))Ir.registerIcon(l,a)}},util:{I18n:{translate:i=>i}}}}var um=qk();var dm=document.currentScript;if(dm?.src&&!document.querySelector("link[data-novaprose-css]")){let n=document.createElement("link");n.rel="stylesheet",n.href=dm.src.replace(/[^/]*$/,"novaprose.css"),n.setAttribute("data-novaprose-css",""),document.head.append(n)}window.tinymce=um;})();
|
|
41
|
-
//# sourceMappingURL=tinymce.global.js.map
|
|
46
|
+
`)}setContent(e,{addToHistory:t=!0,fullPage:r=!0}={}){let o={content:e};this.emit("beforeSetContent",o);let i=r?An.get(this):void 0,s=eu(this.schema,o.content,i),l=this.view.state.tr.replaceWith(0,this.view.state.doc.content.size,s.content);if(i&&(typeof o.content!="string"||Qg.has(s)))for(let[a,c]of Object.entries(s.attrs))c!==this.view.state.doc.attrs[a]&&l.setDocAttribute(a,c);l.setMeta(xs,!0).setMeta(ui,!0),t||l.setMeta("addToHistory",!1),this.view.dispatch(l),this.emit("setContent",{content:o.content})}insertContent(e){return this.isEditable()?Xg(e)(this.view.state,this.view.dispatch):!1}isEmpty(){return this.view.dom.classList.contains("nova-empty")}resolveCommand(e){e=lo("commands",e);let t=this.commandOverrides.get(e)??(Object.prototype.hasOwnProperty.call(Ke,e)?Ke[e]:void 0);return t||(Zg.has(e)||(Zg.add(e),console.warn(`[nova] unknown command "${String(e)}": editor.exec() returns false`)),()=>!1)}registerCommands(e){for(let[t,r]of Object.entries(e.commands??{}))r&&this.commandOverrides.set(t,r);e.transformTransaction&&this.transactionTransforms.push(e.transformTransaction)}exec(e){let r=(typeof e=="string"?this.resolveCommand(e):e)(this.view.state,this.view.dispatch,this.view);return r&&this.view.focus(),r}chain(){return Ng({view:()=>this.destroyed?null:this.view,resolve:e=>this.resolveCommand(e),insertContent:e=>(t,r,o)=>this.isEditable()&&Xg(e)(t,r,o)})}can(e){let t=typeof e=="string"?this.resolveCommand(e):e;try{return t(this.view.state,void 0,this.view)}catch{return!1}}isActive(e){return lr(this.view.state,lo("commands",e))}getCommandState(e){return{active:this.isActive(e),enabled:this.isEditable()&&this.can(e)}}focus(){this.destroyed||this.view.focus()}isPasteAsText(){return this.pasteAsText}setPasteAsText(e){this.pasteAsText=e,this.toolbar?.update()}loadSearchBar(){return this.searchBarLoad??(this.searchBarLoad=import(__novaChunk("tinymce-chunks/search-bar-3ea04183.js") ).then(({createSearchBar:e})=>this.destroyed?null:(this.searchBar=e(this,this.contentHost),this.searchBar),e=>(vt("The find and replace bar failed to load",e),null))),this.searchBarLoad}openSearch(){return this.loadSearchBar().then(e=>e?.open())}closeSearch(){this.searchBar?.close()}isEditable(){return this.editable&&!this.disabled}isDisabled(){return this.disabled}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.view.setProps({}),this.applyDisabled(),e&&(this.ui.closePopover(),this.view.dom.blur()),this.toolbar?.update(),this.emit("editableChange"))}applyDisabled(){this.root.classList.toggle("nova-disabled",this.disabled),this.disabled?this.root.setAttribute("aria-disabled","true"):this.root.removeAttribute("aria-disabled"),this.disabled?this.view.dom.setAttribute("tabindex","-1"):this.view.dom.removeAttribute("tabindex")}setEditable(e){this.editable!==e&&(this.editable=e,this.view.setProps({}),this.root.classList.toggle("nova-readonly",!e),e||this.ui.closePopover(),this.toolbar?.update(),this.emit("editableChange"))}on(e,t){e=lo("events",e);let r=this.listeners.get(e);return r||this.listeners.set(e,r=new Set),r.add(t),()=>this.off(e,t)}off(e,t){e=lo("events",e),this.listeners.get(e)?.delete(t)}emit(e,...[t]){for(let r of this.listeners.get(e)??[])try{r(this,t)}catch(o){vt(`Listener for "${e}" failed`,o)}}destroy(){if(!this.destroyed){this.emit("destroy"),this.destroyed=!0,this.menubar?.destroy(),this.ui.destroy(),this.toolbar?.destroy(),this.statusbar?.destroy();for(let e of this.cleanups.splice(0))try{e()}catch(t){vt("Plugin cleanup failed",t)}this.searchBar?.destroy(),this.root.classList.contains("nova-fullscreen")&&mr(this,!1),this.view.destroy(),this.root.remove(),this.listeners.clear()}}};function vt(n,e){console.error(`[nova] ${n}`,...e===void 0?[]:[e])}var Qg=new WeakSet;function eu(n,e,t){if(typeof e!="string")return Te.fromJSON(n,co(n,e));let r=t?t.read(e):null,o=document.createElement("div"),i=document.createElement("template");i.innerHTML=r?r.content:e,o.appendChild(i.content);let s=hr(n).parse(o);if(!r)return s;let l=s.type.create(r.attrs,s.content);return Qg.add(l),l}function ws(n){return new bo(n)}var ou={};j(ou,{prettyHTML:()=>Ss});var ey=new Set(["address","article","aside","blockquote","caption","col","colgroup","dd","details","div","dl","dt","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hr","li","main","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"]),Pw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Rw=/<!--[\s\S]*?-->|<\/?[a-zA-Z][^>]*>|[^<]+|</g;function ru(n){let e=/^<(\/?)([a-zA-Z][\w-]*)/.exec(n);return e?{name:e[2].toLowerCase(),closing:e[1]==="/"}:null}function Ss(n,e=" "){let t=n.match(Rw)??[],r="",o=0,i=[],s=()=>(r?`
|
|
47
|
+
`:"")+e.repeat(o);for(let l=0;l<t.length;l++){let a=t[l],c=ru(a);if(c&&!c.closing&&c.name==="pre"){let f=l,h=0;for(;f<t.length;f++){let m=ru(t[f]);if(m?.name==="pre"&&(h+=m.closing?-1:1),h===0)break}r+=s()+t.slice(l,f+1).join(""),l=f;continue}if(!c||!ey.has(c.name)){r+=a;continue}if(c.closing){i.pop()?.spread&&(o=Math.max(0,o-1),r+=s()),r+=a;continue}let d=i[i.length-1];if((!d||d.spread)&&(r+=s()),r+=a,Pw.has(c.name)||a.endsWith("/>"))continue;let u=ru(t[l+1]??""),p=!!u&&!u.closing&&ey.has(u.name);i.push({name:c.name,spread:p}),p&&o++}return r}var ty=new Set("script,style,iframe,frame,frameset,object,embed,applet,base,link,meta,title,head,html,body,template,slot,noscript,form,input,button,select,option,optgroup,textarea,fieldset,legend,datalist,output,progress,meter,svg,math,canvas,audio,video,source,track,picture,map,area,portal,dialog,param,xmp,plaintext,listing,noembed,noframes,image".split(",")),Dw=/^(on|xmlns)|^(srcdoc|formaction|action|contenteditable|autofocus|is|slot|nonce)$/,_w=/^[a-z_:][a-z0-9_.:-]*$/,ny=/^[a-z][a-z0-9._-]*$/,gr=new Set("p,h1,h2,h3,h4,h5,h6,blockquote,pre,hr,ul,ol,li,img,figure,figcaption,br,table,tr,td,th,strong,em,u,s,code,a,sub,sup".split(",")),ko=new Set(["span","i","b","del","strike","mark"]),Iw=new Set("abbr,acronym,bdi,bdo,big,cite,data,dfn,ins,kbd,q,samp,small,time,tt,var,label,ruby,rt,rp,wbr".split(",")),ay=new Set("div,section,article,aside,header,footer,nav,main,address,details,summary,dl,dt,dd,center,hgroup,search".split(",")),Hw=new Set([...ay,..."p,h1,h2,h3,h4,h5,h6,blockquote,pre,hr,ul,ol,li,table,figure".split(",")]),Bw={a:["href"],ul:["data-type"],li:["data-type","data-checked"],img:["src"],td:["colspan","rowspan"],th:["colspan","rowspan"]};function ry(n){let e=[],t=0,r="";for(let o of n)o==="["?t++:o==="]"&&(t=Math.max(0,t-1)),o===","&&!t?(e.push(r),r=""):r+=o;return e.push(r),e.map(o=>o.trim()).filter(Boolean)}function Fw(n){let e=n.trim(),t=e.startsWith("!");t&&(e=e.slice(1));let r=/^([^=:<]+)(?:([=:<])(.*))?$/s.exec(e);if(!r)return null;let o=r[1].trim().toLowerCase();if(!o)return null;let i={name:o,required:t},s=r[3]??"";return r[2]==="="?i.def=s:r[2]===":"?i.forced=s:r[2]==="<"&&(i.values=s.split("?")),i}function iu(n,e){return n==="*"?!0:n.endsWith("*")?e.startsWith(n.slice(0,-1)):n===e}var oy=new Set;function su(n,e){oy.has(n)||(oy.add(n),console.warn(`[nova] <${n}> in content rules is ignored: ${e}`))}var lu=class{constructor(e){S(this,"elements",new Map);S(this,"globals",[]);S(this,"blockTags",new Map);S(this,"inlineTags",new Map);let t=new Set((e.invalidElements??"").split(",").map(s=>s.trim().toLowerCase()).filter(Boolean)),r=new Set,o=new Set;for(let s of(e.customElements??"").split(",")){let l=s.trim().toLowerCase(),a=l.replace(/^~/,"");if(ny.test(a)){if(ty.has(a)||gr.has(a)){su(a,"it cannot be a custom element");continue}o.add(a),l.startsWith("~")&&r.add(a)}}let i=(s,l)=>{let[a,...c]=s;if(a){if(a==="@"||a==="*"){this.globals.push(...l??[]);return}for(let d of s){if(!ny.test(d)||t.has(d))continue;if(ty.has(d)){su(d,"not allowed for security reasons (iframes and video: use the media plugin)");continue}this.elements.set(d,l);let u=gr.has(d)||ko.has(d)?d:a;if(gr.has(d))continue;if(ko.has(d)){d===a&&l?.length&&this.inlineTags.set(d,d);continue}let p=o.has(d)||o.has(a)||d.includes("-");Iw.has(a)||r.has(a)?this.inlineTags.set(d,u):ay.has(a)||p?this.blockTags.set(d,u):(!c.includes(d)||d===a)&&su(d,"unknown element")}}};for(let s of ry(e.validElements??"")){let{names:l,attrs:a}=iy(s);a?i(l,a):l.every(c=>gr.has(c)||ko.has(c))||i(l,null)}for(let s of ry(e.extendedValidElements??"")){let{names:l,attrs:a}=iy(s);i(l,a)}for(let s of o)t.has(s)||(this.elements.has(s)||this.elements.set(s,[{name:"*",required:!1}]),r.has(s)?this.inlineTags.set(s,s):this.inlineTags.has(s)||this.blockTags.set(s,s))}apply(e,t){return jw(e.nodes,e.marks,this,t)}get active(){return this.elements.size>0||this.globals.length>0}touches(e){return this.globals.length>0||this.elements.has(e)}rulesFor(e){return[...this.elements.get(e)??[],...this.globals]}allows(e,t){return Dw.test(t)||!_w.test(t)?!1:this.rulesFor(e).some(r=>iu(r.name,t))}extends(e){return this.rulesFor(e).some(t=>t.name!=="class"&&t.name!=="style")}get classOnBuiltIn(){if(this.globals.some(e=>iu(e.name,"class")))return!0;for(let[e,t]of this.elements)if(gr.has(e)&&t?.some(r=>iu(r.name,"class")))return!0;return!1}hasRequired(e,t){return this.rulesFor(e).every(r=>!r.required||t.hasAttribute(r.name))}readAttrs(e,t,r){let o=null;for(let i of Array.from(t.attributes)){let s=i.name.toLowerCase();if(s===ns&&(s="style"),r.includes(s)||!this.allows(e,s))continue;let l=Yr(s,i.value);l!==null&&((o??(o={}))[s]=l)}return o}outputAttrs(e,t,r){let o={...t};if(r&&typeof r=="object"&&!Array.isArray(r))for(let[s,l]of Object.entries(r)){let a=s.toLowerCase();if(o[a]!=null||!this.allows(e,a)||!["string","number","boolean"].includes(typeof l))continue;let c=Yr(a,String(l));c!==null&&(o[a]=c)}if(this.elements.get(e))for(let s of Object.keys(o))this.allows(e,s)||Bw[e]?.includes(s)||s.startsWith("data-nova-")||delete o[s];for(let s of this.rulesFor(e)){if(s.name.includes("*"))continue;s.forced!==void 0?o[s.name]=s.forced:s.def!==void 0&&o[s.name]==null&&(o[s.name]=s.def);let l=o[s.name];s.values&&l!=null&&!s.values.includes(String(l))&&delete o[s.name]}return e==="a"&&o.target!=null&&o.rel==null&&(o.rel="noopener noreferrer"),o}decorate(e,t){if(!Array.isArray(e)||typeof e[0]!="string")return e;let r=e[0],o=(r.includes(" ")?r.split(" ")[1]:r).toLowerCase();if(!this.touches(o))return e;let i=e[1],s=!!i&&typeof i=="object"&&!Array.isArray(i)&&i.nodeType===void 0,l=this.outputAttrs(o,s?i:{},t);return[r,l,...e.slice(s?2:1)]}};function iy(n){let e=/^([^[]*)(?:\[(.*)\])?$/s.exec(n.trim()),t=(e?.[1]??"").trim().replace(/^[-#+!]+/,"").split("/").map(i=>i.trim().toLowerCase()).filter(Boolean),r=e?.[2],o=r===void 0?null:r.split("|").map(Fw).filter(i=>i!==null);return{names:t,attrs:o}}function zw(n){if(!n.validElements&&!n.extendedValidElements&&!n.customElements)return null;let e=new lu(n);return e.active?e:null}var sy=n=>(/^[a-z][a-z0-9-]*/i.exec(n)?.[0]??"").toLowerCase();function $w(n,e,t,r,o){try{let i=n.schema,s=e==="node"?o(i.nodes[t].create(r)):o(i.marks[t].create(r),!0),l=Array.isArray(s)?s[1]:null;return l&&typeof l=="object"&&!Array.isArray(l)?Object.keys(l):[]}catch{return[]}}function Vw(n,e,t,r,o){let i=(e.parseDOM??[]).map(a=>a.tag?sy(a.tag):"").filter(a=>gr.has(a)&&r.touches(a));if(!i.length||!e.toDOM)return e;let s=i.some(a=>r.extends(a)),l=e.toDOM;return{...e,...s?{attrs:{...e.attrs,htmlAttrs:{default:null}}}:{},parseDOM:e.parseDOM.map(a=>{let c=a.tag?sy(a.tag):"";if(!i.includes(c))return a;let d=a.getAttrs;return{...a,getAttrs:u=>{let p=d?d(u):a.attrs??null;if(p===!1||!r.hasRequired(c,u))return!1;if(!s)return p;let f=r.readAttrs(c,u,["class","style"]);if(!f)return p;for(let h of $w(o,t,n,{...p},l))delete f[h];return Object.keys(f).length?{...p,htmlAttrs:f}:p}}}),toDOM:((a,c)=>r.decorate(l(a,c),a.attrs.htmlAttrs))}}function ly(n,e){return Array.from(n.children).some(t=>{let r=t.localName;return Hw.has(r)||e.blockTags.has(r)})}function qw(n){let e={},t={},r=(a,c,d)=>{if(!n.hasRequired(a,c))return!1;let u=ko.has(a),p=u?d&&a==="span"?["class","style"]:["style"]:[],f=n.readAttrs(a,c,p);return u&&!f?!1:{tag:a,htmlAttrs:f}},o=a=>[...a].filter(([,c])=>!ko.has(c)).map(([c])=>c),i=(a,c,d)=>{let u=typeof d.tag=="string"&&a.has(d.tag)?d.tag:c;return{tag:u,attrs:n.outputAttrs(u,{},d.htmlAttrs)}},s=[...n.blockTags];if(s.length){let a=new Set(n.blockTags.values()),c=a.has("div")?"div":[...a][0],d={tag:{default:c},htmlAttrs:{default:null}};e.html_block={ownStyleTags:o(n.blockTags),group:"block",content:"block+",defining:!0,attrs:d,parseDOM:s.map(([u,p])=>({tag:u,getAttrs:f=>ly(f,n)?r(p,f,!1):!1})),toDOM:u=>{let{tag:p,attrs:f}=i(a,c,u.attrs);return[p,f,0]}},e.html_textblock={group:"block",content:"inline*",attrs:d,parseDOM:s.map(([u,p])=>({tag:u,getAttrs:f=>ly(f,n)?!1:r(p,f,!1)})),toDOM:u=>{let{tag:p,attrs:f}=i(a,c,u.attrs);return[p,f,0]}}}let l=[...n.inlineTags];if(l.length){let a=new Set(n.inlineTags.values()),c=a.has("span")?"span":[...a][0],d={tag:{default:c},htmlAttrs:{default:null}};e.html_inline_atom={ownStyleTags:o(n.inlineTags),group:"inline",inline:!0,atom:!0,attrs:d,parseDOM:l.map(([u,p])=>({tag:u,priority:65,getAttrs:f=>f.firstChild?!1:r(p,f,!1)})),toDOM:u=>{let{tag:p,attrs:f}=i(a,c,u.attrs);return[p,f]}},t.html_inline={attrs:d,excludes:"",parseDOM:l.map(([u,p])=>({tag:u,priority:p==="span"?40:60,getAttrs:f=>f.firstChild?r(p,f,!0):!1})),toDOM:u=>{let{tag:p,attrs:f}=i(a,c,u.attrs);return[p,f,0]}}}return{nodes:e,marks:t}}function jw(n,e,t,r){let o=(s,l)=>Object.fromEntries(Object.entries(s).map(([a,c])=>[a,Vw(a,c,l,t,r)])),i=qw(t);return{nodes:{...o(n,"node"),...i.nodes},marks:{...o(e,"mark"),...i.marks}}}var cy={create:zw};var dy=new Set(["lists","link","image","table","code","preview","searchreplace","fullscreen","help","wordcount","paste","hr","print","textcolor","colorpicker","contextmenu","tabfocus","textpattern","imagetools","powerpaste"]),uy={tinycomments:"comments",tinymcespellchecker:"spellchecker",inlinecss:"email"},Ww=new Set(["selector","target","license_key","api_key","branding","promotion","skin","skin_url","content_css","icons","icons_url","theme","theme_url","base_url","suffix","referrer_policy","convert_urls","relative_urls","remove_script_host","document_base_url","entity_encoding","height","min_height","max_height","width","resize","content_style","setup","init_instance_callback","inline","plugins","toolbar","menubar","statusbar","placeholder","readonly","disabled","block_formats","file_picker_callback","formats","style_formats","style_formats_merge","valid_classes","table_class_list","table_cell_class_list","file_picker_types","language","images_upload_handler","paste_as_text","paste_preprocess","paste_postprocess","invalid_elements","valid_elements","directionality","extended_valid_elements","custom_elements","valid_styles","toolbar_mode","toolbar_sticky","font_family_formats","font_size_formats","line_height_formats","color_map","autosave_interval","autosave_retention","autosave_prefix","quickbars_selection_toolbar","quickbars_insert_toolbar","mentions_fetch","tinycomments_author","tinycomments_author_name","codesample_languages","details_initial_state","details_serialized_state","tableofcontents_class","tableofcontents_depth","tableofcontents_header","tableofcontents_orderedlist","tableofcontents_includeheader","codesample_global_prismjs","casechange_title_case_minors","permanentpen_properties","visualchars_default_state","save_enablewhendirty","save_onsavecallback","save_oncancelcallback","importcss_append","importcss_file_filter","importcss_selector_filter","importcss_groups","importcss_exclusive","importcss_selector_converter","templates","spellchecker_active","spellchecker_language","spellchecker_languages","spellchecker_ignore_list","spellchecker_dialog","content_language","spellchecker_languagetool_url","spellchecker_check","a11ychecker_level","a11ychecker_ignored_rules","a11ychecker_allow_decorative_images","a11y_advanced_options","a11ychecker_alt_text_max_length","a11ychecker_filter_issue","a11ychecker_html_version","a11ychecker_issue_url_callback","ai_request","ai_shortcuts","inlinecss_selector_filter","inlinecss_file_filter","linkchecker_service_url","linkchecker_preprocess","linkchecker_content_css","tiny_pageembed_classes","tiny_pageembed_inline_styles","fullpagehtml_default_doctype","fullpagehtml_default_title","fullpagehtml_default_encoding","fullpagehtml_default_body_style","fullpagehtml_hide_in_source_view","mediaembed_service_url","mediaembed_max_width","mediaembed_inline_styles","advtable_value_series","advcode_prettify_editor","advcode_prettify_getcontent","advcode_inline","view_show","sidebar_show","editimage_toolbar","editimage_credentials_hosts","editimage_fetch_image","editimage_cors_hosts","editimage_proxy","editimage_proxy_service_url","editimage_upload_timeout","autocorrect_autocorrect","autocorrect_capitalize","autocorrect_service_url","typography_default_lang","typography_langs","typography_rules","typography_ignore","text_patterns","text_patterns_lookup","template_replace_values","template_preview_replace_values","template_selected_content_classes","template_cdate_classes","template_mdate_classes","template_cdate_format","template_mdate_format"]),Nn=n=>(Array.isArray(n)?n.join(" "):String(n??"")).split(/[\s,]+/).filter(Boolean);function py(n,e){return Nn(n.plugins).filter(t=>dy.has(t)||e(uy[t]??t))}function Kw(n){return/\/dash\//.test(n)?"dashes":/^common\/punctuation\/(quote|apostrophe)$/.test(n)?"quotes":n==="common/punctuation/hellip"?"ellipsis":n==="common/punctuation/delDoublePunctuation"||n.startsWith("common/space/")?"spaces":n==="common/symbols/arrow"?"arrows":n.startsWith("common/symbols/")?"symbols":n==="common/number/fraction"?"fractions":n.startsWith("common/number/")?"math":n.startsWith("common/nbsp/")?"nbsp":null}var Uw={code:["code","code_block"],pre:["code_block"],a:["link"],strong:["bold"],b:["bold"],em:["italic"],i:["italic"],blockquote:["blockquote"]};function Jw(n){let e={},t=n.typography_default_lang,r=Array.isArray(t)?t[0]:t;typeof r=="string"&&r&&(e.language=r.replace(/_/g,"-"));let o=n.typography_langs,s=(Array.isArray(o)?o:o&&typeof o=="object"?Object.keys(o):[]).filter(l=>typeof l=="string").map(l=>l.replace(/_/g,"-"));if(s.length&&(e.languages=s),Array.isArray(n.typography_rules)){let l=new Set(n.typography_rules.map(a=>typeof a=="string"?Kw(a):null));e.rules=Object.fromEntries(["quotes","dashes","ellipsis","symbols","arrows","math","fractions","spaces","nbsp"].map(a=>[a,l.has(a)]))}if(Array.isArray(n.typography_ignore)){let l=n.typography_ignore.flatMap(a=>typeof a=="string"?Uw[a.toLowerCase().replace(/\[.*$/,"")]??[]:[]);l.length&&(e.ignore=[...new Set(l)])}return e}function Ms(n){if(typeof n=="string")return n.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,r]=e.includes("=")?e.split("="):[e,e];return{label:t.trim(),value:(r??t).trim()}})}function Gw(n){let e="",t=new Promise(o=>{let i=new FileReader;i.onload=()=>{e=String(i.result).replace(/^data:[^,]*,/,""),o()},i.onerror=()=>o(),i.readAsDataURL(n)}),r="";return{ready:t,info:{id:()=>n.name.replace(/\.[^.]+$/,"")||"image",name:()=>n.name.replace(/\.[^.]+$/,"")||"image",filename:()=>n.name||"image",blob:()=>n,base64:()=>e,blobUri:()=>r||(r=URL.createObjectURL(n)),uri:()=>{}}}}var Yw=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre"]),Xw=new Set(["span","strong","b","em","i","u","s","strike","del","code","sub","sup"]);function Es(n){let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(!r||typeof r!="object")continue;let o=r,i={};typeof o.block=="string"&&Yw.has(o.block.toLowerCase())&&(i.block=o.block.toLowerCase()),typeof o.inline=="string"&&Xw.has(o.inline.toLowerCase())&&(i.inline=o.inline.toLowerCase()),typeof o.selector=="string"&&(i.selector=o.selector),(typeof o.classes=="string"||Array.isArray(o.classes))&&(i.classes=o.classes),o.styles&&typeof o.styles=="object"&&(i.styles=Object.fromEntries(Object.entries(o.styles).filter(([,s])=>typeof s=="string"&&!s.includes("%")).map(([s,l])=>[s.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`),l]))),(i.block||i.inline||i.selector)&&t.push(i)}return t}function fy(n){return Array.isArray(n)?n.flatMap(e=>{if(!e||typeof e!="object")return[];let t=e,r=String(t.title??"");if(!r)return[];if(Array.isArray(t.items))return[{title:r,items:fy(t.items)}];if(typeof t.format=="string")return[{title:r,format:t.format}];let[o]=Es(t);return o?[{title:r,...o}]:[]}):[]}function hy(n){return n.flatMap(e=>{if(!e||typeof e!="object")return[];let t=e,r=typeof t.title=="string"?t.title:"";return r?Array.isArray(t.subprompts)?[{title:r,items:hy(t.subprompts)}]:typeof t.prompt!="string"?[]:[{title:r,prompt:t.prompt,...typeof t.selection=="boolean"?{selection:t.selection}:{}}]:[]})}function my(n){let e=Object.keys(n).filter(b=>!Ww.has(b)),t=[],r=[];for(let b of Nn(n.plugins)){let A=uy[b]??b;dy.has(b)||(Mo(A)?t.push(A):r.push(b))}t.includes("ai")&&!t.includes("suggestions")&&t.splice(t.indexOf("ai"),0,"suggestions"),t.includes("mediaembed")&&!t.includes("media")&&t.splice(t.indexOf("mediaembed"),0,"media");let o={plugins:t};n.toolbar===!1?o.toolbar=!1:Array.isArray(n.toolbar)?o.toolbar=n.toolbar.join(" | "):typeof n.toolbar=="string"&&(o.toolbar=n.toolbar),n.menubar!==void 0&&(o.menubar=n.menubar),n.text_patterns===!1&&(o.textPatterns=!1),typeof n.statusbar=="boolean"&&(o.statusbar=n.statusbar),typeof n.placeholder=="string"&&(o.placeholder=n.placeholder),n.readonly===!0&&(o.editable=!1),typeof n.content_style=="string"&&(o.contentStyle=n.content_style);let i=b=>Array.isArray(b)?b.filter(A=>!!A&&typeof A.title=="string"&&typeof A.value=="string").map(({title:A,value:H})=>({title:A,value:H})):void 0,s=i(n.table_class_list);s&&(o.tableClassList=s);let l=i(n.table_cell_class_list);if(l&&(o.tableCellClassList=l),n.formats&&typeof n.formats=="object"&&(o.formats=Object.fromEntries(Object.entries(n.formats).map(([b,A])=>[b,Es(A)]).filter(([,b])=>b.length))),Array.isArray(n.style_formats)&&(o.styleFormats=fy(n.style_formats),n.style_formats_merge===!0&&(o.styleFormatsMerge=!0)),typeof n.valid_classes=="string"?o.validClasses=Nn(n.valid_classes):n.valid_classes&&typeof n.valid_classes=="object"?o.validClasses=Object.values(n.valid_classes).flatMap(b=>Nn(b)):o.validClasses=!0,n.content_css!==void 0&&n.content_css!==!1){let b=new Set(["default","dark","document","writer","tinymce-5","tinymce-5-dark"]),A=(Array.isArray(n.content_css)?n.content_css:String(n.content_css).split(",")).map(H=>String(H).trim()).filter(H=>H&&!b.has(H));A.length&&(o.contentCss=A)}n.disabled===!0&&(o.disabled=!0),n.resize!==!1&&(o.resize=n.resize==="both"?"both":!0);let a=Ms(n.block_formats);if(a){let b=["p","h1","h2","h3","h4","h5","h6","pre"];o.blockFormats=a.map(({label:A,value:H})=>({label:A,block:H.toLowerCase()})).filter(A=>b.includes(A.block))}if(typeof n.language=="string"&&(o.language=n.language.replace("_","-")),(n.toolbar_mode==="floating"||n.toolbar_mode==="sliding"||n.toolbar_mode==="scrolling"||n.toolbar_mode==="wrap")&&(o.toolbarMode=n.toolbar_mode),n.inline===!0&&(o.mode="inline"),n.paste_as_text===!0&&(o.pasteAsText=!0),typeof n.paste_preprocess=="function"){let b=n.paste_preprocess;o.pastePreprocess=(A,H)=>{let $={content:A};return b(H,$),$.content}}typeof n.invalid_elements=="string"&&(o.invalidElements=n.invalid_elements),typeof n.valid_elements=="string"&&(o.validElements=n.valid_elements),typeof n.extended_valid_elements=="string"&&(o.extendedValidElements=n.extended_valid_elements),typeof n.custom_elements=="string"&&(o.customElements=n.custom_elements),(n.directionality==="rtl"||n.directionality==="ltr")&&(o.direction=n.directionality),n.valid_styles&&(o.validStyles=n.valid_styles);let c=Ms(n.font_family_formats);c&&(o.fontFamilies=c);let d=Ms(n.font_size_formats);d&&(o.fontSizes=d.map(b=>b.value));let u=Ms(n.line_height_formats);if(u&&(o.lineHeights=u.map(b=>b.value)),Array.isArray(n.color_map)&&(o.colors=n.color_map.filter((b,A)=>A%2===0).map(b=>b.startsWith("#")?b:`#${b}`)),typeof n.images_upload_handler=="function"){let b=n.images_upload_handler,A=async(H,$)=>{let{ready:G,info:U}=Gw(H);return await G,b(U,$)};o.uploadImage=A}if(typeof n.file_picker_callback=="function"){let b=n.file_picker_callback;typeof n.file_picker_types=="string"&&(o.filePickerTypes=Nn(n.file_picker_types).filter(A=>A==="file"||A==="image"||A==="media")),o.filePicker=({type:A,value:H})=>new Promise($=>b((G,U={})=>$({url:G,...U}),H,{filetype:A,fieldname:"src"}))}let p={};if(n.autosave_interval||n.autosave_retention||n.autosave_prefix){let b=A=>parseInt(String(A),10);p.autosave={...n.autosave_interval?{delay:b(n.autosave_interval)*1e3}:{},...n.autosave_retention?{retention:b(n.autosave_retention)}:{},...n.autosave_prefix?{key:String(n.autosave_prefix)}:{}}}if((n.quickbars_selection_toolbar!==void 0||n.quickbars_insert_toolbar!==void 0)&&(p.quickbars={...n.quickbars_selection_toolbar!==void 0?{selection:n.quickbars_selection_toolbar}:{},...n.quickbars_insert_toolbar!==void 0?{insert:n.quickbars_insert_toolbar}:{}}),typeof n.mentions_fetch=="function"){let b=n.mentions_fetch;p.mentions={fetch:A=>new Promise(H=>b({term:A},H))}}if(n.tinycomments_author&&(p.comments={author:{id:String(n.tinycomments_author),name:String(n.tinycomments_author_name??n.tinycomments_author)}}),Array.isArray(n.codesample_languages)){let b=n.codesample_languages.flatMap(A=>{let{text:H,value:$}=A??{};return typeof $=="string"&&$?[{value:$,label:typeof H=="string"&&H?H:$}]:[]});p.codesample={languages:b}}let f=b=>b==="inherited"||b==="collapsed"||b==="expanded"?b:void 0;(n.details_initial_state||n.details_serialized_state)&&(p.accordion={...f(n.details_initial_state)?{initialState:f(n.details_initial_state)}:{},...f(n.details_serialized_state)?{serializedState:f(n.details_serialized_state)}:{}}),Nn(n.plugins).includes("tableofcontents")&&(p.tableofcontents={className:typeof n.tableofcontents_class=="string"?n.tableofcontents_class:"mce-toc",titleTag:typeof n.tableofcontents_header=="string"?n.tableofcontents_header:"h2",...n.tableofcontents_depth!==void 0?{depth:Number(n.tableofcontents_depth)}:{},...n.tableofcontents_orderedlist?{orderedList:!0}:{},...n.tableofcontents_includeheader===!1?{title:""}:{}}),Array.isArray(n.casechange_title_case_minors)&&(p.casechange={titleCaseMinors:n.casechange_title_case_minors.map(String)}),n.permanentpen_properties&&typeof n.permanentpen_properties=="object"&&(p.permanentpen={properties:{...n.permanentpen_properties}}),n.visualchars_default_state===!0&&(p.visualchars={default:!0});let h=Object.fromEntries([["append",n.importcss_append],["fileFilter",n.importcss_file_filter],["selectorFilter",n.importcss_selector_filter],["groups",n.importcss_groups],["exclusive",n.importcss_exclusive],["converter",n.importcss_selector_converter]].filter(([,b])=>b!==void 0));Object.keys(h).length&&(p.importcss=h);let m=n.templates,g=Object.fromEntries([["templates",typeof m=="function"?()=>new Promise(b=>m(b)):m],["values",n.template_replace_values],["previewValues",n.template_preview_replace_values],["selectedContentClasses",n.template_selected_content_classes],["creationDateClasses",n.template_cdate_classes],["modifiedDateClasses",n.template_mdate_classes],["creationDateFormat",n.template_cdate_format],["modifiedDateFormat",n.template_mdate_format]].filter(([,b])=>b!==void 0));Object.keys(g).length&&(p.template=g);let y={};typeof n.spellchecker_active=="boolean"&&(y.active=n.spellchecker_active);let x=n.content_language??n.spellchecker_language;typeof x=="string"&&x&&(y.language=x.replace(/_/g,"-")),typeof n.spellchecker_languages=="string"&&(y.languages=n.spellchecker_languages.split(",").map(b=>b.split("=")).filter(b=>b.length===2&&!!b[0].trim()&&!!b[1].trim()).map(([b,A])=>({name:b.trim(),code:A.trim().replace(/_/g,"-")})));let M=n.spellchecker_ignore_list,L=Array.isArray(M)?M:M&&typeof M=="object"?Object.values(M).flatMap(b=>Array.isArray(b)?b:[]):[];if(L.length&&(y.ignore=L.filter(b=>typeof b=="string")),typeof n.spellchecker_check=="function"&&(y.check=n.spellchecker_check),typeof n.spellchecker_languagetool_url=="string"&&(y.languageTool={url:n.spellchecker_languagetool_url}),Object.keys(y).length&&(p.spellchecker=y),Nn(n.plugins).includes("a11ychecker")){let b={allowDecorativeImages:(n.a11ychecker_allow_decorative_images??n.a11y_advanced_options)===!0};typeof n.a11ychecker_level=="string"&&(b.level=n.a11ychecker_level.toLowerCase()),typeof n.a11ychecker_ignored_rules=="string"&&(b.ignoredRules=n.a11ychecker_ignored_rules.split(",").map(H=>H.trim()).filter(Boolean)),typeof n.a11ychecker_alt_text_max_length=="number"&&(b.altTextMaxLength=n.a11ychecker_alt_text_max_length);let A=n.a11ychecker_filter_issue;typeof A=="function"&&(b.filterIssue=H=>A({...H,id:H.rule,contentID:H.text})!==!1),p.a11ychecker=b}let O=n.ai_shortcuts;O===!1||Array.isArray(O)&&!O.length?p.ai={shortcuts:!1}:Array.isArray(O)&&(p.ai={shortcuts:hy(O)});let B={};(["string","function"].includes(typeof n.inlinecss_selector_filter)||n.inlinecss_selector_filter instanceof RegExp)&&(B.selectorFilter=n.inlinecss_selector_filter),(["string","function"].includes(typeof n.inlinecss_file_filter)||n.inlinecss_file_filter instanceof RegExp)&&(B.fileFilter=n.inlinecss_file_filter),Object.keys(B).length&&(p.email=B);let J={};typeof n.autocorrect_autocorrect=="boolean"&&(J.autocorrect=n.autocorrect_autocorrect),typeof n.autocorrect_capitalize=="boolean"&&(J.capitalize=n.autocorrect_capitalize),Object.keys(J).length&&(p.autocorrect=J);let P={};typeof n.linkchecker_service_url=="string"&&(P.serviceUrl=n.linkchecker_service_url);let v=n.linkchecker_preprocess;if(typeof v=="function"&&(P.preprocess=b=>{let A=v({url:b});return typeof A?.url=="string"?A.url:b}),Object.keys(P).length&&(p.linkchecker=P),t.includes("pageembed")){let b=n.tiny_pageembed_classes;p.pageembed={className:"tiny-pageembed",sizes:Array.isArray(b)?b.filter(A=>!!A&&typeof A.value=="string").map(A=>({value:A.value,...typeof A.text=="string"?{text:A.text}:{}})):["21by9","16by9","4by3","1by1"].map(A=>({value:`tiny-pageembed--${A}`})),inlineStyles:n.tiny_pageembed_inline_styles===!0}}if(t.includes("fullpagehtml")){let b={},A=(H,$)=>{typeof n[H]=="string"&&(b[$]=n[H])};A("fullpagehtml_default_doctype","doctype"),A("fullpagehtml_default_title","title"),A("fullpagehtml_default_encoding","encoding"),A("fullpagehtml_default_body_style","bodyStyle"),n.fullpagehtml_hide_in_source_view===!0&&(b.hideInSourceView=!0),Object.keys(b).length&&(p.fullpagehtml=b)}if(t.includes("mediaembed")){let b={className:"ephox-summary-card",inlineStyles:n.mediaembed_inline_styles===!0};typeof n.mediaembed_service_url=="string"&&n.mediaembed_service_url&&(b.serviceUrl=n.mediaembed_service_url);let A=Number(n.mediaembed_max_width);n.mediaembed_max_width!==void 0&&Number.isFinite(A)&&(b.maxWidth=A),p.mediaembed=b}let k=n.advtable_value_series;if(t.includes("advtable")&&k&&typeof k=="object"){let b={};for(let[A,H]of Object.entries(k)){let{title:$,generator:G}=H??{};if(typeof $!="string"||typeof G!="function")continue;let U;b[A]={title:$,value:se=>{se===0&&(U=void 0);let rt=G({sectionType:"tbody",cellType:"td",getRowType:()=>"body",classes:[],direction:"column",prev:U},se,0);U=rt;let $e=rt?.value;return typeof $e=="string"||typeof $e=="number"?String($e):void 0}}}Object.keys(b).length&&(p.advtable={series:b})}if(t.includes("editimage")){let b={};typeof n.editimage_toolbar=="string"&&(b.toolbar=n.editimage_toolbar),Array.isArray(n.editimage_credentials_hosts)&&(b.credentialsHosts=n.editimage_credentials_hosts.filter(H=>typeof H=="string"));let A=n.editimage_fetch_image;typeof A=="function"&&(b.fetchImage=H=>{let $=document.createElement("img");return $.src=H,A($)}),Object.keys(b).length&&(p.editimage=b)}t.includes("advcode")&&typeof n.advcode_prettify_editor=="boolean"&&(p.advcode={prettify:n.advcode_prettify_editor});let E=Jw(n);return Object.keys(E).length&&(p.typography=E),Object.keys(p).length&&(o.pluginOptions=p),{options:o,unknown:e,missingPlugins:r}}var uu=null,au=null;function by(){return au??(au=import(__novaChunk("tinymce-chunks/dialog-126a0355.js") ).then(n=>uu=n)),au}function Zw(n,e,t){if(uu)return uu.openSpecDialog(n,e,t);let r=null,o={...e.initialData??{}},i=[];by().then(l=>{r=l.openSpecDialog(n,{...e,initialData:o},t);for(let a of i.splice(0))a(r)},l=>console.error("[nova] windowManager: could not load dialogs",l));let s=l=>(...a)=>{let c=d=>d[l](...a);r?c(r):i.push(c)};return{getData:()=>r?r.getData():{...o},setData:l=>{r?r.setData(l):o={...o,...l}},close:s("close"),block:s("block"),unblock:s("unblock"),focus:s("focus"),disable:s("disable"),enable:s("enable"),showTab:s("showTab"),redial:s("redial")}}var Cs={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",superscript:"superscript",subscript:"subscript",justifyleft:"alignLeft",justifycenter:"alignCenter",justifyright:"alignRight",justifyfull:"alignJustify",insertunorderedlist:"bulletList",insertorderedlist:"orderedList",indent:"indent",outdent:"outdent",undo:"undo",redo:"redo",removeformat:"clearFormatting",unlink:"unlink",inserthorizontalrule:"horizontalRule",mceblockquote:"blockquote"},vo={mcelowercase:"lowercase",mceuppercase:"uppercase",mcetitlecase:"titlecase",mcetoggleformatpainter:"formatpainter",mcetogglepermanentpen:"permanentpen",mceconfigurepermanentpen:"configurepermanentpen",mcevisualchars:"visualchars",mcesave:"save",mcecancel:"cancel",mcetemplate:"template",mceinsertfootnote:"footnotes",mceupdatefootnotes:"footnotesupdate",mcespellcheckdialog:"spellcheckdialog",mcetypography:"typography",mcecodeeditor:"code",mceimagerotateleft:"rotateleft",mceimagerotateright:"rotateright",mceimageflipvertical:"flipv",mceimagefliphorizontal:"fliph",mceeditimage:"editimage",mcefullpagehtmlproperties:"fullpagehtml"},gy=new Set(["mcespellcheckenable","mcespellcheckdisable","mcespellcheckupdate","mcespellcheckdialogclose"]),yy={mceadvancedtablesort:()=>({command:"dialog"}),mcesorttablebycolumnasc:()=>({command:"sort",value:{by:"column",direction:"asc"}}),mcesorttablebycolumndesc:()=>({command:"sort",value:{by:"column",direction:"desc"}}),mcesorttablebyrowasc:()=>({command:"sort",value:{by:"row",direction:"asc"}}),mcesorttablebyrowdesc:()=>({command:"sort",value:{by:"row",direction:"desc"}}),mcesorttableadvanced:n=>{let e=n&&typeof n=="object"?n:{},t=Number(e.roworcol);return{command:"sort",value:{by:e.sortby==="row"?"row":"column",...Number.isInteger(t)&&t>=0?{index:t}:{},direction:e.order==="descending"?"desc":"asc",scope:e.sort==="selection"?"selection":"table"}}},mcetabletoggleseries:n=>({command:"series",value:n?.name})},Qw=new Set(["insertaccordion","removeaccordion","toggleaccordion","toggleallaccordions"]),eS={p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock"},tS={bold:"bold",italic:"italic",underline:"underline","strike-through":"strike",link:"link",unlink:"unlink",image:"image",table:"table",undo:"undo",redo:"redo","align-left":"alignLeft","align-center":"alignCenter","align-right":"alignRight","align-justify":"alignJustify","unordered-list":"bulletList","ordered-list":"orderedList",indent:"indent",outdent:"outdent",quote:"blockquote","code-sample":"codeBlock","horizontal-rule":"horizontalRule","remove-formatting":"clearFormatting",fullscreen:"fullscreen",preview:"preview",sourcecode:"sourceCode",help:"help",print:"print",search:"search",copy:"copy","edit-block":"edit",checkmark:"check",close:"close",upload:"upload",subscript:"subscript",superscript:"superscript","paste-text":"pasteText","text-color":"textColor","highlight-bg-color":"highlight","line-height":"lineHeight"},cu={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",superscript:"superscript",subscript:"subscript",code:"code",p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock",alignleft:"alignLeft",aligncenter:"alignCenter",alignright:"alignRight",alignjustify:"alignJustify"},nS=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre"]),rS=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","pre","alignleft","aligncenter","alignright","alignjustify"]),du={forecolor:"color",hilitecolor:"background",fontname:"font_family",fontsize:"font_size"};function xo(n){console.warn(`[nova] tinymce-compat: editor.dom.${n} changes the editor DOM directly, which NovaProse redraws from its document model. Use setContent, insertContent or editor.formatter instead.`)}var Ts=new Map;function As(n){if(typeof n!="string"||!n)return;if(Ts.has(n))return Ts.get(n);let e=tS[n]??(n in C?n:void 0);return e?C[e]:void 0}function oS(n){let e=!1,t=!0;return{state:{get active(){return e},get enabled(){return t}},api:{isActive:()=>e,setActive:r=>{e=r,n.core.updateUI()},isEnabled:()=>t,setEnabled:r=>{t=r,n.core.updateUI()},isDisabled:()=>!t,setDisabled:r=>{t=!r,n.core.updateUI()}}}}var wo=class{constructor(e,t,r,o){S(this,"id");S(this,"core");S(this,"targetElm");S(this,"settings");S(this,"plugins",{});S(this,"initialized",!1);S(this,"removed",!1);S(this,"handlers",new Map);S(this,"dirty",!1);S(this,"teardowns",[]);S(this,"commands",new Map);S(this,"options",{get:e=>this.settings[e],set:(e,t)=>(this.settings[e]=t,e==="disabled"&&this.core.setDisabled(t===!0),!0),isSet:e=>e in this.settings,isRegistered:()=>!0,register:()=>{}});S(this,"mode",{get:()=>this.core.isEditable()?"design":"readonly",set:e=>this.core.setEditable(e!=="readonly"),isReadOnly:()=>!this.core.isEditable()});S(this,"undoManager",{undo:()=>this.core.exec("undo"),redo:()=>this.core.exec("redo"),hasUndo:()=>this.core.can("undo"),hasRedo:()=>this.core.can("redo"),add:()=>null,clear:()=>{},transact:e=>(e(),null),ignore:e=>e()});S(this,"selection",{getContent:(e={})=>e.format==="text"?this.core.selection.getText():this.core.selection.getHTML(),setContent:e=>this.insertContent(e),getNode:()=>this.core.selection.getNode()??this.core.view.dom,getStart:()=>this.selection.getNode(),getEnd:()=>this.selection.getNode(),isCollapsed:()=>this.core.selection.isCollapsed(),collapse:(e=!1)=>this.core.selection.collapse(e),setCursorLocation:(e,t=0)=>{e&&this.core.selection.setCursorLocation(e,t)},select:(e,t=!1)=>this.core.selection.select(e,t),getRng:()=>this.core.selection.getDOMRange(),setRng:e=>{let{view:t}=this.core;if(!e||!t.dom.contains(e.startContainer))return;let r=t.posAtDOM(e.startContainer,e.startOffset),o=t.dom.contains(e.endContainer)?t.posAtDOM(e.endContainer,e.endOffset):r;this.core.selection.setRange(r,o)},getBookmark:()=>this.core.selection.getBookmark(),moveToBookmark:e=>this.core.selection.moveToBookmark(e),scrollIntoView:()=>this.core.selection.scrollIntoView()});S(this,"notificationManager",{open:e=>this.core.ui.notify({text:e.text,...e.type?{type:e.type}:{},...e.timeout!==void 0?{timeout:e.timeout}:{}}),close:()=>{}});S(this,"windowManager",{alert:(e,t)=>{let r=document.createElement("p");r.textContent=e,this.core.ui.openDialog({title:"",body:r,onSubmit:()=>!0,...t?{onClose:t}:{}})},confirm:(e,t)=>{let r=document.createElement("p");r.textContent=e;let o=!1;this.core.ui.openDialog({title:"",body:r,submitLabel:"OK",onSubmit:()=>(o=!0,!0),onClose:()=>t?.(o)})},open:e=>Zw(this.core,e,t=>this.windowManager.open(t))});S(this,"ui",{registry:{addIcon:(e,t)=>{Ts.set(e,t)},addButton:(e,t)=>this.addButton(e,t,!1),addToggleButton:(e,t)=>this.addButton(e,t,!0),addMenuButton:(e,t)=>{let r=[];t.fetch(i=>r=i);let o=As(t.icon);this.core.ui.registry.addMenuButton(e,{tooltip:t.tooltip??t.text??e,...o?{icon:o}:{text:t.text??e},items:()=>(t.fetch(i=>r=i),r.map((i,s)=>i.type==="separator"?{type:"separator"}:{id:`${e}-${s}`,label:i.text??"",onSelect:()=>i.onAction?.({})}))})},addMenuItem:(e,t)=>{let r=As(t.icon);this.core.ui.registry.addMenuItem(e,{text:t.text??e,...r?{icon:r}:{},onAction:()=>t.onAction?.({})})},addContextToolbar:(e,t)=>{this.core.ui.registry.addContextToolbar(e,{label:t.label??e,items:t.items,position:t.position==="node"?"node":"selection",predicate:()=>{let r=this.selection.getNode();return!!r&&this.getBody().contains(r)&&t.predicate(r)}})},addSidebar:(e,t)=>{let r=null,o={element:()=>r},i=As(t.icon);this.core.ui.registry.addSidebar(e,{title:t.tooltip??e,...i?{icon:i}:{},render:s=>{r=s;let l=t.onSetup?.(o);return typeof l=="function"?l:void 0},onShow:()=>t.onShow?.(o),onHide:()=>t.onHide?.(o)})},addView:(e,t)=>{this.core.ui.registry.addView(e,{buttons:(Array.isArray(t.buttons)?t.buttons:[]).filter(r=>typeof r?.text=="string").map(r=>({text:r.text,buttonType:r.buttonType==="primary"?"primary":"secondary",onAction:()=>r.onAction?.()})),...t.onShow?{onShow:t.onShow}:{},...t.onHide?{onHide:t.onHide}:{}})},addContextForm:()=>{console.warn("[nova] tinymce-compat: addContextForm is not supported yet")},getAll:()=>({})}});S(this,"dom",{select:(e,t)=>[...(t??this.getBody()).querySelectorAll(e)],get:e=>typeof e=="string"?this.getBody().querySelector(`#${CSS.escape(e)}`):e,getParent:(e,t)=>{let r=e instanceof Element?e:e?.parentElement??null;for(;r&&r!==this.getBody();){if(typeof t=="string"?r.matches(t):t(r))return r;r=r.parentElement}return null},getParents:(e,t)=>{let r=[],o=e instanceof Element?e:e?.parentElement??null;for(;o&&o!==this.getBody();)(!t||o.matches(t))&&r.push(o),o=o.parentElement;return r},is:(e,t)=>!!e?.matches(t),getAttrib:(e,t,r="")=>e?.getAttribute(t)??r,hasClass:(e,t)=>!!e?.classList.contains(t),getStyle:(e,t)=>e instanceof HTMLElement?e.style.getPropertyValue(t):"",getRoot:()=>this.getBody(),encode:e=>e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`),decode:e=>{let t=document.createElement("textarea");return t.innerHTML=e,t.value},create:(e,t={},r)=>{let o=document.createElement(e);for(let[i,s]of Object.entries(t))i.startsWith("on")||o.setAttribute(i,s);return r!==void 0&&(o.textContent=r),o},uniqueId:(e="mce_")=>`${e}${Math.random().toString(36).slice(2,10)}`,setAttrib:()=>xo("setAttrib"),addClass:()=>xo("addClass"),removeClass:()=>xo("removeClass"),setStyle:()=>xo("setStyle"),remove:()=>xo("remove")});S(this,"formatter",{apply:(e,t={})=>this.applyFormat(e,t,"apply"),remove:e=>this.applyFormat(e,{},"remove"),toggle:(e,t={})=>this.applyFormat(e,t,this.formatter.match(e)?"remove":"apply"),match:e=>{if(this.core.formatter.has(e))return this.core.formatter.match(e);let t=e.toLowerCase();if(nS.has(t))return this.blockMatches(t);let r=cu[t];if(r)return this.core.isActive(r);let o=du[t];if(!o)return!1;let{state:i}=this.core.view,{from:s,to:l,empty:a}=i.selection,c=i.schema.marks[o];return a||!c?bt(i,o)!==null:i.doc.rangeHasMark(s,l,c)},canApply:e=>this.core.formatter.has(e)||e.toLowerCase()in cu||e.toLowerCase()in du,register:(e,t)=>{let r=typeof e=="string"?[[e,t]]:Object.entries(e);for(let[o,i]of r){let s=Es(i);s.length?this.core.formatter.register(o,s):console.warn(`[nova] tinymce-compat: format "${o}" is not supported yet`)}},unregister:e=>this.core.formatter.unregister(e),get:e=>this.core.formatter.get(e)});this.core=e,this.targetElm=t,this.id=r,this.settings=o,setTimeout(()=>{by().catch(()=>{})},0)}getContent(e={}){let t={format:e.format??"html",content:""};return t.content=t.format==="text"?this.core.getText():this.core.getHTML({fullPage:e.fullpagehtml!==!1}),(e.prettify===!0||this.settings.advcode_prettify_getcontent===!0&&this.core.hasPlugin("advcode"))&&t.format!=="text"&&(t.content=Ss(t.content)),this.fire("GetContent",t),t.content}setContent(e,t={}){let r={content:e,...t};return this.fire("BeforeSetContent",r),this.core.setContent(r.content,{fullPage:t.fullpagehtml!==!1}),this.fire("SetContent",r),r.content}insertContent(e){this.core.insertContent(e)}resetContent(e){this.core.setContent(e??this.settings.__initialContent??"",{addToHistory:!1}),this.setDirty(!1)}getBody(){return this.core.view.dom}getElement(){return this.targetElm}getContainer(){return this.core.root}getContentAreaContainer(){return this.core.view.dom.parentElement??this.core.root}getDoc(){return this.core.root.ownerDocument}getWin(){return this.core.root.ownerDocument.defaultView}queryCommandValue(e){return e.toLowerCase()==="togglesidebar"?this.core.ui.sidebar.active??"":e.toLowerCase()==="toggleview"?this.core.ui.view.active??"":""}execCommand(e,t,r){let o=e.toLowerCase(),i=!1;if(Cs[o])i=this.core.exec(Cs[o]);else if(o==="formatblock"||o==="mcetoggleformat"){let s=eS[String(r??"").toLowerCase()];i=s?this.core.exec(s):!1}else if(o==="mceinsertcontent"||o==="inserthtml")this.insertContent(String(r??"")),i=!0;else if(o==="toggleview")this.core.ui.view.toggle(String(r??"")),i=!0;else if(o==="togglesidebar")this.core.ui.sidebar.toggle(String(r??"")),i=!0;else if((o==="mceaidialog"||o==="mceaidialogclose")&&this.core.hasPlugin("ai")){let s=r&&typeof r=="object"?r:{},l={...typeof s.prompt=="string"?{prompt:s.prompt}:{},...s.generate===!0?{generate:!0}:{},...s.display===!1?{display:!1}:{}};this.core.root.dispatchEvent(o==="mceaidialog"?new CustomEvent("nova-ai-dialog",{detail:l}):new CustomEvent("nova-ai-dialog-close")),i=!0}else if(o==="mcesetcontent")this.setContent(String(r??"")),i=!0;else if(o==="mceinserttoc"||o==="mceupdatetoc"){let s=this.core.ui.registry.get(o==="mceinserttoc"?"tableofcontents":"tableofcontentsupdate");s?.type==="button"&&(s.onAction(this.core),i=!0)}else if(yy[o]&&this.core.hasPlugin("advtable"))this.core.root.dispatchEvent(new CustomEvent("nova-advtable",{detail:yy[o](r)})),i=!0;else if(Qw.has(o))i=this.accordionCommand(o,r);else if(o==="mceinserttemplate"&&this.core.hasPlugin("template"))this.core.root.dispatchEvent(new CustomEvent("nova-insert-template",{detail:String(r??"")})),i=!0;else if(gy.has(o)&&this.core.hasPlugin("spellchecker"))i=this.spellcheckCommand(o);else if(vo[o]||o==="mcetogglestickyformatpainter")i=this.pluginCommand(o);else if(o==="codesample"){let s=this.core.ui.registry.get("codesample");s?.type==="button"&&(s.onAction(this.core),i=!0)}else if(o==="selectall"){let{state:s,dispatch:l}=this.core.view;l(s.tr.setSelection(new ue(s.doc))),i=!0}else if(o==="mcecleanup")i=!0;else{let s=this.commands.get(o);s&&(s(t,r),i=!0)}return i&&this.fire("ExecCommand",{command:e,ui:t,value:r}),i}spellcheckCommand(e){if(e==="mcespellcheckdialogclose")return this.core.ui.closeOverlays(),!0;if(e==="mcespellcheckupdate")return!0;let t=this.core.ui.registry.get("spellchecker");if(!t)return!1;let r=!!t.isActive?.(this.core);return e==="mcespellcheckenable"!==r&&t.onAction(this.core),!0}accordionCommand(e,t){let{view:r}=this.core,{state:o}=r,i=o.selection.$from,s=null;for(let d=i.depth;d>0&&!s;d--){let u=i.node(d);u.type.name==="details"&&(s={pos:i.before(d),open:u.attrs.open!==!1})}if(e==="insertaccordion"||e==="removeaccordion"){if(e==="removeaccordion"!=!!s)return!1;let d=this.core.ui.registry.get("accordion");return d?.type!=="button"?!1:(d.onAction(this.core),!0)}let l=[];if(e==="toggleaccordion"?s&&l.push(s):o.doc.descendants((d,u)=>(d.type.name==="details"&&l.push({pos:u,open:d.attrs.open!==!1}),!d.isTextblock)),!l.length)return!1;let a=typeof t=="boolean"?t:!l.every(d=>d.open),c=o.tr;for(let d of l)c.setNodeAttribute(d.pos,"open",a);return r.dispatch(c.setMeta("addToHistory",!1)),!0}pluginCommand(e){let{registry:t}=this.core.ui;if(e==="mcetogglestickyformatpainter"){let o=t.get("formatpainter"),i=t.getMenuItem("formatpainter");return o?.type!=="button"||!i?!1:(i.isActive?.(this.core)?i.onAction(this.core):(o.onAction(this.core),o.onAction(this.core)),!0)}let r=t.getMenuItem(vo[e]);return!r||e!=="mcesave"&&r.isEnabled?.(this.core)===!1?!1:(r.onAction(this.core),!0)}queryCommandState(e){let t=e.toLowerCase(),r=Cs[t];return r?this.core.isActive(r):t==="mcetoggleformatpainter"||t==="mcetogglepermanentpen"?!!this.core.ui.registry.getMenuItem(vo[t])?.isActive?.(this.core):!1}queryCommandSupported(e){let t=e.toLowerCase();return t in Cs||["formatblock","mceinsertcontent","mcesetcontent"].includes(t)||t in vo&&!!this.core.ui.registry.getMenuItem(vo[t])||t==="mcetogglestickyformatpainter"&&this.core.ui.registry.has("formatpainter")||gy.has(t)&&this.core.hasPlugin("spellchecker")||(t==="mceaidialog"||t==="mceaidialogclose")&&this.core.hasPlugin("ai")||this.commands.has(t)}addCommand(e,t){this.commands.set(e.toLowerCase(),t)}on(e,t,r=!1){for(let o of e.toLowerCase().split(/\s+/).filter(Boolean)){let i=this.handlers.get(o)??new Set;r?this.handlers.set(o,new Set([t,...i])):this.handlers.set(o,i.add(t))}return this}off(e,t){if(!e)return this.handlers.clear(),this;for(let r of e.toLowerCase().split(/\s+/).filter(Boolean))t?this.handlers.get(r)?.delete(t):this.handlers.delete(r);return this}once(e,t){let r=o=>(this.off(e,r),t(o));return this.on(e,r)}fire(e,t={}){let r=Object.assign(t,{type:e.toLowerCase(),target:this});for(let o of[...this.handlers.get(e.toLowerCase())??[]])try{o(r)}catch(i){console.error(`[nova] tinymce-compat: "${e}" handler failed`,i)}return r}fireNative(e,t){for(let r of[...this.handlers.get(e)??[]])try{r(t)}catch(o){console.error(`[nova] tinymce-compat: "${e}" handler failed`,o)}}static registerIcon(e,t){Ts.set(e,t)}dispatch(e,t){return this.fire(e,t)}hasEventListeners(e){return(this.handlers.get(e.toLowerCase())?.size??0)>0}isDirty(){return this.dirty}setDirty(e){let t=this.dirty!==e;this.dirty=e,t&&e&&this.fire("Dirty")}save(){let e=this.getContent(),t=this.fire("SaveContent",{content:e});return this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.value=String(t.content)),this.setDirty(!1),String(t.content)}focus(){this.core.focus()}hasFocus(){return this.core.view.hasFocus()}hide(){this.core.root.hidden=!0,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!1)}show(){this.core.root.hidden=!1,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!0)}isHidden(){return this.core.root.hidden===!0}getParam(e,t){return e in this.settings?this.settings[e]:t}addButton(e,t,r){let{api:o,state:i}=oS(this);t.enabled===!1&&o.setEnabled(!1),t.active&&o.setActive(!0);let s=As(t.icon);if(this.core.ui.registry.addButton(e,{tooltip:t.tooltip??t.text??e,...s?{icon:s}:{text:t.text??e},isEnabled:()=>i.enabled,...r?{isActive:()=>i.active}:{},onAction:()=>t.onAction?.(o)}),t.onSetup){let l=()=>{let a=t.onSetup(o);typeof a=="function"&&this.teardowns.push(a)};this.initialized?l():this.once("init",l)}}blockMatches(e){let{$from:t}=this.core.view.state.selection;for(let o=t.depth;o>0;o-=1){let i=t.node(o),s=i.type.name;if(e==="blockquote"&&s==="blockquote")return!0;if(o===t.depth){if(e==="p")return s==="paragraph";if(e==="pre")return s==="code_block";if(/^h[1-6]$/.test(e))return s==="heading"&&i.attrs.level===Number(e[1])}}let r=null;if(this.core.view.state.doc.descendants(o=>r||!o.isTextblock?!r:(r={name:o.type.name,level:o.attrs.level},!1)),!t.depth&&r){let o=r;if(e==="p")return o.name==="paragraph";if(e==="pre")return o.name==="code_block";if(/^h[1-6]$/.test(e))return o.name==="heading"&&o.level===Number(e[1])}return!1}applyFormat(e,t,r){if(this.core.formatter.has(e)){r==="apply"?this.core.formatter.apply(e):this.core.formatter.remove(e);return}let o=e.toLowerCase(),i=cu[o];if(i){let l=this.formatter.match(o);rS.has(o)?r==="apply"?this.core.exec(i):l&&this.core.exec("paragraph"):r==="apply"!==l&&this.core.exec(i);return}let s=du[o];if(s){this.core.exec(It(s,r==="apply"?t.value??null:null));return}console.warn(`[nova] tinymce-compat: format "${e}" is not supported yet`)}remove(){if(this.removed)return;this.fire("remove"),this.save(),this.teardowns.splice(0).forEach(t=>t()),this.removed=!0,this.core.destroy(),this.core.root.remove(),this.settings.__wrapper?.remove(),this.targetElm.hidden=!1,this.off()}destroy(){this.remove()}};var ky=new Set;function pu(n){ky.has(n)||(ky.add(n),console.warn(`[nova] tinymce-compat: ${n}`))}var iS=0,Ns=n=>typeof n=="number"?`${n}px`:String(n);function sS(){xd(cy);let n=[],e=new Map,t=null;async function r(i,s){var H;let l=n.find($=>$.targetElm===i&&!$.removed);if(l)return l;let{options:a,unknown:c,missingPlugins:d}=my(s);c.length&&pu(`options not supported yet: ${c.join(", ")}`);let u=String(Array.isArray(s.plugins)?s.plugins.join(" "):s.plugins??"").split(/[\s,]+/).filter($=>e.has($)),p=d.filter($=>!e.has($));p.length&&pu(`plugins not available: ${p.join(", ")}`);let f=i.id||`mce_${++iS}`;i.id||(i.id=f);let h=i instanceof HTMLTextAreaElement,m=h?i.value:i.innerHTML,g={...s,__initialContent:m},y;s.inline===!0&&!h?(i.replaceChildren(),y=i):(y=document.createElement("div"),y.className="nova-compat",i.after(y),i.hidden=!0,g.__wrapper=y);let x,M=$=>{let G=$;if(!G||typeof G.start!="string")return null;if(typeof G.replacement=="string")return{start:G.start,replacement:G.replacement};let U=(Array.isArray(G.format)?G.format:[G.format]).filter(Ae=>typeof Ae=="string"),se=typeof G.cmd=="string"?G.cmd:null;return!se&&!U.length?null:{start:G.start,...typeof G.end=="string"&&G.end?{end:G.end}:{},...G.trigger==="enter"?{trigger:"enter"}:{},value:G.value,command:(Ae,rt)=>{if(se)x.execCommand(se,!1,rt);else for(let $e of U)x.formatter.apply($e)}}};Array.isArray(s.text_patterns)&&(a.textPatterns=s.text_patterns.map(M));let L=s.text_patterns_lookup;typeof L=="function"&&(a.textPatternsLookup=$=>{let G=L($);return Array.isArray(G)?G.map(M):[]},a.textPatterns||(a.textPatterns=[]));let O=s.save_onsavecallback,B=s.save_oncancelcallback,J={...s.save_enablewhendirty!==void 0?{enableWhenDirty:s.save_enablewhendirty!==!1}:{},...typeof O=="function"?{onSave:()=>(x.save(),O(x))}:{},...typeof B=="function"?{onCancel:()=>B(x)}:{}},P=s.ai_request,v=typeof P=="function"?{...a.pluginOptions?.ai,async*request($){let{tinyAiRequest:G}=await import(__novaChunk("tinymce-chunks/ai-e0658729.js") );yield*G(P,(U,se)=>x?.fire(U,se))($)}}:null,k={...a.pluginOptions,...Object.keys(J).length?{save:J}:{},...v?{ai:v}:{}},E=ws({...a,...Object.keys(k).length?{pluginOptions:k}:{},element:y,content:m,setup:$=>{x=new wo($,i,f,g);for(let G of u)try{let U=e.get(G)(x,"");x.plugins[G]=U&&typeof U=="object"?U:{}}catch(U){console.error(`[nova] tinymce-compat: plugin "${G}" failed`,U)}s.setup?.(x)}});s.height!==void 0&&(E.root.style.height=Ns(s.height)),s.min_height!==void 0&&(E.root.style.minHeight=Ns(s.min_height)),s.max_height!==void 0&&(E.root.style.maxHeight=Ns(s.max_height)),s.width!==void 0&&(E.root.style.width=Ns(s.width));let b=!1;E.on("change",()=>{x.setDirty(!0),b=!0,x.fire("input")}),E.on("selectionChange",()=>{x.fire("NodeChange",{element:x.selection.getNode(),selectionChange:!0})}),E.on("focus",()=>{t=x,b=!1,x.fire("focus")}),E.on("blur",()=>{b&&x.fire("change",{level:{content:x.getContent()}}),b=!1,x.fire("blur")});for(let $ of["keydown","keyup","keypress","click","dblclick","mousedown","mouseup","paste","copy","cut","drop"])E.view.dom.addEventListener($,G=>x.fireNative($,G));if(E.root.addEventListener("nova-ai-dialogopen",()=>x.fire("AIDialogOpen")),E.root.addEventListener("nova-ai-dialogclose",()=>x.fire("AIDialogClose")),E.root.addEventListener("nova-autocorrect-toggle",$=>{let{feature:G,on:U}=$.detail;x.fire((G==="capitalize"?"Capitalize":"Autocorrect")+(U?"Start":"End"))}),(h?i.form:i.closest("form"))?.addEventListener("submit",()=>x.save()),x.on("remove",()=>{let $=n.indexOf(x);$>=0&&n.splice($,1),t===x&&(t=n[0]??null)}),n.push(x),t??(t=x),await E.ready,x.removed)return x;for(let $ of py(s,G=>E.hasPlugin(G)))(H=x.plugins)[$]??(H[$]={});return x.plugins.inlinecss&&(x.plugins.inlinecss.getContent=async()=>{x.fire("InlineCSS");let{emailHTML:$}=await import(__novaChunk("tinymce-chunks/email-1926dd8a.js") );return{html:await $(E,{document:!1})}}),x.initialized=!0,x.fire("init"),s.init_instance_callback?.(x),typeof s.view_show=="string"&&s.view_show?E.ui.view.show(s.view_show):typeof s.sidebar_show=="string"&&s.sidebar_show&&E.ui.sidebar.show(s.sidebar_show),x}return{majorVersion:"7",minorVersion:"0.0",novaprose:!0,get activeEditor(){return t},get editors(){return[...n]},async init(i){document.readyState==="loading"&&await new Promise(a=>document.addEventListener("DOMContentLoaded",a,{once:!0})),typeof i.language=="string"&&await rl(i.language.replace("_","-")).catch(a=>(console.warn("[nova] tinymce-compat: language pack failed to load",a),!1));let s=i.target?[i.target]:i.selector?[...document.querySelectorAll(i.selector)]:[];s.length||pu(`no elements match "${i.selector??""}"`);let l=[];for(let a of s)l.push(await r(a,i));return l},get:(i=>i===void 0?[...n]:typeof i=="number"?n[i]??null:n.find(s=>s.id===i)??null),remove(i){(i===void 0?[...n]:typeof i=="string"?n.filter(l=>l.id===i.replace(/^#/,"")||l.targetElm.matches(i)):[i]).forEach(l=>l.remove())},triggerSave(){n.forEach(i=>i.save())},execCommand(i,s,l){return t?.execCommand(i,s,l)??!1},PluginManager:{add:(i,s)=>{e.set(i,s)},get:i=>e.get(i),requireLangPack:()=>{},urls:{}},IconManager:{add:(i,s)=>{for(let[l,a]of Object.entries(s.icons??{}))wo.registerIcon(l,a)}},util:{I18n:{translate:i=>i}}}}var vy=sS();$t("ru",()=>import(__novaChunk("tinymce-chunks/ru-f1d19f4f.js") ));$t("de",()=>import(__novaChunk("tinymce-chunks/de-eb649701.js") ));$t("es",()=>import(__novaChunk("tinymce-chunks/es-b9c95169.js") ));$t("fr",()=>import(__novaChunk("tinymce-chunks/fr-724ffe36.js") ));$t("it",()=>import(__novaChunk("tinymce-chunks/it-f4816bbc.js") ));$t("pt-BR",()=>import(__novaChunk("tinymce-chunks/pt-BR-abebbb34.js") ));var xy=document.currentScript;if(xy?.src&&!document.querySelector("link[data-novaprose-css]")){let n=document.createElement("link");n.rel="stylesheet",n.href=xy.src.replace(/[^/]*$/,"novaprose.css"),n.setAttribute("data-novaprose-css",""),document.head.append(n)}window.tinymce=vy;var q=globalThis.__novaprose_tinymce={};q["node_modules/.pnpm/prosemirror-history@1.5.2/node_modules/prosemirror-history/dist/index.js"]=Mc;q["node_modules/.pnpm/prosemirror-inputrules@1.7.0/node_modules/prosemirror-inputrules/dist/index.js"]=id;q["node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js"]=Yl;q["node_modules/.pnpm/prosemirror-model@1.25.13/node_modules/prosemirror-model/dist/index.js"]=Vs;q["node_modules/.pnpm/prosemirror-schema-list@1.6.1/node_modules/prosemirror-schema-list/dist/index.js"]=fa;q["node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"]=Qs;q["node_modules/.pnpm/prosemirror-transform@1.12.7/node_modules/prosemirror-transform/dist/index.js"]=Gs;q["node_modules/.pnpm/prosemirror-view@1.43.1/node_modules/prosemirror-view/dist/index.js"]=Kl;q["node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js"]=Jl;q["packages/core/src/blocks.ts"]=Ac;q["packages/core/src/code-language.ts"]=Aa;q["packages/core/src/commands.ts"]=Lc;q["packages/core/src/comments.ts"]=ta;q["packages/core/src/content-css.ts"]=Hc;q["packages/core/src/document.ts"]=wd;q["packages/core/src/editor.ts"]=nu;q["packages/core/src/element-id.ts"]=ul;q["packages/core/src/image.ts"]=ed;q["packages/core/src/link.ts"]=cd;q["packages/core/src/mark-views.ts"]=Qd;q["packages/core/src/page.ts"]=Rd;q["packages/core/src/parser.ts"]=Nd;q["packages/core/src/plugins.ts"]=Rs;q["packages/core/src/plugins/accordion.ts"]=dl;q["packages/core/src/plugins/advtable.ts"]=ja;q["packages/core/src/plugins/comments.ts"]=la;q["packages/core/src/plugins/footnotes.ts"]=mc;q["packages/core/src/plugins/fullpagehtml.ts"]=oc;q["packages/core/src/plugins/index.ts"]=sm;q["packages/core/src/plugins/math.ts"]=hl;q["packages/core/src/plugins/media.ts"]=Ba;q["packages/core/src/plugins/mediaembed.ts"]=Xa;q["packages/core/src/plugins/mentions.ts"]=oa;q["packages/core/src/plugins/mergetags.ts"]=da;q["packages/core/src/plugins/pageembed.ts"]=$a;q["packages/core/src/plugins/pagelayout.ts"]=dc;q["packages/core/src/plugins/shared.ts"]=ol;q["packages/core/src/plugins/suggestions.ts"]=Ea;q["packages/core/src/plugins/tableofcontents.ts"]=yl;q["packages/core/src/pretty-html.ts"]=ou;q["packages/core/src/schema.ts"]=Ia;q["packages/core/src/search.ts"]=Bd;q["packages/core/src/serializer.ts"]=Qa;q["packages/core/src/tables.ts"]=yd;q["packages/core/src/ui/builtins.ts"]=jd;q["packages/core/src/ui/dialog.ts"]=qc;q["packages/core/src/ui/dom.ts"]=tl;q["packages/core/src/ui/file-picker.ts"]=zc;q["packages/core/src/ui/icons.ts"]=nl;q["packages/core/src/ui/link-bubble.ts"]=Jd;q["packages/core/src/ui/menu.ts"]=Od;q["packages/core/src/ui/popover.ts"]=Wd;q["packages/core/src/ui/views.ts"]=$d;q["packages/core/src/url.ts"]=Ca;})();
|
|
48
|
+
//# sourceMappingURL=tinymce.global.js.map
|