diff --git a/core/mock_data.py b/core/mock_data.py index 76655d6a3..687ffad5c 100644 --- a/core/mock_data.py +++ b/core/mock_data.py @@ -205,7 +205,7 @@ class SharedResources: "author": { "name": "Prof. Sven G. Bilén, Ph.D.", "profile_url": "#", - "avatar_url": large_static("img/v3/demo_page/avatar.png"), + "avatar_url": large_static("img/v3/demo-page/avatar.png"), "role": "The Pennsylvania State University", "badge": BadgeToken.TIER_3, }, diff --git a/frontend/wysiwyg-editor.js b/frontend/wysiwyg-editor.js index fd386ec80..ef94d3ba4 100644 --- a/frontend/wysiwyg-editor.js +++ b/frontend/wysiwyg-editor.js @@ -1,5 +1,6 @@ -import { Editor } from "@tiptap/core"; +import { Editor, Extension } from "@tiptap/core"; +import { Plugin } from "@tiptap/pm/state"; import StarterKit from "@tiptap/starter-kit"; import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight"; import Underline from "@tiptap/extension-underline"; @@ -195,7 +196,7 @@ export const debounce = (fn, ms) => { }; export const createToolbarButton = (editor, opts) => { - const { label, onClick, isActive, title } = opts; + const { label, onClick, isActive, isDisabled, title } = opts; const btn = document.createElement("button"); btn.type = "button"; btn.className = "wysiwyg-toolbar__btn"; @@ -208,6 +209,12 @@ export const createToolbarButton = (editor, opts) => { }); const updateActive = () => { btn.classList.toggle("wysiwyg-toolbar__btn--active", isActive ? isActive() : false); + // Optional disabled state (e.g. undo/redo greyed out when no history). + if (isDisabled) { + const disabled = isDisabled(); + btn.disabled = disabled; + btn.classList.toggle("wysiwyg-toolbar__btn--disabled", disabled); + } }; editor.on("selectionUpdate", updateActive); editor.on("transaction", updateActive); @@ -278,6 +285,28 @@ export const ICONS = { '', }; +/* +Biography toolbar icons, normalized to `currentColor` so they inherit the +toolbar button colour and active/hover states. Used only by the "bio" toolbar +preset so the icons on other editors (news, examples) are unchanged. +*/ +export const BIO_ICONS = { + bold: + '', + italic: + '', + underline: + '', + orderedList: + '', + markdown: + '', + undo: + '', + redo: + '', +}; + const buildTableGridPicker = (onSelect) => { const MAX = 6; @@ -406,6 +435,16 @@ const TOOLBAR_PRESETS = { ], right: ["preview", "undo", "redo"], }, + /* + Biography editor preset: bold, italic, underline, ordered list, link, markdown + on the left; undo / redo on the right. No separators or bullet list. Preview is + retained for Markdown-mode preview functionality. The "bio" preset renders + BIO_ICONS. + */ + bio: { + left: ["bold", "italic", "underline", "orderedList", "markdown"], + right: ["preview", "undo", "redo"], + }, }; const buildToolbar = (editor, toolbarEl, preset = "full") => { @@ -418,21 +457,26 @@ const buildToolbar = (editor, toolbarEl, preset = "full") => { // when the `table` tool is present and is removed in initWysiwyg's cleanup. const ctx = { mdBtn: null, previewBtn: null, handleDocClick: null }; + // The "bio" preset renders the dedicated bio icon set; other presets keep + // their existing glyphs. `bioIcon` returns the bio SVG for bio, else `fallback`. + const isBio = preset === "bio"; + const bioIcon = (key, fallback) => (isBio ? BIO_ICONS[key] : fallback); + const builders = { separator: () => createSeparator(), heading: () => createHeadingDropdown(editor), bold: () => createToolbarButton(editor, { - label: "Bold", title: "Bold", html: "B", + label: "Bold", title: "Bold", html: bioIcon("bold", "B"), onClick: () => editor.chain().focus().toggleBold().run(), isActive: () => editor.isActive("bold"), }), italic: () => createToolbarButton(editor, { - label: "Italic", title: "Italic", html: "I", + label: "Italic", title: "Italic", html: bioIcon("italic", "I"), onClick: () => editor.chain().focus().toggleItalic().run(), isActive: () => editor.isActive("italic"), }), underline: () => createToolbarButton(editor, { - label: "Underline", title: "Underline", html: "U", + label: "Underline", title: "Underline", html: bioIcon("underline", "U"), onClick: () => editor.chain().focus().toggleUnderline().run(), isActive: () => editor.isActive("underline"), }), @@ -447,7 +491,7 @@ const buildToolbar = (editor, toolbarEl, preset = "full") => { isActive: () => editor.isActive("bulletList"), }), orderedList: () => createToolbarButton(editor, { - label: "Ordered list", title: "Ordered list", html: ICONS.orderedList, + label: "Ordered list", title: "Ordered list", html: bioIcon("orderedList", ICONS.orderedList), onClick: () => editor.chain().focus().toggleOrderedList().run(), isActive: () => editor.isActive("orderedList"), }), @@ -457,7 +501,7 @@ const buildToolbar = (editor, toolbarEl, preset = "full") => { isActive: () => editor.isActive("taskList"), }), link: () => createToolbarButton(editor, { - label: "Link", title: "Insert link", html: ICONS.link, + label: "Link", title: "Insert link", html: bioIcon("link", ICONS.link), onClick: async () => { const result = await openModal("Insert Link", [ { name: "url", label: "URL", type: "url", placeholder: "https://example.com" }, @@ -564,7 +608,7 @@ const buildToolbar = (editor, toolbarEl, preset = "full") => { mdBtn.className = "wysiwyg-toolbar__btn wysiwyg-toolbar__btn--md"; mdBtn.setAttribute("aria-label", "Markdown"); mdBtn.setAttribute("title", "Toggle Markdown mode"); - mdBtn.innerHTML = ICONS.markdown; + mdBtn.innerHTML = bioIcon("markdown", ICONS.markdown); ctx.mdBtn = mdBtn; return mdBtn; }, @@ -580,14 +624,17 @@ const buildToolbar = (editor, toolbarEl, preset = "full") => { return previewBtn; }, undo: () => createToolbarButton(editor, { - label: "Undo", title: "Undo", html: "↶", + label: "Undo", title: "Undo", html: bioIcon("undo", "↶"), onClick: () => editor.chain().focus().undo().run(), isActive: () => false, + // Grey out when there is no history to undo. + isDisabled: isBio ? () => !editor.can().undo() : undefined, }), redo: () => createToolbarButton(editor, { - label: "Redo", title: "Redo", html: "↷", + label: "Redo", title: "Redo", html: bioIcon("redo", "↷"), onClick: () => editor.chain().focus().redo().run(), isActive: () => false, + isDisabled: isBio ? () => !editor.can().redo() : undefined, }), }; @@ -717,6 +764,25 @@ export const initWysiwyg = (textareaId) => { if (!toolbarEl || !editorEl) return null; const preset = wrapper.dataset.wysiwygPreset || "full"; + const maxlength = Number(wrapper.dataset.wysiwygMaxlength) || 0; + + // Live length of the serialized markdown; kept current by dispatchState. + let markdownLength = 0; + // Block edits that grow the doc once the markdown is at/over the limit. + const MarkdownLengthLimit = Extension.create({ + name: "markdownLengthLimit", + addProseMirrorPlugins() { + return [ + new Plugin({ + filterTransaction(tr) { + if (!tr.docChanged) return true; + const grew = tr.doc.content.size > tr.before.content.size; + return !(grew && markdownLength >= maxlength); + }, + }), + ]; + }, + }); /* 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 = ""; @@ -751,6 +817,7 @@ export const initWysiwyg = (textareaId) => { Image, TaskList, TaskItem.configure({ nested: true }), + ...(maxlength ? [MarkdownLengthLimit] : []), ], content: initialContent, editorProps: { @@ -771,21 +838,41 @@ export const initWysiwyg = (textareaId) => { handlePaste(_view, event) { const pastedText = event.clipboardData?.getData("text/plain") || ""; if (!pastedText.trim() || !editorRef.current) return false; - const trimmed = pastedText.trim(); + + // Clamp pasted text to the remaining character budget, mirroring the + // native truncation used elsewhere (e.g. Tagline). + let textToInsert = pastedText; + if (maxlength) { + const remaining = maxlength - markdownLength; + if (remaining <= 0) { + event.preventDefault(); + return true; + } + if (pastedText.length > remaining) { + textToInsert = pastedText.slice(0, remaining); + } + } + + const trimmed = textToInsert.trim(); const looksLikeMarkdown = (!trimmed.startsWith("<") && (/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(trimmed) || - /\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(pastedText))); + /\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(textToInsert))); if (looksLikeMarkdown) { try { event.preventDefault(); - const html = parseMarkdownSafe(pastedText); + const html = parseMarkdownSafe(textToInsert); editorRef.current.chain().focus().insertContent(html).run(); return true; } catch (_) { return false; } } + if (textToInsert !== pastedText) { + event.preventDefault(); + editorRef.current.chain().focus().insertContent(textToInsert).run(); + return true; + } return false; }, }, @@ -896,7 +983,7 @@ export const initWysiwyg = (textareaId) => { form.addEventListener("submit", syncTextarea, true); } - // ── Bridge to the host page (e.g. the create-post Alpine form) ────────── + // ── Bridge to the host page (e.g. the create-post / profile-edit Alpine form) ── // Emit content + plain-text char count on every change so the page can drive // a char counter, a Saving/Saved indicator, and localStorage persistence. // `programmatic: true` flags updates the user didn't make (initial load / @@ -906,12 +993,16 @@ export const initWysiwyg = (textareaId) => { ? state.markdownText : turndown.turndown(editor.getHTML()); const dispatchState = (programmatic) => { + // `characters` = visible text; `markdownCharacters` = the stored/validated markdown. + const value = currentValue(); + markdownLength = value.length; editorEl.dispatchEvent( new CustomEvent("wysiwyg-update", { detail: { id: textareaId, characters: editor.state.doc.textContent.length, - value: currentValue(), + markdownCharacters: value.length, + value, programmatic: !!programmatic, }, bubbles: true, @@ -960,4 +1051,8 @@ const autoInit = (elId) => { if (typeof document !== "undefined") { window.autoInit = autoInit + // Handshake for pages whose Alpine components initialize before this module + // finishes loading (deferred script, cold cache): they wait for this event + // instead of calling window.autoInit directly. + window.dispatchEvent(new CustomEvent("wysiwyg-editor-ready")) } diff --git a/package-lock.json b/package-lock.json index ce3bc3162..0966a7d19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,11 +24,13 @@ "@tiptap/extension-task-item": "^2.27.2", "@tiptap/extension-task-list": "^2.27.2", "@tiptap/extension-underline": "^2.10.0", + "@tiptap/pm": "^2.27.2", "@tiptap/starter-kit": "^2.10.0", "alpinejs": "^3.10.2", "autoprefixer": "^10.4.12", "cssnano": "^5.1.14", "dompurify": "^3.2.2", + "fuse.js": "7.3.0", "hast-util-to-html": "^9.0.5", "htmx": "^0.0.2", "lowlight": "^3.0.0", @@ -1844,6 +1846,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/fuse.js": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.3.0.tgz", + "integrity": "sha512-plz8RVjfcDedTGfVngWH1jmJvBvAwi1v2jecfDerbEnMcmOYUEEwKFTHbNoCiYyzaK2Ws8lABkTCcRSqCY1q4w==", + "license": "Apache-2.0", + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/krisk" + } + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", diff --git a/package.json b/package.json index b50df1a35..22f355631 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,16 @@ "@tiptap/extension-task-item": "^2.27.2", "@tiptap/extension-task-list": "^2.27.2", "@tiptap/extension-underline": "^2.10.0", + "@tiptap/pm": "^2.27.2", "@tiptap/starter-kit": "^2.10.0", "alpinejs": "^3.10.2", "autoprefixer": "^10.4.12", "cssnano": "^5.1.14", + "dompurify": "^3.2.2", + "fuse.js": "7.3.0", "hast-util-to-html": "^9.0.5", "htmx": "^0.0.2", "lowlight": "^3.0.0", - "dompurify": "^3.2.2", - "fuse.js": "7.3.0", "marked": "^17.0.0", "tailwindcss": "3.2.1", "turndown": "^7.2.0", diff --git a/static/css/v3/forms.css b/static/css/v3/forms.css index 56d9db7a3..615df385c 100644 --- a/static/css/v3/forms.css +++ b/static/css/v3/forms.css @@ -11,6 +11,10 @@ gap: var(--space-default, 8px); } +.field + .field__label-row { + margin-top: var(--space-default); +} + .field__label { font-family: var(--font-sans); font-size: var(--font-size-xs); diff --git a/static/css/v3/user-profile-page.css b/static/css/v3/user-profile-page.css index 8919af7ac..23e4543cd 100644 --- a/static/css/v3/user-profile-page.css +++ b/static/css/v3/user-profile-page.css @@ -215,14 +215,19 @@ z-index: 10; } +.user-profile__content-actions { + flex-shrink: 0; +} + .user-profile__save-indicator { - display: inline-flex; + display: flex; align-items: center; font-family: var(--font-sans); font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); letter-spacing: var(--letter-spacing-tight); color: var(--color-text-tertiary); + white-space: nowrap; } .user-profile__save-state { diff --git a/static/css/v3/wysiwyg-editor.css b/static/css/v3/wysiwyg-editor.css index 097dbab6d..4ea41f162 100644 --- a/static/css/v3/wysiwyg-editor.css +++ b/static/css/v3/wysiwyg-editor.css @@ -135,6 +135,20 @@ height: 18px; } +/* Disabled state (e.g. undo/redo with no available history). */ +.wysiwyg-toolbar__btn--disabled, +.wysiwyg-toolbar__btn:disabled { + color: var(--color-text-tertiary); + opacity: 0.25; + cursor: default; + pointer-events: none; +} + +.wysiwyg-toolbar__btn--disabled:hover, +.wysiwyg-toolbar__btn:disabled:hover { + background: transparent; +} + .wysiwyg-toolbar__btn--active { background: var(--color-surface-brand-accent-default, var(--color-primary-orange-mustard)); color: var(--color-icon-on-accent, #050816); @@ -308,6 +322,7 @@ color: var(--color-text-primary, #050816); outline: none; overflow-wrap: break-word; + word-break: break-word; } .wysiwyg-editor__prose p { diff --git a/static/js/v3/wysiwyg-editor.js b/static/js/v3/wysiwyg-editor.js index 0850424cf..c6d60dc92 100644 --- a/static/js/v3/wysiwyg-editor.js +++ b/static/js/v3/wysiwyg-editor.js @@ -1,18 +1,18 @@ -var wE=Object.create;var Aa=Object.defineProperty;var SE=Object.getOwnPropertyDescriptor;var xE=Object.getOwnPropertyNames;var _E=Object.getPrototypeOf,TE=Object.prototype.hasOwnProperty;var CE=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),NE=(t,e)=>{for(var n in e)Aa(t,n,{get:e[n],enumerable:!0})},AE=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xE(e))!TE.call(t,i)&&i!==n&&Aa(t,i,{get:()=>e[i],enumerable:!(r=SE(e,i))||r.enumerable});return t};var vE=(t,e,n)=>(n=t!=null?wE(_E(t)):{},AE(e||!t||!t.__esModule?Aa(n,"default",{value:t,enumerable:!0}):n,t));var Mb=CE((bI,vb)=>{function bb(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)&&bb(n)}),t}var Xs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function yb(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Un(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 EC="",db=t=>!!t.scope,kC=(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}`},cu=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=yb(e)}openNode(e){if(!db(e))return;let n=kC(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){db(e)&&(this.buffer+=EC)}value(){return this.buffer}span(e){this.buffer+=``}},fb=(t={})=>{let e={children:[]};return Object.assign(e,t),e},uu=class t{constructor(){this.rootNode=fb(),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=fb({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)}))}},du=class extends uu{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 cu(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ui(t){return t?typeof t=="string"?t:t.source:null}function Eb(t){return hr("(?=",t,")")}function wC(t){return hr("(?:",t,")*")}function SC(t){return hr("(?:",t,")?")}function hr(...t){return t.map(n=>Ui(n)).join("")}function xC(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function pu(...t){return"("+(xC(t).capture?"":"?:")+t.map(r=>Ui(r)).join("|")+")"}function kb(t){return new RegExp(t.toString()+"|").exec("").length-1}function _C(t,e){let n=t&&t.exec(e);return n&&n.index===0}var TC=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function hu(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Ui(r),s="";for(;o.length>0;){let a=TC.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 CC=/\b\B/,wb="[a-zA-Z]\\w*",mu="[a-zA-Z_]\\w*",Sb="\\b\\d+(\\.\\d+)?",xb="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_b="\\b(0b[01]+)",NC="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",AC=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=hr(e,/.*\b/,t.binary,/\b.*/)),Un({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},$i={begin:"\\\\[\\s\\S]",relevance:0},vC={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[$i]},MC={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[$i]},OC={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/},ea=function(t,e,n={}){let r=Un({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=pu("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:hr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},RC=ea("//","$"),IC=ea("/\\*","\\*/"),DC=ea("#","$"),LC={scope:"number",begin:Sb,relevance:0},PC={scope:"number",begin:xb,relevance:0},BC={scope:"number",begin:_b,relevance:0},zC={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[$i,{begin:/\[/,end:/\]/,relevance:0,contains:[$i]}]},FC={scope:"title",begin:wb,relevance:0},UC={scope:"title",begin:mu,relevance:0},$C={begin:"\\.\\s*"+mu,relevance:0},HC=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()}})},Zs=Object.freeze({__proto__:null,APOS_STRING_MODE:vC,BACKSLASH_ESCAPE:$i,BINARY_NUMBER_MODE:BC,BINARY_NUMBER_RE:_b,COMMENT:ea,C_BLOCK_COMMENT_MODE:IC,C_LINE_COMMENT_MODE:RC,C_NUMBER_MODE:PC,C_NUMBER_RE:xb,END_SAME_AS_BEGIN:HC,HASH_COMMENT_MODE:DC,IDENT_RE:wb,MATCH_NOTHING_RE:CC,METHOD_GUARD:$C,NUMBER_MODE:LC,NUMBER_RE:Sb,PHRASAL_WORDS_MODE:OC,QUOTE_STRING_MODE:MC,REGEXP_MODE:zC,RE_STARTERS_RE:NC,SHEBANG:AC,TITLE_MODE:FC,UNDERSCORE_IDENT_RE:mu,UNDERSCORE_TITLE_MODE:UC});function WC(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function KC(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function GC(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=WC,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function VC(t,e){Array.isArray(t.illegal)&&(t.illegal=pu(...t.illegal))}function qC(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 YC=(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=hr(n.beforeMatch,Eb(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},JC=["of","and","for","in","not","or","if","then","parent","list","value"],ZC="keyword";function Tb(t,e,n=ZC){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,Tb(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,XC(l[0],l[1])]})}}function XC(t,e){return e?Number(e):QC(t)?0:1}function QC(t){return JC.includes(t.toLowerCase())}var pb={},pr=t=>{console.error(t)},hb=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Yr=(t,e)=>{pb[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),pb[`${t}/${e}`]=!0)},Qs=new Error;function Cb(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+=kb(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function eN(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw pr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Qs;if(typeof t.beginScope!="object"||t.beginScope===null)throw pr("beginScope must be object"),Qs;Cb(t,t.begin,{key:"beginScope"}),t.begin=hu(t.begin,{joinWith:""})}}function tN(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw pr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Qs;if(typeof t.endScope!="object"||t.endScope===null)throw pr("endScope must be object"),Qs;Cb(t,t.end,{key:"endScope"}),t.end=hu(t.end,{joinWith:""})}}function nN(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function rN(t){nN(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),eN(t),tN(t)}function iN(t){function e(s,a){return new RegExp(Ui(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+=kb(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(hu(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;[KC,qC,rN,YC].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[GC,VC,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=Tb(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=Ui(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 oN(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=Un(t.classNameAliases||{}),o(t)}function Nb(t){return t?t.endsWithParent||Nb(t.starts):!1}function oN(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Un(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Nb(t)?Un(t,{starts:t.starts?Un(t.starts):null}):Object.isFrozen(t)?Un(t):t}var sN="11.11.1",fu=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},lu=yb,mb=Un,gb=Symbol("nomatch"),aN=7,Ab=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:du};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 P=B(S[1]);return P||(hb(o.replace("{}",S[1])),hb("Falling back to no-highlight mode for this block.",x)),P?S[1]:"no-highlight"}return E.split(/\s+/).find(P=>l(P)||B(P))}function u(x,E,S){let P="",$="";typeof E=="object"?(P=x,S=E.ignoreIllegals,$=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`),$=x,P=E),S===void 0&&(S=!0);let U={code:P,language:$};ce("before:highlight",U);let oe=U.result?U.result:d(U.language,U.code,S);return oe.code=U.code,ce("after:highlight",oe),oe}function d(x,E,S,P){let $=Object.create(null);function U(I,k){return I.keywords[k]}function oe(){if(!W.keywords){xe.addText(Q);return}let I=0;W.keywordPatternRe.lastIndex=0;let k=W.keywordPatternRe.exec(Q),N="";for(;k;){N+=Q.substring(I,k.index);let z=ve.case_insensitive?k[0].toLowerCase():k[0],Z=U(W,z);if(Z){let[be,Et]=Z;if(xe.addText(N),N="",$[z]=($[z]||0)+1,$[z]<=aN&&(ue+=Et),be.startsWith("_"))N+=k[0];else{let Tn=ve.classNameAliases[be]||be;J(k[0],Tn)}}else N+=k[0];I=W.keywordPatternRe.lastIndex,k=W.keywordPatternRe.exec(Q)}N+=Q.substring(I),xe.addText(N)}function se(){if(Q==="")return;let I=null;if(typeof W.subLanguage=="string"){if(!e[W.subLanguage]){xe.addText(Q);return}I=d(W.subLanguage,Q,!0,Y[W.subLanguage]),Y[W.subLanguage]=I._top}else I=p(Q,W.subLanguage.length?W.subLanguage:null);W.relevance>0&&(ue+=I.relevance),xe.__addSublanguage(I._emitter,I.language)}function Ne(){W.subLanguage!=null?se():oe(),Q=""}function J(I,k){I!==""&&(xe.startScope(k),xe.addText(I),xe.endScope())}function Ae(I,k){let N=1,z=k.length-1;for(;N<=z;){if(!I._emit[N]){N++;continue}let Z=ve.classNameAliases[I[N]]||I[N],be=k[N];Z?J(be,Z):(Q=be,oe(),Q=""),N++}}function Nt(I,k){return I.scope&&typeof I.scope=="string"&&xe.openNode(ve.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(J(Q,ve.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),Q=""):I.beginScope._multi&&(Ae(I.beginScope,k),Q="")),W=Object.create(I,{parent:{value:W}}),W}function We(I,k,N){let z=_C(I.endRe,N);if(z){if(I["on:end"]){let Z=new Xs(I);I["on:end"](k,Z),Z.isMatchIgnored&&(z=!1)}if(z){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return We(I.parent,k,N)}function tn(I){return W.matcher.regexIndex===0?(Q+=I[0],1):(_t=!0,0)}function nn(I){let k=I[0],N=I.rule,z=new Xs(N),Z=[N.__beforeBegin,N["on:begin"]];for(let be of Z)if(be&&(be(I,z),z.isMatchIgnored))return tn(k);return N.skip?Q+=k:(N.excludeBegin&&(Q+=k),Ne(),!N.returnBegin&&!N.excludeBegin&&(Q=k)),Nt(N,I),N.returnBegin?0:k.length}function xn(I){let k=I[0],N=E.substring(I.index),z=We(W,I,N);if(!z)return gb;let Z=W;W.endScope&&W.endScope._wrap?(Ne(),J(k,W.endScope._wrap)):W.endScope&&W.endScope._multi?(Ne(),Ae(W.endScope,I)):Z.skip?Q+=k:(Z.returnEnd||Z.excludeEnd||(Q+=k),Ne(),Z.excludeEnd&&(Q=k));do W.scope&&xe.closeNode(),!W.skip&&!W.subLanguage&&(ue+=W.relevance),W=W.parent;while(W!==z.parent);return z.starts&&Nt(z.starts,I),Z.returnEnd?0:k.length}function _n(){let I=[];for(let k=W;k!==ve;k=k.parent)k.scope&&I.unshift(k.scope);I.forEach(k=>xe.openNode(k))}let ot={};function gt(I,k){let N=k&&k[0];if(Q+=I,N==null)return Ne(),0;if(ot.type==="begin"&&k.type==="end"&&ot.index===k.index&&N===""){if(Q+=E.slice(k.index,k.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=k,k.type==="begin")return nn(k);if(k.type==="illegal"&&!S){let z=new Error('Illegal lexeme "'+N+'" for mode "'+(W.scope||"")+'"');throw z.mode=W,z}else if(k.type==="end"){let z=xn(k);if(z!==gb)return z}if(k.type==="illegal"&&N==="")return Q+=` -`,1;if(st>1e5&&st>k.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Q+=N,N.length}let ve=B(x);if(!ve)throw pr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let te=iN(ve),bt="",W=P||te,Y={},xe=new a.__emitter(a);_n();let Q="",ue=0,yt=0,st=0,_t=!1;try{if(ve.__emitTokens)ve.__emitTokens(E,xe);else{for(W.matcher.considerAll();;){st++,_t?_t=!1:W.matcher.considerAll(),W.matcher.lastIndex=yt;let I=W.matcher.exec(E);if(!I)break;let k=E.substring(yt,I.index),N=gt(k,I);yt=I.index+N}gt(E.substring(yt))}return xe.finalize(),bt=xe.toHTML(),{language:x,value:bt,relevance:ue,illegal:!1,_emitter:xe,_top:W}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:x,value:lu(E),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:yt,context:E.slice(yt-100,yt+100),mode:I.mode,resultSoFar:bt},_emitter:xe};if(i)return{language:x,value:lu(E),illegal:!1,relevance:0,errorRaised:I,_emitter:xe,_top:W};throw I}}function f(x){let E={value:lu(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),P=E.filter(B).filter(Ee).map(Ne=>d(Ne,x,!1));P.unshift(S);let $=P.sort((Ne,J)=>{if(Ne.relevance!==J.relevance)return J.relevance-Ne.relevance;if(Ne.language&&J.language){if(B(Ne.language).supersetOf===J.language)return 1;if(B(J.language).supersetOf===Ne.language)return-1}return 0}),[U,oe]=$,se=U;return se.secondBest=oe,se}function h(x,E,S){let P=E&&n[E]||S;x.classList.add("hljs"),x.classList.add(`language-${P}`)}function m(x){let E=null,S=c(x);if(l(S))return;if(ce("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 fu("One of your code blocks includes unescaped HTML.",x.innerHTML);E=x;let P=E.textContent,$=S?u(P,{language:S,ignoreIllegals:!0}):p(P);x.innerHTML=$.value,x.dataset.highlighted="yes",h(x,S,$.language),x.result={language:$.language,re:$.relevance,relevance:$.relevance},$.secondBest&&(x.secondBest={language:$.secondBest.language,relevance:$.secondBest.relevance}),ce("after:highlightElement",{el:x,result:$,text:P})}function g(x){a=mb(a,x)}let b=()=>{T(),Yr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){T(),Yr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function T(){function x(){T()}if(document.readyState==="loading"){_||window.addEventListener("DOMContentLoaded",x,!1),_=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function A(x,E){let S=null;try{S=E(t)}catch(P){if(pr("Language definition for '{}' could not be registered.".replace("{}",x)),i)pr(P);else throw P;S=s}S.name||(S.name=x),e[x]=S,S.rawDefinition=E.bind(null,t),S.aliases&&K(S.aliases,{languageName:x})}function R(x){delete e[x];for(let E of Object.keys(n))n[E]===x&&delete n[E]}function D(){return Object.keys(e)}function B(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function K(x,{languageName:E}){typeof x=="string"&&(x=[x]),x.forEach(S=>{n[S.toLowerCase()]=E})}function Ee(x){let E=B(x);return E&&!E.disableAutodetect}function X(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 he(x){X(x),r.push(x)}function we(x){let E=r.indexOf(x);E!==-1&&r.splice(E,1)}function ce(x,E){let S=x;r.forEach(function(P){P[S]&&P[S](E)})}function de(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:T,highlightElement:m,highlightBlock:de,configure:g,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:A,unregisterLanguage:R,listLanguages:D,getLanguage:B,registerAliases:K,autoDetection:Ee,inherit:mb,addPlugin:he,removePlugin:we}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=sN,t.regex={concat:hr,lookahead:Eb,either:pu,optional:SC,anyNumberOfTimes:wC};for(let x in Zs)typeof Zs[x]=="object"&&bb(Zs[x]);return Object.assign(t,Zs),t},Jr=Ab({});Jr.newInstance=()=>Ab({});vb.exports=Jr;Jr.HighlightJS=Jr;Jr.default=Jr});function Je(t){this.content=t}Je.prototype={constructor:Je,find:function(t){for(var e=0;e>1}};Je.from=function(t){if(t instanceof Je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Je(e)};var va=Je;function Nd(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=Nd(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ad(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?ro(n+1,o):ro(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}};fe.none=[];var Gn=class extends Error{},L=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=Md(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(vd(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(C.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)}};L.empty=new L(C.empty,0,0);function vd(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(vd(o.content,e-i-1,n-i-1)))}function Md(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=Md(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}function ME(t,e,n){if(n.openStart>t.depth)throw new Gn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Gn("Inconsistent open depths");return Od(t,e,n,0)}function Od(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&&(Wn(t.nodeAfter,r),o++));for(let a=o;ai&&Ra(t,e,i+1),s=r.depth>i&&Ra(n,r,i+1),a=[];return ti(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Rd(o,s),Wn(Kn(o,Id(t,e,n,r,i+1)),a)):(o&&Wn(Kn(o,so(t,e,i+1)),a),ti(e,n,i,a),s&&Wn(Kn(s,so(n,r,i+1)),a)),ti(r,null,i,a),new C(a)}function so(t,e,n){let r=[];if(ti(null,t,n,r),t.depth>n){let i=Ra(t,e,n+1);Wn(Kn(i,so(t,e,n+1)),r)}return ti(e,null,n,r),new C(r)}function OE(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(C.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var ao=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 Vn(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=yd.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()+")"),Dd(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=C.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=C.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};At.prototype.text=void 0;var Da=class t extends At{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):Dd(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 Dd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var qn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new La(e,n);if(r.next==null)return t.empty;let i=Ld(r);r.next&&r.err("Unexpected trailing text");let o=UE(FE(i));return $E(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(` -`)}};qn.empty=new qn(!0);var La=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 Ld(t){let e=[];do e.push(DE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function DE(t){let e=[];do e.push(LE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function LE(t){let e=zE(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=PE(t,e);else break;return e}function Ed(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function PE(t,e){let n=Ed(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ed(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function BE(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 zE(t){if(t.eat("(")){let e=Ld(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=BE(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 FE(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 qn(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:zd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new At(this,this.computeAttrs(e),C.from(n),fe.setFrom(r))}createChecked(e=null,n,r){return n=C.from(n),this.checkContent(n),new At(this,this.computeAttrs(e),n,fe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=C.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(C.empty,!0);return o?new At(this,e,n.append(o),fe.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 HE(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 Pa=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?HE(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=Ud(e,i.attrs),this.excluded=null;let o=Bd(this.attrs);this.instance=o?new fe(this,o):null}create(e=null){return!e&&this.instance?this.instance:new fe(this,zd(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=va.from(e.nodes),n.marks=va.from(e.marks||{}),this.nodes=lo.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]=qn.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?wd(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==""?[]:wd(this,s.split(" "))}this.nodeFromJSON=i=>At.fromJSON(this,i),this.markFromJSON=i=>fe.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 lo){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 Da(r,r.defaultAttrs,e,fe.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 wd(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 WE(t){return t.tag!=null}function KE(t){return t.style!=null}var an=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(WE(i))this.tags.push(i);else if(KE(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 co(this,n,!1);return r.addAll(e,fe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new co(this,n,!0);return r.addAll(e,fe.none,n.from,n.to),L.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=xd(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=xd(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)))}},$d={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},GE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hd={ol:!0,ul:!0},oi=1,Ba=2,ni=4;function Sd(t,e,n){return e!=null?(e?oi:0)|(e==="full"?Ba:0):t&&t.whitespace=="pre"?oi|Ba:n&~ni}var Cr=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=fe.none,this.match=o||(s&ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(C.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=C.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(C.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&&!$d.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},co=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=Sd(null,n.preserveWhitespace,0)|(r?ni:0);i?o=new Cr(i.type,i.attrs,fe.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Cr(null,null,fe.none,!0,null,s):o=new Cr(e.schema.topNodeType,null,fe.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&Ba?"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):_d(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Cr(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 VE(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function qE(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function xd(t){let e={};for(let n in t)e[n]=t[n];return e}function _d(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&&io(Oa(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return io(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=Td(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Td(e.marks)}};function Td(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Oa(t){return t.document||window.document}var Cd=new WeakMap;function jE(t){let e=Cd.get(t);return e===void 0&&Cd.set(t,e=YE(t)),e}function YE(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}=io(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 Gd=65535,Vd=Math.pow(2,16);function JE(t,e){return t+e*Vd}function Wd(t){return t&Gd}function ZE(t){return(t-(t&Gd))/Vd}var qd=1,jd=2,uo=4,Yd=8,li=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Yd)>0}get deletedBefore(){return(this.delInfo&(qd|uo))>0}get deletedAfter(){return(this.delInfo&(jd|uo))>0}get deletedAcross(){return(this.delInfo&uo)>0}},cn=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=Wd(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:JE(a/3,e-l),m=e==l?jd:e==d?qd:uo;return(n<0?e!=l:e!=d)&&(m|=Yd),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=Wd(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 Ge.fromReplace(e,this.from,this.to,o)}invert(){return new jn(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))}};Fe.jsonID("addMark",ui);var jn=class t extends Fe{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 L(Wa(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ge.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))}};Fe.jsonID("removeMark",jn);var di=class t extends Fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ge.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ge.fromReplace(e,this.pos,this.pos+1,new L(C.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,L.fromJSON(e,n.slice),n.insert,!!n.structure)}};Fe.jsonID("replaceAround",Le);function $a(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 XE(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 QE(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 jn(s.from,s.to,s.style)))}function Ka(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 ek(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function un(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=C.from(r.node(h).copy(u)),d++):l--;let f=C.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=C.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Le(i,o,i,o,new L(r,0,0),n.length,!0))}function ok(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)&&sk(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&&Zd(t,s,a,o),Ka(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 Le(d,f,d+1,f-1,new L(C.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Jd(t,s,a,o),!1}})}function Jd(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 Zd(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 sk(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function ak(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 Le(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new L(C.from(s),0,0),1,!0))}function vt(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 lk(t,e,n=1,r){let i=t.doc.resolve(e),o=C.empty,s=C.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=C.from(i.node(a).copy(o));let u=r&&r[c];s=C.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Ze(e,e,new L(o.append(s),n,n),!0))}function Ft(t,e){let n=t.resolve(e),r=n.index();return Xd(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ck(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&&Xd(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 uk(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);Zd(t,u.node(),u.before(),a)}s.inlineContent&&Ka(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 Ze(c,l.map(e+n,-1),L.empty,!0)),r===!0){let u=t.doc.resolve(c);Jd(t,u.node(),u.before(),t.steps.length)}return t}function dk(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=L.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Qd(i,o,r)?new Ze(e,n,r):new Ha(i,o,r).fit()}function Qd(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var Ha=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=C.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=C.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 L(o,s,a);return e>-1?new Le(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ze(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=Fa(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(C.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=Fa(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new L(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=Fa(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new L(si(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new L(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(ef(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,C.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=Ua(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,C.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(C.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 Fa(t,e){for(let n=0;n1&&(r=r.replaceChild(0,ef(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(C.empty,!0)))),t.copy(r)}function Ua(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&&!fk(n,o.content,s)?a:null}function fk(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=pk(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 tf(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(C.empty,!0))}return t}function mk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=dk(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new L(C.from(r),0,0))}function gk(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=nf(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 nf(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 fo=class t extends Fe{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 Ge.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 Ge.fromReplace(e,this.pos,this.pos+1,new L(C.from(i),0,n.isLeaf?0:1))}getMap(){return cn.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)}};Fe.jsonID("attr",fo);var po=class t extends Fe{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 Ge.ok(r)}getMap(){return cn.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)}};Fe.jsonID("docAttr",po);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 Cn=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=L.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 L(C.from(r),0,0))}delete(e,n){return this.replace(e,n,L.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return hk(this,e,n,r),this}replaceRangeWith(e,n,r){return mk(this,e,n,r),this}deleteRange(e,n){return gk(this,e,n),this}lift(e,n){return tk(this,e,n),this}join(e,n=1){return uk(this,e,n),this}wrap(e,n){return ik(this,e,n),this}setBlockType(e,n=e,r,i=null){return ok(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return ak(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fo(e,n,r)),this}setDocAttribute(e,n){return this.step(new po(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 fe)n.isInSet(r.marks)&&this.step(new Nr(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Nr(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 lk(this,e,n,r),this}addMark(e,n,r){return XE(this,e,n,r),this}removeMark(e,n,r){return QE(this,e,n,r),this}clearIncompatible(e,n,r){return Ka(this,e,n,r),this}};var Ga=Object.create(null),q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Rr(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?Or(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Or(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 Or(e,e,0,0,1)||new at(e)}static atEnd(e){return Or(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=Ga[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 Ga)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}getBookmark(){return G.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;var Rr=class{constructor(e,n){this.$from=e,this.$to=n}},rf=!1;function of(t){!rf&&!t.parent.inlineContent&&(rf=!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){of(e),of(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=L.empty){if(super.replace(e,n),n==L.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 go(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=Or(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function sf(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 af=1,mo=2,lf=4,ja=class extends Cn{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|=mo,this}ensureMarks(e){return fe.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&mo)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mo,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)||fe.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|=lf,this}get scrolledIntoView(){return(this.updated&lf)>0}};function cf(t,e){return!e||!t?t:t.bind(e)}var Yn=class{constructor(e,n,r){this.name=e,this.init=cf(n.init,r),this.apply=cf(n.apply,r)}},yk=[new Yn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Yn("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Yn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Yn("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=yk.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 Yn(r.key,r.spec.state,r))})}},bo=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=At.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 uf(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=uf(i,e,{})),n[r]=i}return n}var me=class{constructor(e){this.spec=e,this.props={},e.props&&uf(e.props,this,this.props),this.key=e.key?e.key.key:df("plugin")}getState(e){return e[this.key]}},Va=Object.create(null);function df(t){return t in Va?t+"$"+ ++Va[t]:(Va[t]=0,t+"$")}var _e=class{constructor(e="key"){this.key=df(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Br=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},el=null,fn=function(t,e,n){let r=el||(el=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Ek=function(){el=null},nr=function(t,e,n,r){return n&&(ff(t,e,n,r,-1)||ff(t,e,n,r,1))},kk=/^(img|br|input|textarea|hr)$/i;function ff(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ot(t))){let s=t.parentNode;if(!s||s.nodeType!=1||wi(t)||kk.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(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?Ot(t):0}else return!1}}function Ot(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wk(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=Ot(t)}else if(t.parentNode&&!wi(t))e=Ve(t),t=t.parentNode;else return null}}function Sk(t,e){for(;;){if(t.nodeType==3&&e2),Mt=zr||(Kt?/Mac/.test(Kt.platform):!1),qf=Kt?/Win/.test(Kt.platform):!1,pn=/Android \d/.test(Rn),Si=!!pf&&"webkitFontSmoothing"in pf.documentElement.style,Ck=Si?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Nk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function dn(t,e){return typeof t=="number"?t:t[e]}function Ak(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 hf(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=Br(s);continue}let a=s,l=a==o.body,c=l?Nk(o):Ak(a),u=0,d=0;if(e.topc.bottom-dn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+dn(i,"top")-c.top:e.bottom-c.bottom+dn(i,"bottom")),e.leftc.right-dn(r,"right")&&(u=e.right-c.right+dn(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:Br(s)}}function vk(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:jf(t.dom)}}function jf(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Br(r));return e}function Mk({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Yf(n,r==0?0:r-e)}function Yf(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?Rk(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Jf(n,i)}function Rk(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 yl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ik(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 Lk(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 Zf(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=Lk(t,r,i,e))}a==null&&(a=Dk(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function mf(t){return t.top=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,hi(Nn(fn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ot(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Ya(l.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Ot(r))){let l=r.childNodes[i-1],c=l.nodeType==3?fn(l,Ot(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 Ya(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 Qf(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 zk(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Qf(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=Xf(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=fn(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 Fk=/[\u0590-\u08ac]/;function Uk(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?!Fk.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Qf(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 gf=null,bf=null,yf=!1;function $k(t,e,n){return gf==e&&bf==n?yf:(gf=e,bf=n,yf=n=="up"||n=="down"?zk(t,e,n):Uk(t,e,n))}var It=0,Ef=1,Zn=2,Gt=3,rr=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=It,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;nVe(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 ko){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 yo&&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?Ve(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=Ve(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?Zn:Ef,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Gt:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Zn:Gt}r=s}this.dirty=Zn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Zn:Ef;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==It&&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}},il=class extends rr{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}},Fr=class t extends rr{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=ln.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&Gt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=It){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=ll(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}=ln.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=np(u,r,n),c?l=new ol(e,n,r,i,u,d||null,f,c,o,s+1):n.isText?new Eo(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=()=>C.empty)}return e}matchesNode(e,n,r){return this.dirty==It&&e.eq(this.node)&&wo(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 al(this,s&&s.node,e);Gk(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?fe.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==Zn)&&(s&&this.protectLocalComposition(e,s),ep(this.contentDOM,this.children,e),zr&&Vk(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=qk(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 il(this,o,n,i);e.input.compositionNodes.push(s),this.children=ll(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Gt||!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=It}updateOuterDeco(e){if(wo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=tp(this.dom,this.nodeDOM,sl(this.outerDeco,this.node,n),sl(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 kf(t,e,n,r,i){np(r,e,t);let o=new On(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var Eo=class t extends On{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==Gt||this.dirty!=It&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=It||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=It,!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=Gt)}get domAtom(){return!1}isText(e){return this.node.text==e}},ko=class extends rr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==It&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},ol=class extends On{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==Gt)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 ep(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=Fr.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 Fr)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 Kk(t,e){return t.type.side-e.type.side}function Gk(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 Vk(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 qk(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 ll(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 El(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(Ao(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&&xk(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(()=>{(!rp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Yk(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ve(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wt&&Mn<=11&&(n.disabled=!0,n.disabled=!1)}function ip(t,e){if(e instanceof V){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Tf(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Tf(t)}function Tf(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function kl(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||G.between(e,n,r)}function Cf(t){return t.editable&&!t.hasFocus()?!1:op(t)}function op(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 Jk(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return nr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function cl(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 An(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Nf(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 An(t,new G(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=cl(t.state,e);return i&&i instanceof V?An(t,i):!1}else if(!(Mt&&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)?An(t,new V(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Si?An(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 An(t,new G(e>0?r.$to:r.$from));{let i=cl(t.state,e);return i?An(t,i):!1}}}function So(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 Dr(t,e){return e<0?Zk(t):Xk(t)}function Zk(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Rt&&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(sp(n))break;{let a=n.previousSibling;for(;a&&gi(a,-1);)i=n.parentNode,o=Ve(a),a=a.previousSibling;if(a)n=a,r=So(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?ul(t,n,r):i&&ul(t,i,o)}function Xk(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=So(n),o,s;for(;;)if(r{t.state==i&&hn(t)},50)}function Af(t,e){let n=t.state.doc.resolve(e);if(!(qe||qf)&&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 vf(t,e,n){let r=t.state.selection;if(r instanceof G&&!r.empty||n.indexOf("s")>-1||Mt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=cl(t.state,e);if(s&&s instanceof V)return An(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?An(t,a):!1}return!1}function Mf(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 Of(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function tw(t){if(!Qe||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;Of(t,r,"true"),setTimeout(()=>Of(t,r,"false"),20)}return!1}function nw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function rw(t,e){let n=e.keyCode,r=nw(e);if(n==8||Mt&&n==72&&r=="c")return Mf(t,-1)||Dr(t,-1);if(n==46&&!e.shiftKey||Mt&&n==68&&r=="c")return Mf(t,1)||Dr(t,1);if(n==13||n==27)return!0;if(n==37||Mt&&n==66&&r=="c"){let i=n==37?Af(t,t.state.selection.from)=="ltr"?-1:1:-1;return Nf(t,i,r)||Dr(t,i)}else if(n==39||Mt&&n==70&&r=="c"){let i=n==39?Af(t,t.state.selection.from)=="ltr"?1:-1:1;return Nf(t,i,r)||Dr(t,i)}else{if(n==38||Mt&&n==80&&r=="c")return vf(t,-1,r)||Dr(t,-1);if(n==40||Mt&&n==78&&r=="c")return tw(t)||vf(t,1,r)||Dr(t,1);if(r==(Mt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function wl(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")||ln.fromSchema(t.state.schema),a=fp(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=dp[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 ap(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 L(C.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=ln.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=aw(n),Si&&lw(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")||an.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!iw.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=cw(Rf(a,+u[1],+u[2]),u[4]);else if(a=L.maxOpen(ow(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 iw=/^(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 ow(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&&cp(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=up(s[s.length-1],o.length));let u=lp(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return C.from(s)}return t}function lp(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,C.from(t));return t}function cp(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(C.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Rf(t,e,n){return en})),Za.createHTML(t)):t}function aw(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=fp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&dp[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=sw(t),i)for(let o=0;o=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=C.from(l.create(r[a+1],i)),o++,s++}return new L(i,o,s)}var lt={},ct={},uw={touchstart:!0,touchmove:!0},fl=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 dw(t){for(let e in lt){let n=lt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{pw(t,r)&&!Sl(t,r)&&(t.editable||!(r.type in ct))&&n(t,r)},uw[e]?{passive:!0}:void 0)}Qe&&t.dom.addEventListener("input",()=>null),pl(t)}function vn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function fw(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 pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Sl(t,r))})}function Sl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function pw(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 hw(t,e){!Sl(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,!hp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(pn&&qe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zr&&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,Jn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||rw(t,n)?n.preventDefault():vn(t,"key")};ct.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ct.keypress=(t,e)=>{let n=e;if(hp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mt&&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 vo(t){return{left:t.clientX,top:t.clientY}}function mw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function xl(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 Pr(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 gw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&V.isSelectable(r)?(Pr(t,new V(n),"pointer"),!0):!1}function bw(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?(Pr(t,V.create(t.state.doc,i),"pointer"),!0):!1}function yw(t,e,n,r,i){return xl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?bw(t,n):gw(t,n))}function Ew(t,e,n,r){return xl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function kw(t,e,n,r){return xl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||ww(t,n,r)}function ww(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Pr(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)Pr(t,G.create(r,a+1,a+1+s.content.size),"pointer");else if(V.isSelectable(s))Pr(t,V.create(r,a),"pointer");else continue;return!0}}function _l(t){return xo(t)}var pp=Mt?"metaKey":"ctrlKey";lt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=_l(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&mw(n,t.input.lastClick)&&!n[pp]&&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(vo(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new hl(t,s,n,!!r)):(o=="doubleClick"?Ew:kw)(t,s.pos,s.inside,n)?n.preventDefault():vn(t,"pointer"))};var hl=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[pp],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&&Rt&&!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)),vn(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(()=>hn(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(vo(e))),this.updateAllowDefault(e),this.allowDefault||!n?vn(this.view,"pointer"):yw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qe&&this.mightDrag&&!this.mightDrag.node.isAtom||qe&&!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)?(Pr(this.view,q.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):vn(this.view,"pointer")}move(e){this.updateAllowDefault(e),vn(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(),_l(t),vn(t,"pointer")};lt.touchmove=t=>{t.input.lastTouch=Date.now(),vn(t,"pointer")};lt.contextmenu=t=>_l(t);function hp(t,e){return t.composing?!0:Qe&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var Sw=pn?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)||qe&&qf&&xw(t)))t.markCursor=t.state.storedMarks||n.marks(),xo(t,!0),t.markCursor=null;else if(xo(t,!e.selection.empty),Rt&&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}mp(t,Sw)};function xw(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++,mp(t,20))};function mp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>xo(t),e))}function gp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Tw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _w(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=wk(e.focusNode,e.focusOffset),r=Sk(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 Tw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function xo(t,e=!1){if(!(pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),gp(t),e||t.docView&&t.docView.dirty){let n=El(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 Cw(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&&Mn<15||zr&&Ck<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}=wl(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Cw(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Nw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Aw(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=ap(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||L.empty)))return!0;if(!o)return!1;let s=Nw(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 bp(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&&!pn)return;let r=bi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&yi(t,bp(r),r.getData("text/html"),i,n)?n.preventDefault():Aw(t,n)};var _o=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},vw=Mt?"altKey":"ctrlKey";function yp(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[vw]}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(vo(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}=wl(t,a);(!n.dataTransfer.files.length||!qe||Vf>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 _o(u,yp(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{Mw(t,e,t.dragging)}finally{t.dragging=null}};function Mw(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(vo(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=ap(t,bp(e.dataTransfer),bi?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&yp(t,e));if(t.someProp("handleDrop",p=>p(t,e,o||L.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?ho(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(kl(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())&&hn(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(qe&&pn&&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,Jn(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 To=class t{constructor(e,n){this.toDOM=e,this.spec=n||er,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 et(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)}},Qn=class t{constructor(e,n){this.attrs=e,this.spec=n||er}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 et(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==Xe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||er)}mapInner(e,n,r,i,o){let s;for(let a=0;a{let c=l+r,u;if(u=kp(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 Qn){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;ci.map(e,n,er));return t.from(r)}forChild(e,n){if(n.isLeaf)return Pe.empty;let r=[];for(let i=0;in instanceof Pe)?e:e.reduce((n,r)=>n.concat(r instanceof Pe?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let g=m-h-(p-f);for(let b=0;bw+u-d)continue;let _=a[b]+u-d;p>=_?a[b+1]=f<=_?-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!=Xe?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Rw(a,t,e,n,i,o,s),u=No(c,r,0,s);e=u.local;for(let d=0;dn&&s.to{let c=kp(t,a,l+n);if(c){o=!0;let u=No(c,a,n+l+1,r);u!=Xe&&i.push(l,l+a.nodeSize,u)}});let s=Ep(o?wp(t):t,-n).sort(tr);for(let a=0;a0;)e++;t.splice(e,0,n)}function Xa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Xe&&e.push(r)}),t.cursorWrapper&&e.push(Pe.create(t.state.doc,[t.cursorWrapper.deco])),Co.from(e)}var Iw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dw=wt&&Mn<=11,gl=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}},bl=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gl,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():Qe&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Dw&&(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,Iw)),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(Cf(this.view)){if(this.suppressingSelectionUpdates)return hn(this.view);if(wt&&Mn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nr(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=Br(o))n.add(o);for(let o=e.anchorNode;o;o=Br(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)&&Cf(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(Rt&&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||Bw(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),Lw(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,zw(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hn(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],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){o=g;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||an.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:Uw,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 Uw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qe&&/^(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||Qe&&/^(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 $w=/^(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 Hw(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,B=El(t,D);if(B&&!t.state.selection.eq(B)){if(qe&&pn&&t.input.lastKeyCode===13&&Date.now()-100Ee(t,Jn(13,"Enter"))))return;let K=t.state.tr.setSelection(B);D=="pointer"?K.setMeta("pointer",!0):D=="key"&&K.scrollIntoView(),o&&K.setMeta("composition",o),t.dispatch(K)}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=Fw(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||pn)&&i.some(D=>D.nodeType==1&&!$w.test(D.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",D=>D(t,Jn(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 D=zf(t,t.state.doc,c.sel);if(D&&!D.eq(t.state.selection)){let B=t.state.tr.setSelection(D);o&&B.setMeta("composition",o),t.dispatch(B)}}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&&Mn<=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),w=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA;if((zr&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!w&&m.posD(t,Jn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&Kw(u,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",D=>D(t,Jn(8,"Backspace")))){pn&&qe&&t.domObserver.suppressSelectionUpdates();return}qe&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),pn&&!w&&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(D){return D(t,Jn(13,"Enter"))})},20));let _=h.start,T=h.endA,A=D=>{let B=D||t.state.tr.replace(_,T,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let K=zf(t,B.doc,c.sel);K&&!(qe&&t.composing&&K.empty&&(h.start!=h.endB||t.input.lastChromeDeletehn(t),20));let D=A(t.state.tr.delete(_,T)),B=u.resolve(h.start).marksAcross(u.resolve(h.endA));B&&D.ensureMarks(B),t.dispatch(D)}else if(h.endA==h.endB&&(R=Ww(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let D=A(t.state.tr);R.type=="add"?D.addMark(_,T,R.mark):D.removeMark(_,T,R.mark),t.dispatch(D)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let D=m.parent.textBetween(m.parentOffset,g.parentOffset),B=()=>A(t.state.tr.insertText(D,_,T));t.someProp("handleTextInput",K=>K(t,_,T,D,B))||t.dispatch(B())}else t.dispatch(A());else t.dispatch(A())}function zf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:kl(t,e.resolve(n.anchor),e.resolve(n.head))}function Ww(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||Qa(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 Gw(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 fl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Kf),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=Hf(this),$f(this),this.nodeViews=Wf(this),this.docView=kf(this.state.doc,Uf(this),Xa(this),this.dom,this),this.domObserver=new bl(this,(r,i,o,s)=>Hw(this,r,i,o,s)),this.domObserver.start(),dw(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&&pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Kf),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&&(gp(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=Wf(this);qw(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&pl(this),this.editable=Hf(this),$f(this);let l=Xa(this),c=Uf(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&&vk(this);if(s){this.domObserver.stop();let p=d&&(wt||qe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Vw(i.selection,e.selection);if(d){let h=qe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_w(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=kf(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())&&Jk(this))?hn(this,p):(ip(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&&Mk(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&&hf(this,n.getBoundingClientRect(),e)}else hf(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 _o(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 Pk(this,e)}coordsAtPos(e,n=1){return Xf(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 $k(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 wl(this,e)}destroy(){this.docView&&(fw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ek())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return hw(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qe&&this.root.nodeType===11&&_k(this.dom.ownerDocument)==this.dom&&Pw(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 Uf(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"),[et.node(0,t.state.doc.content.size,e)]}function $f(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:et.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Hf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Vw(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 Wf(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 qw(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 Kf(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 mn={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:"'"},Oo={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),Yw=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Be=0;Be<10;Be++)mn[48+Be]=mn[96+Be]=String(Be);var Be;for(Be=1;Be<=24;Be++)mn[Be+111]="F"+Be;var Be;for(Be=65;Be<=90;Be++)mn[Be]=String.fromCharCode(Be+32),Oo[Be]=String.fromCharCode(Be);var Be;for(Mo in mn)Oo.hasOwnProperty(Mo)||(Oo[Mo]=mn[Mo]);var Mo;function Sp(t){var e=jw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Yw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Oo:mn)[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 Jw=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Zw=typeof navigator<"u"&&/Win/.test(navigator.platform);function Xw(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 Tp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Al=(t,e,n)=>{let r=Tp(t,n);if(!r)return!1;let i=Ml(r);if(!i){let s=r.blockRange(),a=s&&un(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(Dp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ur(o,"end")||V.isSelectable(o)))for(let s=r.depth;;s--){let a=fi(t.doc,r.before(s),r.after(s),L.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},Cp=(t,e,n)=>{let r=Tp(t,n);if(!r)return!1;let i=Ml(r);return i?Ap(t,i,e):!1},Np=(t,e,n)=>{let r=vp(t,n);if(!r)return!1;let i=Il(r);return i?Ap(t,i,e):!1};function Ap(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,L.empty);if(!c||c.from!=o||c instanceof Ze&&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 Ur(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 vl=(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=Ml(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 Ml(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 vp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=vp(t,n);if(!r)return!1;let i=Il(r);if(!i)return!1;let o=i.nodeAfter;if(Dp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ur(o,"start")||V.isSelectable(o))){let s=fi(t.doc,r.before(),r.after(),L.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||!Ft(t.doc,n.from))return!1;i=n.from}else if(i=Mr(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},Op=(t,e)=>{let n=t.selection,r;if(n instanceof V){if(n.node.isTextblock||!Ft(t.doc,n.to))return!1;r=n.to}else if(r=Mr(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Rp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&un(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Dl=(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 Ll(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=Ll(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},Bl=(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=Ll(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(vt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&un(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function e0(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof V&&e.selection.node.isBlock)return!r.parentOffset||!vt(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=Ll(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=vt(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=vt(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 t0=e0();var Ip=(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)},n0=(t,e)=>(e&&e(t.tr.setSelection(new at(t.doc))),!0);function r0(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||Ft(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Dp(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&r0(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=C.empty;for(let b=s.length-1;b>=0;b--)h=C.from(s[b].create(null,h));h=C.from(i.copy(h));let m=t.tr.step(new Le(e.pos-1,p,e.pos,p,new L(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ft(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&&un(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ur(o,"start",!0)&&Ur(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=C.empty;for(let _=h.length-1;_>=0;_--)b=C.from(h[_].copy(b));let w=t.tr.step(new Le(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new L(b,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Lp(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 Fl=Lp(-1),Ul=Lp(1);function Pp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&vr(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function $l(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 Vn(l,l,e.depth),e.endIndex=0;u--)o=C.from(n[u].type.create(n[u].attrs,o));t.step(new Le(e.start-(r?2:0),e.end,e.start,e.end,new L(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?a0(e,n,t,o):l0(e,n,o):!0:!1}}function a0(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?C.empty:C.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new Le(d-(a?1:0),f+(l?1:0),d+1,f-1,new L((a?C.empty:C.from(i.copy(C.empty))).append(l?C.empty:C.from(i.copy(C.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Fp(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=C.from(c?t.create():null),d=new L(C.from(t.create(null,C.from(a.type.create(null,u)))),c?3:1,0),f=o.start,p=o.end;n(e.tr.step(new Le(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function $o(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 $r=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:$o({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}},Vl=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 F(t,e,n){return t.config[e]===void 0&&t.parent?F(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?F(t.parent,e,n):null}):t.config[e]}function Ho(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 jp(t){let e=[],{nodeExtensions:n,markExtensions:r}=Ho(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=F(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=F(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 Ue(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 ee(...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 ql(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)=>ee(n,r),{})}function Yp(t){return typeof t=="function"}function re(t,e=void 0,...n){return Yp(t)?e?t.bind(e)(...n):t(...n):t}function c0(t={}){return Object.keys(t).length===0&&t.constructor===Object}function u0(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Up(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):u0(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function $p(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&c0(n)?!1:n!=null))}function d0(t,e){var n;let r=jp(t),{nodeExtensions:i,markExtensions:o}=Ho(t),s=(n=i.find(c=>F(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,w)=>{let _=F(w,"extendNodeSchema",d);return{...b,..._?_(c):{}}},{}),p=$p({...f,content:re(F(c,"content",d)),marks:re(F(c,"marks",d)),group:re(F(c,"group",d)),inline:re(F(c,"inline",d)),atom:re(F(c,"atom",d)),selectable:re(F(c,"selectable",d)),draggable:re(F(c,"draggable",d)),code:re(F(c,"code",d)),whitespace:re(F(c,"whitespace",d)),linebreakReplacement:re(F(c,"linebreakReplacement",d)),defining:re(F(c,"defining",d)),isolating:re(F(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var w;return[b.name,{default:(w=b?.attribute)===null||w===void 0?void 0:w.default}]}))}),h=re(F(c,"parseHTML",d));h&&(p.parseDOM=h.map(b=>Up(b,u)));let m=F(c,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:ql(b,u)}));let g=F(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 w=F(b,"extendMarkSchema",d);return{...g,...w?w(c):{}}},{}),p=$p({...f,inclusive:re(F(c,"inclusive",d)),excludes:re(F(c,"excludes",d)),group:re(F(c,"group",d)),spanning:re(F(c,"spanning",d)),code:re(F(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=re(F(c,"parseHTML",d));h&&(p.parseDOM=h.map(g=>Up(g,u)));let m=F(c,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:ql(g,u)})),[c.name,p]}));return new ii({topNode:s,nodes:a,marks:l})}function Wl(t,e){return e.nodes[t]||e.marks[t]||null}function Hp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ql(t,e){let n=ln.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}var f0=(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 ec(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Hr=class{constructor(e){this.find=e.find,this.handler=e.handler}},p0=(t,e)=>{if(ec(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 Io(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=f0(c)+o;return s.forEach(f=>{if(u)return;let p=p0(d,f.find);if(!p)return;let h=l.state.tr,m=$o({state:l.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:w,can:_}=new $r({editor:n,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:w,can:_})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:o}),l.dispatch(h),u=!0)}),u}function h0(t){let{editor:e,rules:n}=t,r=new me({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=Ql(C.from(u),s.schema);let{from:d}=l,f=d+u.length;Io({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 Io({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&Io({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?Io({editor:e,from:s.pos,to:s.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function m0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Do(t){return m0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Wo(t,e){let n={...t};return Do(t)&&Do(e)&&Object.keys(e).forEach(r=>{Do(e[r])&&Do(t[r])?n[r]=Wo(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=re(F(this,"addOptions",{name:this.name}))),this.storage=re(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Wo(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=re(F(n,"addOptions",{name:n.name})),n.storage=re(F(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 g0(t){return typeof t=="number"}var jl=class{constructor(e){this.find=e.find,this.handler=e.handler}},b0=(t,e,n)=>{if(ec(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 y0(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new $r({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");b0(b,o.find,s).forEach(_=>{if(_.index===void 0)return;let T=m+_.index+1,A=T+_[0].length,R={from:n.tr.mapping.map(T),to:n.tr.mapping.map(A)},D=o.handler({state:n,range:R,match:_,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(D)})}),d.every(p=>p!==null)}var Lo=null,E0=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 k0(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=$o({state:u,transaction:m});if(!(!y0({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 me({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&&(Lo=e)},p=()=>{Lo&&(Lo=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=Lo;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"),w=!!b;if(!m&&!g&&!w)return;if(w){let{text:A}=b;typeof A=="string"?A=A:A=Ql(C.from(A),p.schema);let{from:R}=b,D=R+A.length,B=E0(A);return l({rule:u,state:p,from:R,to:{b:D},pasteEvt:B})}let _=f.doc.content.findDiffStart(p.doc.content),T=f.doc.content.findDiffEnd(p.doc.content);if(!(!g0(_)||!T||_===T.b))return l({rule:u,state:p,from:_,to:T,pasteEvt:s})}}))}function w0(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}var Yl=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=d0(this.extensions,n),this.setupExtensions()}static resolve(e){let n=t.sort(t.flatten(e)),r=w0(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=F(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{let o=F(r,"priority")||100,s=F(i,"priority")||100;return o>s?-1:o{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Wl(n.name,this.schema)},i=F(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:Wl(s.name,this.schema)},l=[],c=F(s,"addKeyboardShortcuts",a),u={};if(s.type==="mark"&&F(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=xp(u);l.push(d);let f=F(s,"addInputRules",a);Hp(s,e.options.enableInputRules)&&f&&r.push(...f());let p=F(s,"addPasteRules",a);Hp(s,e.options.enablePasteRules)&&p&&i.push(...p());let h=F(s,"addProseMirrorPlugins",a);if(h){let m=h();l.push(...m)}return l}).flat();return[h0({editor:e,rules:r}),...k0({editor:e,rules:i}),...o]}get attributes(){return jp(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=Ho(this.extensions);return Object.fromEntries(n.filter(r=>!!F(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:Ue(r.name,this.schema)},s=F(r,"addNodeView",o);if(!s)return[];let a=(l,c,u,d,f)=>{let p=ql(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:Wl(e.name,this.schema)};e.type==="mark"&&(!((n=re(F(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);let i=F(e,"onBeforeCreate",r),o=F(e,"onCreate",r),s=F(e,"onUpdate",r),a=F(e,"onSelectionUpdate",r),l=F(e,"onTransaction",r),c=F(e,"onFocus",r),u=F(e,"onBlur",r),d=F(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)})}},$e=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=re(F(this,"addOptions",{name:this.name}))),this.storage=re(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Wo(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=re(F(n,"addOptions",{name:n.name})),n.storage=re(F(n,"addStorage",{name:n.name,options:n.options})),n}};function Jp(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 Zp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var S0=$e.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new me({key:new _e("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=Zp(n);return Jp(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),x0=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),_0=(t=!1)=>({commands:e})=>e.setContent("",t),T0=()=>({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=un(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},C0=t=>e=>t(e),N0=()=>({state:t,dispatch:e})=>Bl(t,e),A0=(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},v0=()=>({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},M0=t=>({tr:e,state:n,dispatch:r})=>{let i=Ue(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},O0=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},R0=()=>({state:t,dispatch:e})=>Ro(t,e),I0=()=>({commands:t})=>t.keyboardShortcut("Enter"),D0=()=>({state:t,dispatch:e})=>Pl(t,e);function zo(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ec(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Xp(t,e,n={}){return t.find(r=>r.type===e&&zo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Wp(t,e,n={}){return!!Xp(t,e,n)}function tc(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),!Xp([...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&&Wp([...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=Dn(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){let d=tc(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},P0=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=()=>{(Fo()||Kp())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),B0()&&!Fo()&&!Kp()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!Qp(n.state.selection))return s(),!0;let a=eh(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},F0=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),U0=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),th=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&&th(r)}return t};function Po(t){let e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return th(n)}function _i(t,e,n){if(t instanceof At||t instanceof C)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 C.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?an.fromSchema(l).parseSlice(Po(t),n.parseOptions):an.fromSchema(l).parse(Po(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let o=an.fromSchema(e);return n.slice?o.parseSlice(Po(t),n.parseOptions).content:o.parse(Po(t),n.parseOptions)}return _i("",e,n)}function $0(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 H0=t=>!("type"in t),W0=(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((H0(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 C){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&&$0(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},K0=()=>({state:t,dispatch:e})=>Mp(t,e),G0=()=>({state:t,dispatch:e})=>Op(t,e),V0=()=>({state:t,dispatch:e})=>Al(t,e),q0=()=>({state:t,dispatch:e})=>Ol(t,e),j0=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Mr(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Y0=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Mr(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},J0=()=>({state:t,dispatch:e})=>Cp(t,e),Z0=()=>({state:t,dispatch:e})=>Np(t,e);function nh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function X0(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=X0(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?Ue(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=>zo(d.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var eS=(t,e={})=>({state:n,dispatch:r})=>{let i=Ue(t,n.schema);return Ti(n,i,e)?Rp(n,r):!1},tS=()=>({state:t,dispatch:e})=>zl(t,e),nS=t=>({state:e,dispatch:n})=>{let r=Ue(t,e.schema);return zp(r)(e,n)},rS=()=>({state:t,dispatch:e})=>Dl(t,e);function Ko(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Gp(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 iS=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Ko(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Dn(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,Gp(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Gp(d.attrs,e)))})})}),!0):!1},oS=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),sS=()=>({tr:t,dispatch:e})=>{if(e){let n=new at(t.doc);t.setSelection(n)}return!0},aS=()=>({state:t,dispatch:e})=>vl(t,e),lS=()=>({state:t,dispatch:e})=>Rl(t,e),cS=()=>({state:t,dispatch:e})=>Ip(t,e),uS=()=>({state:t,dispatch:e})=>Ul(t,e),dS=()=>({state:t,dispatch:e})=>Fl(t,e);function Jl(t,e,n={},r={}){return _i(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var fS=(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=Jl(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 rh(t,e){let n=Dn(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 ih(t,e){let n=new Cn(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function pS(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function oh(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function nc(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 rc(t){return e=>nc(e.$from,t)}function hS(t,e){let n={from:0,to:t.content.size};return Jp(t,n,e)}function mS(t,e){let n=Ue(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 ic(t,e){let n=Ko(typeof e=="string"?e:e.name,t.schema);return n==="node"?mS(t,e):n==="mark"?rh(t,e):{}}function gS(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 bS(t){let e=gS(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 sh(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}})})}),bS(r)}function Vo(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=tc(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 Bo(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 Zl(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?Dn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>zo(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),w=Math.min(h,g+m.nodeSize),_=w-b;s+=_,a.push(...m.marks.map(T=>({mark:T,from:b,to:w})))})}),s===0)return!1;let l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>zo(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 yS(t,e,n={}){if(!e)return Ti(t,null,n)||Zl(t,null,n);let r=Ko(e,t.schema);return r==="node"?Ti(t,e,n):r==="mark"?Zl(t,e,n):!1}function Vp(t,e){let{nodeExtensions:n}=Ho(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=re(F(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function oc(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&&(oc(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ah(t){return t instanceof V}function ES(t,e,n){var r;let{selection:i}=e,o=null;if(Qp(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 kS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=Dn(t,r.schema);if(i)if(s){let c=rh(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 ES(r,n,l)},wS=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),SS=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=Ue(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>$l(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>$l(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},xS=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=ir(t,0,r.content.size),o=V.create(r,i);e.setSelection(o)}return!0},_S=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=ir(i,s,a),c=ir(o,s,a),u=G.create(r,l,c);e.setSelection(u)}return!0},TS=t=>({state:e,dispatch:n})=>{let r=Ue(t,e.schema);return Fp(r)(e,n)};function qp(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 CS=({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=Bo(c,a.node().type.name,a.node().attrs);if(o instanceof V&&o.node.isBlock)return!a.parentOffset||!vt(s,a.pos)?!1:(r&&(t&&qp(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:pS(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,h=vt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&vt(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&&qp(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},NS=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let a=Ue(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=C.empty,w=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-w;B>=l.depth-3;B-=1)b=C.from(l.node(B).copy(b));let _=l.indexAfter(-1){if(D>-1)return!1;B.isTextblock&&B.content.size===0&&(D=K+1)}),D>-1&&n.setSelection(G.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}let p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...Bo(f,d.type.name,d.attrs),...e},m={...Bo(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(!vt(n.doc,l.pos,2))return!1;if(i){let{selection:b,storedMarks:w}=r,{splittableMarks:_}=o.extensionManager,T=w||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!T||!i)return!0;let A=T.filter(R=>_.includes(R.type.name));n.ensureMarks(A)}return!0},Kl=(t,e)=>{let n=rc(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&&Ft(t.doc,n.pos)&&t.join(n.pos),!0},Gl=(t,e)=>{let n=rc(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&&Ft(t.doc,r)&&t.join(r),!0},AS=(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=Ue(t,s.schema),h=Ue(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:w}=m,_=b.blockRange(w),T=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;let A=rc(R=>Vp(R.type.name,d))(m);if(_.depth>=1&&A&&_.depth-A.depth<=1){if(A.node.type===p)return c.liftListItem(h);if(Vp(A.node.type.name,d)&&p.validContent(A.node.content)&&a)return l().command(()=>(o.setNodeMarkup(A.pos,p),!0)).command(()=>Kl(o,p)).command(()=>Gl(o,p)).run()}return!n||!T||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Kl(o,p)).command(()=>Gl(o,p)).run():l().command(()=>{let R=u().wrapInList(p,r),D=T.filter(B=>f.includes(B.type.name));return o.ensureMarks(D),R?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Kl(o,p)).command(()=>Gl(o,p)).run()},vS=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=Dn(t,r.schema);return Zl(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},MS=(t,e,n={})=>({state:r,commands:i})=>{let o=Ue(t,r.schema),s=Ue(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})},OS=(t,e={})=>({state:n,commands:r})=>{let i=Ue(t,n.schema);return Ti(n,i,e)?r.lift(i):r.wrapIn(i,e)},RS=()=>({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},IS=()=>({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},DS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Dn(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=tc(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},LS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Ko(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ue(t,r.schema)),a==="mark"&&(s=Dn(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 w=Math.max(g,c),_=Math.min(g+m.nodeSize,u);n.addMark(w,_,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},PS=(t,e={})=>({state:n,dispatch:r})=>{let i=Ue(t,n.schema);return Pp(i,e)(n,r)},BS=(t,e={})=>({state:n,dispatch:r})=>{let i=Ue(t,n.schema);return Bp(i,e)(n,r)},zS=Object.freeze({__proto__:null,blur:x0,clearContent:_0,clearNodes:T0,command:C0,createParagraphNear:N0,cut:A0,deleteCurrentNode:v0,deleteNode:M0,deleteRange:O0,deleteSelection:R0,enter:I0,exitCode:D0,extendMarkRange:L0,first:P0,focus:z0,forEach:F0,insertContent:U0,insertContentAt:W0,joinBackward:V0,joinDown:G0,joinForward:q0,joinItemBackward:j0,joinItemForward:Y0,joinTextblockBackward:J0,joinTextblockForward:Z0,joinUp:K0,keyboardShortcut:Q0,lift:eS,liftEmptyBlock:tS,liftListItem:nS,newlineInCode:rS,resetAttributes:iS,scrollIntoView:oS,selectAll:sS,selectNodeBackward:aS,selectNodeForward:lS,selectParentNode:cS,selectTextblockEnd:uS,selectTextblockStart:dS,setContent:fS,setMark:kS,setMeta:wS,setNode:SS,setNodeSelection:xS,setTextSelection:_S,sinkListItem:TS,splitBlock:CS,splitListItem:NS,toggleList:AS,toggleMark:vS,toggleNode:MS,toggleWrap:OS,undoInputRule:RS,unsetAllMarks:IS,unsetMark:DS,updateAttributes:LS,wrapIn:PS,wrapInList:BS}),FS=$e.create({name:"commands",addCommands(){return{...zS}}}),US=$e.create({name:"drop",addProseMirrorPlugins(){return[new me({key:new _e("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),$S=$e.create({name:"editable",addProseMirrorPlugins(){return[new me({key:new _e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),HS=new _e("focusEvents"),WS=$e.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new me({key:HS,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}}}})]}}),KS=$e.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 Fo()||nh()?o:i},addProseMirrorPlugins(){return[new me({key:new _e("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)||!oc(n.doc))return;let f=n.tr,p=$o({state:n,transaction:f}),{commands:h}=new $r({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),GS=$e.create({name:"paste",addProseMirrorPlugins(){return[new me({key:new _e("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),VS=$e.create({name:"tabindex",addProseMirrorPlugins(){return[new me({key:new _e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Xl=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)}},qS=`.ProseMirror { +var wE=Object.create;var Aa=Object.defineProperty;var SE=Object.getOwnPropertyDescriptor;var xE=Object.getOwnPropertyNames;var _E=Object.getPrototypeOf,CE=Object.prototype.hasOwnProperty;var TE=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),NE=(t,e)=>{for(var n in e)Aa(t,n,{get:e[n],enumerable:!0})},AE=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xE(e))!CE.call(t,i)&&i!==n&&Aa(t,i,{get:()=>e[i],enumerable:!(r=SE(e,i))||r.enumerable});return t};var vE=(t,e,n)=>(n=t!=null?wE(_E(t)):{},AE(e||!t||!t.__esModule?Aa(n,"default",{value:t,enumerable:!0}):n,t));var Mb=TE((yI,vb)=>{function bb(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)&&bb(n)}),t}var Xs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function yb(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Un(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 EC="",db=t=>!!t.scope,kC=(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}`},cu=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=yb(e)}openNode(e){if(!db(e))return;let n=kC(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){db(e)&&(this.buffer+=EC)}value(){return this.buffer}span(e){this.buffer+=``}},fb=(t={})=>{let e={children:[]};return Object.assign(e,t),e},uu=class t{constructor(){this.rootNode=fb(),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=fb({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)}))}},du=class extends uu{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 cu(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ui(t){return t?typeof t=="string"?t:t.source:null}function Eb(t){return hr("(?=",t,")")}function wC(t){return hr("(?:",t,")*")}function SC(t){return hr("(?:",t,")?")}function hr(...t){return t.map(n=>Ui(n)).join("")}function xC(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function pu(...t){return"("+(xC(t).capture?"":"?:")+t.map(r=>Ui(r)).join("|")+")"}function kb(t){return new RegExp(t.toString()+"|").exec("").length-1}function _C(t,e){let n=t&&t.exec(e);return n&&n.index===0}var CC=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function hu(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Ui(r),s="";for(;o.length>0;){let a=CC.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 TC=/\b\B/,wb="[a-zA-Z]\\w*",mu="[a-zA-Z_]\\w*",Sb="\\b\\d+(\\.\\d+)?",xb="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_b="\\b(0b[01]+)",NC="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",AC=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=hr(e,/.*\b/,t.binary,/\b.*/)),Un({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Hi={begin:"\\\\[\\s\\S]",relevance:0},vC={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Hi]},MC={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Hi]},OC={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/},ea=function(t,e,n={}){let r=Un({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=pu("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:hr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},RC=ea("//","$"),IC=ea("/\\*","\\*/"),DC=ea("#","$"),LC={scope:"number",begin:Sb,relevance:0},PC={scope:"number",begin:xb,relevance:0},BC={scope:"number",begin:_b,relevance:0},zC={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Hi,{begin:/\[/,end:/\]/,relevance:0,contains:[Hi]}]},FC={scope:"title",begin:wb,relevance:0},UC={scope:"title",begin:mu,relevance:0},HC={begin:"\\.\\s*"+mu,relevance:0},$C=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()}})},Js=Object.freeze({__proto__:null,APOS_STRING_MODE:vC,BACKSLASH_ESCAPE:Hi,BINARY_NUMBER_MODE:BC,BINARY_NUMBER_RE:_b,COMMENT:ea,C_BLOCK_COMMENT_MODE:IC,C_LINE_COMMENT_MODE:RC,C_NUMBER_MODE:PC,C_NUMBER_RE:xb,END_SAME_AS_BEGIN:$C,HASH_COMMENT_MODE:DC,IDENT_RE:wb,MATCH_NOTHING_RE:TC,METHOD_GUARD:HC,NUMBER_MODE:LC,NUMBER_RE:Sb,PHRASAL_WORDS_MODE:OC,QUOTE_STRING_MODE:MC,REGEXP_MODE:zC,RE_STARTERS_RE:NC,SHEBANG:AC,TITLE_MODE:FC,UNDERSCORE_IDENT_RE:mu,UNDERSCORE_TITLE_MODE:UC});function WC(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function KC(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function VC(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=WC,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function GC(t,e){Array.isArray(t.illegal)&&(t.illegal=pu(...t.illegal))}function qC(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 YC=(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=hr(n.beforeMatch,Eb(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},ZC=["of","and","for","in","not","or","if","then","parent","list","value"],JC="keyword";function Cb(t,e,n=JC){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,Cb(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,XC(l[0],l[1])]})}}function XC(t,e){return e?Number(e):QC(t)?0:1}function QC(t){return ZC.includes(t.toLowerCase())}var pb={},pr=t=>{console.error(t)},hb=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Yr=(t,e)=>{pb[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),pb[`${t}/${e}`]=!0)},Qs=new Error;function Tb(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+=kb(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function eT(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw pr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Qs;if(typeof t.beginScope!="object"||t.beginScope===null)throw pr("beginScope must be object"),Qs;Tb(t,t.begin,{key:"beginScope"}),t.begin=hu(t.begin,{joinWith:""})}}function tT(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw pr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Qs;if(typeof t.endScope!="object"||t.endScope===null)throw pr("endScope must be object"),Qs;Tb(t,t.end,{key:"endScope"}),t.end=hu(t.end,{joinWith:""})}}function nT(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function rT(t){nT(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),eT(t),tT(t)}function iT(t){function e(s,a){return new RegExp(Ui(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+=kb(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(hu(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;[KC,qC,rT,YC].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[VC,GC,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=Cb(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=Ui(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 oT(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=Un(t.classNameAliases||{}),o(t)}function Nb(t){return t?t.endsWithParent||Nb(t.starts):!1}function oT(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Un(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Nb(t)?Un(t,{starts:t.starts?Un(t.starts):null}):Object.isFrozen(t)?Un(t):t}var sT="11.11.1",fu=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},lu=yb,mb=Un,gb=Symbol("nomatch"),aT=7,Ab=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:du};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 P=B(S[1]);return P||(hb(o.replace("{}",S[1])),hb("Falling back to no-highlight mode for this block.",x)),P?S[1]:"no-highlight"}return E.split(/\s+/).find(P=>l(P)||B(P))}function u(x,E,S){let P="",F="";typeof E=="object"?(P=x,S=E.ignoreIllegals,F=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`),F=x,P=E),S===void 0&&(S=!0);let H={code:P,language:F};Z("before:highlight",H);let se=H.result?H.result:d(H.language,H.code,S);return se.code=H.code,Z("after:highlight",se),se}function d(x,E,S,P){let F=Object.create(null);function H(I,k){return I.keywords[k]}function se(){if(!W.keywords){Se.addText(ee);return}let I=0;W.keywordPatternRe.lastIndex=0;let k=W.keywordPatternRe.exec(ee),A="";for(;k;){A+=ee.substring(I,k.index);let z=ve.case_insensitive?k[0].toLowerCase():k[0],X=H(W,z);if(X){let[ge,Et]=X;if(Se.addText(A),A="",F[z]=(F[z]||0)+1,F[z]<=aT&&(de+=Et),ge.startsWith("_"))A+=k[0];else{let Cn=ve.classNameAliases[ge]||ge;J(k[0],Cn)}}else A+=k[0];I=W.keywordPatternRe.lastIndex,k=W.keywordPatternRe.exec(ee)}A+=ee.substring(I),Se.addText(A)}function ae(){if(ee==="")return;let I=null;if(typeof W.subLanguage=="string"){if(!e[W.subLanguage]){Se.addText(ee);return}I=d(W.subLanguage,ee,!0,Y[W.subLanguage]),Y[W.subLanguage]=I._top}else I=p(ee,W.subLanguage.length?W.subLanguage:null);W.relevance>0&&(de+=I.relevance),Se.__addSublanguage(I._emitter,I.language)}function Ne(){W.subLanguage!=null?ae():se(),ee=""}function J(I,k){I!==""&&(Se.startScope(k),Se.addText(I),Se.endScope())}function Ae(I,k){let A=1,z=k.length-1;for(;A<=z;){if(!I._emit[A]){A++;continue}let X=ve.classNameAliases[I[A]]||I[A],ge=k[A];X?J(ge,X):(ee=ge,se(),ee=""),A++}}function Nt(I,k){return I.scope&&typeof I.scope=="string"&&Se.openNode(ve.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(J(ee,ve.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),ee=""):I.beginScope._multi&&(Ae(I.beginScope,k),ee="")),W=Object.create(I,{parent:{value:W}}),W}function We(I,k,A){let z=_C(I.endRe,A);if(z){if(I["on:end"]){let X=new Xs(I);I["on:end"](k,X),X.isMatchIgnored&&(z=!1)}if(z){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return We(I.parent,k,A)}function tn(I){return W.matcher.regexIndex===0?(ee+=I[0],1):(_t=!0,0)}function nn(I){let k=I[0],A=I.rule,z=new Xs(A),X=[A.__beforeBegin,A["on:begin"]];for(let ge of X)if(ge&&(ge(I,z),z.isMatchIgnored))return tn(k);return A.skip?ee+=k:(A.excludeBegin&&(ee+=k),Ne(),!A.returnBegin&&!A.excludeBegin&&(ee=k)),Nt(A,I),A.returnBegin?0:k.length}function xn(I){let k=I[0],A=E.substring(I.index),z=We(W,I,A);if(!z)return gb;let X=W;W.endScope&&W.endScope._wrap?(Ne(),J(k,W.endScope._wrap)):W.endScope&&W.endScope._multi?(Ne(),Ae(W.endScope,I)):X.skip?ee+=k:(X.returnEnd||X.excludeEnd||(ee+=k),Ne(),X.excludeEnd&&(ee=k));do W.scope&&Se.closeNode(),!W.skip&&!W.subLanguage&&(de+=W.relevance),W=W.parent;while(W!==z.parent);return z.starts&&Nt(z.starts,I),X.returnEnd?0:k.length}function _n(){let I=[];for(let k=W;k!==ve;k=k.parent)k.scope&&I.unshift(k.scope);I.forEach(k=>Se.openNode(k))}let ot={};function gt(I,k){let A=k&&k[0];if(ee+=I,A==null)return Ne(),0;if(ot.type==="begin"&&k.type==="end"&&ot.index===k.index&&A===""){if(ee+=E.slice(k.index,k.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=k,k.type==="begin")return nn(k);if(k.type==="illegal"&&!S){let z=new Error('Illegal lexeme "'+A+'" for mode "'+(W.scope||"")+'"');throw z.mode=W,z}else if(k.type==="end"){let z=xn(k);if(z!==gb)return z}if(k.type==="illegal"&&A==="")return ee+=` +`,1;if(st>1e5&&st>k.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ee+=A,A.length}let ve=B(x);if(!ve)throw pr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let ne=iT(ve),bt="",W=P||ne,Y={},Se=new a.__emitter(a);_n();let ee="",de=0,yt=0,st=0,_t=!1;try{if(ve.__emitTokens)ve.__emitTokens(E,Se);else{for(W.matcher.considerAll();;){st++,_t?_t=!1:W.matcher.considerAll(),W.matcher.lastIndex=yt;let I=W.matcher.exec(E);if(!I)break;let k=E.substring(yt,I.index),A=gt(k,I);yt=I.index+A}gt(E.substring(yt))}return Se.finalize(),bt=Se.toHTML(),{language:x,value:bt,relevance:de,illegal:!1,_emitter:Se,_top:W}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:x,value:lu(E),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:yt,context:E.slice(yt-100,yt+100),mode:I.mode,resultSoFar:bt},_emitter:Se};if(i)return{language:x,value:lu(E),illegal:!1,relevance:0,errorRaised:I,_emitter:Se,_top:W};throw I}}function f(x){let E={value:lu(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),P=E.filter(B).filter(ye).map(Ne=>d(Ne,x,!1));P.unshift(S);let F=P.sort((Ne,J)=>{if(Ne.relevance!==J.relevance)return J.relevance-Ne.relevance;if(Ne.language&&J.language){if(B(Ne.language).supersetOf===J.language)return 1;if(B(J.language).supersetOf===Ne.language)return-1}return 0}),[H,se]=F,ae=H;return ae.secondBest=se,ae}function h(x,E,S){let P=E&&n[E]||S;x.classList.add("hljs"),x.classList.add(`language-${P}`)}function m(x){let E=null,S=c(x);if(l(S))return;if(Z("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 fu("One of your code blocks includes unescaped HTML.",x.innerHTML);E=x;let P=E.textContent,F=S?u(P,{language:S,ignoreIllegals:!0}):p(P);x.innerHTML=F.value,x.dataset.highlighted="yes",h(x,S,F.language),x.result={language:F.language,re:F.relevance,relevance:F.relevance},F.secondBest&&(x.secondBest={language:F.secondBest.language,relevance:F.secondBest.relevance}),Z("after:highlightElement",{el:x,result:F,text:P})}function g(x){a=mb(a,x)}let b=()=>{_(),Yr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){_(),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 N(x,E){let S=null;try{S=E(t)}catch(P){if(pr("Language definition for '{}' could not be registered.".replace("{}",x)),i)pr(P);else throw P;S=s}S.name||(S.name=x),e[x]=S,S.rawDefinition=E.bind(null,t),S.aliases&&K(S.aliases,{languageName:x})}function v(x){delete e[x];for(let E of Object.keys(n))n[E]===x&&delete n[E]}function D(){return Object.keys(e)}function B(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function K(x,{languageName:E}){typeof x=="string"&&(x=[x]),x.forEach(S=>{n[S.toLowerCase()]=E})}function ye(x){let E=B(x);return E&&!E.disableAutodetect}function ue(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 ke(x){ue(x),r.push(x)}function Te(x){let E=r.indexOf(x);E!==-1&&r.splice(E,1)}function Z(x,E){let S=x;r.forEach(function(P){P[S]&&P[S](E)})}function Q(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:Q,configure:g,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:N,unregisterLanguage:v,listLanguages:D,getLanguage:B,registerAliases:K,autoDetection:ye,inherit:mb,addPlugin:ke,removePlugin:Te}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=sT,t.regex={concat:hr,lookahead:Eb,either:pu,optional:SC,anyNumberOfTimes:wC};for(let x in Js)typeof Js[x]=="object"&&bb(Js[x]);return Object.assign(t,Js),t},Zr=Ab({});Zr.newInstance=()=>Ab({});vb.exports=Zr;Zr.HighlightJS=Zr;Zr.default=Zr});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 va=Ze;function Nd(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=Nd(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ad(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?ro(n+1,o):ro(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}};pe.none=[];var Vn=class extends Error{},L=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=Md(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(vd(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(T.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)}};L.empty=new L(T.empty,0,0);function vd(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(vd(o.content,e-i-1,n-i-1)))}function Md(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=Md(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}function ME(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 Od(t,e,n,0)}function Od(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&&(Wn(t.nodeAfter,r),o++));for(let a=o;ai&&Ra(t,e,i+1),s=r.depth>i&&Ra(n,r,i+1),a=[];return ti(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Rd(o,s),Wn(Kn(o,Id(t,e,n,r,i+1)),a)):(o&&Wn(Kn(o,so(t,e,i+1)),a),ti(e,n,i,a),s&&Wn(Kn(s,so(n,r,i+1)),a)),ti(r,null,i,a),new T(a)}function so(t,e,n){let r=[];if(ti(null,t,n,r),t.depth>n){let i=Ra(t,e,n+1);Wn(Kn(i,so(t,e,n+1)),r)}return ti(e,null,n,r),new T(r)}function OE(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(T.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var ao=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 Gn(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=yd.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()+")"),Dd(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=T.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=T.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};At.prototype.text=void 0;var Da=class t extends At{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):Dd(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 Dd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var qn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new La(e,n);if(r.next==null)return t.empty;let i=Ld(r);r.next&&r.err("Unexpected trailing text");let o=UE(FE(i));return HE(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(` +`)}};qn.empty=new qn(!0);var La=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 Ld(t){let e=[];do e.push(DE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function DE(t){let e=[];do e.push(LE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function LE(t){let e=zE(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=PE(t,e);else break;return e}function Ed(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function PE(t,e){let n=Ed(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ed(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function BE(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 zE(t){if(t.eat("(")){let e=Ld(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=BE(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 FE(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 qn(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:zd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new At(this,this.computeAttrs(e),T.from(n),pe.setFrom(r))}createChecked(e=null,n,r){return n=T.from(n),this.checkContent(n),new At(this,this.computeAttrs(e),n,pe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=T.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(T.empty,!0);return o?new At(this,e,n.append(o),pe.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 $E(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 Pa=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$E(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=Ud(e,i.attrs),this.excluded=null;let o=Bd(this.attrs);this.instance=o?new pe(this,o):null}create(e=null){return!e&&this.instance?this.instance:new pe(this,zd(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=va.from(e.nodes),n.marks=va.from(e.marks||{}),this.nodes=lo.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]=qn.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?wd(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==""?[]:wd(this,s.split(" "))}this.nodeFromJSON=i=>At.fromJSON(this,i),this.markFromJSON=i=>pe.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 lo){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 Da(r,r.defaultAttrs,e,pe.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 wd(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 WE(t){return t.tag!=null}function KE(t){return t.style!=null}var an=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(WE(i))this.tags.push(i);else if(KE(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 co(this,n,!1);return r.addAll(e,pe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new co(this,n,!0);return r.addAll(e,pe.none,n.from,n.to),L.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=xd(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=xd(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)))}},Hd={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},VE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$d={ol:!0,ul:!0},oi=1,Ba=2,ni=4;function Sd(t,e,n){return e!=null?(e?oi:0)|(e==="full"?Ba:0):t&&t.whitespace=="pre"?oi|Ba: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=pe.none,this.match=o||(s&ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(T.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=T.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(T.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&&!Hd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},co=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=Sd(null,n.preserveWhitespace,0)|(r?ni:0);i?o=new Tr(i.type,i.attrs,pe.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Tr(null,null,pe.none,!0,null,s):o=new Tr(e.schema.topNodeType,null,pe.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&Ba?"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):_d(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 GE(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$d.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function qE(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function xd(t){let e={};for(let n in t)e[n]=t[n];return e}function _d(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&&io(Oa(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return io(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=Cd(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Cd(e.marks)}};function Cd(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Oa(t){return t.document||window.document}var Td=new WeakMap;function jE(t){let e=Td.get(t);return e===void 0&&Td.set(t,e=YE(t)),e}function YE(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}=io(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 Vd=65535,Gd=Math.pow(2,16);function ZE(t,e){return t+e*Gd}function Wd(t){return t&Vd}function JE(t){return(t-(t&Vd))/Gd}var qd=1,jd=2,uo=4,Yd=8,li=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Yd)>0}get deletedBefore(){return(this.delInfo&(qd|uo))>0}get deletedAfter(){return(this.delInfo&(jd|uo))>0}get deletedAcross(){return(this.delInfo&uo)>0}},cn=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=Wd(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:ZE(a/3,e-l),m=e==l?jd:e==d?qd:uo;return(n<0?e!=l:e!=d)&&(m|=Yd),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=Wd(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 jn(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 jn=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 L(Wa(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",jn);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 L(T.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,L.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ue.jsonID("replaceAround",Le);function Ha(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 XE(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 QE(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 jn(s.from,s.to,s.style)))}function Ka(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 e0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function un(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=T.from(r.node(h).copy(u)),d++):l--;let f=T.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=T.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Le(i,o,i,o,new L(r,0,0),n.length,!0))}function o0(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)&&s0(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&&Jd(t,s,a,o),Ka(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 Le(d,f,d+1,f-1,new L(T.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Zd(t,s,a,o),!1}})}function Zd(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 Jd(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 s0(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function a0(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 Le(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new L(T.from(s),0,0),1,!0))}function vt(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 l0(t,e,n=1,r){let i=t.doc.resolve(e),o=T.empty,s=T.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=T.from(i.node(a).copy(o));let u=r&&r[c];s=T.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Je(e,e,new L(o.append(s),n,n),!0))}function Ft(t,e){let n=t.resolve(e),r=n.index();return Xd(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function c0(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&&Xd(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 u0(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);Jd(t,u.node(),u.before(),a)}s.inlineContent&&Ka(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 Je(c,l.map(e+n,-1),L.empty,!0)),r===!0){let u=t.doc.resolve(c);Zd(t,u.node(),u.before(),t.steps.length)}return t}function d0(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=L.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Qd(i,o,r)?new Je(e,n,r):new $a(i,o,r).fit()}function Qd(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var $a=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=T.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=T.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 L(o,s,a);return e>-1?new Le(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Je(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=Fa(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(T.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=Fa(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new L(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=Fa(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new L(si(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new L(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(ef(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,T.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=Ua(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,T.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(T.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 Fa(t,e){for(let n=0;n1&&(r=r.replaceChild(0,ef(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(T.empty,!0)))),t.copy(r)}function Ua(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&&!f0(n,o.content,s)?a:null}function f0(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=p0(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 tf(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(T.empty,!0))}return t}function m0(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=d0(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new L(T.from(r),0,0))}function g0(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=nf(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 nf(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 fo=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 L(T.from(i),0,n.isLeaf?0:1))}getMap(){return cn.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",fo);var po=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 cn.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",po);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 Tn=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=L.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 L(T.from(r),0,0))}delete(e,n){return this.replace(e,n,L.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return h0(this,e,n,r),this}replaceRangeWith(e,n,r){return m0(this,e,n,r),this}deleteRange(e,n){return g0(this,e,n),this}lift(e,n){return t0(this,e,n),this}join(e,n=1){return u0(this,e,n),this}wrap(e,n){return i0(this,e,n),this}setBlockType(e,n=e,r,i=null){return o0(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return a0(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fo(e,n,r)),this}setDocAttribute(e,n){return this.step(new po(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 pe)n.isInSet(r.marks)&&this.step(new Nr(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Nr(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 l0(this,e,n,r),this}addMark(e,n,r){return XE(this,e,n,r),this}removeMark(e,n,r){return QE(this,e,n,r),this}clearIncompatible(e,n,r){return Ka(this,e,n,r),this}};var Va=Object.create(null),q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Rr(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?Or(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Or(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 Or(e,e,0,0,1)||new at(e)}static atEnd(e){return Or(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=Va[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 Va)throw new RangeError("Duplicate use of selection JSON ID "+e);return Va[e]=n,n.prototype.jsonID=e,n}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;var Rr=class{constructor(e,n){this.$from=e,this.$to=n}},rf=!1;function of(t){!rf&&!t.parent.inlineContent&&(rf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var V=class t extends q{constructor(e,n=e){of(e),of(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=L.empty){if(super.replace(e,n),n==L.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 go(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&&G.isSelectable(a))return G.create(t,n-(i<0?a.nodeSize:0))}else{let l=Or(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function sf(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 af=1,mo=2,lf=4,ja=class extends Tn{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|=mo,this}ensureMarks(e){return pe.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&mo)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mo,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)||pe.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|=lf,this}get scrolledIntoView(){return(this.updated&lf)>0}};function cf(t,e){return!e||!t?t:t.bind(e)}var Yn=class{constructor(e,n,r){this.name=e,this.init=cf(n.init,r),this.apply=cf(n.apply,r)}},y0=[new Yn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Yn("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Yn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Yn("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=y0.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 Yn(r.key,r.spec.state,r))})}},bo=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=At.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 uf(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=uf(i,e,{})),n[r]=i}return n}var fe=class{constructor(e){this.spec=e,this.props={},e.props&&uf(e.props,this,this.props),this.key=e.key?e.key.key:df("plugin")}getState(e){return e[this.key]}},Ga=Object.create(null);function df(t){return t in Ga?t+"$"+ ++Ga[t]:(Ga[t]=0,t+"$")}var xe=class{constructor(e="key"){this.key=df(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Ge=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Br=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},el=null,fn=function(t,e,n){let r=el||(el=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},E0=function(){el=null},nr=function(t,e,n,r){return n&&(ff(t,e,n,r,-1)||ff(t,e,n,r,1))},k0=/^(img|br|input|textarea|hr)$/i;function ff(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ot(t))){let s=t.parentNode;if(!s||s.nodeType!=1||wi(t)||k0.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ge(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?Ot(t):0}else return!1}}function Ot(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function w0(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=Ot(t)}else if(t.parentNode&&!wi(t))e=Ge(t),t=t.parentNode;else return null}}function S0(t,e){for(;;){if(t.nodeType==3&&e2),Mt=zr||(Kt?/Mac/.test(Kt.platform):!1),qf=Kt?/Win/.test(Kt.platform):!1,pn=/Android \d/.test(Rn),Si=!!pf&&"webkitFontSmoothing"in pf.documentElement.style,T0=Si?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function N0(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function dn(t,e){return typeof t=="number"?t:t[e]}function A0(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 hf(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=Br(s);continue}let a=s,l=a==o.body,c=l?N0(o):A0(a),u=0,d=0;if(e.topc.bottom-dn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+dn(i,"top")-c.top:e.bottom-c.bottom+dn(i,"bottom")),e.leftc.right-dn(r,"right")&&(u=e.right-c.right+dn(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:Br(s)}}function v0(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:jf(t.dom)}}function jf(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Br(r));return e}function M0({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Yf(n,r==0?0:r-e)}function Yf(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?R0(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Zf(n,i)}function R0(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 yl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function I0(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 L0(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 Jf(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=L0(t,r,i,e))}a==null&&(a=D0(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function mf(t){return t.top=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,hi(Nn(fn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ot(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Ya(l.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Ot(r))){let l=r.childNodes[i-1],c=l.nodeType==3?fn(l,Ot(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 Ya(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 Qf(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 z0(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Qf(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=Xf(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=fn(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 F0=/[\u0590-\u08ac]/;function U0(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?!F0.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Qf(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 gf=null,bf=null,yf=!1;function H0(t,e,n){return gf==e&&bf==n?yf:(gf=e,bf=n,yf=n=="up"||n=="down"?z0(t,e,n):U0(t,e,n))}var It=0,Ef=1,Jn=2,Vt=3,rr=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=It,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;nGe(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 ko){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 yo&&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?Ge(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=Ge(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?Jn:Ef,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?Jn:Vt}r=s}this.dirty=Jn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jn:Ef;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==It&&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}},il=class extends rr{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}},Fr=class t extends rr{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=ln.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!=It){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=ll(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}=ln.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=np(u,r,n),c?l=new ol(e,n,r,i,u,d||null,f,c,o,s+1):n.isText?new Eo(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=()=>T.empty)}return e}matchesNode(e,n,r){return this.dirty==It&&e.eq(this.node)&&wo(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 al(this,s&&s.node,e);V0(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?pe.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==Jn)&&(s&&this.protectLocalComposition(e,s),ep(this.contentDOM,this.children,e),zr&&G0(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof V)||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=q0(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 il(this,o,n,i);e.input.compositionNodes.push(s),this.children=ll(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=It}updateOuterDeco(e){if(wo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=tp(this.dom,this.nodeDOM,sl(this.outerDeco,this.node,n),sl(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 kf(t,e,n,r,i){np(r,e,t);let o=new On(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var Eo=class t extends On{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!=It&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=It||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=It,!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}},ko=class extends rr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==It&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},ol=class extends On{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 ep(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=Fr.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 Fr)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 K0(t,e){return t.type.side-e.type.side}function V0(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 G0(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 q0(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 ll(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 El(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(Ao(n)){for(l=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&G.isSelectable(d)&&i.parent&&!(d.isInline&&x0(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new G(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(()=>{(!rp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Y0(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ge(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wt&&Mn<=11&&(n.disabled=!0,n.disabled=!1)}function ip(t,e){if(e instanceof G){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Cf(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Cf(t)}function Cf(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function kl(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||V.between(e,n,r)}function Tf(t){return t.editable&&!t.hasFocus()?!1:op(t)}function op(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 Z0(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return nr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function cl(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 An(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Nf(t,e,n){let r=t.state.selection;if(r instanceof V)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 An(t,new V(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=cl(t.state,e);return i&&i instanceof G?An(t,i):!1}else if(!(Mt&&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?G.isSelectable(o)?An(t,new G(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Si?An(t,new V(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof G&&r.node.isInline)return An(t,new V(e>0?r.$to:r.$from));{let i=cl(t.state,e);return i?An(t,i):!1}}}function So(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 Dr(t,e){return e<0?J0(t):X0(t)}function J0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Rt&&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(sp(n))break;{let a=n.previousSibling;for(;a&&gi(a,-1);)i=n.parentNode,o=Ge(a),a=a.previousSibling;if(a)n=a,r=So(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?ul(t,n,r):i&&ul(t,i,o)}function X0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=So(n),o,s;for(;;)if(r{t.state==i&&hn(t)},50)}function Af(t,e){let n=t.state.doc.resolve(e);if(!(qe||qf)&&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 vf(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||Mt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=cl(t.state,e);if(s&&s instanceof G)return An(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?An(t,a):!1}return!1}function Mf(t,e){if(!(t.state.selection instanceof V))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 Of(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function tk(t){if(!Qe||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;Of(t,r,"true"),setTimeout(()=>Of(t,r,"false"),20)}return!1}function nk(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function rk(t,e){let n=e.keyCode,r=nk(e);if(n==8||Mt&&n==72&&r=="c")return Mf(t,-1)||Dr(t,-1);if(n==46&&!e.shiftKey||Mt&&n==68&&r=="c")return Mf(t,1)||Dr(t,1);if(n==13||n==27)return!0;if(n==37||Mt&&n==66&&r=="c"){let i=n==37?Af(t,t.state.selection.from)=="ltr"?-1:1:-1;return Nf(t,i,r)||Dr(t,i)}else if(n==39||Mt&&n==70&&r=="c"){let i=n==39?Af(t,t.state.selection.from)=="ltr"?1:-1:1;return Nf(t,i,r)||Dr(t,i)}else{if(n==38||Mt&&n==80&&r=="c")return vf(t,-1,r)||Dr(t,-1);if(n==40||Mt&&n==78&&r=="c")return tk(t)||vf(t,1,r)||Dr(t,1);if(r==(Mt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function wl(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")||ln.fromSchema(t.state.schema),a=fp(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=dp[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 ap(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 L(T.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=ln.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=ak(n),Si&&lk(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")||an.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ik.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=ck(Rf(a,+u[1],+u[2]),u[4]);else if(a=L.maxOpen(ok(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 ik=/^(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 ok(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&&cp(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=up(s[s.length-1],o.length));let u=lp(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return T.from(s)}return t}function lp(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,T.from(t));return t}function cp(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(T.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Rf(t,e,n){return en})),Ja.createHTML(t)):t}function ak(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=fp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&dp[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=sk(t),i)for(let o=0;o=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=T.from(l.create(r[a+1],i)),o++,s++}return new L(i,o,s)}var lt={},ct={},uk={touchstart:!0,touchmove:!0},fl=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 dk(t){for(let e in lt){let n=lt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{pk(t,r)&&!Sl(t,r)&&(t.editable||!(r.type in ct))&&n(t,r)},uk[e]?{passive:!0}:void 0)}Qe&&t.dom.addEventListener("input",()=>null),pl(t)}function vn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function fk(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 pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Sl(t,r))})}function Sl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function pk(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 hk(t,e){!Sl(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,!hp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(pn&&qe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zr&&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))||rk(t,n)?n.preventDefault():vn(t,"key")};ct.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ct.keypress=(t,e)=>{let n=e;if(hp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!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 vo(t){return{left:t.clientX,top:t.clientY}}function mk(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function xl(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 Pr(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 gk(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&G.isSelectable(r)?(Pr(t,new G(n),"pointer"),!0):!1}function bk(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof G&&(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(G.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?(Pr(t,G.create(t.state.doc,i),"pointer"),!0):!1}function yk(t,e,n,r,i){return xl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?bk(t,n):gk(t,n))}function Ek(t,e,n,r){return xl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function kk(t,e,n,r){return xl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||wk(t,n,r)}function wk(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Pr(t,V.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)Pr(t,V.create(r,a+1,a+1+s.content.size),"pointer");else if(G.isSelectable(s))Pr(t,G.create(r,a),"pointer");else continue;return!0}}function _l(t){return xo(t)}var pp=Mt?"metaKey":"ctrlKey";lt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=_l(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&mk(n,t.input.lastClick)&&!n[pp]&&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(vo(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new hl(t,s,n,!!r)):(o=="doubleClick"?Ek:kk)(t,s.pos,s.inside,n)?n.preventDefault():vn(t,"pointer"))};var hl=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[pp],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 G&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Rt&&!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)),vn(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(()=>hn(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(vo(e))),this.updateAllowDefault(e),this.allowDefault||!n?vn(this.view,"pointer"):yk(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qe&&this.mightDrag&&!this.mightDrag.node.isAtom||qe&&!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)?(Pr(this.view,q.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):vn(this.view,"pointer")}move(e){this.updateAllowDefault(e),vn(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(),_l(t),vn(t,"pointer")};lt.touchmove=t=>{t.input.lastTouch=Date.now(),vn(t,"pointer")};lt.contextmenu=t=>_l(t);function hp(t,e){return t.composing?!0:Qe&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var Sk=pn?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 V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||qe&&qf&&xk(t)))t.markCursor=t.state.storedMarks||n.marks(),xo(t,!0),t.markCursor=null;else if(xo(t,!e.selection.empty),Rt&&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}mp(t,Sk)};function xk(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++,mp(t,20))};function mp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>xo(t),e))}function gp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Ck());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _k(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=w0(e.focusNode,e.focusOffset),r=S0(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 Ck(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function xo(t,e=!1){if(!(pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),gp(t),e||t.docView&&t.docView.dirty){let n=El(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 Tk(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&&Mn<15||zr&&T0<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}=wl(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Tk(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Nk(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Ak(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=ap(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||L.empty)))return!0;if(!o)return!1;let s=Nk(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 bp(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&&!pn)return;let r=bi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&yi(t,bp(r),r.getData("text/html"),i,n)?n.preventDefault():Ak(t,n)};var _o=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},vk=Mt?"altKey":"ctrlKey";function yp(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[vk]}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(vo(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof G?i.to-1:i.to))){if(r&&r.mightDrag)s=G.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=G.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=wl(t,a);(!n.dataTransfer.files.length||!qe||Gf>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 _o(u,yp(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{Mk(t,e,t.dragging)}finally{t.dragging=null}};function Mk(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(vo(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=ap(t,bp(e.dataTransfer),bi?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&yp(t,e));if(t.someProp("handleDrop",p=>p(t,e,o||L.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?ho(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&&G.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new G(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(kl(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())&&hn(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(qe&&pn&&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 Co=class t{constructor(e,n){this.toDOM=e,this.spec=n||er,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 et(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)}},Qn=class t{constructor(e,n){this.attrs=e,this.spec=n||er}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 et(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==Xe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||er)}mapInner(e,n,r,i,o){let s;for(let a=0;a{let c=l+r,u;if(u=kp(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 Qn){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;ci.map(e,n,er));return t.from(r)}forChild(e,n){if(n.isLeaf)return Pe.empty;let r=[];for(let i=0;in instanceof Pe)?e:e.reduce((n,r)=>n.concat(r instanceof Pe?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let g=m-h-(p-f);for(let b=0;bw+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!=Xe?(a[c]=d,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Rk(a,t,e,n,i,o,s),u=No(c,r,0,s);e=u.local;for(let d=0;dn&&s.to{let c=kp(t,a,l+n);if(c){o=!0;let u=No(c,a,n+l+1,r);u!=Xe&&i.push(l,l+a.nodeSize,u)}});let s=Ep(o?wp(t):t,-n).sort(tr);for(let a=0;a0;)e++;t.splice(e,0,n)}function Xa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Xe&&e.push(r)}),t.cursorWrapper&&e.push(Pe.create(t.state.doc,[t.cursorWrapper.deco])),To.from(e)}var Ik={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dk=wt&&Mn<=11,gl=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}},bl=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gl,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():Qe&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Dk&&(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,Ik)),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(Tf(this.view)){if(this.suppressingSelectionUpdates)return hn(this.view);if(wt&&Mn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nr(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=Br(o))n.add(o);for(let o=e.anchorNode;o;o=Br(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)&&Tf(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(Rt&&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||Bk(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),Lk(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,zk(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hn(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],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){o=g;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||an.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:Uk,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 Uk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qe&&/^(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||Qe&&/^(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 Hk=/^(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 $k(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,B=El(t,D);if(B&&!t.state.selection.eq(B)){if(qe&&pn&&t.input.lastKeyCode===13&&Date.now()-100ye(t,Zn(13,"Enter"))))return;let K=t.state.tr.setSelection(B);D=="pointer"?K.setMeta("pointer",!0):D=="key"&&K.scrollIntoView(),o&&K.setMeta("composition",o),t.dispatch(K)}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=Fk(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||pn)&&i.some(D=>D.nodeType==1&&!Hk.test(D.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",D=>D(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof V&&!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 D=zf(t,t.state.doc,c.sel);if(D&&!D.eq(t.state.selection)){let B=t.state.tr.setSelection(D);o&&B.setMeta("composition",o),t.dispatch(B)}}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&&Mn<=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),w=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA;if((zr&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!w&&m.posD(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&Kk(u,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",D=>D(t,Zn(8,"Backspace")))){pn&&qe&&t.domObserver.suppressSelectionUpdates();return}qe&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),pn&&!w&&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(D){return D(t,Zn(13,"Enter"))})},20));let C=h.start,_=h.endA,N=D=>{let B=D||t.state.tr.replace(C,_,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let K=zf(t,B.doc,c.sel);K&&!(qe&&t.composing&&K.empty&&(h.start!=h.endB||t.input.lastChromeDeletehn(t),20));let D=N(t.state.tr.delete(C,_)),B=u.resolve(h.start).marksAcross(u.resolve(h.endA));B&&D.ensureMarks(B),t.dispatch(D)}else if(h.endA==h.endB&&(v=Wk(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let D=N(t.state.tr);v.type=="add"?D.addMark(C,_,v.mark):D.removeMark(C,_,v.mark),t.dispatch(D)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let D=m.parent.textBetween(m.parentOffset,g.parentOffset),B=()=>N(t.state.tr.insertText(D,C,_));t.someProp("handleTextInput",K=>K(t,C,_,D,B))||t.dispatch(B())}else t.dispatch(N());else t.dispatch(N())}function zf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:kl(t,e.resolve(n.anchor),e.resolve(n.head))}function Wk(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||Qa(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 Vk(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 fl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Kf),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=$f(this),Hf(this),this.nodeViews=Wf(this),this.docView=kf(this.state.doc,Uf(this),Xa(this),this.dom,this),this.domObserver=new bl(this,(r,i,o,s)=>$k(this,r,i,o,s)),this.domObserver.start(),dk(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&&pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Kf),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&&(gp(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=Wf(this);qk(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&pl(this),this.editable=$f(this),Hf(this);let l=Xa(this),c=Uf(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&&v0(this);if(s){this.domObserver.stop();let p=d&&(wt||qe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Gk(i.selection,e.selection);if(d){let h=qe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_k(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=kf(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())&&Z0(this))?hn(this,p):(ip(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&&M0(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 G){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&hf(this,n.getBoundingClientRect(),e)}else hf(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 _o(e.slice,e.move,i<0?void 0:G.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 P0(this,e)}coordsAtPos(e,n=1){return Xf(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 H0(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 wl(this,e)}destroy(){this.docView&&(fk(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,E0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return hk(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qe&&this.root.nodeType===11&&_0(this.dom.ownerDocument)==this.dom&&Pk(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 Uf(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"),[et.node(0,t.state.doc.content.size,e)]}function Hf(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:et.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function $f(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Gk(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 Wf(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 qk(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 Kf(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 mn={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:"'"},Oo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jk=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Be=0;Be<10;Be++)mn[48+Be]=mn[96+Be]=String(Be);var Be;for(Be=1;Be<=24;Be++)mn[Be+111]="F"+Be;var Be;for(Be=65;Be<=90;Be++)mn[Be]=String.fromCharCode(Be+32),Oo[Be]=String.fromCharCode(Be);var Be;for(Mo in mn)Oo.hasOwnProperty(Mo)||(Oo[Mo]=mn[Mo]);var Mo;function Sp(t){var e=jk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Yk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Oo:mn)[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 Zk=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Jk=typeof navigator<"u"&&/Win/.test(navigator.platform);function Xk(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 Cp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Al=(t,e,n)=>{let r=Cp(t,n);if(!r)return!1;let i=Ml(r);if(!i){let s=r.blockRange(),a=s&&un(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(Dp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ur(o,"end")||G.isSelectable(o)))for(let s=r.depth;;s--){let a=fi(t.doc,r.before(s),r.after(s),L.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},Tp=(t,e,n)=>{let r=Cp(t,n);if(!r)return!1;let i=Ml(r);return i?Ap(t,i,e):!1},Np=(t,e,n)=>{let r=vp(t,n);if(!r)return!1;let i=Il(r);return i?Ap(t,i,e):!1};function Ap(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,L.empty);if(!c||c.from!=o||c instanceof Je&&c.slice.size>=l-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(V.create(u.doc,o)),n(u.scrollIntoView())}return!0}function Ur(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 vl=(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=Ml(r)}let s=o&&o.nodeBefore;return!s||!G.isSelectable(s)?!1:(e&&e(t.tr.setSelection(G.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Ml(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 vp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=vp(t,n);if(!r)return!1;let i=Il(r);if(!i)return!1;let o=i.nodeAfter;if(Dp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ur(o,"start")||G.isSelectable(o))){let s=fi(t.doc,r.before(),r.after(),L.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 G,i;if(r){if(n.node.isTextblock||!Ft(t.doc,n.from))return!1;i=n.from}else if(i=Mr(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(G.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Op=(t,e)=>{let n=t.selection,r;if(n instanceof G){if(n.node.isTextblock||!Ft(t.doc,n.to))return!1;r=n.to}else if(r=Mr(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Rp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&un(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Dl=(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 Ll(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=Ll(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},Bl=(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=Ll(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(vt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&un(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function ew(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof G&&e.selection.node.isBlock)return!r.parentOffset||!vt(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=Ll(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 V||e.selection instanceof at)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=vt(u.doc,d,o.length,o);if(f||(o[0]=a?{type:a}:null,f=vt(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 tw=ew();var Ip=(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(G.create(t.doc,i))),!0)},nw=(t,e)=>(e&&e(t.tr.setSelection(new at(t.doc))),!0);function rw(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||Ft(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Dp(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&rw(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=T.empty;for(let b=s.length-1;b>=0;b--)h=T.from(s[b].create(null,h));h=T.from(i.copy(h));let m=t.tr.step(new Le(e.pos-1,p,e.pos,p,new L(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ft(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&&un(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Ur(o,"start",!0)&&Ur(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=T.empty;for(let C=h.length-1;C>=0;C--)b=T.from(h[C].copy(b));let w=t.tr.step(new Le(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new L(b,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Lp(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(V.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var Fl=Lp(-1),Ul=Lp(1);function Pp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&vr(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Hl(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 Gn(l,l,e.depth),e.endIndex=0;u--)o=T.from(n[u].type.create(n[u].attrs,o));t.step(new Le(e.start-(r?2:0),e.end,e.start,e.end,new L(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?aw(e,n,t,o):lw(e,n,o):!0:!1}}function aw(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?T.empty:T.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new Le(d-(a?1:0),f+(l?1:0),d+1,f-1,new L((a?T.empty:T.from(i.copy(T.empty))).append(l?T.empty:T.from(i.copy(T.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Fp(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=T.from(c?t.create():null),d=new L(T.from(t.create(null,T.from(a.type.create(null,u)))),c?3:1,0),f=o.start,p=o.end;n(e.tr.step(new Le(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function Ho(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 Hr=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:Ho({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}},Gl=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 $o(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 jp(t){let e=[],{nodeExtensions:n,markExtensions:r}=$o(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 He(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 te(...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 ql(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)=>te(n,r),{})}function Yp(t){return typeof t=="function"}function ie(t,e=void 0,...n){return Yp(t)?e?t.bind(e)(...n):t(...n):t}function cw(t={}){return Object.keys(t).length===0&&t.constructor===Object}function uw(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Up(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):uw(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function Hp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&cw(n)?!1:n!=null))}function dw(t,e){var n;let r=jp(t),{nodeExtensions:i,markExtensions:o}=$o(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,w)=>{let C=U(w,"extendNodeSchema",d);return{...b,...C?C(c):{}}},{}),p=Hp({...f,content:ie(U(c,"content",d)),marks:ie(U(c,"marks",d)),group:ie(U(c,"group",d)),inline:ie(U(c,"inline",d)),atom:ie(U(c,"atom",d)),selectable:ie(U(c,"selectable",d)),draggable:ie(U(c,"draggable",d)),code:ie(U(c,"code",d)),whitespace:ie(U(c,"whitespace",d)),linebreakReplacement:ie(U(c,"linebreakReplacement",d)),defining:ie(U(c,"defining",d)),isolating:ie(U(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var w;return[b.name,{default:(w=b?.attribute)===null||w===void 0?void 0:w.default}]}))}),h=ie(U(c,"parseHTML",d));h&&(p.parseDOM=h.map(b=>Up(b,u)));let m=U(c,"renderHTML",d);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:ql(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 w=U(b,"extendMarkSchema",d);return{...g,...w?w(c):{}}},{}),p=Hp({...f,inclusive:ie(U(c,"inclusive",d)),excludes:ie(U(c,"excludes",d)),group:ie(U(c,"group",d)),spanning:ie(U(c,"spanning",d)),code:ie(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=ie(U(c,"parseHTML",d));h&&(p.parseDOM=h.map(g=>Up(g,u)));let m=U(c,"renderHTML",d);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:ql(g,u)})),[c.name,p]}));return new ii({topNode:s,nodes:a,marks:l})}function Wl(t,e){return e.nodes[t]||e.marks[t]||null}function $p(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ql(t,e){let n=ln.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}var fw=(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 ec(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var $r=class{constructor(e){this.find=e.find,this.handler=e.handler}},pw=(t,e)=>{if(ec(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 Io(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=fw(c)+o;return s.forEach(f=>{if(u)return;let p=pw(d,f.find);if(!p)return;let h=l.state.tr,m=Ho({state:l.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:w,can:C}=new Hr({editor:n,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:w,can:C})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:o}),l.dispatch(h),u=!0)}),u}function hw(t){let{editor:e,rules:n}=t,r=new fe({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=Ql(T.from(u),s.schema);let{from:d}=l,f=d+u.length;Io({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 Io({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&Io({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?Io({editor:e,from:s.pos,to:s.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mw(t){return Object.prototype.toString.call(t).slice(8,-1)}function Do(t){return mw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Wo(t,e){let n={...t};return Do(t)&&Do(e)&&Object.keys(e).forEach(r=>{Do(e[r])&&Do(t[r])?n[r]=Wo(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=ie(U(this,"addOptions",{name:this.name}))),this.storage=ie(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:()=>Wo(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=ie(U(n,"addOptions",{name:n.name})),n.storage=ie(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 gw(t){return typeof t=="number"}var jl=class{constructor(e){this.find=e.find,this.handler=e.handler}},bw=(t,e,n)=>{if(ec(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 yw(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Hr({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");bw(b,o.find,s).forEach(C=>{if(C.index===void 0)return;let _=m+C.index+1,N=_+C[0].length,v={from:n.tr.mapping.map(_),to:n.tr.mapping.map(N)},D=o.handler({state:n,range:v,match:C,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(D)})}),d.every(p=>p!==null)}var Lo=null,Ew=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 kw(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=Ho({state:u,transaction:m});if(!(!yw({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 fe({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&&(Lo=e)},p=()=>{Lo&&(Lo=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=Lo;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"),w=!!b;if(!m&&!g&&!w)return;if(w){let{text:N}=b;typeof N=="string"?N=N:N=Ql(T.from(N),p.schema);let{from:v}=b,D=v+N.length,B=Ew(N);return l({rule:u,state:p,from:v,to:{b:D},pasteEvt:B})}let C=f.doc.content.findDiffStart(p.doc.content),_=f.doc.content.findDiffEnd(p.doc.content);if(!(!gw(C)||!_||C===_.b))return l({rule:u,state:p,from:C,to:_,pasteEvt:s})}}))}function ww(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}var Yl=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=dw(this.extensions,n),this.setupExtensions()}static resolve(e){let n=t.sort(t.flatten(e)),r=ww(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:Wl(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:Wl(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=xp(u);l.push(d);let f=U(s,"addInputRules",a);$p(s,e.options.enableInputRules)&&f&&r.push(...f());let p=U(s,"addPasteRules",a);$p(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[hw({editor:e,rules:r}),...kw({editor:e,rules:i}),...o]}get attributes(){return jp(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=$o(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:He(r.name,this.schema)},s=U(r,"addNodeView",o);if(!s)return[];let a=(l,c,u,d,f)=>{let p=ql(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:Wl(e.name,this.schema)};e.type==="mark"&&(!((n=ie(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)})}},ze=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=ie(U(this,"addOptions",{name:this.name}))),this.storage=ie(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:()=>Wo(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=ie(U(n,"addOptions",{name:n.name})),n.storage=ie(U(n,"addStorage",{name:n.name,options:n.options})),n}};function Zp(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 Jp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var Sw=ze.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new fe({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=Jp(n);return Zp(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xw=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),_w=(t=!1)=>({commands:e})=>e.setContent("",t),Cw=()=>({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=un(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},Tw=t=>e=>t(e),Nw=()=>({state:t,dispatch:e})=>Bl(t,e),Aw=(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 V(r.doc.resolve(Math.max(s-1,0)))),!0},vw=()=>({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},Mw=t=>({tr:e,state:n,dispatch:r})=>{let i=He(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},Ow=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},Rw=()=>({state:t,dispatch:e})=>Ro(t,e),Iw=()=>({commands:t})=>t.keyboardShortcut("Enter"),Dw=()=>({state:t,dispatch:e})=>Pl(t,e);function zo(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ec(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Xp(t,e,n={}){return t.find(r=>r.type===e&&zo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Wp(t,e,n={}){return!!Xp(t,e,n)}function tc(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),!Xp([...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&&Wp([...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=Dn(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){let d=tc(l,o,e);if(d&&d.from<=c&&d.to>=u){let f=V.create(s,d.from,d.to);n.setSelection(f)}}return!0},Pw=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=()=>{(Fo()||Kp())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),Bw()&&!Fo()&&!Kp()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!Qp(n.state.selection))return s(),!0;let a=eh(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},Fw=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Uw=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),th=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&&th(r)}return t};function Po(t){let e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return th(n)}function _i(t,e,n){if(t instanceof At||t instanceof T)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 T.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?an.fromSchema(l).parseSlice(Po(t),n.parseOptions):an.fromSchema(l).parse(Po(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let o=an.fromSchema(e);return n.slice?o.parseSlice(Po(t),n.parseOptions).content:o.parse(Po(t),n.parseOptions)}return _i("",e,n)}function Hw(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 $w=t=>!("type"in t),Ww=(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(($w(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 T){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&&Hw(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},Kw=()=>({state:t,dispatch:e})=>Mp(t,e),Vw=()=>({state:t,dispatch:e})=>Op(t,e),Gw=()=>({state:t,dispatch:e})=>Al(t,e),qw=()=>({state:t,dispatch:e})=>Ol(t,e),jw=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Mr(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Yw=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Mr(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Zw=()=>({state:t,dispatch:e})=>Tp(t,e),Jw=()=>({state:t,dispatch:e})=>Np(t,e);function nh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Xw(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=Xw(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 Ci(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?He(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=>zo(d.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var e1=(t,e={})=>({state:n,dispatch:r})=>{let i=He(t,n.schema);return Ci(n,i,e)?Rp(n,r):!1},t1=()=>({state:t,dispatch:e})=>zl(t,e),n1=t=>({state:e,dispatch:n})=>{let r=He(t,e.schema);return zp(r)(e,n)},r1=()=>({state:t,dispatch:e})=>Dl(t,e);function Ko(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Vp(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 i1=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Ko(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=He(t,r.schema)),a==="mark"&&(s=Dn(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,Vp(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Vp(d.attrs,e)))})})}),!0):!1},o1=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),s1=()=>({tr:t,dispatch:e})=>{if(e){let n=new at(t.doc);t.setSelection(n)}return!0},a1=()=>({state:t,dispatch:e})=>vl(t,e),l1=()=>({state:t,dispatch:e})=>Rl(t,e),c1=()=>({state:t,dispatch:e})=>Ip(t,e),u1=()=>({state:t,dispatch:e})=>Ul(t,e),d1=()=>({state:t,dispatch:e})=>Fl(t,e);function Zl(t,e,n={},r={}){return _i(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var f1=(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=Zl(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 rh(t,e){let n=Dn(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 ih(t,e){let n=new Tn(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function p1(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function oh(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function nc(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 rc(t){return e=>nc(e.$from,t)}function h1(t,e){let n={from:0,to:t.content.size};return Zp(t,n,e)}function m1(t,e){let n=He(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 ic(t,e){let n=Ko(typeof e=="string"?e:e.name,t.schema);return n==="node"?m1(t,e):n==="mark"?rh(t,e):{}}function g1(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 b1(t){let e=g1(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 sh(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}})})}),b1(r)}function Go(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=tc(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 Bo(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 Jl(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?Dn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>zo(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),w=Math.min(h,g+m.nodeSize),C=w-b;s+=C,a.push(...m.marks.map(_=>({mark:_,from:b,to:w})))})}),s===0)return!1;let l=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>zo(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 y1(t,e,n={}){if(!e)return Ci(t,null,n)||Jl(t,null,n);let r=Ko(e,t.schema);return r==="node"?Ci(t,e,n):r==="mark"?Jl(t,e,n):!1}function Gp(t,e){let{nodeExtensions:n}=$o(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=ie(U(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function oc(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&&(oc(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ah(t){return t instanceof G}function E1(t,e,n){var r;let{selection:i}=e,o=null;if(Qp(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 k1=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=Dn(t,r.schema);if(i)if(s){let c=rh(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 E1(r,n,l)},w1=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),S1=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=He(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>Hl(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Hl(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},x1=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=ir(t,0,r.content.size),o=G.create(r,i);e.setSelection(o)}return!0},_1=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=V.atStart(r).from,a=V.atEnd(r).to,l=ir(i,s,a),c=ir(o,s,a),u=V.create(r,l,c);e.setSelection(u)}return!0},C1=t=>({state:e,dispatch:n})=>{let r=He(t,e.schema);return Fp(r)(e,n)};function qp(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 T1=({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=Bo(c,a.node().type.name,a.node().attrs);if(o instanceof G&&o.node.isBlock)return!a.parentOffset||!vt(s,a.pos)?!1:(r&&(t&&qp(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:p1(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,h=vt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&vt(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 V&&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&&qp(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},N1=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let a=He(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=T.empty,w=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-w;B>=l.depth-3;B-=1)b=T.from(l.node(B).copy(b));let C=l.indexAfter(-1){if(D>-1)return!1;B.isTextblock&&B.content.size===0&&(D=K+1)}),D>-1&&n.setSelection(V.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}let p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...Bo(f,d.type.name,d.attrs),...e},m={...Bo(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(!vt(n.doc,l.pos,2))return!1;if(i){let{selection:b,storedMarks:w}=r,{splittableMarks:C}=o.extensionManager,_=w||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!_||!i)return!0;let N=_.filter(v=>C.includes(v.type.name));n.ensureMarks(N)}return!0},Kl=(t,e)=>{let n=rc(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&&Ft(t.doc,n.pos)&&t.join(n.pos),!0},Vl=(t,e)=>{let n=rc(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&&Ft(t.doc,r)&&t.join(r),!0},A1=(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=He(t,s.schema),h=He(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:w}=m,C=b.blockRange(w),_=g||m.$to.parentOffset&&m.$from.marks();if(!C)return!1;let N=rc(v=>Gp(v.type.name,d))(m);if(C.depth>=1&&N&&C.depth-N.depth<=1){if(N.node.type===p)return c.liftListItem(h);if(Gp(N.node.type.name,d)&&p.validContent(N.node.content)&&a)return l().command(()=>(o.setNodeMarkup(N.pos,p),!0)).command(()=>Kl(o,p)).command(()=>Vl(o,p)).run()}return!n||!_||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Kl(o,p)).command(()=>Vl(o,p)).run():l().command(()=>{let v=u().wrapInList(p,r),D=_.filter(B=>f.includes(B.type.name));return o.ensureMarks(D),v?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Kl(o,p)).command(()=>Vl(o,p)).run()},v1=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=Dn(t,r.schema);return Jl(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},M1=(t,e,n={})=>({state:r,commands:i})=>{let o=He(t,r.schema),s=He(e,r.schema),a=Ci(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})},O1=(t,e={})=>({state:n,commands:r})=>{let i=He(t,n.schema);return Ci(n,i,e)?r.lift(i):r.wrapIn(i,e)},R1=()=>({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},I1=()=>({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},D1=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Dn(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=tc(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},L1=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Ko(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=He(t,r.schema)),a==="mark"&&(s=Dn(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 w=Math.max(g,c),C=Math.min(g+m.nodeSize,u);n.addMark(w,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},P1=(t,e={})=>({state:n,dispatch:r})=>{let i=He(t,n.schema);return Pp(i,e)(n,r)},B1=(t,e={})=>({state:n,dispatch:r})=>{let i=He(t,n.schema);return Bp(i,e)(n,r)},z1=Object.freeze({__proto__:null,blur:xw,clearContent:_w,clearNodes:Cw,command:Tw,createParagraphNear:Nw,cut:Aw,deleteCurrentNode:vw,deleteNode:Mw,deleteRange:Ow,deleteSelection:Rw,enter:Iw,exitCode:Dw,extendMarkRange:Lw,first:Pw,focus:zw,forEach:Fw,insertContent:Uw,insertContentAt:Ww,joinBackward:Gw,joinDown:Vw,joinForward:qw,joinItemBackward:jw,joinItemForward:Yw,joinTextblockBackward:Zw,joinTextblockForward:Jw,joinUp:Kw,keyboardShortcut:Qw,lift:e1,liftEmptyBlock:t1,liftListItem:n1,newlineInCode:r1,resetAttributes:i1,scrollIntoView:o1,selectAll:s1,selectNodeBackward:a1,selectNodeForward:l1,selectParentNode:c1,selectTextblockEnd:u1,selectTextblockStart:d1,setContent:f1,setMark:k1,setMeta:w1,setNode:S1,setNodeSelection:x1,setTextSelection:_1,sinkListItem:C1,splitBlock:T1,splitListItem:N1,toggleList:A1,toggleMark:v1,toggleNode:M1,toggleWrap:O1,undoInputRule:R1,unsetAllMarks:I1,unsetMark:D1,updateAttributes:L1,wrapIn:P1,wrapInList:B1}),F1=ze.create({name:"commands",addCommands(){return{...z1}}}),U1=ze.create({name:"drop",addProseMirrorPlugins(){return[new fe({key:new xe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),H1=ze.create({name:"editable",addProseMirrorPlugins(){return[new fe({key:new xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$1=new xe("focusEvents"),W1=ze.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new fe({key:$1,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}}}})]}}),K1=ze.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 Fo()||nh()?o:i},addProseMirrorPlugins(){return[new fe({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)||!oc(n.doc))return;let f=n.tr,p=Ho({state:n,transaction:f}),{commands:h}=new Hr({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),V1=ze.create({name:"paste",addProseMirrorPlugins(){return[new fe({key:new xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),G1=ze.create({name:"tabindex",addProseMirrorPlugins(){return[new fe({key:new xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Xl=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)}},q1=`.ProseMirror { position: relative; } @@ -86,20 +86,20 @@ img.ProseMirror-separator { .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 Uo=class extends Vl{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(qS,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=Yp(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?[$S,S0.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),FS,WS,KS,VS,US,GS].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 Yl(i,this)}createCommandManager(){this.commandManager=new $r({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Jl(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=Jl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=eh(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:bo.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 ic(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return yS(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ql(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` +}`;function j1(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 Uo=class extends Gl{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=j1(q1,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=Yp(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?[H1,Sw.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),F1,W1,K1,G1,U1,V1].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 Yl(i,this)}createCommandManager(){this.commandManager=new Hr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Zl(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=Zl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=eh(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:bo.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 ic(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return y1(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ql(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` -`,textSerializers:r={}}=e||{};return hS(this.state.doc,{blockSeparator:n,textSerializers:{...Zp(this.schema),...r}})}get isEmpty(){return oc(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 Xl(n,this)}get $doc(){return this.$pos(0)}};function Vt(t){return new Hr({find:t.find,handler:({state:e,range:n,match:r})=>{let i=re(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(Vo(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 qo(t){return new Hr({find:t.find,handler:({state:e,range:n,match:r})=>{let i=re(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 Hr({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=re(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 qt(t){return new Hr({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=re(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&vr(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&&Ft(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}var ae=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=re(F(this,"addOptions",{name:this.name}))),this.storage=re(F(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>Wo(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=re(F(n,"addOptions",{name:n.name})),n.storage=re(F(n,"addStorage",{name:n.name,options:n.options})),n}};function Dt(t){return new jl({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=re(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(Vo(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 lh(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 YS=/^\s*>\s$/,ch=ae.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ee(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[qt({find:YS,type:this.type})]}});var JS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ZS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,XS=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QS=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,uh=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",ee(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[Vt({find:JS,type:this.type}),Vt({find:XS,type:this.type})]},addPasteRules(){return[Dt({find:ZS,type:this.type}),Dt({find:QS,type:this.type})]}});var ex="listItem",dh="textStyle",fh=/^\s*([-+*])\s$/,ph=ae.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",ee(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(ex,this.editor.getAttributes(dh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=qt({find:fh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=qt({find:fh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(dh),editor:this.editor})),[t]}});var tx=/(^|[^`])`([^`]+)`(?!`)/,nx=/(^|[^`])`([^`]+)`(?!`)/g,hh=ut.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ee(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[Vt({find:tx,type:this.type})]},addPasteRules(){return[Dt({find:nx,type:this.type})]}});var rx=/^```([a-z]+)?[\s\n]$/,ix=/^~~~([a-z]+)?[\s\n]$/,jo=ae.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",ee(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(` +`,textSerializers:r={}}=e||{};return h1(this.state.doc,{blockSeparator:n,textSerializers:{...Jp(this.schema),...r}})}get isEmpty(){return oc(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 Xl(n,this)}get $doc(){return this.$pos(0)}};function Gt(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=ie(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(Go(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 qo(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=ie(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 Ti(t){return new $r({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=ie(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 qt(t){return new $r({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=ie(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&vr(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&&Ft(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}var le=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=ie(U(this,"addOptions",{name:this.name}))),this.storage=ie(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:()=>Wo(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=ie(U(n,"addOptions",{name:n.name})),n.storage=ie(U(n,"addStorage",{name:n.name,options:n.options})),n}};function Dt(t){return new jl({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=ie(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(Go(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 lh(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof G){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 Y1=/^\s*>\s$/,ch=le.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",te(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[qt({find:Y1,type:this.type})]}});var Z1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,J1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,X1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Q1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,uh=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",te(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[Gt({find:Z1,type:this.type}),Gt({find:X1,type:this.type})]},addPasteRules(){return[Dt({find:J1,type:this.type}),Dt({find:Q1,type:this.type})]}});var eS="listItem",dh="textStyle",fh=/^\s*([-+*])\s$/,ph=le.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",te(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(eS,this.editor.getAttributes(dh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=qt({find:fh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=qt({find:fh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(dh),editor:this.editor})),[t]}});var tS=/(^|[^`])`([^`]+)`(?!`)/,nS=/(^|[^`])`([^`]+)`(?!`)/g,hh=ut.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",te(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[Gt({find:tS,type:this.type})]},addPasteRules(){return[Dt({find:nS,type:this.type})]}});var rS=/^```([a-z]+)?[\s\n]$/,iS=/^~~~([a-z]+)?[\s\n]$/,jo=le.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",te(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:rx,type:this.type,getAttributes:t=>({language:t[1]})}),Ci({find:ix,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new me({key:new _e("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 mh=ae.create({name:"doc",topNode:!0,content:"block+"});function gh(t={}){return new me({view(e){return new sc(e,t)}})}var sc=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=ho(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 bh=$e.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[gh(this.options)]}});var tt=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 L.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 ac(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!ox(e)||!sx(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}}};tt.prototype.visible=!1;tt.findFrom=tt.findGapCursorFrom;q.jsonID("gapcursor",tt);var ac=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 tt.valid(n)?new tt(n):q.near(n)}};function yh(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function ox(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||yh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sx(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||yh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Eh(){return new me({props:{decorations:ux,createSelectionBetween(t,e,n){return e.pos==n.pos&&tt.valid(n)?new tt(n):null},handleClick:lx,handleKeyDown:ax,handleDOMEvents:{beforeinput:cx}}})}var ax=xi({ArrowLeft:Yo("horiz",-1),ArrowRight:Yo("horiz",1),ArrowUp:Yo("vert",-1),ArrowDown:Yo("vert",1)});function Yo(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=tt.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new tt(c))),!0):!1}}function lx(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!tt.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 tt(r))),!0)}function cx(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof tt))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=C.empty;for(let s=r.length-1;s>=0;s--)i=C.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new L(i,0,0));return o.setSelection(G.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function ux(t){if(!(t.selection instanceof tt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(t.doc,[et.widget(t.selection.head,e,{key:"gapcursor"})])}var kh=$e.create({name:"gapCursor",addProseMirrorPlugins(){return[Eh()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=re(F(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}});var wh=ae.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",ee(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 Sh=ae.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]}`,ee(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 Jo=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length=n?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.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)};je.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};je.from=function(e){return e instanceof je?e:e&&e.length?new xh(e):je.empty};var xh=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<=Jo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Jo)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}(je);je.empty=new xh([]);var dx=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}(je),lc=je;var fx=500,sr=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 jt(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 jt(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;uhx&&(a=px(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 jt(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 jt(h,m,g))}else r.push(new jt(h))},i);let c=[];for(let f=n;ffx&&(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 jt(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(lc.from(i.reverse()),o)}};sr.empty=new sr(lc.empty,0);function px(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var jt=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)}}},Yt=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},hx=20;function mx(t,e,n,r){let i=n.getMeta(or),o;if(i)return i.historyState;n.getMeta(yx)&&(t=new Yt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(or))return s.getMeta(or).redo?new Yt(t.done.addTransform(n,void 0,r,Zo(e)),t.undone,_h(n.mapping.maps),t.prevTime,t.prevComposition):new Yt(t.done,t.undone.addTransform(n,void 0,r,Zo(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||!gx(n,t.prevRanges)),c=s?cc(t.prevRanges,n.mapping):_h(n.mapping.maps);return new Yt(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Zo(e)),sr.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new Yt(t.done.rebased(n,o),t.undone.rebased(n,o),cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Yt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function gx(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 _h(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 cc(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=or.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=bx(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var dc=Xo(!1,!0),fc=Xo(!0,!0),wO=Xo(!1,!1),SO=Xo(!0,!1);var Nh=$e.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dc(t,e),redo:()=>({state:t,dispatch:e})=>fc(t,e)}},addProseMirrorPlugins(){return[Ch(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 Ah=ae.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!lh(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}):ah(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[qo({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Ex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,kx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vh=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",ee(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[Vt({find:Ex,type:this.type}),Vt({find:wx,type:this.type})]},addPasteRules(){return[Dt({find:kx,type:this.type}),Dt({find:Sx,type:this.type})]}});var Mh=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ee(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 xx="listItem",Oh="textStyle",Rh=/^(\d+)\.\s$/,Ih=ae.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",ee(this.options.HTMLAttributes,n),0]:["ol",ee(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(xx,this.editor.getAttributes(Oh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=qt({find:Rh,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=qt({find:Rh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Oh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}});var Dh=ae.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var _x=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Lh=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",ee(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[Vt({find:_x,type:this.type})]},addPasteRules(){return[Dt({find:Tx,type:this.type})]}});var Ph=ae.create({name:"text",group:"inline"});var Bh=$e.create({name:"starterKit",addExtensions(){let t=[];return this.options.bold!==!1&&t.push(uh.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(ch.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ph.configure(this.options.bulletList)),this.options.code!==!1&&t.push(hh.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(jo.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(mh.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(bh.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(kh.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(wh.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Sh.configure(this.options.heading)),this.options.history!==!1&&t.push(Nh.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Ah.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(vh.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Mh.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Ih.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Dh.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Lh.configure(this.options.strike)),this.options.text!==!1&&t.push(Ph.configure(this.options.text)),t}});function Cx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Vh(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)&&Vh(n)}),t}var es=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function qh(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ln(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 Nx="",zh=t=>!!t.scope,Ax=(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}`},hc=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=qh(e)}openNode(e){if(!zh(e))return;let n=Ax(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){zh(e)&&(this.buffer+=Nx)}value(){return this.buffer}span(e){this.buffer+=``}},Fh=(t={})=>{let e={children:[]};return Object.assign(e,t),e},mc=class t{constructor(){this.rootNode=Fh(),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=Fh({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)}))}},gc=class extends mc{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 hc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ni(t){return t?typeof t=="string"?t:t.source:null}function jh(t){return lr("(?=",t,")")}function vx(t){return lr("(?:",t,")*")}function Mx(t){return lr("(?:",t,")?")}function lr(...t){return t.map(n=>Ni(n)).join("")}function Ox(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function yc(...t){return"("+(Ox(t).capture?"":"?:")+t.map(r=>Ni(r)).join("|")+")"}function Yh(t){return new RegExp(t.toString()+"|").exec("").length-1}function Rx(t,e){let n=t&&t.exec(e);return n&&n.index===0}var Ix=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ec(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Ni(r),s="";for(;o.length>0;){let a=Ix.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 Dx=/\b\B/,Jh="[a-zA-Z]\\w*",kc="[a-zA-Z_]\\w*",Zh="\\b\\d+(\\.\\d+)?",Xh="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Qh="\\b(0b[01]+)",Lx="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Px=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=lr(e,/.*\b/,t.binary,/\b.*/)),Ln({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ai={begin:"\\\\[\\s\\S]",relevance:0},Bx={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ai]},zx={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ai]},Fx={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/},ns=function(t,e,n={}){let r=Ln({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=yc("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:lr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Ux=ns("//","$"),$x=ns("/\\*","\\*/"),Hx=ns("#","$"),Wx={scope:"number",begin:Zh,relevance:0},Kx={scope:"number",begin:Xh,relevance:0},Gx={scope:"number",begin:Qh,relevance:0},Vx={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ai,{begin:/\[/,end:/\]/,relevance:0,contains:[Ai]}]},qx={scope:"title",begin:Jh,relevance:0},jx={scope:"title",begin:kc,relevance:0},Yx={begin:"\\.\\s*"+kc,relevance:0},Jx=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()}})},Qo=Object.freeze({__proto__:null,APOS_STRING_MODE:Bx,BACKSLASH_ESCAPE:Ai,BINARY_NUMBER_MODE:Gx,BINARY_NUMBER_RE:Qh,COMMENT:ns,C_BLOCK_COMMENT_MODE:$x,C_LINE_COMMENT_MODE:Ux,C_NUMBER_MODE:Kx,C_NUMBER_RE:Xh,END_SAME_AS_BEGIN:Jx,HASH_COMMENT_MODE:Hx,IDENT_RE:Jh,MATCH_NOTHING_RE:Dx,METHOD_GUARD:Yx,NUMBER_MODE:Wx,NUMBER_RE:Zh,PHRASAL_WORDS_MODE:Fx,QUOTE_STRING_MODE:zx,REGEXP_MODE:Vx,RE_STARTERS_RE:Lx,SHEBANG:Px,TITLE_MODE:qx,UNDERSCORE_IDENT_RE:kc,UNDERSCORE_TITLE_MODE:jx});function Zx(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function Xx(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Qx(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Zx,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function e_(t,e){Array.isArray(t.illegal)&&(t.illegal=yc(...t.illegal))}function t_(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 n_(t,e){t.relevance===void 0&&(t.relevance=1)}var r_=(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=lr(n.beforeMatch,jh(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},i_=["of","and","for","in","not","or","if","then","parent","list","value"],o_="keyword";function em(t,e,n=o_){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,em(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,s_(l[0],l[1])]})}}function s_(t,e){return e?Number(e):a_(t)?0:1}function a_(t){return i_.includes(t.toLowerCase())}var Uh={},ar=t=>{console.error(t)},$h=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Wr=(t,e)=>{Uh[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Uh[`${t}/${e}`]=!0)},ts=new Error;function tm(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+=Yh(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function l_(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ar("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ts;if(typeof t.beginScope!="object"||t.beginScope===null)throw ar("beginScope must be object"),ts;tm(t,t.begin,{key:"beginScope"}),t.begin=Ec(t.begin,{joinWith:""})}}function c_(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ar("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ts;if(typeof t.endScope!="object"||t.endScope===null)throw ar("endScope must be object"),ts;tm(t,t.end,{key:"endScope"}),t.end=Ec(t.end,{joinWith:""})}}function u_(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function d_(t){u_(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),l_(t),c_(t)}function f_(t){function e(s,a){return new RegExp(Ni(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+=Yh(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(Ec(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;[Xx,t_,d_,r_].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[Qx,e_,n_].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=em(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=Ni(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 p_(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=Ln(t.classNameAliases||{}),o(t)}function nm(t){return t?t.endsWithParent||nm(t.starts):!1}function p_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ln(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:nm(t)?Ln(t,{starts:t.starts?Ln(t.starts):null}):Object.isFrozen(t)?Ln(t):t}var h_="11.10.0",bc=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},pc=qh,Hh=Ln,Wh=Symbol("nomatch"),m_=7,rm=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:gc};function l(E){return a.noHighlightRe.test(E)}function c(E){let S=E.className+" ";S+=E.parentNode?E.parentNode.className:"";let P=a.languageDetectRe.exec(S);if(P){let $=K(P[1]);return $||($h(o.replace("{}",P[1])),$h("Falling back to no-highlight mode for this block.",E)),$?P[1]:"no-highlight"}return S.split(/\s+/).find($=>l($)||K($))}function u(E,S,P){let $="",U="";typeof S=="object"?($=E,P=S.ignoreIllegals,U=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`),U=E,$=S),P===void 0&&(P=!0);let oe={code:$,language:U};de("before:highlight",oe);let se=oe.result?oe.result:d(oe.language,oe.code,P);return se.code=oe.code,de("after:highlight",se),se}function d(E,S,P,$){let U=Object.create(null);function oe(k,N){return k.keywords[N]}function se(){if(!Y.keywords){Q.addText(ue);return}let k=0;Y.keywordPatternRe.lastIndex=0;let N=Y.keywordPatternRe.exec(ue),z="";for(;N;){z+=ue.substring(k,N.index);let Z=te.case_insensitive?N[0].toLowerCase():N[0],be=oe(Y,Z);if(be){let[Et,Tn]=be;if(Q.addText(z),z="",U[Z]=(U[Z]||0)+1,U[Z]<=m_&&(yt+=Tn),Et.startsWith("_"))z+=N[0];else{let Sr=te.classNameAliases[Et]||Et;Ae(N[0],Sr)}}else z+=N[0];k=Y.keywordPatternRe.lastIndex,N=Y.keywordPatternRe.exec(ue)}z+=ue.substring(k),Q.addText(z)}function Ne(){if(ue==="")return;let k=null;if(typeof Y.subLanguage=="string"){if(!e[Y.subLanguage]){Q.addText(ue);return}k=d(Y.subLanguage,ue,!0,xe[Y.subLanguage]),xe[Y.subLanguage]=k._top}else k=p(ue,Y.subLanguage.length?Y.subLanguage:null);Y.relevance>0&&(yt+=k.relevance),Q.__addSublanguage(k._emitter,k.language)}function J(){Y.subLanguage!=null?Ne():se(),ue=""}function Ae(k,N){k!==""&&(Q.startScope(N),Q.addText(k),Q.endScope())}function Nt(k,N){let z=1,Z=N.length-1;for(;z<=Z;){if(!k._emit[z]){z++;continue}let be=te.classNameAliases[k[z]]||k[z],Et=N[z];be?Ae(Et,be):(ue=Et,se(),ue=""),z++}}function We(k,N){return k.scope&&typeof k.scope=="string"&&Q.openNode(te.classNameAliases[k.scope]||k.scope),k.beginScope&&(k.beginScope._wrap?(Ae(ue,te.classNameAliases[k.beginScope._wrap]||k.beginScope._wrap),ue=""):k.beginScope._multi&&(Nt(k.beginScope,N),ue="")),Y=Object.create(k,{parent:{value:Y}}),Y}function tn(k,N,z){let Z=Rx(k.endRe,z);if(Z){if(k["on:end"]){let be=new es(k);k["on:end"](N,be),be.isMatchIgnored&&(Z=!1)}if(Z){for(;k.endsParent&&k.parent;)k=k.parent;return k}}if(k.endsWithParent)return tn(k.parent,N,z)}function nn(k){return Y.matcher.regexIndex===0?(ue+=k[0],1):(I=!0,0)}function xn(k){let N=k[0],z=k.rule,Z=new es(z),be=[z.__beforeBegin,z["on:begin"]];for(let Et of be)if(Et&&(Et(k,Z),Z.isMatchIgnored))return nn(N);return z.skip?ue+=N:(z.excludeBegin&&(ue+=N),J(),!z.returnBegin&&!z.excludeBegin&&(ue=N)),We(z,k),z.returnBegin?0:N.length}function _n(k){let N=k[0],z=S.substring(k.index),Z=tn(Y,k,z);if(!Z)return Wh;let be=Y;Y.endScope&&Y.endScope._wrap?(J(),Ae(N,Y.endScope._wrap)):Y.endScope&&Y.endScope._multi?(J(),Nt(Y.endScope,k)):be.skip?ue+=N:(be.returnEnd||be.excludeEnd||(ue+=N),J(),be.excludeEnd&&(ue=N));do Y.scope&&Q.closeNode(),!Y.skip&&!Y.subLanguage&&(yt+=Y.relevance),Y=Y.parent;while(Y!==Z.parent);return Z.starts&&We(Z.starts,k),be.returnEnd?0:N.length}function ot(){let k=[];for(let N=Y;N!==te;N=N.parent)N.scope&&k.unshift(N.scope);k.forEach(N=>Q.openNode(N))}let gt={};function ve(k,N){let z=N&&N[0];if(ue+=k,z==null)return J(),0;if(gt.type==="begin"&&N.type==="end"&>.index===N.index&&z===""){if(ue+=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 xn(N);if(N.type==="illegal"&&!P){let Z=new Error('Illegal lexeme "'+z+'" for mode "'+(Y.scope||"")+'"');throw Z.mode=Y,Z}else if(N.type==="end"){let Z=_n(N);if(Z!==Wh)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 ue+=z,z.length}let te=K(E);if(!te)throw ar(o.replace("{}",E)),new Error('Unknown language: "'+E+'"');let bt=f_(te),W="",Y=$||bt,xe={},Q=new a.__emitter(a);ot();let ue="",yt=0,st=0,_t=0,I=!1;try{if(te.__emitTokens)te.__emitTokens(S,Q);else{for(Y.matcher.considerAll();;){_t++,I?I=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=st;let k=Y.matcher.exec(S);if(!k)break;let N=S.substring(st,k.index),z=ve(N,k);st=k.index+z}ve(S.substring(st))}return Q.finalize(),W=Q.toHTML(),{language:E,value:W,relevance:yt,illegal:!1,_emitter:Q,_top:Y}}catch(k){if(k.message&&k.message.includes("Illegal"))return{language:E,value:pc(S),illegal:!0,relevance:0,_illegalBy:{message:k.message,index:st,context:S.slice(st-100,st+100),mode:k.mode,resultSoFar:W},_emitter:Q};if(i)return{language:E,value:pc(S),illegal:!1,relevance:0,errorRaised:k,_emitter:Q,_top:Y};throw k}}function f(E){let S={value:pc(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 P=f(E),$=S.filter(K).filter(X).map(J=>d(J,E,!1));$.unshift(P);let U=$.sort((J,Ae)=>{if(J.relevance!==Ae.relevance)return Ae.relevance-J.relevance;if(J.language&&Ae.language){if(K(J.language).supersetOf===Ae.language)return 1;if(K(Ae.language).supersetOf===J.language)return-1}return 0}),[oe,se]=U,Ne=oe;return Ne.secondBest=se,Ne}function h(E,S,P){let $=S&&n[S]||P;E.classList.add("hljs"),E.classList.add(`language-${$}`)}function m(E){let S=null,P=c(E);if(l(P))return;if(de("before:highlightElement",{el:E,language:P}),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 bc("One of your code blocks includes unescaped HTML.",E.innerHTML);S=E;let $=S.textContent,U=P?u($,{language:P,ignoreIllegals:!0}):p($);E.innerHTML=U.value,E.dataset.highlighted="yes",h(E,P,U.language),E.result={language:U.language,re:U.relevance,relevance:U.relevance},U.secondBest&&(E.secondBest={language:U.secondBest.language,relevance:U.secondBest.relevance}),de("after:highlightElement",{el:E,result:U,text:$})}function g(E){a=Hh(a,E)}let b=()=>{T(),Wr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){T(),Wr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function T(){if(document.readyState==="loading"){_=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function A(){_&&T()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",A,!1);function R(E,S){let P=null;try{P=S(t)}catch($){if(ar("Language definition for '{}' could not be registered.".replace("{}",E)),i)ar($);else throw $;P=s}P.name||(P.name=E),e[E]=P,P.rawDefinition=S.bind(null,t),P.aliases&&Ee(P.aliases,{languageName:E})}function D(E){delete e[E];for(let S of Object.keys(n))n[S]===E&&delete n[S]}function B(){return Object.keys(e)}function K(E){return E=(E||"").toLowerCase(),e[E]||e[n[E]]}function Ee(E,{languageName:S}){typeof E=="string"&&(E=[E]),E.forEach(P=>{n[P.toLowerCase()]=S})}function X(E){let S=K(E);return S&&!S.disableAutodetect}function he(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 we(E){he(E),r.push(E)}function ce(E){let S=r.indexOf(E);S!==-1&&r.splice(S,1)}function de(E,S){let P=E;r.forEach(function($){$[P]&&$[P](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:T,highlightElement:m,highlightBlock:x,configure:g,initHighlighting:b,initHighlightingOnLoad:w,registerLanguage:R,unregisterLanguage:D,listLanguages:B,getLanguage:K,registerAliases:Ee,autoDetection:X,inherit:Hh,addPlugin:we,removePlugin:ce}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=h_,t.regex={concat:lr,lookahead:jh,either:yc,optional:Mx,anyNumberOfTimes:vx};for(let E in Qo)typeof Qo[E]=="object"&&Vh(Qo[E]);return Object.assign(t,Qo),t},Kr=rm({});Kr.newInstance=()=>rm({});var g_=Kr;Kr.HighlightJS=Kr;Kr.default=Kr;var b_=Cx(g_);function im(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?im(n.children,r):{text:n.value,classes:r}}).flat()}function Kh(t){return t.value||t.children||[]}function y_(t){return!!b_.getLanguage(t)}function Gh({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return Go(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)||y_(l)||!((s=n.registered)===null||s===void 0)&&s.call(n,l))?Kh(n.highlight(l,o.node.textContent)):Kh(n.highlightAuto(o.node.textContent));im(u).forEach(d=>{let f=a+d.text.length;if(d.classes.length){let p=et.inline(a,f,{class:d.classes.join(" ")});i.push(p)}a=f})}),Pe.create(t,i)}function E_(t){return typeof t=="function"}function k_({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>E_(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new me({key:new _e("lowlight"),state:{init:(i,{doc:o})=>Gh({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=Go(s.doc,f=>f.type.name===t),d=Go(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)))?Gh({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 om=jo.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))||[],k_({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});var sm=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",ee(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 w_="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",S_="\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",Nc="numeric",Ac="ascii",vc="alpha",Oi="asciinumeric",Mi="alphanumeric",Mc="domain",pm="emoji",x_="scheme",__="slashscheme",wc="whitespace";function T_(t,e){return t in e||(e[t]=[]),e[t]}function cr(t,e,n){e[Nc]&&(e[Oi]=!0,e[Mi]=!0),e[Ac]&&(e[Oi]=!0,e[vc]=!0),e[Oi]&&(e[Mi]=!0),e[vc]&&(e[Mi]=!0),e[Mi]&&(e[Mc]=!0),e[pm]&&(e[Mc]=!0);for(let r in e){let i=T_(r,n);i.indexOf(t)<0&&i.push(t)}}function C_(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),am=(t,e,n,r,i)=>t.ts(e,n,r,i),M=(t,e,n,r,i)=>t.tt(e,n,r,i),yn="WORD",Oc="UWORD",hm="ASCIINUMERICAL",mm="ALPHANUMERICAL",Bi="LOCALHOST",Rc="TLD",Ic="UTLD",as="SCHEME",Gr="SLASH_SCHEME",Lc="NUM",Dc="WS",Pc="NL",Ri="OPENBRACE",Ii="CLOSEBRACE",ls="OPENBRACKET",cs="CLOSEBRACKET",us="OPENPAREN",ds="CLOSEPAREN",fs="OPENANGLEBRACKET",ps="CLOSEANGLEBRACKET",hs="FULLWIDTHLEFTPAREN",ms="FULLWIDTHRIGHTPAREN",gs="LEFTCORNERBRACKET",bs="RIGHTCORNERBRACKET",ys="LEFTWHITECORNERBRACKET",Es="RIGHTWHITECORNERBRACKET",ks="FULLWIDTHLESSTHAN",ws="FULLWIDTHGREATERTHAN",Ss="AMPERSAND",xs="APOSTROPHE",_s="ASTERISK",Bn="AT",Ts="BACKSLASH",Cs="BACKTICK",Ns="CARET",zn="COLON",Bc="COMMA",As="DOLLAR",Jt="DOT",vs="EQUALS",zc="EXCLAMATION",Pt="HYPHEN",Di="PERCENT",Ms="PIPE",Os="PLUS",Rs="POUND",Li="QUERY",Fc="QUOTE",gm="FULLWIDTHMIDDLEDOT",Uc="SEMI",Zt="SLASH",Pi="TILDE",Is="UNDERSCORE",bm="EMOJI",Ds="SYM",ym=Object.freeze({__proto__:null,ALPHANUMERICAL:mm,AMPERSAND:Ss,APOSTROPHE:xs,ASCIINUMERICAL:hm,ASTERISK:_s,AT:Bn,BACKSLASH:Ts,BACKTICK:Cs,CARET:Ns,CLOSEANGLEBRACKET:ps,CLOSEBRACE:Ii,CLOSEBRACKET:cs,CLOSEPAREN:ds,COLON:zn,COMMA:Bc,DOLLAR:As,DOT:Jt,EMOJI:bm,EQUALS:vs,EXCLAMATION:zc,FULLWIDTHGREATERTHAN:ws,FULLWIDTHLEFTPAREN:hs,FULLWIDTHLESSTHAN:ks,FULLWIDTHMIDDLEDOT:gm,FULLWIDTHRIGHTPAREN:ms,HYPHEN:Pt,LEFTCORNERBRACKET:gs,LEFTWHITECORNERBRACKET:ys,LOCALHOST:Bi,NL:Pc,NUM:Lc,OPENANGLEBRACKET:fs,OPENBRACE:Ri,OPENBRACKET:ls,OPENPAREN:us,PERCENT:Di,PIPE:Ms,PLUS:Os,POUND:Rs,QUERY:Li,QUOTE:Fc,RIGHTCORNERBRACKET:bs,RIGHTWHITECORNERBRACKET:Es,SCHEME:as,SEMI:Uc,SLASH:Zt,SLASH_SCHEME:Gr,SYM:Ds,TILDE:Pi,TLD:Rc,UNDERSCORE:Is,UTLD:Ic,UWORD:Oc,WORD:yn,WS:Dc}),gn=/[a-z]/,vi=/\p{L}/u,Sc=/\p{Emoji}/u;var bn=/\d/,xc=/\s/;var lm="\r",_c=` -`,N_="\uFE0F",A_="\u200D",Tc="\uFFFC",rs=null,is=null;function v_(t=[]){let e={};St.groups=e;let n=new St;rs==null&&(rs=cm(w_)),is==null&&(is=cm(S_)),M(n,"'",xs),M(n,"{",Ri),M(n,"}",Ii),M(n,"[",ls),M(n,"]",cs),M(n,"(",us),M(n,")",ds),M(n,"<",fs),M(n,">",ps),M(n,"\uFF08",hs),M(n,"\uFF09",ms),M(n,"\u300C",gs),M(n,"\u300D",bs),M(n,"\u300E",ys),M(n,"\u300F",Es),M(n,"\uFF1C",ks),M(n,"\uFF1E",ws),M(n,"&",Ss),M(n,"*",_s),M(n,"@",Bn),M(n,"`",Cs),M(n,"^",Ns),M(n,":",zn),M(n,",",Bc),M(n,"$",As),M(n,".",Jt),M(n,"=",vs),M(n,"!",zc),M(n,"-",Pt),M(n,"%",Di),M(n,"|",Ms),M(n,"+",Os),M(n,"#",Rs),M(n,"?",Li),M(n,'"',Fc),M(n,"/",Zt),M(n,";",Uc),M(n,"~",Pi),M(n,"_",Is),M(n,"\\",Ts),M(n,"\u30FB",gm);let r=Me(n,bn,Lc,{[Nc]:!0});Me(r,bn,r);let i=Me(r,gn,hm,{[Oi]:!0}),o=Me(r,vi,mm,{[Mi]:!0}),s=Me(n,gn,yn,{[Ac]:!0});Me(s,bn,i),Me(s,gn,s),Me(i,bn,i),Me(i,gn,i);let a=Me(n,vi,Oc,{[vc]:!0});Me(a,gn),Me(a,bn,o),Me(a,vi,a),Me(o,bn,o),Me(o,gn),Me(o,vi,o);let l=M(n,_c,Pc,{[wc]:!0}),c=M(n,lm,Dc,{[wc]:!0}),u=Me(n,xc,Dc,{[wc]:!0});M(n,Tc,u),M(c,_c,l),M(c,Tc,u),Me(c,xc,u),M(u,lm),M(u,_c),Me(u,xc,u),M(u,Tc,u);let d=Me(n,Sc,bm,{[pm]:!0});M(d,"#"),Me(d,Sc,d),M(d,N_,d);let f=M(d,A_);M(f,"#"),Me(f,Sc,d);let p=[[gn,s],[bn,i]],h=[[gn,null],[vi,a],[bn,o]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?w[Mc]=!0:gn.test(g)?bn.test(g)?w[Oi]=!0:w[Ac]=!0:w[Nc]=!0,am(n,g,g,w)}return am(n,"localhost",Bi,{ascii:!0}),n.jd=new St(Ds),{start:n,tokens:Object.assign({groups:e},ym)}}function Em(t,e){let n=M_(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 M_(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 Pn(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:um,formatHref:um,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function $c(t,e=null){let n=Object.assign({},zi);t&&(n=Object.assign(n,t instanceof $c?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 Ls(t,e){class n extends km{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 dm=Ls("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fm=Ls("text"),O_=Ls("nl"),ss=Ls("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===zn}});var Lt=t=>new St(t);function R_({groups:t}){let e=t.domain.concat([Ss,_s,Bn,Ts,Cs,Ns,As,vs,Pt,Lc,Di,Ms,Os,Rs,Zt,Ds,Pi,Is]),n=[xs,zn,Bc,Jt,zc,Di,Li,Fc,Uc,fs,ps,Ri,Ii,cs,ls,us,ds,hs,ms,gs,bs,ys,Es,ks,ws],r=[Ss,xs,_s,Ts,Cs,Ns,As,vs,Pt,Ri,Ii,Di,Ms,Os,Rs,Li,Zt,Ds,Pi,Is],i=Lt(),o=M(i,Pi);ie(o,r,o),ie(o,t.domain,o);let s=Lt(),a=Lt(),l=Lt();ie(i,t.domain,s),ie(i,t.scheme,a),ie(i,t.slashscheme,l),ie(s,r,o),ie(s,t.domain,s);let c=M(s,Bn);M(o,Bn,c),M(a,Bn,c),M(l,Bn,c);let u=M(o,Jt);ie(u,r,o),ie(u,t.domain,o);let d=Lt();ie(c,t.domain,d),ie(d,t.domain,d);let f=M(d,Jt);ie(f,t.domain,d);let p=Lt(dm);ie(f,t.tld,p),ie(f,t.utld,p),M(c,Bi,p);let h=M(d,Pt);M(h,Pt,h),ie(h,t.domain,d),ie(p,t.domain,d),M(p,Jt,f),M(p,Pt,h);let m=M(p,zn);ie(m,t.numeric,dm);let g=M(s,Pt),b=M(s,Jt);M(g,Pt,g),ie(g,t.domain,s),ie(b,r,o),ie(b,t.domain,s);let w=Lt(ss);ie(b,t.tld,w),ie(b,t.utld,w),ie(w,t.domain,s),ie(w,r,o),M(w,Jt,b),M(w,Pt,g),M(w,Bn,c);let _=M(w,zn),T=Lt(ss);ie(_,t.numeric,T);let A=Lt(ss),R=Lt();ie(A,e,A),ie(A,n,R),ie(R,e,A),ie(R,n,R),M(w,Zt,A),M(T,Zt,A);let D=M(a,zn),B=M(l,zn),K=M(B,Zt),Ee=M(K,Zt);ie(a,t.domain,s),M(a,Jt,b),M(a,Pt,g),ie(l,t.domain,s),M(l,Jt,b),M(l,Pt,g),ie(D,t.domain,A),M(D,Zt,A),M(D,Li,A),ie(Ee,t.domain,A),ie(Ee,e,A),M(Ee,Zt,A);let X=[[Ri,Ii],[ls,cs],[us,ds],[fs,ps],[hs,ms],[gs,bs],[ys,Es],[ks,ws]];for(let he=0;he=0&&f++,i++,u++;if(f<0)i-=u,i0&&(o.push(Cc(fm,e,s)),s=[]),i-=f,u-=f;let p=d.t,h=n.slice(i-u,i);o.push(Cc(p,e,h))}}return s.length>0&&o.push(Cc(fm,e,s)),o}function Cc(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 D_=typeof console<"u"&&console&&console.warn||(()=>{}),L_="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Te={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function wm(){return St.groups={},Te.scanner=null,Te.parser=null,Te.tokenQueue=[],Te.pluginQueue=[],Te.customSchemes=[],Te.initialized=!1,Te}function Hc(t,e=!1){if(Te.initialized&&D_(`linkifyjs: already initialized - will not register custom scheme "${t}" ${L_}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`);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[Ti({find:rS,type:this.type,getAttributes:t=>({language:t[1]})}),Ti({find:iS,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new fe({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(V.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var mh=le.create({name:"doc",topNode:!0,content:"block+"});function gh(t={}){return new fe({view(e){return new sc(e,t)}})}var sc=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=ho(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 bh=ze.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[gh(this.options)]}});var tt=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 L.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 ac(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!oS(e)||!sS(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&&!G.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}}};tt.prototype.visible=!1;tt.findFrom=tt.findGapCursorFrom;q.jsonID("gapcursor",tt);var ac=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 tt.valid(n)?new tt(n):q.near(n)}};function yh(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function oS(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||yh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sS(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||yh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Eh(){return new fe({props:{decorations:uS,createSelectionBetween(t,e,n){return e.pos==n.pos&&tt.valid(n)?new tt(n):null},handleClick:lS,handleKeyDown:aS,handleDOMEvents:{beforeinput:cS}}})}var aS=xi({ArrowLeft:Yo("horiz",-1),ArrowRight:Yo("horiz",1),ArrowUp:Yo("vert",-1),ArrowDown:Yo("vert",1)});function Yo(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 V){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=tt.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new tt(c))),!0):!1}}function lS(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!tt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&G.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new tt(r))),!0)}function cS(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof tt))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=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new L(i,0,0));return o.setSelection(V.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function uS(t){if(!(t.selection instanceof tt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(t.doc,[et.widget(t.selection.head,e,{key:"gapcursor"})])}var kh=ze.create({name:"gapCursor",addProseMirrorPlugins(){return[Eh()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ie(U(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}});var wh=le.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",te(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 Sh=le.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]}`,te(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=>Ti({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Zo=200,je=function(){};je.prototype.append=function(e){return e.length?(e=je.from(e),!this.length&&e||e.length=n?je.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};je.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};je.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)};je.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};je.from=function(e){return e instanceof je?e:e&&e.length?new xh(e):je.empty};var xh=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<=Zo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Zo)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}(je);je.empty=new xh([]);var dS=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}(je),lc=je;var fS=500,sr=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 jt(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 jt(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;uhS&&(a=pS(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 jt(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 jt(h,m,g))}else r.push(new jt(h))},i);let c=[];for(let f=n;ffS&&(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 jt(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(lc.from(i.reverse()),o)}};sr.empty=new sr(lc.empty,0);function pS(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var jt=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)}}},Yt=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},hS=20;function mS(t,e,n,r){let i=n.getMeta(or),o;if(i)return i.historyState;n.getMeta(yS)&&(t=new Yt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(or))return s.getMeta(or).redo?new Yt(t.done.addTransform(n,void 0,r,Jo(e)),t.undone,_h(n.mapping.maps),t.prevTime,t.prevComposition):new Yt(t.done,t.undone.addTransform(n,void 0,r,Jo(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||!gS(n,t.prevRanges)),c=s?cc(t.prevRanges,n.mapping):_h(n.mapping.maps);return new Yt(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Jo(e)),sr.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new Yt(t.done.rebased(n,o),t.undone.rebased(n,o),cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Yt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),cc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function gS(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 _h(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 cc(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=or.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=bS(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var dc=Xo(!1,!0),fc=Xo(!0,!0),SM=Xo(!1,!1),xM=Xo(!0,!1);var Nh=ze.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dc(t,e),redo:()=>({state:t,dispatch:e})=>fc(t,e)}},addProseMirrorPlugins(){return[Th(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 Ah=le.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",te(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!lh(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}):ah(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(V.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(G.create(s.doc,c.pos)):s.setSelection(V.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(V.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[qo({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var ES=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,kS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,SS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vh=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",te(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[Gt({find:ES,type:this.type}),Gt({find:wS,type:this.type})]},addPasteRules(){return[Dt({find:kS,type:this.type}),Dt({find:SS,type:this.type})]}});var Mh=le.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",te(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 xS="listItem",Oh="textStyle",Rh=/^(\d+)\.\s$/,Ih=le.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",te(this.options.HTMLAttributes,n),0]:["ol",te(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(xS,this.editor.getAttributes(Oh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=qt({find:Rh,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=qt({find:Rh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Oh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}});var Dh=le.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",te(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var _S=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,CS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Lh=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",te(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[Gt({find:_S,type:this.type})]},addPasteRules(){return[Dt({find:CS,type:this.type})]}});var Ph=le.create({name:"text",group:"inline"});var Bh=ze.create({name:"starterKit",addExtensions(){let t=[];return this.options.bold!==!1&&t.push(uh.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(ch.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ph.configure(this.options.bulletList)),this.options.code!==!1&&t.push(hh.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(jo.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(mh.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(bh.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(kh.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(wh.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Sh.configure(this.options.heading)),this.options.history!==!1&&t.push(Nh.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(Ah.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(vh.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Mh.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(Ih.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Dh.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Lh.configure(this.options.strike)),this.options.text!==!1&&t.push(Ph.configure(this.options.text)),t}});function TS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Gh(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)&&Gh(n)}),t}var es=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function qh(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ln(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 NS="",zh=t=>!!t.scope,AS=(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}`},hc=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=qh(e)}openNode(e){if(!zh(e))return;let n=AS(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){zh(e)&&(this.buffer+=NS)}value(){return this.buffer}span(e){this.buffer+=``}},Fh=(t={})=>{let e={children:[]};return Object.assign(e,t),e},mc=class t{constructor(){this.rootNode=Fh(),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=Fh({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)}))}},gc=class extends mc{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 hc(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ni(t){return t?typeof t=="string"?t:t.source:null}function jh(t){return lr("(?=",t,")")}function vS(t){return lr("(?:",t,")*")}function MS(t){return lr("(?:",t,")?")}function lr(...t){return t.map(n=>Ni(n)).join("")}function OS(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function yc(...t){return"("+(OS(t).capture?"":"?:")+t.map(r=>Ni(r)).join("|")+")"}function Yh(t){return new RegExp(t.toString()+"|").exec("").length-1}function RS(t,e){let n=t&&t.exec(e);return n&&n.index===0}var IS=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ec(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Ni(r),s="";for(;o.length>0;){let a=IS.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 DS=/\b\B/,Zh="[a-zA-Z]\\w*",kc="[a-zA-Z_]\\w*",Jh="\\b\\d+(\\.\\d+)?",Xh="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Qh="\\b(0b[01]+)",LS="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",PS=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=lr(e,/.*\b/,t.binary,/\b.*/)),Ln({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ai={begin:"\\\\[\\s\\S]",relevance:0},BS={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ai]},zS={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ai]},FS={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/},ns=function(t,e,n={}){let r=Ln({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=yc("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:lr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},US=ns("//","$"),HS=ns("/\\*","\\*/"),$S=ns("#","$"),WS={scope:"number",begin:Jh,relevance:0},KS={scope:"number",begin:Xh,relevance:0},VS={scope:"number",begin:Qh,relevance:0},GS={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ai,{begin:/\[/,end:/\]/,relevance:0,contains:[Ai]}]},qS={scope:"title",begin:Zh,relevance:0},jS={scope:"title",begin:kc,relevance:0},YS={begin:"\\.\\s*"+kc,relevance:0},ZS=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()}})},Qo=Object.freeze({__proto__:null,APOS_STRING_MODE:BS,BACKSLASH_ESCAPE:Ai,BINARY_NUMBER_MODE:VS,BINARY_NUMBER_RE:Qh,COMMENT:ns,C_BLOCK_COMMENT_MODE:HS,C_LINE_COMMENT_MODE:US,C_NUMBER_MODE:KS,C_NUMBER_RE:Xh,END_SAME_AS_BEGIN:ZS,HASH_COMMENT_MODE:$S,IDENT_RE:Zh,MATCH_NOTHING_RE:DS,METHOD_GUARD:YS,NUMBER_MODE:WS,NUMBER_RE:Jh,PHRASAL_WORDS_MODE:FS,QUOTE_STRING_MODE:zS,REGEXP_MODE:GS,RE_STARTERS_RE:LS,SHEBANG:PS,TITLE_MODE:qS,UNDERSCORE_IDENT_RE:kc,UNDERSCORE_TITLE_MODE:jS});function JS(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function XS(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function QS(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=JS,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function ex(t,e){Array.isArray(t.illegal)&&(t.illegal=yc(...t.illegal))}function tx(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 nx(t,e){t.relevance===void 0&&(t.relevance=1)}var rx=(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=lr(n.beforeMatch,jh(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},ix=["of","and","for","in","not","or","if","then","parent","list","value"],ox="keyword";function em(t,e,n=ox){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,em(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,sx(l[0],l[1])]})}}function sx(t,e){return e?Number(e):ax(t)?0:1}function ax(t){return ix.includes(t.toLowerCase())}var Uh={},ar=t=>{console.error(t)},Hh=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Wr=(t,e)=>{Uh[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Uh[`${t}/${e}`]=!0)},ts=new Error;function tm(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+=Yh(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function lx(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ar("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ts;if(typeof t.beginScope!="object"||t.beginScope===null)throw ar("beginScope must be object"),ts;tm(t,t.begin,{key:"beginScope"}),t.begin=Ec(t.begin,{joinWith:""})}}function cx(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ar("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ts;if(typeof t.endScope!="object"||t.endScope===null)throw ar("endScope must be object"),ts;tm(t,t.end,{key:"endScope"}),t.end=Ec(t.end,{joinWith:""})}}function ux(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function dx(t){ux(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),lx(t),cx(t)}function fx(t){function e(s,a){return new RegExp(Ni(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+=Yh(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(Ec(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;[XS,tx,dx,rx].forEach(u=>u(s,a)),t.compilerExtensions.forEach(u=>u(s,a)),s.__beforeBegin=null,[QS,ex,nx].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=em(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=Ni(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 px(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=Ln(t.classNameAliases||{}),o(t)}function nm(t){return t?t.endsWithParent||nm(t.starts):!1}function px(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ln(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:nm(t)?Ln(t,{starts:t.starts?Ln(t.starts):null}):Object.isFrozen(t)?Ln(t):t}var hx="11.10.0",bc=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},pc=qh,$h=Ln,Wh=Symbol("nomatch"),mx=7,rm=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:gc};function l(E){return a.noHighlightRe.test(E)}function c(E){let S=E.className+" ";S+=E.parentNode?E.parentNode.className:"";let P=a.languageDetectRe.exec(S);if(P){let F=K(P[1]);return F||(Hh(o.replace("{}",P[1])),Hh("Falling back to no-highlight mode for this block.",E)),F?P[1]:"no-highlight"}return S.split(/\s+/).find(F=>l(F)||K(F))}function u(E,S,P){let F="",H="";typeof S=="object"?(F=E,P=S.ignoreIllegals,H=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`),H=E,F=S),P===void 0&&(P=!0);let se={code:F,language:H};Q("before:highlight",se);let ae=se.result?se.result:d(se.language,se.code,P);return ae.code=se.code,Q("after:highlight",ae),ae}function d(E,S,P,F){let H=Object.create(null);function se(k,A){return k.keywords[A]}function ae(){if(!Y.keywords){ee.addText(de);return}let k=0;Y.keywordPatternRe.lastIndex=0;let A=Y.keywordPatternRe.exec(de),z="";for(;A;){z+=de.substring(k,A.index);let X=ne.case_insensitive?A[0].toLowerCase():A[0],ge=se(Y,X);if(ge){let[Et,Cn]=ge;if(ee.addText(z),z="",H[X]=(H[X]||0)+1,H[X]<=mx&&(yt+=Cn),Et.startsWith("_"))z+=A[0];else{let Sr=ne.classNameAliases[Et]||Et;Ae(A[0],Sr)}}else z+=A[0];k=Y.keywordPatternRe.lastIndex,A=Y.keywordPatternRe.exec(de)}z+=de.substring(k),ee.addText(z)}function Ne(){if(de==="")return;let k=null;if(typeof Y.subLanguage=="string"){if(!e[Y.subLanguage]){ee.addText(de);return}k=d(Y.subLanguage,de,!0,Se[Y.subLanguage]),Se[Y.subLanguage]=k._top}else k=p(de,Y.subLanguage.length?Y.subLanguage:null);Y.relevance>0&&(yt+=k.relevance),ee.__addSublanguage(k._emitter,k.language)}function J(){Y.subLanguage!=null?Ne():ae(),de=""}function Ae(k,A){k!==""&&(ee.startScope(A),ee.addText(k),ee.endScope())}function Nt(k,A){let z=1,X=A.length-1;for(;z<=X;){if(!k._emit[z]){z++;continue}let ge=ne.classNameAliases[k[z]]||k[z],Et=A[z];ge?Ae(Et,ge):(de=Et,ae(),de=""),z++}}function We(k,A){return k.scope&&typeof k.scope=="string"&&ee.openNode(ne.classNameAliases[k.scope]||k.scope),k.beginScope&&(k.beginScope._wrap?(Ae(de,ne.classNameAliases[k.beginScope._wrap]||k.beginScope._wrap),de=""):k.beginScope._multi&&(Nt(k.beginScope,A),de="")),Y=Object.create(k,{parent:{value:Y}}),Y}function tn(k,A,z){let X=RS(k.endRe,z);if(X){if(k["on:end"]){let ge=new es(k);k["on:end"](A,ge),ge.isMatchIgnored&&(X=!1)}if(X){for(;k.endsParent&&k.parent;)k=k.parent;return k}}if(k.endsWithParent)return tn(k.parent,A,z)}function nn(k){return Y.matcher.regexIndex===0?(de+=k[0],1):(I=!0,0)}function xn(k){let A=k[0],z=k.rule,X=new es(z),ge=[z.__beforeBegin,z["on:begin"]];for(let Et of ge)if(Et&&(Et(k,X),X.isMatchIgnored))return nn(A);return z.skip?de+=A:(z.excludeBegin&&(de+=A),J(),!z.returnBegin&&!z.excludeBegin&&(de=A)),We(z,k),z.returnBegin?0:A.length}function _n(k){let A=k[0],z=S.substring(k.index),X=tn(Y,k,z);if(!X)return Wh;let ge=Y;Y.endScope&&Y.endScope._wrap?(J(),Ae(A,Y.endScope._wrap)):Y.endScope&&Y.endScope._multi?(J(),Nt(Y.endScope,k)):ge.skip?de+=A:(ge.returnEnd||ge.excludeEnd||(de+=A),J(),ge.excludeEnd&&(de=A));do Y.scope&&ee.closeNode(),!Y.skip&&!Y.subLanguage&&(yt+=Y.relevance),Y=Y.parent;while(Y!==X.parent);return X.starts&&We(X.starts,k),ge.returnEnd?0:A.length}function ot(){let k=[];for(let A=Y;A!==ne;A=A.parent)A.scope&&k.unshift(A.scope);k.forEach(A=>ee.openNode(A))}let gt={};function ve(k,A){let z=A&&A[0];if(de+=k,z==null)return J(),0;if(gt.type==="begin"&&A.type==="end"&>.index===A.index&&z===""){if(de+=S.slice(A.index,A.index+1),!i){let X=new Error(`0 width match regex (${E})`);throw X.languageName=E,X.badRule=gt.rule,X}return 1}if(gt=A,A.type==="begin")return xn(A);if(A.type==="illegal"&&!P){let X=new Error('Illegal lexeme "'+z+'" for mode "'+(Y.scope||"")+'"');throw X.mode=Y,X}else if(A.type==="end"){let X=_n(A);if(X!==Wh)return X}if(A.type==="illegal"&&z==="")return 1;if(_t>1e5&&_t>A.index*3)throw new Error("potential infinite loop, way more iterations than matches");return de+=z,z.length}let ne=K(E);if(!ne)throw ar(o.replace("{}",E)),new Error('Unknown language: "'+E+'"');let bt=fx(ne),W="",Y=F||bt,Se={},ee=new a.__emitter(a);ot();let de="",yt=0,st=0,_t=0,I=!1;try{if(ne.__emitTokens)ne.__emitTokens(S,ee);else{for(Y.matcher.considerAll();;){_t++,I?I=!1:Y.matcher.considerAll(),Y.matcher.lastIndex=st;let k=Y.matcher.exec(S);if(!k)break;let A=S.substring(st,k.index),z=ve(A,k);st=k.index+z}ve(S.substring(st))}return ee.finalize(),W=ee.toHTML(),{language:E,value:W,relevance:yt,illegal:!1,_emitter:ee,_top:Y}}catch(k){if(k.message&&k.message.includes("Illegal"))return{language:E,value:pc(S),illegal:!0,relevance:0,_illegalBy:{message:k.message,index:st,context:S.slice(st-100,st+100),mode:k.mode,resultSoFar:W},_emitter:ee};if(i)return{language:E,value:pc(S),illegal:!1,relevance:0,errorRaised:k,_emitter:ee,_top:Y};throw k}}function f(E){let S={value:pc(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 P=f(E),F=S.filter(K).filter(ue).map(J=>d(J,E,!1));F.unshift(P);let H=F.sort((J,Ae)=>{if(J.relevance!==Ae.relevance)return Ae.relevance-J.relevance;if(J.language&&Ae.language){if(K(J.language).supersetOf===Ae.language)return 1;if(K(Ae.language).supersetOf===J.language)return-1}return 0}),[se,ae]=H,Ne=se;return Ne.secondBest=ae,Ne}function h(E,S,P){let F=S&&n[S]||P;E.classList.add("hljs"),E.classList.add(`language-${F}`)}function m(E){let S=null,P=c(E);if(l(P))return;if(Q("before:highlightElement",{el:E,language:P}),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 bc("One of your code blocks includes unescaped HTML.",E.innerHTML);S=E;let F=S.textContent,H=P?u(F,{language:P,ignoreIllegals:!0}):p(F);E.innerHTML=H.value,E.dataset.highlighted="yes",h(E,P,H.language),E.result={language:H.language,re:H.relevance,relevance:H.relevance},H.secondBest&&(E.secondBest={language:H.secondBest.language,relevance:H.secondBest.relevance}),Q("after:highlightElement",{el:E,result:H,text:F})}function g(E){a=$h(a,E)}let b=()=>{_(),Wr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){_(),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 N(){C&&_()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",N,!1);function v(E,S){let P=null;try{P=S(t)}catch(F){if(ar("Language definition for '{}' could not be registered.".replace("{}",E)),i)ar(F);else throw F;P=s}P.name||(P.name=E),e[E]=P,P.rawDefinition=S.bind(null,t),P.aliases&&ye(P.aliases,{languageName:E})}function D(E){delete e[E];for(let S of Object.keys(n))n[S]===E&&delete n[S]}function B(){return Object.keys(e)}function K(E){return E=(E||"").toLowerCase(),e[E]||e[n[E]]}function ye(E,{languageName:S}){typeof E=="string"&&(E=[E]),E.forEach(P=>{n[P.toLowerCase()]=S})}function ue(E){let S=K(E);return S&&!S.disableAutodetect}function ke(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 Te(E){ke(E),r.push(E)}function Z(E){let S=r.indexOf(E);S!==-1&&r.splice(S,1)}function Q(E,S){let P=E;r.forEach(function(F){F[P]&&F[P](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:w,registerLanguage:v,unregisterLanguage:D,listLanguages:B,getLanguage:K,registerAliases:ye,autoDetection:ue,inherit:$h,addPlugin:Te,removePlugin:Z}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=hx,t.regex={concat:lr,lookahead:jh,either:yc,optional:MS,anyNumberOfTimes:vS};for(let E in Qo)typeof Qo[E]=="object"&&Gh(Qo[E]);return Object.assign(t,Qo),t},Kr=rm({});Kr.newInstance=()=>rm({});var gx=Kr;Kr.HighlightJS=Kr;Kr.default=Kr;var bx=TS(gx);function im(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?im(n.children,r):{text:n.value,classes:r}}).flat()}function Kh(t){return t.value||t.children||[]}function yx(t){return!!bx.getLanguage(t)}function Vh({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return Vo(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)||yx(l)||!((s=n.registered)===null||s===void 0)&&s.call(n,l))?Kh(n.highlight(l,o.node.textContent)):Kh(n.highlightAuto(o.node.textContent));im(u).forEach(d=>{let f=a+d.text.length;if(d.classes.length){let p=et.inline(a,f,{class:d.classes.join(" ")});i.push(p)}a=f})}),Pe.create(t,i)}function Ex(t){return typeof t=="function"}function kx({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>Ex(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new fe({key:new xe("lowlight"),state:{init:(i,{doc:o})=>Vh({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=Vo(s.doc,f=>f.type.name===t),d=Vo(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)))?Vh({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 om=jo.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))||[],kx({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});var sm=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",te(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 wx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Sx="\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",Nc="numeric",Ac="ascii",vc="alpha",Oi="asciinumeric",Mi="alphanumeric",Mc="domain",pm="emoji",xx="scheme",_x="slashscheme",wc="whitespace";function Cx(t,e){return t in e||(e[t]=[]),e[t]}function cr(t,e,n){e[Nc]&&(e[Oi]=!0,e[Mi]=!0),e[Ac]&&(e[Oi]=!0,e[vc]=!0),e[Oi]&&(e[Mi]=!0),e[vc]&&(e[Mi]=!0),e[Mi]&&(e[Mc]=!0),e[pm]&&(e[Mc]=!0);for(let r in e){let i=Cx(r,n);i.indexOf(t)<0&&i.push(t)}}function Tx(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),am=(t,e,n,r,i)=>t.ts(e,n,r,i),O=(t,e,n,r,i)=>t.tt(e,n,r,i),yn="WORD",Oc="UWORD",hm="ASCIINUMERICAL",mm="ALPHANUMERICAL",Bi="LOCALHOST",Rc="TLD",Ic="UTLD",as="SCHEME",Vr="SLASH_SCHEME",Lc="NUM",Dc="WS",Pc="NL",Ri="OPENBRACE",Ii="CLOSEBRACE",ls="OPENBRACKET",cs="CLOSEBRACKET",us="OPENPAREN",ds="CLOSEPAREN",fs="OPENANGLEBRACKET",ps="CLOSEANGLEBRACKET",hs="FULLWIDTHLEFTPAREN",ms="FULLWIDTHRIGHTPAREN",gs="LEFTCORNERBRACKET",bs="RIGHTCORNERBRACKET",ys="LEFTWHITECORNERBRACKET",Es="RIGHTWHITECORNERBRACKET",ks="FULLWIDTHLESSTHAN",ws="FULLWIDTHGREATERTHAN",Ss="AMPERSAND",xs="APOSTROPHE",_s="ASTERISK",Bn="AT",Cs="BACKSLASH",Ts="BACKTICK",Ns="CARET",zn="COLON",Bc="COMMA",As="DOLLAR",Zt="DOT",vs="EQUALS",zc="EXCLAMATION",Pt="HYPHEN",Di="PERCENT",Ms="PIPE",Os="PLUS",Rs="POUND",Li="QUERY",Fc="QUOTE",gm="FULLWIDTHMIDDLEDOT",Uc="SEMI",Jt="SLASH",Pi="TILDE",Is="UNDERSCORE",bm="EMOJI",Ds="SYM",ym=Object.freeze({__proto__:null,ALPHANUMERICAL:mm,AMPERSAND:Ss,APOSTROPHE:xs,ASCIINUMERICAL:hm,ASTERISK:_s,AT:Bn,BACKSLASH:Cs,BACKTICK:Ts,CARET:Ns,CLOSEANGLEBRACKET:ps,CLOSEBRACE:Ii,CLOSEBRACKET:cs,CLOSEPAREN:ds,COLON:zn,COMMA:Bc,DOLLAR:As,DOT:Zt,EMOJI:bm,EQUALS:vs,EXCLAMATION:zc,FULLWIDTHGREATERTHAN:ws,FULLWIDTHLEFTPAREN:hs,FULLWIDTHLESSTHAN:ks,FULLWIDTHMIDDLEDOT:gm,FULLWIDTHRIGHTPAREN:ms,HYPHEN:Pt,LEFTCORNERBRACKET:gs,LEFTWHITECORNERBRACKET:ys,LOCALHOST:Bi,NL:Pc,NUM:Lc,OPENANGLEBRACKET:fs,OPENBRACE:Ri,OPENBRACKET:ls,OPENPAREN:us,PERCENT:Di,PIPE:Ms,PLUS:Os,POUND:Rs,QUERY:Li,QUOTE:Fc,RIGHTCORNERBRACKET:bs,RIGHTWHITECORNERBRACKET:Es,SCHEME:as,SEMI:Uc,SLASH:Jt,SLASH_SCHEME:Vr,SYM:Ds,TILDE:Pi,TLD:Rc,UNDERSCORE:Is,UTLD:Ic,UWORD:Oc,WORD:yn,WS:Dc}),gn=/[a-z]/,vi=/\p{L}/u,Sc=/\p{Emoji}/u;var bn=/\d/,xc=/\s/;var lm="\r",_c=` +`,Nx="\uFE0F",Ax="\u200D",Cc="\uFFFC",rs=null,is=null;function vx(t=[]){let e={};St.groups=e;let n=new St;rs==null&&(rs=cm(wx)),is==null&&(is=cm(Sx)),O(n,"'",xs),O(n,"{",Ri),O(n,"}",Ii),O(n,"[",ls),O(n,"]",cs),O(n,"(",us),O(n,")",ds),O(n,"<",fs),O(n,">",ps),O(n,"\uFF08",hs),O(n,"\uFF09",ms),O(n,"\u300C",gs),O(n,"\u300D",bs),O(n,"\u300E",ys),O(n,"\u300F",Es),O(n,"\uFF1C",ks),O(n,"\uFF1E",ws),O(n,"&",Ss),O(n,"*",_s),O(n,"@",Bn),O(n,"`",Ts),O(n,"^",Ns),O(n,":",zn),O(n,",",Bc),O(n,"$",As),O(n,".",Zt),O(n,"=",vs),O(n,"!",zc),O(n,"-",Pt),O(n,"%",Di),O(n,"|",Ms),O(n,"+",Os),O(n,"#",Rs),O(n,"?",Li),O(n,'"',Fc),O(n,"/",Jt),O(n,";",Uc),O(n,"~",Pi),O(n,"_",Is),O(n,"\\",Cs),O(n,"\u30FB",gm);let r=Me(n,bn,Lc,{[Nc]:!0});Me(r,bn,r);let i=Me(r,gn,hm,{[Oi]:!0}),o=Me(r,vi,mm,{[Mi]:!0}),s=Me(n,gn,yn,{[Ac]:!0});Me(s,bn,i),Me(s,gn,s),Me(i,bn,i),Me(i,gn,i);let a=Me(n,vi,Oc,{[vc]:!0});Me(a,gn),Me(a,bn,o),Me(a,vi,a),Me(o,bn,o),Me(o,gn),Me(o,vi,o);let l=O(n,_c,Pc,{[wc]:!0}),c=O(n,lm,Dc,{[wc]:!0}),u=Me(n,xc,Dc,{[wc]:!0});O(n,Cc,u),O(c,_c,l),O(c,Cc,u),Me(c,xc,u),O(u,lm),O(u,_c),Me(u,xc,u),O(u,Cc,u);let d=Me(n,Sc,bm,{[pm]:!0});O(d,"#"),Me(d,Sc,d),O(d,Nx,d);let f=O(d,Ax);O(f,"#"),Me(f,Sc,d);let p=[[gn,s],[bn,i]],h=[[gn,null],[vi,a],[bn,o]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?w[Mc]=!0:gn.test(g)?bn.test(g)?w[Oi]=!0:w[Ac]=!0:w[Nc]=!0,am(n,g,g,w)}return am(n,"localhost",Bi,{ascii:!0}),n.jd=new St(Ds),{start:n,tokens:Object.assign({groups:e},ym)}}function Em(t,e){let n=Mx(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 Mx(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 Pn(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:um,formatHref:um,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hc(t,e=null){let n=Object.assign({},zi);t&&(n=Object.assign(n,t instanceof Hc?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 Ls(t,e){class n extends km{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 dm=Ls("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fm=Ls("text"),Ox=Ls("nl"),ss=Ls("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===zn}});var Lt=t=>new St(t);function Rx({groups:t}){let e=t.domain.concat([Ss,_s,Bn,Cs,Ts,Ns,As,vs,Pt,Lc,Di,Ms,Os,Rs,Jt,Ds,Pi,Is]),n=[xs,zn,Bc,Zt,zc,Di,Li,Fc,Uc,fs,ps,Ri,Ii,cs,ls,us,ds,hs,ms,gs,bs,ys,Es,ks,ws],r=[Ss,xs,_s,Cs,Ts,Ns,As,vs,Pt,Ri,Ii,Di,Ms,Os,Rs,Li,Jt,Ds,Pi,Is],i=Lt(),o=O(i,Pi);oe(o,r,o),oe(o,t.domain,o);let s=Lt(),a=Lt(),l=Lt();oe(i,t.domain,s),oe(i,t.scheme,a),oe(i,t.slashscheme,l),oe(s,r,o),oe(s,t.domain,s);let c=O(s,Bn);O(o,Bn,c),O(a,Bn,c),O(l,Bn,c);let u=O(o,Zt);oe(u,r,o),oe(u,t.domain,o);let d=Lt();oe(c,t.domain,d),oe(d,t.domain,d);let f=O(d,Zt);oe(f,t.domain,d);let p=Lt(dm);oe(f,t.tld,p),oe(f,t.utld,p),O(c,Bi,p);let h=O(d,Pt);O(h,Pt,h),oe(h,t.domain,d),oe(p,t.domain,d),O(p,Zt,f),O(p,Pt,h);let m=O(p,zn);oe(m,t.numeric,dm);let g=O(s,Pt),b=O(s,Zt);O(g,Pt,g),oe(g,t.domain,s),oe(b,r,o),oe(b,t.domain,s);let w=Lt(ss);oe(b,t.tld,w),oe(b,t.utld,w),oe(w,t.domain,s),oe(w,r,o),O(w,Zt,b),O(w,Pt,g),O(w,Bn,c);let C=O(w,zn),_=Lt(ss);oe(C,t.numeric,_);let N=Lt(ss),v=Lt();oe(N,e,N),oe(N,n,v),oe(v,e,N),oe(v,n,v),O(w,Jt,N),O(_,Jt,N);let D=O(a,zn),B=O(l,zn),K=O(B,Jt),ye=O(K,Jt);oe(a,t.domain,s),O(a,Zt,b),O(a,Pt,g),oe(l,t.domain,s),O(l,Zt,b),O(l,Pt,g),oe(D,t.domain,N),O(D,Jt,N),O(D,Li,N),oe(ye,t.domain,N),oe(ye,e,N),O(ye,Jt,N);let ue=[[Ri,Ii],[ls,cs],[us,ds],[fs,ps],[hs,ms],[gs,bs],[ys,Es],[ks,ws]];for(let ke=0;ke=0&&f++,i++,u++;if(f<0)i-=u,i0&&(o.push(Tc(fm,e,s)),s=[]),i-=f,u-=f;let p=d.t,h=n.slice(i-u,i);o.push(Tc(p,e,h))}}return s.length>0&&o.push(Tc(fm,e,s)),o}function Tc(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 Dx=typeof console<"u"&&console&&console.warn||(()=>{}),Lx="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 wm(){return St.groups={},_e.scanner=null,_e.parser=null,_e.tokenQueue=[],_e.pluginQueue=[],_e.customSchemes=[],_e.initialized=!1,_e}function $c(t,e=!1){if(_e.initialized&&Dx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Lx}`),!/^[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`);Te.customSchemes.push([t,e])}function P_(){Te.scanner=v_(Te.customSchemes);for(let t=0;t{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=ih(n.doc,[...e]);if(sh(a).forEach(({newRange:c})=>{let u=oh(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(!z_.test(p))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){let p=f.split(B_).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=Ps(h).map(b=>b.toObject(t.defaultProtocol));if(!U_(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=>{Vo(b.from,b.to,r.doc).some(w=>w.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function H_(t){return new me({key:new _e("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=ic(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 W_(t){return new me({key:new _e("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=Wc(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 ur(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(F_,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Sm=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"){Hc(t);return}Hc(t.scheme,t.optionalSlashes)})},onDestroy(){wm()},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)=>!!ur(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=>!!ur(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=>!!ur(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,t),0]:["a",ee(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ur(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=>!!ur(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[Dt({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=Wc(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!ur(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($_({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ur(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(H_({type:this.type})),this.options.linkOnPaste&&t.push(W_({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var Vc,qc;if(typeof WeakMap<"u"){let t=new WeakMap;Vc=e=>t.get(e),qc=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;Vc=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-_});break}let T=i+_*e;for(let A=0;Ar&&(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 V_(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 Ut(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 Hs(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=dr(e.$head)||Y_(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Y_(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 jc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function J_(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Zc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Rm(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 fr(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 Im(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 Rr(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(jc(r)&&jc(i)&&Zc(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?En.rowSelection(r,i):o&&this.isColSelection()?En.colSelection(r,i):new En(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=fr(b,0,m)),g>0&&(b=fr(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 En&&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(et.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Pe.create(t.doc,e)}function eT({$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 tT({$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 nT(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=Se.create(i,r.from);else if(s=="row"){let a=i.resolve(r.from+1);o=Se.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=Se.create(i,l+1,c)}}else r instanceof G&&eT(r)?o=G.create(i,r.from):r instanceof G&&tT(r)&&(o=G.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var rT=new _e("fix-tables");function Lm(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=iT(t,i,o,n))};return e?e.doc!=t.doc&&Lm(e.doc,t.doc,0,r):t.doc.descendants(r),n}function iT(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;Z_(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;sT(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=xm(c)?l+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,a)}o.setSelection(new Se(o.doc.resolve(l+r.tableStart))),e(o)}return!0}function eu(t,e){let n=nt(t.schema);return cT(({node:r})=>n[r.type.spec.tableRole])(t,e)}function cT(t){return(e,n)=>{let r=e.selection,i,o;if(r instanceof Se){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=dr(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=Xt(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 uT(t){return function(e,n){if(!Ut(e))return!1;if(n){let r=nt(e.schema),i=Xt(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 N1=Vr("row",{useDeprecatedLogic:!0}),A1=Vr("column",{useDeprecatedLogic:!0}),Gm=Vr("cell",{useDeprecatedLogic:!0});function dT(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 Bs(t,e){let n=t.selection;if(!(n instanceof Se))return!1;if(e){let r=t.tr,i=nt(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 L(i,0,0))}),r.docChanged&&e(r)}return!0}function fT(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(C.empty),n[i]r&&(f=f.type.createChecked(fr(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(C.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function mT(t,e,n,r,i,o,s){let a=t.doc.type.schema,l=nt(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,C.from(d)),p=[];for(let h=e.height;h{if(!i)return!1;let o=n.selection;if(o instanceof Se)return Us(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 Us(n,r,q.near(n.doc.resolve(o.head+e),e));{let a=n.doc.resolve(s),l=Rm(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),Us(n,r,c)}}}function Fs(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection,s;if(o instanceof Se)s=o;else{let l=qm(i,t,e);if(l==null)return!1;s=new Se(n.doc.resolve(l))}let a=Rm(s.$headCell,t,e);return a?Us(n,r,new Se(s.$anchorCell,a)):!1}}function bT(t,e){let n=t.state.doc,r=dr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Se(r))),!0):!1}function yT(t,e,n){if(!Ut(t.state))return!1;let r=fT(n),i=t.state.selection;if(i instanceof Se){r||(r={width:1,height:1,rows:[C.from(Yc(nt(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=hT(r,a.right-a.left,a.bottom-a.top),Nm(t.state,t.dispatch,s,a,r),!0}else if(r){let o=Hs(t.state),s=o.start(-1);return Nm(t.state,t.dispatch,s,Oe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function ET(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Am(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof Se)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=dr(t.state.selection.$anchor))!=null&&((n=Gc(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=Gc(t,c),d=Fn.getState(t.state)==null;if(!u||!Zc(l,u))if(d)u=l;else return;let f=new Se(l,u);if(d||!t.state.selection.eq(f)){let p=t.state.tr.setSelection(f);d&&p.setMeta(Fn,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Fn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Fn,-1))}function a(l){let c=l,u=Fn.getState(t.state),d;if(u!=null)d=t.state.doc.resolve(u);else if(Am(t,c.target)!=r&&(d=Gc(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 Am(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Gc(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&&dr(t.state.doc.resolve(r))||dr(t.state.doc.resolve(i))}var kT=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")),Jc(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,Jc(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Jc(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 wT(-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)=>{ST(s,a,t,i)},mouseleave:s=>{xT(s)},mousedown:(s,a)=>{_T(s,a,e,n)}},decorations:s=>{let a=Tt.getState(s);if(a&&a.activeHandle>-1)return vT(s,a.activeHandle)},nodeViews:{}}});return o}var wT=class $s{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 $s(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new $s(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return jc(e.doc.resolve(i))||(i=-1),new $s(i,n.dragging)}return n}};function ST(t,e,n,r){if(!t.editable)return;let i=Tt.getState(t.state);if(i&&!i.dragging){let o=CT(e.target),s=-1;if(o){let{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=vm(t,e,"left",n):l-e.clientX<=n&&(s=vm(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}Ym(t,s)}}}function xT(t){if(!t.editable)return;let e=Tt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ym(t,-1)}function _T(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=TT(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&&(NT(t,f.activeHandle,Mm(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=Mm(f.dragging,d,n);Om(t,f.activeHandle,p,r)}}return Om(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function TT(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 RT(t,e,n,r,i){let o=OT(t),s=[],a=[];for(let c=0;c{let{selection:e}=t.state;if(!IT(e))return!1;let n=0,r=nc(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},Qm=ae.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:ru,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}=MT(t,this.options.cellMinWidth),o=["table",ee(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=RT(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})=>Bm(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>zm(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Fm(t,e),addRowBefore:()=>({state:t,dispatch:e})=>$m(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Hm(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wm(t,e),deleteTable:()=>({state:t,dispatch:e})=>Vm(t,e),mergeCells:()=>({state:t,dispatch:e})=>Qc(t,e),splitCell:()=>({state:t,dispatch:e})=>eu(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})=>Gm(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Qc(t,e)?!0:eu(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Km(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>tu(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>tu(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Xc(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=Se.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:Ws,"Mod-Backspace":Ws,Delete:Ws,"Mod-Delete":Ws}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[jm({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Jm({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:re(F(t,"tableRole",e))}}});var eg=ae.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ee(this.options.HTMLAttributes,t),0]}});var tg=ae.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",ee(this.options.HTMLAttributes,t),0]}});var ng=ae.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",ee(this.options.HTMLAttributes,t),0]}});var DT=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,rg=ae.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",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[qo({find:DT,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var ig=ae.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",ee(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 LT=/^\s*(\[([( |x])?\])\s$/,og=ae.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",ee(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[qt({find:LT,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});function PT(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"],T={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},A={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},R=[A,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:R.concat([{begin:/\(/,end:/\)/,keywords:T,contains:R.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,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:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:T,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:T,illegal:"",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function sg(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=PT(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 ag(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._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],T=["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"],A=["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:[...w,..._,"set","shopt",...T,...A]},contains:[p,t.SHEBANG(),h,d,o,s,b,a,l,c,u,n]}}function lg(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],w={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},_={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 cg(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"],T={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},A={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},R=[A,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:R.concat([{begin:/\(/,end:/\)/,keywords:T,contains:R.concat(["self"]),relevance:0}]),relevance:0},B={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,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:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:T,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:T,illegal:"",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function ug(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]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},_=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",T={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,w,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,w,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:"("+_+"\\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,w],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]},T]}}var BT=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_-]*/}}),zT=["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"],FT=["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"],UT=[...zT,...FT],$T=["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(),HT=["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(),WT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),KT=["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 dg(t){let e=t.regex,n=BT(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:":("+HT.join("|")+")"},{begin:":(:)?("+WT.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+KT.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:$T.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+UT.join("|")+")\\b"}]}}function fg(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 pg(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:"bg(t,e,n-1))}function yg(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+bg("(?:<"+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,gg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},gg,c]}}var Eg="[A-Za-z$_][0-9A-Za-z$_]*",GT=["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"],VT=["true","false","null","undefined","NaN","Infinity"],kg=["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"],wg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],qT=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],jT=[].concat(Sg,kg,wg);function xg(t){let e=t.regex,n=(S,{after:P})=>{let $="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,P)=>{let $=S[0].length+S.index,U=S.input[$];if(U==="<"||U===","){P.ignoreMatch();return}U===">"&&(n(S,{after:$})||P.ignoreMatch());let oe,se=S.input.substring($);if(oe=se.match(/^\s*=/)){P.ignoreMatch();return}if((oe=se.match(/^\s+extends\s+/))&&oe.index===0){P.ignoreMatch();return}}},a={$pattern:Eg,keyword:GT,literal:VT,built_in:jT,"variable.language":qT},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]},w={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]},_=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},d];f.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});let T=[].concat(w,f.contains),A=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:A},D={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"}}]},B={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:{_:[...kg,...wg]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function he(S){return e.concat("(?!",S.join("|"),")")}let we={match:e.concat(/\b/,he([...Sg,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},de={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},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:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,w,{match:/\$\d+/},d,B,{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:[w,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:A}]}]},{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"]}]}]},Ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},we,X,D,de,{match:/\$[(.]/}]}}function _g(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])*",Vs=`\\.(${jr})`,qs="[0-9a-fA-F](_*[0-9a-fA-F])*",YT={className:"number",variants:[{begin:`(\\b(${jr})((${Vs})|\\.)?|(${Vs}))[eE][+-]?(${jr})[fFdD]?\\b`},{begin:`\\b(${jr})((${Vs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Vs})[fFdD]?\\b`},{begin:`\\b(${jr})[fFdD]\\b`},{begin:`\\b0[xX]((${qs})\\.?|(${qs})?\\.(${qs}))[pP][+-]?(${jr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${qs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Tg(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=YT,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 JT=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_-]*/}}),ZT=["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"],XT=["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"],QT=[...ZT,...XT],eC=["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(),Cg=["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(),Ng=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),tC=["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(),nC=Cg.concat(Ng).sort().reverse();function Ag(t){let e=JT(t),n=nC,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(_){return{className:"string",begin:"~?"+_+".*?"+_}},c=function(_,T,A){return{className:_,begin:T,relevance:A}},u={$pattern:/[a-z-]+/,keyword:r,attribute:eC.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("+tC.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("+QT.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:":("+Cg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ng.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,w,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function vg(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 Mg(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 Rg(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 Ig(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 w=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,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 Dg(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":(ce,de)=>{de.data._beginMatch=ce[1]||ce[2]},"on:end":(ce,de)=>{de.data._beginMatch!==ce[1]&&de.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"],w=["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"],T={keyword:b,literal:(ce=>{let de=[];return ce.forEach(x=>{de.push(x),x.toLowerCase()===x?de.push(x.toUpperCase()):de.push(x.toLowerCase())}),de})(g),built_in:w},A=ce=>ce.map(de=>de.replace(/\|\d+$/,"")),R={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",A(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},D=e.concat(r,"\\b(?!\\()"),B={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),D],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),D],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"}}]},K={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},Ee={relevance:0,begin:/\(/,end:/\)/,keywords:T,contains:[K,s,B,t.C_BLOCK_COMMENT_MODE,h,m,R]},X={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",A(b).join("\\b|"),"|",A(w).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[Ee]};Ee.contains.push(X);let he=[K,B,t.C_BLOCK_COMMENT_MODE,h,m,R],we={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",...he]},...he,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:T,contains:[we,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,X,B,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},R,{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:T,contains:["self",we,s,B,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 Lg(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 Pg(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Bg(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 zg(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Fg(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 Ug(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}]},R=[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=R,m.contains=R;let Ee=[{begin:/^\s*=>/,starts:{end:"$",contains:R}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:R}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(Ee).concat(c).concat(R)}}function $g(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 rC=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_-]*/}}),iC=["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"],oC=["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"],sC=[...iC,...oC],aC=["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(),lC=["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(),cC=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),uC=["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 Hg(t){let e=rC(t),n=cC,r=lC,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("+sC.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("+uC.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:aC.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 Wg(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Kg(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(A=>!u.includes(A)),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 w(A){return e.concat(/\b/,e.either(...A.map(R=>R.replace(/\s+/,"\\s+"))),/\b/)}let _={scope:"keyword",match:w(f),relevance:0};function T(A,{exceptions:R,when:D}={}){let B=D;return R=R||[],A.map(K=>K.match(/\|\d+$/)||R.includes(K)?K:B(K)?`${K}|0`:K)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:T(h,{when:A=>A.length<3}),literal:o,type:a,built_in:d},contains:[{scope:"type",match:w(s)},_,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function jg(t){return t?typeof t=="string"?t:t.source:null}function Fi(t){return ke("(?=",t,")")}function ke(...t){return t.map(n=>jg(n)).join("")}function dC(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"("+(dC(t).capture?"":"?:")+t.map(r=>jg(r)).join("|")+")"}var su=t=>ke(/\b/,t,/\w$/.test(t)?/\b/:/\B/),fC=["Protocol","Type"].map(su),Gg=["init","self"].map(su),pC=["Any","Self"],iu=["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"],Vg=["false","nil","true"],hC=["assignment","associativity","higherThan","left","lowerThan","none","right"],mC=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],qg=["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"],Yg=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]/),Jg=dt(Yg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),ou=ke(Yg,Jg,"*"),Zg=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]/),Ys=dt(Zg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Qt=ke(Zg,Ys,"*"),js=ke(/[A-Z]/,Ys,"*"),gC=["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\(/,Qt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],bC=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Xg(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,dt(...fC,...Gg)],className:{2:"keyword"}},o={match:ke(/\./,dt(...iu)),relevance:0},s=iu.filter(te=>typeof te=="string").concat(["_|0"]),a=iu.filter(te=>typeof te!="string").concat(pC).map(su),l={variants:[{className:"keyword",match:dt(...a,...Gg)}]},c={$pattern:dt(/\b\w+/,/#\w+/),keyword:s.concat(mC),literal:Vg},u=[i,o,l],d={match:ke(/\./,dt(...qg)),relevance:0},f={className:"built_in",match:ke(/\b/,dt(...qg),/(?=\()/)},p=[d,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:ou},{match:`\\.(\\.|${Jg})+`}]},g=[h,m],b="([0-9]_*)+",w="([0-9a-fA-F]_*)+",_={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(te="")=>({className:"subst",variants:[{match:ke(/\\/,te,/[0\\tnr"']/)},{match:ke(/\\/,te,/u\{[0-9a-fA-F]{1,8}\}/)}]}),A=(te="")=>({className:"subst",match:ke(/\\/,te,/[\t ]*(?:[\r\n]|\r\n)/)}),R=(te="")=>({className:"subst",label:"interpol",begin:ke(/\\/,te,/\(/),end:/\)/}),D=(te="")=>({begin:ke(te,/"""/),end:ke(/"""/,te),contains:[T(te),A(te),R(te)]}),B=(te="")=>({begin:ke(te,/"/),end:ke(/"/,te),contains:[T(te),R(te)]}),K={className:"string",variants:[D(),D("#"),D("##"),D("###"),B(),B("#"),B("##"),B("###")]},Ee=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],X={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Ee},he=te=>{let bt=ke(te,/\//),W=ke(/\//,te);return{begin:bt,end:W,contains:[...Ee,{scope:"comment",begin:`#(?!.*${W})`,end:/$/}]}},we={scope:"regexp",variants:[he("###"),he("##"),he("#"),X]},ce={match:ke(/`/,Qt,/`/)},de={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${Ys}+`},E=[ce,de,x],S={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:bC,contains:[...g,_,K]}]}},P={scope:"keyword",match:ke(/@/,dt(...gC),Fi(dt(/\(/,/\s+/)))},$={scope:"meta",match:ke(/@/,Qt)},U=[S,P,$],oe={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)/,Ys,"+")},{className:"type",match:js,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ke(/\s+&\s+/,Fi(js)),relevance:0}]},se={begin://,keywords:c,contains:[...r,...u,...U,h,oe]};oe.contains.push(se);let Ne={match:ke(Qt,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",Ne,...r,we,...u,...p,...g,_,K,...E,...U,oe]},Ae={begin://,keywords:"repeat each",contains:[...r,oe]},Nt={begin:dt(Fi(ke(Qt,/\s*:/)),Fi(ke(Qt,/\s+/,Qt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Qt}]},We={begin:/\(/,end:/\)/,keywords:c,contains:[Nt,...r,...u,...g,_,K,...U,oe,J],endsParent:!0,illegal:/["']/},tn={match:[/(func|macro)/,/\s+/,dt(ce.match,Qt,ou)],className:{1:"keyword",3:"title.function"},contains:[Ae,We,e],illegal:[/\[/,/%/]},nn={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ae,We,e],illegal:/\[|%/},xn={match:[/operator/,/\s+/,ou],className:{1:"keyword",3:"title"}},_n={begin:[/precedencegroup/,/\s+/,js],className:{1:"keyword",3:"title"},contains:[oe],keywords:[...hC,...Vg],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+/,Qt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[Ae,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:js},...u],relevance:0}]};for(let te of K.variants){let bt=te.contains.find(Y=>Y.label==="interpol");bt.keywords=c;let W=[...u,...p,...g,_,K,...E];bt.contains=[...W,{begin:/\(/,end:/\)/,contains:["self",...W]}]}return{name:"Swift",keywords:c,contains:[...r,tn,nn,ot,gt,ve,xn,_n,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},we,...u,...p,...g,_,K,...E,...U,oe,J]}}var Js="[A-Za-z$_][0-9A-Za-z$_]*",Qg=["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"],eb=["true","false","null","undefined","NaN","Infinity"],tb=["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"],nb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rb=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ib=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ob=[].concat(rb,tb,nb);function yC(t){let e=t.regex,n=(S,{after:P})=>{let $="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,P)=>{let $=S[0].length+S.index,U=S.input[$];if(U==="<"||U===","){P.ignoreMatch();return}U===">"&&(n(S,{after:$})||P.ignoreMatch());let oe,se=S.input.substring($);if(oe=se.match(/^\s*=/)){P.ignoreMatch();return}if((oe=se.match(/^\s+extends\s+/))&&oe.index===0){P.ignoreMatch();return}}},a={$pattern:Js,keyword:Qg,literal:eb,built_in:ob,"variable.language":ib},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]},w={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]},_=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},d];f.contains=_.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(_)});let T=[].concat(w,f.contains),A=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:A},D={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"}}]},B={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:{_:[...tb,...nb]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ee={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function he(S){return e.concat("(?!",S.join("|"),")")}let we={match:e.concat(/\b/,he([...rb,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},de={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},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:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,w,{match:/\$\d+/},d,B,{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:[w,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:A}]}]},{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"]}]}]},Ee,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},we,X,D,de,{match:/\$[(.]/}]}}function sb(t){let e=t.regex,n=yC(t),r=Js,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:Js,keyword:Qg.concat(l),literal:eb,built_in:ob.concat(i),"variable.language":ib},u={className:"meta",begin:"@"+r},d=(m,g,b)=>{let w=m.contains.findIndex(_=>_.label===g);if(w===-1)throw new Error("can not find mode to replace");m.contains.splice(w,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 ab(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 lb(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 cb(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 ub(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 au={arduino:sg,bash:ag,c:lg,cpp:cg,csharp:ug,css:dg,diff:fg,go:pg,graphql:hg,ini:mg,java:yg,javascript:xg,json:_g,kotlin:Tg,less:Ag,lua:vg,makefile:Mg,markdown:Og,objectivec:Rg,perl:Ig,php:Dg,"php-template":Lg,plaintext:Pg,python:Bg,"python-repl":zg,r:Fg,ruby:Ug,rust:$g,scss:Hg,shell:Wg,sql:Kg,swift:Xg,typescript:sb,vbnet:ab,wasm:lb,xml:cb,yaml:ub};var Ob=vE(Mb(),1);var Rb=Ob.default;var Ib={},lN="hljs-";function bu(t){let e=Rb.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||Ib,f=typeof d.prefix=="string"?d.prefix:lN;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:gu,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||Ib).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 gu=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 Db=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var kn=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};kn.prototype.normal={};kn.prototype.property={};kn.prototype.space=void 0;function yu(t,e){let n={},r={};for(let i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new kn(n,r,e)}function Hi(t){return t.toLowerCase()}var He=class{constructor(e,n){this.attribute=n,this.property=e}};He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;var Wi={};NE(Wi,{boolean:()=>ne,booleanish:()=>Re,commaOrSpaceSeparated:()=>xt,commaSeparated:()=>$n,number:()=>v,overloadedBoolean:()=>ta,spaceSeparated:()=>ye});var cN=0,ne=mr(),Re=mr(),ta=mr(),v=mr(),ye=mr(),$n=mr(),xt=mr();function mr(){return 2**++cN}var Eu=Object.keys(Wi),gr=class extends He{constructor(e,n,r,i){let o=-1;if(super(e,n),Lb(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&dN.test(e)){if(e.charAt(4)==="-"){let o=e.slice(5).replace(zb,pN);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=e.slice(4);if(!zb.test(o)){let s=o.replace(uN,fN);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=gr}return new i(r,e)}function fN(t){return"-"+t.toLowerCase()}function pN(t){return t.charAt(1).toUpperCase()}var Fb=yu([ku,Pb,wu,Su,xu],"html"),ia=yu([ku,Bb,wu,Su,xu],"svg");var Ub={}.hasOwnProperty;function $b(t,e){let n=e||{};function r(i,...o){let s=r.invalid,a=r.handlers;if(i&&Ub.call(i,t)){let l=String(i[t]);s=Ub.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 hN=/["&'<>`]/g,mN=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,gN=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,bN=/[|\\{}()[\]^$+*?.]/g,Hb=new WeakMap;function Wb(t,e){if(t=t.replace(e.subset?yN(e.subset):hN,r),e.subset||e.escapeOnly)return t;return t.replace(mN,n).replace(gN,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 yN(t){let e=Hb.get(t);return e||(e=EN(t),Hb.set(t,e)),e}function EN(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 qb=["cent","copy","divide","gt","lt","not","para","times"];var jb={}.hasOwnProperty,Tu={},sa;for(sa in oa)jb.call(oa,sa)&&(Tu[oa[sa]]=sa);var SN=/[^\dA-Za-z]/;function Yb(t,e,n,r){let i=String.fromCharCode(t);if(jb.call(Tu,i)){let o=Tu[i],s="&"+o;return n&&Vb.includes(o)&&!qb.includes(o)&&(!r||e&&e!==61&&SN.test(String.fromCharCode(e)))?s:s+";"}return""}function Jb(t,e,n){let r=Kb(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Yb(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let o=Gb(t,e,n.omitOptionalSemicolons);o.length|^->||--!>|"],TN=["<",">"];function Zb(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return wn(o,Object.assign({},r.settings.characterReferences,{subset:TN}))}}function Xb(t,e,n,r){return""}function Cu(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 Qb(t,e){let n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function ey(t){return t.join(" ").trim()}var CN=/[ \t\n\f\r]/g;function br(t){return typeof t=="object"?t.type==="text"?ty(t.value):!1:ty(t)}function ty(t){return t.replace(CN,"")===""}var Ie=ny(1),Nu=ny(-1),NN=[];function ny(t){return e;function e(n,r,i){let o=n?n.children:NN,s=(r||0)+t,a=o[s];if(!i)for(;a&&br(a);)s+=t,a=o[s];return a}}var AN={}.hasOwnProperty;function aa(t){return e;function e(n,r,i){return AN.call(t,n.tagName)&&t[n.tagName](n,r,i)}}var Ki=aa({body:MN,caption:Au,colgroup:Au,dd:DN,dt:IN,head:Au,html:vN,li:RN,optgroup:LN,option:PN,p:ON,rp:ry,rt:ry,tbody:zN,td:iy,tfoot:FN,th:iy,thead:BN,tr:UN});function Au(t,e,n){let r=Ie(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&br(r.value.charAt(0)))}function vN(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function MN(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function ON(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 RN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="li"}function IN(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function DN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function ry(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function LN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function PN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function BN(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function zN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function FN(t,e,n){return!Ie(n,e)}function UN(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function iy(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var oy=aa({body:WN,colgroup:KN,head:HN,html:$N,tbody:GN});function $N(t){let e=Ie(t,-1);return!e||e.type!=="comment"}function HN(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 WN(t){let e=Ie(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&br(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function KN(t,e,n){let r=Nu(n,e),i=Ie(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Ki(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function GN(t,e,n){let r=Nu(n,e),i=Ie(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Ki(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var la={name:[[` +3. "-" cannot repeat`);_e.customSchemes.push([t,e])}function Px(){_e.scanner=vx(_e.customSchemes);for(let t=0;t<_e.tokenQueue.length;t++)_e.tokenQueue[t][1]({scanner:_e.scanner});_e.parser=Rx(_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 Ps(t){return _e.initialized||Px(),Ix(_e.parser.start,t,Em(_e.scanner.start,t))}Ps.scan=Em;function Wc(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 Hc(n),i=Ps(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=ih(n.doc,[...e]);if(sh(a).forEach(({newRange:c})=>{let u=oh(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(!zx.test(p))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){let p=f.split(Bx).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=Ps(h).map(b=>b.toObject(t.defaultProtocol));if(!Ux(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=>{Go(b.from,b.to,r.doc).some(w=>w.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function $x(t){return new fe({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=ic(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 Wx(t){return new fe({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=Wc(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 ur(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(Fx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Sm=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"){$c(t);return}$c(t.scheme,t.optionalSlashes)})},onDestroy(){wm()},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)=>!!ur(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=>!!ur(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=>!!ur(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",te(this.options.HTMLAttributes,t),0]:["a",te(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ur(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=>!!ur(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[Dt({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=Wc(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!ur(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(Hx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ur(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push($x({type:this.type})),this.options.linkOnPaste&&t.push(Wx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var Gc,qc;if(typeof WeakMap<"u"){let t=new WeakMap;Gc=e=>t.get(e),qc=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;Gc=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 N=0;Nr&&(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 Gx(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 jx(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 Ut(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 $s(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=dr(e.$head)||Yx(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Yx(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 jc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Zx(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Jc(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Rm(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 fr(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 Im(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 Rr(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(jc(r)&&jc(i)&&Jc(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?En.rowSelection(r,i):o&&this.isColSelection()?En.colSelection(r,i):new En(r,i)}return V.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=fr(b,0,m)),g>0&&(b=fr(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 En&&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(et.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Pe.create(t.doc,e)}function e_({$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 t_({$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 n_(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof G&&(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 V&&e_(r)?o=V.create(i,r.from):r instanceof V&&t_(r)&&(o=V.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var r_=new xe("fix-tables");function Lm(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=i_(t,i,o,n))};return e?e.doc!=t.doc&&Lm(e.doc,t.doc,0,r):t.doc.descendants(r),n}function i_(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;Jx(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;s_(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=xm(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 eu(t,e){let n=nt(t.schema);return c_(({node:r})=>n[r.type.spec.tableRole])(t,e)}function c_(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=jx(r.$from),!i)return!1;o=(s=dr(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=Xt(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 u_(t){return function(e,n){if(!Ut(e))return!1;if(n){let r=nt(e.schema),i=Xt(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 AO=Gr("row",{useDeprecatedLogic:!0}),vO=Gr("column",{useDeprecatedLogic:!0}),Vm=Gr("cell",{useDeprecatedLogic:!0});function d_(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 Bs(t,e){let n=t.selection;if(!(n instanceof we))return!1;if(e){let r=t.tr,i=nt(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 L(i,0,0))}),r.docChanged&&e(r)}return!0}function f_(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(T.empty),n[i]r&&(f=f.type.createChecked(fr(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(T.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function m_(t,e,n,r,i,o,s){let a=t.doc.type.schema,l=nt(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,T.from(d)),p=[];for(let h=e.height;h{if(!i)return!1;let o=n.selection;if(o instanceof we)return Us(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 Us(n,r,q.near(n.doc.resolve(o.head+e),e));{let a=n.doc.resolve(s),l=Rm(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),Us(n,r,c)}}}function Fs(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=Rm(s.$headCell,t,e);return a?Us(n,r,new we(s.$anchorCell,a)):!1}}function b_(t,e){let n=t.state.doc,r=dr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new we(r))),!0):!1}function y_(t,e,n){if(!Ut(t.state))return!1;let r=f_(n),i=t.state.selection;if(i instanceof we){r||(r={width:1,height:1,rows:[T.from(Yc(nt(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=h_(r,a.right-a.left,a.bottom-a.top),Nm(t.state,t.dispatch,s,a,r),!0}else if(r){let o=$s(t.state),s=o.start(-1);return Nm(t.state,t.dispatch,s,Oe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function E_(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Am(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=dr(t.state.selection.$anchor))!=null&&((n=Vc(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=Vc(t,c),d=Fn.getState(t.state)==null;if(!u||!Jc(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(Fn,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Fn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Fn,-1))}function a(l){let c=l,u=Fn.getState(t.state),d;if(u!=null)d=t.state.doc.resolve(u);else if(Am(t,c.target)!=r&&(d=Vc(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 V))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 Am(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Vc(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&&dr(t.state.doc.resolve(r))||dr(t.state.doc.resolve(i))}var k_=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")),Zc(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,Zc(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Zc(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 w_(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=Ct.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{S_(s,a,t,i)},mouseleave:s=>{x_(s)},mousedown:(s,a)=>{__(s,a,e,n)}},decorations:s=>{let a=Ct.getState(s);if(a&&a.activeHandle>-1)return v_(s,a.activeHandle)},nodeViews:{}}});return o}var w_=class Hs{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Ct);if(r&&r.setHandle!=null)return new Hs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Hs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return jc(e.doc.resolve(i))||(i=-1),new Hs(i,n.dragging)}return n}};function S_(t,e,n,r){if(!t.editable)return;let i=Ct.getState(t.state);if(i&&!i.dragging){let o=T_(e.target),s=-1;if(o){let{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=vm(t,e,"left",n):l-e.clientX<=n&&(s=vm(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}Ym(t,s)}}}function x_(t){if(!t.editable)return;let e=Ct.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ym(t,-1)}function __(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=Ct.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let a=t.state.doc.nodeAt(s.activeHandle),l=C_(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ct,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);let f=Ct.getState(t.state);f?.dragging&&(N_(t,f.activeHandle,Mm(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ct,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Ct.getState(t.state);if(f&&f.dragging){let p=Mm(f.dragging,d,n);Om(t,f.activeHandle,p,r)}}return Om(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function C_(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 R_(t,e,n,r,i){let o=O_(t),s=[],a=[];for(let c=0;c{let{selection:e}=t.state;if(!I_(e))return!1;let n=0,r=nc(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},Qm=le.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:ru,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}=M_(t,this.options.cellMinWidth),o=["table",te(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=R_(o.schema,t,e,n);if(i){let a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(V.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Bm(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>zm(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Fm(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Hm(t,e),addRowAfter:()=>({state:t,dispatch:e})=>$m(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wm(t,e),deleteTable:()=>({state:t,dispatch:e})=>Gm(t,e),mergeCells:()=>({state:t,dispatch:e})=>Qc(t,e),splitCell:()=>({state:t,dispatch:e})=>eu(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Gr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Gr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Vm(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Qc(t,e)?!0:eu(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Km(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>tu(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>tu(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Xc(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:Ws,"Mod-Backspace":Ws,Delete:Ws,"Mod-Delete":Ws}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[jm({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Zm({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ie(U(t,"tableRole",e))}}});var eg=le.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",te(this.options.HTMLAttributes,t),0]}});var tg=le.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",te(this.options.HTMLAttributes,t),0]}});var ng=le.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",te(this.options.HTMLAttributes,t),0]}});var D_=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,rg=le.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",te(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[qo({find:D_,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var ig=le.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",te(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 L_=/^\s*(\[([( |x])?\])\s$/,og=le.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",te(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[qt({find:L_,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});function P_(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},N={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},v=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:v.concat([{begin:/\(/,end:/\)/,keywords:_,contains:v.concat(["self"]),relevance:0}]),relevance:0},B={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 sg(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=P_(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 ag(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._-]+)+/},w=["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"],N=["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:[...w,...C,"set","shopt",..._,...N]},contains:[p,t.SHEBANG(),h,d,o,s,b,a,l,c,u,n]}}function lg(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],w={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 cg(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},N={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},v=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:v.concat([{begin:/\(/,end:/\)/,keywords:_,contains:v.concat(["self"]),relevance:0}]),relevance:0},B={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=["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]},w={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,w,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,w,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,w],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 B_=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_-]*/}}),z_=["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"],F_=["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"],U_=[...z_,...F_],H_=["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(),$_=["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(),W_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),K_=["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 dg(t){let e=t.regex,n=B_(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:":("+$_.join("|")+")"},{begin:":(:)?("+W_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+K_.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:H_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+U_.join("|")+")\\b"}]}}function fg(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 pg(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:"bg(t,e,n-1))}function yg(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+bg("(?:<"+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,gg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},gg,c]}}var Eg="[A-Za-z$_][0-9A-Za-z$_]*",V_=["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"],G_=["true","false","null","undefined","NaN","Infinity"],kg=["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"],wg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],q_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],j_=[].concat(Sg,kg,wg);function xg(t){let e=t.regex,n=(S,{after:P})=>{let F="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,P)=>{let F=S[0].length+S.index,H=S.input[F];if(H==="<"||H===","){P.ignoreMatch();return}H===">"&&(n(S,{after:F})||P.ignoreMatch());let se,ae=S.input.substring(F);if(se=ae.match(/^\s*=/)){P.ignoreMatch();return}if((se=ae.match(/^\s+extends\s+/))&&se.index===0){P.ignoreMatch();return}}},a={$pattern:Eg,keyword:V_,literal:G_,built_in:j_,"variable.language":q_},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]},w={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(w,f.contains),N=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(_)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},D={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"}}]},B={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:{_:[...kg,...wg]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ye={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},ue={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ke(S){return e.concat("(?!",S.join("|"),")")}let Te={match:e.concat(/\b/,ke([...Sg,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Q={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},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:[v]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,w,{match:/\$\d+/},d,B,{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:[w,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:N}]}]},{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"]}]}]},ye,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},Te,ue,D,Q,{match:/\$[(.]/}]}}function _g(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])*",Gs=`\\.(${jr})`,qs="[0-9a-fA-F](_*[0-9a-fA-F])*",Y_={className:"number",variants:[{begin:`(\\b(${jr})((${Gs})|\\.)?|(${Gs}))[eE][+-]?(${jr})[fFdD]?\\b`},{begin:`\\b(${jr})((${Gs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Gs})[fFdD]?\\b`},{begin:`\\b(${jr})[fFdD]\\b`},{begin:`\\b0[xX]((${qs})\\.?|(${qs})?\\.(${qs}))[pP][+-]?(${jr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${qs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Cg(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=Y_,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 Z_=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_-]*/}}),J_=["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"],X_=["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"],Q_=[...J_,...X_],eC=["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(),Tg=["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(),Ng=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),tC=["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(),nC=Tg.concat(Ng).sort().reverse();function Ag(t){let e=Z_(t),n=nC,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(C){return{className:"string",begin:"~?"+C+".*?"+C}},c=function(C,_,N){return{className:C,begin:_,relevance:N}},u={$pattern:/[a-z-]+/,keyword:r,attribute:eC.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("+tC.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("+Q_.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:":("+Tg.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ng.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,w,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function vg(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 Mg(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 Rg(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 Ig(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 w=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,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 Dg(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":(Z,Q)=>{Q.data._beginMatch=Z[1]||Z[2]},"on:end":(Z,Q)=>{Q.data._beginMatch!==Z[1]&&Q.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"],w=["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:(Z=>{let Q=[];return Z.forEach(x=>{Q.push(x),x.toLowerCase()===x?Q.push(x.toUpperCase()):Q.push(x.toLowerCase())}),Q})(g),built_in:w},N=Z=>Z.map(Q=>Q.replace(/\|\d+$/,"")),v={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",N(w).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},D=e.concat(r,"\\b(?!\\()"),B={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),D],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),D],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"}}]},K={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},ye={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[K,s,B,t.C_BLOCK_COMMENT_MODE,h,m,v]},ue={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",N(b).join("\\b|"),"|",N(w).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[ye]};ye.contains.push(ue);let ke=[K,B,t.C_BLOCK_COMMENT_MODE,h,m,v],Te={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",...ke]},...ke,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:_,contains:[Te,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,ue,B,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},v,{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",Te,s,B,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 Lg(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 Pg(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Bg(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 zg(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Fg(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 Ug(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}]},v=[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=v,m.contains=v;let ye=[{begin:/^\s*=>/,starts:{end:"$",contains:v}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:v}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(ye).concat(c).concat(v)}}function Hg(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 rC=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_-]*/}}),iC=["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"],oC=["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"],sC=[...iC,...oC],aC=["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(),lC=["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(),cC=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),uC=["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 $g(t){let e=rC(t),n=cC,r=lC,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("+sC.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("+uC.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:aC.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 Wg(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Kg(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(N=>!u.includes(N)),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 w(N){return e.concat(/\b/,e.either(...N.map(v=>v.replace(/\s+/,"\\s+"))),/\b/)}let C={scope:"keyword",match:w(f),relevance:0};function _(N,{exceptions:v,when:D}={}){let B=D;return v=v||[],N.map(K=>K.match(/\|\d+$/)||v.includes(K)?K:B(K)?`${K}|0`:K)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(h,{when:N=>N.length<3}),literal:o,type:a,built_in:d},contains:[{scope:"type",match:w(s)},C,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function jg(t){return t?typeof t=="string"?t:t.source:null}function Fi(t){return Ee("(?=",t,")")}function Ee(...t){return t.map(n=>jg(n)).join("")}function dC(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"("+(dC(t).capture?"":"?:")+t.map(r=>jg(r)).join("|")+")"}var su=t=>Ee(/\b/,t,/\w$/.test(t)?/\b/:/\B/),fC=["Protocol","Type"].map(su),Vg=["init","self"].map(su),pC=["Any","Self"],iu=["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"],Gg=["false","nil","true"],hC=["assignment","associativity","higherThan","left","lowerThan","none","right"],mC=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],qg=["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"],Yg=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]/),Zg=dt(Yg,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),ou=Ee(Yg,Zg,"*"),Jg=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]/),Ys=dt(Jg,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Qt=Ee(Jg,Ys,"*"),js=Ee(/[A-Z]/,Ys,"*"),gC=["attached","autoclosure",Ee(/convention\(/,dt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ee(/objc\(/,Qt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],bC=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Xg(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,dt(...fC,...Vg)],className:{2:"keyword"}},o={match:Ee(/\./,dt(...iu)),relevance:0},s=iu.filter(ne=>typeof ne=="string").concat(["_|0"]),a=iu.filter(ne=>typeof ne!="string").concat(pC).map(su),l={variants:[{className:"keyword",match:dt(...a,...Vg)}]},c={$pattern:dt(/\b\w+/,/#\w+/),keyword:s.concat(mC),literal:Gg},u=[i,o,l],d={match:Ee(/\./,dt(...qg)),relevance:0},f={className:"built_in",match:Ee(/\b/,dt(...qg),/(?=\()/)},p=[d,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:ou},{match:`\\.(\\.|${Zg})+`}]},g=[h,m],b="([0-9]_*)+",w="([0-9a-fA-F]_*)+",C={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(ne="")=>({className:"subst",variants:[{match:Ee(/\\/,ne,/[0\\tnr"']/)},{match:Ee(/\\/,ne,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(ne="")=>({className:"subst",match:Ee(/\\/,ne,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(ne="")=>({className:"subst",label:"interpol",begin:Ee(/\\/,ne,/\(/),end:/\)/}),D=(ne="")=>({begin:Ee(ne,/"""/),end:Ee(/"""/,ne),contains:[_(ne),N(ne),v(ne)]}),B=(ne="")=>({begin:Ee(ne,/"/),end:Ee(/"/,ne),contains:[_(ne),v(ne)]}),K={className:"string",variants:[D(),D("#"),D("##"),D("###"),B(),B("#"),B("##"),B("###")]},ye=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],ue={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:ye},ke=ne=>{let bt=Ee(ne,/\//),W=Ee(/\//,ne);return{begin:bt,end:W,contains:[...ye,{scope:"comment",begin:`#(?!.*${W})`,end:/$/}]}},Te={scope:"regexp",variants:[ke("###"),ke("##"),ke("#"),ue]},Z={match:Ee(/`/,Qt,/`/)},Q={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${Ys}+`},E=[Z,Q,x],S={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:bC,contains:[...g,C,K]}]}},P={scope:"keyword",match:Ee(/@/,dt(...gC),Fi(dt(/\(/,/\s+/)))},F={scope:"meta",match:Ee(/@/,Qt)},H=[S,P,F],se={match:Fi(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ee(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ys,"+")},{className:"type",match:js,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ee(/\s+&\s+/,Fi(js)),relevance:0}]},ae={begin://,keywords:c,contains:[...r,...u,...H,h,se]};se.contains.push(ae);let Ne={match:Ee(Qt,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",Ne,...r,Te,...u,...p,...g,C,K,...E,...H,se]},Ae={begin://,keywords:"repeat each",contains:[...r,se]},Nt={begin:dt(Fi(Ee(Qt,/\s*:/)),Fi(Ee(Qt,/\s+/,Qt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Qt}]},We={begin:/\(/,end:/\)/,keywords:c,contains:[Nt,...r,...u,...g,C,K,...H,se,J],endsParent:!0,illegal:/["']/},tn={match:[/(func|macro)/,/\s+/,dt(Z.match,Qt,ou)],className:{1:"keyword",3:"title.function"},contains:[Ae,We,e],illegal:[/\[/,/%/]},nn={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ae,We,e],illegal:/\[|%/},xn={match:[/operator/,/\s+/,ou],className:{1:"keyword",3:"title"}},_n={begin:[/precedencegroup/,/\s+/,js],className:{1:"keyword",3:"title"},contains:[se],keywords:[...hC,...Gg],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+/,Qt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[Ae,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:js},...u],relevance:0}]};for(let ne of K.variants){let bt=ne.contains.find(Y=>Y.label==="interpol");bt.keywords=c;let W=[...u,...p,...g,C,K,...E];bt.contains=[...W,{begin:/\(/,end:/\)/,contains:["self",...W]}]}return{name:"Swift",keywords:c,contains:[...r,tn,nn,ot,gt,ve,xn,_n,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},Te,...u,...p,...g,C,K,...E,...H,se,J]}}var Zs="[A-Za-z$_][0-9A-Za-z$_]*",Qg=["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"],eb=["true","false","null","undefined","NaN","Infinity"],tb=["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"],nb=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rb=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ib=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ob=[].concat(rb,tb,nb);function yC(t){let e=t.regex,n=(S,{after:P})=>{let F="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,P)=>{let F=S[0].length+S.index,H=S.input[F];if(H==="<"||H===","){P.ignoreMatch();return}H===">"&&(n(S,{after:F})||P.ignoreMatch());let se,ae=S.input.substring(F);if(se=ae.match(/^\s*=/)){P.ignoreMatch();return}if((se=ae.match(/^\s+extends\s+/))&&se.index===0){P.ignoreMatch();return}}},a={$pattern:Zs,keyword:Qg,literal:eb,built_in:ob,"variable.language":ib},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]},w={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(w,f.contains),N=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(_)}]),v={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},D={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"}}]},B={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:{_:[...tb,...nb]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ye={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[v],illegal:/%/},ue={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ke(S){return e.concat("(?!",S.join("|"),")")}let Te={match:e.concat(/\b/,ke([...rb,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Q={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},v]},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:[v]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:B},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,w,{match:/\$\d+/},d,B,{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:[w,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:N}]}]},{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"]}]}]},ye,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[v,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[v]},Te,ue,D,Q,{match:/\$[(.]/}]}}function sb(t){let e=t.regex,n=yC(t),r=Zs,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:Zs,keyword:Qg.concat(l),literal:eb,built_in:ob.concat(i),"variable.language":ib},u={className:"meta",begin:"@"+r},d=(m,g,b)=>{let w=m.contains.findIndex(C=>C.label===g);if(w===-1)throw new Error("can not find mode to replace");m.contains.splice(w,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 ab(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 lb(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 cb(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 ub(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 au={arduino:sg,bash:ag,c:lg,cpp:cg,csharp:ug,css:dg,diff:fg,go:pg,graphql:hg,ini:mg,java:yg,javascript:xg,json:_g,kotlin:Cg,less:Ag,lua:vg,makefile:Mg,markdown:Og,objectivec:Rg,perl:Ig,php:Dg,"php-template":Lg,plaintext:Pg,python:Bg,"python-repl":zg,r:Fg,ruby:Ug,rust:Hg,scss:$g,shell:Wg,sql:Kg,swift:Xg,typescript:sb,vbnet:ab,wasm:lb,xml:cb,yaml:ub};var Ob=vE(Mb(),1);var Rb=Ob.default;var Ib={},lT="hljs-";function bu(t){let e=Rb.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||Ib,f=typeof d.prefix=="string"?d.prefix:lT;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:gu,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||Ib).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 gu=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 Db=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var kn=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};kn.prototype.normal={};kn.prototype.property={};kn.prototype.space=void 0;function yu(t,e){let n={},r={};for(let i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new kn(n,r,e)}function $i(t){return t.toLowerCase()}var $e=class{constructor(e,n){this.attribute=n,this.property=e}};$e.prototype.attribute="";$e.prototype.booleanish=!1;$e.prototype.boolean=!1;$e.prototype.commaOrSpaceSeparated=!1;$e.prototype.commaSeparated=!1;$e.prototype.defined=!1;$e.prototype.mustUseProperty=!1;$e.prototype.number=!1;$e.prototype.overloadedBoolean=!1;$e.prototype.property="";$e.prototype.spaceSeparated=!1;$e.prototype.space=void 0;var Wi={};NE(Wi,{boolean:()=>re,booleanish:()=>Re,commaOrSpaceSeparated:()=>xt,commaSeparated:()=>Hn,number:()=>M,overloadedBoolean:()=>ta,spaceSeparated:()=>be});var cT=0,re=mr(),Re=mr(),ta=mr(),M=mr(),be=mr(),Hn=mr(),xt=mr();function mr(){return 2**++cT}var Eu=Object.keys(Wi),gr=class extends $e{constructor(e,n,r,i){let o=-1;if(super(e,n),Lb(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&dT.test(e)){if(e.charAt(4)==="-"){let o=e.slice(5).replace(zb,pT);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=e.slice(4);if(!zb.test(o)){let s=o.replace(uT,fT);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=gr}return new i(r,e)}function fT(t){return"-"+t.toLowerCase()}function pT(t){return t.charAt(1).toUpperCase()}var Fb=yu([ku,Pb,wu,Su,xu],"html"),ia=yu([ku,Bb,wu,Su,xu],"svg");var Ub={}.hasOwnProperty;function Hb(t,e){let n=e||{};function r(i,...o){let s=r.invalid,a=r.handlers;if(i&&Ub.call(i,t)){let l=String(i[t]);s=Ub.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 hT=/["&'<>`]/g,mT=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,gT=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,bT=/[|\\{}()[\]^$+*?.]/g,$b=new WeakMap;function Wb(t,e){if(t=t.replace(e.subset?yT(e.subset):hT,r),e.subset||e.escapeOnly)return t;return t.replace(mT,n).replace(gT,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 yT(t){let e=$b.get(t);return e||(e=ET(t),$b.set(t,e)),e}function ET(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 qb=["cent","copy","divide","gt","lt","not","para","times"];var jb={}.hasOwnProperty,Cu={},sa;for(sa in oa)jb.call(oa,sa)&&(Cu[oa[sa]]=sa);var ST=/[^\dA-Za-z]/;function Yb(t,e,n,r){let i=String.fromCharCode(t);if(jb.call(Cu,i)){let o=Cu[i],s="&"+o;return n&&Gb.includes(o)&&!qb.includes(o)&&(!r||e&&e!==61&&ST.test(String.fromCharCode(e)))?s:s+";"}return""}function Zb(t,e,n){let r=Kb(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Yb(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let o=Vb(t,e,n.omitOptionalSemicolons);o.length|^->||--!>|"],CT=["<",">"];function Jb(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return wn(o,Object.assign({},r.settings.characterReferences,{subset:CT}))}}function Xb(t,e,n,r){return""}function Tu(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 Qb(t,e){let n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function ey(t){return t.join(" ").trim()}var TT=/[ \t\n\f\r]/g;function br(t){return typeof t=="object"?t.type==="text"?ty(t.value):!1:ty(t)}function ty(t){return t.replace(TT,"")===""}var Ie=ny(1),Nu=ny(-1),NT=[];function ny(t){return e;function e(n,r,i){let o=n?n.children:NT,s=(r||0)+t,a=o[s];if(!i)for(;a&&br(a);)s+=t,a=o[s];return a}}var AT={}.hasOwnProperty;function aa(t){return e;function e(n,r,i){return AT.call(t,n.tagName)&&t[n.tagName](n,r,i)}}var Ki=aa({body:MT,caption:Au,colgroup:Au,dd:DT,dt:IT,head:Au,html:vT,li:RT,optgroup:LT,option:PT,p:OT,rp:ry,rt:ry,tbody:zT,td:iy,tfoot:FT,th:iy,thead:BT,tr:UT});function Au(t,e,n){let r=Ie(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&br(r.value.charAt(0)))}function vT(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function MT(t,e,n){let r=Ie(n,e);return!r||r.type!=="comment"}function OT(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 RT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="li"}function IT(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function DT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function ry(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function LT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function PT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function BT(t,e,n){let r=Ie(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function zT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function FT(t,e,n){return!Ie(n,e)}function UT(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function iy(t,e,n){let r=Ie(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var oy=aa({body:WT,colgroup:KT,head:$T,html:HT,tbody:VT});function HT(t){let e=Ie(t,-1);return!e||e.type!=="comment"}function $T(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 WT(t){let e=Ie(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&br(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function KT(t,e,n){let r=Nu(n,e),i=Ie(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Ki(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function VT(t,e,n){let r=Nu(n,e),i=Ie(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Ki(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var la={name:[[` \f\r &/=>`.split(""),` \f\r "&'/=>\``.split("")],[`\0 \f\r "&'/<=>`.split(""),`\0 @@ -107,12 +107,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`),U=E,$=S),P===void 0&&( \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 sy(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=ia);let c=VN(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(s=!1),(c||!o||!oy(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||!Ki(t,e,n))&&a.push(""),a.join("")}function VN(t,e){let n=[],r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let o=qN(t,i,e[i]);o&&n.push(o)}}for(;++rCu(n,t.alternative)&&(s=t.alternative),a=s+wn(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?la.single:la.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}var jN=["<","&"];function ca(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:wn(t.value,Object.assign({},r.settings.characterReferences,{subset:jN}))}function ay(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ca(t,e,n,r)}function ly(t,e,n,r){return r.all(t)}var cy=$b("type",{invalid:YN,unknown:JN,handlers:{comment:Zb,doctype:Xb,element:sy,raw:ay,root:ly,text:ca}});function YN(t){throw new Error("Expected node, not `"+t+"`")}function JN(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var ZN={},XN={},QN=[];function vu(t,e){let n=e||ZN,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:eA,all:tA,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||Db,characterReferences:n.characterReferences||XN,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ia:Fb,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function eA(t,e,n){return cy(t,e,n,this)}function tA(t){let e=[],n=t&&t.children||QN,r=-1;for(;++rnull};function pe(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 nA=(()=>{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")},rA=/^(?:[ \t]*(?:\n|$))+/,iA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Du=/(?:[*+-]|\d{1,9}[.)])/,by=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yy=pe(by).replace(/bull/g,Du).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(),aA=pe(by).replace(/bull/g,Du).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(),Lu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lA=/^[^\n]+/,Pu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cA=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uA=pe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Du).getRegex(),ha="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",Bu=/|$))/,dA=pe("^ {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",Bu).replace("tag",ha).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ey=pe(Lu).replace("hr",Yi).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",ha).getRegex(),fA=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ey).getRegex(),zu={blockquote:fA,code:iA,def:cA,fences:oA,heading:sA,hr:Yi,html:dA,lheading:yy,list:uA,newline:rA,paragraph:Ey,table:ji,text:lA},uy=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yi).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",ha).getRegex(),pA={...zu,lheading:aA,table:uy,paragraph:pe(Lu).replace("hr",Yi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uy).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",ha).getRegex()},hA={...zu,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Bu).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:pe(Lu).replace("hr",Yi).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",yy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gA=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ky=/^( {2,}|\\)\n(?!\s*$)/,bA=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",nA?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,SA=pe(xy,"u").replace(/punct/g,ma).getRegex(),xA=pe(xy,"u").replace(/punct/g,Sy).getRegex(),_y="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_A=pe(_y,"gu").replace(/notPunctSpace/g,wy).replace(/punctSpace/g,Fu).replace(/punct/g,ma).getRegex(),TA=pe(_y,"gu").replace(/notPunctSpace/g,kA).replace(/punctSpace/g,EA).replace(/punct/g,Sy).getRegex(),CA=pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wy).replace(/punctSpace/g,Fu).replace(/punct/g,ma).getRegex(),NA=pe(/\\(punct)/,"gu").replace(/punct/g,ma).getRegex(),AA=pe(/^<(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(),vA=pe(Bu).replace("(?:-->|$)","-->").getRegex(),MA=pe("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",vA).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),da=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,OA=pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",da).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ty=pe(/^!?\[(label)\]\[(ref)\]/).replace("label",da).replace("ref",Pu).getRegex(),Cy=pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pu).getRegex(),RA=pe("reflink|nolink(?!\\()","g").replace("reflink",Ty).replace("nolink",Cy).getRegex(),dy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Uu={_backpedal:ji,anyPunctuation:NA,autolink:AA,blockSkip:wA,br:ky,code:gA,del:ji,emStrongLDelim:SA,emStrongRDelimAst:_A,emStrongRDelimUnd:CA,escape:mA,link:OA,nolink:Cy,punctuation:yA,reflink:Ty,reflinkSearch:RA,tag:MA,text:bA,url:ji},IA={...Uu,link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",da).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",da).getRegex()},Mu={...Uu,emStrongRDelimAst:TA,emStrongLDelim:xA,url:pe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dy).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:pe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},fy=t=>LA[t];function Sn(t,e){if(e){if(ft.escapeTest.test(t))return t.replace(ft.escapeReplace,fy)}else if(ft.escapeTestNoEncode.test(t))return t.replace(ft.escapeReplaceNoEncode,fy);return t}function py(t){try{t=encodeURI(t).replace(ft.percentDecode,"%")}catch{return null}return t}function hy(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 my(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 BA(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(` +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function sy(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=ia);let c=GT(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(s=!1),(c||!o||!oy(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||!Ki(t,e,n))&&a.push(""),a.join("")}function GT(t,e){let n=[],r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){let o=qT(t,i,e[i]);o&&n.push(o)}}for(;++rTu(n,t.alternative)&&(s=t.alternative),a=s+wn(n,Object.assign({},t.settings.characterReferences,{subset:(s==="'"?la.single:la.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}var jT=["<","&"];function ca(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:wn(t.value,Object.assign({},r.settings.characterReferences,{subset:jT}))}function ay(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ca(t,e,n,r)}function ly(t,e,n,r){return r.all(t)}var cy=Hb("type",{invalid:YT,unknown:ZT,handlers:{comment:Jb,doctype:Xb,element:sy,raw:ay,root:ly,text:ca}});function YT(t){throw new Error("Expected node, not `"+t+"`")}function ZT(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var JT={},XT={},QT=[];function vu(t,e){let n=e||JT,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:eN,all:tN,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||Db,characterReferences:n.characterReferences||XT,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ia:Fb,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function eN(t,e,n){return cy(t,e,n,this)}function tN(t){let e=[],n=t&&t.children||QT,r=-1;for(;++rnull};function he(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 nN=(()=>{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")},rN=/^(?:[ \t]*(?:\n|$))+/,iN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Du=/(?:[*+-]|\d{1,9}[.)])/,by=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yy=he(by).replace(/bull/g,Du).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(),aN=he(by).replace(/bull/g,Du).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(),Lu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lN=/^[^\n]+/,Pu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cN=he(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Pu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uN=he(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Du).getRegex(),ha="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",Bu=/|$))/,dN=he("^ {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",Bu).replace("tag",ha).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ey=he(Lu).replace("hr",Yi).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",ha).getRegex(),fN=he(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ey).getRegex(),zu={blockquote:fN,code:iN,def:cN,fences:oN,heading:sN,hr:Yi,html:dN,lheading:yy,list:uN,newline:rN,paragraph:Ey,table:ji,text:lN},uy=he("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yi).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",ha).getRegex(),pN={...zu,lheading:aN,table:uy,paragraph:he(Lu).replace("hr",Yi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uy).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",ha).getRegex()},hN={...zu,html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Bu).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:he(Lu).replace("hr",Yi).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",yy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ky=/^( {2,}|\\)\n(?!\s*$)/,bN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",nN?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,SN=he(xy,"u").replace(/punct/g,ma).getRegex(),xN=he(xy,"u").replace(/punct/g,Sy).getRegex(),_y="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_N=he(_y,"gu").replace(/notPunctSpace/g,wy).replace(/punctSpace/g,Fu).replace(/punct/g,ma).getRegex(),CN=he(_y,"gu").replace(/notPunctSpace/g,kN).replace(/punctSpace/g,EN).replace(/punct/g,Sy).getRegex(),TN=he("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wy).replace(/punctSpace/g,Fu).replace(/punct/g,ma).getRegex(),NN=he(/\\(punct)/,"gu").replace(/punct/g,ma).getRegex(),AN=he(/^<(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(),vN=he(Bu).replace("(?:-->|$)","-->").getRegex(),MN=he("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",vN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),da=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ON=he(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",da).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Cy=he(/^!?\[(label)\]\[(ref)\]/).replace("label",da).replace("ref",Pu).getRegex(),Ty=he(/^!?\[(ref)\](?:\[\])?/).replace("ref",Pu).getRegex(),RN=he("reflink|nolink(?!\\()","g").replace("reflink",Cy).replace("nolink",Ty).getRegex(),dy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Uu={_backpedal:ji,anyPunctuation:NN,autolink:AN,blockSkip:wN,br:ky,code:gN,del:ji,emStrongLDelim:SN,emStrongRDelimAst:_N,emStrongRDelimUnd:TN,escape:mN,link:ON,nolink:Ty,punctuation:yN,reflink:Cy,reflinkSearch:RN,tag:MN,text:bN,url:ji},IN={...Uu,link:he(/^!?\[(label)\]\((.*?)\)/).replace("label",da).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",da).getRegex()},Mu={...Uu,emStrongRDelimAst:CN,emStrongLDelim:xN,url:he(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dy).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:he(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},fy=t=>LN[t];function Sn(t,e){if(e){if(ft.escapeTest.test(t))return t.replace(ft.escapeReplace,fy)}else if(ft.escapeTestNoEncode.test(t))return t.replace(ft.escapeReplaceNoEncode,fy);return t}function py(t){try{t=encodeURI(t).replace(ft.percentDecode,"%")}catch{return null}return t}function hy(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 my(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 BN(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 fa=class{options;rules;lexer;constructor(t){this.options=t||Er}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:Vi(n,` -`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=BA(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=Vi(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:Vi(e[0],` -`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Vi(e[0],` +`)}var fa=class{options;rules;lexer;constructor(t){this.options=t||Er}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:Gi(n,` +`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=BN(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=Gi(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:Gi(e[0],` +`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Gi(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),w=this.rules.other.fencesBeginRegex(h),_=this.rules.other.headingBeginRegex(h),T=this.rules.other.htmlBeginRegex(h);for(;t;){let A=t.split(` -`,1)[0],R;if(f=A,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),R=f):R=f.replace(this.rules.other.tabCharGlobal," "),w.test(f)||_.test(f)||T.test(f)||g.test(f)||b.test(f))break;if(R.search(this.rules.other.nonSpaceChar)>=h||!f.trim())u+=` -`+R.slice(h);else{if(p||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(d)||_.test(d)||b.test(d))break;u+=` -`+f}!p&&!f.trim()&&(p=!0),c+=A+` -`,t=t.substring(A.length+1),d=R.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=hy(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`,t=t.substring(f.length+1),l=!0),!l){let g=this.rules.other.nextBulletRegex(h),b=this.rules.other.hrRegex(h),w=this.rules.other.fencesBeginRegex(h),C=this.rules.other.headingBeginRegex(h),_=this.rules.other.htmlBeginRegex(h);for(;t;){let N=t.split(` +`,1)[0],v;if(f=N,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),v=f):v=f.replace(this.rules.other.tabCharGlobal," "),w.test(f)||C.test(f)||_.test(f)||g.test(f)||b.test(f))break;if(v.search(this.rules.other.nonSpaceChar)>=h||!f.trim())u+=` +`+v.slice(h);else{if(p||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(d)||C.test(d)||b.test(d))break;u+=` +`+f}!p&&!f.trim()&&(p=!0),c+=N+` +`,t=t.substring(N.length+1),d=v.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=hy(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=Vi(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=PA(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)),my(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 my(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}}}},$t=class Ou{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Er,this.options.tokenizer=this.options.tokenizer||new fa,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:ua.normal,inline:Gi.normal};this.options.pedantic?(n.block=ua.pedantic,n.inline=Gi.pedantic):this.options.gfm&&(n.block=ua.gfm,this.options.breaks?n.inline=Gi.breaks:n.inline=Gi.gfm),this.tokenizer.rules=n}static get rules(){return{block:ua,inline:Gi}}static lex(e,n){return new Ou(n).lex(e)}static lexInline(e,n){return new Ou(n).inlineTokens(e)}lex(e){e=e.replace(ft.carriageReturn,` +`?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=Gi(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=PN(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)),my(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 my(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 Ou{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Er,this.options.tokenizer=this.options.tokenizer||new fa,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:ua.normal,inline:Vi.normal};this.options.pedantic?(n.block=ua.pedantic,n.inline=Vi.pedantic):this.options.gfm&&(n.block=ua.gfm,this.options.breaks?n.inline=Vi.breaks:n.inline=Vi.gfm),this.tokenizer.rules=n}static get rules(){return{block:ua,inline:Vi}}static lex(e,n){return new Ou(n).lex(e)}static lexInline(e,n){return new Ou(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(` `)?"":` @@ -164,10 +164,10 @@ ${this.parser.parse(t)} `}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`${Sn(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=py(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=py(t);if(i===null)return Sn(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 pa(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 fa(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 qi;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];qi.passThroughHooks.has(o)?i[s]=c=>{if(this.defaults.async&&qi.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 $t.lex(t,e??this.defaults)}parser(t,e){return Ht.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?$t.lex:$t.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?Ht.parse:Ht.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?$t.lex:$t.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?Ht.parse:Ht.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:

"+Sn(n.message+"",!0)+"
";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},yr=new zA;function ge(t,e){return yr.parse(t,e)}ge.options=ge.setOptions=function(t){return yr.setOptions(t),ge.defaults=yr.defaults,gy(ge.defaults),ge};ge.getDefaults=Iu;ge.defaults=Er;ge.use=function(...t){return yr.use(...t),ge.defaults=yr.defaults,gy(ge.defaults),ge};ge.walkTokens=function(t,e){return yr.walkTokens(t,e)};ge.parseInline=yr.parseInline;ge.Parser=Ht;ge.parser=Ht.parse;ge.Renderer=pa;ge.TextRenderer=$u;ge.Lexer=$t;ge.lexer=$t.lex;ge.Tokenizer=fa;ge.Hooks=qi;ge.parse=ge;var AL=ge.options,vL=ge.setOptions,ML=ge.use,OL=ge.walkTokens,RL=ge.parseInline;var IL=Ht.parse,DL=$t.lex;var{entries:Ly,setPrototypeOf:Ny,isFrozen:FA,getPrototypeOf:UA,getOwnPropertyDescriptor:$A}=Object,{freeze:ht,seal:zt,create:ya}=Object,{apply:ju,construct:Yu}=typeof Reflect<"u"&&Reflect;ht||(ht=function(e){return e});zt||(zt=function(e){return e});ju||(ju=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]:Ea;Ny&&Ny(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let o=n(i);o!==i&&(FA(e)||(e[r]=o),i=o)}t[i]=!0}return t}function qA(t){for(let e=0;e/gm),XA=zt(/\$\{[\w\W]*/gm),QA=zt(/^data-[\-\w.\u00B7-\uFFFF]+$/),ev=zt(/^aria-[\-\w]+$/),Py=zt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tv=zt(/^(?:\w+script|data):/i),nv=zt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),By=zt(/^html$/i),rv=zt(/^[a-z][.\w]*(-[.\w]+)+$/i),Iy=Object.freeze({__proto__:null,ARIA_ATTR:ev,ATTR_WHITESPACE:nv,CUSTOM_ELEMENT:rv,DATA_ATTR:QA,DOCTYPE_NAME:By,ERB_EXPR:ZA,IS_ALLOWED_URI:Py,IS_SCRIPT_OR_DATA:tv,MUSTACHE_EXPR:JA,TMPLIT_EXPR:XA}),eo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},iv=function(){return typeof window>"u"?null:window},ov=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}},Dy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function zy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iv(),e=j=>zy(j);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==eo.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=Qi(h,"cloneNode"),g=Qi(h,"remove"),b=Qi(h,"nextSibling"),w=Qi(h,"childNodes"),_=Qi(h,"parentNode");if(typeof s=="function"){let j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let T,A="",{implementation:R,createNodeIterator:D,createDocumentFragment:B,getElementsByTagName:K}=n,{importNode:Ee}=r,X=Dy();e.isSupported=typeof Ly=="function"&&typeof _=="function"&&R&&R.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:he,ERB_EXPR:we,TMPLIT_EXPR:ce,DATA_ATTR:de,ARIA_ATTR:x,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:P}=Iy,{IS_ALLOWED_URI:$}=Iy,U=null,oe=le({},[...vy,...Ku,...Gu,...Vu,...My]),se=null,Ne=le({},[...Oy,...qu,...Ry,...ba]),J=Object.seal(ya(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}})),Ae=null,Nt=null,We=Object.seal(ya(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),tn=!0,nn=!0,xn=!1,_n=!0,ot=!1,gt=!0,ve=!1,te=!1,bt=!1,W=!1,Y=!1,xe=!1,Q=!0,ue=!1,yt="user-content-",st=!0,_t=!1,I={},k=null,N=le({},["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=le({},["audio","video","img","source","image","track"]),be=null,Et=le({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",Sr="http://www.w3.org/2000/svg",rn="http://www.w3.org/1999/xhtml",xr=rn,xa=!1,_a=null,hE=le({},[Tn,Sr,rn],Hu),to=le({},["mi","mo","mn","ms","mtext"]),no=le({},["annotation-xml"]),mE=le({},["title","style","font","a","script"]),ei=null,gE=["application/xhtml+xml","text/html"],bE="text/html",ze=null,_r=null,yE=n.createElement("form"),sd=function(y){return y instanceof RegExp||y instanceof Function},Ta=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(_r&&_r===y)){if((!y||typeof y!="object")&&(y={}),y=en(y),ei=gE.indexOf(y.PARSER_MEDIA_TYPE)===-1?bE:y.PARSER_MEDIA_TYPE,ze=ei==="application/xhtml+xml"?Hu:Ea,U=Ct(y,"ALLOWED_TAGS")?le({},y.ALLOWED_TAGS,ze):oe,se=Ct(y,"ALLOWED_ATTR")?le({},y.ALLOWED_ATTR,ze):Ne,_a=Ct(y,"ALLOWED_NAMESPACES")?le({},y.ALLOWED_NAMESPACES,Hu):hE,be=Ct(y,"ADD_URI_SAFE_ATTR")?le(en(Et),y.ADD_URI_SAFE_ATTR,ze):Et,z=Ct(y,"ADD_DATA_URI_TAGS")?le(en(Z),y.ADD_DATA_URI_TAGS,ze):Z,k=Ct(y,"FORBID_CONTENTS")?le({},y.FORBID_CONTENTS,ze):N,Ae=Ct(y,"FORBID_TAGS")?le({},y.FORBID_TAGS,ze):en({}),Nt=Ct(y,"FORBID_ATTR")?le({},y.FORBID_ATTR,ze):en({}),I=Ct(y,"USE_PROFILES")?y.USE_PROFILES:!1,tn=y.ALLOW_ARIA_ATTR!==!1,nn=y.ALLOW_DATA_ATTR!==!1,xn=y.ALLOW_UNKNOWN_PROTOCOLS||!1,_n=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ot=y.SAFE_FOR_TEMPLATES||!1,gt=y.SAFE_FOR_XML!==!1,ve=y.WHOLE_DOCUMENT||!1,W=y.RETURN_DOM||!1,Y=y.RETURN_DOM_FRAGMENT||!1,xe=y.RETURN_TRUSTED_TYPE||!1,bt=y.FORCE_BODY||!1,Q=y.SANITIZE_DOM!==!1,ue=y.SANITIZE_NAMED_PROPS||!1,st=y.KEEP_CONTENT!==!1,_t=y.IN_PLACE||!1,$=y.ALLOWED_URI_REGEXP||Py,xr=y.NAMESPACE||rn,to=y.MATHML_TEXT_INTEGRATION_POINTS||to,no=y.HTML_INTEGRATION_POINTS||no,J=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&sd(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&sd(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&&(nn=!1),Y&&(W=!0),I&&(U=le({},My),se=ya(null),I.html===!0&&(le(U,vy),le(se,Oy)),I.svg===!0&&(le(U,Ku),le(se,qu),le(se,ba)),I.svgFilters===!0&&(le(U,Gu),le(se,qu),le(se,ba)),I.mathMl===!0&&(le(U,Vu),le(se,Ry),le(se,ba))),Ct(y,"ADD_TAGS")||(We.tagCheck=null),Ct(y,"ADD_ATTR")||(We.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?We.tagCheck=y.ADD_TAGS:(U===oe&&(U=en(U)),le(U,y.ADD_TAGS,ze))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?We.attributeCheck=y.ADD_ATTR:(se===Ne&&(se=en(se)),le(se,y.ADD_ATTR,ze))),y.ADD_URI_SAFE_ATTR&&le(be,y.ADD_URI_SAFE_ATTR,ze),y.FORBID_CONTENTS&&(k===N&&(k=en(k)),le(k,y.FORBID_CONTENTS,ze)),y.ADD_FORBID_CONTENTS&&(k===N&&(k=en(k)),le(k,y.ADD_FORBID_CONTENTS,ze)),st&&(U["#text"]=!0),ve&&le(U,["html","head","body"]),U.table&&(le(U,["tbody"]),delete Ae.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=y.TRUSTED_TYPES_POLICY,A=T.createHTML("")}else T===void 0&&(T=ov(p,i)),T!==null&&typeof A=="string"&&(A=T.createHTML(""));ht&&ht(y),_r=y}},ad=le({},[...Ku,...Gu,...jA]),ld=le({},[...Vu,...YA]),EE=function(y){let O=_(y);(!O||!O.tagName)&&(O={namespaceURI:xr,tagName:"template"});let H=Ea(y.tagName),Ce=Ea(O.tagName);return _a[y.namespaceURI]?y.namespaceURI===Sr?O.namespaceURI===rn?H==="svg":O.namespaceURI===Tn?H==="svg"&&(Ce==="annotation-xml"||to[Ce]):!!ad[H]:y.namespaceURI===Tn?O.namespaceURI===rn?H==="math":O.namespaceURI===Sr?H==="math"&&no[Ce]:!!ld[H]:y.namespaceURI===rn?O.namespaceURI===Sr&&!no[Ce]||O.namespaceURI===Tn&&!to[Ce]?!1:!ld[H]&&(mE[H]||!ad[H]):!!(ei==="application/xhtml+xml"&&_a[y.namespaceURI]):!1},Wt=function(y){Ji(e.removed,{element:y});try{_(y).removeChild(y)}catch{g(y)}},Hn=function(y,O){try{Ji(e.removed,{attribute:O.getAttributeNode(y),from:O})}catch{Ji(e.removed,{attribute:null,from:O})}if(O.removeAttribute(y),y==="is")if(W||Y)try{Wt(O)}catch{}else try{O.setAttribute(y,"")}catch{}},cd=function(y){let O=null,H=null;if(bt)y=""+y;else{let De=Wu(y,/^[\r\n\t ]+/);H=De&&De[0]}ei==="application/xhtml+xml"&&xr===rn&&(y=''+y+"");let Ce=T?T.createHTML(y):y;if(xr===rn)try{O=new f().parseFromString(Ce,ei)}catch{}if(!O||!O.documentElement){O=R.createDocument(xr,"template",null);try{O.documentElement.innerHTML=xa?A:Ce}catch{}}let Ye=O.body||O.documentElement;return y&&H&&Ye.insertBefore(n.createTextNode(H),Ye.childNodes[0]||null),xr===rn?K.call(O,ve?"html":"body")[0]:ve?O.documentElement:Ye},ud=function(y){return D.call(y.ownerDocument||y,y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ca=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")},dd=function(y){return typeof a=="function"&&y instanceof a};function on(j,y,O){ga(j,H=>{H.call(e,y,O,_r)})}let fd=function(y){let O=null;if(on(X.beforeSanitizeElements,y,null),Ca(y))return Wt(y),!0;let H=ze(y.nodeName);if(on(X.uponSanitizeElement,y,{tagName:H,allowedTags:U}),gt&&y.hasChildNodes()&&!dd(y.firstElementChild)&&pt(/<[/\w!]/g,y.innerHTML)&&pt(/<[/\w!]/g,y.textContent)||y.nodeType===eo.progressingInstruction||gt&&y.nodeType===eo.comment&&pt(/<[/\w]/g,y.data))return Wt(y),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck(H))&&(!U[H]||Ae[H])){if(!Ae[H]&&hd(H)&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,H)||J.tagNameCheck instanceof Function&&J.tagNameCheck(H)))return!1;if(st&&!k[H]){let Ce=_(y)||y.parentNode,Ye=w(y)||y.childNodes;if(Ye&&Ce){let De=Ye.length;for(let kt=De-1;kt>=0;--kt){let sn=m(Ye[kt],!0);sn.__removalCount=(y.__removalCount||0)+1,Ce.insertBefore(sn,b(y))}}}return Wt(y),!0}return y instanceof l&&!EE(y)||(H==="noscript"||H==="noembed"||H==="noframes")&&pt(/<\/no(script|embed|frames)/i,y.innerHTML)?(Wt(y),!0):(ot&&y.nodeType===eo.text&&(O=y.textContent,ga([he,we,ce],Ce=>{O=Zi(O,Ce," ")}),y.textContent!==O&&(Ji(e.removed,{element:y.cloneNode()}),y.textContent=O)),on(X.afterSanitizeElements,y,null),!1)},pd=function(y,O,H){if(Nt[O]||Q&&(O==="id"||O==="name")&&(H in n||H in yE))return!1;if(!(nn&&!Nt[O]&&pt(de,O))){if(!(tn&&pt(x,O))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(O,y))){if(!se[O]||Nt[O]){if(!(hd(y)&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,y)||J.tagNameCheck instanceof Function&&J.tagNameCheck(y))&&(J.attributeNameCheck instanceof RegExp&&pt(J.attributeNameCheck,O)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(O,y))||O==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,H)||J.tagNameCheck instanceof Function&&J.tagNameCheck(H))))return!1}else if(!be[O]){if(!pt($,Zi(H,S,""))){if(!((O==="src"||O==="xlink:href"||O==="href")&&y!=="script"&&KA(H,"data:")===0&&z[y])){if(!(xn&&!pt(E,Zi(H,S,"")))){if(H)return!1}}}}}}}return!0},hd=function(y){return y!=="annotation-xml"&&Wu(y,P)},md=function(y){on(X.beforeSanitizeAttributes,y,null);let{attributes:O}=y;if(!O||Ca(y))return;let H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},Ce=O.length;for(;Ce--;){let Ye=O[Ce],{name:De,namespaceURI:kt,value:sn}=Ye,Tr=ze(De),Na=sn,Ke=De==="value"?Na:GA(Na);if(H.attrName=Tr,H.attrValue=Ke,H.keepAttr=!0,H.forceKeepAttr=void 0,on(X.uponSanitizeAttribute,y,H),Ke=H.attrValue,ue&&(Tr==="id"||Tr==="name")&&(Hn(De,y),Ke=yt+Ke),gt&&pt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ke)){Hn(De,y);continue}if(Tr==="attributename"&&Wu(Ke,"href")){Hn(De,y);continue}if(H.forceKeepAttr)continue;if(!H.keepAttr){Hn(De,y);continue}if(!_n&&pt(/\/>/i,Ke)){Hn(De,y);continue}ot&&ga([he,we,ce],bd=>{Ke=Zi(Ke,bd," ")});let gd=ze(y.nodeName);if(!pd(gd,Tr,Ke)){Hn(De,y);continue}if(T&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!kt)switch(p.getAttributeType(gd,Tr)){case"TrustedHTML":{Ke=T.createHTML(Ke);break}case"TrustedScriptURL":{Ke=T.createScriptURL(Ke);break}}if(Ke!==Na)try{kt?y.setAttributeNS(kt,De,Ke):y.setAttribute(De,Ke),Ca(y)?Wt(y):Ay(e.removed)}catch{Hn(De,y)}}on(X.afterSanitizeAttributes,y,null)},kE=function j(y){let O=null,H=ud(y);for(on(X.beforeSanitizeShadowDOM,y,null);O=H.nextNode();)on(X.uponSanitizeShadowNode,O,null),fd(O),md(O),O.content instanceof o&&j(O.content);on(X.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(j){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O=null,H=null,Ce=null,Ye=null;if(xa=!j,xa&&(j=""),typeof j!="string"&&!dd(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Xi("dirty is not a string, aborting")}else throw Xi("toString is not a function");if(!e.isSupported)return j;if(te||Ta(y),e.removed=[],typeof j=="string"&&(_t=!1),_t){if(j.nodeName){let sn=ze(j.nodeName);if(!U[sn]||Ae[sn])throw Xi("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof a)O=cd(""),H=O.ownerDocument.importNode(j,!0),H.nodeType===eo.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?O=H:O.appendChild(H);else{if(!W&&!ot&&!ve&&j.indexOf("<")===-1)return T&&xe?T.createHTML(j):j;if(O=cd(j),!O)return W?null:xe?A:""}O&&bt&&Wt(O.firstChild);let De=ud(_t?j:O);for(;Ce=De.nextNode();)fd(Ce),md(Ce),Ce.content instanceof o&&kE(Ce.content);if(_t)return j;if(W){if(Y)for(Ye=B.call(O.ownerDocument);O.firstChild;)Ye.appendChild(O.firstChild);else Ye=O;return(se.shadowroot||se.shadowrootmode)&&(Ye=Ee.call(r,Ye,!0)),Ye}let kt=ve?O.outerHTML:O.innerHTML;return ve&&U["!doctype"]&&O.ownerDocument&&O.ownerDocument.doctype&&O.ownerDocument.doctype.name&&pt(By,O.ownerDocument.doctype.name)&&(kt=" -`+kt),ot&&ga([he,we,ce],sn=>{kt=Zi(kt,sn," ")}),T&&xe?T.createHTML(kt):kt},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ta(j),te=!0},e.clearConfig=function(){_r=null,te=!1},e.isValidAttribute=function(j,y,O){_r||Ta({});let H=ze(j),Ce=ze(y);return pd(H,Ce,O)},e.addHook=function(j,y){typeof y=="function"&&Ji(X[j],y)},e.removeHook=function(j,y){if(y!==void 0){let O=HA(X[j],y);return O===-1?void 0:WA(X[j],O,1)[0]}return Ay(X[j])},e.removeHooks=function(j){X[j]=[]},e.removeAllHooks=function(){X=Dy()},e}var Ju=zy();function sv(t){for(var e=1;e0&&t[e-1]===` -`;)e--;return t.substring(0,e)}function Wy(t){return Hy($y(t))}var av=["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 td(t){return nd(t,av)}var Ky=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Gy(t){return nd(t,Ky)}function lv(t){return qy(t,Ky)}var Vy=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function cv(t){return nd(t,Vy)}function uv(t){return qy(t,Vy)}function nd(t,e){return e.indexOf(t.nodeName)>=0}function qy(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var rt={};rt.paragraph={filter:"p",replacement:function(t){return` +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${Sn(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=py(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=py(t);if(i===null)return Sn(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 pa(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 fa(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 qi;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];qi.passThroughHooks.has(o)?i[s]=c=>{if(this.defaults.async&&qi.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 $t.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?$t.parse:$t.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?$t.parse:$t.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:

"+Sn(n.message+"",!0)+"
";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},yr=new zN;function me(t,e){return yr.parse(t,e)}me.options=me.setOptions=function(t){return yr.setOptions(t),me.defaults=yr.defaults,gy(me.defaults),me};me.getDefaults=Iu;me.defaults=Er;me.use=function(...t){return yr.use(...t),me.defaults=yr.defaults,gy(me.defaults),me};me.walkTokens=function(t,e){return yr.walkTokens(t,e)};me.parseInline=yr.parseInline;me.Parser=$t;me.parser=$t.parse;me.Renderer=pa;me.TextRenderer=Hu;me.Lexer=Ht;me.lexer=Ht.lex;me.Tokenizer=fa;me.Hooks=qi;me.parse=me;var vL=me.options,ML=me.setOptions,OL=me.use,RL=me.walkTokens,IL=me.parseInline;var DL=$t.parse,LL=Ht.lex;var{entries:Ly,setPrototypeOf:Ny,isFrozen:FN,getPrototypeOf:UN,getOwnPropertyDescriptor:HN}=Object,{freeze:ht,seal:zt,create:ya}=Object,{apply:ju,construct:Yu}=typeof Reflect<"u"&&Reflect;ht||(ht=function(e){return e});zt||(zt=function(e){return e});ju||(ju=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]:Ea;Ny&&Ny(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let o=n(i);o!==i&&(FN(e)||(e[r]=o),i=o)}t[i]=!0}return t}function qN(t){for(let e=0;e/gm),XN=zt(/\$\{[\w\W]*/gm),QN=zt(/^data-[\-\w.\u00B7-\uFFFF]+$/),eA=zt(/^aria-[\-\w]+$/),Py=zt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tA=zt(/^(?:\w+script|data):/i),nA=zt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),By=zt(/^html$/i),rA=zt(/^[a-z][.\w]*(-[.\w]+)+$/i),Iy=Object.freeze({__proto__:null,ARIA_ATTR:eA,ATTR_WHITESPACE:nA,CUSTOM_ELEMENT:rA,DATA_ATTR:QN,DOCTYPE_NAME:By,ERB_EXPR:JN,IS_ALLOWED_URI:Py,IS_SCRIPT_OR_DATA:tA,MUSTACHE_EXPR:ZN,TMPLIT_EXPR:XN}),eo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},iA=function(){return typeof window>"u"?null:window},oA=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}},Dy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function zy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iA(),e=j=>zy(j);if(e.version="3.3.3",e.removed=[],!t||!t.document||t.document.nodeType!==eo.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=Qi(h,"cloneNode"),g=Qi(h,"remove"),b=Qi(h,"nextSibling"),w=Qi(h,"childNodes"),C=Qi(h,"parentNode");if(typeof s=="function"){let j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let _,N="",{implementation:v,createNodeIterator:D,createDocumentFragment:B,getElementsByTagName:K}=n,{importNode:ye}=r,ue=Dy();e.isSupported=typeof Ly=="function"&&typeof C=="function"&&v&&v.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ke,ERB_EXPR:Te,TMPLIT_EXPR:Z,DATA_ATTR:Q,ARIA_ATTR:x,IS_SCRIPT_OR_DATA:E,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:P}=Iy,{IS_ALLOWED_URI:F}=Iy,H=null,se=ce({},[...vy,...Ku,...Vu,...Gu,...My]),ae=null,Ne=ce({},[...Oy,...qu,...Ry,...ba]),J=Object.seal(ya(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}})),Ae=null,Nt=null,We=Object.seal(ya(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),tn=!0,nn=!0,xn=!1,_n=!0,ot=!1,gt=!0,ve=!1,ne=!1,bt=!1,W=!1,Y=!1,Se=!1,ee=!0,de=!1,yt="user-content-",st=!0,_t=!1,I={},k=null,A=ce({},["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,X=ce({},["audio","video","img","source","image","track"]),ge=null,Et=ce({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cn="http://www.w3.org/1998/Math/MathML",Sr="http://www.w3.org/2000/svg",rn="http://www.w3.org/1999/xhtml",xr=rn,xa=!1,_a=null,hE=ce({},[Cn,Sr,rn],$u),to=ce({},["mi","mo","mn","ms","mtext"]),no=ce({},["annotation-xml"]),mE=ce({},["title","style","font","a","script"]),ei=null,gE=["application/xhtml+xml","text/html"],bE="text/html",Fe=null,_r=null,yE=n.createElement("form"),sd=function(y){return y instanceof RegExp||y instanceof Function},Ca=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(_r&&_r===y)){if((!y||typeof y!="object")&&(y={}),y=en(y),ei=gE.indexOf(y.PARSER_MEDIA_TYPE)===-1?bE:y.PARSER_MEDIA_TYPE,Fe=ei==="application/xhtml+xml"?$u:Ea,H=Tt(y,"ALLOWED_TAGS")?ce({},y.ALLOWED_TAGS,Fe):se,ae=Tt(y,"ALLOWED_ATTR")?ce({},y.ALLOWED_ATTR,Fe):Ne,_a=Tt(y,"ALLOWED_NAMESPACES")?ce({},y.ALLOWED_NAMESPACES,$u):hE,ge=Tt(y,"ADD_URI_SAFE_ATTR")?ce(en(Et),y.ADD_URI_SAFE_ATTR,Fe):Et,z=Tt(y,"ADD_DATA_URI_TAGS")?ce(en(X),y.ADD_DATA_URI_TAGS,Fe):X,k=Tt(y,"FORBID_CONTENTS")?ce({},y.FORBID_CONTENTS,Fe):A,Ae=Tt(y,"FORBID_TAGS")?ce({},y.FORBID_TAGS,Fe):en({}),Nt=Tt(y,"FORBID_ATTR")?ce({},y.FORBID_ATTR,Fe):en({}),I=Tt(y,"USE_PROFILES")?y.USE_PROFILES:!1,tn=y.ALLOW_ARIA_ATTR!==!1,nn=y.ALLOW_DATA_ATTR!==!1,xn=y.ALLOW_UNKNOWN_PROTOCOLS||!1,_n=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ot=y.SAFE_FOR_TEMPLATES||!1,gt=y.SAFE_FOR_XML!==!1,ve=y.WHOLE_DOCUMENT||!1,W=y.RETURN_DOM||!1,Y=y.RETURN_DOM_FRAGMENT||!1,Se=y.RETURN_TRUSTED_TYPE||!1,bt=y.FORCE_BODY||!1,ee=y.SANITIZE_DOM!==!1,de=y.SANITIZE_NAMED_PROPS||!1,st=y.KEEP_CONTENT!==!1,_t=y.IN_PLACE||!1,F=y.ALLOWED_URI_REGEXP||Py,xr=y.NAMESPACE||rn,to=y.MATHML_TEXT_INTEGRATION_POINTS||to,no=y.HTML_INTEGRATION_POINTS||no,J=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&sd(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&sd(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&&(nn=!1),Y&&(W=!0),I&&(H=ce({},My),ae=ya(null),I.html===!0&&(ce(H,vy),ce(ae,Oy)),I.svg===!0&&(ce(H,Ku),ce(ae,qu),ce(ae,ba)),I.svgFilters===!0&&(ce(H,Vu),ce(ae,qu),ce(ae,ba)),I.mathMl===!0&&(ce(H,Gu),ce(ae,Ry),ce(ae,ba))),Tt(y,"ADD_TAGS")||(We.tagCheck=null),Tt(y,"ADD_ATTR")||(We.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?We.tagCheck=y.ADD_TAGS:(H===se&&(H=en(H)),ce(H,y.ADD_TAGS,Fe))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?We.attributeCheck=y.ADD_ATTR:(ae===Ne&&(ae=en(ae)),ce(ae,y.ADD_ATTR,Fe))),y.ADD_URI_SAFE_ATTR&&ce(ge,y.ADD_URI_SAFE_ATTR,Fe),y.FORBID_CONTENTS&&(k===A&&(k=en(k)),ce(k,y.FORBID_CONTENTS,Fe)),y.ADD_FORBID_CONTENTS&&(k===A&&(k=en(k)),ce(k,y.ADD_FORBID_CONTENTS,Fe)),st&&(H["#text"]=!0),ve&&ce(H,["html","head","body"]),H.table&&(ce(H,["tbody"]),delete Ae.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=y.TRUSTED_TYPES_POLICY,N=_.createHTML("")}else _===void 0&&(_=oA(p,i)),_!==null&&typeof N=="string"&&(N=_.createHTML(""));ht&&ht(y),_r=y}},ad=ce({},[...Ku,...Vu,...jN]),ld=ce({},[...Gu,...YN]),EE=function(y){let R=C(y);(!R||!R.tagName)&&(R={namespaceURI:xr,tagName:"template"});let $=Ea(y.tagName),Ce=Ea(R.tagName);return _a[y.namespaceURI]?y.namespaceURI===Sr?R.namespaceURI===rn?$==="svg":R.namespaceURI===Cn?$==="svg"&&(Ce==="annotation-xml"||to[Ce]):!!ad[$]:y.namespaceURI===Cn?R.namespaceURI===rn?$==="math":R.namespaceURI===Sr?$==="math"&&no[Ce]:!!ld[$]:y.namespaceURI===rn?R.namespaceURI===Sr&&!no[Ce]||R.namespaceURI===Cn&&!to[Ce]?!1:!ld[$]&&(mE[$]||!ad[$]):!!(ei==="application/xhtml+xml"&&_a[y.namespaceURI]):!1},Wt=function(y){Zi(e.removed,{element:y});try{C(y).removeChild(y)}catch{g(y)}},$n=function(y,R){try{Zi(e.removed,{attribute:R.getAttributeNode(y),from:R})}catch{Zi(e.removed,{attribute:null,from:R})}if(R.removeAttribute(y),y==="is")if(W||Y)try{Wt(R)}catch{}else try{R.setAttribute(y,"")}catch{}},cd=function(y){let R=null,$=null;if(bt)y=""+y;else{let De=Wu(y,/^[\r\n\t ]+/);$=De&&De[0]}ei==="application/xhtml+xml"&&xr===rn&&(y=''+y+"");let Ce=_?_.createHTML(y):y;if(xr===rn)try{R=new f().parseFromString(Ce,ei)}catch{}if(!R||!R.documentElement){R=v.createDocument(xr,"template",null);try{R.documentElement.innerHTML=xa?N:Ce}catch{}}let Ye=R.body||R.documentElement;return y&&$&&Ye.insertBefore(n.createTextNode($),Ye.childNodes[0]||null),xr===rn?K.call(R,ve?"html":"body")[0]:ve?R.documentElement:Ye},ud=function(y){return D.call(y.ownerDocument||y,y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ta=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")},dd=function(y){return typeof a=="function"&&y instanceof a};function on(j,y,R){ga(j,$=>{$.call(e,y,R,_r)})}let fd=function(y){let R=null;if(on(ue.beforeSanitizeElements,y,null),Ta(y))return Wt(y),!0;let $=Fe(y.nodeName);if(on(ue.uponSanitizeElement,y,{tagName:$,allowedTags:H}),gt&&y.hasChildNodes()&&!dd(y.firstElementChild)&&pt(/<[/\w!]/g,y.innerHTML)&&pt(/<[/\w!]/g,y.textContent)||y.nodeType===eo.progressingInstruction||gt&&y.nodeType===eo.comment&&pt(/<[/\w]/g,y.data))return Wt(y),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck($))&&(!H[$]||Ae[$])){if(!Ae[$]&&hd($)&&(J.tagNameCheck instanceof RegExp&&pt(J.tagNameCheck,$)||J.tagNameCheck instanceof Function&&J.tagNameCheck($)))return!1;if(st&&!k[$]){let Ce=C(y)||y.parentNode,Ye=w(y)||y.childNodes;if(Ye&&Ce){let De=Ye.length;for(let kt=De-1;kt>=0;--kt){let sn=m(Ye[kt],!0);sn.__removalCount=(y.__removalCount||0)+1,Ce.insertBefore(sn,b(y))}}}return Wt(y),!0}return y instanceof l&&!EE(y)||($==="noscript"||$==="noembed"||$==="noframes")&&pt(/<\/no(script|embed|frames)/i,y.innerHTML)?(Wt(y),!0):(ot&&y.nodeType===eo.text&&(R=y.textContent,ga([ke,Te,Z],Ce=>{R=Ji(R,Ce," ")}),y.textContent!==R&&(Zi(e.removed,{element:y.cloneNode()}),y.textContent=R)),on(ue.afterSanitizeElements,y,null),!1)},pd=function(y,R,$){if(Nt[R]||ee&&(R==="id"||R==="name")&&($ in n||$ in yE))return!1;if(!(nn&&!Nt[R]&&pt(Q,R))){if(!(tn&&pt(x,R))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(R,y))){if(!ae[R]||Nt[R]){if(!(hd(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,$)||J.tagNameCheck instanceof Function&&J.tagNameCheck($))))return!1}else if(!ge[R]){if(!pt(F,Ji($,S,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&y!=="script"&&KN($,"data:")===0&&z[y])){if(!(xn&&!pt(E,Ji($,S,"")))){if($)return!1}}}}}}}return!0},hd=function(y){return y!=="annotation-xml"&&Wu(y,P)},md=function(y){on(ue.beforeSanitizeAttributes,y,null);let{attributes:R}=y;if(!R||Ta(y))return;let $={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0},Ce=R.length;for(;Ce--;){let Ye=R[Ce],{name:De,namespaceURI:kt,value:sn}=Ye,Cr=Fe(De),Na=sn,Ke=De==="value"?Na:VN(Na);if($.attrName=Cr,$.attrValue=Ke,$.keepAttr=!0,$.forceKeepAttr=void 0,on(ue.uponSanitizeAttribute,y,$),Ke=$.attrValue,de&&(Cr==="id"||Cr==="name")&&($n(De,y),Ke=yt+Ke),gt&&pt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ke)){$n(De,y);continue}if(Cr==="attributename"&&Wu(Ke,"href")){$n(De,y);continue}if($.forceKeepAttr)continue;if(!$.keepAttr){$n(De,y);continue}if(!_n&&pt(/\/>/i,Ke)){$n(De,y);continue}ot&&ga([ke,Te,Z],bd=>{Ke=Ji(Ke,bd," ")});let gd=Fe(y.nodeName);if(!pd(gd,Cr,Ke)){$n(De,y);continue}if(_&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!kt)switch(p.getAttributeType(gd,Cr)){case"TrustedHTML":{Ke=_.createHTML(Ke);break}case"TrustedScriptURL":{Ke=_.createScriptURL(Ke);break}}if(Ke!==Na)try{kt?y.setAttributeNS(kt,De,Ke):y.setAttribute(De,Ke),Ta(y)?Wt(y):Ay(e.removed)}catch{$n(De,y)}}on(ue.afterSanitizeAttributes,y,null)},kE=function j(y){let R=null,$=ud(y);for(on(ue.beforeSanitizeShadowDOM,y,null);R=$.nextNode();)on(ue.uponSanitizeShadowNode,R,null),fd(R),md(R),R.content instanceof o&&j(R.content);on(ue.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(j){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,$=null,Ce=null,Ye=null;if(xa=!j,xa&&(j=""),typeof j!="string"&&!dd(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Xi("dirty is not a string, aborting")}else throw Xi("toString is not a function");if(!e.isSupported)return j;if(ne||Ca(y),e.removed=[],typeof j=="string"&&(_t=!1),_t){if(j.nodeName){let sn=Fe(j.nodeName);if(!H[sn]||Ae[sn])throw Xi("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof a)R=cd(""),$=R.ownerDocument.importNode(j,!0),$.nodeType===eo.element&&$.nodeName==="BODY"||$.nodeName==="HTML"?R=$:R.appendChild($);else{if(!W&&!ot&&!ve&&j.indexOf("<")===-1)return _&&Se?_.createHTML(j):j;if(R=cd(j),!R)return W?null:Se?N:""}R&&bt&&Wt(R.firstChild);let De=ud(_t?j:R);for(;Ce=De.nextNode();)fd(Ce),md(Ce),Ce.content instanceof o&&kE(Ce.content);if(_t)return j;if(W){if(Y)for(Ye=B.call(R.ownerDocument);R.firstChild;)Ye.appendChild(R.firstChild);else Ye=R;return(ae.shadowroot||ae.shadowrootmode)&&(Ye=ye.call(r,Ye,!0)),Ye}let kt=ve?R.outerHTML:R.innerHTML;return ve&&H["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&pt(By,R.ownerDocument.doctype.name)&&(kt=" +`+kt),ot&&ga([ke,Te,Z],sn=>{kt=Ji(kt,sn," ")}),_&&Se?_.createHTML(kt):kt},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ca(j),ne=!0},e.clearConfig=function(){_r=null,ne=!1},e.isValidAttribute=function(j,y,R){_r||Ca({});let $=Fe(j),Ce=Fe(y);return pd($,Ce,R)},e.addHook=function(j,y){typeof y=="function"&&Zi(ue[j],y)},e.removeHook=function(j,y){if(y!==void 0){let R=$N(ue[j],y);return R===-1?void 0:WN(ue[j],R,1)[0]}return Ay(ue[j])},e.removeHooks=function(j){ue[j]=[]},e.removeAllHooks=function(){ue=Dy()},e}var Zu=zy();function sA(t){for(var e=1;e0&&t[e-1]===` +`;)e--;return t.substring(0,e)}function Wy(t){return $y(Hy(t))}var aA=["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 td(t){return nd(t,aA)}var Ky=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Vy(t){return nd(t,Ky)}function lA(t){return qy(t,Ky)}var Gy=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function cA(t){return nd(t,Gy)}function uA(t){return qy(t,Gy)}function nd(t,e){return e.indexOf(t.nodeName)>=0}function qy(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var rt={};rt.paragraph={filter:"p",replacement:function(t){return` `+t+` @@ -214,7 +214,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="

An error `)+` `,this.references=[]),e}};rt.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};rt.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};rt.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}};rt.image={filter:"img",replacement:function(t,e){var n=ka(e.getAttribute("alt")),r=e.getAttribute("src")||"",i=ka(e.getAttribute("title")),o=i?' "'+i+'"':"";return r?"!["+n+"]("+r+o+")":""}};function ka(t){return t?t.replace(/(\n+\s*)+/g,` -`):""}function jy(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])}jy.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=Zu(this.array,t,this.options))||(e=Zu(this._keep,t,this.options))||(e=Zu(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 fv(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=Fy(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=Xu(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=Xu(l);continue}var u=Fy(a,l,i);a=l,l=u}o&&(o.data=o.data.replace(/ $/,""),o.data||Xu(o))}}function Xu(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Fy(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var rd=typeof window<"u"?window:{};function pv(){var t=rd.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function hv(){var t=function(){};return mv()?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 mv(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{rd.ActiveXObject&&(t=!0)}return t}var gv=pv()?rd.DOMParser:hv();function bv(t,e){var n;if(typeof t=="string"){var r=yv().parseFromString(''+t+"","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return fv({element:n,isBlock:td,isVoid:Gy,isPre:e.preformattedCode?Ev:null}),n}var Qu;function yv(){return Qu=Qu||new gv,Qu}function Ev(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function kv(t,e){return t.isBlock=td(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=wv(t),t.flankingWhitespace=Sv(t,e),t}function wv(t){return!Gy(t)&&!cv(t)&&/^\s*$/i.test(t.textContent)&&!lv(t)&&!uv(t)}function Sv(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=xv(t.textContent);return n.leadingAscii&&Uy("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Uy("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function xv(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 Uy(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&&!td(r)&&(o=i.test(r.textContent))),o}var _v=Array.prototype.reduce,Tv=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function wa(t){if(!(this instanceof wa))return new wa(t);var e={rules:rt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?` +`):""}function jy(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])}jy.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=Ju(this.array,t,this.options))||(e=Ju(this._keep,t,this.options))||(e=Ju(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 fA(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=Fy(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=Xu(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=Xu(l);continue}var u=Fy(a,l,i);a=l,l=u}o&&(o.data=o.data.replace(/ $/,""),o.data||Xu(o))}}function Xu(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Fy(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var rd=typeof window<"u"?window:{};function pA(){var t=rd.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function hA(){var t=function(){};return mA()?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 mA(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{rd.ActiveXObject&&(t=!0)}return t}var gA=pA()?rd.DOMParser:hA();function bA(t,e){var n;if(typeof t=="string"){var r=yA().parseFromString(''+t+"","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return fA({element:n,isBlock:td,isVoid:Vy,isPre:e.preformattedCode?EA:null}),n}var Qu;function yA(){return Qu=Qu||new gA,Qu}function EA(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function kA(t,e){return t.isBlock=td(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=wA(t),t.flankingWhitespace=SA(t,e),t}function wA(t){return!Vy(t)&&!cA(t)&&/^\s*$/i.test(t.textContent)&&!lA(t)&&!uA(t)}function SA(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=xA(t.textContent);return n.leadingAscii&&Uy("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Uy("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function xA(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 Uy(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&&!td(r)&&(o=i.test(r.textContent))),o}var _A=Array.prototype.reduce,CA=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function wa(t){if(!(this instanceof wa))return new wa(t);var e={rules:rt,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?` @@ -224,27 +224,27 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="

An error `+n+` -`:n}};this.options=sv({},e,t),this.rules=new jy(this.options)}wa.prototype={turndown:function(t){if(!Av(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=Yy.call(this,new bv(t,this.options));return Cv.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e`${t}`});wr.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+` +`}};Jr.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};function id(t){var e=t.parentNode;return e.nodeName==="THEAD"||e.firstChild===t&&(e.nodeName==="TABLE"||IA(e))&&RA.call(t.childNodes,function(n){return n.nodeName==="TH"})}function IA(t){var e=t.previousSibling;return t.nodeName==="TBODY"&&(!e||e.nodeName==="THEAD"&&/^\s*$/i.test(e.textContent))}function Qy(t,e){var n=OA.call(e.parentNode.childNodes,e),r=" ";return n===0&&(r="| "),r+t+" |"}function DA(t){t.keep(function(n){return n.nodeName==="TABLE"&&!id(n.rows[0])});for(var e in Jr)t.addRule(e,Jr[e])}function LA(t){t.addRule("taskListItems",{filter:function(e){return e.type==="checkbox"&&e.parentNode.nodeName==="LI"},replacement:function(e,n){return(n.checked?"[x]":"[ ]")+" "}})}function eE(t){t.use([vA,MA,DA,LA])}me.use({gfm:!0,extensions:[{name:"fences",level:"block",tokenizer(t){let e=t.match(/^`{3,}\s*\{(\w+)\}\s*\n([\s\S]*?)^`{3,}\s*$/m);if(e)return{type:"code",raw:e[0],text:e[2],lang:e[1]}}}]});function Xr(t){return Zu.sanitize(me.parse(t))}function lE(t){return Zu.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["use"]})}var cE=bu(au),tE=[{value:"cpp",label:"C++"},{value:"python",label:"Python"},{value:"mermaid",label:"Mermaid"}],Sa="cpp",wr=new Jy({headingStyle:"atx",codeBlockStyle:"fenced",fence:"```",bulletListMarker:"-",emDelimiter:"*",strongDelimiter:"**",hr:"---"});wr.use(eE);wr.addRule("underline",{filter:["u"],replacement:t=>`${t}`});wr.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+` `}});wr.addRule("taskList",{filter:t=>t.nodeName==="UL"&&t.getAttribute("data-type")==="taskList",replacement:t=>` `+t+` -`});var nE=t=>{try{let e=new URL(t,window.location.href);return["http:","https:","mailto:"].includes(e.protocol)}catch{return!1}},rE=(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)})}),Qr=null,uE=0,dE=async()=>Qr||(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)}),Qr=window.mermaid,Qr.initialize({startOnLoad:!1,theme:"default"}),Qr),fE=(t,e)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(...r),e)}},it=(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},pE=()=>{let t=document.createElement("span");return t.className="wysiwyg-toolbar__sep",t},Pv=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},kr={bulletList:'',orderedList:'',checkbox:'',link:'',image:'',markdown:'',preview:''},Bv=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},zv=(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(pE());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},iE={full:{left:["heading","bold","italic","underline","strike","separator","bulletList","orderedList","taskList","separator","link","image","blockquote","horizontalRule","table","separator","code","codeBlock","langSelect","separator","markdown"],right:["preview","undo","redo"]},minimal:{left:["bold","italic","underline","separator","bulletList","orderedList","separator","link","markdown"],right:["preview","undo","redo"]}},Fv=(t,e,n="full")=>{let r=document.createElement("div");r.className="wysiwyg-toolbar__left";let i=document.createElement("div");i.className="wysiwyg-toolbar__right";let o={mdBtn:null,previewBtn:null,handleDocClick:null},s={separator:()=>pE(),heading:()=>Pv(t),bold:()=>it(t,{label:"Bold",title:"Bold",html:"B",onClick:()=>t.chain().focus().toggleBold().run(),isActive:()=>t.isActive("bold")}),italic:()=>it(t,{label:"Italic",title:"Italic",html:"I",onClick:()=>t.chain().focus().toggleItalic().run(),isActive:()=>t.isActive("italic")}),underline:()=>it(t,{label:"Underline",title:"Underline",html:"U",onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:()=>t.isActive("underline")}),strike:()=>it(t,{label:"Strikethrough",title:"Strikethrough",html:"S",onClick:()=>t.chain().focus().toggleStrike().run(),isActive:()=>t.isActive("strike")}),bulletList:()=>it(t,{label:"Bullet list",title:"Bullet list",html:kr.bulletList,onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive("bulletList")}),orderedList:()=>it(t,{label:"Ordered list",title:"Ordered list",html:kr.orderedList,onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive("orderedList")}),taskList:()=>it(t,{label:"Checkbox",title:"Checkbox list",html:kr.checkbox,onClick:()=>t.chain().focus().toggleTaskList().run(),isActive:()=>t.isActive("taskList")}),link:()=>it(t,{label:"Link",title:"Insert link",html:kr.link,onClick:async()=>{let l=await rE("Insert Link",[{name:"url",label:"URL",type:"url",placeholder:"https://example.com"}]);if(!(!l||!l.url)){if(!nE(l.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setLink({href:l.url}).run()}},isActive:()=>t.isActive("link")}),image:()=>it(t,{label:"Image",title:"Insert image",html:kr.image,onClick:async()=>{let l=await rE("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(!(!l||!l.url)){if(!nE(l.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setImage({src:l.url,alt:l.alt||""}).run()}},isActive:()=>!1}),blockquote:()=>it(t,{label:"Blockquote",title:"Blockquote",html:"“",onClick:()=>t.chain().focus().toggleBlockquote().run(),isActive:()=>t.isActive("blockquote")}),horizontalRule:()=>it(t,{label:"Horizontal rule",title:"Horizontal rule",html:"―",onClick:()=>t.chain().focus().setHorizontalRule().run(),isActive:()=>!1}),table:()=>{let l=document.createElement("span");l.className="wysiwyg-toolbar__table-wrap";let c=it(t,{label:"Table",title:"Insert table",html:"▦",onClick:()=>{u.style.display=u.style.display==="none"?"":"none"},isActive:()=>t.isActive("table")}),u=Bv((d,f)=>{t.chain().focus().insertTable({rows:d,cols:f,withHeaderRow:!0}).run(),u.style.display="none"});return l.appendChild(c),l.appendChild(u),o.handleDocClick=d=>{l.contains(d.target)||(u.style.display="none")},document.addEventListener("click",o.handleDocClick),l},code:()=>it(t,{label:"Inline code",title:"Inline code",html:"</>",onClick:()=>t.chain().focus().toggleCode().run(),isActive:()=>t.isActive("code")}),codeBlock:()=>it(t,{label:"Code block",title:"Code block",html:"{{{",onClick:()=>t.chain().focus().toggleCodeBlock({language:Sa}).run(),isActive:()=>t.isActive("codeBlock")}),langSelect:()=>{let l=document.createElement("select");l.className="wysiwyg-toolbar__lang-select",l.setAttribute("aria-label","Code block language"),l.setAttribute("title","Code block language"),tE.forEach(({value:u,label:d})=>{let f=document.createElement("option");f.value=u,f.textContent=d,l.appendChild(f)});let c=()=>{let u=t.isActive("codeBlock");if(l.disabled=!u,u){let f=t.getAttributes("codeBlock").language||Sa;l.value=tE.some(p=>p.value===f)?f:Sa}};return l.addEventListener("change",()=>{t.chain().focus().updateAttributes("codeBlock",{language:l.value}).run()}),t.on("selectionUpdate",c),t.on("transaction",c),c(),l},markdown:()=>{let l=document.createElement("button");return l.type="button",l.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--md",l.setAttribute("aria-label","Markdown"),l.setAttribute("title","Toggle Markdown mode"),l.innerHTML=kr.markdown,o.mdBtn=l,l},preview:()=>{let l=document.createElement("button");return l.type="button",l.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--preview-toggle",l.setAttribute("aria-label","Preview"),l.setAttribute("title","Toggle preview"),l.innerHTML=kr.preview,l.style.display="none",o.previewBtn=l,l},undo:()=>it(t,{label:"Undo",title:"Undo",html:"↶",onClick:()=>t.chain().focus().undo().run(),isActive:()=>!1}),redo:()=>it(t,{label:"Redo",title:"Redo",html:"↷",onClick:()=>t.chain().focus().redo().run(),isActive:()=>!1})},a=iE[n]||iE.full;return a.left.forEach(l=>{let c=s[l]?.();c&&r.appendChild(c)}),a.right.forEach(l=>{let c=s[l]?.();c&&i.appendChild(c)}),e.appendChild(r),e.appendChild(i),{mdBtn:o.mdBtn,previewBtn:o.previewBtn,handleDocClick:o.handleDocClick}},Uv=(t,e)=>{let n=fE(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 dE(),u=`mermaid-edit-${++uE}`,{svg:d}=await c.render(u,l);a.innerHTML=lE(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()},oE=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=cE.highlight(r,i);e.innerHTML=vu(o)}catch{}})},sE=async t=>{let e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;let n=await dE();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-${++uE}`,{svg:l}=await n.render(a,o);s.innerHTML=lE(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)}},od=new Map,aE=t=>{let e=od.get(t);e&&(e.editor.destroy(),e.cleanup(),od.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;let s=r.dataset.wysiwygPreset||"full";i.innerHTML="",r.querySelectorAll(".wysiwyg-table-context").forEach(X=>X.remove());let a=n.value?n.value.trim():"",l=a.startsWith("<")&&a.includes(">"),c=a;if(c&&!l)try{c=Xr(c)}catch{c=a}let u={current:null},d=new Uo({element:o,extensions:[Bh.configure({codeBlock:!1}),om.configure({lowlight:cE,defaultLanguage:Sa}),sm,Sm.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener"}}),Qm.configure({resizable:!1}),eg,tg,ng,rg,ig,og.configure({nested:!0})],content:c,editorProps:{attributes:{class:"wysiwyg-editor__prose"},handleKeyDown(X,he){if(he.key==="Tab"){let{$from:we}=X.state.selection;if(we.parent.type.name==="codeBlock")return he.preventDefault(),u.current?.chain().focus().insertContent(" ").run(),!0}return!1},handlePaste(X,he){let we=he.clipboardData?.getData("text/plain")||"";if(!we.trim()||!u.current)return!1;let ce=we.trim();if(!ce.startsWith("<")&&(/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(ce)||/\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(we)))try{he.preventDefault();let x=Xr(we);return u.current.chain().focus().insertContent(x).run(),!0}catch{return!1}return!1}}});u.current=d;let f={mode:"wysiwyg",markdownText:"",previewOn:!1},{mdBtn:p,previewBtn:h,handleDocClick:m}=Fv(d,i,s);zv(d,i),Uv(d,o);let g=document.createElement("div");g.className="wysiwyg-editor__markdown-pane",g.style.display="none";let b=document.createElement("textarea");b.className="wysiwyg-markdown__textarea",b.setAttribute("aria-label","Markdown source"),b.setAttribute("placeholder","Write markdown here...");let w=document.createElement("div");w.className="wysiwyg-markdown__preview wysiwyg-editor__prose",g.appendChild(b),g.appendChild(w),o.after(g);let _=document.createElement("div");_.className="wysiwyg-editor__preview wysiwyg-editor__prose",_.style.display="none",g.after(_);let T=()=>{w.innerHTML=Xr(f.markdownText),oE(w),sE(w)},A=fE(T,300);b.addEventListener("input",()=>{f.markdownText=b.value,A()}),p.addEventListener("click",X=>{X.preventDefault(),f.mode==="wysiwyg"?(f.markdownText=wr.turndown(d.getHTML()),f.mode="markdown",f.previewOn=!1,p.classList.add("wysiwyg-toolbar__btn--active"),i.classList.add("wysiwyg-editor__toolbar--markdown"),o.style.display="none",g.style.display="",_.style.display="none",h.style.display="",h.classList.remove("wysiwyg-toolbar__btn--active"),b.value=f.markdownText,T(),b.focus()):(d.commands.setContent(Xr(f.markdownText)),f.mode="wysiwyg",f.previewOn=!1,p.classList.remove("wysiwyg-toolbar__btn--active"),i.classList.remove("wysiwyg-editor__toolbar--markdown"),o.style.display="",g.style.display="none",_.style.display="none",h.style.display="none",h.classList.remove("wysiwyg-toolbar__btn--active"))}),h.addEventListener("click",X=>{X.preventDefault(),f.previewOn=!f.previewOn,h.classList.toggle("wysiwyg-toolbar__btn--active",f.previewOn),f.previewOn?(g.style.display="none",_.style.display="",_.innerHTML=Xr(f.markdownText),oE(_),sE(_)):(g.style.display="",_.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 R=r.closest("form"),D=()=>{f.mode==="markdown"?n.value=f.markdownText:n.value=wr.turndown(d.getHTML())};R&&R.addEventListener("submit",D,!0);let B=()=>f.mode==="markdown"?f.markdownText:wr.turndown(d.getHTML()),K=X=>{o.dispatchEvent(new CustomEvent("wysiwyg-update",{detail:{id:t,characters:d.state.doc.textContent.length,value:B(),programmatic:!!X},bubbles:!0}))};d.on("update",()=>K(!1));let Ee=X=>{if(!X.detail||X.detail.id!==t)return;let he=X.detail.value||"";d.commands.setContent(he?Xr(he):""),K(!0)};return window.addEventListener("wysiwyg-set-content",Ee),K(!0),requestAnimationFrame(()=>K(!0)),od.set(t,{editor:d,cleanup:()=>{m&&document.removeEventListener("click",m),R&&R.removeEventListener("submit",D,!0),window.removeEventListener("wysiwyg-set-content",Ee)}}),d},$v=t=>{if(!(typeof document>"u"||!document.querySelector))if(t&&t!==null){let e=document.querySelector(`textarea[id=${t}]`);e&&e.id&&aE(e.id)}else document.querySelectorAll('[data-wysiwyg="v3"]').forEach(e=>{let n=e.querySelector("textarea[id]");n&&n.id&&aE(n.id)})};typeof document<"u"&&(window.autoInit=$v);export{kr as ICONS,it as createToolbarButton,fE as debounce,oE as highlightPreviewCodeBlocks,aE as initWysiwyg,nE as isSafeUrl,rE as openModal,Xr as parseMarkdownSafe,sE as renderMermaidPreview,lE as sanitizeSvg,Uv as setupMermaidEditMode}; +`});var nE=t=>{try{let e=new URL(t,window.location.href);return["http:","https:","mailto:"].includes(e.protocol)}catch{return!1}},rE=(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)})}),Qr=null,uE=0,dE=async()=>Qr||(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)}),Qr=window.mermaid,Qr.initialize({startOnLoad:!1,theme:"default"}),Qr),fE=(t,e)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(...r),e)}},it=(t,e)=>{let{label:n,onClick:r,isActive:i,isDisabled:o,title:s}=e,a=document.createElement("button");a.type="button",a.className="wysiwyg-toolbar__btn",a.setAttribute("aria-label",n),s&&a.setAttribute("title",s),a.innerHTML=e.html||n,a.addEventListener("click",c=>{c.preventDefault(),r()});let l=()=>{if(a.classList.toggle("wysiwyg-toolbar__btn--active",i?i():!1),o){let c=o();a.disabled=c,a.classList.toggle("wysiwyg-toolbar__btn--disabled",c)}};return t.on("selectionUpdate",l),t.on("transaction",l),l(),a},pE=()=>{let t=document.createElement("span");return t.className="wysiwyg-toolbar__sep",t},PA=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},kr={bulletList:'',orderedList:'',checkbox:'',link:'',image:'',markdown:'',preview:''},BA={bold:'',italic:'',underline:'',orderedList:'',markdown:'',undo:'',redo:''},zA=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},FA=(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(pE());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},iE={full:{left:["heading","bold","italic","underline","strike","separator","bulletList","orderedList","taskList","separator","link","image","blockquote","horizontalRule","table","separator","code","codeBlock","langSelect","separator","markdown"],right:["preview","undo","redo"]},minimal:{left:["bold","italic","underline","separator","bulletList","orderedList","separator","link","markdown"],right:["preview","undo","redo"]},bio:{left:["bold","italic","underline","orderedList","markdown"],right:["preview","undo","redo"]}},UA=(t,e,n="full")=>{let r=document.createElement("div");r.className="wysiwyg-toolbar__left";let i=document.createElement("div");i.className="wysiwyg-toolbar__right";let o={mdBtn:null,previewBtn:null,handleDocClick:null},s=n==="bio",a=(u,d)=>s?BA[u]:d,l={separator:()=>pE(),heading:()=>PA(t),bold:()=>it(t,{label:"Bold",title:"Bold",html:a("bold","B"),onClick:()=>t.chain().focus().toggleBold().run(),isActive:()=>t.isActive("bold")}),italic:()=>it(t,{label:"Italic",title:"Italic",html:a("italic","I"),onClick:()=>t.chain().focus().toggleItalic().run(),isActive:()=>t.isActive("italic")}),underline:()=>it(t,{label:"Underline",title:"Underline",html:a("underline","U"),onClick:()=>t.chain().focus().toggleUnderline().run(),isActive:()=>t.isActive("underline")}),strike:()=>it(t,{label:"Strikethrough",title:"Strikethrough",html:"S",onClick:()=>t.chain().focus().toggleStrike().run(),isActive:()=>t.isActive("strike")}),bulletList:()=>it(t,{label:"Bullet list",title:"Bullet list",html:kr.bulletList,onClick:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive("bulletList")}),orderedList:()=>it(t,{label:"Ordered list",title:"Ordered list",html:a("orderedList",kr.orderedList),onClick:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive("orderedList")}),taskList:()=>it(t,{label:"Checkbox",title:"Checkbox list",html:kr.checkbox,onClick:()=>t.chain().focus().toggleTaskList().run(),isActive:()=>t.isActive("taskList")}),link:()=>it(t,{label:"Link",title:"Insert link",html:a("link",kr.link),onClick:async()=>{let u=await rE("Insert Link",[{name:"url",label:"URL",type:"url",placeholder:"https://example.com"}]);if(!(!u||!u.url)){if(!nE(u.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setLink({href:u.url}).run()}},isActive:()=>t.isActive("link")}),image:()=>it(t,{label:"Image",title:"Insert image",html:kr.image,onClick:async()=>{let u=await rE("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(!(!u||!u.url)){if(!nE(u.url)){window.alert("Only http, https, and mailto URLs are allowed.");return}t.chain().focus().setImage({src:u.url,alt:u.alt||""}).run()}},isActive:()=>!1}),blockquote:()=>it(t,{label:"Blockquote",title:"Blockquote",html:"“",onClick:()=>t.chain().focus().toggleBlockquote().run(),isActive:()=>t.isActive("blockquote")}),horizontalRule:()=>it(t,{label:"Horizontal rule",title:"Horizontal rule",html:"―",onClick:()=>t.chain().focus().setHorizontalRule().run(),isActive:()=>!1}),table:()=>{let u=document.createElement("span");u.className="wysiwyg-toolbar__table-wrap";let d=it(t,{label:"Table",title:"Insert table",html:"▦",onClick:()=>{f.style.display=f.style.display==="none"?"":"none"},isActive:()=>t.isActive("table")}),f=zA((p,h)=>{t.chain().focus().insertTable({rows:p,cols:h,withHeaderRow:!0}).run(),f.style.display="none"});return u.appendChild(d),u.appendChild(f),o.handleDocClick=p=>{u.contains(p.target)||(f.style.display="none")},document.addEventListener("click",o.handleDocClick),u},code:()=>it(t,{label:"Inline code",title:"Inline code",html:"</>",onClick:()=>t.chain().focus().toggleCode().run(),isActive:()=>t.isActive("code")}),codeBlock:()=>it(t,{label:"Code block",title:"Code block",html:"{{{",onClick:()=>t.chain().focus().toggleCodeBlock({language:Sa}).run(),isActive:()=>t.isActive("codeBlock")}),langSelect:()=>{let u=document.createElement("select");u.className="wysiwyg-toolbar__lang-select",u.setAttribute("aria-label","Code block language"),u.setAttribute("title","Code block language"),tE.forEach(({value:f,label:p})=>{let h=document.createElement("option");h.value=f,h.textContent=p,u.appendChild(h)});let d=()=>{let f=t.isActive("codeBlock");if(u.disabled=!f,f){let h=t.getAttributes("codeBlock").language||Sa;u.value=tE.some(m=>m.value===h)?h:Sa}};return u.addEventListener("change",()=>{t.chain().focus().updateAttributes("codeBlock",{language:u.value}).run()}),t.on("selectionUpdate",d),t.on("transaction",d),d(),u},markdown:()=>{let u=document.createElement("button");return 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=a("markdown",kr.markdown),o.mdBtn=u,u},preview:()=>{let u=document.createElement("button");return u.type="button",u.className="wysiwyg-toolbar__btn wysiwyg-toolbar__btn--preview-toggle",u.setAttribute("aria-label","Preview"),u.setAttribute("title","Toggle preview"),u.innerHTML=kr.preview,u.style.display="none",o.previewBtn=u,u},undo:()=>it(t,{label:"Undo",title:"Undo",html:a("undo","↶"),onClick:()=>t.chain().focus().undo().run(),isActive:()=>!1,isDisabled:s?()=>!t.can().undo():void 0}),redo:()=>it(t,{label:"Redo",title:"Redo",html:a("redo","↷"),onClick:()=>t.chain().focus().redo().run(),isActive:()=>!1,isDisabled:s?()=>!t.can().redo():void 0})},c=iE[n]||iE.full;return c.left.forEach(u=>{let d=l[u]?.();d&&r.appendChild(d)}),c.right.forEach(u=>{let d=l[u]?.();d&&i.appendChild(d)}),e.appendChild(r),e.appendChild(i),{mdBtn:o.mdBtn,previewBtn:o.previewBtn,handleDocClick:o.handleDocClick}},HA=(t,e)=>{let n=fE(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 dE(),u=`mermaid-edit-${++uE}`,{svg:d}=await c.render(u,l);a.innerHTML=lE(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()},oE=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=cE.highlight(r,i);e.innerHTML=vu(o)}catch{}})},sE=async t=>{let e=t.querySelectorAll("code.language-mermaid");if(e.length===0)return;let n=await dE();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-${++uE}`,{svg:l}=await n.render(a,o);s.innerHTML=lE(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)}},od=new Map,aE=t=>{let e=od.get(t);e&&(e.editor.destroy(),e.cleanup(),od.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;let s=r.dataset.wysiwygPreset||"full",a=Number(r.dataset.wysiwygMaxlength)||0,l=0,c=ze.create({name:"markdownLengthLimit",addProseMirrorPlugins(){return[new fe({filterTransaction(Z){return Z.docChanged?!(Z.doc.content.size>Z.before.content.size&&l>=a):!0}})]}});i.innerHTML="",r.querySelectorAll(".wysiwyg-table-context").forEach(Z=>Z.remove());let u=n.value?n.value.trim():"",d=u.startsWith("<")&&u.includes(">"),f=u;if(f&&!d)try{f=Xr(f)}catch{f=u}let p={current:null},h=new Uo({element:o,extensions:[Bh.configure({codeBlock:!1}),om.configure({lowlight:cE,defaultLanguage:Sa}),sm,Sm.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener"}}),Qm.configure({resizable:!1}),eg,tg,ng,rg,ig,og.configure({nested:!0}),...a?[c]:[]],content:f,editorProps:{attributes:{class:"wysiwyg-editor__prose"},handleKeyDown(Z,Q){if(Q.key==="Tab"){let{$from:x}=Z.state.selection;if(x.parent.type.name==="codeBlock")return Q.preventDefault(),p.current?.chain().focus().insertContent(" ").run(),!0}return!1},handlePaste(Z,Q){let x=Q.clipboardData?.getData("text/plain")||"";if(!x.trim()||!p.current)return!1;let E=x;if(a){let F=a-l;if(F<=0)return Q.preventDefault(),!0;x.length>F&&(E=x.slice(0,F))}let S=E.trim();if(!S.startsWith("<")&&(/^#|^\*\*|^\- |^\d+\. |^`|^\[|^>|^\||^\- \[ \]|^\- \[x\]/i.test(S)||/\n```|\n#{1,6}\s|\n\*\*|\n\- |\n\d+\. |\n\|---|\n\- \[ \]/.test(E)))try{Q.preventDefault();let F=Xr(E);return p.current.chain().focus().insertContent(F).run(),!0}catch{return!1}return E!==x?(Q.preventDefault(),p.current.chain().focus().insertContent(E).run(),!0):!1}}});p.current=h;let m={mode:"wysiwyg",markdownText:"",previewOn:!1},{mdBtn:g,previewBtn:b,handleDocClick:w}=UA(h,i,s);FA(h,i),HA(h,o);let C=document.createElement("div");C.className="wysiwyg-editor__markdown-pane",C.style.display="none";let _=document.createElement("textarea");_.className="wysiwyg-markdown__textarea",_.setAttribute("aria-label","Markdown source"),_.setAttribute("placeholder","Write markdown here...");let N=document.createElement("div");N.className="wysiwyg-markdown__preview wysiwyg-editor__prose",C.appendChild(_),C.appendChild(N),o.after(C);let v=document.createElement("div");v.className="wysiwyg-editor__preview wysiwyg-editor__prose",v.style.display="none",C.after(v);let D=()=>{N.innerHTML=Xr(m.markdownText),oE(N),sE(N)},B=fE(D,300);_.addEventListener("input",()=>{m.markdownText=_.value,B()}),g.addEventListener("click",Z=>{Z.preventDefault(),m.mode==="wysiwyg"?(m.markdownText=wr.turndown(h.getHTML()),m.mode="markdown",m.previewOn=!1,g.classList.add("wysiwyg-toolbar__btn--active"),i.classList.add("wysiwyg-editor__toolbar--markdown"),o.style.display="none",C.style.display="",v.style.display="none",b.style.display="",b.classList.remove("wysiwyg-toolbar__btn--active"),_.value=m.markdownText,D(),_.focus()):(h.commands.setContent(Xr(m.markdownText)),m.mode="wysiwyg",m.previewOn=!1,g.classList.remove("wysiwyg-toolbar__btn--active"),i.classList.remove("wysiwyg-editor__toolbar--markdown"),o.style.display="",C.style.display="none",v.style.display="none",b.style.display="none",b.classList.remove("wysiwyg-toolbar__btn--active"))}),b.addEventListener("click",Z=>{Z.preventDefault(),m.previewOn=!m.previewOn,b.classList.toggle("wysiwyg-toolbar__btn--active",m.previewOn),m.previewOn?(C.style.display="none",v.style.display="",v.innerHTML=Xr(m.markdownText),oE(v),sE(v)):(C.style.display="",v.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 K=r.closest("form"),ye=()=>{m.mode==="markdown"?n.value=m.markdownText:n.value=wr.turndown(h.getHTML())};K&&K.addEventListener("submit",ye,!0);let ue=()=>m.mode==="markdown"?m.markdownText:wr.turndown(h.getHTML()),ke=Z=>{let Q=ue();l=Q.length,o.dispatchEvent(new CustomEvent("wysiwyg-update",{detail:{id:t,characters:h.state.doc.textContent.length,markdownCharacters:Q.length,value:Q,programmatic:!!Z},bubbles:!0}))};h.on("update",()=>ke(!1));let Te=Z=>{if(!Z.detail||Z.detail.id!==t)return;let Q=Z.detail.value||"";h.commands.setContent(Q?Xr(Q):""),ke(!0)};return window.addEventListener("wysiwyg-set-content",Te),ke(!0),requestAnimationFrame(()=>ke(!0)),od.set(t,{editor:h,cleanup:()=>{w&&document.removeEventListener("click",w),K&&K.removeEventListener("submit",ye,!0),window.removeEventListener("wysiwyg-set-content",Te)}}),h},$A=t=>{if(!(typeof document>"u"||!document.querySelector))if(t&&t!==null){let e=document.querySelector(`textarea[id=${t}]`);e&&e.id&&aE(e.id)}else document.querySelectorAll('[data-wysiwyg="v3"]').forEach(e=>{let n=e.querySelector("textarea[id]");n&&n.id&&aE(n.id)})};typeof document<"u"&&(window.autoInit=$A,window.dispatchEvent(new CustomEvent("wysiwyg-editor-ready")));export{BA as BIO_ICONS,kr as ICONS,it as createToolbarButton,fE as debounce,oE as highlightPreviewCodeBlocks,aE as initWysiwyg,nE as isSafeUrl,rE as openModal,Xr as parseMarkdownSafe,sE as renderMermaidPreview,lE as sanitizeSvg,HA as setupMermaidEditMode}; /*! Bundled license information: dompurify/dist/purify.es.mjs: diff --git a/templates/v3/includes/_button.html b/templates/v3/includes/_button.html index 7469f5ebd..6b3a74b92 100644 --- a/templates/v3/includes/_button.html +++ b/templates/v3/includes/_button.html @@ -21,7 +21,7 @@ - icon-library (uses btn-icon-library styles; ignores btn + btn-* classes) - disabled (optional): if truthy, adds disabled attribute to button - alpine_disabled (optional): Alpine.js expression for dynamic disabled binding (e.g. "hasErrors") - - alpine_click (optional): Alpine.js expression run on click (e.g. "save()") + - alpine_click (optional): Alpine.js expression for a click handler (e.g. "save()"); button must sit inside an x-data scope - extra_classes (optional) : Any extra classes that the button should have, as a string - aria_label (optional): An optional label for assistive technology. Defaults to the button label - js_disabled (optional, boolean): If this value is true, the button is hidden unless Javascript is disabled on the page diff --git a/templates/v3/includes/_field_text.html b/templates/v3/includes/_field_text.html index 2afa63db2..819143adf 100644 --- a/templates/v3/includes/_field_text.html +++ b/templates/v3/includes/_field_text.html @@ -65,7 +65,7 @@ {% elif alpine_error %}:class="{ 'field--error': {{ alpine_error }} }" {% elif max_chars %} x-data="{ - value: '', + value: '{{ value|default:''|escapejs }}', maxChars: {{max_chars}}, get charLeft() { return Number(this.maxChars) - this.value?.length || 0; @@ -103,6 +103,7 @@ {% if aria_label %}aria-label="{{ aria_label }}"{% endif %} {% if placeholder %}placeholder="{{ placeholder }}"{% endif %} {% if value %}value="{{ value }}"{% endif %} + {% if max_chars %}maxlength="{{ max_chars }}"{% endif %} {% if required %}required{% endif %} {% if disabled %}disabled{% endif %} {% if alpine_error %}:aria-invalid="!!{{ alpine_error }}" :aria-describedby="{{ alpine_error }} ? 'field-{{ name }}-error' : {% if help_text %}'field-{{ name }}-help'{% else %}null{% endif %} @@ -133,7 +134,7 @@

{% endif %} {% if max_chars and display_max_chars %} - + {% endif %} {% if alpine_error %}

-