diff --git a/frontend/user-profile-wysiwyg-editor.js b/frontend/user-profile-wysiwyg-editor.js new file mode 100644 index 000000000..13a5612ca --- /dev/null +++ b/frontend/user-profile-wysiwyg-editor.js @@ -0,0 +1,339 @@ +import { Editor } from "@tiptap/core"; +import StarterKit from "@tiptap/starter-kit"; +import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight"; +import Underline from "@tiptap/extension-underline"; +import Link from "@tiptap/extension-link"; +import Table from "@tiptap/extension-table"; +import TableRow from "@tiptap/extension-table-row"; +import TableCell from "@tiptap/extension-table-cell"; +import TableHeader from "@tiptap/extension-table-header"; +import Image from "@tiptap/extension-image"; +import TaskList from "@tiptap/extension-task-list"; +import TaskItem from "@tiptap/extension-task-item"; +import { common, createLowlight } from "lowlight"; +import { toHtml } from "hast-util-to-html"; +import { marked } from "marked"; +import DOMPurify from "dompurify"; +import TurndownService from "turndown"; +import { gfm } from "turndown-plugin-gfm"; +import {handleKeyDown, handlePaste, createToolbarButton, ICONS, setupMermaidEditMode, debounce} from './wysiwyg-editor'; + +const lowlight = createLowlight(common); + +const editorInstances = new Map(); + +const buildToolbar = (editor, toolbarEl) => { + const left = document.createElement("div"); + left.className = "wysiwyg-toolbar__left"; + const right = document.createElement("div"); + right.className = "wysiwyg-toolbar__right"; + + + left.appendChild( + createToolbarButton(editor, { + label: "Bold", title: "Bold", html: "B", + onClick: () => editor.chain().focus().toggleBold().run(), + isActive: () => editor.isActive("bold"), + }) + ); + left.appendChild( + createToolbarButton(editor, { + label: "Italic", title: "Italic", html: "I", + onClick: () => editor.chain().focus().toggleItalic().run(), + isActive: () => editor.isActive("italic"), + }) + ); + left.appendChild( + createToolbarButton(editor, { + label: "Underline", title: "Underline", html: "U", + onClick: () => editor.chain().focus().toggleUnderline().run(), + isActive: () => editor.isActive("underline"), + }) + ); + + + left.appendChild( + createToolbarButton(editor, { + label: "Bullet list", title: "Bullet list", html: ICONS.bulletList, + onClick: () => editor.chain().focus().toggleBulletList().run(), + isActive: () => editor.isActive("bulletList"), + }) + ); + left.appendChild( + createToolbarButton(editor, { + label: "Ordered list", title: "Ordered list", html: ICONS.orderedList, + onClick: () => editor.chain().focus().toggleOrderedList().run(), + isActive: () => editor.isActive("orderedList"), + }) + ); + + + left.appendChild( + createToolbarButton(editor, { + label: "Link", title: "Insert link", html: ICONS.link, + onClick: async () => { + const result = await openModal("Insert Link", [ + { name: "url", label: "URL", type: "url", placeholder: "https://example.com" }, + ]); + if (!result || !result.url) return; + if (!isSafeUrl(result.url)) { + window.alert("Only http, https, and mailto URLs are allowed."); + return; + } + editor.chain().focus().setLink({ href: result.url }).run(); + }, + isActive: () => editor.isActive("link"), + }) + ); + + const handleDocClick = (e) => { + if (!tableWrapper.contains(e.target)) gridPopup.style.display = "none"; + }; + + const mdBtn = document.createElement("button"); + mdBtn.type = "button"; + mdBtn.className = "wysiwyg-toolbar__btn wysiwyg-toolbar__btn--md"; + mdBtn.setAttribute("aria-label", "Markdown"); + mdBtn.setAttribute("title", "Toggle Markdown mode"); + mdBtn.innerHTML = ICONS.markdown; + left.appendChild(mdBtn); + + const previewBtn = document.createElement("button"); + previewBtn.type = "button"; + previewBtn.className = "wysiwyg-toolbar__btn wysiwyg-toolbar__btn--preview-toggle"; + previewBtn.setAttribute("aria-label", "Preview"); + previewBtn.setAttribute("title", "Toggle preview"); + previewBtn.innerHTML = ICONS.preview; + previewBtn.style.display = "none"; + + right.appendChild(previewBtn); + right.appendChild( + createToolbarButton(editor, { + label: "Undo", title: "Undo", html: "↶", + onClick: () => editor.chain().focus().undo().run(), + isActive: () => false, + }) + ); + right.appendChild( + createToolbarButton(editor, { + label: "Redo", title: "Redo", html: "↷", + onClick: () => editor.chain().focus().redo().run(), + isActive: () => false, + }) + ); + + toolbarEl.appendChild(left); + toolbarEl.appendChild(right); + + return { mdBtn, previewBtn, handleDocClick }; +}; + +export const initWysiwyg = (textareaId) => { + const prev = editorInstances.get(textareaId); + if (prev) { + prev.editor.destroy(); + prev.cleanup(); + editorInstances.delete(textareaId); + } + + const textarea = document.getElementById(textareaId); + if (!textarea) return null; + const wrapper = textarea.closest('[data-wysiwyg="v3"]'); + if (!wrapper) return null; + + const toolbarEl = wrapper.querySelector(".wysiwyg-editor__toolbar"); + const editorEl = wrapper.querySelector(".wysiwyg-editor__body"); + if (!toolbarEl || !editorEl) return null; + + /* Ensure toolbar is empty and remove any previous table-context bar after re-init (e.g. Fill demo content) to avoid duplicate bars */ + toolbarEl.innerHTML = ""; + wrapper.querySelectorAll(".wysiwyg-table-context").forEach((el) => el.remove()); + + const rawContent = textarea.value ? textarea.value.trim() : ""; + const isHtml = rawContent.startsWith("<") && rawContent.includes(">"); + let initialContent = rawContent; + if (initialContent && !isHtml) { + try { + initialContent = parseMarkdownSafe(initialContent); + } catch (_) { + initialContent = rawContent; + } + } + + const editorRef = { current: null }; + const editor = new Editor({ + element: editorEl, + extensions: [ + StarterKit.configure({ codeBlock: false }), + Underline, + TaskList, + TaskItem.configure({ nested: true }), + ], + content: initialContent, + editorProps: { + attributes: { + class: "wysiwyg-editor__prose", + }, + handleKeyDown(view, event) { + if (event.key === "Tab") { + const { $from } = view.state.selection; + if ($from.parent.type.name === "codeBlock") { + event.preventDefault(); + editorRef.current?.chain().focus().insertContent("\t").run(); + return true; + } + } + return false; + }, + handlePaste(_view, event) { + const pastedText = event.clipboardData?.getData("text/plain") || ""; + if (!pastedText.trim() || !editorRef.current) return false; + const trimmed = pastedText.trim(); + const looksLikeMarkdown = + (!trimmed.startsWith("<") && + (/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(trimmed) || + /\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(pastedText))); + if (looksLikeMarkdown) { + try { + event.preventDefault(); + const html = parseMarkdownSafe(pastedText); + editorRef.current.chain().focus().insertContent(html).run(); + return true; + } catch (_) { + return false; + } + } + return false; + }, + }, + }); + editorRef.current = editor; + + const state = { mode: "wysiwyg", markdownText: "", previewOn: false }; + + const { mdBtn, previewBtn, handleDocClick } = buildToolbar(editor, toolbarEl); + setupMermaidEditMode(editor, editorEl); + + const markdownPane = document.createElement("div"); + markdownPane.className = "wysiwyg-editor__markdown-pane"; + markdownPane.style.display = "none"; + + const mdTextarea = document.createElement("textarea"); + mdTextarea.className = "wysiwyg-markdown__textarea"; + mdTextarea.setAttribute("aria-label", "Markdown source"); + mdTextarea.setAttribute("placeholder", "Write markdown here..."); + + const mdPreview = document.createElement("div"); + mdPreview.className = "wysiwyg-markdown__preview wysiwyg-editor__prose"; + + markdownPane.appendChild(mdTextarea); + markdownPane.appendChild(mdPreview); + editorEl.after(markdownPane); + + const previewEl = document.createElement("div"); + previewEl.className = "wysiwyg-editor__preview wysiwyg-editor__prose"; + previewEl.style.display = "none"; + markdownPane.after(previewEl); + + const updateMdPreview = () => { + mdPreview.innerHTML = parseMarkdownSafe(state.markdownText); + highlightPreviewCodeBlocks(mdPreview); + renderMermaidPreview(mdPreview); + }; + const debouncedMdPreview = debounce(updateMdPreview, 300); + + mdTextarea.addEventListener("input", () => { + state.markdownText = mdTextarea.value; + debouncedMdPreview(); + }); + + mdBtn.addEventListener("click", (e) => { + e.preventDefault(); + if (state.mode === "wysiwyg") { + state.markdownText = turndown.turndown(editor.getHTML()); + state.mode = "markdown"; + state.previewOn = false; + mdBtn.classList.add("wysiwyg-toolbar__btn--active"); + toolbarEl.classList.add("wysiwyg-editor__toolbar--markdown"); + editorEl.style.display = "none"; + markdownPane.style.display = ""; + previewEl.style.display = "none"; + previewBtn.style.display = ""; + previewBtn.classList.remove("wysiwyg-toolbar__btn--active"); + mdTextarea.value = state.markdownText; + updateMdPreview(); + mdTextarea.focus(); + } else { + editor.commands.setContent(parseMarkdownSafe(state.markdownText)); + state.mode = "wysiwyg"; + state.previewOn = false; + mdBtn.classList.remove("wysiwyg-toolbar__btn--active"); + toolbarEl.classList.remove("wysiwyg-editor__toolbar--markdown"); + editorEl.style.display = ""; + markdownPane.style.display = "none"; + previewEl.style.display = "none"; + previewBtn.style.display = "none"; + previewBtn.classList.remove("wysiwyg-toolbar__btn--active"); + } + }); + + previewBtn.addEventListener("click", (e) => { + e.preventDefault(); + state.previewOn = !state.previewOn; + previewBtn.classList.toggle("wysiwyg-toolbar__btn--active", state.previewOn); + if (state.previewOn) { + markdownPane.style.display = "none"; + previewEl.style.display = ""; + previewEl.innerHTML = parseMarkdownSafe(state.markdownText); + highlightPreviewCodeBlocks(previewEl); + renderMermaidPreview(previewEl); + } else { + markdownPane.style.display = ""; + previewEl.style.display = "none"; + } + }); + + textarea.style.position = "absolute"; + textarea.style.left = "-9999px"; + textarea.style.width = "1px"; + textarea.style.height = "1px"; + textarea.setAttribute("aria-hidden", "true"); + textarea.tabIndex = -1; + + const form = wrapper.closest("form"); + const syncTextarea = () => { + if (state.mode === "markdown") { + textarea.value = state.markdownText; + } else { + textarea.value = turndown.turndown(editor.getHTML()); + } + }; + if (form) { + form.addEventListener("submit", syncTextarea, true); + } + + editorInstances.set(textareaId, { + editor, + cleanup: () => { + document.removeEventListener("click", handleDocClick); + if (form) form.removeEventListener("submit", syncTextarea, true); + }, + }); + return editor; +}; + +const autoInit = () => { + if (typeof document === "undefined" || !document.querySelector) return; + document.querySelectorAll('[data-wysiwyg="v3"]').forEach((wrapper) => { + const ta = wrapper.querySelector("textarea[id]"); + if (ta && ta.id) initWysiwyg(ta.id); + }); +}; + +if (typeof document !== "undefined") { + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", autoInit); + } else { + autoInit(); + } +} diff --git a/frontend/wysiwyg-editor.js b/frontend/wysiwyg-editor.js index 403e2aa38..4fe4a9fc3 100644 --- a/frontend/wysiwyg-editor.js +++ b/frontend/wysiwyg-editor.js @@ -186,7 +186,7 @@ const getMermaid = async () => { return mermaidModule; }; -const debounce = (fn, ms) => { +export const debounce = (fn, ms) => { let timer; return (...args) => { clearTimeout(timer); @@ -194,7 +194,7 @@ const debounce = (fn, ms) => { }; }; -const createToolbarButton = (editor, opts) => { +export const createToolbarButton = (editor, opts) => { const { label, onClick, isActive, title } = opts; const btn = document.createElement("button"); btn.type = "button"; @@ -261,7 +261,7 @@ const createHeadingDropdown = (editor) => { return select; }; -const ICONS = { +export const ICONS = { bulletList: '', orderedList: @@ -604,7 +604,7 @@ const buildToolbar = (editor, toolbarEl) => { return { mdBtn, previewBtn, handleDocClick }; }; -const setupMermaidEditMode = (editor, editorEl) => { +export const setupMermaidEditMode = (editor, editorEl) => { const renderMermaid = debounce(async () => { const pres = editorEl.querySelectorAll("pre"); const activePreviews = new Set(); diff --git a/package.json b/package.json index b50df1a35..f00c31068 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "builddocs": "NODE_ENV=production tailwindcss -c ./docstailwind.config.js -i frontend/docsstyles.css -o static/css/docsstyles.css --minify", "builduserguide": "NODE_ENV=production tailwindcss -c ./userguidetailwind.config.js -i frontend/userguidestyles.css -o static/css/userguidestyles.css --minify", "build:wysiwyg": "esbuild frontend/wysiwyg-editor.js --bundle --minify --format=esm --outfile=static/js/v3/wysiwyg-editor.js --external:mermaid", + "build:up-wysiwyg": "esbuild frontend/user-profile-wysiwyg-editor.js --bundle --minify --format=esm --outfile=static/js/v3/user-profile-wysiwyg-editor.js --external:mermaid", "build:fuse": "esbuild frontend/fuse-entry.js --bundle --minify --format=iife --outfile=static/js/v3/fuse.min.js" }, "dependencies": { diff --git a/static/css/v3/avatar.css b/static/css/v3/avatar.css index d26beacd2..8efb2f407 100644 --- a/static/css/v3/avatar.css +++ b/static/css/v3/avatar.css @@ -3,6 +3,7 @@ --avatar-size-md: 40px; --avatar-size-lg: 44px; --avatar-size-xl: 48px; + --avatar-size-xxxl: 112px; } /* Mobile avatar size overrides */ @@ -48,6 +49,11 @@ height: var(--avatar-size-xl); } +.avatar.avatar--xxxl { + width: var(--avatar-size-xxxl); + height: var(--avatar-size-xxxl); +} + /* Image inside avatar container: fill and cover so it's contained and cropped */ .avatar img.avatar__img { width: 100%; diff --git a/static/css/v3/buttons.css b/static/css/v3/buttons.css index 689467e03..4c33da5e0 100644 --- a/static/css/v3/buttons.css +++ b/static/css/v3/buttons.css @@ -133,6 +133,10 @@ color: var(--color-text-error); } +.btn-underline { + text-decoration: underline; +} + .btn-hero { min-height: 48px; padding: var(--space-medium) var(--space-xl) var(--space-medium) diff --git a/static/css/v3/forms.css b/static/css/v3/forms.css index abe4fdbeb..bbfbc67ab 100644 --- a/static/css/v3/forms.css +++ b/static/css/v3/forms.css @@ -139,6 +139,10 @@ color: var(--color-text-tertiary, #6b6d78); } +.field__checkbox__help { + margin-top: var(--space-default); +} + .field__error { margin: 0; padding: 0; @@ -230,17 +234,17 @@ .dropdown__trigger { display: flex; align-items: center; - gap: var(--space-default, 8px); + gap: var(--space-default); width: 100%; height: 40px; - padding: 0 var(--space-large, 16px); - background-color: var(--color-surface-weak, #fff); - border: 1px solid var(--color-stroke-weak, #0508161a); - border-radius: var(--border-radius-xl, 12px); + padding: 0 var(--space-large); + background-color: var(--color-surface-weak); + border: 1px solid var(--color-stroke-weak); + border-radius: var(--border-radius-xl); font-family: var(--font-sans); - font-size: var(--font-size-small, 14px); - font-weight: var(--font-weight-regular, 400); - color: var(--color-text-primary, #050816); + font-size: var(--font-size-small); + font-weight: var(--font-weight-regular); + color: var(--color-text-primary); cursor: pointer; transition: background-color 0.15s ease, @@ -249,15 +253,15 @@ } .dropdown__trigger:hover { - border-color: var(--color-stroke-mid, #0508162b); + border-color: var(--color-stroke-mid); } .dropdown__trigger:hover .dropdown__trigger-placeholder { - color: var(--color-text-link-accent, #00778b); + color: var(--color-text-link-accent); } .dropdown__trigger:focus { - background-color: var(--color-surface-mid, #f7f7f8); + background-color: var(--color-surface-mid); border-color: var(--color-stroke-weak); } @@ -279,7 +283,7 @@ } .dropdown__trigger-placeholder { - color: var(--color-text-secondary, #6b6d78); + color: var(--color-text-secondary); } .dropdown__chevron { @@ -301,12 +305,18 @@ } .dropdown--open .dropdown__trigger { - background-color: var(--color-surface-mid, #f7f7f8); + background-color: var(--color-surface-mid); border-color: var(--color-stroke-weak); border-bottom-left-radius: 0; border-bottom-right-radius: 0; } +.dropdown--disabled .dropdown__trigger{ + color: var(--color-text-tertiary); + background: var(--color-surface-mid); + cursor: not-allowed; +} + /* Combo: trigger when open shows search row; same active look */ .dropdown--combo.dropdown--open .dropdown__trigger, .dropdown__trigger--active { @@ -610,7 +620,7 @@ border-color 0.1s ease; } -.checkbox__input:checked + .checkbox__box { +.checkbox__input:checked+.checkbox__box { background-color: var(--color-surface-strong, #efeff1); border-color: var(--color-text-primary, #050816); } @@ -623,11 +633,11 @@ transition: opacity 0.1s ease; } -.checkbox__input:checked + .checkbox__box .checkbox__check { +.checkbox__input:checked+.checkbox__box .checkbox__check { opacity: 1; } -.checkbox__input:focus-visible + .checkbox__box { +.checkbox__input:focus-visible+.checkbox__box { outline: 2px solid var(--color-stroke-link-accent, #0077b8); outline-offset: 2px; } @@ -646,6 +656,12 @@ cursor: not-allowed; } +.checkbox__multi-checkbox-column { + display: flex; + flex-direction: column; + gap: var(--space-xl); +} + /* ========== Textarea variant ========== */ .field--textarea .field__control--textarea { min-height: 120px; @@ -728,6 +744,7 @@ min-width: 180px; max-width: 280px; } + .field--file-narrow .field__input--file { flex: 0 1 auto; } diff --git a/static/css/v3/user-profile-page.css b/static/css/v3/user-profile-page.css index bb622c35a..72fa96ee6 100644 --- a/static/css/v3/user-profile-page.css +++ b/static/css/v3/user-profile-page.css @@ -4,11 +4,6 @@ padding: 0 var(--space-medium); } -.user-profile__container .btn { - width: fit-content; - min-width: unset; - padding: var(--space-default) var(--space-large); -} /* ──────── Header row, including profile card and buttons ──────── */ @@ -31,6 +26,12 @@ justify-content: flex-end; } +.user-profile__button-group .btn { + width: fit-content; + min-width: unset; + padding: var(--space-default) var(--space-large); +} + .user-profile__btn-no-label { min-width: fit-content; padding: var(--space-default) var(--space-large) @@ -65,7 +66,100 @@ line-height: var(--line-height-relaxed); } +/* ──────── Edit Page Styling ──────── */ + +.user-profile__two-column-inputs { + display: grid; + grid-template-columns: repeat(2, 1fr); + width: 100%; + gap: var(--space-default); + row-gap: var(--space-large); +} + +.user-profile__small-section-heading { + color: var(--color-text-primary); + font-family: var(--font-sans); + font-size: var(--font-size-small); + font-weight: var(--font-weight-medium); + line-height: var(--line-height-relaxed); + letter-spacing: var(--letter-spacing-tight); +} + +.user-profile__small-section-subheading { + color: var(--color-text-secondary); + font-family: var(--font-sans); + font-size: var(--font-size-small); + font-weight: var(--font-weight-regular); + line-height: var(--line-height-relaxed); + letter-spacing: var(--letter-spacing-tight); +} + +.user-profile__default-space-col { + display: flex; + flex-direction: column; + gap: var(--space-default); + width: 100%; +} + +.user-profile__xl-space-col { + display: flex; + flex-direction: column; + gap: var(--space-xl); + width: 100%; +} + +.user-profile__default-space-col .btn { + width: fit-content; +} + +.user-profile__profile-edit-card .card__hr:not(:first-of-type):not(:last-of-type) { + margin: var(--space-default) 0 +} + +.user-profile__badge-select { + padding: 6px; + display: flex; + gap: var(--space-s); + align-items: center; + height: fit-content; + color: var(--color-text-tertiary); + font-family: var(--font-sans); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-regular); + line-height: var(--line-height-tight); + letter-spacing: var(--letter-spacing-tight); +} + +.user-profile__commit-email-form { + width: 100%; + display: grid; + grid-template-columns: 1fr auto; + align-items: end; + gap: var(--space-default); +} + +.user-profile__commit-email-form .btn { + height: 40px; + min-width: unset; + padding-left: var(--space-large); + padding-right: var(--space-large); +} + +.user-profile__avatar-row { + display: flex; + gap: var(--space-default); +} + +.user-profile__avatar-row .user-profile__default-space-col { + width: fit-content; +} + +.user-profile__avatar-row .user-profile__default-space-col .btn { + width: 100%; +} + @media (max-width: 768px) { + /* ──────── Stack header row on mobile ──────── */ .user-profile__profile-card-row { flex-direction: column; @@ -90,16 +184,60 @@ display: contents; } - .user-profile__bio { order: 1; } - .user-profile__achievements { order: 2; } - .user-profile__badges { order: 3; } - .user-profile__github { order: 4; } - .user-profile__posts { order: 5; } - .user-profile__mailing-list { order: 6; } - .user-profile__connections { order: 7; } + .user-profile__bio { + order: 1; + } + + .user-profile__achievements { + order: 2; + } + + .user-profile__badges { + order: 3; + } + + .user-profile__github { + order: 4; + } + + .user-profile__posts { + order: 5; + } + + .user-profile__mailing-list { + order: 6; + } + + .user-profile__connections { + order: 7; + } + + .user-profile__profile-edit-card { + order: 1; + } + + .user-profile-edit__connections-card { + order: 2; + } + + .user-profile__update-details { + order:3; + } + + .user-profile__commit-email-card { + order: 4; + } + + .user-profile__email-preferences-card { + order: 5; + } + + .user-profile__delete-account { + order: 6; + } } -@media (769px <= width < 1280px) { +@media (769px <=width < 1280px) { .user-profile__button-group { align-self: end; width: 528px; diff --git a/static/css/v3/wysiwyg-editor.css b/static/css/v3/wysiwyg-editor.css index 3d08df26b..2712243d1 100644 --- a/static/css/v3/wysiwyg-editor.css +++ b/static/css/v3/wysiwyg-editor.css @@ -715,3 +715,7 @@ background-color: var(--color-surface-brand-accent-default, #f7f7f8) !important; .wysiwyg-modal__btn--insert:hover { background: var(--color-surface-brand-accent-hovered, #FFA000BF); } + +.wysiwyg-v3 > .field__help { + margin-top: var(--space-default); +} diff --git a/static/js/v3/user-profile-wysiwyg-editor.js b/static/js/v3/user-profile-wysiwyg-editor.js new file mode 100644 index 000000000..41829e9de --- /dev/null +++ b/static/js/v3/user-profile-wysiwyg-editor.js @@ -0,0 +1,252 @@ +var xE=Object.create;var Pa=Object.defineProperty;var _E=Object.getOwnPropertyDescriptor;var TE=Object.getOwnPropertyNames;var CE=Object.getPrototypeOf,AE=Object.prototype.hasOwnProperty;var NE=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vE=(t,e)=>{for(var n in e)Pa(t,n,{get:e[n],enumerable:!0})},ME=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of TE(e))!AE.call(t,i)&&i!==n&&Pa(t,i,{get:()=>e[i],enumerable:!(r=_E(e,i))||r.enumerable});return t};var OE=(t,e,n)=>(n=t!=null?xE(CE(t)):{},ME(e||!t||!t.__esModule?Pa(n,"default",{value:t,enumerable:!0}):n,t));var Db=NE((kI,Ib)=>{function wb(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&wb(n)}),t}var oa=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Sb(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function $n(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var wC="",mb=t=>!!t.scope,SC=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},gu=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Sb(e)}openNode(e){if(!mb(e))return;let n=SC(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){mb(e)&&(this.buffer+=wC)}value(){return this.buffer}span(e){this.buffer+=``}},gb=(t={})=>{let e={children:[]};return Object.assign(e,t),e},bu=class t{constructor(){this.rootNode=gb(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=gb({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},yu=class extends bu{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new gu(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function $i(t){return t?typeof t=="string"?t:t.source:null}function xb(t){return mr("(?=",t,")")}function xC(t){return mr("(?:",t,")*")}function _C(t){return mr("(?:",t,")?")}function mr(...t){return t.map(n=>$i(n)).join("")}function TC(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ku(...t){return"("+(TC(t).capture?"":"?:")+t.map(r=>$i(r)).join("|")+")"}function _b(t){return new RegExp(t.toString()+"|").exec("").length-1}function CC(t,e){let n=t&&t.exec(e);return n&&n.index===0}var AC=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function wu(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=$i(r),s="";for(;o.length>0;){let a=AC.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var NC=/\b\B/,Tb="[a-zA-Z]\\w*",Su="[a-zA-Z_]\\w*",Cb="\\b\\d+(\\.\\d+)?",Ab="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Nb="\\b(0b[01]+)",vC="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",MC=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=mr(e,/.*\b/,t.binary,/\b.*/)),$n({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Hi={begin:"\\\\[\\s\\S]",relevance:0},OC={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Hi]},RC={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Hi]},IC={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},aa=function(t,e,n={}){let r=$n({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=ku("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:mr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},DC=aa("//","$"),LC=aa("/\\*","\\*/"),PC=aa("#","$"),BC={scope:"number",begin:Cb,relevance:0},zC={scope:"number",begin:Ab,relevance:0},FC={scope:"number",begin:Nb,relevance:0},UC={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Hi,{begin:/\[/,end:/\]/,relevance:0,contains:[Hi]}]},$C={scope:"title",begin:Tb,relevance:0},HC={scope:"title",begin:Su,relevance:0},WC={begin:"\\.\\s*"+Su,relevance:0},KC=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},ia=Object.freeze({__proto__:null,APOS_STRING_MODE:OC,BACKSLASH_ESCAPE:Hi,BINARY_NUMBER_MODE:FC,BINARY_NUMBER_RE:Nb,COMMENT:aa,C_BLOCK_COMMENT_MODE:LC,C_LINE_COMMENT_MODE:DC,C_NUMBER_MODE:zC,C_NUMBER_RE:Ab,END_SAME_AS_BEGIN:KC,HASH_COMMENT_MODE:PC,IDENT_RE:Tb,MATCH_NOTHING_RE:NC,METHOD_GUARD:WC,NUMBER_MODE:BC,NUMBER_RE:Cb,PHRASAL_WORDS_MODE:IC,QUOTE_STRING_MODE:RC,REGEXP_MODE:UC,RE_STARTERS_RE:vC,SHEBANG:MC,TITLE_MODE:$C,UNDERSCORE_IDENT_RE:Su,UNDERSCORE_TITLE_MODE:HC});function GC(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function VC(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function qC(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=GC,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function jC(t,e){Array.isArray(t.illegal)&&(t.illegal=ku(...t.illegal))}function YC(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function JC(t,e){t.relevance===void 0&&(t.relevance=1)}var ZC=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=mr(n.beforeMatch,xb(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},XC=["of","and","for","in","not","or","if","then","parent","list","value"],QC="keyword";function vb(t,e,n=QC){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,vb(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[o,eA(l[0],l[1])]})}}function eA(t,e){return e?Number(e):tA(t)?0:1}function tA(t){return XC.includes(t.toLowerCase())}var bb={},hr=t=>{console.error(t)},yb=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Yr=(t,e)=>{bb[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),bb[`${t}/${e}`]=!0)},sa=new Error;function Mb(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=_b(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function nA(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw hr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),sa;if(typeof t.beginScope!="object"||t.beginScope===null)throw hr("beginScope must be object"),sa;Mb(t,t.begin,{key:"beginScope"}),t.begin=wu(t.begin,{joinWith:""})}}function rA(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw hr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),sa;if(typeof t.endScope!="object"||t.endScope===null)throw hr("endScope must be object"),sa;Mb(t,t.end,{key:"endScope"}),t.end=wu(t.end,{joinWith:""})}}function iA(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function oA(t){iA(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),nA(t),rA(t)}function sA(t){function e(s,a){return new RegExp($i(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=_b(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(wu(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){let a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){let l=s;if(s.isCompiled)return l;[VC,YC,oA,ZC].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[qC,jC,JC].forEach(u=>u(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=vb(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=$i(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return aA(u==="self"?s:u)})),s.contains.forEach(function(u){o(u,l)}),s.starts&&o(s.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=$n(t.classNameAliases||{}),o(t)}function Ob(t){return t?t.endsWithParent||Ob(t.starts):!1}function aA(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return $n(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Ob(t)?$n(t,{starts:t.starts?$n(t.starts):null}):Object.isFrozen(t)?$n(t):t}var lA="11.11.1",Eu=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},mu=Sb,Eb=$n,kb=Symbol("nomatch"),cA=7,Rb=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:yu};function l(x){return a.noHighlightRe.test(x)}function c(x){let E=x.className+" ";E+=x.parentNode?x.parentNode.className:"";let S=a.languageDetectRe.exec(E);if(S){let B=L(S[1]);return B||(yb(o.replace("{}",S[1])),yb("Falling back to no-highlight mode for this block.",x)),B?S[1]:"no-highlight"}return E.split(/\s+/).find(B=>l(B)||L(B))}function u(x,E,S){let B="",H="";typeof E=="object"?(B=x,S=E.ignoreIllegals,H=E.language):(Yr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Yr("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),H=x,B=E),S===void 0&&(S=!0);let $={code:B,language:H};ge("before:highlight",$);let ie=$.result?$.result:d($.language,$.code,S);return ie.code=$.code,ge("after:highlight",ie),ie}function d(x,E,S,B){let H=Object.create(null);function $(D,w){return D.keywords[w]}function ie(){if(!K.keywords){Se.addText(X);return}let D=0;K.keywordPatternRe.lastIndex=0;let w=K.keywordPatternRe.exec(X),N="";for(;w;){N+=X.substring(D,w.index);let z=ve.case_insensitive?w[0].toLowerCase():w[0],Z=$(K,z);if(Z){let[be,Et]=Z;if(Se.addText(N),N="",H[z]=(H[z]||0)+1,H[z]<=cA&&(ce+=Et),be.startsWith("_"))N+=w[0];else{let Cn=ve.classNameAliases[be]||be;J(w[0],Cn)}}else N+=w[0];D=K.keywordPatternRe.lastIndex,w=K.keywordPatternRe.exec(X)}N+=X.substring(D),Se.addText(N)}function oe(){if(X==="")return;let D=null;if(typeof K.subLanguage=="string"){if(!e[K.subLanguage]){Se.addText(X);return}D=d(K.subLanguage,X,!0,Y[K.subLanguage]),Y[K.subLanguage]=D._top}else D=p(X,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(ce+=D.relevance),Se.__addSublanguage(D._emitter,D.language)}function Ae(){K.subLanguage!=null?oe():ie(),X=""}function J(D,w){D!==""&&(Se.startScope(w),Se.addText(D),Se.endScope())}function Ne(D,w){let N=1,z=w.length-1;for(;N<=z;){if(!D._emit[N]){N++;continue}let Z=ve.classNameAliases[D[N]]||D[N],be=w[N];Z?J(be,Z):(X=be,ie(),X=""),N++}}function Nt(D,w){return D.scope&&typeof D.scope=="string"&&Se.openNode(ve.classNameAliases[D.scope]||D.scope),D.beginScope&&(D.beginScope._wrap?(J(X,ve.classNameAliases[D.beginScope._wrap]||D.beginScope._wrap),X=""):D.beginScope._multi&&(Ne(D.beginScope,w),X="")),K=Object.create(D,{parent:{value:K}}),K}function Ke(D,w,N){let z=CC(D.endRe,N);if(z){if(D["on:end"]){let Z=new oa(D);D["on:end"](w,Z),Z.isMatchIgnored&&(z=!1)}if(z){for(;D.endsParent&&D.parent;)D=D.parent;return D}}if(D.endsWithParent)return Ke(D.parent,w,N)}function nn(D){return K.matcher.regexIndex===0?(X+=D[0],1):(_t=!0,0)}function rn(D){let w=D[0],N=D.rule,z=new oa(N),Z=[N.__beforeBegin,N["on:begin"]];for(let be of Z)if(be&&(be(D,z),z.isMatchIgnored))return nn(w);return N.skip?X+=w:(N.excludeBegin&&(X+=w),Ae(),!N.returnBegin&&!N.excludeBegin&&(X=w)),Nt(N,D),N.returnBegin?0:w.length}function _n(D){let w=D[0],N=E.substring(D.index),z=Ke(K,D,N);if(!z)return kb;let Z=K;K.endScope&&K.endScope._wrap?(Ae(),J(w,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Ae(),Ne(K.endScope,D)):Z.skip?X+=w:(Z.returnEnd||Z.excludeEnd||(X+=w),Ae(),Z.excludeEnd&&(X=w));do K.scope&&Se.closeNode(),!K.skip&&!K.subLanguage&&(ce+=K.relevance),K=K.parent;while(K!==z.parent);return z.starts&&Nt(z.starts,D),Z.returnEnd?0:w.length}function Tn(){let D=[];for(let w=K;w!==ve;w=w.parent)w.scope&&D.unshift(w.scope);D.forEach(w=>Se.openNode(w))}let ot={};function gt(D,w){let N=w&&w[0];if(X+=D,N==null)return Ae(),0;if(ot.type==="begin"&&w.type==="end"&&ot.index===w.index&&N===""){if(X+=E.slice(w.index,w.index+1),!i){let z=new Error(`0 width match regex (${x})`);throw z.languageName=x,z.badRule=ot.rule,z}return 1}if(ot=w,w.type==="begin")return rn(w);if(w.type==="illegal"&&!S){let z=new Error('Illegal lexeme "'+N+'" for mode "'+(K.scope||"")+'"');throw z.mode=K,z}else if(w.type==="end"){let z=_n(w);if(z!==kb)return z}if(w.type==="illegal"&&N==="")return X+=` +`,1;if(st>1e5&&st>w.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=N,N.length}let ve=L(x);if(!ve)throw hr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let ee=sA(ve),bt="",K=B||ee,Y={},Se=new a.__emitter(a);Tn();let X="",ce=0,yt=0,st=0,_t=!1;try{if(ve.__emitTokens)ve.__emitTokens(E,Se);else{for(K.matcher.considerAll();;){st++,_t?_t=!1:K.matcher.considerAll(),K.matcher.lastIndex=yt;let D=K.matcher.exec(E);if(!D)break;let w=E.substring(yt,D.index),N=gt(w,D);yt=D.index+N}gt(E.substring(yt))}return Se.finalize(),bt=Se.toHTML(),{language:x,value:bt,relevance:ce,illegal:!1,_emitter:Se,_top:K}}catch(D){if(D.message&&D.message.includes("Illegal"))return{language:x,value:mu(E),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:yt,context:E.slice(yt-100,yt+100),mode:D.mode,resultSoFar:bt},_emitter:Se};if(i)return{language:x,value:mu(E),illegal:!1,relevance:0,errorRaised:D,_emitter:Se,_top:K};throw D}}function f(x){let E={value:mu(x),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return E._emitter.addText(x),E}function p(x,E){E=E||a.languages||Object.keys(e);let S=f(x),B=E.filter(L).filter(fe).map(Ae=>d(Ae,x,!1));B.unshift(S);let H=B.sort((Ae,J)=>{if(Ae.relevance!==J.relevance)return J.relevance-Ae.relevance;if(Ae.language&&J.language){if(L(Ae.language).supersetOf===J.language)return 1;if(L(J.language).supersetOf===Ae.language)return-1}return 0}),[$,ie]=H,oe=$;return oe.secondBest=ie,oe}function h(x,E,S){let B=E&&n[E]||S;x.classList.add("hljs"),x.classList.add(`language-${B}`)}function m(x){let E=null,S=c(x);if(l(S))return;if(ge("before:highlightElement",{el:x,language:S}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new Eu("One of your code blocks includes unescaped HTML.",x.innerHTML);E=x;let B=E.textContent,H=S?u(B,{language:S,ignoreIllegals:!0}):p(B);x.innerHTML=H.value,x.dataset.highlighted="yes",h(x,S,H.language),x.result={language:H.language,re:H.relevance,relevance:H.relevance},H.secondBest&&(x.secondBest={language:H.secondBest.language,relevance:H.secondBest.relevance}),ge("after:highlightElement",{el:x,result:H,text:B})}function g(x){a=Eb(a,x)}let b=()=>{_(),Yr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){_(),Yr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let C=!1;function _(){function x(){_()}if(document.readyState==="loading"){C||window.addEventListener("DOMContentLoaded",x,!1),C=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function T(x,E){let S=null;try{S=E(t)}catch(B){if(hr("Language definition for '{}' could not be registered.".replace("{}",x)),i)hr(B);else throw B;S=s}S.name||(S.name=x),e[x]=S,S.rawDefinition=E.bind(null,t),S.aliases&&F(S.aliases,{languageName:x})}function I(x){delete e[x];for(let E of Object.keys(n))n[E]===x&&delete n[E]}function v(){return Object.keys(e)}function L(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function F(x,{languageName:E}){typeof x=="string"&&(x=[x]),x.forEach(S=>{n[S.toLowerCase()]=E})}function fe(x){let E=L(x);return E&&!E.disableAutodetect}function le(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=E=>{x["before:highlightBlock"](Object.assign({block:E.el},E))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=E=>{x["after:highlightBlock"](Object.assign({block:E.el},E))})}function Ee(x){le(x),r.push(x)}function De(x){let E=r.indexOf(x);E!==-1&&r.splice(E,1)}function ge(x,E){let S=x;r.forEach(function(B){B[S]&&B[S](E)})}function pe(x){return Yr("10.7.0","highlightBlock will be removed entirely in v12.0"),Yr("10.7.0","Please use highlightElement now."),m(x)}Object.assign(t,{highlight:u,highlightAuto:p,highlightAll:_,highlightElement:m,highlightBlock:pe,configure:g,initHighlighting:b,initHighlightingOnLoad:k,registerLanguage:T,unregisterLanguage:I,listLanguages:v,getLanguage:L,registerAliases:F,autoDetection:fe,inherit:Eb,addPlugin:Ee,removePlugin:De}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=lA,t.regex={concat:mr,lookahead:xb,either:ku,optional:_C,anyNumberOfTimes:xC};for(let x in ia)typeof ia[x]=="object"&&wb(ia[x]);return Object.assign(t,ia),t},Jr=Rb({});Jr.newInstance=()=>Rb({});Ib.exports=Jr;Jr.HighlightJS=Jr;Jr.default=Jr});function Ze(t){this.content=t}Ze.prototype={constructor:Ze,find:function(t){for(var e=0;e>1}};Ze.from=function(t){if(t instanceof Ze)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ze(e)};var Ba=Ze;function Ld(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Ld(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Pd(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;ce&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new t(r,i)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new t(i,o)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?ao(n+1,o):ao(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new t(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};ue.none=[];var Vn=class extends Error{},P=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=zd(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Bd(this.content,e+this.openStart,n+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,n){if(!n)return t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new t(e,r,i)}};P.empty=new P(A.empty,0,0);function Bd(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Bd(o.content,e-i-1,n-i-1)))}function zd(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=zd(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}function RE(t,e,n){if(n.openStart>t.depth)throw new Vn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Vn("Inconsistent open depths");return Fd(t,e,n,0)}function Fd(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ti(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Kn(t.nodeAfter,r),o++));for(let a=o;ai&&Ua(t,e,i+1),s=r.depth>i&&Ua(n,r,i+1),a=[];return ti(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Ud(o,s),Kn(Gn(o,$d(t,e,n,r,i+1)),a)):(o&&Kn(Gn(o,uo(t,e,i+1)),a),ti(e,n,i,a),s&&Kn(Gn(s,uo(n,r,i+1)),a)),ti(r,null,i,a),new A(a)}function uo(t,e,n){let r=[];if(ti(null,t,n,r),t.depth>n){let i=Ua(t,e,n+1);Kn(Gn(i,uo(t,e,n+1)),r)}return ti(e,null,n,r),new A(r)}function IE(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(A.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var fo=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new qn(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=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new t(n,r,o)}static resolveCached(e,n){let r=Cd.get(e);if(r)for(let o=0;oe&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Hd(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=A.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};vt.prototype.text=void 0;var Ha=class t extends vt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Hd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var jn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Wa(e,n);if(r.next==null)return t.empty;let i=Wd(r);r.next&&r.err("Unexpected trailing text");let o=HE($E(i));return WE(o,r),o}matchType(e){for(let n=0;nc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(` +`)}};jn.empty=new jn(!0);var Wa=class{constructor(e,n){this.string=e,this.nodeTypes=n,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 Wd(t){let e=[];do e.push(PE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function PE(t){let e=[];do e.push(BE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function BE(t){let e=UE(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=zE(t,e);else break;return e}function Ad(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function zE(t,e){let n=Ad(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ad(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function FE(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UE(t){if(t.eat("(")){let e=Wd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=FE(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $E(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new jn(r.indexOf(t.length-1)>-1);for(let s=0;s-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:Vd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vt(this,this.computeAttrs(e),A.from(n),ue.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new vt(this,this.computeAttrs(e),n,ue.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(A.empty,!0);return o?new vt(this,e,n.append(o),ue.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new t(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function KE(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}var Ka=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?KE(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},ri=class t{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=jd(e,i.attrs),this.excluded=null;let o=Gd(this.attrs);this.instance=o?new ue(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ue(this,Vd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new t(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}},ii=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ba.from(e.nodes),n.marks=Ba.from(e.marks||{}),this.nodes=po.compile(this.spec.nodes,this),this.marks=ri.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=jn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?vd(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:vd(this,s.split(" "))}this.nodeFromJSON=i=>vt.fromJSON(this,i),this.markFromJSON=i=>ue.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof po){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Ha(r,r.defaultAttrs,e,ue.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function vd(t,e){let n=[];for(let r=0;r-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function GE(t){return t.tag!=null}function VE(t){return t.style!=null}var ln=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(GE(i))this.tags.push(i);else if(VE(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new ho(this,n,!1);return r.addAll(e,ue.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new ho(this,n,!0);return r.addAll(e,ue.none,n.from,n.to),P.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=Od(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Od(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},Yd={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},qE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Jd={ol:!0,ul:!0},oi=1,Ga=2,ni=4;function Md(t,e,n){return e!=null?(e?oi:0)|(e==="full"?Ga:0):t&&t.whitespace=="pre"?oi|Ga:n&~ni}var Tr=class{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=ue.none,this.match=o||(s&ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&oi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Yd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ho=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Md(null,n.preserveWhitespace,0)|(r?ni:0);i?o=new Tr(i.type,i.attrs,ue.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Tr(null,null,ue.none,!0,null,s):o=new Tr(e.schema.topNodeType,null,ue.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&Ga?"full":this.localPreserveWS||(i.options&oi)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,` +`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s(s.type?s.type.allowsMarkType(c.type):Rd(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Tr(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=oi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function jE(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Jd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function YE(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Od(t){let e={};for(let n in t)e[n]=t[n];return e}function Rd(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l{if(o.length||s.marks.length){let a=0,l=0;for(;a=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&lo(Fa(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return lo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Id(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Id(e.marks)}};function Id(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Fa(t){return t.document||window.document}var Dd=new WeakMap;function JE(t){let e=Dd.get(t);return e===void 0&&Dd.set(t,e=ZE(t)),e}function ZE(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;du)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=lo(t,f,n,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}var Qd=65535,ef=Math.pow(2,16);function XE(t,e){return t+e*ef}function Zd(t){return t&Qd}function QE(t){return(t-(t&Qd))/ef}var tf=1,nf=2,mo=4,rf=8,li=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&rf)>0}get deletedBefore(){return(this.delInfo&(tf|mo))>0}get deletedAfter(){return(this.delInfo&(nf|mo))>0}get deletedAcross(){return(this.delInfo&mo)>0}},un=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Zd(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[a+o],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,p=l+i+(f<0?0:u);if(r)return p;let h=e==(n<0?l:d)?null:XE(a/3,e-l),m=e==l?nf:e==d?tf:mo;return(n<0?e!=l:e!=d)&&(m|=rf),new li(p,m,h)}i+=u-c}return r?e+i:new li(e+i,0,null)}touches(e,n){let r=0,i=Zd(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Ve.fromReplace(e,this.from,this.to,o)}invert(){return new Yn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Ue.jsonID("addMark",ui);var Yn=class t extends Ue{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new P(Za(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ve.fromReplace(e,this.from,this.to,r)}invert(){return new ui(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Ue.jsonID("removeMark",Yn);var di=class t extends Ue{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ve.fromReplace(e,this.pos,this.pos+1,new P(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,P.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ue.jsonID("replaceAround",Pe);function Ya(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function ek(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,n),h=r.addToSet(d);for(let m=0;mt.step(l)),o.forEach(l=>t.step(l))}function tk(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof ri){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;ut.step(new Yn(s.from,s.to,s.style)))}function Xa(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l=0;l--)t.step(s[l])}function nk(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function dn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-o;if(rn;h--)m||r.index(h)>0?(m=!0,u=A.from(r.node(h).copy(u)),d++):l--;let f=A.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Pe(i,o,i,o,new P(r,0,0),n.length,!0))}function ak(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&lk(t.doc,t.mapping.slice(o).map(a),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&&sf(t,s,a,o),Xa(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new Pe(d,f,d+1,f-1,new P(A.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&of(t,s,a,o),!1}})}function of(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function sf(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(` +`))}})}function lk(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function ck(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Pe(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new P(A.from(s),0,0),1,!0))}function Mt(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let d=i.node(c),f=i.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 a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function uk(t,e,n=1,r){let i=t.doc.resolve(e),o=A.empty,s=A.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=A.from(i.node(a).copy(o));let u=r&&r[c];s=A.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Xe(e,e,new P(o.append(s),n,n),!0))}function Ut(t,e){let n=t.resolve(e),r=n.index();return af(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dk(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&af(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function fk(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);sf(t,u.node(),u.before(),a)}s.inlineContent&&Xa(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Xe(c,l.map(e+n,-1),P.empty,!0)),r===!0){let u=t.doc.resolve(c);of(t,u.node(),u.before(),t.steps.length)}return t}function pk(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function fi(t,e,n=e,r=P.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return lf(i,o,r)?new Xe(e,n,r):new Ja(i,o,r).fit()}function lf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var Ja=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new P(o,s,a);return e>-1?new Pe(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Xe(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=qa(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(A.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=qa(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new P(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=qa(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new P(si(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new P(si(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m1||l==0||m.content.size)&&(d=g,u.push(cf(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=ai(this.placed,n,A.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;a--){let{match:l,type:c}=this.frontier[a],u=ja(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ai(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ai(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=ai(this.placed,this.frontier.length,n))}};function si(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(si(t.firstChild.content,e-1,n)))}function ai(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ai(t.lastChild.content,e-1,n)))}function qa(t,e){for(let n=0;n1&&(r=r.replaceChild(0,cf(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function ja(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!hk(n,o.content,s)?a:null}function hk(t,e,n){for(let r=n;r0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:i.before(f)==p&&s.splice(1,0,-f)}let l=s.indexOf(a),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=mk(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-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=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=i.before(p),n=o.after(p))}}function uf(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(A.empty,!0))}return t}function bk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=pk(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new P(A.from(r),0,0))}function yk(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=df(r,i);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function df(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}var go=class t extends Ue{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ve.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ve.fromReplace(e,this.pos,this.pos+1,new P(A.from(i),0,n.isLeaf?0:1))}getMap(){return un.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};Ue.jsonID("attr",go);var bo=class t extends Ue{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ve.ok(r)}getMap(){return un.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};Ue.jsonID("docAttr",bo);var Ar=class extends Error{};Ar=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ar.prototype=Object.create(Error.prototype);Ar.prototype.constructor=Ar;Ar.prototype.name="TransformError";var An=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ci}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ar(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=P.empty){let i=fi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new P(A.from(r),0,0))}delete(e,n){return this.replace(e,n,P.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return gk(this,e,n,r),this}replaceRangeWith(e,n,r){return bk(this,e,n,r),this}deleteRange(e,n){return yk(this,e,n),this}lift(e,n){return rk(this,e,n),this}join(e,n=1){return fk(this,e,n),this}wrap(e,n){return sk(this,e,n),this}setBlockType(e,n=e,r,i=null){return ak(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return ck(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new go(e,n,r)),this}setDocAttribute(e,n){return this.step(new bo(e,n)),this}addNodeMark(e,n){return this.step(new di(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ue)n.isInSet(r.marks)&&this.step(new Cr(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Cr(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return uk(this,e,n,r),this}addMark(e,n,r){return ek(this,e,n,r),this}removeMark(e,n,r){return tk(this,e,n,r),this}clearIncompatible(e,n,r){return Xa(this,e,n,r),this}};var Qa=Object.create(null),q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Or(e.min(n),e.max(n))]}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 n=0;n=0;o--){let s=n<0?Mr(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Mr(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new at(e.node(0))}static atStart(e){return Mr(e,e,0,0,1)||new at(e)}static atEnd(e){return Mr(e,e,e.content.size,e.childCount,-1)||new at(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qa[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Qa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qa[e]=n,n.prototype.jsonID=e,n}getBookmark(){return G.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;var Or=class{constructor(e,n){this.$from=e,this.$to=n}},ff=!1;function pf(t){!ff&&!t.parent.inlineContent&&(ff=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var G=class t extends q{constructor(e,n=e){pf(e),pf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let i=e.resolve(n.map(this.anchor));return new t(i.parent.inlineContent?i:r,r)}replace(e,n=P.empty){if(super.replace(e,n),n==P.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ko(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(o)n=o.$head;else return q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&V.isSelectable(a))return V.create(t,n-(i<0?a.nodeSize:0))}else{let l=Mr(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function hf(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var mf=1,Eo=2,gf=4,nl=class extends An{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.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Eo,this}ensureMarks(e){return ue.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&Eo)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Eo,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ue.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=gf,this}get scrolledIntoView(){return(this.updated&gf)>0}};function bf(t,e){return!e||!t?t:t.bind(e)}var Jn=class{constructor(e,n,r){this.name=e,this.init=bf(n.init,r),this.apply=bf(n.apply,r)}},kk=[new Jn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Jn("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Jn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Jn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],pi=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=kk.slice(),n&&n.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 Jn(r.key,r.spec.state,r))})}},wo=class t{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,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new pi(e.schema,e.plugins),o=new t(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=vt.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=q.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}};function yf(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=yf(i,e,{})),n[r]=i}return n}var he=class{constructor(e){this.spec=e,this.props={},e.props&&yf(e.props,this,this.props),this.key=e.key?e.key.key:Ef("plugin")}getState(e){return e[this.key]}},el=Object.create(null);function Ef(t){return t in el?t+"$"+ ++el[t]:(el[t]=0,t+"$")}var xe=class{constructor(e="key"){this.key=Ef(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var qe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},ll=null,pn=function(t,e,n){let r=ll||(ll=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},wk=function(){ll=null},rr=function(t,e,n,r){return n&&(kf(t,e,n,r,-1)||kf(t,e,n,r,1))},Sk=/^(img|br|input|textarea|hr)$/i;function kf(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Rt(t))){let s=t.parentNode;if(!s||s.nodeType!=1||wi(t)||Sk.test(t.nodeName)||t.contentEditable=="false")return!1;e=qe(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Rt(t):0}else return!1}}function Rt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function xk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Rt(t)}else if(t.parentNode&&!wi(t))e=qe(t),t=t.parentNode;else return null}}function _k(t,e){for(;;){if(t.nodeType==3&&e2),Ot=Br||(Gt?/Mac/.test(Gt.platform):!1),tp=Gt?/Win/.test(Gt.platform):!1,hn=/Android \d/.test(In),Si=!!wf&&"webkitFontSmoothing"in wf.documentElement.style,Nk=Si?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function fn(t,e){return typeof t=="number"?t:t[e]}function Mk(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Sf(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Pr(s);continue}let a=s,l=a==o.body,c=l?vk(o):Mk(a),u=0,d=0;if(e.topc.bottom-fn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+fn(i,"top")-c.top:e.bottom-c.bottom+fn(i,"bottom")),e.leftc.right-fn(r,"right")&&(u=e.right-c.right+fn(i,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-p,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Pr(s)}}function Ok(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:np(t.dom)}}function np(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pr(r));return e}function Rk({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;rp(n,r==0?0:r-e)}function rp(t,e){for(let n=0;n=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?Dk(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:ip(n,i)}function Dk(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Cl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Lk(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function Bk(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right-1?i:t.docView.posFromDOM(e,n,-1)}function op(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let c;Si&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Bk(t,r,i,e))}a==null&&(a=Pk(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function xf(t){return t.top=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,hi(Nn(pn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Rt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return rl(l.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Rt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?pn(l,Rt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return hi(Nn(c,1),!1)}if(o==null&&i=0)}function hi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function rl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function ap(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Uk(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return ap(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=sp(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=pn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}var $k=/[\u0590-\u08ac]/;function Hk(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!$k.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:ap(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}var _f=null,Tf=null,Cf=!1;function Wk(t,e,n){return _f==e&&Tf==n?Cf:(_f=e,Tf=n,Cf=n=="up"||n=="down"?Uk(t,e,n):Hk(t,e,n))}var Dt=0,Af=1,Xn=2,Vt=3,ir=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Dt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nqe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof _o){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof So&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?qe(o.dom)+1:0}}else{let o,s=!0;for(;o=r=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=qe(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;uh&&sn){let h=a;a=l,l=h}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Xn:Af,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Vt:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Xn:Vt}r=s}this.dirty=Xn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Xn:Af;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Dt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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}},fl=class extends ir{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},zr=class t extends ir{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=cn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Vt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Vt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Dt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=gl(o,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=cn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=up(u,r,n),c?l=new pl(e,n,r,i,u,d||null,f,c,o,s+1):n.isText?new xo(e,n,r,i,u,f,o):new t(e,n,r,i,u,d||null,f,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==Dt&&e.eq(this.node)&&To(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new ml(this,s&&s.node,e);qk(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?ue.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Xn)&&(s&&this.protectLocalComposition(e,s),lp(this.contentDOM,this.children,e),Br&&jk(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof G)||rn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=Yk(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new fl(this,o,n,i);e.input.compositionNodes.push(s),this.children=gl(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Vt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Dt}updateOuterDeco(e){if(To(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=cp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Nf(t,e,n,r,i){up(r,e,t);let o=new Rn(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var xo=class t extends Rn{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Vt||this.dirty!=Dt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Dt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Dt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Vt)}get domAtom(){return!1}isText(e){return this.node.text==e}},_o=class extends ir{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Dt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},pl=class extends Rn{constructor(e,n,r,i,o,s,a,l,c,u){super(e,n,r,i,o,s,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==Vt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function lp(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,a=Math.min(s,e.length);for(;o-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=zr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof zr)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function Vk(t,e){return t.type.side-e.type.side}function qk(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;co;)a.push(i[s++]);let h=o+f.nodeSize;if(f.isText){let g=h;s!g.inline):a.slice();r(f,m,e.forChild(o,f),p),o=h}}function jk(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Yk(t,e,n,r){for(let i=0,o=0;i=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function gl(t,e,n,r,i){let o=[];for(let s=0,a=0;s=n||u<=e?o.push(l):(cn&&o.push(l.slice(n-c,l.size,r)))}return o}function Al(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Ro(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&V.isSelectable(d)&&i.parent&&!(d.isInline&&Tk(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new V(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!dp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zk(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,qe(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wt&&On<=11&&(n.disabled=!0,n.disabled=!1)}function fp(t,e){if(e instanceof V){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(If(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else If(t)}function If(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Nl(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||G.between(e,n,r)}function Df(t){return t.editable&&!t.hasFocus()?!1:pp(t)}function pp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Xk(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return rr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function bl(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&q.findFrom(o,e)}function vn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Lf(t,e,n){let r=t.state.selection;if(r instanceof G)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return vn(t,new G(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=bl(t.state,e);return i&&i instanceof V?vn(t,i):!1}else if(!(Ot&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?V.isSelectable(o)?vn(t,new V(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Si?vn(t,new G(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof V&&r.node.isInline)return vn(t,new G(e>0?r.$to:r.$from));{let i=bl(t.state,e);return i?vn(t,i):!1}}}function Co(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ir(t,e){return e<0?Qk(t):ew(t)}function Qk(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(It&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(gi(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(hp(n))break;{let a=n.previousSibling;for(;a&&gi(a,-1);)i=n.parentNode,o=qe(a),a=a.previousSibling;if(a)n=a,r=Co(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?yl(t,n,r):i&&yl(t,i,o)}function ew(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Co(n),o,s;for(;;)if(r{t.state==i&&mn(t)},50)}function Pf(t,e){let n=t.state.doc.resolve(e);if(!(je||tp)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Bf(t,e,n){let r=t.state.selection;if(r instanceof G&&!r.empty||n.indexOf("s")>-1||Ot&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=bl(t.state,e);if(s&&s instanceof V)return vn(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof at?q.near(s,e):q.findFrom(s,e);return a?vn(t,a):!1}return!1}function zf(t,e){if(!(t.state.selection instanceof G))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function Ff(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function rw(t){if(!et||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ff(t,r,"true"),setTimeout(()=>Ff(t,r,"false"),20)}return!1}function iw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function ow(t,e){let n=e.keyCode,r=iw(e);if(n==8||Ot&&n==72&&r=="c")return zf(t,-1)||Ir(t,-1);if(n==46&&!e.shiftKey||Ot&&n==68&&r=="c")return zf(t,1)||Ir(t,1);if(n==13||n==27)return!0;if(n==37||Ot&&n==66&&r=="c"){let i=n==37?Pf(t,t.state.selection.from)=="ltr"?-1:1:-1;return Lf(t,i,r)||Ir(t,i)}else if(n==39||Ot&&n==70&&r=="c"){let i=n==39?Pf(t,t.state.selection.from)=="ltr"?1:-1:1;return Lf(t,i,r)||Ir(t,i)}else{if(n==38||Ot&&n==80&&r=="c")return Bf(t,-1,r)||Ir(t,-1);if(n==40||Ot&&n==78&&r=="c")return rw(t)||Bf(t,1,r)||Ir(t,1);if(r==(Ot?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function vl(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||cn.fromSchema(t.state.schema),a=kp(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ep[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:l,text:f,slice:e}}function mp(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t)}),o)return a=new P(A.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:p}=t.state,h=cn.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=cw(n),Si&&uw(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||ln.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!sw.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=dw(Uf(a,+u[1],+u[2]),u[4]);else if(a=P.maxOpen(aw(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d{a=d(a,t,l)}),a}var sw=/^(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 aw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&bp(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=yp(s[s.length-1],o.length));let u=gp(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return A.from(s)}return t}function gp(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function bp(t,e,n,r,i){if(i1&&(o=0),i=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Uf(t,e,n){return en})),ol.createHTML(t)):t}function cw(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=kp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Ep[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=lw(t),i)for(let o=0;o=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=A.from(l.create(r[a+1],i)),o++,s++}return new P(i,o,s)}var lt={},ct={},fw={touchstart:!0,touchmove:!0},kl=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function pw(t){for(let e in lt){let n=lt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{mw(t,r)&&!Ml(t,r)&&(t.editable||!(r.type in ct))&&n(t,r)},fw[e]?{passive:!0}:void 0)}et&&t.dom.addEventListener("input",()=>null),wl(t)}function Mn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function hw(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function wl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ml(t,r))})}function Ml(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function mw(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function gw(t,e){!Ml(t,e)&<[e.type]&&(t.editable||!(e.type in ct))&<[e.type](t,e)}ct.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Sp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(hn&&je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Br&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Zn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||ow(t,n)?n.preventDefault():Mn(t,"key")};ct.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ct.keypress=(t,e)=>{let n=e;if(Sp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ot&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof G)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Io(t){return{left:t.clientX,top:t.clientY}}function bw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ol(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function Lr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function yw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&V.isSelectable(r)?(Lr(t,new V(n),"pointer"),!0):!1}function Ew(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof V&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(V.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(Lr(t,V.create(t.state.doc,i),"pointer"),!0):!1}function kw(t,e,n,r,i){return Ol(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?Ew(t,n):yw(t,n))}function ww(t,e,n,r){return Ol(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Sw(t,e,n,r){return Ol(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||xw(t,n,r)}function xw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Lr(t,G.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)Lr(t,G.create(r,a+1,a+1+s.content.size),"pointer");else if(V.isSelectable(s))Lr(t,V.create(r,a),"pointer");else continue;return!0}}function Rl(t){return Ao(t)}var wp=Ot?"metaKey":"ctrlKey";lt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Rl(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&bw(n,t.input.lastClick)&&!n[wp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Io(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Sl(t,s,n,!!r)):(o=="doubleClick"?ww:Sw)(t,s.pos,s.inside,n)?n.preventDefault():Mn(t,"pointer"))};var Sl=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[wp],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}let a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof V&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&It&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Mn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>mn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Io(e))),this.updateAllowDefault(e),this.allowDefault||!n?Mn(this.view,"pointer"):kw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||et&&this.mightDrag&&!this.mightDrag.node.isAtom||je&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Lr(this.view,q.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):Mn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Mn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};lt.touchstart=t=>{t.input.lastTouch=Date.now(),Rl(t),Mn(t,"pointer")};lt.touchmove=t=>{t.input.lastTouch=Date.now(),Mn(t,"pointer")};lt.contextmenu=t=>Rl(t);function Sp(t,e){return t.composing?!0:et&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var _w=hn?5e3:-1;ct.compositionstart=ct.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof G&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||je&&tp&&Tw(t)))t.markCursor=t.state.storedMarks||n.marks(),Ao(t,!0),t.markCursor=null;else if(Ao(t,!e.selection.empty),It&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}xp(t,_w)};function Tw(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ct.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,xp(t,20))};function xp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ao(t),e))}function _p(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Aw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Cw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=xk(e.focusNode,e.focusOffset),r=_k(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Aw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ao(t,e=!1){if(!(hn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),_p(t),e||t.docView&&t.docView.dirty){let n=Al(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Nw(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var bi=wt&&On<15||Br&&Nk<604;lt.copy=ct.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=bi?null:n.clipboardData,s=r.content(),{dom:a,text:l}=vl(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Nw(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function vw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Mw(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?yi(t,r.value,null,i,e):yi(t,r.textContent,r.innerHTML,i,e)},50)}function yi(t,e,n,r,i){let o=mp(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||P.empty)))return!0;if(!o)return!1;let s=vw(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Tp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ct.paste=(t,e)=>{let n=e;if(t.composing&&!hn)return;let r=bi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&yi(t,Tp(r),r.getData("text/html"),i,n)?n.preventDefault():Mw(t,n)};var No=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},Ow=Ot?"altKey":"ctrlKey";function Cp(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Ow]}lt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Io(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof V?i.to-1:i.to))){if(r&&r.mightDrag)s=V.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=V.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=vl(t,a);(!n.dataTransfer.files.length||!je||ep>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(bi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",bi||n.dataTransfer.setData("text/plain",c),t.dragging=new No(u,Cp(t,n),s)};lt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ct.dragover=ct.dragenter=(t,e)=>e.preventDefault();ct.drop=(t,e)=>{try{Rw(t,e,t.dragging)}finally{t.dragging=null}};function Rw(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Io(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",p=>{o=p(o,t,!1)}):o=mp(t,Tp(e.dataTransfer),bi?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&Cp(t,e));if(t.someProp("handleDrop",p=>p(t,e,o||P.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?yo(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(s){let{node:p}=n;p?p.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&V.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new V(f));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((h,m,g,b)=>p=b),l.setSelection(Nl(t,f,l.doc.resolve(p)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}lt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&mn(t)},20))};lt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};lt.beforeinput=(t,e)=>{if(je&&hn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Zn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ct)lt[t]=ct[t];function Ei(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var vo=class t{constructor(e,n){this.toDOM=e,this.spec=n||tr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new tt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ei(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},er=class t{constructor(e,n){this.attrs=e,this.spec=n||tr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new tt(o,s,this)}valid(e,n){return n.from=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==Qe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||tr)}mapInner(e,n,r,i,o){let s;for(let a=0;a{let c=l+r,u;if(u=Np(n,a,c)){for(i||(i=this.children.slice());oa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;ao&&l.type instanceof er){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;ci.map(e,n,tr));return t.from(r)}forChild(e,n){if(n.isLeaf)return Be.empty;let r=[];for(let i=0;in instanceof Be)?e:e.reduce((n,r)=>n.concat(r instanceof Be?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let g=m-h-(p-f);for(let b=0;bk+u-d)continue;let C=a[b]+u-d;p>=C?a[b+1]=f<=C?-2:-1:f>=u&&g&&(a[b]+=g,a[b+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let f=n.map(t[c+1]+o,-1),p=f-i,{index:h,offset:m}=r.content.findIndex(d),g=r.maybeChild(h);if(g&&m==d&&m+g.nodeSize==p){let b=a[c+2].mapInner(n,g,u+1,t[c]+o+1,s);b!=Qe?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Dw(a,t,e,n,i,o,s),u=Oo(c,r,0,s);e=u.local;for(let d=0;dn&&s.to{let c=Np(t,a,l+n);if(c){o=!0;let u=Oo(c,a,n+l+1,r);u!=Qe&&i.push(l,l+a.nodeSize,u)}});let s=Ap(o?vp(t):t,-n).sort(nr);for(let a=0;a0;)e++;t.splice(e,0,n)}function sl(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Qe&&e.push(r)}),t.cursorWrapper&&e.push(Be.create(t.state.doc,[t.cursorWrapper.deco])),Mo.from(e)}var Lw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Pw=wt&&On<=11,_l=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Tl=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _l,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():et&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Pw&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Lw)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Df(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(wt&&On<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Pr(o))n.add(o);for(let o=e.anchorNode;o;o=Pr(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Df(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;uu.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(It&&l.length){let u=l.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}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||Fw(e,d)!=p)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Bw(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Uw(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){o=g;break}if(!k||k.size)break}let d=t.state.doc,f=t.someProp("domParser")||ln.fromSchema(t.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Hw,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),h={anchor:g+s,head:b+s}}return{doc:m,sel:h,from:s,to:a}}function Hw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(et&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||et&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var Ww=/^(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 Kw(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let v=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,L=Al(t,v);if(L&&!t.state.selection.eq(L)){if(je&&hn&&t.input.lastKeyCode===13&&Date.now()-100fe(t,Zn(13,"Enter"))))return;let F=t.state.tr.setSelection(L);v=="pointer"?F.setMeta("pointer",!0):v=="key"&&F.scrollIntoView(),o&&F.setMeta("composition",o),t.dispatch(F)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=$w(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||hn)&&i.some(v=>v.nodeType==1&&!Ww.test(v.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",v=>v(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof G&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let v=Vf(t,t.state.doc,c.sel);if(v&&!v.eq(t.state.selection)){let L=t.state.tr.setSelection(v);o&&L.setMeta("composition",o),t.dispatch(L)}}return}t.state.selection.fromt.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),wt&&On<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" \xA0"&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),b=u.resolve(h.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA;if((Br&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!k&&m.posv(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&Vw(u,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",v=>v(t,Zn(8,"Backspace")))){hn&&je&&t.domObserver.suppressSelectionUpdates();return}je&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),hn&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(v){return v(t,Zn(13,"Enter"))})},20));let C=h.start,_=h.endA,T=v=>{let L=v||t.state.tr.replace(C,_,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let F=Vf(t,L.doc,c.sel);F&&!(je&&t.composing&&F.empty&&(h.start!=h.endB||t.input.lastChromeDeletemn(t),20));let v=T(t.state.tr.delete(C,_)),L=u.resolve(h.start).marksAcross(u.resolve(h.endA));L&&v.ensureMarks(L),t.dispatch(v)}else if(h.endA==h.endB&&(I=Gw(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let v=T(t.state.tr);I.type=="add"?v.addMark(C,_,I.mark):v.removeMark(C,_,I.mark),t.dispatch(v)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let v=m.parent.textBetween(m.parentOffset,g.parentOffset),L=()=>T(t.state.tr.insertText(v,C,_));t.someProp("handleTextInput",F=>F(t,C,_,v,L))||t.dispatch(L())}else t.dispatch(T());else t.dispatch(T())}function Vf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Nl(t,e.resolve(n.anchor),e.resolve(n.head))}function Gw(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;un||al(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function qw(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s=s?o-r:0;o-=l,o&&o=a?o-r:0;o-=l,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}var ki=class{constructor(e,n){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 kl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Xf),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=Jf(this),Yf(this),this.nodeViews=Zf(this),this.docView=Nf(this.state.doc,jf(this),sl(this),this.dom,this),this.domObserver=new Tl(this,(r,i,o,s)=>Kw(this,r,i,o,s)),this.domObserver.start(),pw(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&wl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Xf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(_p(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Zf(this);Yw(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&wl(this),this.editable=Jf(this),Yf(this);let l=sl(this),c=jf(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ok(this);if(s){this.domObserver.stop();let p=d&&(wt||je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&jw(i.selection,e.selection);if(d){let h=je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Cw(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Nf(e.doc,c,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xk(this))?mn(this,p):(fp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Rk(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof V){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Sf(this,n.getBoundingClientRect(),e)}else Sf(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 n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new No(e.slice,e.move,i<0?void 0:V.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return zk(this,e)}coordsAtPos(e,n=1){return sp(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Wk(this,n||this.state,e)}pasteHTML(e,n){return yi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return yi(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return vl(this,e)}destroy(){this.docView&&(hw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],sl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return gw(this,e)}domSelectionRange(){let e=this.domSelection();return e?et&&this.root.nodeType===11&&Ck(this.dom.ownerDocument)==this.dom&&zw(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};ki.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function jf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[tt.node(0,t.state.doc.content.size,e)]}function Yf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:tt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Jf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function jw(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Zf(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Yw(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Xf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var gn={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:"'"},Lo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Jw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Zw=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ze=0;ze<10;ze++)gn[48+ze]=gn[96+ze]=String(ze);var ze;for(ze=1;ze<=24;ze++)gn[ze+111]="F"+ze;var ze;for(ze=65;ze<=90;ze++)gn[ze]=String.fromCharCode(ze+32),Lo[ze]=String.fromCharCode(ze);var ze;for(Do in gn)Lo.hasOwnProperty(Do)||(Lo[Do]=gn[Do]);var Do;function Mp(t){var e=Jw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Lo:gn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}var Xw=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Qw=typeof navigator<"u"&&/Win/.test(navigator.platform);function e0(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;at.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Ip(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Pl=(t,e,n)=>{let r=Ip(t,n);if(!r)return!1;let i=zl(r);if(!i){let s=r.blockRange(),a=s&&dn(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(Hp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Fr(o,"end")||V.isSelectable(o)))for(let s=r.depth;;s--){let a=fi(t.doc,r.before(s),r.after(s),P.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Dp=(t,e,n)=>{let r=Ip(t,n);if(!r)return!1;let i=zl(r);return i?Pp(t,i,e):!1},Lp=(t,e,n)=>{let r=Bp(t,n);if(!r)return!1;let i=$l(r);return i?Pp(t,i,e):!1};function Pp(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=fi(t.doc,o,l,P.empty);if(!c||c.from!=o||c instanceof Xe&&c.slice.size>=l-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(G.create(u.doc,o)),n(u.scrollIntoView())}return!0}function Fr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Bl=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=zl(r)}let s=o&&o.nodeBefore;return!s||!V.isSelectable(s)?!1:(e&&e(t.tr.setSelection(V.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function zl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Bp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=Bp(t,n);if(!r)return!1;let i=$l(r);if(!i)return!1;let o=i.nodeAfter;if(Hp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Fr(o,"start")||V.isSelectable(o))){let s=fi(t.doc,r.before(),r.after(),P.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof V,i;if(r){if(n.node.isTextblock||!Ut(t.doc,n.from))return!1;i=n.from}else if(i=vr(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(V.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Fp=(t,e)=>{let n=t.selection,r;if(n instanceof V){if(n.node.isTextblock||!Ut(t.doc,n.to))return!1;r=n.to}else if(r=vr(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Up=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&dn(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Hl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function Wl(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Wl(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(q.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Gl=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof at||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Wl(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Mt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&dn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function n0(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof V&&e.selection.node.isBlock)return!r.parentOffset||!Mt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Wl(r.node(p-1).contentMatchAt(r.indexAfter(p-1)));let m=t&&t(i.parent,l,r);o.unshift(m||(l&&a?{type:a}:null)),s=p;break}else{if(p==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof G||e.selection instanceof at)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Mt(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=Mt(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),h=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}var r0=n0();var $p=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(V.create(t.doc,i))),!0)},i0=(t,e)=>(e&&e(t.tr.setSelection(new at(t.doc))),!0);function o0(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ut(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Hp(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&o0(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let p=e.pos+o.nodeSize,h=A.empty;for(let b=s.length-1;b>=0;b--)h=A.from(s[b].create(null,h));h=A.from(i.copy(h));let m=t.tr.step(new Pe(e.pos-1,p,e.pos,p,new P(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ut(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:q.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&dn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Fr(o,"start",!0)&&Fr(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let b=A.empty;for(let C=h.length-1;C>=0;C--)b=A.from(h[C].copy(b));let k=t.tr.step(new Pe(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new P(b,h.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function Wp(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(G.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var ql=Wp(-1),jl=Wp(1);function Kp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&Nr(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Yl(t,e=null){return function(n,r){let i=!1;for(let o=0;o{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new qn(l,l,e.depth),e.endIndex=0;u--)o=A.from(n[u].type.create(n[u].attrs,o));t.step(new Pe(e.start-(r?2:0),e.end,e.start,e.end,new P(o,0,0),n.length,!0));let s=0;for(let u=0;us.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?c0(e,n,t,o):u0(e,n,o):!0:!1}}function c0(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);om;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?A.empty:A.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new Pe(d-(a?1:0),f+(l?1:0),d+1,f-1,new P((a?A.empty:A.from(i.copy(A.empty))).append(l?A.empty:A.from(i.copy(A.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function qp(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=A.from(c?t.create():null),d=new P(A.from(t.create(null,A.from(a.type.create(null,u)))),c?3:1,0),f=o.start,p=o.end;n(e.tr.step(new Pe(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function Ko(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Ur=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{let d=l(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...m)=>{let g=this.buildProps(c,n),b=p(...m)(g);return a.push(b),d}])),run:u};return d}createCan(e){let{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:Ko({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}},ec=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){let r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function U(t,e,n){return t.config[e]===void 0&&t.parent?U(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?U(t.parent,e,n):null}):t.config[e]}function Go(t){let e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function nh(t){let e=[],{nodeExtensions:n,markExtensions:r}=Go(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=U(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...o,...p}})})})})}),i.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=U(s,"addAttributes",a);if(!l)return;let c=l();Object.entries(c).forEach(([u,d])=>{let f={...o,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function $e(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Q(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else if(i==="style"){let a=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{let[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),a.forEach(u=>{let[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function tc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Q(n,r),{})}function rh(t){return typeof t=="function"}function ne(t,e=void 0,...n){return rh(t)?e?t.bind(e)(...n):t(...n):t}function d0(t={}){return Object.keys(t).length===0&&t.constructor===Object}function f0(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function jp(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let i=e.reduce((o,s)=>{let a=s.attribute.parseHTML?s.attribute.parseHTML(n):f0(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Yp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&d0(n)?!1:n!=null))}function p0(t,e){var n;let r=nh(t),{nodeExtensions:i,markExtensions:o}=Go(t),s=(n=i.find(c=>U(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{let u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,k)=>{let C=U(k,"extendNodeSchema",d);return{...b,...C?C(c):{}}},{}),p=Yp({...f,content:ne(U(c,"content",d)),marks:ne(U(c,"marks",d)),group:ne(U(c,"group",d)),inline:ne(U(c,"inline",d)),atom:ne(U(c,"atom",d)),selectable:ne(U(c,"selectable",d)),draggable:ne(U(c,"draggable",d)),code:ne(U(c,"code",d)),whitespace:ne(U(c,"whitespace",d)),linebreakReplacement:ne(U(c,"linebreakReplacement",d)),defining:ne(U(c,"defining",d)),isolating:ne(U(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var k;return[b.name,{default:(k=b?.attribute)===null||k===void 0?void 0:k.default}]}))}),h=ne(U(c,"parseHTML",d));h&&(p.parseDOM=h.map(b=>jp(b,u)));let m=U(c,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:tc(b,u)}));let g=U(c,"renderText",d);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(o.map(c=>{let u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,b)=>{let k=U(b,"extendMarkSchema",d);return{...g,...k?k(c):{}}},{}),p=Yp({...f,inclusive:ne(U(c,"inclusive",d)),excludes:ne(U(c,"excludes",d)),group:ne(U(c,"group",d)),spanning:ne(U(c,"spanning",d)),code:ne(U(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),h=ne(U(c,"parseHTML",d));h&&(p.parseDOM=h.map(g=>jp(g,u)));let m=U(c,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:tc(g,u)})),[c.name,p]}));return new ii({topNode:s,nodes:a,marks:l})}function Zl(t,e){return e.nodes[t]||e.marks[t]||null}function Jp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ac(t,e){let n=cn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}var h0=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;let u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),n};function lc(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var $r=class{constructor(e){this.find=e.find,this.handler=e.handler}},m0=(t,e)=>{if(lc(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Bo(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1,d=h0(c)+o;return s.forEach(f=>{if(u)return;let p=m0(d,f.find);if(!p)return;let h=l.state.tr,m=Ko({state:l.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:k,can:C}=new Ur({editor:n,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:k,can:C})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:o}),l.dispatch(h),u=!0)}),u}function g0(t){let{editor:e,rules:n}=t,r=new he({state:{init(){return null},apply(i,o,s){let a=i.getMeta(r);if(a)return a;let l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=ac(A.from(u),s.schema);let{from:d}=l,f=d+u.length;Bo({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return Bo({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&Bo({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?Bo({editor:e,from:s.pos,to:s.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function b0(t){return Object.prototype.toString.call(t).slice(8,-1)}function zo(t){return b0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Vo(t,e){let n={...t};return zo(t)&&zo(e)&&Object.keys(e).forEach(r=>{zo(e[r])&&zo(t[r])?n[r]=Vo(t[r],e[r]):n[r]=e[r]}),n}var ut=class t{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ne(U(this,"addOptions",{name:this.name}))),this.storage=ne(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Vo(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ne(U(n,"addOptions",{name:n.name})),n.storage=ne(U(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let s=i.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;let l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}};function y0(t){return typeof t=="number"}var nc=class{constructor(e){this.find=e.find,this.handler=e.handler}},E0=(t,e,n)=>{if(lc(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(i=>{let o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function k0(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Ur({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;let m=Math.max(r,h),g=Math.min(i,h+p.content.size),b=p.textBetween(m-h,g-h,void 0,"\uFFFC");E0(b,o.find,s).forEach(C=>{if(C.index===void 0)return;let _=m+C.index+1,T=_+C[0].length,I={from:n.tr.mapping.map(_),to:n.tr.mapping.map(T)},v=o.handler({state:n,range:I,match:C,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(v)})}),d.every(p=>p!==null)}var Fo=null,w0=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function S0(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}let l=({state:u,from:d,to:f,rule:p,pasteEvt:h})=>{let m=u.tr,g=Ko({state:u,transaction:m});if(!(!k0({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new he({view(d){let f=h=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(h.target)?d.dom.parentElement:null,r&&(Fo=e)},p=()=>{Fo&&(Fo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,a=f,!o){let p=Fo;p?.isEditable&&setTimeout(()=>{let h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;let h=(p=f.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=f,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,p)=>{let h=d[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!o,b=h.getMeta("applyPasteRules"),k=!!b;if(!m&&!g&&!k)return;if(k){let{text:T}=b;typeof T=="string"?T=T:T=ac(A.from(T),p.schema);let{from:I}=b,v=I+T.length,L=w0(T);return l({rule:u,state:p,from:I,to:{b:v},pasteEvt:L})}let C=f.doc.content.findDiffStart(p.doc.content),_=f.doc.content.findDiffEnd(p.doc.content);if(!(!y0(C)||!_||C===_.b))return l({rule:u,state:p,from:C,to:_,pasteEvt:s})}}))}function x0(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}var rc=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=p0(this.extensions,n),this.setupExtensions()}static resolve(e){let n=t.sort(t.flatten(e)),r=x0(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},i=U(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{let o=U(r,"priority")||100,s=U(i,"priority")||100;return o>s?-1:o{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Zl(n.name,this.schema)},i=U(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{let a={name:s.name,options:s.options,storage:s.storage,editor:e,type:Zl(s.name,this.schema)},l=[],c=U(s,"addKeyboardShortcuts",a),u={};if(s.type==="mark"&&U(s,"exitable",a)&&(u.ArrowRight=()=>ut.handleExit({editor:e,mark:s})),c){let m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}let d=Op(u);l.push(d);let f=U(s,"addInputRules",a);Jp(s,e.options.enableInputRules)&&f&&r.push(...f());let p=U(s,"addPasteRules",a);Jp(s,e.options.enablePasteRules)&&p&&i.push(...p());let h=U(s,"addProseMirrorPlugins",a);if(h){let m=h();l.push(...m)}return l}).flat();return[g0({editor:e,rules:r}),...S0({editor:e,rules:i}),...o]}get attributes(){return nh(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=Go(this.extensions);return Object.fromEntries(n.filter(r=>!!U(r,"addNodeView")).map(r=>{let i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:$e(r.name,this.schema)},s=U(r,"addNodeView",o);if(!s)return[];let a=(l,c,u,d,f)=>{let p=tc(l,i);return s()({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:p})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Zl(e.name,this.schema)};e.type==="mark"&&(!((n=ne(U(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);let i=U(e,"onBeforeCreate",r),o=U(e,"onCreate",r),s=U(e,"onUpdate",r),a=U(e,"onSelectionUpdate",r),l=U(e,"onTransaction",r),c=U(e,"onFocus",r),u=U(e,"onBlur",r),d=U(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}},He=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ne(U(this,"addOptions",{name:this.name}))),this.storage=ne(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Vo(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ne(U(n,"addOptions",{name:n.name})),n.storage=ne(U(n,"addStorage",{name:n.name,options:n.options})),n}};function ih(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=` + +`,textSerializers:s={}}=n||{},a="";return t.nodesBetween(r,i,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=o);let p=s?.[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function oh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var _0=He.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new he({key:new xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),l=oh(n);return ih(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),T0=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),C0=(t=!1)=>({commands:e})=>e.setContent("",t),A0=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;let{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;let h=dn(p);if(a.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},N0=t=>e=>t(e),v0=()=>({state:t,dispatch:e})=>Gl(t,e),M0=(t,e)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new G(r.doc.resolve(Math.max(s-1,0)))),!0},O0=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){let a=i.before(o),l=i.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1},R0=t=>({tr:e,state:n,dispatch:r})=>{let i=$e(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},I0=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},D0=()=>({state:t,dispatch:e})=>Po(t,e),L0=()=>({commands:t})=>t.keyboardShortcut("Enter"),P0=()=>({state:t,dispatch:e})=>Kl(t,e);function Ho(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:lc(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function sh(t,e,n={}){return t.find(r=>r.type===e&&Ho(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Zp(t,e,n={}){return!!sh(t,e,n)}function cc(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!sh([...i.node.marks],e,n)))return;let s=i.index,a=t.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&Zp([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l({tr:n,state:r,dispatch:i})=>{let o=Ln(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){let d=cc(l,o,e);if(d&&d.from<=c&&d.to>=u){let f=G.create(s,d.from,d.to);n.setSelection(f)}}return!0},z0=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};let s=()=>{(Wo()||Xp())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),F0()&&!Wo()&&!Xp()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!ah(n.state.selection))return s(),!0;let a=lh(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},$0=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),H0=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),ch=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&ch(r)}return t};function Uo(t){let e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return ch(n)}function _i(t,e,n){if(t instanceof vt||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};let r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(a=>e.nodeFromJSON(a)));let s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),_i("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="",l=new ii({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?ln.fromSchema(l).parseSlice(Uo(t),n.parseOptions):ln.fromSchema(l).parse(Uo(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let o=ln.fromSchema(e);return n.slice?o.parseSlice(Uo(t),n.parseOptions).content:o.parse(Uo(t),n.parseOptions)}return _i("",e,n)}function W0(t,e,n){let r=t.steps.length-1;if(r{s===0&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var K0=t=>!("type"in t),G0=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a,l=g=>{o.emit("contentError",{editor:o,error:g,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{_i(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=_i(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((K0(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,p=p?g.isBlock:!1}),u===d&&p){let{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof A){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else m=a,r.replaceWith(u,d,m);n.updateSelection&&W0(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},V0=()=>({state:t,dispatch:e})=>zp(t,e),q0=()=>({state:t,dispatch:e})=>Fp(t,e),j0=()=>({state:t,dispatch:e})=>Pl(t,e),Y0=()=>({state:t,dispatch:e})=>Fl(t,e),J0=()=>({state:t,dispatch:e,tr:n})=>{try{let r=vr(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Z0=()=>({state:t,dispatch:e,tr:n})=>{try{let r=vr(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},X0=()=>({state:t,dispatch:e})=>Dp(t,e),Q0=()=>({state:t,dispatch:e})=>Lp(t,e);function uh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function eS(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a({editor:e,view:n,tr:r,dispatch:i})=>{let o=eS(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{let u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Ti(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?$e(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;let p=Math.max(r,f),h=Math.min(i,f+d.nodeSize);a.push({node:d,from:p,to:h})});let l=i-r,c=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Ho(d.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var nS=(t,e={})=>({state:n,dispatch:r})=>{let i=$e(t,n.schema);return Ti(n,i,e)?Up(n,r):!1},rS=()=>({state:t,dispatch:e})=>Vl(t,e),iS=t=>({state:e,dispatch:n})=>{let r=$e(t,e.schema);return Vp(r)(e,n)},oS=()=>({state:t,dispatch:e})=>Hl(t,e);function qo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Qp(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var sS=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=qo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=$e(t,r.schema)),a==="mark"&&(s=Ln(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{o&&o===c.type&&n.setNodeMarkup(u,void 0,Qp(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Qp(d.attrs,e)))})})}),!0):!1},aS=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),lS=()=>({tr:t,dispatch:e})=>{if(e){let n=new at(t.doc);t.setSelection(n)}return!0},cS=()=>({state:t,dispatch:e})=>Bl(t,e),uS=()=>({state:t,dispatch:e})=>Ul(t,e),dS=()=>({state:t,dispatch:e})=>$p(t,e),fS=()=>({state:t,dispatch:e})=>jl(t,e),pS=()=>({state:t,dispatch:e})=>ql(t,e);function ic(t,e,n={},r={}){return _i(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var hS=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,c;let{doc:u}=o;if(n.preserveWhitespace!=="full"){let d=ic(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function dh(t,e){let n=Ln(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});let a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function fh(t,e){let n=new An(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function mS(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function ph(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function uc(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function dc(t){return e=>uc(e.$from,t)}function gS(t,e){let n={from:0,to:t.content.size};return ih(t,n,e)}function bS(t,e){let n=$e(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});let s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function fc(t,e){let n=qo(typeof e=="string"?e:e.name,t.schema);return n==="node"?bS(t,e):n==="mark"?dh(t,e):{}}function yS(t,e=JSON.stringify){let n={};return t.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function ES(t){let e=yS(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function hh(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{let{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{let c=e.slice(o).map(a,-1),u=e.slice(o).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),ES(r)}function Yo(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=cc(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function $o(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function oc(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?Ln(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>Ho(d.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:d,$to:f})=>{let p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;let b=Math.max(p,g),k=Math.min(h,g+m.nodeSize),C=k-b;s+=C,a.push(...m.marks.map(_=>({mark:_,from:b,to:k})))})}),s===0)return!1;let l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>Ho(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=s}function kS(t,e,n={}){if(!e)return Ti(t,null,n)||oc(t,null,n);let r=qo(e,t.schema);return r==="node"?Ti(t,e,n):r==="mark"?oc(t,e,n):!1}function eh(t,e){let{nodeExtensions:n}=Go(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=ne(U(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function pc(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(pc(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function mh(t){return t instanceof V}function wS(t,e,n){var r;let{selection:i}=e,o=null;if(ah(i)&&(o=i.$cursor),o){let a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){let p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=p&&h}return!c}),c})}var SS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=Ln(t,r.schema);if(i)if(s){let c=dh(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{let u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{let h=Math.max(p,u),m=Math.min(p+f.nodeSize,d);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(h,m,l.create({...b.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return wS(r,n,l)},xS=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),_S=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=$e(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>Yl(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Yl(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},TS=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=or(t,0,r.content.size),o=V.create(r,i);e.setSelection(o)}return!0},CS=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=G.atStart(r).from,a=G.atEnd(r).to,l=or(i,s,a),c=or(o,s,a),u=G.create(r,l,c);e.setSelection(u)}return!0},AS=t=>({state:e,dispatch:n})=>{let r=$e(t,e.schema);return qp(r)(e,n)};function th(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var NS=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,u=$o(c,a.node().type.name,a.node().attrs);if(o instanceof V&&o.node.isBlock)return!a.parentOffset||!Mt(s,a.pos)?!1:(r&&(t&&th(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:mS(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,h=Mt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&Mt(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(h&&(o instanceof G&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){let m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&th(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},vS=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let a=$e(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;let d=l.node(-1);if(d.type!==a)return!1;let f=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=A.empty,k=l.index(-1)?1:l.index(-2)?2:3;for(let L=l.depth-k;L>=l.depth-3;L-=1)b=A.from(l.node(L).copy(b));let C=l.indexAfter(-1){if(v>-1)return!1;L.isTextblock&&L.content.size===0&&(v=F+1)}),v>-1&&n.setSelection(G.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}let p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...$o(f,d.type.name,d.attrs),...e},m={...$o(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);let g=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!Mt(n.doc,l.pos,2))return!1;if(i){let{selection:b,storedMarks:k}=r,{splittableMarks:C}=o.extensionManager,_=k||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!_||!i)return!0;let T=_.filter(I=>C.includes(I.type.name));n.ensureMarks(T)}return!0},Xl=(t,e)=>{let n=dc(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&Ut(t.doc,n.pos)&&t.join(n.pos),!0},Ql=(t,e)=>{let n=dc(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&Ut(t.doc,r)&&t.join(r),!0},MS=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=$e(t,s.schema),h=$e(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:k}=m,C=b.blockRange(k),_=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;let T=dc(I=>eh(I.type.name,d))(m);if(C.depth>=1&&T&&C.depth-T.depth<=1){if(T.node.type===p)return c.liftListItem(h);if(eh(T.node.type.name,d)&&p.validContent(T.node.content)&&a)return l().command(()=>(o.setNodeMarkup(T.pos,p),!0)).command(()=>Xl(o,p)).command(()=>Ql(o,p)).run()}return!n||!_||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Xl(o,p)).command(()=>Ql(o,p)).run():l().command(()=>{let I=u().wrapInList(p,r),v=_.filter(L=>f.includes(L.type.name));return o.ensureMarks(v),I?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Xl(o,p)).command(()=>Ql(o,p)).run()},OS=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=Ln(t,r.schema);return oc(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},RS=(t,e,n={})=>({state:r,commands:i})=>{let o=$e(t,r.schema),s=$e(e,r.schema),a=Ti(r,o,n),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},IS=(t,e={})=>({state:n,commands:r})=>{let i=$e(t,n.schema);return Ti(n,i,e)?r.lift(i):r.wrapIn(i,e)},DS=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){let l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},LS=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},PS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ln(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&s){let{from:f,to:p}=a,h=(o=c.marks().find(g=>g.type===l))===null||o===void 0?void 0:o.attrs,m=cc(c,l,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},BS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=qo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=$e(t,r.schema)),a==="mark"&&(s=Ln(t,r.schema)),i&&n.selection.ranges.forEach(l=>{let c=l.$from.pos,u=l.$to.pos,d,f,p,h;n.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{o&&o===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g=c&&g<=u&&(o&&o===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){let k=Math.max(g,c),C=Math.min(g+m.nodeSize,u);n.addMark(k,C,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(p,h,s.create({...m.attrs,...e}))}))}),!0):!1},zS=(t,e={})=>({state:n,dispatch:r})=>{let i=$e(t,n.schema);return Kp(i,e)(n,r)},FS=(t,e={})=>({state:n,dispatch:r})=>{let i=$e(t,n.schema);return Gp(i,e)(n,r)},US=Object.freeze({__proto__:null,blur:T0,clearContent:C0,clearNodes:A0,command:N0,createParagraphNear:v0,cut:M0,deleteCurrentNode:O0,deleteNode:R0,deleteRange:I0,deleteSelection:D0,enter:L0,exitCode:P0,extendMarkRange:B0,first:z0,focus:U0,forEach:$0,insertContent:H0,insertContentAt:G0,joinBackward:j0,joinDown:q0,joinForward:Y0,joinItemBackward:J0,joinItemForward:Z0,joinTextblockBackward:X0,joinTextblockForward:Q0,joinUp:V0,keyboardShortcut:tS,lift:nS,liftEmptyBlock:rS,liftListItem:iS,newlineInCode:oS,resetAttributes:sS,scrollIntoView:aS,selectAll:lS,selectNodeBackward:cS,selectNodeForward:uS,selectParentNode:dS,selectTextblockEnd:fS,selectTextblockStart:pS,setContent:hS,setMark:SS,setMeta:xS,setNode:_S,setNodeSelection:TS,setTextSelection:CS,sinkListItem:AS,splitBlock:NS,splitListItem:vS,toggleList:MS,toggleMark:OS,toggleNode:RS,toggleWrap:IS,undoInputRule:DS,unsetAllMarks:LS,unsetMark:PS,updateAttributes:BS,wrapIn:zS,wrapInList:FS}),$S=He.create({name:"commands",addCommands(){return{...US}}}),HS=He.create({name:"drop",addProseMirrorPlugins(){return[new he({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),WS=He.create({name:"editable",addProseMirrorPlugins(){return[new he({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),KS=new xe("focusEvents"),GS=He.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new he({key:KS,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),VS=He.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{let{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&h.parent.childCount===1?g===d.pos:q.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Wo()||uh()?o:i},addProseMirrorPlugins(){return[new he({key:new xe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;let r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=e.selection,l=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!pc(n.doc))return;let f=n.tr,p=Ko({state:n,transaction:f}),{commands:h}=new Ur({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),qS=He.create({name:"paste",addProseMirrorPlugins(){return[new he({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),jS=He.create({name:"tabindex",addProseMirrorPlugins(){return[new he({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var sc=class t{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new t(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new t(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new t(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;let l=new t(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new t(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){let o=i.node.attrs,s=Object.keys(n);for(let a=0;a{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},YS=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +} + +.tippy-box[data-animation=fade][data-state=hidden] { + opacity: 0 +}`;function JS(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var Hr=class extends ec{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=JS(YS,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){let r=rh(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;let n=this.state.plugins,r=n;if([].concat(e).forEach(o=>{let s=typeof o=="string"?`${o}$`:o.key;r=r.filter(a=>!a.key.startsWith(s))}),n.length===r.length)return;let i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;let i=[...this.options.enableCoreExtensions?[WS,_0.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),$S,GS,VS,jS,HS,qS].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new rc(i,this)}createCommandManager(){this.commandManager=new Ur({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=ic(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=ic(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=lh(n,this.options.autofocus);this.view=new ki(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:wo.create({doc:n,selection:r||void 0})});let i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();let o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}let n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return fc(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return kS(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ac(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` + +`,textSerializers:r={}}=e||{};return gS(this.state.doc,{blockSeparator:n,textSerializers:{...oh(this.schema),...r}})}get isEmpty(){return pc(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){let n=this.state.doc.resolve(e);return new sc(n,this)}get $doc(){return this.$pos(0)}};function qt(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=ne(t.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=e,s=r[r.length-1],a=r[0];if(s){let l=a.search(/\S/),c=n.from+a.indexOf(s),u=c+s.length;if(Yo(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;un.from&&o.delete(n.from+l,c);let f=n.from+l+s.length;o.addMark(n.from+l,f,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function Jo(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=ne(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from,a=n.to,l=t.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),u=s+c;u>a?u=a:a=u+r[1].length;let d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,a,l)}else if(r[0]){let c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function Ci(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=ne(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function jt(t){return new $r({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=ne(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&Nr(l,t.type,o);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){let{selection:d,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){let m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(t.keepAttributes){let d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}let u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Ut(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}var se=class t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ne(U(this,"addOptions",{name:this.name}))),this.storage=ne(U(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Vo(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ne(U(n,"addOptions",{name:n.name})),n.storage=ne(U(n,"addStorage",{name:n.name,options:n.options})),n}};function Lt(t){return new nc({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=ne(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=e,a=r[r.length-1],l=r[0],c=n.to;if(a){let u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Yo(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;fn.from&&s.delete(n.from+u,d),c=n.from+u+a.length,s.addMark(n.from+u,c,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function gh(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof V){let o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){let o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}var ZS=/^\s*>\s$/,bh=se.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[jt({find:ZS,type:this.type})]}});var XS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,QS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,tx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,yh=ut.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[qt({find:XS,type:this.type}),qt({find:ex,type:this.type})]},addPasteRules(){return[Lt({find:QS,type:this.type}),Lt({find:tx,type:this.type})]}});var nx="listItem",Eh="textStyle",kh=/^\s*([-+*])\s$/,wh=se.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nx,this.editor.getAttributes(Eh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=jt({find:kh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=jt({find:kh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Eh),editor:this.editor})),[t]}});var rx=/(^|[^`])`([^`]+)`(?!`)/,ix=/(^|[^`])`([^`]+)`(?!`)/g,Sh=ut.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[qt({find:rx,type:this.type})]},addPasteRules(){return[Lt({find:ix,type:this.type})]}});var ox=/^```([a-z]+)?[\s\n]$/,sx=/^~~~([a-z]+)?[\s\n]$/,Zo=se.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Q(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` + +`);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(q.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ci({find:ox,type:this.type,getAttributes:t=>({language:t[1]})}),Ci({find:sx,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new he({key:new xe("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;let{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,` +`));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(G.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var xh=se.create({name:"doc",topNode:!0,content:"block+"});function _h(t={}){return new he({view(e){return new hc(e,t)}})}var hc=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):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),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){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*a;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 l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,p=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*p}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=yo(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var Th=He.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_h(this.options)]}});var nt=class t extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):q.near(r)}content(){return P.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new mc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!ax(e)||!lx(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(t.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!V.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(t.valid(a))return a}return null}}};nt.prototype.visible=!1;nt.findFrom=nt.findGapCursorFrom;q.jsonID("gapcursor",nt);var mc=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return nt.valid(n)?new nt(n):q.near(n)}};function Ch(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function ax(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Ch(i.type))return!0;if(i.inlineContent)return!1}}return!0}function lx(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Ch(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ah(){return new he({props:{decorations:fx,createSelectionBetween(t,e,n){return e.pos==n.pos&&nt.valid(n)?new nt(n):null},handleClick:ux,handleKeyDown:cx,handleDOMEvents:{beforeinput:dx}}})}var cx=xi({ArrowLeft:Xo("horiz",-1),ArrowRight:Xo("horiz",1),ArrowUp:Xo("vert",-1),ArrowDown:Xo("vert",1)});function Xo(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof G){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=nt.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new nt(c))),!0):!1}}function ux(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!nt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&V.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new nt(r))),!0)}function dx(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof nt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=A.empty;for(let s=r.length-1;s>=0;s--)i=A.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new P(i,0,0));return o.setSelection(G.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function fx(t){if(!(t.selection instanceof nt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Be.create(t.doc,[tt.widget(t.selection.head,e,{key:"gapcursor"})])}var Nh=He.create({name:"gapCursor",addProseMirrorPlugins(){return[Ah()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ne(U(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}});var vh=se.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Q(this.options.HTMLAttributes,t)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){let d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Mh=se.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Q(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ci({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Qo=200,Ye=function(){};Ye.prototype.append=function(e){return e.length?(e=Ye.from(e),!this.length&&e||e.length=n?Ye.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ye.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ye.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ye.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};Ye.from=function(e){return e instanceof Ye?e:e&&e.length?new Oh(e):Ye.empty};var Oh=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Qo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Qo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ye);Ye.empty=new Oh([]);var px=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(Ye),gc=Ye;var hx=500,ar=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new Yt(d.map));let p=d.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Yt(h,void 0,void 0,c.length+u.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(o)):d.selection,l=new t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;ugx&&(a=mx(a,c),s-=c),new t(a.append(o),s)}remapping(e,n){let r=new ci;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Yt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=n;this.items.forEach(f=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(l+1,p));g&&a++,r.push(new Yt(h,m,g))}else r.push(new Yt(h))},i);let c=[];for(let f=n;fhx&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let d=new Yt(c.invert(),l,u),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new t(gc.from(i.reverse()),o)}};ar.empty=new ar(gc.empty,0);function mx(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var Yt=class t{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Jt=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},gx=20;function bx(t,e,n,r){let i=n.getMeta(sr),o;if(i)return i.historyState;n.getMeta(kx)&&(t=new Jt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(sr))return s.getMeta(sr).redo?new Jt(t.done.addTransform(n,void 0,r,es(e)),t.undone,Rh(n.mapping.maps),t.prevTime,t.prevComposition):new Jt(t.done,t.undone.addTransform(n,void 0,r,es(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yx(n,t.prevRanges)),c=s?bc(t.prevRanges,n.mapping):Rh(n.mapping.maps);return new Jt(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,es(e)),ar.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new Jt(t.done.rebased(n,o),t.undone.rebased(n,o),bc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Jt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),bc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yx(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function Rh(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function bc(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=sr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=Ex(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var Ec=ts(!1,!0),kc=ts(!0,!0),_O=ts(!1,!1),TO=ts(!0,!1);var Lh=He.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Ec(t,e),redo:()=>({state:t,dispatch:e})=>kc(t,e)}},addProseMirrorPlugins(){return[Dh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var Ph=se.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!gh(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):mh(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){let{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(G.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(V.create(s.doc,c.pos)):s.setSelection(G.create(s.doc,c.pos));else{let d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(u,d),s.setSelection(G.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Jo({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var wx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,_x=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Bh=ut.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[qt({find:wx,type:this.type}),qt({find:xx,type:this.type})]},addPasteRules(){return[Lt({find:Sx,type:this.type}),Lt({find:_x,type:this.type})]}});var zh=se.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Q(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var Tx="listItem",Fh="textStyle",Uh=/^(\d+)\.\s$/,$h=se.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",Q(this.options.HTMLAttributes,n),0]:["ol",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Tx,this.editor.getAttributes(Fh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=jt({find:Uh,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=jt({find:Uh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Fh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}});var Hh=se.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Cx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ax=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Wh=ut.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[qt({find:Cx,type:this.type})]},addPasteRules(){return[Lt({find:Ax,type:this.type})]}});var Kh=se.create({name:"text",group:"inline"});var ns=He.create({name:"starterKit",addExtensions(){let t=[];return this.options.bold!==!1&&t.push(yh.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(bh.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(wh.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Sh.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(Zo.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(xh.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(Th.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(Nh.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(vh.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Mh.configure(this.options.heading)),this.options.history!==!1&&t.push(Lh.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Ph.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Bh.configure(this.options.italic)),this.options.listItem!==!1&&t.push(zh.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push($h.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Hh.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Wh.configure(this.options.strike)),this.options.text!==!1&&t.push(Kh.configure(this.options.text)),t}});function Nx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Qh(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Qh(n)}),t}var is=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function em(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Pn(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var vx="",Gh=t=>!!t.scope,Mx=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},Sc=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=em(e)}openNode(e){if(!Gh(e))return;let n=Mx(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Gh(e)&&(this.buffer+=vx)}value(){return this.buffer}span(e){this.buffer+=``}},Vh=(t={})=>{let e={children:[]};return Object.assign(e,t),e},xc=class t{constructor(){this.rootNode=Vh(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=Vh({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},_c=class extends xc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Sc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ai(t){return t?typeof t=="string"?t:t.source:null}function tm(t){return cr("(?=",t,")")}function Ox(t){return cr("(?:",t,")*")}function Rx(t){return cr("(?:",t,")?")}function cr(...t){return t.map(n=>Ai(n)).join("")}function Ix(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Cc(...t){return"("+(Ix(t).capture?"":"?:")+t.map(r=>Ai(r)).join("|")+")"}function nm(t){return new RegExp(t.toString()+"|").exec("").length-1}function Dx(t,e){let n=t&&t.exec(e);return n&&n.index===0}var Lx=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ac(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Ai(r),s="";for(;o.length>0;){let a=Lx.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var Px=/\b\B/,rm="[a-zA-Z]\\w*",Nc="[a-zA-Z_]\\w*",im="\\b\\d+(\\.\\d+)?",om="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",sm="\\b(0b[01]+)",Bx="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",zx=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=cr(e,/.*\b/,t.binary,/\b.*/)),Pn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ni={begin:"\\\\[\\s\\S]",relevance:0},Fx={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ni]},Ux={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ni]},$x={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},as=function(t,e,n={}){let r=Pn({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=Cc("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:cr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Hx=as("//","$"),Wx=as("/\\*","\\*/"),Kx=as("#","$"),Gx={scope:"number",begin:im,relevance:0},Vx={scope:"number",begin:om,relevance:0},qx={scope:"number",begin:sm,relevance:0},jx={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ni,{begin:/\[/,end:/\]/,relevance:0,contains:[Ni]}]},Yx={scope:"title",begin:rm,relevance:0},Jx={scope:"title",begin:Nc,relevance:0},Zx={begin:"\\.\\s*"+Nc,relevance:0},Xx=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},rs=Object.freeze({__proto__:null,APOS_STRING_MODE:Fx,BACKSLASH_ESCAPE:Ni,BINARY_NUMBER_MODE:qx,BINARY_NUMBER_RE:sm,COMMENT:as,C_BLOCK_COMMENT_MODE:Wx,C_LINE_COMMENT_MODE:Hx,C_NUMBER_MODE:Vx,C_NUMBER_RE:om,END_SAME_AS_BEGIN:Xx,HASH_COMMENT_MODE:Kx,IDENT_RE:rm,MATCH_NOTHING_RE:Px,METHOD_GUARD:Zx,NUMBER_MODE:Gx,NUMBER_RE:im,PHRASAL_WORDS_MODE:$x,QUOTE_STRING_MODE:Ux,REGEXP_MODE:jx,RE_STARTERS_RE:Bx,SHEBANG:zx,TITLE_MODE:Yx,UNDERSCORE_IDENT_RE:Nc,UNDERSCORE_TITLE_MODE:Jx});function Qx(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function e_(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function t_(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Qx,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function n_(t,e){Array.isArray(t.illegal)&&(t.illegal=Cc(...t.illegal))}function r_(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function i_(t,e){t.relevance===void 0&&(t.relevance=1)}var o_=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=cr(n.beforeMatch,tm(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},s_=["of","and","for","in","not","or","if","then","parent","list","value"],a_="keyword";function am(t,e,n=a_){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,am(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[o,l_(l[0],l[1])]})}}function l_(t,e){return e?Number(e):c_(t)?0:1}function c_(t){return s_.includes(t.toLowerCase())}var qh={},lr=t=>{console.error(t)},jh=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Wr=(t,e)=>{qh[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),qh[`${t}/${e}`]=!0)},ss=new Error;function lm(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=nm(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function u_(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw lr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ss;if(typeof t.beginScope!="object"||t.beginScope===null)throw lr("beginScope must be object"),ss;lm(t,t.begin,{key:"beginScope"}),t.begin=Ac(t.begin,{joinWith:""})}}function d_(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw lr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ss;if(typeof t.endScope!="object"||t.endScope===null)throw lr("endScope must be object"),ss;lm(t,t.end,{key:"endScope"}),t.end=Ac(t.end,{joinWith:""})}}function f_(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function p_(t){f_(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),u_(t),d_(t)}function h_(t){function e(s,a){return new RegExp(Ai(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=nm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(Ac(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){let a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){let l=s;if(s.isCompiled)return l;[e_,r_,p_,o_].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[t_,n_,i_].forEach(u=>u(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=am(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=Ai(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(u){return m_(u==="self"?s:u)})),s.contains.forEach(function(u){o(u,l)}),s.starts&&o(s.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Pn(t.classNameAliases||{}),o(t)}function cm(t){return t?t.endsWithParent||cm(t.starts):!1}function m_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Pn(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:cm(t)?Pn(t,{starts:t.starts?Pn(t.starts):null}):Object.isFrozen(t)?Pn(t):t}var g_="11.10.0",Tc=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},wc=em,Yh=Pn,Jh=Symbol("nomatch"),b_=7,um=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:_c};function l(E){return a.noHighlightRe.test(E)}function c(E){let S=E.className+" ";S+=E.parentNode?E.parentNode.className:"";let B=a.languageDetectRe.exec(S);if(B){let H=F(B[1]);return H||(jh(o.replace("{}",B[1])),jh("Falling back to no-highlight mode for this block.",E)),H?B[1]:"no-highlight"}return S.split(/\s+/).find(H=>l(H)||F(H))}function u(E,S,B){let H="",$="";typeof S=="object"?(H=E,B=S.ignoreIllegals,$=S.language):(Wr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Wr("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),$=E,H=S),B===void 0&&(B=!0);let ie={code:H,language:$};pe("before:highlight",ie);let oe=ie.result?ie.result:d(ie.language,ie.code,B);return oe.code=ie.code,pe("after:highlight",oe),oe}function d(E,S,B,H){let $=Object.create(null);function ie(w,N){return w.keywords[N]}function oe(){if(!Y.keywords){X.addText(ce);return}let w=0;Y.keywordPatternRe.lastIndex=0;let N=Y.keywordPatternRe.exec(ce),z="";for(;N;){z+=ce.substring(w,N.index);let Z=ee.case_insensitive?N[0].toLowerCase():N[0],be=ie(Y,Z);if(be){let[Et,Cn]=be;if(X.addText(z),z="",$[Z]=($[Z]||0)+1,$[Z]<=b_&&(yt+=Cn),Et.startsWith("_"))z+=N[0];else{let wr=ee.classNameAliases[Et]||Et;Ne(N[0],wr)}}else z+=N[0];w=Y.keywordPatternRe.lastIndex,N=Y.keywordPatternRe.exec(ce)}z+=ce.substring(w),X.addText(z)}function Ae(){if(ce==="")return;let w=null;if(typeof Y.subLanguage=="string"){if(!e[Y.subLanguage]){X.addText(ce);return}w=d(Y.subLanguage,ce,!0,Se[Y.subLanguage]),Se[Y.subLanguage]=w._top}else w=p(ce,Y.subLanguage.length?Y.subLanguage:null);Y.relevance>0&&(yt+=w.relevance),X.__addSublanguage(w._emitter,w.language)}function J(){Y.subLanguage!=null?Ae():oe(),ce=""}function Ne(w,N){w!==""&&(X.startScope(N),X.addText(w),X.endScope())}function Nt(w,N){let z=1,Z=N.length-1;for(;z<=Z;){if(!w._emit[z]){z++;continue}let be=ee.classNameAliases[w[z]]||w[z],Et=N[z];be?Ne(Et,be):(ce=Et,oe(),ce=""),z++}}function Ke(w,N){return w.scope&&typeof w.scope=="string"&&X.openNode(ee.classNameAliases[w.scope]||w.scope),w.beginScope&&(w.beginScope._wrap?(Ne(ce,ee.classNameAliases[w.beginScope._wrap]||w.beginScope._wrap),ce=""):w.beginScope._multi&&(Nt(w.beginScope,N),ce="")),Y=Object.create(w,{parent:{value:Y}}),Y}function nn(w,N,z){let Z=Dx(w.endRe,z);if(Z){if(w["on:end"]){let be=new is(w);w["on:end"](N,be),be.isMatchIgnored&&(Z=!1)}if(Z){for(;w.endsParent&&w.parent;)w=w.parent;return w}}if(w.endsWithParent)return nn(w.parent,N,z)}function rn(w){return Y.matcher.regexIndex===0?(ce+=w[0],1):(D=!0,0)}function _n(w){let N=w[0],z=w.rule,Z=new is(z),be=[z.__beforeBegin,z["on:begin"]];for(let Et of be)if(Et&&(Et(w,Z),Z.isMatchIgnored))return rn(N);return z.skip?ce+=N:(z.excludeBegin&&(ce+=N),J(),!z.returnBegin&&!z.excludeBegin&&(ce=N)),Ke(z,w),z.returnBegin?0:N.length}function Tn(w){let N=w[0],z=S.substring(w.index),Z=nn(Y,w,z);if(!Z)return Jh;let be=Y;Y.endScope&&Y.endScope._wrap?(J(),Ne(N,Y.endScope._wrap)):Y.endScope&&Y.endScope._multi?(J(),Nt(Y.endScope,w)):be.skip?ce+=N:(be.returnEnd||be.excludeEnd||(ce+=N),J(),be.excludeEnd&&(ce=N));do Y.scope&&X.closeNode(),!Y.skip&&!Y.subLanguage&&(yt+=Y.relevance),Y=Y.parent;while(Y!==Z.parent);return Z.starts&&Ke(Z.starts,w),be.returnEnd?0:N.length}function ot(){let w=[];for(let N=Y;N!==ee;N=N.parent)N.scope&&w.unshift(N.scope);w.forEach(N=>X.openNode(N))}let gt={};function ve(w,N){let z=N&&N[0];if(ce+=w,z==null)return J(),0;if(gt.type==="begin"&&N.type==="end"&>.index===N.index&&z===""){if(ce+=S.slice(N.index,N.index+1),!i){let Z=new Error(`0 width match regex (${E})`);throw Z.languageName=E,Z.badRule=gt.rule,Z}return 1}if(gt=N,N.type==="begin")return _n(N);if(N.type==="illegal"&&!B){let Z=new Error('Illegal lexeme "'+z+'" for mode "'+(Y.scope||"")+'"');throw Z.mode=Y,Z}else if(N.type==="end"){let Z=Tn(N);if(Z!==Jh)return Z}if(N.type==="illegal"&&z==="")return 1;if(_t>1e5&&_t>N.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ce+=z,z.length}let ee=F(E);if(!ee)throw lr(o.replace("{}",E)),new Error('Unknown language: "'+E+'"');let bt=h_(ee),K="",Y=H||bt,Se={},X=new a.__emitter(a);ot();let ce="",yt=0,st=0,_t=0,D=!1;try{if(ee.__emitTokens)ee.__emitTokens(S,X);else{for(Y.matcher.considerAll();;){_t++,D?D=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=st;let w=Y.matcher.exec(S);if(!w)break;let N=S.substring(st,w.index),z=ve(N,w);st=w.index+z}ve(S.substring(st))}return X.finalize(),K=X.toHTML(),{language:E,value:K,relevance:yt,illegal:!1,_emitter:X,_top:Y}}catch(w){if(w.message&&w.message.includes("Illegal"))return{language:E,value:wc(S),illegal:!0,relevance:0,_illegalBy:{message:w.message,index:st,context:S.slice(st-100,st+100),mode:w.mode,resultSoFar:K},_emitter:X};if(i)return{language:E,value:wc(S),illegal:!1,relevance:0,errorRaised:w,_emitter:X,_top:Y};throw w}}function f(E){let S={value:wc(E),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return S._emitter.addText(E),S}function p(E,S){S=S||a.languages||Object.keys(e);let B=f(E),H=S.filter(F).filter(le).map(J=>d(J,E,!1));H.unshift(B);let $=H.sort((J,Ne)=>{if(J.relevance!==Ne.relevance)return Ne.relevance-J.relevance;if(J.language&&Ne.language){if(F(J.language).supersetOf===Ne.language)return 1;if(F(Ne.language).supersetOf===J.language)return-1}return 0}),[ie,oe]=$,Ae=ie;return Ae.secondBest=oe,Ae}function h(E,S,B){let H=S&&n[S]||B;E.classList.add("hljs"),E.classList.add(`language-${H}`)}function m(E){let S=null,B=c(E);if(l(B))return;if(pe("before:highlightElement",{el:E,language:B}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(E)),a.throwUnescapedHTML))throw new Tc("One of your code blocks includes unescaped HTML.",E.innerHTML);S=E;let H=S.textContent,$=B?u(H,{language:B,ignoreIllegals:!0}):p(H);E.innerHTML=$.value,E.dataset.highlighted="yes",h(E,B,$.language),E.result={language:$.language,re:$.relevance,relevance:$.relevance},$.secondBest&&(E.secondBest={language:$.secondBest.language,relevance:$.secondBest.relevance}),pe("after:highlightElement",{el:E,result:$,text:H})}function g(E){a=Yh(a,E)}let b=()=>{_(),Wr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){_(),Wr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let C=!1;function _(){if(document.readyState==="loading"){C=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function T(){C&&_()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",T,!1);function I(E,S){let B=null;try{B=S(t)}catch(H){if(lr("Language definition for '{}' could not be registered.".replace("{}",E)),i)lr(H);else throw H;B=s}B.name||(B.name=E),e[E]=B,B.rawDefinition=S.bind(null,t),B.aliases&&fe(B.aliases,{languageName:E})}function v(E){delete e[E];for(let S of Object.keys(n))n[S]===E&&delete n[S]}function L(){return Object.keys(e)}function F(E){return E=(E||"").toLowerCase(),e[E]||e[n[E]]}function fe(E,{languageName:S}){typeof E=="string"&&(E=[E]),E.forEach(B=>{n[B.toLowerCase()]=S})}function le(E){let S=F(E);return S&&!S.disableAutodetect}function Ee(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=S=>{E["before:highlightBlock"](Object.assign({block:S.el},S))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=S=>{E["after:highlightBlock"](Object.assign({block:S.el},S))})}function De(E){Ee(E),r.push(E)}function ge(E){let S=r.indexOf(E);S!==-1&&r.splice(S,1)}function pe(E,S){let B=E;r.forEach(function(H){H[B]&&H[B](S)})}function x(E){return Wr("10.7.0","highlightBlock will be removed entirely in v12.0"),Wr("10.7.0","Please use highlightElement now."),m(E)}Object.assign(t,{highlight:u,highlightAuto:p,highlightAll:_,highlightElement:m,highlightBlock:x,configure:g,initHighlighting:b,initHighlightingOnLoad:k,registerLanguage:I,unregisterLanguage:v,listLanguages:L,getLanguage:F,registerAliases:fe,autoDetection:le,inherit:Yh,addPlugin:De,removePlugin:ge}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=g_,t.regex={concat:cr,lookahead:tm,either:Cc,optional:Rx,anyNumberOfTimes:Ox};for(let E in rs)typeof rs[E]=="object"&&Qh(rs[E]);return Object.assign(t,rs),t},Kr=um({});Kr.newInstance=()=>um({});var y_=Kr;Kr.HighlightJS=Kr;Kr.default=Kr;var E_=Nx(y_);function dm(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?dm(n.children,r):{text:n.value,classes:r}}).flat()}function Zh(t){return t.value||t.children||[]}function k_(t){return!!E_.getLanguage(t)}function Xh({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return jo(t,o=>o.type.name===e).forEach(o=>{var s;let a=o.pos+1,l=o.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||k_(l)||!((s=n.registered)===null||s===void 0)&&s.call(n,l))?Zh(n.highlight(l,o.node.textContent)):Zh(n.highlightAuto(o.node.textContent));dm(u).forEach(d=>{let f=a+d.text.length;if(d.classes.length){let p=tt.inline(a,f,{class:d.classes.join(" ")});i.push(p)}a=f})}),Be.create(t,i)}function w_(t){return typeof t=="function"}function S_({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>w_(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new he({key:new xe("lowlight"),state:{init:(i,{doc:o})=>Xh({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,a)=>{let l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=jo(s.doc,f=>f.type.name===t),d=jo(a.doc,f=>f.type.name===t);return i.docChanged&&([l,c].includes(t)||d.length!==u.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Xh({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var fm=Zo.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],S_({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});var ls=ut.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var x_="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",__="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Lc="numeric",Pc="ascii",Bc="alpha",Oi="asciinumeric",Mi="alphanumeric",zc="domain",Em="emoji",T_="scheme",C_="slashscheme",vc="whitespace";function A_(t,e){return t in e||(e[t]=[]),e[t]}function ur(t,e,n){e[Lc]&&(e[Oi]=!0,e[Mi]=!0),e[Pc]&&(e[Oi]=!0,e[Bc]=!0),e[Oi]&&(e[Mi]=!0),e[Bc]&&(e[Mi]=!0),e[Mi]&&(e[zc]=!0),e[Em]&&(e[zc]=!0);for(let r in e){let i=A_(r,n);i.indexOf(t)<0&&i.push(t)}}function N_(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function St(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}St.groups={};St.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,i),Me=(t,e,n,r,i)=>t.tr(e,n,r,i),pm=(t,e,n,r,i)=>t.ts(e,n,r,i),O=(t,e,n,r,i)=>t.tt(e,n,r,i),En="WORD",Fc="UWORD",km="ASCIINUMERICAL",wm="ALPHANUMERICAL",Bi="LOCALHOST",Uc="TLD",$c="UTLD",fs="SCHEME",Gr="SLASH_SCHEME",Wc="NUM",Hc="WS",Kc="NL",Ri="OPENBRACE",Ii="CLOSEBRACE",ps="OPENBRACKET",hs="CLOSEBRACKET",ms="OPENPAREN",gs="CLOSEPAREN",bs="OPENANGLEBRACKET",ys="CLOSEANGLEBRACKET",Es="FULLWIDTHLEFTPAREN",ks="FULLWIDTHRIGHTPAREN",ws="LEFTCORNERBRACKET",Ss="RIGHTCORNERBRACKET",xs="LEFTWHITECORNERBRACKET",_s="RIGHTWHITECORNERBRACKET",Ts="FULLWIDTHLESSTHAN",Cs="FULLWIDTHGREATERTHAN",As="AMPERSAND",Ns="APOSTROPHE",vs="ASTERISK",zn="AT",Ms="BACKSLASH",Os="BACKTICK",Rs="CARET",Fn="COLON",Gc="COMMA",Is="DOLLAR",Zt="DOT",Ds="EQUALS",Vc="EXCLAMATION",Bt="HYPHEN",Di="PERCENT",Ls="PIPE",Ps="PLUS",Bs="POUND",Li="QUERY",qc="QUOTE",Sm="FULLWIDTHMIDDLEDOT",jc="SEMI",Xt="SLASH",Pi="TILDE",zs="UNDERSCORE",xm="EMOJI",Fs="SYM",_m=Object.freeze({__proto__:null,ALPHANUMERICAL:wm,AMPERSAND:As,APOSTROPHE:Ns,ASCIINUMERICAL:km,ASTERISK:vs,AT:zn,BACKSLASH:Ms,BACKTICK:Os,CARET:Rs,CLOSEANGLEBRACKET:ys,CLOSEBRACE:Ii,CLOSEBRACKET:hs,CLOSEPAREN:gs,COLON:Fn,COMMA:Gc,DOLLAR:Is,DOT:Zt,EMOJI:xm,EQUALS:Ds,EXCLAMATION:Vc,FULLWIDTHGREATERTHAN:Cs,FULLWIDTHLEFTPAREN:Es,FULLWIDTHLESSTHAN:Ts,FULLWIDTHMIDDLEDOT:Sm,FULLWIDTHRIGHTPAREN:ks,HYPHEN:Bt,LEFTCORNERBRACKET:ws,LEFTWHITECORNERBRACKET:xs,LOCALHOST:Bi,NL:Kc,NUM:Wc,OPENANGLEBRACKET:bs,OPENBRACE:Ri,OPENBRACKET:ps,OPENPAREN:ms,PERCENT:Di,PIPE:Ls,PLUS:Ps,POUND:Bs,QUERY:Li,QUOTE:qc,RIGHTCORNERBRACKET:Ss,RIGHTWHITECORNERBRACKET:_s,SCHEME:fs,SEMI:jc,SLASH:Xt,SLASH_SCHEME:Gr,SYM:Fs,TILDE:Pi,TLD:Uc,UNDERSCORE:zs,UTLD:$c,UWORD:Fc,WORD:En,WS:Hc}),bn=/[a-z]/,vi=/\p{L}/u,Mc=/\p{Emoji}/u;var yn=/\d/,Oc=/\s/;var hm="\r",Rc=` +`,v_="\uFE0F",M_="\u200D",Ic="\uFFFC",cs=null,us=null;function O_(t=[]){let e={};St.groups=e;let n=new St;cs==null&&(cs=mm(x_)),us==null&&(us=mm(__)),O(n,"'",Ns),O(n,"{",Ri),O(n,"}",Ii),O(n,"[",ps),O(n,"]",hs),O(n,"(",ms),O(n,")",gs),O(n,"<",bs),O(n,">",ys),O(n,"\uFF08",Es),O(n,"\uFF09",ks),O(n,"\u300C",ws),O(n,"\u300D",Ss),O(n,"\u300E",xs),O(n,"\u300F",_s),O(n,"\uFF1C",Ts),O(n,"\uFF1E",Cs),O(n,"&",As),O(n,"*",vs),O(n,"@",zn),O(n,"`",Os),O(n,"^",Rs),O(n,":",Fn),O(n,",",Gc),O(n,"$",Is),O(n,".",Zt),O(n,"=",Ds),O(n,"!",Vc),O(n,"-",Bt),O(n,"%",Di),O(n,"|",Ls),O(n,"+",Ps),O(n,"#",Bs),O(n,"?",Li),O(n,'"',qc),O(n,"/",Xt),O(n,";",jc),O(n,"~",Pi),O(n,"_",zs),O(n,"\\",Ms),O(n,"\u30FB",Sm);let r=Me(n,yn,Wc,{[Lc]:!0});Me(r,yn,r);let i=Me(r,bn,km,{[Oi]:!0}),o=Me(r,vi,wm,{[Mi]:!0}),s=Me(n,bn,En,{[Pc]:!0});Me(s,yn,i),Me(s,bn,s),Me(i,yn,i),Me(i,bn,i);let a=Me(n,vi,Fc,{[Bc]:!0});Me(a,bn),Me(a,yn,o),Me(a,vi,a),Me(o,yn,o),Me(o,bn),Me(o,vi,o);let l=O(n,Rc,Kc,{[vc]:!0}),c=O(n,hm,Hc,{[vc]:!0}),u=Me(n,Oc,Hc,{[vc]:!0});O(n,Ic,u),O(c,Rc,l),O(c,Ic,u),Me(c,Oc,u),O(u,hm),O(u,Rc),Me(u,Oc,u),O(u,Ic,u);let d=Me(n,Mc,xm,{[Em]:!0});O(d,"#"),Me(d,Mc,d),O(d,v_,d);let f=O(d,M_);O(f,"#"),Me(f,Mc,d);let p=[[bn,s],[yn,i]],h=[[bn,null],[vi,a],[yn,o]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?k[zc]=!0:bn.test(g)?yn.test(g)?k[Oi]=!0:k[Pc]=!0:k[Lc]=!0,pm(n,g,g,k)}return pm(n,"localhost",Bi,{ascii:!0}),n.jd=new St(Fs),{start:n,tokens:Object.assign({groups:e},_m)}}function Tm(t,e){let n=R_(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s=0&&(d+=n[s].length,f++),c+=n[s].length,o+=n[s].length,s++;o-=d,s-=f,c-=d,i.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function R_(t){let e=[],n=t.length,r=0;for(;r56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Bn(t,e,n,r,i){let o,s=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}var zi={defaultProtocol:"http",events:null,format:gm,formatHref:gm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Yc(t,e=null){let n=Object.assign({},zi);t&&(n=Object.assign(n,t instanceof Yc?t.o:t));let r=n.ignoreTags,i=[];for(let o=0;on?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=zi.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:d}}};function Us(t,e){class n extends Cm{constructor(i,o){super(i,o),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var bm=Us("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ym=Us("text"),I_=Us("nl"),ds=Us("url",{isLink:!0,toHref(t=zi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==Bi&&t[1].t===Fn}});var Pt=t=>new St(t);function D_({groups:t}){let e=t.domain.concat([As,vs,zn,Ms,Os,Rs,Is,Ds,Bt,Wc,Di,Ls,Ps,Bs,Xt,Fs,Pi,zs]),n=[Ns,Fn,Gc,Zt,Vc,Di,Li,qc,jc,bs,ys,Ri,Ii,hs,ps,ms,gs,Es,ks,ws,Ss,xs,_s,Ts,Cs],r=[As,Ns,vs,Ms,Os,Rs,Is,Ds,Bt,Ri,Ii,Di,Ls,Ps,Bs,Li,Xt,Fs,Pi,zs],i=Pt(),o=O(i,Pi);re(o,r,o),re(o,t.domain,o);let s=Pt(),a=Pt(),l=Pt();re(i,t.domain,s),re(i,t.scheme,a),re(i,t.slashscheme,l),re(s,r,o),re(s,t.domain,s);let c=O(s,zn);O(o,zn,c),O(a,zn,c),O(l,zn,c);let u=O(o,Zt);re(u,r,o),re(u,t.domain,o);let d=Pt();re(c,t.domain,d),re(d,t.domain,d);let f=O(d,Zt);re(f,t.domain,d);let p=Pt(bm);re(f,t.tld,p),re(f,t.utld,p),O(c,Bi,p);let h=O(d,Bt);O(h,Bt,h),re(h,t.domain,d),re(p,t.domain,d),O(p,Zt,f),O(p,Bt,h);let m=O(p,Fn);re(m,t.numeric,bm);let g=O(s,Bt),b=O(s,Zt);O(g,Bt,g),re(g,t.domain,s),re(b,r,o),re(b,t.domain,s);let k=Pt(ds);re(b,t.tld,k),re(b,t.utld,k),re(k,t.domain,s),re(k,r,o),O(k,Zt,b),O(k,Bt,g),O(k,zn,c);let C=O(k,Fn),_=Pt(ds);re(C,t.numeric,_);let T=Pt(ds),I=Pt();re(T,e,T),re(T,n,I),re(I,e,T),re(I,n,I),O(k,Xt,T),O(_,Xt,T);let v=O(a,Fn),L=O(l,Fn),F=O(L,Xt),fe=O(F,Xt);re(a,t.domain,s),O(a,Zt,b),O(a,Bt,g),re(l,t.domain,s),O(l,Zt,b),O(l,Bt,g),re(v,t.domain,T),O(v,Xt,T),O(v,Li,T),re(fe,t.domain,T),re(fe,e,T),O(fe,Xt,T);let le=[[Ri,Ii],[ps,hs],[ms,gs],[bs,ys],[Es,ks],[ws,Ss],[xs,_s],[Ts,Cs]];for(let Ee=0;Ee=0&&f++,i++,u++;if(f<0)i-=u,i0&&(o.push(Dc(ym,e,s)),s=[]),i-=f,u-=f;let p=d.t,h=n.slice(i-u,i);o.push(Dc(p,e,h))}}return s.length>0&&o.push(Dc(ym,e,s)),o}function Dc(t,e,n){let r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}var P_=typeof console<"u"&&console&&console.warn||(()=>{}),B_="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",_e={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Am(){return St.groups={},_e.scanner=null,_e.parser=null,_e.tokenQueue=[],_e.pluginQueue=[],_e.customSchemes=[],_e.initialized=!1,_e}function Jc(t,e=!1){if(_e.initialized&&P_(`linkifyjs: already initialized - will not register custom scheme "${t}" ${B_}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);_e.customSchemes.push([t,e])}function z_(){_e.scanner=O_(_e.customSchemes);for(let t=0;t<_e.tokenQueue.length;t++)_e.tokenQueue[t][1]({scanner:_e.scanner});_e.parser=D_(_e.scanner.tokens);for(let t=0;t<_e.pluginQueue.length;t++)_e.pluginQueue[t][1]({scanner:_e.scanner,parser:_e.parser});return _e.initialized=!0,_e}function $s(t){return _e.initialized||z_(),L_(_e.parser.start,t,Tm(_e.scanner.start,t))}$s.scan=Tm;function Zc(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}let r=new Yc(n),i=$s(t),o=[];for(let s=0;s{let i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,a=fh(n.doc,[...e]);if(hh(a).forEach(({newRange:c})=>{let u=ph(r.doc,c,p=>p.isTextblock),d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){let p=r.doc.textBetween(c.from,c.to," "," ");if(!U_.test(p))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){let p=f.split(F_).filter(Boolean);if(p.length<=0)return!1;let h=p[p.length-1],m=d.pos+f.lastIndexOf(h);if(!h)return!1;let g=$s(h).map(b=>b.toObject(t.defaultProtocol));if(!H_(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Yo(b.from,b.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function K_(t){return new he({key:new xe("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target,a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(f=>f.nodeName==="A"))return!1;let l=fc(e.state,t.type.name),c=r.target,u=(i=c?.href)!==null&&i!==void 0?i:l.href,d=(o=c?.target)!==null&&o!==void 0?o:l.target;return c&&u?(window.open(u,d),!0):!1}}})}function G_(t){return new he({key:new xe("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});let l=Zc(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function dr(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace($_,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Nm=ut.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Jc(t);return}Jc(t.scheme,t.optionalSlashes)})},onDestroy(){Am()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!dr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!dr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!dr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Q(this.options.HTMLAttributes,t),0]:["a",Q(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!dr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!dr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Lt({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=Zc(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!dr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(W_({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!dr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(K_({type:this.type})),this.options.linkOnPaste&&t.push(G_({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var eu,tu;if(typeof WeakMap<"u"){let t=new WeakMap;eu=e=>t.get(e),tu=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;eu=r=>{for(let i=0;i(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Oe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:b-C});break}let _=i+C*e;for(let T=0;Tr&&(o+=c.attrs.colspan)}}for(let s=0;s1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function j_(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function J_(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function $t(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function qs(t){let e=t.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 n=fr(e.$head)||Z_(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Z_(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function nu(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function X_(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ou(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function zm(t,e,n){let r=t.node(-1),i=Oe.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function pr(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Fm(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;iu!=n.pos-o);l.unshift(n.pos-o);let c=l.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=o+u+1;return new Or(a.resolve(f),a.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(nu(r)&&nu(i)&&ou(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?kn.rowSelection(r,i):o&&this.isColSelection()?kn.colSelection(r,i):new kn(r,i)}return G.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=Oe.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l0||g>0){let b=h.attrs;if(m>0&&(b=pr(b,0,m)),g>0&&(b=pr(b,b.colspan-g,g)),p.lefti.bottom){let b={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),i=Oe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom0&&(n=l.resolve(o+i.map[a.left])),s.bottom0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof kn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=Oe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right{e.push(tt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Be.create(t.doc,e)}function nT({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function rT({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function iT(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof V&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=we.create(i,r.from);else if(s=="row"){let a=i.resolve(r.from+1);o=we.rowSelection(a,a)}else if(!n){let a=Oe.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=we.create(i,l+1,c)}}else r instanceof G&&nT(r)?o=G.create(i,r.from):r instanceof G&&rT(r)&&(o=G.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var oT=new xe("fix-tables");function $m(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s{i.type.spec.tableRole=="table"&&(n=sT(t,i,o,n))};return e?e.doc!=t.doc&&$m(e.doc,t.doc,0,r):t.doc.descendants(r),n}function sT(t,e,n,r){let i=Oe.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let l=0;l0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);let h=[];for(let g=0;g0?-1:0;Q_(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s0&&i0&&e.map[a-1]==l||i0?-1:0;lT(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c0&&i0&&d==e.map[u-e.width]){let f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i0&&n[o]==n[o-1]||r.right0&&n[i]==n[i-t]||r.bottom0){let u=l+1+c.content.size,d=vm(c)?l+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,a)}o.setSelection(new we(o.doc.resolve(l+r.tableStart))),e(o)}return!0}function lu(t,e){let n=rt(t.schema);return dT(({node:r})=>n[r.type.spec.tableRole])(t,e)}function dT(t){return(e,n)=>{let r=e.selection,i,o;if(r instanceof we){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var s;if(i=J_(r.$from),!i)return!1;o=(s=fr(r.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let u=Qt(e),d=e.tr;for(let p=0;p{s.attrs[t]!==e&&o.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function fT(t){return function(e,n){if(!$t(e))return!1;if(n){let r=rt(e.schema),i=Qt(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l{let p=f+o.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,d,h.attrs)}),r(s)}return!0}}var M1=Vr("row",{useDeprecatedLogic:!0}),O1=Vr("column",{useDeprecatedLogic:!0}),Zm=Vr("cell",{useDeprecatedLogic:!0});function pT(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Hs(t,e){let n=t.selection;if(!(n instanceof we))return!1;if(e){let r=t.tr,i=rt(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new P(i,0,0))}),r.docChanged&&e(r)}return!0}function hT(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;let i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l=0;s--){let{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c=e.length&&e.push(A.empty),n[i]r&&(f=f.type.createChecked(pr(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;pi&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}o.push(A.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function bT(t,e,n,r,i,o,s){let a=t.doc.type.schema,l=rt(a),c,u;if(i>e.width)for(let d=0,f=0;de.height){let d=[];for(let h=0,m=(e.height-1)*e.width;h=e.width?!1:n.nodeAt(e.map[m+h]).type==l.header_cell;d.push(g?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}let f=l.row.create(null,A.from(d)),p=[];for(let h=e.height;h{if(!i)return!1;let o=n.selection;if(o instanceof we)return Gs(n,r,q.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=Qm(i,t,e);if(s==null)return!1;if(t=="horiz")return Gs(n,r,q.near(n.doc.resolve(o.head+e),e));{let a=n.doc.resolve(s),l=zm(a,t,e),c;return l?c=q.near(l,1):e<0?c=q.near(n.doc.resolve(a.before(-1)),-1):c=q.near(n.doc.resolve(a.after(-1)),1),Gs(n,r,c)}}}function Ks(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection,s;if(o instanceof we)s=o;else{let l=Qm(i,t,e);if(l==null)return!1;s=new we(n.doc.resolve(l))}let a=zm(s.$headCell,t,e);return a?Gs(n,r,new we(s.$anchorCell,a)):!1}}function ET(t,e){let n=t.state.doc,r=fr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new we(r))),!0):!1}function kT(t,e,n){if(!$t(t.state))return!1;let r=hT(n),i=t.state.selection;if(i instanceof we){r||(r={width:1,height:1,rows:[A.from(ru(rt(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Oe.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=gT(r,a.right-a.left,a.bottom-a.top),Im(t.state,t.dispatch,s,a,r),!0}else if(r){let o=qs(t.state),s=o.start(-1);return Im(t.state,t.dispatch,s,Oe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function wT(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Dm(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof we)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=fr(t.state.selection.$anchor))!=null&&((n=Qc(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let u=Qc(t,c),d=Un.getState(t.state)==null;if(!u||!ou(l,u))if(d)u=l;else return;let f=new we(l,u);if(d||!t.state.selection.eq(f)){let p=t.state.tr.setSelection(f);d&&p.setMeta(Un,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Un.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Un,-1))}function a(l){let c=l,u=Un.getState(t.state),d;if(u!=null)d=t.state.doc.resolve(u);else if(Dm(t,c.target)!=r&&(d=Qc(t,e),!d))return s();d&&o(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function Qm(t,e,n){if(!(t.state.selection instanceof G))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let s=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Dm(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Qc(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&fr(t.state.doc.resolve(r))||fr(t.state.doc.resolve(i))}var ST=class{constructor(t,e){this.node=t,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")),iu(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,iu(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function iu(t,e,n,r,i,o){let s=0,a=!0,l=e.firstChild,c=t.firstChild;if(c){for(let d=0,f=0;dnew r(d,n,f)),new xT(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=Tt.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{_T(s,a,t,i)},mouseleave:s=>{TT(s)},mousedown:(s,a)=>{CT(s,a,e,n)}},decorations:s=>{let a=Tt.getState(s);if(a&&a.activeHandle>-1)return OT(s,a.activeHandle)},nodeViews:{}}});return o}var xT=class Vs{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Tt);if(r&&r.setHandle!=null)return new Vs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Vs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return nu(e.doc.resolve(i))||(i=-1),new Vs(i,n.dragging)}return n}};function _T(t,e,n,r){if(!t.editable)return;let i=Tt.getState(t.state);if(i&&!i.dragging){let o=NT(e.target),s=-1;if(o){let{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=Lm(t,e,"left",n):l-e.clientX<=n&&(s=Lm(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){let a=t.state.doc.resolve(s),l=a.node(-1),c=Oe.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}tg(t,s)}}}function TT(t){if(!t.editable)return;let e=Tt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tg(t,-1)}function CT(t,e,n,r){var i;if(!t.editable)return!1;let o=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Tt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let a=t.state.doc.nodeAt(s.activeHandle),l=AT(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Tt,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);let f=Tt.getState(t.state);f?.dragging&&(vT(t,f.activeHandle,Pm(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Tt,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Tt.getState(t.state);if(f&&f.dragging){let p=Pm(f.dragging,d,n);Bm(t,f.activeHandle,p,r)}}return Bm(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function AT(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let l=0;l{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function DT(t,e,n,r,i){let o=IT(t),s=[],a=[];for(let c=0;c{let{selection:e}=t.state;if(!LT(e))return!1;let n=0,r=uc(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},og=se.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:du,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=RT(t,this.options.cellMinWidth),o=["table",Q(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=DT(o.schema,t,e,n);if(i){let a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(G.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Wm(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Km(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Gm(t,e),addRowBefore:()=>({state:t,dispatch:e})=>qm(t,e),addRowAfter:()=>({state:t,dispatch:e})=>jm(t,e),deleteRow:()=>({state:t,dispatch:e})=>Ym(t,e),deleteTable:()=>({state:t,dispatch:e})=>Xm(t,e),mergeCells:()=>({state:t,dispatch:e})=>au(t,e),splitCell:()=>({state:t,dispatch:e})=>lu(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Vr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Vr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Zm(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>au(t,e)?!0:lu(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Jm(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>cu(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>cu(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&su(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=we.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:js,"Mod-Backspace":js,Delete:js,"Mod-Delete":js}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[eg({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],ng({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ne(U(t,"tableRole",e))}}});var sg=se.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Q(this.options.HTMLAttributes,t),0]}});var ag=se.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Q(this.options.HTMLAttributes,t),0]}});var lg=se.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Q(this.options.HTMLAttributes,t),0]}});var PT=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,cg=se.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Jo({find:PT,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var Ys=se.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});var BT=/^\s*(\[([( |x])?\])\s$/,Js=se.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Q(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=()=>{var u,d;a.ariaLabel=((d=(u=this.options.a11y)===null||u===void 0?void 0:u.checkboxLabel)===null||d===void 0?void 0:d.call(u,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return c(),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=n();if(typeof p!="number")return!1;let h=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...h?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{i.setAttribute(u,d)}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(e).forEach(([u,d])=>{i.setAttribute(u,d)}),{dom:i,contentDOM:l,update:u=>u.type!==this.type?!1:(i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(),!0)}}},addInputRules(){return[jt({find:BT,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});function zT(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},T={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[T,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:I.concat([{begin:/\(/,end:/\)/,keywords:_,contains:I.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function ug(t){let e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=zT(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function dg(t){let e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},o=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);let l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],T=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...k,...C,"set","shopt",..._,...T]},contains:[p,t.SHEBANG(),h,d,o,s,b,a,l,c,u,n]}}function fg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},C={begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:p,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:g}}}function pg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},T={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[T,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:I.concat([{begin:/\(/,end:/\)/,keywords:_,contains:I.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function hg(t){let e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},d=t.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},p=t.inherit(f,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},g=t.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[m,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[g,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let b={variants:[c,m,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},C=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,k,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+C+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},_]}}var FT=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),UT=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],$T=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],HT=[...UT,...$T],WT=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),KT=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),GT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),VT=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function mg(t){let e=t.regex,n=FT(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+KT.join("|")+")"},{begin:":(:)?("+GT.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+VT.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:WT.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+HT.join("|")+")\\b"}]}}function gg(t){let e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function bg(t){let o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"wg(t,e,n-1))}function Sg(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+wg("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,kg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},kg,c]}}var xg="[A-Za-z$_][0-9A-Za-z$_]*",qT=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],jT=["true","false","null","undefined","NaN","Infinity"],_g=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Tg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Cg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],YT=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],JT=[].concat(Cg,_g,Tg);function Ag(t){let e=t.regex,n=(S,{after:B})=>{let H="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,B)=>{let H=S[0].length+S.index,$=S.input[H];if($==="<"||$===","){B.ignoreMatch();return}$===">"&&(n(S,{after:H})||B.ignoreMatch());let ie,oe=S.input.substring(H);if(ie=oe.match(/^\s*=/)){B.ignoreMatch();return}if((ie=oe.match(/^\s+extends\s+/))&&ie.index===0){B.ignoreMatch();return}}},a={$pattern:xg,keyword:qT,literal:jT,built_in:JT,"variable.language":YT},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},C=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},d];f.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});let _=[].concat(k,f.contains),T=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(_)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T},v={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[..._g,...Tg]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ee(S){return e.concat("(?!",S.join("|"),")")}let De={match:e.concat(/\b/,Ee([...Cg,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ge={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,k,{match:/\$\d+/},d,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},E,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},fe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ge,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},De,le,v,pe,{match:/\$[(.]/}]}}function Ng(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var jr="[0-9](_*[0-9])*",Qs=`\\.(${jr})`,ea="[0-9a-fA-F](_*[0-9a-fA-F])*",ZT={className:"number",variants:[{begin:`(\\b(${jr})((${Qs})|\\.)?|(${Qs}))[eE][+-]?(${jr})[fFdD]?\\b`},{begin:`\\b(${jr})((${Qs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Qs})[fFdD]?\\b`},{begin:`\\b(${jr})[fFdD]\\b`},{begin:`\\b0[xX]((${ea})\\.?|(${ea})?\\.(${ea}))[pP][+-]?(${jr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ea})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function vg(t){let e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},c=ZT,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,l,s,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},c]}}var XT=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),QT=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],eC=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],tC=[...QT,...eC],nC=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Mg=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Og=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rC=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),iC=Mg.concat(Og).sort().reverse();function Rg(t){let e=XT(t),n=iC,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(C){return{className:"string",begin:"~?"+C+".*?"+C}},c=function(C,_,T){return{className:C,begin:_,relevance:T}},u={$pattern:/[a-z-]+/,keyword:r,attribute:nC.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);let f=a.concat({begin:/\{/,end:/\}/,contains:s}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rC.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},m={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},g={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+tC.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",o,0),c("selector-id","#"+o),c("selector-class","\\."+o,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Mg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Og.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},k={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,k,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function Ig(t){let e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function Dg(t){let e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(c,{contains:[]}),f=t.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let p=[n,l];return[c,u,d,f].forEach(b=>{b.contains=b.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,o,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Pg(t){let e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function Bg(t){let e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},s={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,o,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(m,g,b="\\1")=>{let k=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,k,/(?:\\.|[^\\\/])*?/,b,r)},p=(m,g,b)=>e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,b,r),h=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=h,s.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function zg(t){let e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(ge,pe)=>{pe.data._beginMatch=ge[1]||ge[2]},"on:end":(ge,pe)=>{pe.data._beginMatch!==ge[1]&&pe.ignoreMatch()}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,h={scope:"string",variants:[u,c,d,f]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],k=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],_={keyword:b,literal:(ge=>{let pe=[];return ge.forEach(x=>{pe.push(x),x.toLowerCase()===x?pe.push(x.toUpperCase()):pe.push(x.toLowerCase())}),pe})(g),built_in:k},T=ge=>ge.map(pe=>pe.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",T(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},v=e.concat(r,"\\b(?!\\()"),L={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),v],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),v],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},F={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},fe={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[F,s,L,t.C_BLOCK_COMMENT_MODE,h,m,I]},le={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",T(b).join("\\b|"),"|",T(k).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[fe]};fe.contains.push(le);let Ee=[F,L,t.C_BLOCK_COMMENT_MODE,h,m,I],De={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...Ee]},...Ee,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:_,contains:[De,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},s,le,L,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},I,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:_,contains:["self",De,s,L,t.C_BLOCK_COMMENT_MODE,h,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},h,m]}}function Fg(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function Ug(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function $g(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,d,t.HASH_COMMENT_MODE]}]};return c.contains=[d,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,d]}]}}function Hg(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Wg(t){let e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Kg(t){let e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:s},d={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},I=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=I,m.contains=I;let fe=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:I}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(fe).concat(c).concat(I)}}function Gg(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:""},o]}}var oC=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),sC=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],aC=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],lC=[...sC,...aC],cC=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),uC=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),dC=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),fC=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Vg(t){let e=oC(t),n=dC,r=uC,i="@[a-z-]+",o="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+lC.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+fC.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:cC.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function qg(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function jg(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=u,h=[...c,...l].filter(T=>!u.includes(T)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function k(T){return e.concat(/\b/,e.either(...T.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}let C={scope:"keyword",match:k(f),relevance:0};function _(T,{exceptions:I,when:v}={}){let L=v;return I=I||[],T.map(F=>F.match(/\|\d+$/)||I.includes(F)?F:L(F)?`${F}|0`:F)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(h,{when:T=>T.length<3}),literal:o,type:a,built_in:d},contains:[{scope:"type",match:k(s)},C,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function Xg(t){return t?typeof t=="string"?t:t.source:null}function Fi(t){return ke("(?=",t,")")}function ke(...t){return t.map(n=>Xg(n)).join("")}function pC(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function dt(...t){return"("+(pC(t).capture?"":"?:")+t.map(r=>Xg(r)).join("|")+")"}var hu=t=>ke(/\b/,t,/\w$/.test(t)?/\b/:/\B/),hC=["Protocol","Type"].map(hu),Yg=["init","self"].map(hu),mC=["Any","Self"],fu=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Jg=["false","nil","true"],gC=["assignment","associativity","higherThan","left","lowerThan","none","right"],bC=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Zg=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Qg=dt(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),eb=dt(Qg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),pu=ke(Qg,eb,"*"),tb=dt(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),na=dt(tb,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),en=ke(tb,na,"*"),ta=ke(/[A-Z]/,na,"*"),yC=["attached","autoclosure",ke(/convention\(/,dt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ke(/objc\(/,en,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],EC=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function nb(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,dt(...hC,...Yg)],className:{2:"keyword"}},o={match:ke(/\./,dt(...fu)),relevance:0},s=fu.filter(ee=>typeof ee=="string").concat(["_|0"]),a=fu.filter(ee=>typeof ee!="string").concat(mC).map(hu),l={variants:[{className:"keyword",match:dt(...a,...Yg)}]},c={$pattern:dt(/\b\w+/,/#\w+/),keyword:s.concat(bC),literal:Jg},u=[i,o,l],d={match:ke(/\./,dt(...Zg)),relevance:0},f={className:"built_in",match:ke(/\b/,dt(...Zg),/(?=\()/)},p=[d,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:pu},{match:`\\.(\\.|${eb})+`}]},g=[h,m],b="([0-9]_*)+",k="([0-9a-fA-F]_*)+",C={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${k})(\\.(${k}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(ee="")=>({className:"subst",variants:[{match:ke(/\\/,ee,/[0\\tnr"']/)},{match:ke(/\\/,ee,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(ee="")=>({className:"subst",match:ke(/\\/,ee,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(ee="")=>({className:"subst",label:"interpol",begin:ke(/\\/,ee,/\(/),end:/\)/}),v=(ee="")=>({begin:ke(ee,/"""/),end:ke(/"""/,ee),contains:[_(ee),T(ee),I(ee)]}),L=(ee="")=>({begin:ke(ee,/"/),end:ke(/"/,ee),contains:[_(ee),I(ee)]}),F={className:"string",variants:[v(),v("#"),v("##"),v("###"),L(),L("#"),L("##"),L("###")]},fe=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],le={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:fe},Ee=ee=>{let bt=ke(ee,/\//),K=ke(/\//,ee);return{begin:bt,end:K,contains:[...fe,{scope:"comment",begin:`#(?!.*${K})`,end:/$/}]}},De={scope:"regexp",variants:[Ee("###"),Ee("##"),Ee("#"),le]},ge={match:ke(/`/,en,/`/)},pe={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${na}+`},E=[ge,pe,x],S={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:EC,contains:[...g,C,F]}]}},B={scope:"keyword",match:ke(/@/,dt(...yC),Fi(dt(/\(/,/\s+/)))},H={scope:"meta",match:ke(/@/,en)},$=[S,B,H],ie={match:Fi(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ke(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,na,"+")},{className:"type",match:ta,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ke(/\s+&\s+/,Fi(ta)),relevance:0}]},oe={begin://,keywords:c,contains:[...r,...u,...$,h,ie]};ie.contains.push(oe);let Ae={match:ke(en,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",Ae,...r,De,...u,...p,...g,C,F,...E,...$,ie]},Ne={begin://,keywords:"repeat each",contains:[...r,ie]},Nt={begin:dt(Fi(ke(en,/\s*:/)),Fi(ke(en,/\s+/,en,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:en}]},Ke={begin:/\(/,end:/\)/,keywords:c,contains:[Nt,...r,...u,...g,C,F,...$,ie,J],endsParent:!0,illegal:/["']/},nn={match:[/(func|macro)/,/\s+/,dt(ge.match,en,pu)],className:{1:"keyword",3:"title.function"},contains:[Ne,Ke,e],illegal:[/\[/,/%/]},rn={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ne,Ke,e],illegal:/\[|%/},_n={match:[/operator/,/\s+/,pu],className:{1:"keyword",3:"title"}},Tn={begin:[/precedencegroup/,/\s+/,ta],className:{1:"keyword",3:"title"},contains:[ie],keywords:[...gC,...Jg],end:/}/},ot={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},gt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ve={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,en,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[Ne,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:ta},...u],relevance:0}]};for(let ee of F.variants){let bt=ee.contains.find(Y=>Y.label==="interpol");bt.keywords=c;let K=[...u,...p,...g,C,F,...E];bt.contains=[...K,{begin:/\(/,end:/\)/,contains:["self",...K]}]}return{name:"Swift",keywords:c,contains:[...r,nn,rn,ot,gt,ve,_n,Tn,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},De,...u,...p,...g,C,F,...E,...$,ie,J]}}var ra="[A-Za-z$_][0-9A-Za-z$_]*",rb=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ib=["true","false","null","undefined","NaN","Infinity"],ob=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],sb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ab=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],lb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],cb=[].concat(ab,ob,sb);function kC(t){let e=t.regex,n=(S,{after:B})=>{let H="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,B)=>{let H=S[0].length+S.index,$=S.input[H];if($==="<"||$===","){B.ignoreMatch();return}$===">"&&(n(S,{after:H})||B.ignoreMatch());let ie,oe=S.input.substring(H);if(ie=oe.match(/^\s*=/)){B.ignoreMatch();return}if((ie=oe.match(/^\s+extends\s+/))&&ie.index===0){B.ignoreMatch();return}}},a={$pattern:ra,keyword:rb,literal:ib,built_in:cb,"variable.language":lb},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},k={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},C=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},d];f.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});let _=[].concat(k,f.contains),T=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(_)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T},v={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...ob,...sb]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ee(S){return e.concat("(?!",S.join("|"),")")}let De={match:e.concat(/\b/,Ee([...ab,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ge={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},pe={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,k,{match:/\$\d+/},d,L,{scope:"attr",match:r+e.lookahead(":"),relevance:0},E,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},fe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ge,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},De,le,v,pe,{match:/\$[(.]/}]}}function ub(t){let e=t.regex,n=kC(t),r=ra,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ra,keyword:rb.concat(l),literal:ib,built_in:cb.concat(i),"variable.language":lb},u={className:"meta",begin:"@"+r},d=(m,g,b)=>{let k=m.contains.findIndex(C=>C.label===g);if(k===-1)throw new Error("can not find mode to replace");m.contains.splice(k,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);let f=n.contains.find(m=>m.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([u,o,s,p]),d(n,"shebang",t.SHEBANG()),d(n,"use_strict",a);let h=n.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function db(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,d,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function fb(t){t.regex;let e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");let n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,s,i,t.QUOTE_STRING_MODE,l,c,a]}}function pb(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[o,s,l,a]}]}]},t.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function hb(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,m,o,s],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}var Ui={arduino:ug,bash:dg,c:fg,cpp:pg,csharp:hg,css:mg,diff:gg,go:bg,graphql:yg,ini:Eg,java:Sg,javascript:Ag,json:Ng,kotlin:vg,less:Rg,lua:Ig,makefile:Dg,markdown:Lg,objectivec:Pg,perl:Bg,php:zg,"php-template":Fg,plaintext:Ug,python:$g,"python-repl":Hg,r:Wg,ruby:Kg,rust:Gg,scss:Vg,shell:qg,sql:jg,swift:nb,typescript:ub,vbnet:db,wasm:fb,xml:pb,yaml:hb};var Lb=OE(Db(),1);var Pb=Lb.default;var Bb={},uA="hljs-";function Wi(t){let e=Pb.newInstance();return t&&o(t),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,u){let d=u||Bb,f=typeof d.prefix=="string"?d.prefix:uA;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:xu,classPrefix:f});let p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});let h=p._emitter.root,m=h.data;return m.language=p.language,m.relevance=p.relevance,h}function r(l,c){let d=(c||Bb).subset||i(),f=-1,p=0,h;for(;++fp&&(p=g.data.relevance,h=g)}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){let d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}var xu=class{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){let r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){let n=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}};var zb=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var wn=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};wn.prototype.normal={};wn.prototype.property={};wn.prototype.space=void 0;function _u(t,e){let n={},r={};for(let i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new wn(n,r,e)}function Ki(t){return t.toLowerCase()}var We=class{constructor(e,n){this.attribute=n,this.property=e}};We.prototype.attribute="";We.prototype.booleanish=!1;We.prototype.boolean=!1;We.prototype.commaOrSpaceSeparated=!1;We.prototype.commaSeparated=!1;We.prototype.defined=!1;We.prototype.mustUseProperty=!1;We.prototype.number=!1;We.prototype.overloadedBoolean=!1;We.prototype.property="";We.prototype.spaceSeparated=!1;We.prototype.space=void 0;var Gi={};vE(Gi,{boolean:()=>te,booleanish:()=>Re,commaOrSpaceSeparated:()=>xt,commaSeparated:()=>Hn,number:()=>M,overloadedBoolean:()=>la,spaceSeparated:()=>ye});var dA=0,te=gr(),Re=gr(),la=gr(),M=gr(),ye=gr(),Hn=gr(),xt=gr();function gr(){return 2**++dA}var Tu=Object.keys(Gi),br=class extends We{constructor(e,n,r,i){let o=-1;if(super(e,n),Fb(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&pA.test(e)){if(e.charAt(4)==="-"){let o=e.slice(5).replace(Hb,mA);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=e.slice(4);if(!Hb.test(o)){let s=o.replace(fA,hA);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=br}return new i(r,e)}function hA(t){return"-"+t.toLowerCase()}function mA(t){return t.charAt(1).toUpperCase()}var Wb=_u([Cu,Ub,Au,Nu,vu],"html"),da=_u([Cu,$b,Au,Nu,vu],"svg");var Kb={}.hasOwnProperty;function Gb(t,e){let n=e||{};function r(i,...o){let s=r.invalid,a=r.handlers;if(i&&Kb.call(i,t)){let l=String(i[t]);s=Kb.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var gA=/["&'<>`]/g,bA=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yA=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,EA=/[|\\{}()[\]^$+*?.]/g,Vb=new WeakMap;function qb(t,e){if(t=t.replace(e.subset?kA(e.subset):gA,r),e.subset||e.escapeOnly)return t;return t.replace(bA,n).replace(yA,r);function n(i,o,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),e)}function r(i,o,s){return e.format(i.charCodeAt(0),s.charCodeAt(o+1),e)}}function kA(t){let e=Vb.get(t);return e||(e=wA(t),Vb.set(t,e)),e}function wA(t){let e=[],n=-1;for(;++n",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var Zb=["cent","copy","divide","gt","lt","not","para","times"];var Xb={}.hasOwnProperty,Ou={},pa;for(pa in fa)Xb.call(fa,pa)&&(Ou[fa[pa]]=pa);var _A=/[^\dA-Za-z]/;function Qb(t,e,n,r){let i=String.fromCharCode(t);if(Xb.call(Ou,i)){let o=Ou[i],s="&"+o;return n&&Jb.includes(o)&&!Zb.includes(o)&&(!r||e&&e!==61&&_A.test(String.fromCharCode(e)))?s:s+";"}return""}function ey(t,e,n){let r=jb(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Qb(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let o=Yb(t,e,n.omitOptionalSemicolons);o.length|^->||--!>|"],AA=["<",">"];function ty(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return Sn(o,Object.assign({},r.settings.characterReferences,{subset:AA}))}}function ny(t,e,n,r){return""}function Ru(t,e){let n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function ry(t,e){let n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function iy(t){return t.join(" ").trim()}var NA=/[ \t\n\f\r]/g;function yr(t){return typeof t=="object"?t.type==="text"?oy(t.value):!1:oy(t)}function oy(t){return t.replace(NA,"")===""}var Ie=sy(1),Iu=sy(-1),vA=[];function sy(t){return e;function e(n,r,i){let o=n?n.children:vA,s=(r||0)+t,a=o[s];if(!i)for(;a&&yr(a);)s+=t,a=o[s];return a}}var MA={}.hasOwnProperty;function ha(t){return e;function e(n,r,i){return MA.call(t,n.tagName)&&t[n.tagName](n,r,i)}}var Vi=ha({body:RA,caption:Du,colgroup:Du,dd:PA,dt:LA,head:Du,html:OA,li:DA,optgroup:BA,option:zA,p:IA,rp:ay,rt:ay,tbody:UA,td:ly,tfoot:$A,th:ly,thead:FA,tr:HA});function Du(t,e,n){let r=Ie(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&yr(r.value.charAt(0)))}function OA(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function RA(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function IA(t,e,n){let r=Ie(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function DA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="li"}function LA(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function PA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function ay(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function BA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function zA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function FA(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function UA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function $A(t,e,n){return!Ie(n,e)}function HA(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function ly(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var cy=ha({body:GA,colgroup:VA,head:KA,html:WA,tbody:qA});function WA(t){let e=Ie(t,-1);return!e||e.type!=="comment"}function KA(t){let e=new Set;for(let r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}let n=t.children[0];return!n||n.type==="element"}function GA(t){let e=Ie(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&yr(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function VA(t,e,n){let r=Iu(n,e),i=Ie(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Vi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function qA(t,e,n){let r=Iu(n,e),i=Ie(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Vi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var ma={name:[[` +\f\r &/=>`.split(""),` +\f\r "&'/=>\``.split("")],[`\0 +\f\r "&'/<=>`.split(""),`\0 +\f\r "&'/<=>\``.split("")]],unquoted:[[` +\f\r &>`.split(""),`\0 +\f\r "&'<=>\``.split("")],[`\0 +\f\r "&'<=>\``.split(""),`\0 +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function uy(t,e,n,r){let i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags,s=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],l;i.space==="html"&&t.tagName==="svg"&&(r.schema=da);let c=jA(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(s=!1),(c||!o||!cy(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),s&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!s&&(!o||!Vi(t,e,n))&&a.push(""),a.join("")}function jA(t,e){let n=[],r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let o=YA(t,i,e[i]);o&&n.push(o)}}for(;++rRu(n,t.alternative)&&(s=t.alternative),a=s+Sn(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?ma.single:ma.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}var JA=["<","&"];function ga(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Sn(t.value,Object.assign({},r.settings.characterReferences,{subset:JA}))}function dy(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ga(t,e,n,r)}function fy(t,e,n,r){return r.all(t)}var py=Gb("type",{invalid:ZA,unknown:XA,handlers:{comment:ty,doctype:ny,element:uy,raw:dy,root:fy,text:ga}});function ZA(t){throw new Error("Expected node, not `"+t+"`")}function XA(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var QA={},eN={},tN=[];function Lu(t,e){let n=e||QA,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:nN,all:rN,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||zb,characterReferences:n.characterReferences||eN,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?da:Wb,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function nN(t,e,n){return py(t,e,n,this)}function rN(t){let e=[],n=t&&t.children||tN,r=-1;for(;++rnull};function de(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,o)=>{let s=typeof o=="string"?o:o.source;return s=s.replace(ft.caret,"$1"),n=n.replace(i,s),r},getRegex:()=>new RegExp(n,e)};return r}var iN=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},oN=/^(?:[ \t]*(?:\n|$))+/,sN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,aN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uu=/(?:[*+-]|\d{1,9}[.)])/,wy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Sy=de(wy).replace(/bull/g,Uu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),cN=de(wy).replace(/bull/g,Uu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$u=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,uN=/^[^\n]+/,Hu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,dN=de(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Hu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),fN=de(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Uu).getRegex(),wa="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wu=/|$))/,pN=de("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wu).replace("tag",wa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xy=de($u).replace("hr",Zi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wa).getRegex(),hN=de(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xy).getRegex(),Ku={blockquote:hN,code:sN,def:dN,fences:aN,heading:lN,hr:Zi,html:pN,lheading:Sy,list:fN,newline:oN,paragraph:xy,table:Ji,text:uN},hy=de("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wa).getRegex(),mN={...Ku,lheading:cN,table:hy,paragraph:de($u).replace("hr",Zi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",hy).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wa).getRegex()},gN={...Ku,html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wu).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ji,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:de($u).replace("hr",Zi).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Sy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_y=/^( {2,}|\\)\n(?!\s*$)/,EN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",iN?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ay=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_N=de(Ay,"u").replace(/punct/g,Sa).getRegex(),TN=de(Ay,"u").replace(/punct/g,Cy).getRegex(),Ny="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",CN=de(Ny,"gu").replace(/notPunctSpace/g,Ty).replace(/punctSpace/g,Gu).replace(/punct/g,Sa).getRegex(),AN=de(Ny,"gu").replace(/notPunctSpace/g,SN).replace(/punctSpace/g,wN).replace(/punct/g,Cy).getRegex(),NN=de("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ty).replace(/punctSpace/g,Gu).replace(/punct/g,Sa).getRegex(),vN=de(/\\(punct)/,"gu").replace(/punct/g,Sa).getRegex(),MN=de(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ON=de(Wu).replace("(?:-->|$)","-->").getRegex(),RN=de("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ON).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ya=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,IN=de(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ya).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vy=de(/^!?\[(label)\]\[(ref)\]/).replace("label",ya).replace("ref",Hu).getRegex(),My=de(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hu).getRegex(),DN=de("reflink|nolink(?!\\()","g").replace("reflink",vy).replace("nolink",My).getRegex(),my=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Vu={_backpedal:Ji,anyPunctuation:vN,autolink:MN,blockSkip:xN,br:_y,code:yN,del:Ji,emStrongLDelim:_N,emStrongRDelimAst:CN,emStrongRDelimUnd:NN,escape:bN,link:IN,nolink:My,punctuation:kN,reflink:vy,reflinkSearch:DN,tag:RN,text:EN,url:Ji},LN={...Vu,link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",ya).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ya).getRegex()},Pu={...Vu,emStrongRDelimAst:AN,emStrongLDelim:TN,url:de(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",my).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:de(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},gy=t=>BN[t];function xn(t,e){if(e){if(ft.escapeTest.test(t))return t.replace(ft.escapeReplace,gy)}else if(ft.escapeTestNoEncode.test(t))return t.replace(ft.escapeReplaceNoEncode,gy);return t}function by(t){try{t=encodeURI(t).replace(ft.percentDecode,"%")}catch{return null}return t}function yy(t,e){let n=t.replace(ft.findPipe,(o,s,a)=>{let l=!1,c=s;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(ft.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length0?-2:-1}function Ey(t,e,n,r,i){let o=e.href,s=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function FN(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(` +`).map(o=>{let s=o.match(n.other.beginningSpace);if(s===null)return o;let[a]=s;return a.length>=i.length?o.slice(i.length):o}).join(` +`)}var Ea=class{options;rules;lexer;constructor(t){this.options=t||kr}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ji(n,` +`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=FN(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=ji(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ji(e[0],` +`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=ji(e[0],` +`).split(` +`),r="",i="",o=[];for(;n.length>0;){let s=!1,a=[],l;for(l=0;l1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),s=!1;for(;t;){let l=!1,c="",u="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let d=e[2].split(` +`,1)[0].replace(this.rules.other.listReplaceTabs,g=>" ".repeat(3*g.length)),f=t.split(` +`,1)[0],p=!d.trim(),h=0;if(this.options.pedantic?(h=2,u=d.trimStart()):p?h=e[1].length+1:(h=e[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,u=d.slice(h),h+=e[1].length),p&&this.rules.other.blankLine.test(f)&&(c+=f+` +`,t=t.substring(f.length+1),l=!0),!l){let g=this.rules.other.nextBulletRegex(h),b=this.rules.other.hrRegex(h),k=this.rules.other.fencesBeginRegex(h),C=this.rules.other.headingBeginRegex(h),_=this.rules.other.htmlBeginRegex(h);for(;t;){let T=t.split(` +`,1)[0],I;if(f=T,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),I=f):I=f.replace(this.rules.other.tabCharGlobal," "),k.test(f)||C.test(f)||_.test(f)||g.test(f)||b.test(f))break;if(I.search(this.rules.other.nonSpaceChar)>=h||!f.trim())u+=` +`+I.slice(h);else{if(p||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(d)||C.test(d)||b.test(d))break;u+=` +`+f}!p&&!f.trim()&&(p=!0),c+=T+` +`,t=t.substring(T.length+1),d=I.slice(h)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(s=!0));let m=null;this.options.gfm&&(m=this.rules.other.listIsTask.exec(u),m&&(u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:c,task:!!m,loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!i.loose){let c=l.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=u}}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=yy(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let s of r)this.rules.other.tableAlignRight.test(s)?o.align.push("right"):this.rules.other.tableAlignCenter.test(s)?o.align.push("center"):this.rules.other.tableAlignLeft.test(s)?o.align.push("left"):o.align.push(null);for(let s=0;s({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[l]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===` +`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=ji(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=zN(e[2],"()");if(o===-2)return;if(o>-1){let s=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,s).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ey(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Ey(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,o,s,a=i,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+i);(r=c.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(s=[...o].length,r[3]||r[4]){a+=s;continue}else if((r[5]||r[6])&&i%3&&!((i+s)%3)){l+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a+l);let u=[...r[0]][0].length,d=t.slice(0,i+r.index+u+s);if(Math.min(i,s)%2){let p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Ht=class Bu{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||kr,this.options.tokenizer=this.options.tokenizer||new Ea,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:ft,block:ba.normal,inline:qi.normal};this.options.pedantic?(n.block=ba.pedantic,n.inline=qi.pedantic):this.options.gfm&&(n.block=ba.gfm,this.options.breaks?n.inline=qi.breaks:n.inline=qi.gfm),this.tokenizer.rules=n}static get rules(){return{block:ba,inline:qi}}static lex(e,n){return new Bu(n).lex(e)}static lexInline(e,n){return new Bu(n).inlineTokens(e)}lex(e){e=e.replace(ft.carriageReturn,` +`),this.blockTokens(e,this.tokens);for(let n=0;n(i=s.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let s=n.at(-1);i.raw.length===1&&s!==void 0?s.raw+=` +`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let s=n.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+i.raw,s.text+=` +`+i.text,this.inlineQueue.at(-1).src=s.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let s=n.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+i.raw,s.text+=` +`+i.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let o=e;if(this.options.extensions?.startBlock){let s=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},a),typeof l=="number"&&l>=0&&(s=Math.min(s,l))}),s<1/0&&s>=0&&(o=e.substring(0,s+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){let s=n.at(-1);r&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+i.raw,s.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):n.push(i),r=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let s=n.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+i.raw,s.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):n.push(i);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)o=i[2]?i[2].length:0,r=r.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let s=!1,a="";for(;e;){s||(a=""),s=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),f;this.options.extensions.startInline.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),s=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},ka=class{options;parser;constructor(t){this.options=t||kr}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(ft.notSpaceStart)?.[0],i=t.replace(ft.endingNewline,"")+` +`;return r?'
'+(n?i:xn(i,!0))+`
+`:"
"+(n?i:xn(i,!0))+`
+`}blockquote({tokens:t}){return`
+${this.parser.parse(t)}
+`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)} +`}hr(t){return`
+`}list(t){let e=t.ordered,n=t.start,r="";for(let s=0;s +`+r+" +`}listitem(t){return`
  • ${this.parser.parse(t.tokens)}
  • +`}checkbox({checked:t}){return" '}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    +`}table(t){let e="",n="";for(let i=0;i${r}`),` + +`+e+` +`+r+`
    +`}tablerow({text:t}){return` +${t} +`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+` +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${xn(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=by(t);if(i===null)return r;t=i;let o='
    ",o}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=by(t);if(i===null)return xn(n);t=i;let o=`${n}{let s=i[o].flat(1/0);n=n.concat(this.walkTokens(s,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=e.renderers[i.name];o?e.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=o.apply(this,s)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[i.level];o?o.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new ka(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let s=o,a=n.renderer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Ea(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let s=o,a=n.tokenizer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Yi;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let s=o,a=n.hooks[s],l=i[s];Yi.passThroughHooks.has(o)?i[s]=c=>{if(this.defaults.async&&Yi.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await a.call(i,c);return l.call(i,d)})();let u=a.call(i,c);return l.call(i,u)}:i[s]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(i,c);return d===!1&&(d=await l.apply(i,c)),d})();let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(s){let a=[];return a.push(o.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ht.lex(t,e??this.defaults)}parser(t,e){return Wt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():t?Ht.lex:Ht.lexInline)(s,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser():t?Wt.parse:Wt.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(o);try{i.hooks&&(e=i.hooks.preprocess(e));let s=(i.hooks?i.hooks.provideLexer():t?Ht.lex:Ht.lexInline)(e,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():t?Wt.parse:Wt.parseInline)(s,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(s){return o(s)}}}onError(t,e){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,t){let r="

    An error occurred:

    "+xn(n.message+"",!0)+"
    ";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Er=new UN;function me(t,e){return Er.parse(t,e)}me.options=me.setOptions=function(t){return Er.setOptions(t),me.defaults=Er.defaults,ky(me.defaults),me};me.getDefaults=Fu;me.defaults=kr;me.use=function(...t){return Er.use(...t),me.defaults=Er.defaults,ky(me.defaults),me};me.walkTokens=function(t,e){return Er.walkTokens(t,e)};me.parseInline=Er.parseInline;me.Parser=Wt;me.parser=Wt.parse;me.Renderer=ka;me.TextRenderer=qu;me.Lexer=Ht;me.lexer=Ht.lex;me.Tokenizer=Ea;me.Hooks=Yi;me.parse=me;var OL=me.options,RL=me.setOptions,IL=me.use,DL=me.walkTokens,LL=me.parseInline;var PL=Wt.parse,BL=Ht.lex;var{entries:Fy,setPrototypeOf:Oy,isFrozen:$N,getPrototypeOf:HN,getOwnPropertyDescriptor:WN}=Object,{freeze:ht,seal:Ft,create:Ta}=Object,{apply:ed,construct:td}=typeof Reflect<"u"&&Reflect;ht||(ht=function(e){return e});Ft||(Ft=function(e){return e});ed||(ed=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o1?n-1:0),i=1;i1?n-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:Ca;Oy&&Oy(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let o=n(i);o!==i&&($N(e)||(e[r]=o),i=o)}t[i]=!0}return t}function YN(t){for(let e=0;e/gm),ev=Ft(/\$\{[\w\W]*/gm),tv=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),nv=Ft(/^aria-[\-\w]+$/),Uy=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rv=Ft(/^(?:\w+script|data):/i),iv=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$y=Ft(/^html$/i),ov=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i),By=Object.freeze({__proto__:null,ARIA_ATTR:nv,ATTR_WHITESPACE:iv,CUSTOM_ELEMENT:ov,DATA_ATTR:tv,DOCTYPE_NAME:$y,ERB_EXPR:QN,IS_ALLOWED_URI:Uy,IS_SCRIPT_OR_DATA:rv,MUSTACHE_EXPR:XN,TMPLIT_EXPR:ev}),no={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sv=function(){return typeof window>"u"?null:window},av=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));let o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},zy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Hy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sv(),e=j=>Hy(j);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==no.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t,r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=t,h=l.prototype,m=to(h,"cloneNode"),g=to(h,"remove"),b=to(h,"nextSibling"),k=to(h,"childNodes"),C=to(h,"parentNode");if(typeof s=="function"){let j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let _,T="",{implementation:I,createNodeIterator:v,createDocumentFragment:L,getElementsByTagName:F}=n,{importNode:fe}=r,le=zy();e.isSupported=typeof Fy=="function"&&typeof C=="function"&&I&&I.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Ee,ERB_EXPR:De,TMPLIT_EXPR:ge,DATA_ATTR:pe,ARIA_ATTR:x,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:B}=By,{IS_ALLOWED_URI:H}=By,$=null,ie=ae({},[...Iy,...Ju,...Zu,...Xu,...Dy]),oe=null,Ae=ae({},[...Ly,...Qu,...Py,..._a]),J=Object.seal(Ta(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ne=null,Nt=null,Ke=Object.seal(Ta(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),nn=!0,rn=!0,_n=!1,Tn=!0,ot=!1,gt=!0,ve=!1,ee=!1,bt=!1,K=!1,Y=!1,Se=!1,X=!0,ce=!1,yt="user-content-",st=!0,_t=!1,D={},w=null,N=ae({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),z=null,Z=ae({},["audio","video","img","source","image","track"]),be=null,Et=ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cn="http://www.w3.org/1998/Math/MathML",wr="http://www.w3.org/2000/svg",on="http://www.w3.org/1999/xhtml",Sr=on,Oa=!1,Ra=null,gE=ae({},[Cn,wr,on],ju),oo=ae({},["mi","mo","mn","ms","mtext"]),so=ae({},["annotation-xml"]),bE=ae({},["title","style","font","a","script"]),ei=null,yE=["application/xhtml+xml","text/html"],EE="text/html",Fe=null,xr=null,kE=n.createElement("form"),hd=function(y){return y instanceof RegExp||y instanceof Function},Ia=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xr&&xr===y)){if((!y||typeof y!="object")&&(y={}),y=tn(y),ei=yE.indexOf(y.PARSER_MEDIA_TYPE)===-1?EE:y.PARSER_MEDIA_TYPE,Fe=ei==="application/xhtml+xml"?ju:Ca,$=Ct(y,"ALLOWED_TAGS")?ae({},y.ALLOWED_TAGS,Fe):ie,oe=Ct(y,"ALLOWED_ATTR")?ae({},y.ALLOWED_ATTR,Fe):Ae,Ra=Ct(y,"ALLOWED_NAMESPACES")?ae({},y.ALLOWED_NAMESPACES,ju):gE,be=Ct(y,"ADD_URI_SAFE_ATTR")?ae(tn(Et),y.ADD_URI_SAFE_ATTR,Fe):Et,z=Ct(y,"ADD_DATA_URI_TAGS")?ae(tn(Z),y.ADD_DATA_URI_TAGS,Fe):Z,w=Ct(y,"FORBID_CONTENTS")?ae({},y.FORBID_CONTENTS,Fe):N,Ne=Ct(y,"FORBID_TAGS")?ae({},y.FORBID_TAGS,Fe):tn({}),Nt=Ct(y,"FORBID_ATTR")?ae({},y.FORBID_ATTR,Fe):tn({}),D=Ct(y,"USE_PROFILES")?y.USE_PROFILES:!1,nn=y.ALLOW_ARIA_ATTR!==!1,rn=y.ALLOW_DATA_ATTR!==!1,_n=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Tn=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ot=y.SAFE_FOR_TEMPLATES||!1,gt=y.SAFE_FOR_XML!==!1,ve=y.WHOLE_DOCUMENT||!1,K=y.RETURN_DOM||!1,Y=y.RETURN_DOM_FRAGMENT||!1,Se=y.RETURN_TRUSTED_TYPE||!1,bt=y.FORCE_BODY||!1,X=y.SANITIZE_DOM!==!1,ce=y.SANITIZE_NAMED_PROPS||!1,st=y.KEEP_CONTENT!==!1,_t=y.IN_PLACE||!1,H=y.ALLOWED_URI_REGEXP||Uy,Sr=y.NAMESPACE||on,oo=y.MATHML_TEXT_INTEGRATION_POINTS||oo,so=y.HTML_INTEGRATION_POINTS||so,J=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&hd(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&hd(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ot&&(rn=!1),Y&&(K=!0),D&&($=ae({},Dy),oe=Ta(null),D.html===!0&&(ae($,Iy),ae(oe,Ly)),D.svg===!0&&(ae($,Ju),ae(oe,Qu),ae(oe,_a)),D.svgFilters===!0&&(ae($,Zu),ae(oe,Qu),ae(oe,_a)),D.mathMl===!0&&(ae($,Xu),ae(oe,Py),ae(oe,_a))),Ct(y,"ADD_TAGS")||(Ke.tagCheck=null),Ct(y,"ADD_ATTR")||(Ke.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?Ke.tagCheck=y.ADD_TAGS:($===ie&&($=tn($)),ae($,y.ADD_TAGS,Fe))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?Ke.attributeCheck=y.ADD_ATTR:(oe===Ae&&(oe=tn(oe)),ae(oe,y.ADD_ATTR,Fe))),y.ADD_URI_SAFE_ATTR&&ae(be,y.ADD_URI_SAFE_ATTR,Fe),y.FORBID_CONTENTS&&(w===N&&(w=tn(w)),ae(w,y.FORBID_CONTENTS,Fe)),y.ADD_FORBID_CONTENTS&&(w===N&&(w=tn(w)),ae(w,y.ADD_FORBID_CONTENTS,Fe)),st&&($["#text"]=!0),ve&&ae($,["html","head","body"]),$.table&&(ae($,["tbody"]),delete Ne.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw eo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw eo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=y.TRUSTED_TYPES_POLICY,T=_.createHTML("")}else _===void 0&&(_=av(p,i)),_!==null&&typeof T=="string"&&(T=_.createHTML(""));ht&&ht(y),xr=y}},md=ae({},[...Ju,...Zu,...JN]),gd=ae({},[...Xu,...ZN]),wE=function(y){let R=C(y);(!R||!R.tagName)&&(R={namespaceURI:Sr,tagName:"template"});let W=Ca(y.tagName),Ce=Ca(R.tagName);return Ra[y.namespaceURI]?y.namespaceURI===wr?R.namespaceURI===on?W==="svg":R.namespaceURI===Cn?W==="svg"&&(Ce==="annotation-xml"||oo[Ce]):!!md[W]:y.namespaceURI===Cn?R.namespaceURI===on?W==="math":R.namespaceURI===wr?W==="math"&&so[Ce]:!!gd[W]:y.namespaceURI===on?R.namespaceURI===wr&&!so[Ce]||R.namespaceURI===Cn&&!oo[Ce]?!1:!gd[W]&&(bE[W]||!md[W]):!!(ei==="application/xhtml+xml"&&Ra[y.namespaceURI]):!1},Kt=function(y){Xi(e.removed,{element:y});try{C(y).removeChild(y)}catch{g(y)}},Wn=function(y,R){try{Xi(e.removed,{attribute:R.getAttributeNode(y),from:R})}catch{Xi(e.removed,{attribute:null,from:R})}if(R.removeAttribute(y),y==="is")if(K||Y)try{Kt(R)}catch{}else try{R.setAttribute(y,"")}catch{}},bd=function(y){let R=null,W=null;if(bt)y=""+y;else{let Le=Yu(y,/^[\r\n\t ]+/);W=Le&&Le[0]}ei==="application/xhtml+xml"&&Sr===on&&(y=''+y+"");let Ce=_?_.createHTML(y):y;if(Sr===on)try{R=new f().parseFromString(Ce,ei)}catch{}if(!R||!R.documentElement){R=I.createDocument(Sr,"template",null);try{R.documentElement.innerHTML=Oa?T:Ce}catch{}}let Je=R.body||R.documentElement;return y&&W&&Je.insertBefore(n.createTextNode(W),Je.childNodes[0]||null),Sr===on?F.call(R,ve?"html":"body")[0]:ve?R.documentElement:Je},yd=function(y){return v.call(y.ownerDocument||y,y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Da=function(y){return y instanceof d&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof u)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},Ed=function(y){return typeof a=="function"&&y instanceof a};function sn(j,y,R){xa(j,W=>{W.call(e,y,R,xr)})}let kd=function(y){let R=null;if(sn(le.beforeSanitizeElements,y,null),Da(y))return Kt(y),!0;let W=Fe(y.nodeName);if(sn(le.uponSanitizeElement,y,{tagName:W,allowedTags:$}),gt&&y.hasChildNodes()&&!Ed(y.firstElementChild)&&pt(/<[/\w!]/g,y.innerHTML)&&pt(/<[/\w!]/g,y.textContent)||y.nodeType===no.progressingInstruction||gt&&y.nodeType===no.comment&&pt(/<[/\w]/g,y.data))return Kt(y),!0;if(!(Ke.tagCheck instanceof Function&&Ke.tagCheck(W))&&(!$[W]||Ne[W])){if(!Ne[W]&&Sd(W)&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,W)||J.tagNameCheck instanceof Function&&J.tagNameCheck(W)))return!1;if(st&&!w[W]){let Ce=C(y)||y.parentNode,Je=k(y)||y.childNodes;if(Je&&Ce){let Le=Je.length;for(let kt=Le-1;kt>=0;--kt){let an=m(Je[kt],!0);an.__removalCount=(y.__removalCount||0)+1,Ce.insertBefore(an,b(y))}}}return Kt(y),!0}return y instanceof l&&!wE(y)||(W==="noscript"||W==="noembed"||W==="noframes")&&pt(/<\/no(script|embed|frames)/i,y.innerHTML)?(Kt(y),!0):(ot&&y.nodeType===no.text&&(R=y.textContent,xa([Ee,De,ge],Ce=>{R=Qi(R,Ce," ")}),y.textContent!==R&&(Xi(e.removed,{element:y.cloneNode()}),y.textContent=R)),sn(le.afterSanitizeElements,y,null),!1)},wd=function(y,R,W){if(Nt[R]||X&&(R==="id"||R==="name")&&(W in n||W in kE))return!1;if(!(rn&&!Nt[R]&&pt(pe,R))){if(!(nn&&pt(x,R))){if(!(Ke.attributeCheck instanceof Function&&Ke.attributeCheck(R,y))){if(!oe[R]||Nt[R]){if(!(Sd(y)&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,y)||J.tagNameCheck instanceof Function&&J.tagNameCheck(y))&&(J.attributeNameCheck instanceof RegExp&&pt(J.attributeNameCheck,R)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(R,y))||R==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,W)||J.tagNameCheck instanceof Function&&J.tagNameCheck(W))))return!1}else if(!be[R]){if(!pt(H,Qi(W,S,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&y!=="script"&&VN(W,"data:")===0&&z[y])){if(!(_n&&!pt(E,Qi(W,S,"")))){if(W)return!1}}}}}}}return!0},Sd=function(y){return y!=="annotation-xml"&&Yu(y,B)},xd=function(y){sn(le.beforeSanitizeAttributes,y,null);let{attributes:R}=y;if(!R||Da(y))return;let W={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0},Ce=R.length;for(;Ce--;){let Je=R[Ce],{name:Le,namespaceURI:kt,value:an}=Je,_r=Fe(Le),La=an,Ge=Le==="value"?La:qN(La);if(W.attrName=_r,W.attrValue=Ge,W.keepAttr=!0,W.forceKeepAttr=void 0,sn(le.uponSanitizeAttribute,y,W),Ge=W.attrValue,ce&&(_r==="id"||_r==="name")&&(Wn(Le,y),Ge=yt+Ge),gt&&pt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ge)){Wn(Le,y);continue}if(_r==="attributename"&&Yu(Ge,"href")){Wn(Le,y);continue}if(W.forceKeepAttr)continue;if(!W.keepAttr){Wn(Le,y);continue}if(!Tn&&pt(/\/>/i,Ge)){Wn(Le,y);continue}ot&&xa([Ee,De,ge],Td=>{Ge=Qi(Ge,Td," ")});let _d=Fe(y.nodeName);if(!wd(_d,_r,Ge)){Wn(Le,y);continue}if(_&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!kt)switch(p.getAttributeType(_d,_r)){case"TrustedHTML":{Ge=_.createHTML(Ge);break}case"TrustedScriptURL":{Ge=_.createScriptURL(Ge);break}}if(Ge!==La)try{kt?y.setAttributeNS(kt,Le,Ge):y.setAttribute(Le,Ge),Da(y)?Kt(y):Ry(e.removed)}catch{Wn(Le,y)}}sn(le.afterSanitizeAttributes,y,null)},SE=function j(y){let R=null,W=yd(y);for(sn(le.beforeSanitizeShadowDOM,y,null);R=W.nextNode();)sn(le.uponSanitizeShadowNode,R,null),kd(R),xd(R),R.content instanceof o&&j(R.content);sn(le.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(j){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,W=null,Ce=null,Je=null;if(Oa=!j,Oa&&(j=""),typeof j!="string"&&!Ed(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw eo("dirty is not a string, aborting")}else throw eo("toString is not a function");if(!e.isSupported)return j;if(ee||Ia(y),e.removed=[],typeof j=="string"&&(_t=!1),_t){if(j.nodeName){let an=Fe(j.nodeName);if(!$[an]||Ne[an])throw eo("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof a)R=bd(""),W=R.ownerDocument.importNode(j,!0),W.nodeType===no.element&&W.nodeName==="BODY"||W.nodeName==="HTML"?R=W:R.appendChild(W);else{if(!K&&!ot&&!ve&&j.indexOf("<")===-1)return _&&Se?_.createHTML(j):j;if(R=bd(j),!R)return K?null:Se?T:""}R&&bt&&Kt(R.firstChild);let Le=yd(_t?j:R);for(;Ce=Le.nextNode();)kd(Ce),xd(Ce),Ce.content instanceof o&&SE(Ce.content);if(_t)return j;if(K){if(Y)for(Je=L.call(R.ownerDocument);R.firstChild;)Je.appendChild(R.firstChild);else Je=R;return(oe.shadowroot||oe.shadowrootmode)&&(Je=fe.call(r,Je,!0)),Je}let kt=ve?R.outerHTML:R.innerHTML;return ve&&$["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&pt($y,R.ownerDocument.doctype.name)&&(kt=" +`+kt),ot&&xa([Ee,De,ge],an=>{kt=Qi(kt,an," ")}),_&&Se?_.createHTML(kt):kt},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ia(j),ee=!0},e.clearConfig=function(){xr=null,ee=!1},e.isValidAttribute=function(j,y,R){xr||Ia({});let W=Fe(j),Ce=Fe(y);return wd(W,Ce,R)},e.addHook=function(j,y){typeof y=="function"&&Xi(le[j],y)},e.removeHook=function(j,y){if(y!==void 0){let R=KN(le[j],y);return R===-1?void 0:GN(le[j],R,1)[0]}return Ry(le[j])},e.removeHooks=function(j){le[j]=[]},e.removeAllHooks=function(){le=zy()},e}var nd=Hy();function lv(t){for(var e=1;e0&&t[e-1]===` +`;)e--;return t.substring(0,e)}function qy(t){return Vy(Gy(t))}var cv=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function ad(t){return ld(t,cv)}var jy=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Yy(t){return ld(t,jy)}function uv(t){return Zy(t,jy)}var Jy=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function dv(t){return ld(t,Jy)}function fv(t){return Zy(t,Jy)}function ld(t,e){return e.indexOf(t.nodeName)>=0}function Zy(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var it={};it.paragraph={filter:"p",replacement:function(t){return` + +`+t+` + +`}};it.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+` +`}};it.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var i=sd(r===1?"=":"-",t.length);return` + +`+t+` +`+i+` + +`}else return` + +`+sd("#",r)+" "+t+` + +`}};it.blockquote={filter:"blockquote",replacement:function(t){return t=qy(t).replace(/^/gm,"> "),` + +`+t+` + +`}};it.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?` +`+t:` + +`+t+` + +`}};it.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+" ",i=e.parentNode;if(i.nodeName==="OL"){var o=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,e);r=(o?Number(o)+s:s+1)+". "}var a=/\n$/.test(t);return t=qy(t)+(a?` +`:""),t=t.replace(/\n/gm,` +`+" ".repeat(r.length)),r+t+(e.nextSibling?` +`:"")}};it.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return` + + `+e.firstChild.textContent.replace(/\n/g,` + `)+` + +`}};it.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",i=(r.match(/language-(\S+)/)||[null,""])[1],o=e.firstChild.textContent,s=n.fence.charAt(0),a=3,l=new RegExp("^"+s+"{3,}","gm"),c;c=l.exec(o);)c[0].length>=a&&(a=c[0].length+1);var u=sd(s,a);return` + +`+u+i+` +`+o.replace(/\n$/,"")+` +`+u+` + +`}};it.horizontalRule={filter:"hr",replacement:function(t,e,n){return` + +`+n.hr+` + +`}};it.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=Aa(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}};it.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),i=Aa(e.getAttribute("title"));i&&(i=' "'+i+'"');var o,s;switch(n.linkReferenceStyle){case"collapsed":o="["+t+"][]",s="["+t+"]: "+r+i;break;case"shortcut":o="["+t+"]",s="["+t+"]: "+r+i;break;default:var a=this.references.length+1;o="["+t+"]["+a+"]",s="["+a+"]: "+r+i}return this.references.push(s),o},references:[],append:function(t){var e="";return this.references.length&&(e=` + +`+this.references.join(` +`)+` + +`,this.references=[]),e}};it.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};it.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};it.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};it.image={filter:"img",replacement:function(t,e){var n=Aa(e.getAttribute("alt")),r=e.getAttribute("src")||"",i=Aa(e.getAttribute("title")),o=i?' "'+i+'"':"";return r?"!["+n+"]("+r+o+")":""}};function Aa(t){return t?t.replace(/(\n+\s*)+/g,` +`):""}function Xy(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}Xy.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=rd(this.array,t,this.options))||(e=rd(this._keep,t,this.options))||(e=rd(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function hv(t){var e=t.element,n=t.isBlock,r=t.isVoid,i=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||i(e))){for(var o=null,s=!1,a=null,l=Wy(a,e,i);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!s&&c[0]===" "&&(c=c.substr(1)),!c){l=id(l);continue}l.data=c,o=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,s=!1):r(l)||i(l)?(o=null,s=!0):o&&(s=!1);else{l=id(l);continue}var u=Wy(a,l,i);a=l,l=u}o&&(o.data=o.data.replace(/ $/,""),o.data||id(o))}}function id(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Wy(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var cd=typeof window<"u"?window:{};function mv(){var t=cd.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function gv(){var t=function(){};return bv()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function bv(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{cd.ActiveXObject&&(t=!0)}return t}var yv=mv()?cd.DOMParser:gv();function Ev(t,e){var n;if(typeof t=="string"){var r=kv().parseFromString(''+t+"","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return hv({element:n,isBlock:ad,isVoid:Yy,isPre:e.preformattedCode?wv:null}),n}var od;function kv(){return od=od||new yv,od}function wv(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function Sv(t,e){return t.isBlock=ad(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=xv(t),t.flankingWhitespace=_v(t,e),t}function xv(t){return!Yy(t)&&!dv(t)&&/^\s*$/i.test(t.textContent)&&!uv(t)&&!fv(t)}function _v(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=Tv(t.textContent);return n.leadingAscii&&Ky("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Ky("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Tv(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function Ky(t,e,n){var r,i,o;return t==="left"?(r=e.previousSibling,i=/ $/):(r=e.nextSibling,i=/^ /),r&&(r.nodeType===3?o=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?o=!1:r.nodeType===1&&!ad(r)&&(o=i.test(r.textContent))),o}var Cv=Array.prototype.reduce,Av=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Na(t){if(!(this instanceof Na))return new Na(t);var e={rules:it,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?` + +`:""},keepReplacement:function(n,r){return r.isBlock?` + +`+r.outerHTML+` + +`:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?` + +`+n+` + +`:n}};this.options=lv({},e,t),this.rules=new Xy(this.options)}Na.prototype={turndown:function(t){if(!Mv(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=Qy.call(this,new Ev(t,this.options));return Nv.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e`${t}`});Qr.addRule("taskListItem",{filter:t=>t.nodeName==="LI"&&t.getAttribute("data-type")==="taskItem",replacement:(t,e)=>{let r=e.getAttribute("data-checked")==="true"?"- [x] ":"- [ ] ",i=t.replace(/^\s+/,"").replace(/\s+$/,"");return r+i+` +`}});Qr.addRule("taskList",{filter:t=>t.nodeName==="UL"&&t.getAttribute("data-type")==="taskList",replacement:t=>` +`+t+` +`});var sE=t=>{try{let e=new URL(t,window.location.href);return["http:","https:","mailto:"].includes(e.protocol)}catch{return!1}},aE=(t,e)=>new Promise(n=>{let r=document.createElement("div");r.className="wysiwyg-modal__overlay";let i=document.createElement("div");i.className="wysiwyg-modal";let o=document.createElement("h3");o.className="wysiwyg-modal__title",o.textContent=t,i.appendChild(o);let s={};e.forEach(({name:f,label:p,type:h,placeholder:m})=>{let g=document.createElement("label");g.className="wysiwyg-modal__label",g.textContent=p,i.appendChild(g);let b=document.createElement("input");b.type=h||"text",b.className="wysiwyg-modal__input",m&&(b.placeholder=m),i.appendChild(b),s[f]=b});let a=document.createElement("div");a.className="wysiwyg-modal__actions";let l=document.createElement("button");l.type="button",l.className="wysiwyg-modal__btn wysiwyg-modal__btn--cancel",l.textContent="Cancel";let c=document.createElement("button");c.type="button",c.className="wysiwyg-modal__btn wysiwyg-modal__btn--insert",c.textContent="Insert",a.appendChild(l),a.appendChild(c),i.appendChild(a),r.appendChild(i),document.body.appendChild(r);let u=Object.values(s)[0];u&&requestAnimationFrame(()=>u.focus());let d=f=>{r.remove(),n(f)};l.addEventListener("click",()=>d(null)),r.addEventListener("click",f=>{f.target===r&&d(null)}),c.addEventListener("click",()=>{let f={};for(let[p,h]of Object.entries(s))f[p]=h.value;d(f)}),i.addEventListener("keydown",f=>{f.key==="Enter"&&c.click(),f.key==="Escape"&&d(null)})}),Xr=null,pE=0,hE=async()=>Xr||(window.mermaid||await new Promise((t,e)=>{let n=document.createElement("script");n.src="https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.min.js",n.integrity="sha256-pDvBr9RG+cTMZqxd1F0C6NZeJvxTROwO94f4jW3bb54=",n.crossOrigin="anonymous",n.onload=t,n.onerror=()=>e(new Error("Failed to load mermaid")),document.head.appendChild(n)}),Xr=window.mermaid,Xr.initialize({startOnLoad:!1,theme:"default"}),Xr),Ma=(t,e)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(...r),e)}},Te=(t,e)=>{let{label:n,onClick:r,isActive:i,title:o}=e,s=document.createElement("button");s.type="button",s.className="wysiwyg-toolbar__btn",s.setAttribute("aria-label",n),o&&s.setAttribute("title",o),s.innerHTML=e.html||n,s.addEventListener("click",l=>{l.preventDefault(),r()});let a=()=>{s.classList.toggle("wysiwyg-toolbar__btn--active",i?i():!1)};return t.on("selectionUpdate",a),t.on("transaction",a),a(),s},io=()=>{let t=document.createElement("span");return t.className="wysiwyg-toolbar__sep",t},zv=t=>{let e=document.createElement("select");e.className="wysiwyg-toolbar__lang-select",e.setAttribute("aria-label","Heading level"),e.setAttribute("title","Heading level"),[{value:"p",label:"Paragraph"},{value:"1",label:"Heading 1"},{value:"2",label:"Heading 2"},{value:"3",label:"Heading 3"}].forEach(({value:i,label:o})=>{let s=document.createElement("option");s.value=i,s.textContent=o,e.appendChild(s)}),e.addEventListener("change",()=>{let i=e.value;i==="p"?t.chain().focus().setParagraph().run():t.chain().focus().toggleHeading({level:parseInt(i)}).run()});let r=()=>{t.isActive("heading",{level:1})?e.value="1":t.isActive("heading",{level:2})?e.value="2":t.isActive("heading",{level:3})?e.value="3":e.value="p"};return t.on("selectionUpdate",r),t.on("transaction",r),r(),e},At={bulletList:'',orderedList:'',checkbox:'',link:'',image:'',markdown:'',preview:''},Fv=t=>{let n=document.createElement("div");n.className="wysiwyg-table-grid",n.style.display="none";let r=document.createElement("div");r.className="wysiwyg-table-grid__label",r.textContent="Insert table",n.appendChild(r);let i=document.createElement("div");i.className="wysiwyg-table-grid__cells",n.appendChild(i);let o=[];for(let a=0;a<6;a++)for(let l=0;l<6;l++){let c=document.createElement("span");c.className="wysiwyg-table-grid__cell",c.dataset.row=a+1,c.dataset.col=l+1,i.appendChild(c),o.push(c)}let s=(a,l)=>{o.forEach(c=>{let u=parseInt(c.dataset.row),d=parseInt(c.dataset.col);c.classList.toggle("wysiwyg-table-grid__cell--active",u<=a&&d<=l)}),r.textContent=`${a} \xD7 ${l} table`};return i.addEventListener("mouseover",a=>{let l=a.target.closest(".wysiwyg-table-grid__cell");l&&s(parseInt(l.dataset.row),parseInt(l.dataset.col))}),i.addEventListener("mouseleave",()=>{o.forEach(a=>a.classList.remove("wysiwyg-table-grid__cell--active")),r.textContent="Insert table"}),i.addEventListener("click",a=>{let l=a.target.closest(".wysiwyg-table-grid__cell");l&&t(parseInt(l.dataset.row),parseInt(l.dataset.col))}),n},Uv=(t,e)=>{let n=document.createElement("div");n.className="wysiwyg-table-context",n.style.display="none",e.after(n),[{label:"Add row above",icon:"\u2191 Row",cmd:()=>t.chain().focus().addRowBefore().run()},{label:"Add row below",icon:"\u2193 Row",cmd:()=>t.chain().focus().addRowAfter().run()},{label:"Delete row",icon:"\u2715 Row",cmd:()=>t.chain().focus().deleteRow().run(),danger:!0},"sep",{label:"Add column before",icon:"\u2190 Col",cmd:()=>t.chain().focus().addColumnBefore().run()},{label:"Add column after",icon:"\u2192 Col",cmd:()=>t.chain().focus().addColumnAfter().run()},{label:"Delete column",icon:"\u2715 Col",cmd:()=>t.chain().focus().deleteColumn().run(),danger:!0},"sep",{label:"Merge cells",icon:"Merge",cmd:()=>t.chain().focus().mergeCells().run()},{label:"Split cell",icon:"Split",cmd:()=>t.chain().focus().splitCell().run()},"sep",{label:"Delete table",icon:"Delete table",cmd:()=>t.chain().focus().deleteTable().run(),danger:!0}].forEach(o=>{if(o==="sep"){n.appendChild(io());return}let s=document.createElement("button");s.type="button",s.className="wysiwyg-table-context__btn"+(o.danger?" wysiwyg-table-context__btn--danger":""),s.setAttribute("aria-label",o.label),s.setAttribute("title",o.label),s.textContent=o.icon,s.addEventListener("click",a=>{a.preventDefault(),o.cmd()}),n.appendChild(s)});let i=()=>{n.style.display=t.isActive("table")?"":"none"};return t.on("selectionUpdate",i),t.on("transaction",i),i(),n},$v=(t,e)=>{let n=document.createElement("div");n.className="wysiwyg-toolbar__left";let r=document.createElement("div");r.className="wysiwyg-toolbar__right",n.appendChild(zv(t)),n.appendChild(Te(t,{label:"Bold",title:"Bold",html:"B",onClick:()=>t.chain().focus().toggleBold().run(),isActive:()=>t.isActive("bold")})),n.appendChild(Te(t,{label:"Italic",title:"Italic",html:"I",onClick:()=>t.chain().focus().toggleItalic().run(),isActive:()=>t.isActive("italic")})),n.appendChild(Te(t,{label:"Underline",title:"Underline",html:"U",onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:()=>t.isActive("underline")})),n.appendChild(Te(t,{label:"Strikethrough",title:"Strikethrough",html:"S",onClick:()=>t.chain().focus().toggleStrike().run(),isActive:()=>t.isActive("strike")})),n.appendChild(io()),n.appendChild(Te(t,{label:"Bullet list",title:"Bullet list",html:At.bulletList,onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive("bulletList")})),n.appendChild(Te(t,{label:"Ordered list",title:"Ordered list",html:At.orderedList,onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive("orderedList")})),n.appendChild(Te(t,{label:"Checkbox",title:"Checkbox list",html:At.checkbox,onClick:()=>t.chain().focus().toggleTaskList().run(),isActive:()=>t.isActive("taskList")})),n.appendChild(io()),n.appendChild(Te(t,{label:"Link",title:"Insert link",html:At.link,onClick:async()=>{let f=await aE("Insert Link",[{name:"url",label:"URL",type:"url",placeholder:"https://example.com"}]);if(!(!f||!f.url)){if(!sE(f.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setLink({href:f.url}).run()}},isActive:()=>t.isActive("link")})),n.appendChild(Te(t,{label:"Image",title:"Insert image",html:At.image,onClick:async()=>{let f=await aE("Insert Image",[{name:"url",label:"Image URL",type:"url",placeholder:"https://example.com/image.png"},{name:"alt",label:"Alt text",type:"text",placeholder:"Image description"}]);if(!(!f||!f.url)){if(!sE(f.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setImage({src:f.url,alt:f.alt||""}).run()}},isActive:()=>!1})),n.appendChild(Te(t,{label:"Blockquote",title:"Blockquote",html:"“",onClick:()=>t.chain().focus().toggleBlockquote().run(),isActive:()=>t.isActive("blockquote")})),n.appendChild(Te(t,{label:"Horizontal rule",title:"Horizontal rule",html:"―",onClick:()=>t.chain().focus().setHorizontalRule().run(),isActive:()=>!1}));let i=document.createElement("span");i.className="wysiwyg-toolbar__table-wrap";let o=Te(t,{label:"Table",title:"Insert table",html:"▦",onClick:()=>{s.style.display=s.style.display==="none"?"":"none"},isActive:()=>t.isActive("table")}),s=Fv((f,p)=>{t.chain().focus().insertTable({rows:f,cols:p,withHeaderRow:!0}).run(),s.style.display="none"});i.appendChild(o),i.appendChild(s),n.appendChild(i);let a=f=>{i.contains(f.target)||(s.style.display="none")};document.addEventListener("click",a),n.appendChild(io()),n.appendChild(Te(t,{label:"Inline code",title:"Inline code",html:"</>",onClick:()=>t.chain().focus().toggleCode().run(),isActive:()=>t.isActive("code")})),n.appendChild(Te(t,{label:"Code block",title:"Code block",html:"{{{",onClick:()=>t.chain().focus().toggleCodeBlock({language:va}).run(),isActive:()=>t.isActive("codeBlock")}));let l=document.createElement("select");l.className="wysiwyg-toolbar__lang-select",l.setAttribute("aria-label","Code block language"),l.setAttribute("title","Code block language"),oE.forEach(({value:f,label:p})=>{let h=document.createElement("option");h.value=f,h.textContent=p,l.appendChild(h)});let c=()=>{let f=t.isActive("codeBlock");if(l.disabled=!f,f){let h=t.getAttributes("codeBlock").language||va;l.value=oE.some(m=>m.value===h)?h:va}};l.addEventListener("change",()=>{t.chain().focus().updateAttributes("codeBlock",{language:l.value}).run()}),t.on("selectionUpdate",c),t.on("transaction",c),c(),n.appendChild(l),n.appendChild(io());let u=document.createElement("button");u.type="button",u.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--md",u.setAttribute("aria-label","Markdown"),u.setAttribute("title","Toggle Markdown mode"),u.innerHTML=At.markdown,n.appendChild(u);let d=document.createElement("button");return d.type="button",d.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--preview-toggle",d.setAttribute("aria-label","Preview"),d.setAttribute("title","Toggle preview"),d.innerHTML=At.preview,d.style.display="none",r.appendChild(d),r.appendChild(Te(t,{label:"Undo",title:"Undo",html:"↶",onClick:()=>t.chain().focus().undo().run(),isActive:()=>!1})),r.appendChild(Te(t,{label:"Redo",title:"Redo",html:"↷",onClick:()=>t.chain().focus().redo().run(),isActive:()=>!1})),e.appendChild(n),e.appendChild(r),{mdBtn:u,previewBtn:d,handleDocClick:a}},fd=(t,e)=>{let n=Ma(async()=>{let r=e.querySelectorAll("pre"),i=new Set;for(let o of r){let s=o.querySelector("code");if(!s||!s.classList.contains("language-mermaid"))continue;let a=o.nextElementSibling;(!a||!a.classList.contains("mermaid-preview"))&&(a=document.createElement("div"),a.className="mermaid-preview",o.after(a)),i.add(a);let l=s.textContent.trim();if(!l){a.innerHTML="";continue}try{let c=await hE(),u=`mermaid-edit-${++pE}`,{svg:d}=await c.render(u,l);a.innerHTML=dE(d),a.classList.remove("mermaid-error")}catch(c){let u=document.createElement("span");u.className="mermaid-error",u.textContent=c.message||"Invalid diagram",a.innerHTML="",a.appendChild(u),a.classList.add("mermaid-error")}}e.querySelectorAll(".mermaid-preview").forEach(o=>{i.has(o)||o.remove()})},500);t.on("update",n),n()},lE=t=>{t.querySelectorAll("pre code[class*='language-']").forEach(e=>{let n=e.className.match(/language-\{?(\w+)\}?/);if(!n)return;let r=n[1];if(r==="mermaid")return;let i=e.textContent;try{let o=fE.highlight(r,i);e.innerHTML=Lu(o)}catch{}})},cE=async t=>{let e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;let n=await hE();for(let r of e){let i=r.parentElement;if(!i||i.tagName!=="PRE")continue;let o=r.textContent.trim();if(!o)continue;let s=document.createElement("div");s.className="mermaid-preview";try{let a=`mermaid-preview-${++pE}`,{svg:l}=await n.render(a,o);s.innerHTML=dE(l)}catch(a){let l=document.createElement("span");l.className="mermaid-error",l.textContent=a.message||"Invalid diagram",s.appendChild(l),s.classList.add("mermaid-error")}i.replaceWith(s)}},dd=new Map,Hv=t=>{let e=dd.get(t);e&&(e.editor.destroy(),e.cleanup(),dd.delete(t));let n=document.getElementById(t);if(!n)return null;let r=n.closest('[data-wysiwyg="v3"]');if(!r)return null;let i=r.querySelector(".wysiwyg-editor__toolbar"),o=r.querySelector(".wysiwyg-editor__body");if(!i||!o)return null;i.innerHTML="",r.querySelectorAll(".wysiwyg-table-context").forEach(v=>v.remove());let s=n.value?n.value.trim():"",a=s.startsWith("<")&&s.includes(">"),l=s;if(l&&!a)try{l=ro(l)}catch{l=s}let c={current:null},u=new Hr({element:o,extensions:[ns.configure({codeBlock:!1}),fm.configure({lowlight:fE,defaultLanguage:va}),ls,Nm.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener"}}),og.configure({resizable:!1}),sg,ag,lg,cg,Ys,Js.configure({nested:!0})],content:l,editorProps:{attributes:{class:"wysiwyg-editor__prose"},handleKeyDown(v,L){if(L.key==="Tab"){let{$from:F}=v.state.selection;if(F.parent.type.name==="codeBlock")return L.preventDefault(),c.current?.chain().focus().insertContent(" ").run(),!0}return!1},handlePaste(v,L){let F=L.clipboardData?.getData("text/plain")||"";if(!F.trim()||!c.current)return!1;let fe=F.trim();if(!fe.startsWith("<")&&(/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(fe)||/\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(F)))try{L.preventDefault();let Ee=ro(F);return c.current.chain().focus().insertContent(Ee).run(),!0}catch{return!1}return!1}}});c.current=u;let d={mode:"wysiwyg",markdownText:"",previewOn:!1},{mdBtn:f,previewBtn:p,handleDocClick:h}=$v(u,i);Uv(u,i),fd(u,o);let m=document.createElement("div");m.className="wysiwyg-editor__markdown-pane",m.style.display="none";let g=document.createElement("textarea");g.className="wysiwyg-markdown__textarea",g.setAttribute("aria-label","Markdown source"),g.setAttribute("placeholder","Write markdown here...");let b=document.createElement("div");b.className="wysiwyg-markdown__preview wysiwyg-editor__prose",m.appendChild(g),m.appendChild(b),o.after(m);let k=document.createElement("div");k.className="wysiwyg-editor__preview wysiwyg-editor__prose",k.style.display="none",m.after(k);let C=()=>{b.innerHTML=ro(d.markdownText),lE(b),cE(b)},_=Ma(C,300);g.addEventListener("input",()=>{d.markdownText=g.value,_()}),f.addEventListener("click",v=>{v.preventDefault(),d.mode==="wysiwyg"?(d.markdownText=Qr.turndown(u.getHTML()),d.mode="markdown",d.previewOn=!1,f.classList.add("wysiwyg-toolbar__btn--active"),i.classList.add("wysiwyg-editor__toolbar--markdown"),o.style.display="none",m.style.display="",k.style.display="none",p.style.display="",p.classList.remove("wysiwyg-toolbar__btn--active"),g.value=d.markdownText,C(),g.focus()):(u.commands.setContent(ro(d.markdownText)),d.mode="wysiwyg",d.previewOn=!1,f.classList.remove("wysiwyg-toolbar__btn--active"),i.classList.remove("wysiwyg-editor__toolbar--markdown"),o.style.display="",m.style.display="none",k.style.display="none",p.style.display="none",p.classList.remove("wysiwyg-toolbar__btn--active"))}),p.addEventListener("click",v=>{v.preventDefault(),d.previewOn=!d.previewOn,p.classList.toggle("wysiwyg-toolbar__btn--active",d.previewOn),d.previewOn?(m.style.display="none",k.style.display="",k.innerHTML=ro(d.markdownText),lE(k),cE(k)):(m.style.display="",k.style.display="none")}),n.style.position="absolute",n.style.left="-9999px",n.style.width="1px",n.style.height="1px",n.setAttribute("aria-hidden","true"),n.tabIndex=-1;let T=r.closest("form"),I=()=>{d.mode==="markdown"?n.value=d.markdownText:n.value=Qr.turndown(u.getHTML())};return T&&T.addEventListener("submit",I,!0),dd.set(t,{editor:u,cleanup:()=>{document.removeEventListener("click",h),T&&T.removeEventListener("submit",I,!0)}}),u},uE=()=>{typeof document>"u"||!document.querySelector||document.querySelectorAll('[data-wysiwyg="v3"]').forEach(t=>{let e=t.querySelector("textarea[id]");e&&e.id&&Hv(e.id)})};typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",uE):uE());var WP=Wi(Ui),pd=new Map,Wv=(t,e)=>{let n=document.createElement("div");n.className="wysiwyg-toolbar__left";let r=document.createElement("div");r.className="wysiwyg-toolbar__right",n.appendChild(Te(t,{label:"Bold",title:"Bold",html:"B",onClick:()=>t.chain().focus().toggleBold().run(),isActive:()=>t.isActive("bold")})),n.appendChild(Te(t,{label:"Italic",title:"Italic",html:"I",onClick:()=>t.chain().focus().toggleItalic().run(),isActive:()=>t.isActive("italic")})),n.appendChild(Te(t,{label:"Underline",title:"Underline",html:"U",onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:()=>t.isActive("underline")})),n.appendChild(Te(t,{label:"Bullet list",title:"Bullet list",html:At.bulletList,onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive("bulletList")})),n.appendChild(Te(t,{label:"Ordered list",title:"Ordered list",html:At.orderedList,onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive("orderedList")})),n.appendChild(Te(t,{label:"Link",title:"Insert link",html:At.link,onClick:async()=>{let a=await openModal("Insert Link",[{name:"url",label:"URL",type:"url",placeholder:"https://example.com"}]);if(!(!a||!a.url)){if(!isSafeUrl(a.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setLink({href:a.url}).run()}},isActive:()=>t.isActive("link")}));let i=a=>{tableWrapper.contains(a.target)||(gridPopup.style.display="none")},o=document.createElement("button");o.type="button",o.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--md",o.setAttribute("aria-label","Markdown"),o.setAttribute("title","Toggle Markdown mode"),o.innerHTML=At.markdown,n.appendChild(o);let s=document.createElement("button");return s.type="button",s.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--preview-toggle",s.setAttribute("aria-label","Preview"),s.setAttribute("title","Toggle preview"),s.innerHTML=At.preview,s.style.display="none",r.appendChild(s),r.appendChild(Te(t,{label:"Undo",title:"Undo",html:"↶",onClick:()=>t.chain().focus().undo().run(),isActive:()=>!1})),r.appendChild(Te(t,{label:"Redo",title:"Redo",html:"↷",onClick:()=>t.chain().focus().redo().run(),isActive:()=>!1})),e.appendChild(n),e.appendChild(r),{mdBtn:o,previewBtn:s,handleDocClick:i}},Kv=t=>{let e=pd.get(t);e&&(e.editor.destroy(),e.cleanup(),pd.delete(t));let n=document.getElementById(t);if(!n)return null;let r=n.closest('[data-wysiwyg="v3"]');if(!r)return null;let i=r.querySelector(".wysiwyg-editor__toolbar"),o=r.querySelector(".wysiwyg-editor__body");if(!i||!o)return null;i.innerHTML="",r.querySelectorAll(".wysiwyg-table-context").forEach(v=>v.remove());let s=n.value?n.value.trim():"",a=s.startsWith("<")&&s.includes(">"),l=s;if(l&&!a)try{l=parseMarkdownSafe(l)}catch{l=s}let c={current:null},u=new Hr({element:o,extensions:[ns.configure({codeBlock:!1}),ls,Ys,Js.configure({nested:!0})],content:l,editorProps:{attributes:{class:"wysiwyg-editor__prose"},handleKeyDown(v,L){if(L.key==="Tab"){let{$from:F}=v.state.selection;if(F.parent.type.name==="codeBlock")return L.preventDefault(),c.current?.chain().focus().insertContent(" ").run(),!0}return!1},handlePaste(v,L){let F=L.clipboardData?.getData("text/plain")||"";if(!F.trim()||!c.current)return!1;let fe=F.trim();if(!fe.startsWith("<")&&(/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(fe)||/\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(F)))try{L.preventDefault();let Ee=parseMarkdownSafe(F);return c.current.chain().focus().insertContent(Ee).run(),!0}catch{return!1}return!1}}});c.current=u;let d={mode:"wysiwyg",markdownText:"",previewOn:!1},{mdBtn:f,previewBtn:p,handleDocClick:h}=Wv(u,i);fd(u,o);let m=document.createElement("div");m.className="wysiwyg-editor__markdown-pane",m.style.display="none";let g=document.createElement("textarea");g.className="wysiwyg-markdown__textarea",g.setAttribute("aria-label","Markdown source"),g.setAttribute("placeholder","Write markdown here...");let b=document.createElement("div");b.className="wysiwyg-markdown__preview wysiwyg-editor__prose",m.appendChild(g),m.appendChild(b),o.after(m);let k=document.createElement("div");k.className="wysiwyg-editor__preview wysiwyg-editor__prose",k.style.display="none",m.after(k);let C=()=>{b.innerHTML=parseMarkdownSafe(d.markdownText),highlightPreviewCodeBlocks(b),renderMermaidPreview(b)},_=Ma(C,300);g.addEventListener("input",()=>{d.markdownText=g.value,_()}),f.addEventListener("click",v=>{v.preventDefault(),d.mode==="wysiwyg"?(d.markdownText=turndown.turndown(u.getHTML()),d.mode="markdown",d.previewOn=!1,f.classList.add("wysiwyg-toolbar__btn--active"),i.classList.add("wysiwyg-editor__toolbar--markdown"),o.style.display="none",m.style.display="",k.style.display="none",p.style.display="",p.classList.remove("wysiwyg-toolbar__btn--active"),g.value=d.markdownText,C(),g.focus()):(u.commands.setContent(parseMarkdownSafe(d.markdownText)),d.mode="wysiwyg",d.previewOn=!1,f.classList.remove("wysiwyg-toolbar__btn--active"),i.classList.remove("wysiwyg-editor__toolbar--markdown"),o.style.display="",m.style.display="none",k.style.display="none",p.style.display="none",p.classList.remove("wysiwyg-toolbar__btn--active"))}),p.addEventListener("click",v=>{v.preventDefault(),d.previewOn=!d.previewOn,p.classList.toggle("wysiwyg-toolbar__btn--active",d.previewOn),d.previewOn?(m.style.display="none",k.style.display="",k.innerHTML=parseMarkdownSafe(d.markdownText),highlightPreviewCodeBlocks(k),renderMermaidPreview(k)):(m.style.display="",k.style.display="none")}),n.style.position="absolute",n.style.left="-9999px",n.style.width="1px",n.style.height="1px",n.setAttribute("aria-hidden","true"),n.tabIndex=-1;let T=r.closest("form"),I=()=>{d.mode==="markdown"?n.value=d.markdownText:n.value=turndown.turndown(u.getHTML())};return T&&T.addEventListener("submit",I,!0),pd.set(t,{editor:u,cleanup:()=>{document.removeEventListener("click",h),T&&T.removeEventListener("submit",I,!0)}}),u},mE=()=>{typeof document>"u"||!document.querySelector||document.querySelectorAll('[data-wysiwyg="v3"]').forEach(t=>{let e=t.querySelector("textarea[id]");e&&e.id&&Kv(e.id)})};typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",mE):mE());export{Kv as initWysiwyg}; +/*! Bundled license information: + +dompurify/dist/purify.es.mjs: + (*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE *) +*/ diff --git a/templates/includes/icon.html b/templates/includes/icon.html index 5c2d90fd9..86356b327 100644 --- a/templates/includes/icon.html +++ b/templates/includes/icon.html @@ -127,6 +127,8 @@ {% elif icon_name == "pixel-share" %} + {% elif icon_name == "pixel-trash" %} + {% endif %} {% endif %} diff --git a/templates/v3/includes/_avatar_v3.html b/templates/v3/includes/_avatar_v3.html index a8e044597..f8f91a4e5 100644 --- a/templates/v3/includes/_avatar_v3.html +++ b/templates/v3/includes/_avatar_v3.html @@ -6,7 +6,7 @@ - src (optional) Image URL for the avatar - name (optional) User's full name; used for alt text and initials fallback - variant (optional) Background color: yellow | green | teal (default: yellow) - - size (optional) Avatar size: sm | md | lg | xl (default: md) + - size (optional) Avatar size: sm | md | lg | xl | xxxl (default: md) Rendering priority: 1. Image — when `src` is provided diff --git a/templates/v3/includes/_field_checkbox.html b/templates/v3/includes/_field_checkbox.html index fc617387d..8ad10e66b 100644 --- a/templates/v3/includes/_field_checkbox.html +++ b/templates/v3/includes/_field_checkbox.html @@ -8,21 +8,27 @@ required (optional) — if truthy, adds required attribute disabled (optional) — if truthy, adds disabled attribute extra_class (optional) — additional classes on the wrapper + help_text (optional) — help text that appears in small font below the checkbox for context Usage: {% include "v3/includes/_field_checkbox.html" with name="agree" label="I agree to the terms" %} {% endcomment %} - +
    + + {% if help_text %} +

    {{ help_text }}

    + {% endif %} +
    diff --git a/templates/v3/includes/_field_dropdown.html b/templates/v3/includes/_field_dropdown.html index f017238b9..fc46b1be0 100644 --- a/templates/v3/includes/_field_dropdown.html +++ b/templates/v3/includes/_field_dropdown.html @@ -5,6 +5,7 @@ label (optional) — label text placeholder (optional) — placeholder text when nothing selected options (required) — list of (value, label) 2-tuples (e.g. from TextChoices.choices) + disabled (optional) — if true, disables the input and applies the disabled style selected (optional) — value of the pre-selected option default (optional) — value to reset to when the clear button is clicked (defaults to '') help_text (optional) — help text below the field @@ -91,17 +92,18 @@ {% if label %}aria-labelledby="field-{{ name }}-label"{% endif %} {% if error %}aria-invalid="true" aria-describedby="field-{{ name }}-error"{% elif help_text %}aria-describedby="field-{{ name }}-help"{% endif %} x-show="!jsReady" - :disabled="jsReady" + :disabled="jsReady || {{disabled|default:"false"}}" @change="$dispatch('field-change', { name: '{{ name }}', value: $event.target.value, label: $event.target.options[$event.target.selectedIndex].text })"> {% if placeholder %}{% endif %} {% for value, label in options %} {% endfor %} -