import { a as usePage, c as __commonJSMin, d as __toESM, o as vue_exports } from "../ssr.js";
import { n as server_renderer_exports, t } from "./i18n-CXLOYfyq.js";
import { r as Slot_default } from "./AuthModal-BJdeGGae.js";
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
import { n as uploadImage, t as isImageFile } from "./upload-D2yiLNgi.js";
import { n as Avatar_default } from "./AppLayout-Cibl7rtt.js";
//#region node_modules/highlight.js/lib/core.js
var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
	function deepFreeze(obj) {
		if (obj instanceof Map) obj.clear = obj.delete = obj.set = function() {
			throw new Error("map is read-only");
		};
		else if (obj instanceof Set) obj.add = obj.clear = obj.delete = function() {
			throw new Error("set is read-only");
		};
		Object.freeze(obj);
		Object.getOwnPropertyNames(obj).forEach((name) => {
			const prop = obj[name];
			const type = typeof prop;
			if ((type === "object" || type === "function") && !Object.isFrozen(prop)) deepFreeze(prop);
		});
		return obj;
	}
	/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */
	/** @typedef {import('highlight.js').CompiledMode} CompiledMode */
	/** @implements CallbackResponse */
	var Response = class {
		/**
		* @param {CompiledMode} mode
		*/
		constructor(mode) {
			if (mode.data === void 0) mode.data = {};
			this.data = mode.data;
			this.isMatchIgnored = false;
		}
		ignoreMatch() {
			this.isMatchIgnored = true;
		}
	};
	/**
	* @param {string} value
	* @returns {string}
	*/
	function escapeHTML(value) {
		return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
	}
	/**
	* performs a shallow merge of multiple objects into one
	*
	* @template T
	* @param {T} original
	* @param {Record<string,any>[]} objects
	* @returns {T} a single new object
	*/
	function inherit$1(original, ...objects) {
		/** @type Record<string,any> */
		const result = Object.create(null);
		for (const key in original) result[key] = original[key];
		objects.forEach(function(obj) {
			for (const key in obj) result[key] = obj[key];
		});
		return result;
	}
	/**
	* @typedef {object} Renderer
	* @property {(text: string) => void} addText
	* @property {(node: Node) => void} openNode
	* @property {(node: Node) => void} closeNode
	* @property {() => string} value
	*/
	/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */
	/** @typedef {{walk: (r: Renderer) => void}} Tree */
	/** */
	var SPAN_CLOSE = "</span>";
	/**
	* Determines if a node needs to be wrapped in <span>
	*
	* @param {Node} node */
	var emitsWrappingTags = (node) => {
		return !!node.scope;
	};
	/**
	*
	* @param {string} name
	* @param {{prefix:string}} options
	*/
	var scopeToCSSClass = (name, { prefix }) => {
		if (name.startsWith("language:")) return name.replace("language:", "language-");
		if (name.includes(".")) {
			const pieces = name.split(".");
			return [`${prefix}${pieces.shift()}`, ...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`)].join(" ");
		}
		return `${prefix}${name}`;
	};
	/** @type {Renderer} */
	var HTMLRenderer = class {
		/**
		* Creates a new HTMLRenderer
		*
		* @param {Tree} parseTree - the parse tree (must support `walk` API)
		* @param {{classPrefix: string}} options
		*/
		constructor(parseTree, options) {
			this.buffer = "";
			this.classPrefix = options.classPrefix;
			parseTree.walk(this);
		}
		/**
		* Adds texts to the output stream
		*
		* @param {string} text */
		addText(text) {
			this.buffer += escapeHTML(text);
		}
		/**
		* Adds a node open to the output stream (if needed)
		*
		* @param {Node} node */
		openNode(node) {
			if (!emitsWrappingTags(node)) return;
			const className = scopeToCSSClass(node.scope, { prefix: this.classPrefix });
			this.span(className);
		}
		/**
		* Adds a node close to the output stream (if needed)
		*
		* @param {Node} node */
		closeNode(node) {
			if (!emitsWrappingTags(node)) return;
			this.buffer += SPAN_CLOSE;
		}
		/**
		* returns the accumulated buffer
		*/
		value() {
			return this.buffer;
		}
		/**
		* Builds a span element
		*
		* @param {string} className */
		span(className) {
			this.buffer += `<span class="${className}">`;
		}
	};
	/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */
	/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */
	/** @typedef {import('highlight.js').Emitter} Emitter */
	/**  */
	/** @returns {DataNode} */
	var newNode = (opts = {}) => {
		/** @type DataNode */
		const result = { children: [] };
		Object.assign(result, opts);
		return result;
	};
	var TokenTree = class TokenTree {
		constructor() {
			/** @type DataNode */
			this.rootNode = newNode();
			this.stack = [this.rootNode];
		}
		get top() {
			return this.stack[this.stack.length - 1];
		}
		get root() {
			return this.rootNode;
		}
		/** @param {Node} node */
		add(node) {
			this.top.children.push(node);
		}
		/** @param {string} scope */
		openNode(scope) {
			/** @type Node */
			const node = newNode({ scope });
			this.add(node);
			this.stack.push(node);
		}
		closeNode() {
			if (this.stack.length > 1) return this.stack.pop();
		}
		closeAllNodes() {
			while (this.closeNode());
		}
		toJSON() {
			return JSON.stringify(this.rootNode, null, 4);
		}
		/**
		* @typedef { import("./html_renderer").Renderer } Renderer
		* @param {Renderer} builder
		*/
		walk(builder) {
			return this.constructor._walk(builder, this.rootNode);
		}
		/**
		* @param {Renderer} builder
		* @param {Node} node
		*/
		static _walk(builder, node) {
			if (typeof node === "string") builder.addText(node);
			else if (node.children) {
				builder.openNode(node);
				node.children.forEach((child) => this._walk(builder, child));
				builder.closeNode(node);
			}
			return builder;
		}
		/**
		* @param {Node} node
		*/
		static _collapse(node) {
			if (typeof node === "string") return;
			if (!node.children) return;
			if (node.children.every((el) => typeof el === "string")) node.children = [node.children.join("")];
			else node.children.forEach((child) => {
				TokenTree._collapse(child);
			});
		}
	};
	/**
	Currently this is all private API, but this is the minimal API necessary
	that an Emitter must implement to fully support the parser.
	
	Minimal interface:
	
	- addText(text)
	- __addSublanguage(emitter, subLanguageName)
	- startScope(scope)
	- endScope()
	- finalize()
	- toHTML()
	
	*/
	/**
	* @implements {Emitter}
	*/
	var TokenTreeEmitter = class extends TokenTree {
		/**
		* @param {*} options
		*/
		constructor(options) {
			super();
			this.options = options;
		}
		/**
		* @param {string} text
		*/
		addText(text) {
			if (text === "") return;
			this.add(text);
		}
		/** @param {string} scope */
		startScope(scope) {
			this.openNode(scope);
		}
		endScope() {
			this.closeNode();
		}
		/**
		* @param {Emitter & {root: DataNode}} emitter
		* @param {string} name
		*/
		__addSublanguage(emitter, name) {
			/** @type DataNode */
			const node = emitter.root;
			if (name) node.scope = `language:${name}`;
			this.add(node);
		}
		toHTML() {
			return new HTMLRenderer(this, this.options).value();
		}
		finalize() {
			this.closeAllNodes();
			return true;
		}
	};
	/**
	* @param {string} value
	* @returns {RegExp}
	* */
	/**
	* @param {RegExp | string } re
	* @returns {string}
	*/
	function source(re) {
		if (!re) return null;
		if (typeof re === "string") return re;
		return re.source;
	}
	/**
	* @param {RegExp | string } re
	* @returns {string}
	*/
	function lookahead(re) {
		return concat("(?=", re, ")");
	}
	/**
	* @param {RegExp | string } re
	* @returns {string}
	*/
	function anyNumberOfTimes(re) {
		return concat("(?:", re, ")*");
	}
	/**
	* @param {RegExp | string } re
	* @returns {string}
	*/
	function optional(re) {
		return concat("(?:", re, ")?");
	}
	/**
	* @param {...(RegExp | string) } args
	* @returns {string}
	*/
	function concat(...args) {
		return args.map((x) => source(x)).join("");
	}
	/**
	* @param { Array<string | RegExp | Object> } args
	* @returns {object}
	*/
	function stripOptionsFromArgs(args) {
		const opts = args[args.length - 1];
		if (typeof opts === "object" && opts.constructor === Object) {
			args.splice(args.length - 1, 1);
			return opts;
		} else return {};
	}
	/** @typedef { {capture?: boolean} } RegexEitherOptions */
	/**
	* Any of the passed expresssions may match
	*
	* Creates a huge this | this | that | that match
	* @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
	* @returns {string}
	*/
	function either(...args) {
		return "(" + (stripOptionsFromArgs(args).capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
	}
	/**
	* @param {RegExp | string} re
	* @returns {number}
	*/
	function countMatchGroups(re) {
		return new RegExp(re.toString() + "|").exec("").length - 1;
	}
	/**
	* Does lexeme start with a regular expression match at the beginning
	* @param {RegExp} re
	* @param {string} lexeme
	*/
	function startsWith(re, lexeme) {
		const match = re && re.exec(lexeme);
		return match && match.index === 0;
	}
	var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
	/**
	* @param {(string | RegExp)[]} regexps
	* @param {{joinWith: string}} opts
	* @returns {string}
	*/
	function _rewriteBackreferences(regexps, { joinWith }) {
		let numCaptures = 0;
		return regexps.map((regex) => {
			numCaptures += 1;
			const offset = numCaptures;
			let re = source(regex);
			let out = "";
			while (re.length > 0) {
				const match = BACKREF_RE.exec(re);
				if (!match) {
					out += re;
					break;
				}
				out += re.substring(0, match.index);
				re = re.substring(match.index + match[0].length);
				if (match[0][0] === "\\" && match[1]) out += "\\" + String(Number(match[1]) + offset);
				else {
					out += match[0];
					if (match[0] === "(") numCaptures++;
				}
			}
			return out;
		}).map((re) => `(${re})`).join(joinWith);
	}
	/** @typedef {import('highlight.js').Mode} Mode */
	/** @typedef {import('highlight.js').ModeCallback} ModeCallback */
	var MATCH_NOTHING_RE = /\b\B/;
	var IDENT_RE = "[a-zA-Z]\\w*";
	var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
	var NUMBER_RE = "\\b\\d+(\\.\\d+)?";
	var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
	var BINARY_NUMBER_RE = "\\b(0b[01]+)";
	var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
	/**
	* @param { Partial<Mode> & {binary?: string | RegExp} } opts
	*/
	var SHEBANG = (opts = {}) => {
		const beginShebang = /^#![ ]*\//;
		if (opts.binary) opts.begin = concat(beginShebang, /.*\b/, opts.binary, /\b.*/);
		return inherit$1({
			scope: "meta",
			begin: beginShebang,
			end: /$/,
			relevance: 0,
			/** @type {ModeCallback} */
			"on:begin": (m, resp) => {
				if (m.index !== 0) resp.ignoreMatch();
			}
		}, opts);
	};
	var BACKSLASH_ESCAPE = {
		begin: "\\\\[\\s\\S]",
		relevance: 0
	};
	var APOS_STRING_MODE = {
		scope: "string",
		begin: "'",
		end: "'",
		illegal: "\\n",
		contains: [BACKSLASH_ESCAPE]
	};
	var QUOTE_STRING_MODE = {
		scope: "string",
		begin: "\"",
		end: "\"",
		illegal: "\\n",
		contains: [BACKSLASH_ESCAPE]
	};
	var PHRASAL_WORDS_MODE = { 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/ };
	/**
	* Creates a comment mode
	*
	* @param {string | RegExp} begin
	* @param {string | RegExp} end
	* @param {Mode | {}} [modeOptions]
	* @returns {Partial<Mode>}
	*/
	var COMMENT = function(begin, end, modeOptions = {}) {
		const mode = inherit$1({
			scope: "comment",
			begin,
			end,
			contains: []
		}, modeOptions);
		mode.contains.push({
			scope: "doctag",
			begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
			end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
			excludeBegin: true,
			relevance: 0
		});
		const ENGLISH_WORD = either("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,}/);
		mode.contains.push({ begin: concat(/[ ]+/, "(", ENGLISH_WORD, /[.]?[:]?([.][ ]|[ ])/, "){3}") });
		return mode;
	};
	var C_LINE_COMMENT_MODE = COMMENT("//", "$");
	var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
	var HASH_COMMENT_MODE = COMMENT("#", "$");
	var NUMBER_MODE = {
		scope: "number",
		begin: NUMBER_RE,
		relevance: 0
	};
	var C_NUMBER_MODE = {
		scope: "number",
		begin: C_NUMBER_RE,
		relevance: 0
	};
	var BINARY_NUMBER_MODE = {
		scope: "number",
		begin: BINARY_NUMBER_RE,
		relevance: 0
	};
	var REGEXP_MODE = {
		scope: "regexp",
		begin: /\/(?=[^/\n]*\/)/,
		end: /\/[gimuy]*/,
		contains: [BACKSLASH_ESCAPE, {
			begin: /\[/,
			end: /\]/,
			relevance: 0,
			contains: [BACKSLASH_ESCAPE]
		}]
	};
	var TITLE_MODE = {
		scope: "title",
		begin: IDENT_RE,
		relevance: 0
	};
	var UNDERSCORE_TITLE_MODE = {
		scope: "title",
		begin: UNDERSCORE_IDENT_RE,
		relevance: 0
	};
	var METHOD_GUARD = {
		begin: "\\.\\s*[a-zA-Z_]\\w*",
		relevance: 0
	};
	/**
	* Adds end same as begin mechanics to a mode
	*
	* Your mode must include at least a single () match group as that first match
	* group is what is used for comparison
	* @param {Partial<Mode>} mode
	*/
	var END_SAME_AS_BEGIN = function(mode) {
		return Object.assign(mode, {
			/** @type {ModeCallback} */
			"on:begin": (m, resp) => {
				resp.data._beginMatch = m[1];
			},
			/** @type {ModeCallback} */
			"on:end": (m, resp) => {
				if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
			}
		});
	};
	var MODES = /*#__PURE__*/ Object.freeze({
		__proto__: null,
		APOS_STRING_MODE,
		BACKSLASH_ESCAPE,
		BINARY_NUMBER_MODE,
		BINARY_NUMBER_RE,
		COMMENT,
		C_BLOCK_COMMENT_MODE,
		C_LINE_COMMENT_MODE,
		C_NUMBER_MODE,
		C_NUMBER_RE,
		END_SAME_AS_BEGIN,
		HASH_COMMENT_MODE,
		IDENT_RE,
		MATCH_NOTHING_RE,
		METHOD_GUARD,
		NUMBER_MODE,
		NUMBER_RE,
		PHRASAL_WORDS_MODE,
		QUOTE_STRING_MODE,
		REGEXP_MODE,
		RE_STARTERS_RE,
		SHEBANG,
		TITLE_MODE,
		UNDERSCORE_IDENT_RE,
		UNDERSCORE_TITLE_MODE
	});
	/**
	@typedef {import('highlight.js').CallbackResponse} CallbackResponse
	@typedef {import('highlight.js').CompilerExt} CompilerExt
	*/
	/**
	* Skip a match if it has a preceding dot
	*
	* This is used for `beginKeywords` to prevent matching expressions such as
	* `bob.keyword.do()`. The mode compiler automatically wires this up as a
	* special _internal_ 'on:begin' callback for modes with `beginKeywords`
	* @param {RegExpMatchArray} match
	* @param {CallbackResponse} response
	*/
	function skipIfHasPrecedingDot(match, response) {
		if (match.input[match.index - 1] === ".") response.ignoreMatch();
	}
	/**
	*
	* @type {CompilerExt}
	*/
	function scopeClassName(mode, _parent) {
		if (mode.className !== void 0) {
			mode.scope = mode.className;
			delete mode.className;
		}
	}
	/**
	* `beginKeywords` syntactic sugar
	* @type {CompilerExt}
	*/
	function beginKeywords(mode, parent) {
		if (!parent) return;
		if (!mode.beginKeywords) return;
		mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
		mode.__beforeBegin = skipIfHasPrecedingDot;
		mode.keywords = mode.keywords || mode.beginKeywords;
		delete mode.beginKeywords;
		if (mode.relevance === void 0) mode.relevance = 0;
	}
	/**
	* Allow `illegal` to contain an array of illegal values
	* @type {CompilerExt}
	*/
	function compileIllegal(mode, _parent) {
		if (!Array.isArray(mode.illegal)) return;
		mode.illegal = either(...mode.illegal);
	}
	/**
	* `match` to match a single expression for readability
	* @type {CompilerExt}
	*/
	function compileMatch(mode, _parent) {
		if (!mode.match) return;
		if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
		mode.begin = mode.match;
		delete mode.match;
	}
	/**
	* provides the default 1 relevance to all modes
	* @type {CompilerExt}
	*/
	function compileRelevance(mode, _parent) {
		if (mode.relevance === void 0) mode.relevance = 1;
	}
	var beforeMatchExt = (mode, parent) => {
		if (!mode.beforeMatch) return;
		if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
		const originalMode = Object.assign({}, mode);
		Object.keys(mode).forEach((key) => {
			delete mode[key];
		});
		mode.keywords = originalMode.keywords;
		mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
		mode.starts = {
			relevance: 0,
			contains: [Object.assign(originalMode, { endsParent: true })]
		};
		mode.relevance = 0;
		delete originalMode.beforeMatch;
	};
	var COMMON_KEYWORDS = [
		"of",
		"and",
		"for",
		"in",
		"not",
		"or",
		"if",
		"then",
		"parent",
		"list",
		"value"
	];
	var DEFAULT_KEYWORD_SCOPE = "keyword";
	/**
	* Given raw keywords from a language definition, compile them.
	*
	* @param {string | Record<string,string|string[]> | Array<string>} rawKeywords
	* @param {boolean} caseInsensitive
	*/
	function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
		/** @type {import("highlight.js/private").KeywordDict} */
		const compiledKeywords = Object.create(null);
		if (typeof rawKeywords === "string") compileList(scopeName, rawKeywords.split(" "));
		else if (Array.isArray(rawKeywords)) compileList(scopeName, rawKeywords);
		else Object.keys(rawKeywords).forEach(function(scopeName) {
			Object.assign(compiledKeywords, compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName));
		});
		return compiledKeywords;
		/**
		* Compiles an individual list of keywords
		*
		* Ex: "for if when while|5"
		*
		* @param {string} scopeName
		* @param {Array<string>} keywordList
		*/
		function compileList(scopeName, keywordList) {
			if (caseInsensitive) keywordList = keywordList.map((x) => x.toLowerCase());
			keywordList.forEach(function(keyword) {
				const pair = keyword.split("|");
				compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];
			});
		}
	}
	/**
	* Returns the proper score for a given keyword
	*
	* Also takes into account comment keywords, which will be scored 0 UNLESS
	* another score has been manually assigned.
	* @param {string} keyword
	* @param {string} [providedScore]
	*/
	function scoreForKeyword(keyword, providedScore) {
		if (providedScore) return Number(providedScore);
		return commonKeyword(keyword) ? 0 : 1;
	}
	/**
	* Determines if a given keyword is common or not
	*
	* @param {string} keyword */
	function commonKeyword(keyword) {
		return COMMON_KEYWORDS.includes(keyword.toLowerCase());
	}
	/**
	* @type {Record<string, boolean>}
	*/
	var seenDeprecations = {};
	/**
	* @param {string} message
	*/
	var error = (message) => {
		console.error(message);
	};
	/**
	* @param {string} message
	* @param {any} args
	*/
	var warn = (message, ...args) => {
		console.log(`WARN: ${message}`, ...args);
	};
	/**
	* @param {string} version
	* @param {string} message
	*/
	var deprecated = (version, message) => {
		if (seenDeprecations[`${version}/${message}`]) return;
		console.log(`Deprecated as of ${version}. ${message}`);
		seenDeprecations[`${version}/${message}`] = true;
	};
	/**
	@typedef {import('highlight.js').CompiledMode} CompiledMode
	*/
	var MultiClassError = /* @__PURE__ */ new Error();
	/**
	* Renumbers labeled scope names to account for additional inner match
	* groups that otherwise would break everything.
	*
	* Lets say we 3 match scopes:
	*
	*   { 1 => ..., 2 => ..., 3 => ... }
	*
	* So what we need is a clean match like this:
	*
	*   (a)(b)(c) => [ "a", "b", "c" ]
	*
	* But this falls apart with inner match groups:
	*
	* (a)(((b)))(c) => ["a", "b", "b", "b", "c" ]
	*
	* Our scopes are now "out of alignment" and we're repeating `b` 3 times.
	* What needs to happen is the numbers are remapped:
	*
	*   { 1 => ..., 2 => ..., 5 => ... }
	*
	* We also need to know that the ONLY groups that should be output
	* are 1, 2, and 5.  This function handles this behavior.
	*
	* @param {CompiledMode} mode
	* @param {Array<RegExp | string>} regexes
	* @param {{key: "beginScope"|"endScope"}} opts
	*/
	function remapScopeNames(mode, regexes, { key }) {
		let offset = 0;
		const scopeNames = mode[key];
		/** @type Record<number,boolean> */
		const emit = {};
		/** @type Record<number,string> */
		const positions = {};
		for (let i = 1; i <= regexes.length; i++) {
			positions[i + offset] = scopeNames[i];
			emit[i + offset] = true;
			offset += countMatchGroups(regexes[i - 1]);
		}
		mode[key] = positions;
		mode[key]._emit = emit;
		mode[key]._multi = true;
	}
	/**
	* @param {CompiledMode} mode
	*/
	function beginMultiClass(mode) {
		if (!Array.isArray(mode.begin)) return;
		if (mode.skip || mode.excludeBegin || mode.returnBegin) {
			error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
			throw MultiClassError;
		}
		if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
			error("beginScope must be object");
			throw MultiClassError;
		}
		remapScopeNames(mode, mode.begin, { key: "beginScope" });
		mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
	}
	/**
	* @param {CompiledMode} mode
	*/
	function endMultiClass(mode) {
		if (!Array.isArray(mode.end)) return;
		if (mode.skip || mode.excludeEnd || mode.returnEnd) {
			error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
			throw MultiClassError;
		}
		if (typeof mode.endScope !== "object" || mode.endScope === null) {
			error("endScope must be object");
			throw MultiClassError;
		}
		remapScopeNames(mode, mode.end, { key: "endScope" });
		mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
	}
	/**
	* this exists only to allow `scope: {}` to be used beside `match:`
	* Otherwise `beginScope` would necessary and that would look weird
	
	{
	match: [ /def/, /\w+/ ]
	scope: { 1: "keyword" , 2: "title" }
	}
	
	* @param {CompiledMode} mode
	*/
	function scopeSugar(mode) {
		if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
			mode.beginScope = mode.scope;
			delete mode.scope;
		}
	}
	/**
	* @param {CompiledMode} mode
	*/
	function MultiClass(mode) {
		scopeSugar(mode);
		if (typeof mode.beginScope === "string") mode.beginScope = { _wrap: mode.beginScope };
		if (typeof mode.endScope === "string") mode.endScope = { _wrap: mode.endScope };
		beginMultiClass(mode);
		endMultiClass(mode);
	}
	/**
	@typedef {import('highlight.js').Mode} Mode
	@typedef {import('highlight.js').CompiledMode} CompiledMode
	@typedef {import('highlight.js').Language} Language
	@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
	@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage
	*/
	/**
	* Compiles a language definition result
	*
	* Given the raw result of a language definition (Language), compiles this so
	* that it is ready for highlighting code.
	* @param {Language} language
	* @returns {CompiledLanguage}
	*/
	function compileLanguage(language) {
		/**
		* Builds a regex with the case sensitivity of the current language
		*
		* @param {RegExp | string} value
		* @param {boolean} [global]
		*/
		function langRe(value, global) {
			return new RegExp(source(value), "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : ""));
		}
		/**
		Stores multiple regular expressions and allows you to quickly search for
		them all in a string simultaneously - returning the first match.  It does
		this by creating a huge (a|b|c) regex - each individual item wrapped with ()
		and joined by `|` - using match groups to track position.  When a match is
		found checking which position in the array has content allows us to figure
		out which of the original regexes / match groups triggered the match.
		
		The match object itself (the result of `Regex.exec`) is returned but also
		enhanced by merging in any meta-data that was registered with the regex.
		This is how we keep track of which mode matched, and what type of rule
		(`illegal`, `begin`, end, etc).
		*/
		class MultiRegex {
			constructor() {
				this.matchIndexes = {};
				this.regexes = [];
				this.matchAt = 1;
				this.position = 0;
			}
			addRule(re, opts) {
				opts.position = this.position++;
				this.matchIndexes[this.matchAt] = opts;
				this.regexes.push([opts, re]);
				this.matchAt += countMatchGroups(re) + 1;
			}
			compile() {
				if (this.regexes.length === 0) this.exec = () => null;
				const terminators = this.regexes.map((el) => el[1]);
				this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true);
				this.lastIndex = 0;
			}
			/** @param {string} s */
			exec(s) {
				this.matcherRe.lastIndex = this.lastIndex;
				const match = this.matcherRe.exec(s);
				if (!match) return null;
				const i = match.findIndex((el, i) => i > 0 && el !== void 0);
				const matchData = this.matchIndexes[i];
				match.splice(0, i);
				return Object.assign(match, matchData);
			}
		}
		class ResumableMultiRegex {
			constructor() {
				this.rules = [];
				this.multiRegexes = [];
				this.count = 0;
				this.lastIndex = 0;
				this.regexIndex = 0;
			}
			getMatcher(index) {
				if (this.multiRegexes[index]) return this.multiRegexes[index];
				const matcher = new MultiRegex();
				this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
				matcher.compile();
				this.multiRegexes[index] = matcher;
				return matcher;
			}
			resumingScanAtSamePosition() {
				return this.regexIndex !== 0;
			}
			considerAll() {
				this.regexIndex = 0;
			}
			addRule(re, opts) {
				this.rules.push([re, opts]);
				if (opts.type === "begin") this.count++;
			}
			/** @param {string} s */
			exec(s) {
				const m = this.getMatcher(this.regexIndex);
				m.lastIndex = this.lastIndex;
				let result = m.exec(s);
				if (this.resumingScanAtSamePosition()) if (result && result.index === this.lastIndex);
				else {
					const m2 = this.getMatcher(0);
					m2.lastIndex = this.lastIndex + 1;
					result = m2.exec(s);
				}
				if (result) {
					this.regexIndex += result.position + 1;
					if (this.regexIndex === this.count) this.considerAll();
				}
				return result;
			}
		}
		/**
		* Given a mode, builds a huge ResumableMultiRegex that can be used to walk
		* the content and find matches.
		*
		* @param {CompiledMode} mode
		* @returns {ResumableMultiRegex}
		*/
		function buildModeRegex(mode) {
			const mm = new ResumableMultiRegex();
			mode.contains.forEach((term) => mm.addRule(term.begin, {
				rule: term,
				type: "begin"
			}));
			if (mode.terminatorEnd) mm.addRule(mode.terminatorEnd, { type: "end" });
			if (mode.illegal) mm.addRule(mode.illegal, { type: "illegal" });
			return mm;
		}
		/** skip vs abort vs ignore
		*
		* @skip   - The mode is still entered and exited normally (and contains rules apply),
		*           but all content is held and added to the parent buffer rather than being
		*           output when the mode ends.  Mostly used with `sublanguage` to build up
		*           a single large buffer than can be parsed by sublanguage.
		*
		*             - The mode begin ands ends normally.
		*             - Content matched is added to the parent mode buffer.
		*             - The parser cursor is moved forward normally.
		*
		* @abort  - A hack placeholder until we have ignore.  Aborts the mode (as if it
		*           never matched) but DOES NOT continue to match subsequent `contains`
		*           modes.  Abort is bad/suboptimal because it can result in modes
		*           farther down not getting applied because an earlier rule eats the
		*           content but then aborts.
		*
		*             - The mode does not begin.
		*             - Content matched by `begin` is added to the mode buffer.
		*             - The parser cursor is moved forward accordingly.
		*
		* @ignore - Ignores the mode (as if it never matched) and continues to match any
		*           subsequent `contains` modes.  Ignore isn't technically possible with
		*           the current parser implementation.
		*
		*             - The mode does not begin.
		*             - Content matched by `begin` is ignored.
		*             - The parser cursor is not moved forward.
		*/
		/**
		* Compiles an individual mode
		*
		* This can raise an error if the mode contains certain detectable known logic
		* issues.
		* @param {Mode} mode
		* @param {CompiledMode | null} [parent]
		* @returns {CompiledMode | never}
		*/
		function compileMode(mode, parent) {
			const cmode = mode;
			if (mode.isCompiled) return cmode;
			[
				scopeClassName,
				compileMatch,
				MultiClass,
				beforeMatchExt
			].forEach((ext) => ext(mode, parent));
			language.compilerExtensions.forEach((ext) => ext(mode, parent));
			mode.__beforeBegin = null;
			[
				beginKeywords,
				compileIllegal,
				compileRelevance
			].forEach((ext) => ext(mode, parent));
			mode.isCompiled = true;
			let keywordPattern = null;
			if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
				mode.keywords = Object.assign({}, mode.keywords);
				keywordPattern = mode.keywords.$pattern;
				delete mode.keywords.$pattern;
			}
			keywordPattern = keywordPattern || /\w+/;
			if (mode.keywords) mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
			cmode.keywordPatternRe = langRe(keywordPattern, true);
			if (parent) {
				if (!mode.begin) mode.begin = /\B|\b/;
				cmode.beginRe = langRe(cmode.begin);
				if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
				if (mode.end) cmode.endRe = langRe(cmode.end);
				cmode.terminatorEnd = source(cmode.end) || "";
				if (mode.endsWithParent && parent.terminatorEnd) cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd;
			}
			if (mode.illegal) cmode.illegalRe = langRe(mode.illegal);
			if (!mode.contains) mode.contains = [];
			mode.contains = [].concat(...mode.contains.map(function(c) {
				return expandOrCloneMode(c === "self" ? mode : c);
			}));
			mode.contains.forEach(function(c) {
				compileMode(c, cmode);
			});
			if (mode.starts) compileMode(mode.starts, parent);
			cmode.matcher = buildModeRegex(cmode);
			return cmode;
		}
		if (!language.compilerExtensions) language.compilerExtensions = [];
		if (language.contains && language.contains.includes("self")) throw new Error("ERR: contains `self` is not supported at the top-level of a language.  See documentation.");
		language.classNameAliases = inherit$1(language.classNameAliases || {});
		return compileMode(language);
	}
	/**
	* Determines if a mode has a dependency on it's parent or not
	*
	* If a mode does have a parent dependency then often we need to clone it if
	* it's used in multiple places so that each copy points to the correct parent,
	* where-as modes without a parent can often safely be re-used at the bottom of
	* a mode chain.
	*
	* @param {Mode | null} mode
	* @returns {boolean} - is there a dependency on the parent?
	* */
	function dependencyOnParent(mode) {
		if (!mode) return false;
		return mode.endsWithParent || dependencyOnParent(mode.starts);
	}
	/**
	* Expands a mode or clones it if necessary
	*
	* This is necessary for modes with parental dependenceis (see notes on
	* `dependencyOnParent`) and for nodes that have `variants` - which must then be
	* exploded into their own individual modes at compile time.
	*
	* @param {Mode} mode
	* @returns {Mode | Mode[]}
	* */
	function expandOrCloneMode(mode) {
		if (mode.variants && !mode.cachedVariants) mode.cachedVariants = mode.variants.map(function(variant) {
			return inherit$1(mode, { variants: null }, variant);
		});
		if (mode.cachedVariants) return mode.cachedVariants;
		if (dependencyOnParent(mode)) return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
		if (Object.isFrozen(mode)) return inherit$1(mode);
		return mode;
	}
	var version = "11.11.1";
	var HTMLInjectionError = class extends Error {
		constructor(reason, html) {
			super(reason);
			this.name = "HTMLInjectionError";
			this.html = html;
		}
	};
	/**
	@typedef {import('highlight.js').Mode} Mode
	@typedef {import('highlight.js').CompiledMode} CompiledMode
	@typedef {import('highlight.js').CompiledScope} CompiledScope
	@typedef {import('highlight.js').Language} Language
	@typedef {import('highlight.js').HLJSApi} HLJSApi
	@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
	@typedef {import('highlight.js').PluginEvent} PluginEvent
	@typedef {import('highlight.js').HLJSOptions} HLJSOptions
	@typedef {import('highlight.js').LanguageFn} LanguageFn
	@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement
	@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext
	@typedef {import('highlight.js/private').MatchType} MatchType
	@typedef {import('highlight.js/private').KeywordData} KeywordData
	@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch
	@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError
	@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult
	@typedef {import('highlight.js').HighlightOptions} HighlightOptions
	@typedef {import('highlight.js').HighlightResult} HighlightResult
	*/
	var escape = escapeHTML;
	var inherit = inherit$1;
	var NO_MATCH = Symbol("nomatch");
	var MAX_KEYWORD_HITS = 7;
	/**
	* @param {any} hljs - object that is extended (legacy)
	* @returns {HLJSApi}
	*/
	var HLJS = function(hljs) {
		/** @type {Record<string, Language>} */
		const languages = Object.create(null);
		/** @type {Record<string, string>} */
		const aliases = Object.create(null);
		/** @type {HLJSPlugin[]} */
		const plugins = [];
		let SAFE_MODE = true;
		const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
		/** @type {Language} */
		const PLAINTEXT_LANGUAGE = {
			disableAutodetect: true,
			name: "Plain text",
			contains: []
		};
		/** @type HLJSOptions */
		let options = {
			ignoreUnescapedHTML: false,
			throwUnescapedHTML: false,
			noHighlightRe: /^(no-?highlight)$/i,
			languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
			classPrefix: "hljs-",
			cssSelector: "pre code",
			languages: null,
			__emitter: TokenTreeEmitter
		};
		/**
		* Tests a language name to see if highlighting should be skipped
		* @param {string} languageName
		*/
		function shouldNotHighlight(languageName) {
			return options.noHighlightRe.test(languageName);
		}
		/**
		* @param {HighlightedHTMLElement} block - the HTML element to determine language for
		*/
		function blockLanguage(block) {
			let classes = block.className + " ";
			classes += block.parentNode ? block.parentNode.className : "";
			const match = options.languageDetectRe.exec(classes);
			if (match) {
				const language = getLanguage(match[1]);
				if (!language) {
					warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
					warn("Falling back to no-highlight mode for this block.", block);
				}
				return language ? match[1] : "no-highlight";
			}
			return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
		}
		/**
		* Core highlighting function.
		*
		* OLD API
		* highlight(lang, code, ignoreIllegals, continuation)
		*
		* NEW API
		* highlight(code, {lang, ignoreIllegals})
		*
		* @param {string} codeOrLanguageName - the language to use for highlighting
		* @param {string | HighlightOptions} optionsOrCode - the code to highlight
		* @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
		*
		* @returns {HighlightResult} Result - an object that represents the result
		* @property {string} language - the language name
		* @property {number} relevance - the relevance score
		* @property {string} value - the highlighted HTML code
		* @property {string} code - the original raw code
		* @property {CompiledMode} top - top of the current mode stack
		* @property {boolean} illegal - indicates whether any illegal matches were found
		*/
		function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
			let code = "";
			let languageName = "";
			if (typeof optionsOrCode === "object") {
				code = codeOrLanguageName;
				ignoreIllegals = optionsOrCode.ignoreIllegals;
				languageName = optionsOrCode.language;
			} else {
				deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
				deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
				languageName = codeOrLanguageName;
				code = optionsOrCode;
			}
			if (ignoreIllegals === void 0) ignoreIllegals = true;
			/** @type {BeforeHighlightContext} */
			const context = {
				code,
				language: languageName
			};
			fire("before:highlight", context);
			const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
			result.code = context.code;
			fire("after:highlight", result);
			return result;
		}
		/**
		* private highlight that's used internally and does not fire callbacks
		*
		* @param {string} languageName - the language to use for highlighting
		* @param {string} codeToHighlight - the code to highlight
		* @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
		* @param {CompiledMode?} [continuation] - current continuation mode, if any
		* @returns {HighlightResult} - result of the highlight operation
		*/
		function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
			const keywordHits = Object.create(null);
			/**
			* Return keyword data if a match is a keyword
			* @param {CompiledMode} mode - current mode
			* @param {string} matchText - the textual match
			* @returns {KeywordData | false}
			*/
			function keywordData(mode, matchText) {
				return mode.keywords[matchText];
			}
			function processKeywords() {
				if (!top.keywords) {
					emitter.addText(modeBuffer);
					return;
				}
				let lastIndex = 0;
				top.keywordPatternRe.lastIndex = 0;
				let match = top.keywordPatternRe.exec(modeBuffer);
				let buf = "";
				while (match) {
					buf += modeBuffer.substring(lastIndex, match.index);
					const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
					const data = keywordData(top, word);
					if (data) {
						const [kind, keywordRelevance] = data;
						emitter.addText(buf);
						buf = "";
						keywordHits[word] = (keywordHits[word] || 0) + 1;
						if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
						if (kind.startsWith("_")) buf += match[0];
						else {
							const cssClass = language.classNameAliases[kind] || kind;
							emitKeyword(match[0], cssClass);
						}
					} else buf += match[0];
					lastIndex = top.keywordPatternRe.lastIndex;
					match = top.keywordPatternRe.exec(modeBuffer);
				}
				buf += modeBuffer.substring(lastIndex);
				emitter.addText(buf);
			}
			function processSubLanguage() {
				if (modeBuffer === "") return;
				/** @type HighlightResult */
				let result = null;
				if (typeof top.subLanguage === "string") {
					if (!languages[top.subLanguage]) {
						emitter.addText(modeBuffer);
						return;
					}
					result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
					continuations[top.subLanguage] = result._top;
				} else result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
				if (top.relevance > 0) relevance += result.relevance;
				emitter.__addSublanguage(result._emitter, result.language);
			}
			function processBuffer() {
				if (top.subLanguage != null) processSubLanguage();
				else processKeywords();
				modeBuffer = "";
			}
			/**
			* @param {string} text
			* @param {string} scope
			*/
			function emitKeyword(keyword, scope) {
				if (keyword === "") return;
				emitter.startScope(scope);
				emitter.addText(keyword);
				emitter.endScope();
			}
			/**
			* @param {CompiledScope} scope
			* @param {RegExpMatchArray} match
			*/
			function emitMultiClass(scope, match) {
				let i = 1;
				const max = match.length - 1;
				while (i <= max) {
					if (!scope._emit[i]) {
						i++;
						continue;
					}
					const klass = language.classNameAliases[scope[i]] || scope[i];
					const text = match[i];
					if (klass) emitKeyword(text, klass);
					else {
						modeBuffer = text;
						processKeywords();
						modeBuffer = "";
					}
					i++;
				}
			}
			/**
			* @param {CompiledMode} mode - new mode to start
			* @param {RegExpMatchArray} match
			*/
			function startNewMode(mode, match) {
				if (mode.scope && typeof mode.scope === "string") emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
				if (mode.beginScope) {
					if (mode.beginScope._wrap) {
						emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
						modeBuffer = "";
					} else if (mode.beginScope._multi) {
						emitMultiClass(mode.beginScope, match);
						modeBuffer = "";
					}
				}
				top = Object.create(mode, { parent: { value: top } });
				return top;
			}
			/**
			* @param {CompiledMode } mode - the mode to potentially end
			* @param {RegExpMatchArray} match - the latest match
			* @param {string} matchPlusRemainder - match plus remainder of content
			* @returns {CompiledMode | void} - the next mode, or if void continue on in current mode
			*/
			function endOfMode(mode, match, matchPlusRemainder) {
				let matched = startsWith(mode.endRe, matchPlusRemainder);
				if (matched) {
					if (mode["on:end"]) {
						const resp = new Response(mode);
						mode["on:end"](match, resp);
						if (resp.isMatchIgnored) matched = false;
					}
					if (matched) {
						while (mode.endsParent && mode.parent) mode = mode.parent;
						return mode;
					}
				}
				if (mode.endsWithParent) return endOfMode(mode.parent, match, matchPlusRemainder);
			}
			/**
			* Handle matching but then ignoring a sequence of text
			*
			* @param {string} lexeme - string containing full match text
			*/
			function doIgnore(lexeme) {
				if (top.matcher.regexIndex === 0) {
					modeBuffer += lexeme[0];
					return 1;
				} else {
					resumeScanAtSamePosition = true;
					return 0;
				}
			}
			/**
			* Handle the start of a new potential mode match
			*
			* @param {EnhancedMatch} match - the current match
			* @returns {number} how far to advance the parse cursor
			*/
			function doBeginMatch(match) {
				const lexeme = match[0];
				const newMode = match.rule;
				const resp = new Response(newMode);
				const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
				for (const cb of beforeCallbacks) {
					if (!cb) continue;
					cb(match, resp);
					if (resp.isMatchIgnored) return doIgnore(lexeme);
				}
				if (newMode.skip) modeBuffer += lexeme;
				else {
					if (newMode.excludeBegin) modeBuffer += lexeme;
					processBuffer();
					if (!newMode.returnBegin && !newMode.excludeBegin) modeBuffer = lexeme;
				}
				startNewMode(newMode, match);
				return newMode.returnBegin ? 0 : lexeme.length;
			}
			/**
			* Handle the potential end of mode
			*
			* @param {RegExpMatchArray} match - the current match
			*/
			function doEndMatch(match) {
				const lexeme = match[0];
				const matchPlusRemainder = codeToHighlight.substring(match.index);
				const endMode = endOfMode(top, match, matchPlusRemainder);
				if (!endMode) return NO_MATCH;
				const origin = top;
				if (top.endScope && top.endScope._wrap) {
					processBuffer();
					emitKeyword(lexeme, top.endScope._wrap);
				} else if (top.endScope && top.endScope._multi) {
					processBuffer();
					emitMultiClass(top.endScope, match);
				} else if (origin.skip) modeBuffer += lexeme;
				else {
					if (!(origin.returnEnd || origin.excludeEnd)) modeBuffer += lexeme;
					processBuffer();
					if (origin.excludeEnd) modeBuffer = lexeme;
				}
				do {
					if (top.scope) emitter.closeNode();
					if (!top.skip && !top.subLanguage) relevance += top.relevance;
					top = top.parent;
				} while (top !== endMode.parent);
				if (endMode.starts) startNewMode(endMode.starts, match);
				return origin.returnEnd ? 0 : lexeme.length;
			}
			function processContinuations() {
				const list = [];
				for (let current = top; current !== language; current = current.parent) if (current.scope) list.unshift(current.scope);
				list.forEach((item) => emitter.openNode(item));
			}
			/** @type {{type?: MatchType, index?: number, rule?: Mode}}} */
			let lastMatch = {};
			/**
			*  Process an individual match
			*
			* @param {string} textBeforeMatch - text preceding the match (since the last match)
			* @param {EnhancedMatch} [match] - the match itself
			*/
			function processLexeme(textBeforeMatch, match) {
				const lexeme = match && match[0];
				modeBuffer += textBeforeMatch;
				if (lexeme == null) {
					processBuffer();
					return 0;
				}
				if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
					modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
					if (!SAFE_MODE) {
						/** @type {AnnotatedError} */
						const err = /* @__PURE__ */ new Error(`0 width match regex (${languageName})`);
						err.languageName = languageName;
						err.badRule = lastMatch.rule;
						throw err;
					}
					return 1;
				}
				lastMatch = match;
				if (match.type === "begin") return doBeginMatch(match);
				else if (match.type === "illegal" && !ignoreIllegals) {
					/** @type {AnnotatedError} */
					const err = /* @__PURE__ */ new Error("Illegal lexeme \"" + lexeme + "\" for mode \"" + (top.scope || "<unnamed>") + "\"");
					err.mode = top;
					throw err;
				} else if (match.type === "end") {
					const processed = doEndMatch(match);
					if (processed !== NO_MATCH) return processed;
				}
				if (match.type === "illegal" && lexeme === "") {
					modeBuffer += "\n";
					return 1;
				}
				if (iterations > 1e5 && iterations > match.index * 3) throw /* @__PURE__ */ new Error("potential infinite loop, way more iterations than matches");
				modeBuffer += lexeme;
				return lexeme.length;
			}
			const language = getLanguage(languageName);
			if (!language) {
				error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
				throw new Error("Unknown language: \"" + languageName + "\"");
			}
			const md = compileLanguage(language);
			let result = "";
			/** @type {CompiledMode} */
			let top = continuation || md;
			/** @type Record<string,CompiledMode> */
			const continuations = {};
			const emitter = new options.__emitter(options);
			processContinuations();
			let modeBuffer = "";
			let relevance = 0;
			let index = 0;
			let iterations = 0;
			let resumeScanAtSamePosition = false;
			try {
				if (!language.__emitTokens) {
					top.matcher.considerAll();
					for (;;) {
						iterations++;
						if (resumeScanAtSamePosition) resumeScanAtSamePosition = false;
						else top.matcher.considerAll();
						top.matcher.lastIndex = index;
						const match = top.matcher.exec(codeToHighlight);
						if (!match) break;
						const processedCount = processLexeme(codeToHighlight.substring(index, match.index), match);
						index = match.index + processedCount;
					}
					processLexeme(codeToHighlight.substring(index));
				} else language.__emitTokens(codeToHighlight, emitter);
				emitter.finalize();
				result = emitter.toHTML();
				return {
					language: languageName,
					value: result,
					relevance,
					illegal: false,
					_emitter: emitter,
					_top: top
				};
			} catch (err) {
				if (err.message && err.message.includes("Illegal")) return {
					language: languageName,
					value: escape(codeToHighlight),
					illegal: true,
					relevance: 0,
					_illegalBy: {
						message: err.message,
						index,
						context: codeToHighlight.slice(index - 100, index + 100),
						mode: err.mode,
						resultSoFar: result
					},
					_emitter: emitter
				};
				else if (SAFE_MODE) return {
					language: languageName,
					value: escape(codeToHighlight),
					illegal: false,
					relevance: 0,
					errorRaised: err,
					_emitter: emitter,
					_top: top
				};
				else throw err;
			}
		}
		/**
		* returns a valid highlight result, without actually doing any actual work,
		* auto highlight starts with this and it's possible for small snippets that
		* auto-detection may not find a better match
		* @param {string} code
		* @returns {HighlightResult}
		*/
		function justTextHighlightResult(code) {
			const result = {
				value: escape(code),
				illegal: false,
				relevance: 0,
				_top: PLAINTEXT_LANGUAGE,
				_emitter: new options.__emitter(options)
			};
			result._emitter.addText(code);
			return result;
		}
		/**
		Highlighting with language detection. Accepts a string with the code to
		highlight. Returns an object with the following properties:
		
		- language (detected language)
		- relevance (int)
		- value (an HTML string with highlighting markup)
		- secondBest (object with the same structure for second-best heuristically
		detected language, may be absent)
		
		@param {string} code
		@param {Array<string>} [languageSubset]
		@returns {AutoHighlightResult}
		*/
		function highlightAuto(code, languageSubset) {
			languageSubset = languageSubset || options.languages || Object.keys(languages);
			const plaintext = justTextHighlightResult(code);
			const results = languageSubset.filter(getLanguage).filter(autoDetection).map((name) => _highlight(name, code, false));
			results.unshift(plaintext);
			const [best, secondBest] = results.sort((a, b) => {
				if (a.relevance !== b.relevance) return b.relevance - a.relevance;
				if (a.language && b.language) {
					if (getLanguage(a.language).supersetOf === b.language) return 1;
					else if (getLanguage(b.language).supersetOf === a.language) return -1;
				}
				return 0;
			});
			/** @type {AutoHighlightResult} */
			const result = best;
			result.secondBest = secondBest;
			return result;
		}
		/**
		* Builds new class name for block given the language name
		*
		* @param {HTMLElement} element
		* @param {string} [currentLang]
		* @param {string} [resultLang]
		*/
		function updateClassName(element, currentLang, resultLang) {
			const language = currentLang && aliases[currentLang] || resultLang;
			element.classList.add("hljs");
			element.classList.add(`language-${language}`);
		}
		/**
		* Applies highlighting to a DOM node containing code.
		*
		* @param {HighlightedHTMLElement} element - the HTML element to highlight
		*/
		function highlightElement(element) {
			/** @type HTMLElement */
			let node = null;
			const language = blockLanguage(element);
			if (shouldNotHighlight(language)) return;
			fire("before:highlightElement", {
				el: element,
				language
			});
			if (element.dataset.highlighted) {
				console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element);
				return;
			}
			if (element.children.length > 0) {
				if (!options.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(element);
				}
				if (options.throwUnescapedHTML) throw new HTMLInjectionError("One of your code blocks includes unescaped HTML.", element.innerHTML);
			}
			node = element;
			const text = node.textContent;
			const result = language ? highlight(text, {
				language,
				ignoreIllegals: true
			}) : highlightAuto(text);
			element.innerHTML = result.value;
			element.dataset.highlighted = "yes";
			updateClassName(element, language, result.language);
			element.result = {
				language: result.language,
				re: result.relevance,
				relevance: result.relevance
			};
			if (result.secondBest) element.secondBest = {
				language: result.secondBest.language,
				relevance: result.secondBest.relevance
			};
			fire("after:highlightElement", {
				el: element,
				result,
				text
			});
		}
		/**
		* Updates highlight.js global options with the passed options
		*
		* @param {Partial<HLJSOptions>} userOptions
		*/
		function configure(userOptions) {
			options = inherit(options, userOptions);
		}
		const initHighlighting = () => {
			highlightAll();
			deprecated("10.6.0", "initHighlighting() deprecated.  Use highlightAll() now.");
		};
		function initHighlightingOnLoad() {
			highlightAll();
			deprecated("10.6.0", "initHighlightingOnLoad() deprecated.  Use highlightAll() now.");
		}
		let wantsHighlight = false;
		/**
		* auto-highlights all pre>code elements on the page
		*/
		function highlightAll() {
			function boot() {
				highlightAll();
			}
			if (document.readyState === "loading") {
				if (!wantsHighlight) window.addEventListener("DOMContentLoaded", boot, false);
				wantsHighlight = true;
				return;
			}
			document.querySelectorAll(options.cssSelector).forEach(highlightElement);
		}
		/**
		* Register a language grammar module
		*
		* @param {string} languageName
		* @param {LanguageFn} languageDefinition
		*/
		function registerLanguage(languageName, languageDefinition) {
			let lang = null;
			try {
				lang = languageDefinition(hljs);
			} catch (error$1) {
				error("Language definition for '{}' could not be registered.".replace("{}", languageName));
				if (!SAFE_MODE) throw error$1;
				else error(error$1);
				lang = PLAINTEXT_LANGUAGE;
			}
			if (!lang.name) lang.name = languageName;
			languages[languageName] = lang;
			lang.rawDefinition = languageDefinition.bind(null, hljs);
			if (lang.aliases) registerAliases(lang.aliases, { languageName });
		}
		/**
		* Remove a language grammar module
		*
		* @param {string} languageName
		*/
		function unregisterLanguage(languageName) {
			delete languages[languageName];
			for (const alias of Object.keys(aliases)) if (aliases[alias] === languageName) delete aliases[alias];
		}
		/**
		* @returns {string[]} List of language internal names
		*/
		function listLanguages() {
			return Object.keys(languages);
		}
		/**
		* @param {string} name - name of the language to retrieve
		* @returns {Language | undefined}
		*/
		function getLanguage(name) {
			name = (name || "").toLowerCase();
			return languages[name] || languages[aliases[name]];
		}
		/**
		*
		* @param {string|string[]} aliasList - single alias or list of aliases
		* @param {{languageName: string}} opts
		*/
		function registerAliases(aliasList, { languageName }) {
			if (typeof aliasList === "string") aliasList = [aliasList];
			aliasList.forEach((alias) => {
				aliases[alias.toLowerCase()] = languageName;
			});
		}
		/**
		* Determines if a given language has auto-detection enabled
		* @param {string} name - name of the language
		*/
		function autoDetection(name) {
			const lang = getLanguage(name);
			return lang && !lang.disableAutodetect;
		}
		/**
		* Upgrades the old highlightBlock plugins to the new
		* highlightElement API
		* @param {HLJSPlugin} plugin
		*/
		function upgradePluginAPI(plugin) {
			if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) plugin["before:highlightElement"] = (data) => {
				plugin["before:highlightBlock"](Object.assign({ block: data.el }, data));
			};
			if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) plugin["after:highlightElement"] = (data) => {
				plugin["after:highlightBlock"](Object.assign({ block: data.el }, data));
			};
		}
		/**
		* @param {HLJSPlugin} plugin
		*/
		function addPlugin(plugin) {
			upgradePluginAPI(plugin);
			plugins.push(plugin);
		}
		/**
		* @param {HLJSPlugin} plugin
		*/
		function removePlugin(plugin) {
			const index = plugins.indexOf(plugin);
			if (index !== -1) plugins.splice(index, 1);
		}
		/**
		*
		* @param {PluginEvent} event
		* @param {any} args
		*/
		function fire(event, args) {
			const cb = event;
			plugins.forEach(function(plugin) {
				if (plugin[cb]) plugin[cb](args);
			});
		}
		/**
		* DEPRECATED
		* @param {HighlightedHTMLElement} el
		*/
		function deprecateHighlightBlock(el) {
			deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
			deprecated("10.7.0", "Please use highlightElement now.");
			return highlightElement(el);
		}
		Object.assign(hljs, {
			highlight,
			highlightAuto,
			highlightAll,
			highlightElement,
			highlightBlock: deprecateHighlightBlock,
			configure,
			initHighlighting,
			initHighlightingOnLoad,
			registerLanguage,
			unregisterLanguage,
			listLanguages,
			getLanguage,
			registerAliases,
			autoDetection,
			inherit,
			addPlugin,
			removePlugin
		});
		hljs.debugMode = function() {
			SAFE_MODE = false;
		};
		hljs.safeMode = function() {
			SAFE_MODE = true;
		};
		hljs.versionString = version;
		hljs.regex = {
			concat,
			lookahead,
			either,
			optional,
			anyNumberOfTimes
		};
		for (const key in MODES) if (typeof MODES[key] === "object") deepFreeze(MODES[key]);
		Object.assign(hljs, MODES);
		return hljs;
	};
	var highlight = HLJS({});
	highlight.newInstance = () => HLJS({});
	module.exports = highlight;
	highlight.HighlightJS = highlight;
	highlight.default = highlight;
}));
//#endregion
//#region node_modules/orderedmap/dist/index.js
function OrderedMap(content) {
	this.content = content;
}
OrderedMap.prototype = {
	constructor: OrderedMap,
	find: function(key) {
		for (var i = 0; i < this.content.length; i += 2) if (this.content[i] === key) return i;
		return -1;
	},
	get: function(key) {
		var found = this.find(key);
		return found == -1 ? void 0 : this.content[found + 1];
	},
	update: function(key, value, newKey) {
		var self = newKey && newKey != key ? this.remove(newKey) : this;
		var found = self.find(key), content = self.content.slice();
		if (found == -1) content.push(newKey || key, value);
		else {
			content[found + 1] = value;
			if (newKey) content[found] = newKey;
		}
		return new OrderedMap(content);
	},
	remove: function(key) {
		var found = this.find(key);
		if (found == -1) return this;
		var content = this.content.slice();
		content.splice(found, 2);
		return new OrderedMap(content);
	},
	addToStart: function(key, value) {
		return new OrderedMap([key, value].concat(this.remove(key).content));
	},
	addToEnd: function(key, value) {
		var content = this.remove(key).content.slice();
		content.push(key, value);
		return new OrderedMap(content);
	},
	addBefore: function(place, key, value) {
		var without = this.remove(key), content = without.content.slice();
		var found = without.find(place);
		content.splice(found == -1 ? content.length : found, 0, key, value);
		return new OrderedMap(content);
	},
	forEach: function(f) {
		for (var i = 0; i < this.content.length; i += 2) f(this.content[i], this.content[i + 1]);
	},
	prepend: function(map) {
		map = OrderedMap.from(map);
		if (!map.size) return this;
		return new OrderedMap(map.content.concat(this.subtract(map).content));
	},
	append: function(map) {
		map = OrderedMap.from(map);
		if (!map.size) return this;
		return new OrderedMap(this.subtract(map).content.concat(map.content));
	},
	subtract: function(map) {
		var result = this;
		map = OrderedMap.from(map);
		for (var i = 0; i < map.content.length; i += 2) result = result.remove(map.content[i]);
		return result;
	},
	toObject: function() {
		var result = {};
		this.forEach(function(key, value) {
			result[key] = value;
		});
		return result;
	},
	get size() {
		return this.content.length >> 1;
	}
};
OrderedMap.from = function(value) {
	if (value instanceof OrderedMap) return value;
	var content = [];
	if (value) for (var prop in value) content.push(prop, value[prop]);
	return new OrderedMap(content);
};
//#endregion
//#region node_modules/prosemirror-model/dist/index.js
function findDiffStart$1(a, b, pos) {
	for (let i = 0;; i++) {
		if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
		let childA = a.child(i), childB = b.child(i);
		if (childA == childB) {
			pos += childA.nodeSize;
			continue;
		}
		if (!childA.sameMarkup(childB)) return pos;
		if (childA.isText && childA.text != childB.text) {
			for (let j = 0; childA.text[j] == childB.text[j]; j++) pos++;
			return pos;
		}
		if (childA.content.size || childB.content.size) {
			let inner = findDiffStart$1(childA.content, childB.content, pos + 1);
			if (inner != null) return inner;
		}
		pos += childA.nodeSize;
	}
}
function findDiffEnd$1(a, b, posA, posB) {
	for (let iA = a.childCount, iB = b.childCount;;) {
		if (iA == 0 || iB == 0) return iA == iB ? null : {
			a: posA,
			b: posB
		};
		let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;
		if (childA == childB) {
			posA -= size;
			posB -= size;
			continue;
		}
		if (!childA.sameMarkup(childB)) return {
			a: posA,
			b: posB
		};
		if (childA.isText && childA.text != childB.text) {
			let same = 0, minSize = Math.min(childA.text.length, childB.text.length);
			while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
				same++;
				posA--;
				posB--;
			}
			return {
				a: posA,
				b: posB
			};
		}
		if (childA.content.size || childB.content.size) {
			let inner = findDiffEnd$1(childA.content, childB.content, posA - 1, posB - 1);
			if (inner) return inner;
		}
		posA -= size;
		posB -= size;
	}
}
/**
A fragment represents a node's collection of child nodes.

Like nodes, fragments are persistent data structures, and you
should not mutate them or their content. Rather, you create new
instances whenever needed. The API tries to make this easy.
*/
var Fragment$1 = class Fragment$1 {
	/**
	@internal
	*/
	constructor(content, size) {
		this.content = content;
		this.size = size || 0;
		if (size == null) for (let i = 0; i < content.length; i++) this.size += content[i].nodeSize;
	}
	/**
	Invoke a callback for all descendant nodes between the given two
	positions (relative to start of this fragment). Doesn't descend
	into a node when the callback returns `false`.
	*/
	nodesBetween(from, to, f, nodeStart = 0, parent) {
		for (let i = 0, pos = 0; pos < to; i++) {
			let child = this.content[i], end = pos + child.nodeSize;
			if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
				let start = pos + 1;
				child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
			}
			pos = end;
		}
	}
	/**
	Call the given callback for every descendant node. `pos` will be
	relative to the start of the fragment. The callback may return
	`false` to prevent traversal of a given node's children.
	*/
	descendants(f) {
		this.nodesBetween(0, this.size, f);
	}
	/**
	Extract the text between `from` and `to`. See the same method on
	[`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
	*/
	textBetween(from, to, blockSeparator, leafText) {
		let text = "", first = true;
		this.nodesBetween(from, to, (node, pos) => {
			let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
			if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) if (first) first = false;
			else text += blockSeparator;
			text += nodeText;
		}, 0);
		return text;
	}
	/**
	Create a new fragment containing the combined content of this
	fragment and the other.
	*/
	append(other) {
		if (!other.size) return this;
		if (!this.size) return other;
		let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;
		if (last.isText && last.sameMarkup(first)) {
			content[content.length - 1] = last.withText(last.text + first.text);
			i = 1;
		}
		for (; i < other.content.length; i++) content.push(other.content[i]);
		return new Fragment$1(content, this.size + other.size);
	}
	/**
	Cut out the sub-fragment between the two given positions.
	*/
	cut(from, to = this.size) {
		if (from == 0 && to == this.size) return this;
		let result = [], size = 0;
		if (to > from) for (let i = 0, pos = 0; pos < to; i++) {
			let child = this.content[i], end = pos + child.nodeSize;
			if (end > from) {
				if (pos < from || end > to) if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));
				else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
				result.push(child);
				size += child.nodeSize;
			}
			pos = end;
		}
		return new Fragment$1(result, size);
	}
	/**
	@internal
	*/
	cutByIndex(from, to) {
		if (from == to) return Fragment$1.empty;
		if (from == 0 && to == this.content.length) return this;
		return new Fragment$1(this.content.slice(from, to));
	}
	/**
	Create a new fragment in which the node at the given index is
	replaced by the given node.
	*/
	replaceChild(index, node) {
		let current = this.content[index];
		if (current == node) return this;
		let copy = this.content.slice();
		let size = this.size + node.nodeSize - current.nodeSize;
		copy[index] = node;
		return new Fragment$1(copy, size);
	}
	/**
	Create a new fragment by prepending the given node to this
	fragment.
	*/
	addToStart(node) {
		return new Fragment$1([node].concat(this.content), this.size + node.nodeSize);
	}
	/**
	Create a new fragment by appending the given node to this
	fragment.
	*/
	addToEnd(node) {
		return new Fragment$1(this.content.concat(node), this.size + node.nodeSize);
	}
	/**
	Compare this fragment to another one.
	*/
	eq(other) {
		if (this.content.length != other.content.length) return false;
		for (let i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;
		return true;
	}
	/**
	The first child of the fragment, or `null` if it is empty.
	*/
	get firstChild() {
		return this.content.length ? this.content[0] : null;
	}
	/**
	The last child of the fragment, or `null` if it is empty.
	*/
	get lastChild() {
		return this.content.length ? this.content[this.content.length - 1] : null;
	}
	/**
	The number of child nodes in this fragment.
	*/
	get childCount() {
		return this.content.length;
	}
	/**
	Get the child node at the given index. Raise an error when the
	index is out of range.
	*/
	child(index) {
		let found = this.content[index];
		if (!found) throw new RangeError("Index " + index + " out of range for " + this);
		return found;
	}
	/**
	Get the child node at the given index, if it exists.
	*/
	maybeChild(index) {
		return this.content[index] || null;
	}
	/**
	Call `f` for every child node, passing the node, its offset
	into this parent node, and its index.
	*/
	forEach(f) {
		for (let i = 0, p = 0; i < this.content.length; i++) {
			let child = this.content[i];
			f(child, p, i);
			p += child.nodeSize;
		}
	}
	/**
	Find the first position at which this fragment and another
	fragment differ, or `null` if they are the same.
	*/
	findDiffStart(other, pos = 0) {
		return findDiffStart$1(this, other, pos);
	}
	/**
	Find the first position, searching from the end, at which this
	fragment and the given fragment differ, or `null` if they are
	the same. Since this position will not be the same in both
	nodes, an object with two separate positions is returned.
	*/
	findDiffEnd(other, pos = this.size, otherPos = other.size) {
		return findDiffEnd$1(this, other, pos, otherPos);
	}
	/**
	Find the index and inner offset corresponding to a given relative
	position in this fragment. The result object will be reused
	(overwritten) the next time the function is called. @internal
	*/
	findIndex(pos) {
		if (pos == 0) return retIndex$1(0, pos);
		if (pos == this.size) return retIndex$1(this.content.length, pos);
		if (pos > this.size || pos < 0) throw new RangeError(`Position ${pos} outside of fragment (${this})`);
		for (let i = 0, curPos = 0;; i++) {
			let cur = this.child(i), end = curPos + cur.nodeSize;
			if (end >= pos) {
				if (end == pos) return retIndex$1(i + 1, end);
				return retIndex$1(i, curPos);
			}
			curPos = end;
		}
	}
	/**
	Return a debugging string that describes this fragment.
	*/
	toString() {
		return "<" + this.toStringInner() + ">";
	}
	/**
	@internal
	*/
	toStringInner() {
		return this.content.join(", ");
	}
	/**
	Create a JSON-serializeable representation of this fragment.
	*/
	toJSON() {
		return this.content.length ? this.content.map((n) => n.toJSON()) : null;
	}
	/**
	Deserialize a fragment from its JSON representation.
	*/
	static fromJSON(schema, value) {
		if (!value) return Fragment$1.empty;
		if (!Array.isArray(value)) throw new RangeError("Invalid input for Fragment.fromJSON");
		return Fragment$1.fromArray(value.map(schema.nodeFromJSON));
	}
	/**
	Build a fragment from an array of nodes. Ensures that adjacent
	text nodes with the same marks are joined together.
	*/
	static fromArray(array) {
		if (!array.length) return Fragment$1.empty;
		let joined, size = 0;
		for (let i = 0; i < array.length; i++) {
			let node = array[i];
			size += node.nodeSize;
			if (i && node.isText && array[i - 1].sameMarkup(node)) {
				if (!joined) joined = array.slice(0, i);
				joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);
			} else if (joined) joined.push(node);
		}
		return new Fragment$1(joined || array, size);
	}
	/**
	Create a fragment from something that can be interpreted as a
	set of nodes. For `null`, it returns the empty fragment. For a
	fragment, the fragment itself. For a node or array of nodes, a
	fragment containing those nodes.
	*/
	static from(nodes) {
		if (!nodes) return Fragment$1.empty;
		if (nodes instanceof Fragment$1) return nodes;
		if (Array.isArray(nodes)) return this.fromArray(nodes);
		if (nodes.attrs) return new Fragment$1([nodes], nodes.nodeSize);
		throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
	}
};
/**
An empty fragment. Intended to be reused whenever a node doesn't
contain anything (rather than allocating a new empty fragment for
each leaf node).
*/
Fragment$1.empty = new Fragment$1([], 0);
var found$1 = {
	index: 0,
	offset: 0
};
function retIndex$1(index, offset) {
	found$1.index = index;
	found$1.offset = offset;
	return found$1;
}
function compareDeep$1(a, b) {
	if (a === b) return true;
	if (!(a && typeof a == "object") || !(b && typeof b == "object")) return false;
	let array = Array.isArray(a);
	if (Array.isArray(b) != array) return false;
	if (array) {
		if (a.length != b.length) return false;
		for (let i = 0; i < a.length; i++) if (!compareDeep$1(a[i], b[i])) return false;
	} else {
		for (let p in a) if (!(p in b) || !compareDeep$1(a[p], b[p])) return false;
		for (let p in b) if (!(p in a)) return false;
	}
	return true;
}
/**
A mark is a piece of information that can be attached to a node,
such as it being emphasized, in code font, or a link. It has a
type and optionally a set of attributes that provide further
information (such as the target of the link). Marks are created
through a `Schema`, which controls which types exist and which
attributes they have.
*/
var Mark$2 = class Mark$2 {
	/**
	@internal
	*/
	constructor(type, attrs) {
		this.type = type;
		this.attrs = attrs;
	}
	/**
	Given a set of marks, create a new set which contains this one as
	well, in the right position. If this mark is already in the set,
	the set itself is returned. If any marks that are set to be
	[exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
	those are replaced by this one.
	*/
	addToSet(set) {
		let copy, placed = false;
		for (let i = 0; i < set.length; i++) {
			let other = set[i];
			if (this.eq(other)) return set;
			if (this.type.excludes(other.type)) {
				if (!copy) copy = set.slice(0, i);
			} else if (other.type.excludes(this.type)) return set;
			else {
				if (!placed && other.type.rank > this.type.rank) {
					if (!copy) copy = set.slice(0, i);
					copy.push(this);
					placed = true;
				}
				if (copy) copy.push(other);
			}
		}
		if (!copy) copy = set.slice();
		if (!placed) copy.push(this);
		return copy;
	}
	/**
	Remove this mark from the given set, returning a new set. If this
	mark is not in the set, the set itself is returned.
	*/
	removeFromSet(set) {
		for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));
		return set;
	}
	/**
	Test whether this mark is in the given set of marks.
	*/
	isInSet(set) {
		for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return true;
		return false;
	}
	/**
	Test whether this mark has the same type and attributes as
	another mark.
	*/
	eq(other) {
		return this == other || this.type == other.type && compareDeep$1(this.attrs, other.attrs);
	}
	/**
	Convert this mark to a JSON-serializeable representation.
	*/
	toJSON() {
		let obj = { type: this.type.name };
		for (let _ in this.attrs) {
			obj.attrs = this.attrs;
			break;
		}
		return obj;
	}
	/**
	Deserialize a mark from JSON.
	*/
	static fromJSON(schema, json) {
		if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
		let type = schema.marks[json.type];
		if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
		let mark = type.create(json.attrs);
		type.checkAttrs(mark.attrs);
		return mark;
	}
	/**
	Test whether two sets of marks are identical.
	*/
	static sameSet(a, b) {
		if (a == b) return true;
		if (a.length != b.length) return false;
		for (let i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;
		return true;
	}
	/**
	Create a properly sorted mark set from null, a single mark, or an
	unsorted array of marks.
	*/
	static setFrom(marks) {
		if (!marks || Array.isArray(marks) && marks.length == 0) return Mark$2.none;
		if (marks instanceof Mark$2) return [marks];
		let copy = marks.slice();
		copy.sort((a, b) => a.type.rank - b.type.rank);
		return copy;
	}
};
/**
The empty set of marks.
*/
Mark$2.none = [];
/**
Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when
given an invalid replacement.
*/
var ReplaceError$1 = class extends Error {};
/**
A slice represents a piece cut out of a larger document. It
stores not only a fragment, but also the depth up to which nodes on
both side are ‘open’ (cut through).
*/
var Slice$1 = class Slice$1 {
	/**
	Create a slice. When specifying a non-zero open depth, you must
	make sure that there are nodes of at least that depth at the
	appropriate side of the fragment—i.e. if the fragment is an
	empty paragraph node, `openStart` and `openEnd` can't be greater
	than 1.
	
	It is not necessary for the content of open nodes to conform to
	the schema's content constraints, though it should be a valid
	start/end/middle for such a node, depending on which sides are
	open.
	*/
	constructor(content, openStart, openEnd) {
		this.content = content;
		this.openStart = openStart;
		this.openEnd = openEnd;
	}
	/**
	The size this slice would add when inserted into a document.
	*/
	get size() {
		return this.content.size - this.openStart - this.openEnd;
	}
	/**
	@internal
	*/
	insertAt(pos, fragment) {
		let content = insertInto$1(this.content, pos + this.openStart, fragment, this.openStart + 1, this.openEnd + 1);
		return content && new Slice$1(content, this.openStart, this.openEnd);
	}
	/**
	@internal
	*/
	removeBetween(from, to) {
		return new Slice$1(removeRange$1(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
	}
	/**
	Tests whether this slice is equal to another slice.
	*/
	eq(other) {
		return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;
	}
	/**
	@internal
	*/
	toString() {
		return this.content + "(" + this.openStart + "," + this.openEnd + ")";
	}
	/**
	Convert a slice to a JSON-serializable representation.
	*/
	toJSON() {
		if (!this.content.size) return null;
		let json = { content: this.content.toJSON() };
		if (this.openStart > 0) json.openStart = this.openStart;
		if (this.openEnd > 0) json.openEnd = this.openEnd;
		return json;
	}
	/**
	Deserialize a slice from its JSON representation.
	*/
	static fromJSON(schema, json) {
		if (!json) return Slice$1.empty;
		let openStart = json.openStart || 0, openEnd = json.openEnd || 0;
		if (typeof openStart != "number" || typeof openEnd != "number") throw new RangeError("Invalid input for Slice.fromJSON");
		return new Slice$1(Fragment$1.fromJSON(schema, json.content), openStart, openEnd);
	}
	/**
	Create a slice from a fragment by taking the maximum possible
	open value on both side of the fragment.
	*/
	static maxOpen(fragment, openIsolating = true) {
		let openStart = 0, openEnd = 0;
		for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;
		for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++;
		return new Slice$1(fragment, openStart, openEnd);
	}
};
/**
The empty slice.
*/
Slice$1.empty = new Slice$1(Fragment$1.empty, 0, 0);
function removeRange$1(content, from, to) {
	let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
	let { index: indexTo, offset: offsetTo } = content.findIndex(to);
	if (offset == from || child.isText) {
		if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError("Removing non-flat range");
		return content.cut(0, from).append(content.cut(to));
	}
	if (index != indexTo) throw new RangeError("Removing non-flat range");
	return content.replaceChild(index, child.copy(removeRange$1(child.content, from - offset - 1, to - offset - 1)));
}
function insertInto$1(content, dist, insert, openStart, openEnd, parent) {
	let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
	if (offset == dist || child.isText) {
		if (parent && openStart <= 0 && openEnd <= 0 && !parent.canReplace(index, index, insert)) return null;
		return content.cut(0, dist).append(insert).append(content.cut(dist));
	}
	let inner = insertInto$1(child.content, dist - offset - 1, insert, index == 0 ? openStart - 1 : 0, index == content.childCount - 1 ? openEnd - 1 : 0, child);
	return inner && content.replaceChild(index, child.copy(inner));
}
function replace$1($from, $to, slice) {
	if (slice.openStart > $from.depth) throw new ReplaceError$1("Inserted content deeper than insertion position");
	if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError$1("Inconsistent open depths");
	return replaceOuter$1($from, $to, slice, 0);
}
function replaceOuter$1($from, $to, slice, depth) {
	let index = $from.index(depth), node = $from.node(depth);
	if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
		let inner = replaceOuter$1($from, $to, slice, depth + 1);
		return node.copy(node.content.replaceChild(index, inner));
	} else if (!slice.content.size) return close$1(node, replaceTwoWay$1($from, $to, depth));
	else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {
		let parent = $from.parent, content = parent.content;
		return close$1(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
	} else {
		let { start, end } = prepareSliceForReplace$1(slice, $from);
		return close$1(node, replaceThreeWay$1($from, start, end, $to, depth));
	}
}
function checkJoin$1(main, sub) {
	if (!sub.type.compatibleContent(main.type)) throw new ReplaceError$1("Cannot join " + sub.type.name + " onto " + main.type.name);
}
function joinable$2($before, $after, depth) {
	let node = $before.node(depth);
	checkJoin$1(node, $after.node(depth));
	return node;
}
function addNode$1(child, target) {
	let last = target.length - 1;
	if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);
	else target.push(child);
}
function addRange$1($start, $end, depth, target) {
	let node = ($end || $start).node(depth);
	let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;
	if ($start) {
		startIndex = $start.index(depth);
		if ($start.depth > depth) startIndex++;
		else if ($start.textOffset) {
			addNode$1($start.nodeAfter, target);
			startIndex++;
		}
	}
	for (let i = startIndex; i < endIndex; i++) addNode$1(node.child(i), target);
	if ($end && $end.depth == depth && $end.textOffset) addNode$1($end.nodeBefore, target);
}
function close$1(node, content) {
	node.type.checkContent(content);
	return node.copy(content);
}
function replaceThreeWay$1($from, $start, $end, $to, depth) {
	let openStart = $from.depth > depth && joinable$2($from, $start, depth + 1);
	let openEnd = $to.depth > depth && joinable$2($end, $to, depth + 1);
	let content = [];
	addRange$1(null, $from, depth, content);
	if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {
		checkJoin$1(openStart, openEnd);
		addNode$1(close$1(openStart, replaceThreeWay$1($from, $start, $end, $to, depth + 1)), content);
	} else {
		if (openStart) addNode$1(close$1(openStart, replaceTwoWay$1($from, $start, depth + 1)), content);
		addRange$1($start, $end, depth, content);
		if (openEnd) addNode$1(close$1(openEnd, replaceTwoWay$1($end, $to, depth + 1)), content);
	}
	addRange$1($to, null, depth, content);
	return new Fragment$1(content);
}
function replaceTwoWay$1($from, $to, depth) {
	let content = [];
	addRange$1(null, $from, depth, content);
	if ($from.depth > depth) addNode$1(close$1(joinable$2($from, $to, depth + 1), replaceTwoWay$1($from, $to, depth + 1)), content);
	addRange$1($to, null, depth, content);
	return new Fragment$1(content);
}
function prepareSliceForReplace$1(slice, $along) {
	let extra = $along.depth - slice.openStart;
	let node = $along.node(extra).copy(slice.content);
	for (let i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment$1.from(node));
	return {
		start: node.resolveNoCache(slice.openStart + extra),
		end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
	};
}
/**
You can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more
information about it. Objects of this class represent such a
resolved position, providing various pieces of context
information, and some helper methods.

Throughout this interface, methods that take an optional `depth`
parameter will interpret undefined as `this.depth` and negative
numbers as `this.depth + value`.
*/
var ResolvedPos$1 = class ResolvedPos$1 {
	/**
	@internal
	*/
	constructor(pos, path, parentOffset) {
		this.pos = pos;
		this.path = path;
		this.parentOffset = parentOffset;
		this.depth = path.length / 3 - 1;
	}
	/**
	@internal
	*/
	resolveDepth(val) {
		if (val == null) return this.depth;
		if (val < 0) return this.depth + val;
		return val;
	}
	/**
	The parent node that the position points into. Note that even if
	a position points into a text node, that node is not considered
	the parent—text nodes are ‘flat’ in this model, and have no content.
	*/
	get parent() {
		return this.node(this.depth);
	}
	/**
	The root node in which the position was resolved.
	*/
	get doc() {
		return this.node(0);
	}
	/**
	The ancestor node at the given level. `p.node(p.depth)` is the
	same as `p.parent`.
	*/
	node(depth) {
		return this.path[this.resolveDepth(depth) * 3];
	}
	/**
	The index into the ancestor at the given level. If this points
	at the 3rd node in the 2nd paragraph on the top level, for
	example, `p.index(0)` is 1 and `p.index(1)` is 2.
	*/
	index(depth) {
		return this.path[this.resolveDepth(depth) * 3 + 1];
	}
	/**
	The index pointing after this position into the ancestor at the
	given level.
	*/
	indexAfter(depth) {
		depth = this.resolveDepth(depth);
		return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);
	}
	/**
	The (absolute) position at the start of the node at the given
	level.
	*/
	start(depth) {
		depth = this.resolveDepth(depth);
		return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
	}
	/**
	The (absolute) position at the end of the node at the given
	level.
	*/
	end(depth) {
		depth = this.resolveDepth(depth);
		return this.start(depth) + this.node(depth).content.size;
	}
	/**
	The (absolute) position directly before the wrapping node at the
	given level, or, when `depth` is `this.depth + 1`, the original
	position.
	*/
	before(depth) {
		depth = this.resolveDepth(depth);
		if (!depth) throw new RangeError("There is no position before the top-level node");
		return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];
	}
	/**
	The (absolute) position directly after the wrapping node at the
	given level, or the original position when `depth` is `this.depth + 1`.
	*/
	after(depth) {
		depth = this.resolveDepth(depth);
		if (!depth) throw new RangeError("There is no position after the top-level node");
		return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;
	}
	/**
	When this position points into a text node, this returns the
	distance between the position and the start of the text node.
	Will be zero for positions that point between nodes.
	*/
	get textOffset() {
		return this.pos - this.path[this.path.length - 1];
	}
	/**
	Get the node directly after the position, if any. If the position
	points into a text node, only the part of that node after the
	position is returned.
	*/
	get nodeAfter() {
		let parent = this.parent, index = this.index(this.depth);
		if (index == parent.childCount) return null;
		let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);
		return dOff ? parent.child(index).cut(dOff) : child;
	}
	/**
	Get the node directly before the position, if any. If the
	position points into a text node, only the part of that node
	before the position is returned.
	*/
	get nodeBefore() {
		let index = this.index(this.depth);
		let dOff = this.pos - this.path[this.path.length - 1];
		if (dOff) return this.parent.child(index).cut(0, dOff);
		return index == 0 ? null : this.parent.child(index - 1);
	}
	/**
	Get the position at the given index in the parent node at the
	given depth (which defaults to `this.depth`).
	*/
	posAtIndex(index, depth) {
		depth = this.resolveDepth(depth);
		let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
		for (let i = 0; i < index; i++) pos += node.child(i).nodeSize;
		return pos;
	}
	/**
	Get the marks at this position, factoring in the surrounding
	marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
	position is at the start of a non-empty node, the marks of the
	node after it (if any) are returned.
	*/
	marks() {
		let parent = this.parent, index = this.index();
		if (parent.content.size == 0) return Mark$2.none;
		if (this.textOffset) return parent.child(index).marks;
		let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);
		if (!main) {
			let tmp = main;
			main = other;
			other = tmp;
		}
		let marks = main.marks;
		for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);
		return marks;
	}
	/**
	Get the marks after the current position, if any, except those
	that are non-inclusive and not present at position `$end`. This
	is mostly useful for getting the set of marks to preserve after a
	deletion. Will return `null` if this position is at the end of
	its parent node or its parent node isn't a textblock (in which
	case no marks should be preserved).
	*/
	marksAcross($end) {
		let after = this.parent.maybeChild(this.index());
		if (!after || !after.isInline) return null;
		let marks = after.marks, next = $end.parent.maybeChild($end.index());
		for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);
		return marks;
	}
	/**
	The depth up to which this position and the given (non-resolved)
	position share the same parent nodes.
	*/
	sharedDepth(pos) {
		for (let depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;
		return 0;
	}
	/**
	Returns a range based on the place where this position and the
	given position diverge around block content. If both point into
	the same textblock, for example, a range around that textblock
	will be returned. If they point into different blocks, the range
	around those blocks in their shared ancestor is returned. You can
	pass in an optional predicate that will be called with a parent
	node to see if a range into that parent is acceptable.
	*/
	blockRange(other = this, pred) {
		if (other.pos < this.pos) return other.blockRange(this);
		for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange$1(this, other, d);
		return null;
	}
	/**
	Query whether the given position shares the same parent node.
	*/
	sameParent(other) {
		return this.pos - this.parentOffset == other.pos - other.parentOffset;
	}
	/**
	Return the greater of this and the given position.
	*/
	max(other) {
		return other.pos > this.pos ? other : this;
	}
	/**
	Return the smaller of this and the given position.
	*/
	min(other) {
		return other.pos < this.pos ? other : this;
	}
	/**
	@internal
	*/
	toString() {
		let str = "";
		for (let i = 1; i <= this.depth; i++) str += (str ? "/" : "") + this.node(i).type.name + "_" + this.index(i - 1);
		return str + ":" + this.parentOffset;
	}
	/**
	@internal
	*/
	static resolve(doc, pos) {
		if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError("Position " + pos + " out of range");
		let path = [];
		let start = 0, parentOffset = pos;
		for (let node = doc;;) {
			let { index, offset } = node.content.findIndex(parentOffset);
			let rem = parentOffset - offset;
			path.push(node, index, start + offset);
			if (!rem) break;
			node = node.child(index);
			if (node.isText) break;
			parentOffset = rem - 1;
			start += offset + 1;
		}
		return new ResolvedPos$1(pos, path, parentOffset);
	}
	/**
	@internal
	*/
	static resolveCached(doc, pos) {
		let cache = resolveCache$1.get(doc);
		if (cache) for (let i = 0; i < cache.elts.length; i++) {
			let elt = cache.elts[i];
			if (elt.pos == pos) return elt;
		}
		else resolveCache$1.set(doc, cache = new ResolveCache$1());
		let result = cache.elts[cache.i] = ResolvedPos$1.resolve(doc, pos);
		cache.i = (cache.i + 1) % resolveCacheSize$1;
		return result;
	}
};
var ResolveCache$1 = class {
	constructor() {
		this.elts = [];
		this.i = 0;
	}
};
var resolveCacheSize$1 = 12, resolveCache$1 = /* @__PURE__ */ new WeakMap();
/**
Represents a flat range of content, i.e. one that starts and
ends in the same node.
*/
var NodeRange$1 = class {
	/**
	Construct a node range. `$from` and `$to` should point into the
	same node until at least the given `depth`, since a node range
	denotes an adjacent set of nodes in a single parent node.
	*/
	constructor($from, $to, depth) {
		this.$from = $from;
		this.$to = $to;
		this.depth = depth;
	}
	/**
	The position at the start of the range.
	*/
	get start() {
		return this.$from.before(this.depth + 1);
	}
	/**
	The position at the end of the range.
	*/
	get end() {
		return this.$to.after(this.depth + 1);
	}
	/**
	The parent node that the range points into.
	*/
	get parent() {
		return this.$from.node(this.depth);
	}
	/**
	The start index of the range in the parent node.
	*/
	get startIndex() {
		return this.$from.index(this.depth);
	}
	/**
	The end index of the range in the parent node.
	*/
	get endIndex() {
		return this.$to.indexAfter(this.depth);
	}
};
var emptyAttrs$1 = Object.create(null);
/**
This class represents a node in the tree that makes up a
ProseMirror document. So a document is an instance of `Node`, with
children that are also instances of `Node`.

Nodes are persistent data structures. Instead of changing them, you
create new ones with the content you want. Old ones keep pointing
at the old document shape. This is made cheaper by sharing
structure between the old and new data as much as possible, which a
tree shape like this (without back pointers) makes easy.

**Do not** directly mutate the properties of a `Node` object. See
[the guide](https://prosemirror.net/docs/guide/#doc) for more information.
*/
var Node$1 = class Node$1 {
	/**
	@internal
	*/
	constructor(type, attrs, content, marks = Mark$2.none) {
		this.type = type;
		this.attrs = attrs;
		this.marks = marks;
		this.content = content || Fragment$1.empty;
	}
	/**
	The array of this node's child nodes.
	*/
	get children() {
		return this.content.content;
	}
	/**
	The size of this node, as defined by the integer-based [indexing
	scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
	amount of characters. For other leaf nodes, it is one. For
	non-leaf nodes, it is the size of the content plus two (the
	start and end token).
	*/
	get nodeSize() {
		return this.isLeaf ? 1 : 2 + this.content.size;
	}
	/**
	The number of children that the node has.
	*/
	get childCount() {
		return this.content.childCount;
	}
	/**
	Get the child node at the given index. Raises an error when the
	index is out of range.
	*/
	child(index) {
		return this.content.child(index);
	}
	/**
	Get the child node at the given index, if it exists.
	*/
	maybeChild(index) {
		return this.content.maybeChild(index);
	}
	/**
	Call `f` for every child node, passing the node, its offset
	into this parent node, and its index.
	*/
	forEach(f) {
		this.content.forEach(f);
	}
	/**
	Invoke a callback for all descendant nodes recursively overlapping
	the given two positions that are relative to start of this
	node's content. This includes all ancestors of the nodes
	containing the two positions. The callback is invoked with the
	node, its position relative to the original node (method receiver),
	its parent node, and its child index. When the callback returns
	false for a given node, that node's children will not be
	recursed over. The last parameter can be used to specify a
	starting position to count from.
	*/
	nodesBetween(from, to, f, startPos = 0) {
		this.content.nodesBetween(from, to, f, startPos, this);
	}
	/**
	Call the given callback for every descendant node. Doesn't
	descend into a node when the callback returns `false`.
	*/
	descendants(f) {
		this.nodesBetween(0, this.content.size, f);
	}
	/**
	Concatenates all the text nodes found in this fragment and its
	children.
	*/
	get textContent() {
		return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
	}
	/**
	Get all text between positions `from` and `to`. When
	`blockSeparator` is given, it will be inserted to separate text
	from different block nodes. If `leafText` is given, it'll be
	inserted for every non-text leaf node encountered, otherwise
	[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
	*/
	textBetween(from, to, blockSeparator, leafText) {
		return this.content.textBetween(from, to, blockSeparator, leafText);
	}
	/**
	Returns this node's first child, or `null` if there are no
	children.
	*/
	get firstChild() {
		return this.content.firstChild;
	}
	/**
	Returns this node's last child, or `null` if there are no
	children.
	*/
	get lastChild() {
		return this.content.lastChild;
	}
	/**
	Test whether two nodes represent the same piece of document.
	*/
	eq(other) {
		return this == other || this.sameMarkup(other) && this.content.eq(other.content);
	}
	/**
	Compare the markup (type, attributes, and marks) of this node to
	those of another. Returns `true` if both have the same markup.
	*/
	sameMarkup(other) {
		return this.hasMarkup(other.type, other.attrs, other.marks);
	}
	/**
	Check whether this node's markup correspond to the given type,
	attributes, and marks.
	*/
	hasMarkup(type, attrs, marks) {
		return this.type == type && compareDeep$1(this.attrs, attrs || type.defaultAttrs || emptyAttrs$1) && Mark$2.sameSet(this.marks, marks || Mark$2.none);
	}
	/**
	Create a new node with the same markup as this node, containing
	the given content (or empty, if no content is given).
	*/
	copy(content = null) {
		if (content == this.content) return this;
		return new Node$1(this.type, this.attrs, content, this.marks);
	}
	/**
	Create a copy of this node, with the given set of marks instead
	of the node's own marks.
	*/
	mark(marks) {
		return marks == this.marks ? this : new Node$1(this.type, this.attrs, this.content, marks);
	}
	/**
	Create a copy of this node with only the content between the
	given positions. If `to` is not given, it defaults to the end of
	the node.
	*/
	cut(from, to = this.content.size) {
		if (from == 0 && to == this.content.size) return this;
		return this.copy(this.content.cut(from, to));
	}
	/**
	Cut out the part of the document between the given positions, and
	return it as a `Slice` object.
	*/
	slice(from, to = this.content.size, includeParents = false) {
		if (from == to) return Slice$1.empty;
		let $from = this.resolve(from), $to = this.resolve(to);
		let depth = includeParents ? 0 : $from.sharedDepth(to);
		let start = $from.start(depth);
		return new Slice$1($from.node(depth).content.cut($from.pos - start, $to.pos - start), $from.depth - depth, $to.depth - depth);
	}
	/**
	Replace the part of the document between the given positions with
	the given slice. The slice must 'fit', meaning its open sides
	must be able to connect to the surrounding content, and its
	content nodes must be valid children for the node they are placed
	into. If any of this is violated, an error of type
	[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
	*/
	replace(from, to, slice) {
		return replace$1(this.resolve(from), this.resolve(to), slice);
	}
	/**
	Find the node directly after the given position.
	*/
	nodeAt(pos) {
		for (let node = this;;) {
			let { index, offset } = node.content.findIndex(pos);
			node = node.maybeChild(index);
			if (!node) return null;
			if (offset == pos || node.isText) return node;
			pos -= offset + 1;
		}
	}
	/**
	Find the (direct) child node after the given offset, if any,
	and return it along with its index and offset relative to this
	node.
	*/
	childAfter(pos) {
		let { index, offset } = this.content.findIndex(pos);
		return {
			node: this.content.maybeChild(index),
			index,
			offset
		};
	}
	/**
	Find the (direct) child node before the given offset, if any,
	and return it along with its index and offset relative to this
	node.
	*/
	childBefore(pos) {
		if (pos == 0) return {
			node: null,
			index: 0,
			offset: 0
		};
		let { index, offset } = this.content.findIndex(pos);
		if (offset < pos) return {
			node: this.content.child(index),
			index,
			offset
		};
		let node = this.content.child(index - 1);
		return {
			node,
			index: index - 1,
			offset: offset - node.nodeSize
		};
	}
	/**
	Resolve the given position in the document, returning an
	[object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
	*/
	resolve(pos) {
		return ResolvedPos$1.resolveCached(this, pos);
	}
	/**
	@internal
	*/
	resolveNoCache(pos) {
		return ResolvedPos$1.resolve(this, pos);
	}
	/**
	Test whether a given mark or mark type occurs in this document
	between the two given positions.
	*/
	rangeHasMark(from, to, type) {
		let found = false;
		if (to > from) this.nodesBetween(from, to, (node) => {
			if (type.isInSet(node.marks)) found = true;
			return !found;
		});
		return found;
	}
	/**
	True when this is a block (non-inline node)
	*/
	get isBlock() {
		return this.type.isBlock;
	}
	/**
	True when this is a textblock node, a block node with inline
	content.
	*/
	get isTextblock() {
		return this.type.isTextblock;
	}
	/**
	True when this node allows inline content.
	*/
	get inlineContent() {
		return this.type.inlineContent;
	}
	/**
	True when this is an inline node (a text node or a node that can
	appear among text).
	*/
	get isInline() {
		return this.type.isInline;
	}
	/**
	True when this is a text node.
	*/
	get isText() {
		return this.type.isText;
	}
	/**
	True when this is a leaf node.
	*/
	get isLeaf() {
		return this.type.isLeaf;
	}
	/**
	True when this is an atom, i.e. when it does not have directly
	editable content. This is usually the same as `isLeaf`, but can
	be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
	on a node's spec (typically used when the node is displayed as
	an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
	*/
	get isAtom() {
		return this.type.isAtom;
	}
	/**
	Return a string representation of this node for debugging
	purposes.
	*/
	toString() {
		if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
		let name = this.type.name;
		if (this.content.size) name += "(" + this.content.toStringInner() + ")";
		return wrapMarks$1(this.marks, name);
	}
	/**
	Get the content match in this node at the given index.
	*/
	contentMatchAt(index) {
		let match = this.type.contentMatch.matchFragment(this.content, 0, index);
		if (!match) throw new Error("Called contentMatchAt on a node with invalid content");
		return match;
	}
	/**
	Test whether replacing the range between `from` and `to` (by
	child index) with the given replacement fragment (which defaults
	to the empty fragment) would leave the node's content valid. You
	can optionally pass `start` and `end` indices into the
	replacement fragment.
	*/
	canReplace(from, to, replacement = Fragment$1.empty, start = 0, end = replacement.childCount) {
		let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
		let two = one && one.matchFragment(this.content, to);
		if (!two || !two.validEnd) return false;
		for (let i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;
		return true;
	}
	/**
	Test whether replacing the range `from` to `to` (by index) with
	a node of the given type would leave the node's content valid.
	*/
	canReplaceWith(from, to, type, marks) {
		if (marks && !this.type.allowsMarks(marks)) return false;
		let start = this.contentMatchAt(from).matchType(type);
		let end = start && start.matchFragment(this.content, to);
		return end ? end.validEnd : false;
	}
	/**
	Test whether the given node's content could be appended to this
	node. If that node is empty, this will only return true if there
	is at least one node type that can appear in both nodes (to avoid
	merging completely incompatible nodes).
	*/
	canAppend(other) {
		if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);
		else return this.type.compatibleContent(other.type);
	}
	/**
	Check whether this node and its descendants conform to the
	schema, and raise an exception when they do not.
	*/
	check() {
		this.type.checkContent(this.content);
		this.type.checkAttrs(this.attrs);
		let copy = Mark$2.none;
		for (let i = 0; i < this.marks.length; i++) {
			let mark = this.marks[i];
			mark.type.checkAttrs(mark.attrs);
			copy = mark.addToSet(copy);
		}
		if (!Mark$2.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
		this.content.forEach((node) => node.check());
	}
	/**
	Return a JSON-serializeable representation of this node.
	*/
	toJSON() {
		let obj = { type: this.type.name };
		for (let _ in this.attrs) {
			obj.attrs = this.attrs;
			break;
		}
		if (this.content.size) obj.content = this.content.toJSON();
		if (this.marks.length) obj.marks = this.marks.map((n) => n.toJSON());
		return obj;
	}
	/**
	Deserialize a node from its JSON representation.
	*/
	static fromJSON(schema, json) {
		if (!json) throw new RangeError("Invalid input for Node.fromJSON");
		let marks = void 0;
		if (json.marks) {
			if (!Array.isArray(json.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
			marks = json.marks.map(schema.markFromJSON);
		}
		if (json.type == "text") {
			if (typeof json.text != "string") throw new RangeError("Invalid text node in JSON");
			return schema.text(json.text, marks);
		}
		let content = Fragment$1.fromJSON(schema, json.content);
		let node = schema.nodeType(json.type).create(json.attrs, content, marks);
		node.type.checkAttrs(node.attrs);
		return node;
	}
};
Node$1.prototype.text = void 0;
var TextNode = class TextNode extends Node$1 {
	/**
	@internal
	*/
	constructor(type, attrs, content, marks) {
		super(type, attrs, null, marks);
		if (!content) throw new RangeError("Empty text nodes are not allowed");
		this.text = content;
	}
	toString() {
		if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
		return wrapMarks$1(this.marks, JSON.stringify(this.text));
	}
	get textContent() {
		return this.text;
	}
	textBetween(from, to) {
		return this.text.slice(from, to);
	}
	get nodeSize() {
		return this.text.length;
	}
	mark(marks) {
		return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);
	}
	withText(text) {
		if (text == this.text) return this;
		return new TextNode(this.type, this.attrs, text, this.marks);
	}
	cut(from = 0, to = this.text.length) {
		if (from == 0 && to == this.text.length) return this;
		return this.withText(this.text.slice(from, to));
	}
	eq(other) {
		return this.sameMarkup(other) && this.text == other.text;
	}
	toJSON() {
		let base = super.toJSON();
		base.text = this.text;
		return base;
	}
};
function wrapMarks$1(marks, str) {
	for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
	return str;
}
/**
Instances of this class represent a match state of a node type's
[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
find out whether further content matches here, and whether a given
position is a valid end of the node.
*/
var ContentMatch$1 = class ContentMatch$1 {
	/**
	@internal
	*/
	constructor(validEnd) {
		this.validEnd = validEnd;
		/**
		@internal
		*/
		this.next = [];
		/**
		@internal
		*/
		this.wrapCache = [];
	}
	/**
	@internal
	*/
	static parse(string, nodeTypes) {
		let stream = new TokenStream$1(string, nodeTypes);
		if (stream.next == null) return ContentMatch$1.empty;
		let expr = parseExpr$1(stream);
		if (stream.next) stream.err("Unexpected trailing text");
		let match = dfa$1(nfa$1(expr));
		checkForDeadEnds$1(match, stream);
		return match;
	}
	/**
	Match a node type, returning a match after that node if
	successful.
	*/
	matchType(type) {
		for (let i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;
		return null;
	}
	/**
	Try to match a fragment. Returns the resulting match when
	successful.
	*/
	matchFragment(frag, start = 0, end = frag.childCount) {
		let cur = this;
		for (let i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);
		return cur;
	}
	/**
	@internal
	*/
	get inlineContent() {
		return this.next.length != 0 && this.next[0].type.isInline;
	}
	/**
	Get the first matching node type at this match position that can
	be generated.
	*/
	get defaultType() {
		for (let i = 0; i < this.next.length; i++) {
			let { type } = this.next[i];
			if (!(type.isText || type.hasRequiredAttrs())) return type;
		}
		return null;
	}
	/**
	@internal
	*/
	compatible(other) {
		for (let i = 0; i < this.next.length; i++) for (let j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;
		return false;
	}
	/**
	Try to match the given fragment, and if that fails, see if it can
	be made to match by inserting nodes in front of it. When
	successful, return a fragment of inserted nodes (which may be
	empty if nothing had to be inserted). When `toEnd` is true, only
	return a fragment if the resulting match goes to the end of the
	content expression.
	*/
	fillBefore(after, toEnd = false, startIndex = 0) {
		let seen = [this];
		function search(match, types) {
			let finished = match.matchFragment(after, startIndex);
			if (finished && (!toEnd || finished.validEnd)) return Fragment$1.from(types.map((tp) => tp.createAndFill()));
			for (let i = 0; i < match.next.length; i++) {
				let { type, next } = match.next[i];
				if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
					seen.push(next);
					let found = search(next, types.concat(type));
					if (found) return found;
				}
			}
			return null;
		}
		return search(this, []);
	}
	/**
	Find a set of wrapping node types that would allow a node of the
	given type to appear at this position. The result may be empty
	(when it fits directly) and will be null when no such wrapping
	exists.
	*/
	findWrapping(target) {
		for (let i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];
		let computed = this.computeWrapping(target);
		this.wrapCache.push(target, computed);
		return computed;
	}
	/**
	@internal
	*/
	computeWrapping(target) {
		let seen = Object.create(null), active = [{
			match: this,
			type: null,
			via: null
		}];
		while (active.length) {
			let current = active.shift(), match = current.match;
			if (match.matchType(target)) {
				let result = [];
				for (let obj = current; obj.type; obj = obj.via) result.push(obj.type);
				return result.reverse();
			}
			for (let i = 0; i < match.next.length; i++) {
				let { type, next } = match.next[i];
				if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {
					active.push({
						match: type.contentMatch,
						type,
						via: current
					});
					seen[type.name] = true;
				}
			}
		}
		return null;
	}
	/**
	The number of outgoing edges this node has in the finite
	automaton that describes the content expression.
	*/
	get edgeCount() {
		return this.next.length;
	}
	/**
	Get the _n_​th outgoing edge from this node in the finite
	automaton that describes the content expression.
	*/
	edge(n) {
		if (n >= this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`);
		return this.next[n];
	}
	/**
	@internal
	*/
	toString() {
		let seen = [];
		function scan(m) {
			seen.push(m);
			for (let i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);
		}
		scan(this);
		return seen.map((m, i) => {
			let out = i + (m.validEnd ? "*" : " ") + " ";
			for (let i = 0; i < m.next.length; i++) out += (i ? ", " : "") + m.next[i].type.name + "->" + seen.indexOf(m.next[i].next);
			return out;
		}).join("\n");
	}
};
/**
@internal
*/
ContentMatch$1.empty = new ContentMatch$1(true);
var TokenStream$1 = class {
	constructor(string, nodeTypes) {
		this.string = string;
		this.nodeTypes = nodeTypes;
		this.inline = null;
		this.pos = 0;
		this.tokens = string.split(/\s*(?=\b|\W|$)/);
		if (this.tokens[this.tokens.length - 1] == "") this.tokens.pop();
		if (this.tokens[0] == "") this.tokens.shift();
	}
	get next() {
		return this.tokens[this.pos];
	}
	eat(tok) {
		return this.next == tok && (this.pos++ || true);
	}
	err(str) {
		throw new SyntaxError(str + " (in content expression '" + this.string + "')");
	}
};
function parseExpr$1(stream) {
	let exprs = [];
	do
		exprs.push(parseExprSeq$1(stream));
	while (stream.eat("|"));
	return exprs.length == 1 ? exprs[0] : {
		type: "choice",
		exprs
	};
}
function parseExprSeq$1(stream) {
	let exprs = [];
	do
		exprs.push(parseExprSubscript$1(stream));
	while (stream.next && stream.next != ")" && stream.next != "|");
	return exprs.length == 1 ? exprs[0] : {
		type: "seq",
		exprs
	};
}
function parseExprSubscript$1(stream) {
	let expr = parseExprAtom$1(stream);
	for (;;) if (stream.eat("+")) expr = {
		type: "plus",
		expr
	};
	else if (stream.eat("*")) expr = {
		type: "star",
		expr
	};
	else if (stream.eat("?")) expr = {
		type: "opt",
		expr
	};
	else if (stream.eat("{")) expr = parseExprRange$1(stream, expr);
	else break;
	return expr;
}
function parseNum$1(stream) {
	if (/\D/.test(stream.next)) stream.err("Expected number, got '" + stream.next + "'");
	let result = Number(stream.next);
	stream.pos++;
	return result;
}
function parseExprRange$1(stream, expr) {
	let min = parseNum$1(stream), max = min;
	if (stream.eat(",")) if (stream.next != "}") max = parseNum$1(stream);
	else max = -1;
	if (!stream.eat("}")) stream.err("Unclosed braced range");
	return {
		type: "range",
		min,
		max,
		expr
	};
}
function resolveName$1(stream, name) {
	let types = stream.nodeTypes, type = types[name];
	if (type) return [type];
	let result = [];
	for (let typeName in types) {
		let type = types[typeName];
		if (type.isInGroup(name)) result.push(type);
	}
	if (result.length == 0) stream.err("No node type or group '" + name + "' found");
	return result;
}
function parseExprAtom$1(stream) {
	if (stream.eat("(")) {
		let expr = parseExpr$1(stream);
		if (!stream.eat(")")) stream.err("Missing closing paren");
		return expr;
	} else if (!/\W/.test(stream.next)) {
		let exprs = resolveName$1(stream, stream.next).map((type) => {
			if (stream.inline == null) stream.inline = type.isInline;
			else if (stream.inline != type.isInline) stream.err("Mixing inline and block content");
			return {
				type: "name",
				value: type
			};
		});
		stream.pos++;
		return exprs.length == 1 ? exprs[0] : {
			type: "choice",
			exprs
		};
	} else stream.err("Unexpected token '" + stream.next + "'");
}
function nfa$1(expr) {
	let nfa = [[]];
	connect(compile(expr, 0), node());
	return nfa;
	function node() {
		return nfa.push([]) - 1;
	}
	function edge(from, to, term) {
		let edge = {
			term,
			to
		};
		nfa[from].push(edge);
		return edge;
	}
	function connect(edges, to) {
		edges.forEach((edge) => edge.to = to);
	}
	function compile(expr, from) {
		if (expr.type == "choice") return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);
		else if (expr.type == "seq") for (let i = 0;; i++) {
			let next = compile(expr.exprs[i], from);
			if (i == expr.exprs.length - 1) return next;
			connect(next, from = node());
		}
		else if (expr.type == "star") {
			let loop = node();
			edge(from, loop);
			connect(compile(expr.expr, loop), loop);
			return [edge(loop)];
		} else if (expr.type == "plus") {
			let loop = node();
			connect(compile(expr.expr, from), loop);
			connect(compile(expr.expr, loop), loop);
			return [edge(loop)];
		} else if (expr.type == "opt") return [edge(from)].concat(compile(expr.expr, from));
		else if (expr.type == "range") {
			let cur = from;
			for (let i = 0; i < expr.min; i++) {
				let next = node();
				connect(compile(expr.expr, cur), next);
				cur = next;
			}
			if (expr.max == -1) connect(compile(expr.expr, cur), cur);
			else for (let i = expr.min; i < expr.max; i++) {
				let next = node();
				edge(cur, next);
				connect(compile(expr.expr, cur), next);
				cur = next;
			}
			return [edge(cur)];
		} else if (expr.type == "name") return [edge(from, void 0, expr.value)];
		else throw new Error("Unknown expr type");
	}
}
function cmp$1(a, b) {
	return b - a;
}
function nullFrom$1(nfa, node) {
	let result = [];
	scan(node);
	return result.sort(cmp$1);
	function scan(node) {
		let edges = nfa[node];
		if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);
		result.push(node);
		for (let i = 0; i < edges.length; i++) {
			let { term, to } = edges[i];
			if (!term && result.indexOf(to) == -1) scan(to);
		}
	}
}
function dfa$1(nfa) {
	let labeled = Object.create(null);
	return explore(nullFrom$1(nfa, 0));
	function explore(states) {
		let out = [];
		states.forEach((node) => {
			nfa[node].forEach(({ term, to }) => {
				if (!term) return;
				let set;
				for (let i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];
				nullFrom$1(nfa, to).forEach((node) => {
					if (!set) out.push([term, set = []]);
					if (set.indexOf(node) == -1) set.push(node);
				});
			});
		});
		let state = labeled[states.join(",")] = new ContentMatch$1(states.indexOf(nfa.length - 1) > -1);
		for (let i = 0; i < out.length; i++) {
			let states = out[i][1].sort(cmp$1);
			state.next.push({
				type: out[i][0],
				next: labeled[states.join(",")] || explore(states)
			});
		}
		return state;
	}
}
function checkForDeadEnds$1(match, stream) {
	for (let i = 0, work = [match]; i < work.length; i++) {
		let state = work[i], dead = !state.validEnd, nodes = [];
		for (let j = 0; j < state.next.length; j++) {
			let { type, next } = state.next[j];
			nodes.push(type.name);
			if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;
			if (work.indexOf(next) == -1) work.push(next);
		}
		if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
	}
}
function defaultAttrs(attrs) {
	let defaults = Object.create(null);
	for (let attrName in attrs) {
		let attr = attrs[attrName];
		if (!attr.hasDefault) return null;
		defaults[attrName] = attr.default;
	}
	return defaults;
}
function computeAttrs(attrs, value) {
	let built = Object.create(null);
	for (let name in attrs) {
		let given = value && value[name];
		if (given === void 0) {
			let attr = attrs[name];
			if (attr.hasDefault) given = attr.default;
			else throw new RangeError("No value supplied for attribute " + name);
		}
		built[name] = given;
	}
	return built;
}
function checkAttrs(attrs, values, type, name) {
	for (let name in values) if (!(name in attrs)) throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);
	for (let name in attrs) {
		let attr = attrs[name];
		if (attr.validate) attr.validate(values[name]);
	}
}
function initAttrs(typeName, attrs) {
	let result = Object.create(null);
	if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
	return result;
}
/**
Node types are objects allocated once per `Schema` and used to
[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information
about the node type, such as its name and what kind of node it
represents.
*/
var NodeType$1 = class NodeType$1 {
	/**
	@internal
	*/
	constructor(name, schema, spec) {
		this.name = name;
		this.schema = schema;
		this.spec = spec;
		/**
		The set of marks allowed in this node. `null` means all marks
		are allowed.
		*/
		this.markSet = null;
		this.groups = spec.group ? spec.group.split(" ") : [];
		this.attrs = initAttrs(name, spec.attrs);
		this.defaultAttrs = defaultAttrs(this.attrs);
		this.contentMatch = null;
		this.inlineContent = null;
		this.isBlock = !(spec.inline || name == "text");
		this.isText = name == "text";
	}
	/**
	True if this is an inline type.
	*/
	get isInline() {
		return !this.isBlock;
	}
	/**
	True if this is a textblock type, a block that contains inline
	content.
	*/
	get isTextblock() {
		return this.isBlock && this.inlineContent;
	}
	/**
	True for node types that allow no content.
	*/
	get isLeaf() {
		return this.contentMatch == ContentMatch$1.empty;
	}
	/**
	True when this node is an atom, i.e. when it does not have
	directly editable content.
	*/
	get isAtom() {
		return this.isLeaf || !!this.spec.atom;
	}
	/**
	Return true when this node type is part of the given
	[group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
	*/
	isInGroup(group) {
		return this.groups.indexOf(group) > -1;
	}
	/**
	The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
	*/
	get whitespace() {
		return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
	}
	/**
	Tells you whether this node type has any required attributes.
	*/
	hasRequiredAttrs() {
		for (let n in this.attrs) if (this.attrs[n].isRequired) return true;
		return false;
	}
	/**
	Indicates whether this node allows some of the same content as
	the given node type.
	*/
	compatibleContent(other) {
		return this == other || this.contentMatch.compatible(other.contentMatch);
	}
	/**
	@internal
	*/
	computeAttrs(attrs) {
		if (!attrs && this.defaultAttrs) return this.defaultAttrs;
		else return computeAttrs(this.attrs, attrs);
	}
	/**
	Create a `Node` of this type. The given attributes are
	checked and defaulted (you can pass `null` to use the type's
	defaults entirely, if no required attributes exist). `content`
	may be a `Fragment`, a node, an array of nodes, or
	`null`. Similarly `marks` may be `null` to default to the empty
	set of marks.
	*/
	create(attrs = null, content, marks) {
		if (this.isText) throw new Error("NodeType.create can't construct text nodes");
		return new Node$1(this, this.computeAttrs(attrs), Fragment$1.from(content), Mark$2.setFrom(marks));
	}
	/**
	Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
	against the node type's content restrictions, and throw an error
	if it doesn't match.
	*/
	createChecked(attrs = null, content, marks) {
		content = Fragment$1.from(content);
		this.checkContent(content);
		return new Node$1(this, this.computeAttrs(attrs), content, Mark$2.setFrom(marks));
	}
	/**
	Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
	necessary to add nodes to the start or end of the given fragment
	to make it fit the node. If no fitting wrapping can be found,
	return null. Note that, due to the fact that required nodes can
	always be created, this will always succeed if you pass null or
	`Fragment.empty` as content.
	*/
	createAndFill(attrs = null, content, marks) {
		attrs = this.computeAttrs(attrs);
		content = Fragment$1.from(content);
		if (content.size) {
			let before = this.contentMatch.fillBefore(content);
			if (!before) return null;
			content = before.append(content);
		}
		let matched = this.contentMatch.matchFragment(content);
		let after = matched && matched.fillBefore(Fragment$1.empty, true);
		if (!after) return null;
		return new Node$1(this, attrs, content.append(after), Mark$2.setFrom(marks));
	}
	/**
	Returns true if the given fragment is valid content for this node
	type.
	*/
	validContent(content) {
		let result = this.contentMatch.matchFragment(content);
		if (!result || !result.validEnd) return false;
		for (let i = 0; i < content.childCount; i++) if (!this.allowsMarks(content.child(i).marks)) return false;
		return true;
	}
	/**
	Throws a RangeError if the given fragment is not valid content for this
	node type.
	@internal
	*/
	checkContent(content) {
		if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
	}
	/**
	@internal
	*/
	checkAttrs(attrs) {
		checkAttrs(this.attrs, attrs, "node", this.name);
	}
	/**
	Check whether the given mark type is allowed in this node.
	*/
	allowsMarkType(markType) {
		return this.markSet == null || this.markSet.indexOf(markType) > -1;
	}
	/**
	Test whether the given set of marks are allowed in this node.
	*/
	allowsMarks(marks) {
		if (this.markSet == null) return true;
		for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) return false;
		return true;
	}
	/**
	Removes the marks that are not allowed in this node from the given set.
	*/
	allowedMarks(marks) {
		if (this.markSet == null) return marks;
		let copy;
		for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) {
			if (!copy) copy = marks.slice(0, i);
		} else if (copy) copy.push(marks[i]);
		return !copy ? marks : copy.length ? copy : Mark$2.none;
	}
	/**
	@internal
	*/
	static compile(nodes, schema) {
		let result = Object.create(null);
		nodes.forEach((name, spec) => result[name] = new NodeType$1(name, schema, spec));
		let topType = schema.spec.topNode || "doc";
		if (!result[topType]) throw new RangeError("Schema is missing its top node type ('" + topType + "')");
		if (!result.text) throw new RangeError("Every schema needs a 'text' type");
		for (let _ in result.text.attrs) throw new RangeError("The text node type should not have attributes");
		return result;
	}
};
function validateType(typeName, attrName, type) {
	let types = type.split("|");
	return (value) => {
		let name = value === null ? "null" : typeof value;
		if (types.indexOf(name) < 0) throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);
	};
}
var Attribute = class {
	constructor(typeName, attrName, options) {
		this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
		this.default = options.default;
		this.validate = typeof options.validate == "string" ? validateType(typeName, attrName, options.validate) : options.validate;
	}
	get isRequired() {
		return !this.hasDefault;
	}
};
/**
Like nodes, marks (which are associated with nodes to signify
things like emphasis or being part of a link) are
[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are
instantiated once per `Schema`.
*/
var MarkType = class MarkType {
	/**
	@internal
	*/
	constructor(name, rank, schema, spec) {
		this.name = name;
		this.rank = rank;
		this.schema = schema;
		this.spec = spec;
		this.attrs = initAttrs(name, spec.attrs);
		this.excluded = null;
		let defaults = defaultAttrs(this.attrs);
		this.instance = defaults ? new Mark$2(this, defaults) : null;
	}
	/**
	Create a mark of this type. `attrs` may be `null` or an object
	containing only some of the mark's attributes. The others, if
	they have defaults, will be added.
	*/
	create(attrs = null) {
		if (!attrs && this.instance) return this.instance;
		return new Mark$2(this, computeAttrs(this.attrs, attrs));
	}
	/**
	@internal
	*/
	static compile(marks, schema) {
		let result = Object.create(null), rank = 0;
		marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));
		return result;
	}
	/**
	When there is a mark of this type in the given set, a new set
	without it is returned. Otherwise, the input set is returned.
	*/
	removeFromSet(set) {
		for (var i = 0; i < set.length; i++) if (set[i].type == this) {
			set = set.slice(0, i).concat(set.slice(i + 1));
			i--;
		}
		return set;
	}
	/**
	Tests whether there is a mark of this type in the given set.
	*/
	isInSet(set) {
		for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
	}
	/**
	@internal
	*/
	checkAttrs(attrs) {
		checkAttrs(this.attrs, attrs, "mark", this.name);
	}
	/**
	Queries whether a given mark type is
	[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
	*/
	excludes(other) {
		return this.excluded.indexOf(other) > -1;
	}
};
/**
A document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark
type](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may
occur in conforming documents, and provides functionality for
creating and deserializing such documents.

When given, the type parameters provide the names of the nodes and
marks in this schema.
*/
var Schema = class {
	/**
	Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
	*/
	constructor(spec) {
		/**
		The [linebreak
		replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
		in this schema, if any.
		*/
		this.linebreakReplacement = null;
		/**
		An object for storing whatever values modules may want to
		compute and cache per schema. (If you want to store something
		in it, try to use property names unlikely to clash.)
		*/
		this.cached = Object.create(null);
		let instanceSpec = this.spec = {};
		for (let prop in spec) instanceSpec[prop] = spec[prop];
		instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType$1.compile(this.spec.nodes, this);
		this.marks = MarkType.compile(this.spec.marks, this);
		let contentExprCache = Object.create(null);
		for (let prop in this.nodes) {
			if (prop in this.marks) throw new RangeError(prop + " can not be both a node and a mark");
			let type = this.nodes[prop], contentExpr = type.spec.content || "", markExpr = type.spec.marks;
			type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch$1.parse(contentExpr, this.nodes));
			type.inlineContent = type.contentMatch.inlineContent;
			if (type.spec.linebreakReplacement) {
				if (this.linebreakReplacement) throw new RangeError("Multiple linebreak nodes defined");
				if (!type.isInline || !type.isLeaf) throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
				this.linebreakReplacement = type;
			}
			type.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type.inlineContent ? [] : null;
		}
		for (let prop in this.marks) {
			let type = this.marks[prop], excl = type.spec.excludes;
			type.excluded = excl == null ? [type] : excl == "" ? [] : gatherMarks(this, excl.split(" "));
		}
		this.nodeFromJSON = (json) => Node$1.fromJSON(this, json);
		this.markFromJSON = (json) => Mark$2.fromJSON(this, json);
		this.topNodeType = this.nodes[this.spec.topNode || "doc"];
		this.cached.wrappings = Object.create(null);
	}
	/**
	Create a node in this schema. The `type` may be a string or a
	`NodeType` instance. Attributes will be extended with defaults,
	`content` may be a `Fragment`, `null`, a `Node`, or an array of
	nodes.
	*/
	node(type, attrs = null, content, marks) {
		if (typeof type == "string") type = this.nodeType(type);
		else if (!(type instanceof NodeType$1)) throw new RangeError("Invalid node type: " + type);
		else if (type.schema != this) throw new RangeError("Node type from different schema used (" + type.name + ")");
		return type.createChecked(attrs, content, marks);
	}
	/**
	Create a text node in the schema. Empty text nodes are not
	allowed.
	*/
	text(text, marks) {
		let type = this.nodes.text;
		return new TextNode(type, type.defaultAttrs, text, Mark$2.setFrom(marks));
	}
	/**
	Create a mark with the given type and attributes.
	*/
	mark(type, attrs) {
		if (typeof type == "string") type = this.marks[type];
		return type.create(attrs);
	}
	/**
	@internal
	*/
	nodeType(name) {
		let found = this.nodes[name];
		if (!found) throw new RangeError("Unknown node type: " + name);
		return found;
	}
};
function gatherMarks(schema, marks) {
	let found = [];
	for (let i = 0; i < marks.length; i++) {
		let name = marks[i], mark = schema.marks[name], ok = mark;
		if (mark) found.push(mark);
		else for (let prop in schema.marks) {
			let mark = schema.marks[prop];
			if (name == "_" || mark.spec.group && mark.spec.group.split(" ").indexOf(name) > -1) found.push(ok = mark);
		}
		if (!ok) throw new SyntaxError("Unknown mark type: '" + marks[i] + "'");
	}
	return found;
}
function isTagRule(rule) {
	return rule.tag != null;
}
function isStyleRule(rule) {
	return rule.style != null;
}
/**
A DOM parser represents a strategy for parsing DOM content into a
ProseMirror document conforming to a given schema. Its behavior is
defined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).
*/
var DOMParser = class DOMParser {
	/**
	Create a parser that targets the given schema, using the given
	parsing rules.
	*/
	constructor(schema, rules) {
		this.schema = schema;
		this.rules = rules;
		/**
		@internal
		*/
		this.tags = [];
		/**
		@internal
		*/
		this.styles = [];
		let matchedStyles = this.matchedStyles = [];
		rules.forEach((rule) => {
			if (isTagRule(rule)) this.tags.push(rule);
			else if (isStyleRule(rule)) {
				let prop = /[^=]*/.exec(rule.style)[0];
				if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop);
				this.styles.push(rule);
			}
		});
		this.normalizeLists = !this.tags.some((r) => {
			if (!/^(ul|ol)\b/.test(r.tag) || !r.node) return false;
			let node = schema.nodes[r.node];
			return node.contentMatch.matchType(node);
		});
	}
	/**
	Parse a document from the content of a DOM node.
	*/
	parse(dom, options = {}) {
		let context = new ParseContext(this, options, false);
		context.addAll(dom, Mark$2.none, options.from, options.to);
		return context.finish();
	}
	/**
	Parses the content of the given DOM node, like
	[`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
	options. But unlike that method, which produces a whole node,
	this one returns a slice that is open at the sides, meaning that
	the schema constraints aren't applied to the start of nodes to
	the left of the input and the end of nodes at the end.
	*/
	parseSlice(dom, options = {}) {
		let context = new ParseContext(this, options, true);
		context.addAll(dom, Mark$2.none, options.from, options.to);
		return Slice$1.maxOpen(context.finish());
	}
	/**
	@internal
	*/
	matchTag(dom, context, after) {
		for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {
			let rule = this.tags[i];
			if (matches(dom, rule.tag) && (rule.namespace === void 0 || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) {
				if (rule.getAttrs) {
					let result = rule.getAttrs(dom);
					if (result === false) continue;
					rule.attrs = result || void 0;
				}
				return rule;
			}
		}
	}
	/**
	@internal
	*/
	matchStyle(prop, value, context, after) {
		for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {
			let rule = this.styles[i], style = rule.style;
			if (style.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) || style.length > prop.length && (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value)) continue;
			if (rule.getAttrs) {
				let result = rule.getAttrs(value);
				if (result === false) continue;
				rule.attrs = result || void 0;
			}
			return rule;
		}
	}
	/**
	@internal
	*/
	static schemaRules(schema) {
		let result = [];
		function insert(rule) {
			let priority = rule.priority == null ? 50 : rule.priority, i = 0;
			for (; i < result.length; i++) {
				let next = result[i];
				if ((next.priority == null ? 50 : next.priority) < priority) break;
			}
			result.splice(i, 0, rule);
		}
		for (let name in schema.marks) {
			let rules = schema.marks[name].spec.parseDOM;
			if (rules) rules.forEach((rule) => {
				insert(rule = copy(rule));
				if (!(rule.mark || rule.ignore || rule.clearMark)) rule.mark = name;
			});
		}
		for (let name in schema.nodes) {
			let rules = schema.nodes[name].spec.parseDOM;
			if (rules) rules.forEach((rule) => {
				insert(rule = copy(rule));
				if (!(rule.node || rule.ignore || rule.mark)) rule.node = name;
			});
		}
		return result;
	}
	/**
	Construct a DOM parser using the parsing rules listed in a
	schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
	[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
	*/
	static fromSchema(schema) {
		return schema.cached.domParser || (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));
	}
};
var blockTags = {
	address: true,
	article: true,
	aside: true,
	blockquote: true,
	canvas: true,
	dd: true,
	div: true,
	dl: true,
	fieldset: true,
	figcaption: true,
	figure: true,
	footer: true,
	form: true,
	h1: true,
	h2: true,
	h3: true,
	h4: true,
	h5: true,
	h6: true,
	header: true,
	hgroup: true,
	hr: true,
	li: true,
	noscript: true,
	ol: true,
	output: true,
	p: true,
	pre: true,
	section: true,
	table: true,
	tfoot: true,
	ul: true
};
var ignoreTags = {
	head: true,
	noscript: true,
	object: true,
	script: true,
	style: true,
	title: true
};
var listTags = {
	ol: true,
	ul: true
};
var OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
function wsOptionsFor(type, preserveWhitespace, base) {
	if (preserveWhitespace != null) return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
	return type && type.whitespace == "pre" ? 3 : base & -5;
}
var NodeContext = class {
	constructor(type, attrs, marks, solid, match, options) {
		this.type = type;
		this.attrs = attrs;
		this.marks = marks;
		this.solid = solid;
		this.options = options;
		this.content = [];
		this.activeMarks = Mark$2.none;
		this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
	}
	findWrapping(node) {
		if (!this.match) {
			if (!this.type) return [];
			let fill = this.type.contentMatch.fillBefore(Fragment$1.from(node));
			if (fill) this.match = this.type.contentMatch.matchFragment(fill);
			else {
				let start = this.type.contentMatch, wrap;
				if (wrap = start.findWrapping(node.type)) {
					this.match = start;
					return wrap;
				} else return null;
			}
		}
		return this.match.findWrapping(node.type);
	}
	finish(openEnd) {
		if (!(this.options & OPT_PRESERVE_WS)) {
			let last = this.content[this.content.length - 1], m;
			if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
				let text = last;
				if (last.text.length == m[0].length) this.content.pop();
				else this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
			}
		}
		let content = Fragment$1.from(this.content);
		if (!openEnd && this.match) content = content.append(this.match.fillBefore(Fragment$1.empty, true));
		return this.type ? this.type.create(this.attrs, content, this.marks) : content;
	}
	inlineContext(node) {
		if (this.type) return this.type.inlineContent;
		if (this.content.length) return this.content[0].isInline;
		return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());
	}
};
var ParseContext = class {
	constructor(parser, options, isOpen) {
		this.parser = parser;
		this.options = options;
		this.isOpen = isOpen;
		this.open = 0;
		this.localPreserveWS = false;
		let topNode = options.topNode, topContext;
		let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
		if (topNode) topContext = new NodeContext(topNode.type, topNode.attrs, Mark$2.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
		else if (isOpen) topContext = new NodeContext(null, null, Mark$2.none, true, null, topOptions);
		else topContext = new NodeContext(parser.schema.topNodeType, null, Mark$2.none, true, null, topOptions);
		this.nodes = [topContext];
		this.find = options.findPositions;
		this.needsBlock = false;
	}
	get top() {
		return this.nodes[this.open];
	}
	addDOM(dom, marks) {
		if (dom.nodeType == 3) this.addTextNode(dom, marks);
		else if (dom.nodeType == 1) this.addElement(dom, marks);
	}
	addTextNode(dom, marks) {
		let value = dom.nodeValue;
		let top = this.top, preserveWS = top.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;
		let { schema } = this.parser;
		if (preserveWS === "full" || top.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
			if (!preserveWS) {
				value = value.replace(/[ \t\r\n\u000c]+/g, " ");
				if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
					let nodeBefore = top.content[top.content.length - 1];
					let domNodeBefore = dom.previousSibling;
					if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text)) value = value.slice(1);
				}
			} else if (preserveWS === "full") value = value.replace(/\r\n?/g, "\n");
			else if (schema.linebreakReplacement && /[\r\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {
				let lines = value.split(/\r?\n|\r/);
				for (let i = 0; i < lines.length; i++) {
					if (i) this.insertNode(schema.linebreakReplacement.create(), marks, true);
					if (lines[i]) this.insertNode(schema.text(lines[i]), marks, !/\S/.test(lines[i]));
				}
				value = "";
			} else value = value.replace(/\r?\n|\r/g, " ");
			if (value) this.insertNode(schema.text(value), marks, !/\S/.test(value));
			this.findInText(dom);
		} else this.findInside(dom);
	}
	addElement(dom, marks, matchAfter) {
		let outerWS = this.localPreserveWS, top = this.top;
		if (dom.tagName == "PRE" || /pre/.test(dom.style && dom.style.whiteSpace)) this.localPreserveWS = true;
		let name = dom.nodeName.toLowerCase(), ruleID;
		if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom);
		let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
		out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
			this.findInside(dom);
			this.ignoreFallback(dom, marks);
		} else if (!rule || rule.skip || rule.closeParent) {
			if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1);
			else if (rule && rule.skip.nodeType) dom = rule.skip;
			let sync, oldNeedsBlock = this.needsBlock;
			if (blockTags.hasOwnProperty(name)) {
				if (top.content.length && top.content[0].isInline && this.open) {
					this.open--;
					top = this.top;
				}
				sync = true;
				if (!top.type) this.needsBlock = true;
			} else if (!dom.firstChild) {
				this.leafFallback(dom, marks);
				break out;
			}
			let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
			if (innerMarks) this.addAll(dom, innerMarks);
			if (sync) this.sync(top);
			this.needsBlock = oldNeedsBlock;
		} else {
			let innerMarks = this.readStyles(dom, marks);
			if (innerMarks) this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : void 0);
		}
		this.localPreserveWS = outerWS;
	}
	leafFallback(dom, marks) {
		if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent) this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
	}
	ignoreFallback(dom, marks) {
		if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent)) this.findPlace(this.parser.schema.text("-"), marks, true);
	}
	readStyles(dom, marks) {
		let styles = dom.style;
		if (styles && styles.length) for (let i = 0; i < this.parser.matchedStyles.length; i++) {
			let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);
			if (value) for (let after = void 0;;) {
				let rule = this.parser.matchStyle(name, value, this, after);
				if (!rule) break;
				if (rule.ignore) return null;
				if (rule.clearMark) marks = marks.filter((m) => !rule.clearMark(m));
				else marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
				if (rule.consuming === false) after = rule;
				else break;
			}
		}
		return marks;
	}
	addElementByRule(dom, rule, marks, continueAfter) {
		let sync, nodeType;
		if (rule.node) {
			nodeType = this.parser.schema.nodes[rule.node];
			if (!nodeType.isLeaf) {
				let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
				if (inner) {
					sync = true;
					marks = inner;
				}
			} else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) this.leafFallback(dom, marks);
		} else {
			let markType = this.parser.schema.marks[rule.mark];
			marks = marks.concat(markType.create(rule.attrs));
		}
		let startIn = this.top;
		if (nodeType && nodeType.isLeaf) this.findInside(dom);
		else if (continueAfter) this.addElement(dom, marks, continueAfter);
		else if (rule.getContent) {
			this.findInside(dom);
			rule.getContent(dom, this.parser.schema).forEach((node) => this.insertNode(node, marks, false));
		} else {
			let contentDOM = dom;
			if (typeof rule.contentElement == "string") contentDOM = dom.querySelector(rule.contentElement);
			else if (typeof rule.contentElement == "function") contentDOM = rule.contentElement(dom);
			else if (rule.contentElement) contentDOM = rule.contentElement;
			this.findAround(dom, contentDOM, true);
			this.addAll(contentDOM, marks);
			this.findAround(dom, contentDOM, false);
		}
		if (sync && this.sync(startIn)) this.open--;
	}
	addAll(parent, marks, startIndex, endIndex) {
		let index = startIndex || 0;
		for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {
			this.findAtPoint(parent, index);
			this.addDOM(dom, marks);
		}
		this.findAtPoint(parent, index);
	}
	findPlace(node, marks, cautious) {
		let route, sync;
		for (let depth = this.open, penalty = 0; depth >= 0; depth--) {
			let cx = this.nodes[depth];
			let found = cx.findWrapping(node);
			if (found && (!route || route.length > found.length + penalty)) {
				route = found;
				sync = cx;
				if (!found.length) break;
			}
			if (cx.solid) {
				if (cautious) break;
				penalty += 2;
			}
		}
		if (!route) return null;
		this.sync(sync);
		for (let i = 0; i < route.length; i++) marks = this.enterInner(route[i], null, marks, false);
		return marks;
	}
	insertNode(node, marks, cautious) {
		if (node.isInline && this.needsBlock && !this.top.type) {
			let block = this.textblockFromContext();
			if (block) marks = this.enterInner(block, null, marks);
		}
		let innerMarks = this.findPlace(node, marks, cautious);
		if (innerMarks) {
			this.closeExtra();
			let top = this.top;
			if (top.match) top.match = top.match.matchType(node.type);
			let nodeMarks = Mark$2.none;
			for (let m of innerMarks.concat(node.marks)) if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type)) nodeMarks = m.addToSet(nodeMarks);
			top.content.push(node.mark(nodeMarks));
			return true;
		}
		return false;
	}
	enter(type, attrs, marks, preserveWS) {
		let innerMarks = this.findPlace(type.create(attrs), marks, false);
		if (innerMarks) innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
		return innerMarks;
	}
	enterInner(type, attrs, marks, solid = false, preserveWS) {
		this.closeExtra();
		let top = this.top;
		top.match = top.match && top.match.matchType(type);
		let options = wsOptionsFor(type, preserveWS, top.options);
		if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options |= OPT_OPEN_LEFT;
		let applyMarks = Mark$2.none;
		marks = marks.filter((m) => {
			if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
				applyMarks = m.addToSet(applyMarks);
				return false;
			}
			return true;
		});
		this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
		this.open++;
		return marks;
	}
	closeExtra(openEnd = false) {
		let i = this.nodes.length - 1;
		if (i > this.open) {
			for (; i > this.open; i--) this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));
			this.nodes.length = this.open + 1;
		}
	}
	finish() {
		this.open = 0;
		this.closeExtra(this.isOpen);
		return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
	}
	sync(to) {
		for (let i = this.open; i >= 0; i--) if (this.nodes[i] == to) {
			this.open = i;
			return true;
		} else if (this.localPreserveWS) this.nodes[i].options |= OPT_PRESERVE_WS;
		return false;
	}
	get currentPos() {
		this.closeExtra();
		let pos = 0;
		for (let i = this.open; i >= 0; i--) {
			let content = this.nodes[i].content;
			for (let j = content.length - 1; j >= 0; j--) pos += content[j].nodeSize;
			if (i) pos++;
		}
		return pos;
	}
	findAtPoint(parent, offset) {
		if (this.find) {
			for (let i = 0; i < this.find.length; i++) if (this.find[i].node == parent && this.find[i].offset == offset) this.find[i].pos = this.currentPos;
		}
	}
	findInside(parent) {
		if (this.find) {
			for (let i = 0; i < this.find.length; i++) if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) this.find[i].pos = this.currentPos;
		}
	}
	findAround(parent, content, before) {
		if (parent != content && this.find) {
			for (let i = 0; i < this.find.length; i++) if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {
				if (content.compareDocumentPosition(this.find[i].node) & (before ? 2 : 4)) this.find[i].pos = this.currentPos;
			}
		}
	}
	findInText(textNode) {
		if (this.find) {
			for (let i = 0; i < this.find.length; i++) if (this.find[i].node == textNode) this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);
		}
	}
	matchesContext(context) {
		if (context.indexOf("|") > -1) return context.split(/\s*\|\s*/).some(this.matchesContext, this);
		let parts = context.split("/");
		let option = this.options.context;
		let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);
		let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);
		let match = (i, depth) => {
			for (; i >= 0; i--) {
				let part = parts[i];
				if (part == "") {
					if (i == parts.length - 1 || i == 0) continue;
					for (; depth >= minDepth; depth--) if (match(i - 1, depth)) return true;
					return false;
				} else {
					let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null;
					if (!next || next.name != part && !next.isInGroup(part)) return false;
					depth--;
				}
			}
			return true;
		};
		return match(parts.length - 1, this.open);
	}
	textblockFromContext() {
		let $context = this.options.context;
		if ($context) for (let d = $context.depth; d >= 0; d--) {
			let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;
			if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt;
		}
		for (let name in this.parser.schema.nodes) {
			let type = this.parser.schema.nodes[name];
			if (type.isTextblock && type.defaultAttrs) return type;
		}
	}
};
function normalizeList(dom) {
	for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
		let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;
		if (name && listTags.hasOwnProperty(name) && prevItem) {
			prevItem.appendChild(child);
			child = prevItem;
		} else if (name == "li") prevItem = child;
		else if (name) prevItem = null;
	}
}
function matches(dom, selector) {
	return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);
}
function copy(obj) {
	let copy = {};
	for (let prop in obj) copy[prop] = obj[prop];
	return copy;
}
function markMayApply(markType, nodeType) {
	let nodes = nodeType.schema.nodes;
	for (let name in nodes) {
		let parent = nodes[name];
		if (!parent.allowsMarkType(markType)) continue;
		let seen = [], scan = (match) => {
			seen.push(match);
			for (let i = 0; i < match.edgeCount; i++) {
				let { type, next } = match.edge(i);
				if (type == nodeType) return true;
				if (seen.indexOf(next) < 0 && scan(next)) return true;
			}
		};
		if (scan(parent.contentMatch)) return true;
	}
}
/**
A DOM serializer knows how to convert ProseMirror nodes and
marks of various types to DOM nodes.
*/
var DOMSerializer = class DOMSerializer {
	/**
	Create a serializer. `nodes` should map node names to functions
	that take a node and return a description of the corresponding
	DOM. `marks` does the same for mark names, but also gets an
	argument that tells it whether the mark's content is block or
	inline content (for typical use, it'll always be inline). A mark
	serializer may be `null` to indicate that marks of that type
	should not be serialized.
	*/
	constructor(nodes, marks) {
		this.nodes = nodes;
		this.marks = marks;
	}
	/**
	Serialize the content of this fragment to a DOM fragment. When
	not in the browser, the `document` option, containing a DOM
	document, should be passed so that the serializer can create
	nodes.
	*/
	serializeFragment(fragment, options = {}, target) {
		if (!target) target = doc$1(options).createDocumentFragment();
		let top = target, active = [];
		fragment.forEach((node) => {
			if (active.length || node.marks.length) {
				let keep = 0, rendered = 0;
				while (keep < active.length && rendered < node.marks.length) {
					let next = node.marks[rendered];
					if (!this.marks[next.type.name]) {
						rendered++;
						continue;
					}
					if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) break;
					keep++;
					rendered++;
				}
				while (keep < active.length) top = active.pop()[1];
				while (rendered < node.marks.length) {
					let add = node.marks[rendered++];
					let markDOM = this.serializeMark(add, node.isInline, options);
					if (markDOM) {
						active.push([add, top]);
						top.appendChild(markDOM.dom);
						top = markDOM.contentDOM || markDOM.dom;
					}
				}
			}
			top.appendChild(this.serializeNodeInner(node, options));
		});
		return target;
	}
	/**
	@internal
	*/
	serializeNodeInner(node, options) {
		if (node.isText) return doc$1(options).createTextNode(node.text);
		let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
		if (contentDOM) {
			if (node.isLeaf) throw new RangeError("Content hole not allowed in a leaf node spec");
			this.serializeFragment(node.content, options, contentDOM);
		}
		return dom;
	}
	/**
	Serialize this node to a DOM node. This can be useful when you
	need to serialize a part of a document, as opposed to the whole
	document. To serialize a whole document, use
	[`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
	its [content](https://prosemirror.net/docs/ref/#model.Node.content).
	*/
	serializeNode(node, options = {}) {
		let dom = this.serializeNodeInner(node, options);
		for (let i = node.marks.length - 1; i >= 0; i--) {
			let wrap = this.serializeMark(node.marks[i], node.isInline, options);
			if (wrap) {
				(wrap.contentDOM || wrap.dom).appendChild(dom);
				dom = wrap.dom;
			}
		}
		return dom;
	}
	/**
	@internal
	*/
	serializeMark(mark, inline, options = {}) {
		let toDOM = this.marks[mark.type.name];
		return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
	}
	static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
		if (typeof structure == "string") return { dom: doc.createTextNode(structure) };
		return renderSpec(doc, structure, xmlNS, blockArraysIn);
	}
	/**
	Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
	properties in a schema's node and mark specs.
	*/
	static fromSchema(schema) {
		return schema.cached.domSerializer || (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));
	}
	/**
	Gather the serializers in a schema's node specs into an object.
	This can be useful as a base to build a custom serializer from.
	*/
	static nodesFromSchema(schema) {
		let result = gatherToDOM(schema.nodes);
		if (!result.text) result.text = (node) => node.text;
		return result;
	}
	/**
	Gather the serializers in a schema's mark specs into an object.
	*/
	static marksFromSchema(schema) {
		return gatherToDOM(schema.marks);
	}
};
function gatherToDOM(obj) {
	let result = {};
	for (let name in obj) {
		let toDOM = obj[name].spec.toDOM;
		if (toDOM) result[name] = toDOM;
	}
	return result;
}
function doc$1(options) {
	return options.document || window.document;
}
var suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
function suspiciousAttributes(attrs) {
	let value = suspiciousAttributeCache.get(attrs);
	if (value === void 0) suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
	return value;
}
function suspiciousAttributesInner(attrs) {
	let result = null;
	function scan(value) {
		if (value && typeof value == "object") if (Array.isArray(value)) if (typeof value[0] == "string") {
			if (!result) result = [];
			result.push(value);
		} else for (let i = 0; i < value.length; i++) scan(value[i]);
		else for (let prop in value) scan(value[prop]);
	}
	scan(attrs);
	return result;
}
function renderSpec(doc, structure, xmlNS, blockArraysIn) {
	if (structure.nodeType == 1) return { dom: structure };
	if (structure.dom && structure.dom.nodeType == 1) return structure;
	let tagName = structure[0], suspicious;
	if (typeof tagName != "string") throw new RangeError("Invalid array passed to renderSpec");
	if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -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 space = tagName.indexOf(" ");
	if (space > 0) {
		xmlNS = tagName.slice(0, space);
		tagName = tagName.slice(space + 1);
	}
	let contentDOM;
	let dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);
	let attrs = structure[1], start = 1;
	if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
		start = 2;
		for (let name in attrs) if (attrs[name] != null) {
			let space = name.indexOf(" ");
			if (space > 0) dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);
			else if (name == "style" && dom.style) dom.style.cssText = attrs[name];
			else dom.setAttribute(name, attrs[name]);
		}
	}
	for (let i = start; i < structure.length; i++) {
		let child = structure[i];
		if (child === 0) {
			if (i < structure.length - 1 || i > start) throw new RangeError("Content hole must be the only child of its parent node");
			return {
				dom,
				contentDOM: dom
			};
		} else if (typeof child == "string") dom.appendChild(doc.createTextNode(child));
		else {
			let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);
			dom.appendChild(inner);
			if (innerContent) {
				if (contentDOM) throw new RangeError("Multiple content holes");
				contentDOM = innerContent;
			}
		}
	}
	return {
		dom,
		contentDOM
	};
}
//#endregion
//#region node_modules/prosemirror-transform/dist/index.js
var lower16$1 = 65535;
var factor16$1 = Math.pow(2, 16);
function makeRecover$1(index, offset) {
	return index + offset * factor16$1;
}
function recoverIndex$1(value) {
	return value & lower16$1;
}
function recoverOffset$1(value) {
	return (value - (value & lower16$1)) / factor16$1;
}
var DEL_BEFORE$1 = 1, DEL_AFTER$1 = 2, DEL_ACROSS$1 = 4, DEL_SIDE$1 = 8;
/**
An object representing a mapped position with extra
information.
*/
var MapResult$1 = class {
	/**
	@internal
	*/
	constructor(pos, delInfo, recover) {
		this.pos = pos;
		this.delInfo = delInfo;
		this.recover = recover;
	}
	/**
	Tells you whether the position was deleted, that is, whether the
	step removed the token on the side queried (via the `assoc`)
	argument from the document.
	*/
	get deleted() {
		return (this.delInfo & DEL_SIDE$1) > 0;
	}
	/**
	Tells you whether the token before the mapped position was deleted.
	*/
	get deletedBefore() {
		return (this.delInfo & 5) > 0;
	}
	/**
	True when the token after the mapped position was deleted.
	*/
	get deletedAfter() {
		return (this.delInfo & 6) > 0;
	}
	/**
	Tells whether any of the steps mapped through deletes across the
	position (including both the token before and after the
	position).
	*/
	get deletedAcross() {
		return (this.delInfo & DEL_ACROSS$1) > 0;
	}
};
/**
A map describing the deletions and insertions made by a step, which
can be used to find the correspondence between positions in the
pre-step version of a document and the same position in the
post-step version.
*/
var StepMap$1 = class StepMap$1 {
	/**
	Create a position map. The modifications to the document are
	represented as an array of numbers, in which each group of three
	represents a modified chunk as `[start, oldSize, newSize]`.
	*/
	constructor(ranges, inverted = false) {
		this.ranges = ranges;
		this.inverted = inverted;
		if (!ranges.length && StepMap$1.empty) return StepMap$1.empty;
	}
	/**
	@internal
	*/
	recover(value) {
		let diff = 0, index = recoverIndex$1(value);
		if (!this.inverted) for (let i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
		return this.ranges[index * 3] + diff + recoverOffset$1(value);
	}
	mapResult(pos, assoc = 1) {
		return this._map(pos, assoc, false);
	}
	map(pos, assoc = 1) {
		return this._map(pos, assoc, true);
	}
	/**
	@internal
	*/
	_map(pos, assoc, simple) {
		let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i] - (this.inverted ? diff : 0);
			if (start > pos) break;
			let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
			if (pos <= end) {
				let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
				let result = start + diff + (side < 0 ? 0 : newSize);
				if (simple) return result;
				let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover$1(i / 3, pos - start);
				let del = pos == start ? DEL_AFTER$1 : pos == end ? DEL_BEFORE$1 : DEL_ACROSS$1;
				if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE$1;
				return new MapResult$1(result, del, recover);
			}
			diff += newSize - oldSize;
		}
		return simple ? pos + diff : new MapResult$1(pos + diff, 0, null);
	}
	/**
	@internal
	*/
	touches(pos, recover) {
		let diff = 0, index = recoverIndex$1(recover);
		let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i] - (this.inverted ? diff : 0);
			if (start > pos) break;
			let oldSize = this.ranges[i + oldIndex];
			if (pos <= start + oldSize && i == index * 3) return true;
			diff += this.ranges[i + newIndex] - oldSize;
		}
		return false;
	}
	/**
	Calls the given function on each of the changed ranges included in
	this map.
	*/
	forEach(f) {
		let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
			let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
			f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
			diff += newSize - oldSize;
		}
	}
	/**
	Create an inverted version of this map. The result can be used to
	map positions in the post-step document to the pre-step document.
	*/
	invert() {
		return new StepMap$1(this.ranges, !this.inverted);
	}
	/**
	@internal
	*/
	toString() {
		return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
	}
	/**
	Create a map that moves all positions by offset `n` (which may be
	negative). This can be useful when applying steps meant for a
	sub-document to a larger document, or vice-versa.
	*/
	static offset(n) {
		return n == 0 ? StepMap$1.empty : new StepMap$1(n < 0 ? [
			0,
			-n,
			0
		] : [
			0,
			0,
			n
		]);
	}
};
/**
A StepMap that contains no changed ranges.
*/
StepMap$1.empty = new StepMap$1([]);
/**
A mapping represents a pipeline of zero or more [step
maps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly
handling mapping positions through a series of steps in which some
steps are inverted versions of earlier steps. (This comes up when
‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for
collaboration or history management.)
*/
var Mapping = class Mapping {
	/**
	Create a new mapping with the given position maps.
	*/
	constructor(maps, mirror, from = 0, to = maps ? maps.length : 0) {
		this.mirror = mirror;
		this.from = from;
		this.to = to;
		this._maps = maps || [];
		this.ownData = !(maps || mirror);
	}
	/**
	The step maps in this mapping.
	*/
	get maps() {
		return this._maps;
	}
	/**
	Create a mapping that maps only through a part of this one.
	*/
	slice(from = 0, to = this.maps.length) {
		return new Mapping(this._maps, this.mirror, from, to);
	}
	/**
	Add a step map to the end of this mapping. If `mirrors` is
	given, it should be the index of the step map that is the mirror
	image of this one.
	*/
	appendMap(map, mirrors) {
		if (!this.ownData) {
			this._maps = this._maps.slice();
			this.mirror = this.mirror && this.mirror.slice();
			this.ownData = true;
		}
		this.to = this._maps.push(map);
		if (mirrors != null) this.setMirror(this._maps.length - 1, mirrors);
	}
	/**
	Add all the step maps in a given mapping to this one (preserving
	mirroring information).
	*/
	appendMapping(mapping) {
		for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
			let mirr = mapping.getMirror(i);
			this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : void 0);
		}
	}
	/**
	Finds the offset of the step map that mirrors the map at the
	given offset, in this mapping (as per the second argument to
	`appendMap`).
	*/
	getMirror(n) {
		if (this.mirror) {
			for (let i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];
		}
	}
	/**
	@internal
	*/
	setMirror(n, m) {
		if (!this.mirror) this.mirror = [];
		this.mirror.push(n, m);
	}
	/**
	Append the inverse of the given mapping to this one.
	*/
	appendMappingInverted(mapping) {
		for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
			let mirr = mapping.getMirror(i);
			this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : void 0);
		}
	}
	/**
	Create an inverted version of this mapping.
	*/
	invert() {
		let inverse = new Mapping();
		inverse.appendMappingInverted(this);
		return inverse;
	}
	/**
	Map a position through this mapping.
	*/
	map(pos, assoc = 1) {
		if (this.mirror) return this._map(pos, assoc, true);
		for (let i = this.from; i < this.to; i++) pos = this._maps[i].map(pos, assoc);
		return pos;
	}
	/**
	Map a position through this mapping, returning a mapping
	result.
	*/
	mapResult(pos, assoc = 1) {
		return this._map(pos, assoc, false);
	}
	/**
	@internal
	*/
	_map(pos, assoc, simple) {
		let delInfo = 0;
		for (let i = this.from; i < this.to; i++) {
			let result = this._maps[i].mapResult(pos, assoc);
			if (result.recover != null) {
				let corr = this.getMirror(i);
				if (corr != null && corr > i && corr < this.to) {
					i = corr;
					pos = this._maps[corr].recover(result.recover);
					continue;
				}
			}
			delInfo |= result.delInfo;
			pos = result.pos;
		}
		return simple ? pos : new MapResult$1(pos, delInfo, null);
	}
};
var stepsByID$1 = Object.create(null);
/**
A step object represents an atomic change. It generally applies
only to the document it was created for, since the positions
stored in it will only make sense for that document.

New steps are defined by creating classes that extend `Step`,
overriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`
methods, and registering your class with a unique
JSON-serialization identifier using
[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).
*/
var Step$1 = class {
	/**
	Get the step map that represents the changes made by this step,
	and which can be used to transform between positions in the old
	and the new document.
	*/
	getMap() {
		return StepMap$1.empty;
	}
	/**
	Try to merge this step with another one, to be applied directly
	after it. Returns the merged step when possible, null if the
	steps can't be merged.
	*/
	merge(other) {
		return null;
	}
	/**
	Deserialize a step from its JSON representation. Will call
	through to the step class' own implementation of this method.
	*/
	static fromJSON(schema, json) {
		if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON");
		let type = stepsByID$1[json.stepType];
		if (!type) throw new RangeError(`No step type ${json.stepType} defined`);
		return type.fromJSON(schema, json);
	}
	/**
	To be able to serialize steps to JSON, each step needs a string
	ID to attach to its JSON representation. Use this method to
	register an ID for your step classes. Try to pick something
	that's unlikely to clash with steps from other modules.
	*/
	static jsonID(id, stepClass) {
		if (id in stepsByID$1) throw new RangeError("Duplicate use of step JSON ID " + id);
		stepsByID$1[id] = stepClass;
		stepClass.prototype.jsonID = id;
		return stepClass;
	}
};
/**
The result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a
new document or a failure value.
*/
var StepResult$1 = class StepResult$1 {
	/**
	@internal
	*/
	constructor(doc, failed) {
		this.doc = doc;
		this.failed = failed;
	}
	/**
	Create a successful step result.
	*/
	static ok(doc) {
		return new StepResult$1(doc, null);
	}
	/**
	Create a failed step result.
	*/
	static fail(message) {
		return new StepResult$1(null, message);
	}
	/**
	Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
	arguments. Create a successful result if it succeeds, and a
	failed one if it throws a `ReplaceError`.
	*/
	static fromReplace(doc, from, to, slice) {
		try {
			return StepResult$1.ok(doc.replace(from, to, slice));
		} catch (e) {
			if (e instanceof ReplaceError$1) return StepResult$1.fail(e.message);
			throw e;
		}
	}
};
function mapFragment$1(fragment, f, parent) {
	let mapped = [];
	for (let i = 0; i < fragment.childCount; i++) {
		let child = fragment.child(i);
		if (child.content.size) child = child.copy(mapFragment$1(child.content, f, child));
		if (child.isInline) child = f(child, parent, i);
		mapped.push(child);
	}
	return Fragment$1.fromArray(mapped);
}
/**
Add a mark to all inline content between two positions.
*/
var AddMarkStep$1 = class AddMarkStep$1 extends Step$1 {
	/**
	Create a mark step.
	*/
	constructor(from, to, mark) {
		super();
		this.from = from;
		this.to = to;
		this.mark = mark;
	}
	apply(doc) {
		let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
		let parent = $from.node($from.sharedDepth(this.to));
		let slice = new Slice$1(mapFragment$1(oldSlice.content, (node, parent) => {
			if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type)) return node;
			return node.mark(this.mark.addToSet(node.marks));
		}, parent), oldSlice.openStart, oldSlice.openEnd);
		return StepResult$1.fromReplace(doc, this.from, this.to, slice);
	}
	invert() {
		return new RemoveMarkStep$1(this.from, this.to, this.mark);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		if (from.deleted && to.deleted || from.pos >= to.pos) return null;
		return new AddMarkStep$1(from.pos, to.pos, this.mark);
	}
	merge(other) {
		if (other instanceof AddMarkStep$1 && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep$1(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
		return null;
	}
	toJSON() {
		return {
			stepType: "addMark",
			mark: this.mark.toJSON(),
			from: this.from,
			to: this.to
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
		return new AddMarkStep$1(json.from, json.to, schema.markFromJSON(json.mark));
	}
};
Step$1.jsonID("addMark", AddMarkStep$1);
/**
Remove a mark from all inline content between two positions.
*/
var RemoveMarkStep$1 = class RemoveMarkStep$1 extends Step$1 {
	/**
	Create a mark-removing step.
	*/
	constructor(from, to, mark) {
		super();
		this.from = from;
		this.to = to;
		this.mark = mark;
	}
	apply(doc) {
		let oldSlice = doc.slice(this.from, this.to);
		let slice = new Slice$1(mapFragment$1(oldSlice.content, (node) => {
			return node.mark(this.mark.removeFromSet(node.marks));
		}, doc), oldSlice.openStart, oldSlice.openEnd);
		return StepResult$1.fromReplace(doc, this.from, this.to, slice);
	}
	invert() {
		return new AddMarkStep$1(this.from, this.to, this.mark);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		if (from.deleted && to.deleted || from.pos >= to.pos) return null;
		return new RemoveMarkStep$1(from.pos, to.pos, this.mark);
	}
	merge(other) {
		if (other instanceof RemoveMarkStep$1 && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep$1(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
		return null;
	}
	toJSON() {
		return {
			stepType: "removeMark",
			mark: this.mark.toJSON(),
			from: this.from,
			to: this.to
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
		return new RemoveMarkStep$1(json.from, json.to, schema.markFromJSON(json.mark));
	}
};
Step$1.jsonID("removeMark", RemoveMarkStep$1);
/**
Add a mark to a specific node.
*/
var AddNodeMarkStep$1 = class AddNodeMarkStep$1 extends Step$1 {
	/**
	Create a node mark step.
	*/
	constructor(pos, mark) {
		super();
		this.pos = pos;
		this.mark = mark;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult$1.fail("No node at mark step's position");
		let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
		return StepResult$1.fromReplace(doc, this.pos, this.pos + 1, new Slice$1(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	invert(doc) {
		let node = doc.nodeAt(this.pos);
		if (node) {
			let newSet = this.mark.addToSet(node.marks);
			if (newSet.length == node.marks.length) {
				for (let i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep$1(this.pos, node.marks[i]);
				return new AddNodeMarkStep$1(this.pos, this.mark);
			}
		}
		return new RemoveNodeMarkStep$1(this.pos, this.mark);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new AddNodeMarkStep$1(pos.pos, this.mark);
	}
	toJSON() {
		return {
			stepType: "addNodeMark",
			pos: this.pos,
			mark: this.mark.toJSON()
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
		return new AddNodeMarkStep$1(json.pos, schema.markFromJSON(json.mark));
	}
};
Step$1.jsonID("addNodeMark", AddNodeMarkStep$1);
/**
Remove a mark from a specific node.
*/
var RemoveNodeMarkStep$1 = class RemoveNodeMarkStep$1 extends Step$1 {
	/**
	Create a mark-removing step.
	*/
	constructor(pos, mark) {
		super();
		this.pos = pos;
		this.mark = mark;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult$1.fail("No node at mark step's position");
		let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
		return StepResult$1.fromReplace(doc, this.pos, this.pos + 1, new Slice$1(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	invert(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node || !this.mark.isInSet(node.marks)) return this;
		return new AddNodeMarkStep$1(this.pos, this.mark);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new RemoveNodeMarkStep$1(pos.pos, this.mark);
	}
	toJSON() {
		return {
			stepType: "removeNodeMark",
			pos: this.pos,
			mark: this.mark.toJSON()
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
		return new RemoveNodeMarkStep$1(json.pos, schema.markFromJSON(json.mark));
	}
};
Step$1.jsonID("removeNodeMark", RemoveNodeMarkStep$1);
/**
Replace a part of the document with a slice of new content.
*/
var ReplaceStep$1 = class ReplaceStep$1 extends Step$1 {
	/**
	The given `slice` should fit the 'gap' between `from` and
	`to`—the depths must line up, and the surrounding nodes must be
	able to be joined with the open sides of the slice. When
	`structure` is true, the step will fail if the content between
	from and to is not just a sequence of closing and then opening
	tokens (this is to guard against rebased replace steps
	overwriting something they weren't supposed to).
	*/
	constructor(from, to, slice, structure = false) {
		super();
		this.from = from;
		this.to = to;
		this.slice = slice;
		this.structure = structure;
	}
	apply(doc) {
		if (this.structure && contentBetween$1(doc, this.from, this.to)) return StepResult$1.fail("Structure replace would overwrite content");
		return StepResult$1.fromReplace(doc, this.from, this.to, this.slice);
	}
	getMap() {
		return new StepMap$1([
			this.from,
			this.to - this.from,
			this.slice.size
		]);
	}
	invert(doc) {
		return new ReplaceStep$1(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
	}
	map(mapping) {
		let to = mapping.mapResult(this.to, -1);
		let from = this.from == this.to && ReplaceStep$1.MAP_BIAS < 0 ? to : mapping.mapResult(this.from, 1);
		if (from.deletedAcross && to.deletedAcross) return null;
		return new ReplaceStep$1(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
	}
	merge(other) {
		if (!(other instanceof ReplaceStep$1) || other.structure || this.structure) return null;
		if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
			let slice = this.slice.size + other.slice.size == 0 ? Slice$1.empty : new Slice$1(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
			return new ReplaceStep$1(this.from, this.to + (other.to - other.from), slice, this.structure);
		} else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
			let slice = this.slice.size + other.slice.size == 0 ? Slice$1.empty : new Slice$1(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
			return new ReplaceStep$1(other.from, this.to, slice, this.structure);
		} else return null;
	}
	toJSON() {
		let json = {
			stepType: "replace",
			from: this.from,
			to: this.to
		};
		if (this.slice.size) json.slice = this.slice.toJSON();
		if (this.structure) json.structure = true;
		return json;
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
		return new ReplaceStep$1(json.from, json.to, Slice$1.fromJSON(schema, json.slice), !!json.structure);
	}
};
/**
By default, for backwards compatibility, an inserting step
mapped over an insertion at that same position fill move after
the inserted content. In a collaborative editing situation, that
can make redone insertions appear in unexpected places. You can
set this to -1 to make such mapping keep the step before the
insertion instead.
*/
ReplaceStep$1.MAP_BIAS = 1;
Step$1.jsonID("replace", ReplaceStep$1);
/**
Replace a part of the document with a slice of content, but
preserve a range of the replaced content by moving it into the
slice.
*/
var ReplaceAroundStep$1 = class ReplaceAroundStep$1 extends Step$1 {
	/**
	Create a replace-around step with the given range and gap.
	`insert` should be the point in the slice into which the content
	of the gap should be moved. `structure` has the same meaning as
	it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
	*/
	constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
		super();
		this.from = from;
		this.to = to;
		this.gapFrom = gapFrom;
		this.gapTo = gapTo;
		this.slice = slice;
		this.insert = insert;
		this.structure = structure;
	}
	apply(doc) {
		if (this.structure && (contentBetween$1(doc, this.from, this.gapFrom) || contentBetween$1(doc, this.gapTo, this.to))) return StepResult$1.fail("Structure gap-replace would overwrite content");
		let gap = doc.slice(this.gapFrom, this.gapTo);
		if (gap.openStart || gap.openEnd) return StepResult$1.fail("Gap is not a flat range");
		let inserted = this.slice.insertAt(this.insert, gap.content);
		if (!inserted) return StepResult$1.fail("Content does not fit in gap");
		return StepResult$1.fromReplace(doc, this.from, this.to, inserted);
	}
	getMap() {
		return new StepMap$1([
			this.from,
			this.gapFrom - this.from,
			this.insert,
			this.gapTo,
			this.to - this.gapTo,
			this.slice.size - this.insert
		]);
	}
	invert(doc) {
		let gap = this.gapTo - this.gapFrom;
		return new ReplaceAroundStep$1(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
		let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
		if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
		return new ReplaceAroundStep$1(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
	}
	toJSON() {
		let json = {
			stepType: "replaceAround",
			from: this.from,
			to: this.to,
			gapFrom: this.gapFrom,
			gapTo: this.gapTo,
			insert: this.insert
		};
		if (this.slice.size) json.slice = this.slice.toJSON();
		if (this.structure) json.structure = true;
		return json;
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
		return new ReplaceAroundStep$1(json.from, json.to, json.gapFrom, json.gapTo, Slice$1.fromJSON(schema, json.slice), json.insert, !!json.structure);
	}
};
Step$1.jsonID("replaceAround", ReplaceAroundStep$1);
function contentBetween$1(doc, from, to) {
	let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
	while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
		depth--;
		dist--;
	}
	if (dist > 0) {
		let next = $from.node(depth).maybeChild($from.indexAfter(depth));
		while (dist > 0) {
			if (!next || next.isLeaf) return true;
			next = next.firstChild;
			dist--;
		}
	}
	return false;
}
function addMark(tr, from, to, mark) {
	let removed = [], added = [];
	let removing, adding;
	tr.doc.nodesBetween(from, to, (node, pos, parent) => {
		if (!node.isInline) return;
		let marks = node.marks;
		if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
			let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
			let newSet = mark.addToSet(marks);
			for (let i = 0; i < marks.length; i++) if (!marks[i].isInSet(newSet)) if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;
			else removed.push(removing = new RemoveMarkStep$1(start, end, marks[i]));
			if (adding && adding.to == start) adding.to = end;
			else added.push(adding = new AddMarkStep$1(start, end, mark));
		}
	});
	removed.forEach((s) => tr.step(s));
	added.forEach((s) => tr.step(s));
}
function removeMark(tr, from, to, mark) {
	let matched = [], step = 0;
	tr.doc.nodesBetween(from, to, (node, pos) => {
		if (!node.isInline) return;
		step++;
		let toRemove = null;
		if (mark instanceof MarkType) {
			let set = node.marks, found;
			while (found = mark.isInSet(set)) {
				(toRemove || (toRemove = [])).push(found);
				set = found.removeFromSet(set);
			}
		} else if (mark) {
			if (mark.isInSet(node.marks)) toRemove = [mark];
		} else toRemove = node.marks;
		if (toRemove && toRemove.length) {
			let end = Math.min(pos + node.nodeSize, to);
			for (let i = 0; i < toRemove.length; i++) {
				let style = toRemove[i], found;
				for (let j = 0; j < matched.length; j++) {
					let m = matched[j];
					if (m.step == step - 1 && style.eq(matched[j].style)) found = m;
				}
				if (found) {
					found.to = end;
					found.step = step;
				} else matched.push({
					style,
					from: Math.max(pos, from),
					to: end,
					step
				});
			}
		}
	});
	matched.forEach((m) => tr.step(new RemoveMarkStep$1(m.from, m.to, m.style)));
}
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
	let node = tr.doc.nodeAt(pos);
	let replSteps = [], cur = pos + 1;
	for (let i = 0; i < node.childCount; i++) {
		let child = node.child(i), end = cur + child.nodeSize;
		let allowed = match.matchType(child.type);
		if (!allowed) replSteps.push(new ReplaceStep$1(cur, end, Slice$1.empty));
		else {
			match = allowed;
			for (let j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep$1(cur, end, child.marks[j]));
			if (clearNewlines && child.isText && parentType.whitespace != "pre") {
				let m, newline = /\r?\n|\r/g, slice;
				while (m = newline.exec(child.text)) {
					if (!slice) slice = new Slice$1(Fragment$1.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
					replSteps.push(new ReplaceStep$1(cur + m.index, cur + m.index + m[0].length, slice));
				}
			}
		}
		cur = end;
	}
	if (!match.validEnd) {
		let fill = match.fillBefore(Fragment$1.empty, true);
		tr.replace(cur, cur, new Slice$1(fill, 0, 0));
	}
	for (let i = replSteps.length - 1; i >= 0; i--) tr.step(replSteps[i]);
}
function canCut(node, start, end) {
	return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
}
/**
Try to find a target depth to which the content in the given range
can be lifted. Will not go across
[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.
*/
function liftTarget(range) {
	let content = range.parent.content.cutByIndex(range.startIndex, range.endIndex);
	for (let depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {
		let node = range.$from.node(depth);
		let index = range.$from.index(depth) + contentBefore, endIndex = range.$to.indexAfter(depth) - contentAfter;
		if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;
		if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;
		if (index) contentBefore = 1;
		if (endIndex < node.childCount) contentAfter = 1;
	}
	return null;
}
function lift$2(tr, range, target) {
	let { $from, $to, depth } = range;
	let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
	let start = gapStart, end = gapEnd;
	let before = Fragment$1.empty, openStart = 0;
	for (let d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {
		splitting = true;
		before = Fragment$1.from($from.node(d).copy(before));
		openStart++;
	} else start--;
	let after = Fragment$1.empty, openEnd = 0;
	for (let d = depth, splitting = false; d > target; d--) if (splitting || $to.after(d + 1) < $to.end(d)) {
		splitting = true;
		after = Fragment$1.from($to.node(d).copy(after));
		openEnd++;
	} else end++;
	tr.step(new ReplaceAroundStep$1(start, end, gapStart, gapEnd, new Slice$1(before.append(after), openStart, openEnd), before.size - openStart, true));
}
/**
Try to find a valid way to wrap the content in the given range in a
node of the given type. May introduce extra nodes around and inside
the wrapper node, if necessary. Returns null if no valid wrapping
could be found. When `innerRange` is given, that range's content is
used as the content to fit into the wrapping, instead of the
content of `range`.
*/
function findWrapping(range, nodeType, attrs = null, innerRange = range) {
	let around = findWrappingOutside(range, nodeType);
	let inner = around && findWrappingInside(innerRange, nodeType);
	if (!inner) return null;
	return around.map(withAttrs).concat({
		type: nodeType,
		attrs
	}).concat(inner.map(withAttrs));
}
function withAttrs(type) {
	return {
		type,
		attrs: null
	};
}
function findWrappingOutside(range, type) {
	let { parent, startIndex, endIndex } = range;
	let around = parent.contentMatchAt(startIndex).findWrapping(type);
	if (!around) return null;
	let outer = around.length ? around[0] : type;
	return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
}
function findWrappingInside(range, type) {
	let { parent, startIndex, endIndex } = range;
	let inner = parent.child(startIndex);
	let inside = type.contentMatch.findWrapping(inner.type);
	if (!inside) return null;
	let innerMatch = (inside.length ? inside[inside.length - 1] : type).contentMatch;
	for (let i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);
	if (!innerMatch || !innerMatch.validEnd) return null;
	return inside;
}
function wrap(tr, range, wrappers) {
	let content = Fragment$1.empty;
	for (let i = wrappers.length - 1; i >= 0; i--) {
		if (content.size) {
			let match = wrappers[i].type.contentMatch.matchFragment(content);
			if (!match || !match.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
		}
		content = Fragment$1.from(wrappers[i].type.create(wrappers[i].attrs, content));
	}
	let start = range.start, end = range.end;
	tr.step(new ReplaceAroundStep$1(start, end, start, end, new Slice$1(content, 0, 0), wrappers.length, true));
}
function setBlockType$1(tr, from, to, type, attrs) {
	if (!type.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
	let mapFrom = tr.steps.length;
	tr.doc.nodesBetween(from, to, (node, pos) => {
		let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
		if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
			let convertNewlines = null;
			if (type.schema.linebreakReplacement) {
				let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
				if (pre && !supportLinebreak) convertNewlines = false;
				else if (!pre && supportLinebreak) convertNewlines = true;
			}
			if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);
			clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
			let mapping = tr.mapping.slice(mapFrom);
			let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
			tr.step(new ReplaceAroundStep$1(startM, endM, startM + 1, endM - 1, new Slice$1(Fragment$1.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
			if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);
			return false;
		}
	});
}
function replaceNewlines(tr, node, pos, mapFrom) {
	node.forEach((child, offset) => {
		if (child.isText) {
			let m, newline = /\r?\n|\r/g;
			while (m = newline.exec(child.text)) {
				let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
				tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
			}
		}
	});
}
function replaceLinebreaks(tr, node, pos, mapFrom) {
	node.forEach((child, offset) => {
		if (child.type == child.type.schema.linebreakReplacement) {
			let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
			tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
		}
	});
}
function canChangeType(doc, pos, type) {
	let $pos = doc.resolve(pos), index = $pos.index();
	return $pos.parent.canReplaceWith(index, index + 1, type);
}
/**
Change the type, attributes, and/or marks of the node at `pos`.
When `type` isn't given, the existing node type is preserved,
*/
function setNodeMarkup(tr, pos, type, attrs, marks) {
	let node = tr.doc.nodeAt(pos);
	if (!node) throw new RangeError("No node at given position");
	if (!type) type = node.type;
	let newNode = type.create(attrs, null, marks || node.marks);
	if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);
	if (!type.validContent(node.content)) throw new RangeError("Invalid content for node type " + type.name);
	tr.step(new ReplaceAroundStep$1(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice$1(Fragment$1.from(newNode), 0, 0), 1, true));
}
/**
Check whether splitting at the given position is allowed.
*/
function canSplit(doc, pos, depth = 1, typesAfter) {
	let $pos = doc.resolve(pos), base = $pos.depth - depth;
	let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
	if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;
	for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
		let node = $pos.node(d), index = $pos.index(d);
		if (node.type.spec.isolating) return false;
		let rest = node.content.cutByIndex(index, node.childCount);
		let overrideChild = typesAfter && typesAfter[i + 1];
		if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
		let after = typesAfter && typesAfter[i] || node;
		if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) return false;
	}
	let index = $pos.indexAfter(base);
	let baseType = typesAfter && typesAfter[0];
	return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
}
function split(tr, pos, depth = 1, typesAfter) {
	let $pos = tr.doc.resolve(pos), before = Fragment$1.empty, after = Fragment$1.empty;
	for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
		before = Fragment$1.from($pos.node(d).copy(before));
		let typeAfter = typesAfter && typesAfter[i];
		after = Fragment$1.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
	}
	tr.step(new ReplaceStep$1(pos, pos, new Slice$1(before.append(after), depth, depth), true));
}
/**
Test whether the blocks before and after a given position can be
joined.
*/
function canJoin(doc, pos) {
	let $pos = doc.resolve(pos), index = $pos.index();
	return joinable$1($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
}
function canAppendWithSubstitutedLinebreaks(a, b) {
	if (!b.content.size) a.type.compatibleContent(b.type);
	let match = a.contentMatchAt(a.childCount);
	let { linebreakReplacement } = a.type.schema;
	for (let i = 0; i < b.childCount; i++) {
		let child = b.child(i);
		let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
		match = match.matchType(type);
		if (!match) return false;
		if (!a.type.allowsMarks(child.marks)) return false;
	}
	return match.validEnd;
}
function joinable$1(a, b) {
	return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
}
/**
Find an ancestor of the given position that can be joined to the
block before (or after if `dir` is positive). Returns the joinable
point, if any.
*/
function joinPoint(doc, pos, dir = -1) {
	let $pos = doc.resolve(pos);
	for (let d = $pos.depth;; d--) {
		let before, after, index = $pos.index(d);
		if (d == $pos.depth) {
			before = $pos.nodeBefore;
			after = $pos.nodeAfter;
		} else if (dir > 0) {
			before = $pos.node(d + 1);
			index++;
			after = $pos.node(d).maybeChild(index);
		} else {
			before = $pos.node(d).maybeChild(index - 1);
			after = $pos.node(d + 1);
		}
		if (before && !before.isTextblock && joinable$1(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;
		if (d == 0) break;
		pos = dir < 0 ? $pos.before(d) : $pos.after(d);
	}
}
function join(tr, pos, depth) {
	let convertNewlines = null;
	let { linebreakReplacement } = tr.doc.type.schema;
	let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;
	if (linebreakReplacement && beforeType.inlineContent) {
		let pre = beforeType.whitespace == "pre";
		let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
		if (pre && !supportLinebreak) convertNewlines = false;
		else if (!pre && supportLinebreak) convertNewlines = true;
	}
	let mapFrom = tr.steps.length;
	if (convertNewlines === false) {
		let $after = tr.doc.resolve(pos + depth);
		replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
	}
	if (beforeType.inlineContent) clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
	let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);
	tr.step(new ReplaceStep$1(start, mapping.map(pos + depth, -1), Slice$1.empty, true));
	if (convertNewlines === true) {
		let $full = tr.doc.resolve(start);
		replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
	}
	return tr;
}
/**
Try to find a point where a node of the given type can be inserted
near `pos`, by searching up the node hierarchy when `pos` itself
isn't a valid place but is at the start or end of a node. Return
null if no position was found.
*/
function insertPoint(doc, pos, nodeType) {
	let $pos = doc.resolve(pos);
	if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;
	if ($pos.parentOffset == 0) for (let d = $pos.depth - 1; d >= 0; d--) {
		let index = $pos.index(d);
		if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);
		if (index > 0) return null;
	}
	if ($pos.parentOffset == $pos.parent.content.size) for (let d = $pos.depth - 1; d >= 0; d--) {
		let index = $pos.indexAfter(d);
		if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.after(d + 1);
		if (index < $pos.node(d).childCount) return null;
	}
	return null;
}
/**
Finds a position at or around the given position where the given
slice can be inserted. Will look at parent nodes' nearest boundary
and try there, even if the original position wasn't directly at the
start or end of that node. Returns null when no position was found.
*/
function dropPoint(doc, pos, slice) {
	let $pos = doc.resolve(pos);
	if (!slice.content.size) return pos;
	let content = slice.content;
	for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content;
	for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) for (let d = $pos.depth; d >= 0; d--) {
		let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
		let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
		let parent = $pos.node(d), fits = false;
		if (pass == 1) fits = parent.canReplace(insertPos, insertPos, content);
		else {
			let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
			fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
		}
		if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
	}
	return null;
}
/**
‘Fit’ a slice into a given position in the document, producing a
[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if
there's no meaningful way to insert the slice here, or inserting it
would be a no-op (an empty slice over an empty range).
*/
function replaceStep(doc, from, to = from, slice = Slice$1.empty) {
	if (from == to && !slice.size) return null;
	let $from = doc.resolve(from), $to = doc.resolve(to);
	if (fitsTrivially($from, $to, slice)) return new ReplaceStep$1(from, to, slice);
	return new Fitter($from, $to, slice).fit();
}
function fitsTrivially($from, $to, slice) {
	return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
}
var Fitter = class {
	constructor($from, $to, unplaced) {
		this.$from = $from;
		this.$to = $to;
		this.unplaced = unplaced;
		this.frontier = [];
		this.placed = Fragment$1.empty;
		for (let i = 0; i <= $from.depth; i++) {
			let node = $from.node(i);
			this.frontier.push({
				type: node.type,
				match: node.contentMatchAt($from.indexAfter(i))
			});
		}
		for (let i = $from.depth; i > 0; i--) this.placed = Fragment$1.from($from.node(i).copy(this.placed));
	}
	get depth() {
		return this.frontier.length - 1;
	}
	fit() {
		while (this.unplaced.size) {
			let fit = this.findFittable();
			if (fit) this.placeNodes(fit);
			else this.openMore() || this.dropNode();
		}
		let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;
		let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
		if (!$to) return null;
		let content = this.placed, openStart = $from.depth, openEnd = $to.depth;
		while (openStart && openEnd && content.childCount == 1) {
			content = content.firstChild.content;
			openStart--;
			openEnd--;
		}
		let slice = new Slice$1(content, openStart, openEnd);
		if (moveInline > -1) return new ReplaceAroundStep$1($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
		if (slice.size || $from.pos != this.$to.pos) return new ReplaceStep$1($from.pos, $to.pos, slice);
		return null;
	}
	findFittable() {
		let startDepth = this.unplaced.openStart;
		for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
			let node = cur.firstChild;
			if (cur.childCount > 1) openEnd = 0;
			if (node.type.spec.isolating && openEnd <= d) {
				startDepth = d;
				break;
			}
			cur = node.content;
		}
		for (let pass = 1; pass <= 2; pass++) for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
			let fragment, parent = null;
			if (sliceDepth) {
				parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
				fragment = parent.content;
			} else fragment = this.unplaced.content;
			let first = fragment.firstChild;
			for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
				let { type, match } = this.frontier[frontierDepth], wrap, inject = null;
				if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment$1.from(first), false)) : parent && type.compatibleContent(parent.type))) return {
					sliceDepth,
					frontierDepth,
					parent,
					inject
				};
				else if (pass == 2 && first && (wrap = match.findWrapping(first.type))) return {
					sliceDepth,
					frontierDepth,
					parent,
					wrap
				};
				if (parent && match.matchType(parent.type)) break;
			}
		}
	}
	openMore() {
		let { content, openStart, openEnd } = this.unplaced;
		let inner = contentAt(content, openStart);
		if (!inner.childCount || inner.firstChild.isLeaf) return false;
		this.unplaced = new Slice$1(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
		return true;
	}
	dropNode() {
		let { content, openStart, openEnd } = this.unplaced;
		let inner = contentAt(content, openStart);
		if (inner.childCount <= 1 && openStart > 0) {
			let openAtEnd = content.size - openStart <= openStart + inner.size;
			this.unplaced = new Slice$1(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
		} else this.unplaced = new Slice$1(dropFromFragment(content, openStart, 1), openStart, openEnd);
	}
	placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {
		while (this.depth > frontierDepth) this.closeFrontierNode();
		if (wrap) for (let i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);
		let slice = this.unplaced, fragment = parent ? parent.content : slice.content;
		let openStart = slice.openStart - sliceDepth;
		let taken = 0, add = [];
		let { match, type } = this.frontier[frontierDepth];
		if (inject) {
			for (let i = 0; i < inject.childCount; i++) add.push(inject.child(i));
			match = match.matchFragment(inject);
		}
		let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
		while (taken < fragment.childCount) {
			let next = fragment.child(taken), matches = match.matchType(next.type);
			if (!matches) break;
			taken++;
			if (taken > 1 || openStart == 0 || next.content.size) {
				match = matches;
				add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
			}
		}
		let toEnd = taken == fragment.childCount;
		if (!toEnd) openEndCount = -1;
		this.placed = addToFragment(this.placed, frontierDepth, Fragment$1.from(add));
		this.frontier[frontierDepth].match = match;
		if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();
		for (let i = 0, cur = fragment; i < openEndCount; i++) {
			let node = cur.lastChild;
			this.frontier.push({
				type: node.type,
				match: node.contentMatchAt(node.childCount)
			});
			cur = node.content;
		}
		this.unplaced = !toEnd ? new Slice$1(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice$1.empty : new Slice$1(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
	}
	mustMoveInline() {
		if (!this.$to.parent.isTextblock) return -1;
		let top = this.frontier[this.depth], level;
		if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;
		let { depth } = this.$to, after = this.$to.after(depth);
		while (depth > 1 && after == this.$to.end(--depth)) ++after;
		return after;
	}
	findCloseLevel($to) {
		scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
			let { match, type } = this.frontier[i];
			let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
			let fit = contentAfterFits($to, i, type, match, dropInner);
			if (!fit) continue;
			for (let d = i - 1; d >= 0; d--) {
				let { match, type } = this.frontier[d];
				let matches = contentAfterFits($to, d, type, match, true);
				if (!matches || matches.childCount) continue scan;
			}
			return {
				depth: i,
				fit,
				move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to
			};
		}
	}
	close($to) {
		let close = this.findCloseLevel($to);
		if (!close) return null;
		while (this.depth > close.depth) this.closeFrontierNode();
		if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);
		$to = close.move;
		for (let d = close.depth + 1; d <= $to.depth; d++) {
			let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
			this.openFrontierNode(node.type, node.attrs, add);
		}
		return $to;
	}
	openFrontierNode(type, attrs = null, content) {
		let top = this.frontier[this.depth];
		top.match = top.match.matchType(type);
		this.placed = addToFragment(this.placed, this.depth, Fragment$1.from(type.create(attrs, content)));
		this.frontier.push({
			type,
			match: type.contentMatch
		});
	}
	closeFrontierNode() {
		let add = this.frontier.pop().match.fillBefore(Fragment$1.empty, true);
		if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);
	}
};
function dropFromFragment(fragment, depth, count) {
	if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);
	return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
}
function addToFragment(fragment, depth, content) {
	if (depth == 0) return fragment.append(content);
	return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
}
function contentAt(fragment, depth) {
	for (let i = 0; i < depth; i++) fragment = fragment.firstChild.content;
	return fragment;
}
function closeNodeStart(node, openStart, openEnd) {
	if (openStart <= 0) return node;
	let frag = node.content;
	if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
	if (openStart > 0) {
		frag = node.type.contentMatch.fillBefore(frag).append(frag);
		if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment$1.empty, true));
	}
	return node.copy(frag);
}
function contentAfterFits($to, depth, type, match, open) {
	let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);
	if (index == node.childCount && !type.compatibleContent(node.type)) return null;
	let fit = match.fillBefore(node.content, true, index);
	return fit && !invalidMarks(type, node.content, index) ? fit : null;
}
function invalidMarks(type, fragment, start) {
	for (let i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;
	return false;
}
function definesContent(type) {
	return type.spec.defining || type.spec.definingForContent;
}
function replaceRange(tr, from, to, slice) {
	if (!slice.size) return tr.deleteRange(from, to);
	let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
	if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep$1(from, to, slice));
	let targetDepths = coveredDepths($from, $to);
	if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();
	let preferredTarget = -($from.depth + 1);
	targetDepths.unshift(preferredTarget);
	for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
		let spec = $from.node(d).type.spec;
		if (spec.defining || spec.definingAsContext || spec.isolating) break;
		if (targetDepths.indexOf(d) > -1) preferredTarget = d;
		else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);
	}
	let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
	let leftNodes = [], preferredDepth = slice.openStart;
	for (let content = slice.content, i = 0;; i++) {
		let node = content.firstChild;
		leftNodes.push(node);
		if (i == slice.openStart) break;
		content = node.content;
	}
	for (let d = preferredDepth - 1; d >= 0; d--) {
		let leftNode = leftNodes[d], def = definesContent(leftNode.type);
		if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = d;
		else if (def || !leftNode.type.isTextblock) break;
	}
	for (let j = slice.openStart; j >= 0; j--) {
		let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
		let insert = leftNodes[openDepth];
		if (!insert) continue;
		for (let i = 0; i < targetDepths.length; i++) {
			let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;
			if (targetDepth < 0) {
				expand = false;
				targetDepth = -targetDepth;
			}
			let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
			if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice$1(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
		}
	}
	let startSteps = tr.steps.length;
	for (let i = targetDepths.length - 1; i >= 0; i--) {
		tr.replace(from, to, slice);
		if (tr.steps.length > startSteps) break;
		let depth = targetDepths[i];
		if (depth < 0) continue;
		from = $from.before(depth);
		to = $to.after(depth);
	}
}
function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
	if (depth < oldOpen) {
		let first = fragment.firstChild;
		fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
	}
	if (depth > newOpen) {
		let match = parent.contentMatchAt(0);
		let start = match.fillBefore(fragment).append(fragment);
		fragment = start.append(match.matchFragment(start).fillBefore(Fragment$1.empty, true));
	}
	return fragment;
}
function replaceRangeWith(tr, from, to, node) {
	if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
		let point = insertPoint(tr.doc, from, node.type);
		if (point != null) from = to = point;
	}
	tr.replaceRange(from, to, new Slice$1(Fragment$1.from(node), 0, 0));
}
function deleteRange$1(tr, from, to) {
	let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
	if ($from.parent.isTextblock && $to.parent.isTextblock && $from.start() != $to.start() && $from.parentOffset == 0 && $to.parentOffset == 0) {
		let shared = $from.sharedDepth(to), isolated = false;
		for (let d = $from.depth; d > shared; d--) if ($from.node(d).type.spec.isolating) isolated = true;
		for (let d = $to.depth; d > shared; d--) if ($to.node(d).type.spec.isolating) isolated = true;
		if (!isolated) {
			for (let d = $from.depth; d > 0 && from == $from.start(d); d--) from = $from.before(d);
			for (let d = $to.depth; d > 0 && to == $to.start(d); d--) to = $to.before(d);
			$from = tr.doc.resolve(from);
			$to = tr.doc.resolve(to);
		}
	}
	let covered = coveredDepths($from, $to);
	for (let i = 0; i < covered.length; i++) {
		let depth = covered[i], last = i == covered.length - 1;
		if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr.delete($from.start(depth), $to.end(depth));
		if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr.delete($from.before(depth), $to.after(depth));
	}
	for (let d = 1; d <= $from.depth && d <= $to.depth; d++) if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr.delete($from.before(d), to);
	tr.delete(from, to);
}
function coveredDepths($from, $to) {
	let result = [], minDepth = Math.min($from.depth, $to.depth);
	for (let d = minDepth; d >= 0; d--) {
		let start = $from.start(d);
		if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;
		if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);
	}
	return result;
}
/**
Update an attribute in a specific node.
*/
var AttrStep$1 = class AttrStep$1 extends Step$1 {
	/**
	Construct an attribute step.
	*/
	constructor(pos, attr, value) {
		super();
		this.pos = pos;
		this.attr = attr;
		this.value = value;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult$1.fail("No node at attribute step's position");
		let attrs = Object.create(null);
		for (let name in node.attrs) attrs[name] = node.attrs[name];
		attrs[this.attr] = this.value;
		let updated = node.type.create(attrs, null, node.marks);
		return StepResult$1.fromReplace(doc, this.pos, this.pos + 1, new Slice$1(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	getMap() {
		return StepMap$1.empty;
	}
	invert(doc) {
		return new AttrStep$1(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new AttrStep$1(pos.pos, this.attr, this.value);
	}
	toJSON() {
		return {
			stepType: "attr",
			pos: this.pos,
			attr: this.attr,
			value: this.value
		};
	}
	static fromJSON(schema, json) {
		if (typeof json.pos != "number" || typeof json.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
		return new AttrStep$1(json.pos, json.attr, json.value);
	}
};
Step$1.jsonID("attr", AttrStep$1);
/**
Update an attribute in the doc node.
*/
var DocAttrStep$1 = class DocAttrStep$1 extends Step$1 {
	/**
	Construct an attribute step.
	*/
	constructor(attr, value) {
		super();
		this.attr = attr;
		this.value = value;
	}
	apply(doc) {
		let attrs = Object.create(null);
		for (let name in doc.attrs) attrs[name] = doc.attrs[name];
		attrs[this.attr] = this.value;
		let updated = doc.type.create(attrs, doc.content, doc.marks);
		return StepResult$1.ok(updated);
	}
	getMap() {
		return StepMap$1.empty;
	}
	invert(doc) {
		return new DocAttrStep$1(this.attr, doc.attrs[this.attr]);
	}
	map(mapping) {
		return this;
	}
	toJSON() {
		return {
			stepType: "docAttr",
			attr: this.attr,
			value: this.value
		};
	}
	static fromJSON(schema, json) {
		if (typeof json.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
		return new DocAttrStep$1(json.attr, json.value);
	}
};
Step$1.jsonID("docAttr", DocAttrStep$1);
/**
@internal
*/
var TransformError$1 = class extends Error {};
TransformError$1 = function TransformError(message) {
	let err = Error.call(this, message);
	err.__proto__ = TransformError.prototype;
	return err;
};
TransformError$1.prototype = Object.create(Error.prototype);
TransformError$1.prototype.constructor = TransformError$1;
TransformError$1.prototype.name = "TransformError";
/**
Abstraction to build up and track an array of
[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.

Most transforming methods return the `Transform` object itself, so
that they can be chained.
*/
var Transform = class {
	/**
	Create a transform that starts with the given document.
	*/
	constructor(doc) {
		this.doc = doc;
		/**
		The steps in this transform.
		*/
		this.steps = [];
		/**
		The documents before each of the steps.
		*/
		this.docs = [];
		/**
		A mapping with the maps for each of the steps in this transform.
		*/
		this.mapping = new Mapping();
	}
	/**
	The starting document.
	*/
	get before() {
		return this.docs.length ? this.docs[0] : this.doc;
	}
	/**
	Apply a new step in this transform, saving the result. Throws an
	error when the step fails.
	*/
	step(step) {
		let result = this.maybeStep(step);
		if (result.failed) throw new TransformError$1(result.failed);
		return this;
	}
	/**
	Try to apply a step in this transformation, ignoring it if it
	fails. Returns the step result.
	*/
	maybeStep(step) {
		let result = step.apply(this.doc);
		if (!result.failed) this.addStep(step, result.doc);
		return result;
	}
	/**
	True when the document has been changed (when there are any
	steps).
	*/
	get docChanged() {
		return this.steps.length > 0;
	}
	/**
	Return a single range, in post-transform document positions,
	that covers all content changed by this transform. Returns null
	if no replacements are made. Note that this will ignore changes
	that add/remove marks without replacing the underlying content.
	*/
	changedRange() {
		let from = 1e9, to = -1e9;
		for (let i = 0; i < this.mapping.maps.length; i++) {
			let map = this.mapping.maps[i];
			if (i) {
				from = map.map(from, 1);
				to = map.map(to, -1);
			}
			map.forEach((_f, _t, fromB, toB) => {
				from = Math.min(from, fromB);
				to = Math.max(to, toB);
			});
		}
		return from == 1e9 ? null : {
			from,
			to
		};
	}
	/**
	@internal
	*/
	addStep(step, doc) {
		this.docs.push(this.doc);
		this.steps.push(step);
		this.mapping.appendMap(step.getMap());
		this.doc = doc;
	}
	/**
	Replace the part of the document between `from` and `to` with the
	given `slice`.
	*/
	replace(from, to = from, slice = Slice$1.empty) {
		let step = replaceStep(this.doc, from, to, slice);
		if (step) this.step(step);
		return this;
	}
	/**
	Replace the given range with the given content, which may be a
	fragment, node, or array of nodes.
	*/
	replaceWith(from, to, content) {
		return this.replace(from, to, new Slice$1(Fragment$1.from(content), 0, 0));
	}
	/**
	Delete the content between the given positions.
	*/
	delete(from, to) {
		return this.replace(from, to, Slice$1.empty);
	}
	/**
	Insert the given content at the given position.
	*/
	insert(pos, content) {
		return this.replaceWith(pos, pos, content);
	}
	/**
	Replace a range of the document with a given slice, using
	`from`, `to`, and the slice's
	[`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather
	than fixed start and end points. This method may grow the
	replaced area or close open nodes in the slice in order to get a
	fit that is more in line with WYSIWYG expectations, by dropping
	fully covered parent nodes of the replaced region when they are
	marked [non-defining as
	context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an
	open parent node from the slice that _is_ marked as [defining
	its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
	
	This is the method, for example, to handle paste. The similar
	[`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more
	primitive tool which will _not_ move the start and end of its given
	range, and is useful in situations where you need more precise
	control over what happens.
	*/
	replaceRange(from, to, slice) {
		replaceRange(this, from, to, slice);
		return this;
	}
	/**
	Replace the given range with a node, but use `from` and `to` as
	hints, rather than precise positions. When from and to are the same
	and are at the start or end of a parent node in which the given
	node doesn't fit, this method may _move_ them out towards a parent
	that does allow the given node to be placed. When the given range
	completely covers a parent node, this method may completely replace
	that parent node.
	*/
	replaceRangeWith(from, to, node) {
		replaceRangeWith(this, from, to, node);
		return this;
	}
	/**
	Delete the given range, expanding it to cover fully covered
	parent nodes until a valid replace is found.
	*/
	deleteRange(from, to) {
		deleteRange$1(this, from, to);
		return this;
	}
	/**
	Split the content in the given range off from its parent, if there
	is sibling content before or after it, and move it up the tree to
	the depth specified by `target`. You'll probably want to use
	[`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
	sure the lift is valid.
	*/
	lift(range, target) {
		lift$2(this, range, target);
		return this;
	}
	/**
	Join the blocks around the given position. If depth is 2, their
	last and first siblings are also joined, and so on.
	*/
	join(pos, depth = 1) {
		join(this, pos, depth);
		return this;
	}
	/**
	Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
	The wrappers are assumed to be valid in this position, and should
	probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
	*/
	wrap(range, wrappers) {
		wrap(this, range, wrappers);
		return this;
	}
	/**
	Set the type of all textblocks (partly) between `from` and `to` to
	the given node type with the given attributes.
	*/
	setBlockType(from, to = from, type, attrs = null) {
		setBlockType$1(this, from, to, type, attrs);
		return this;
	}
	/**
	Change the type, attributes, and/or marks of the node at `pos`.
	When `type` isn't given, the existing node type is preserved,
	*/
	setNodeMarkup(pos, type, attrs = null, marks) {
		setNodeMarkup(this, pos, type, attrs, marks);
		return this;
	}
	/**
	Set a single attribute on a given node to a new value.
	The `pos` addresses the document content. Use `setDocAttribute`
	to set attributes on the document itself.
	*/
	setNodeAttribute(pos, attr, value) {
		this.step(new AttrStep$1(pos, attr, value));
		return this;
	}
	/**
	Set a single attribute on the document to a new value.
	*/
	setDocAttribute(attr, value) {
		this.step(new DocAttrStep$1(attr, value));
		return this;
	}
	/**
	Add a mark to the node at position `pos`.
	*/
	addNodeMark(pos, mark) {
		this.step(new AddNodeMarkStep$1(pos, mark));
		return this;
	}
	/**
	Remove a mark (or all marks of the given type) from the node at
	position `pos`.
	*/
	removeNodeMark(pos, mark) {
		let node = this.doc.nodeAt(pos);
		if (!node) throw new RangeError("No node at position " + pos);
		if (mark instanceof Mark$2) {
			if (mark.isInSet(node.marks)) this.step(new RemoveNodeMarkStep$1(pos, mark));
		} else {
			let set = node.marks, found, steps = [];
			while (found = mark.isInSet(set)) {
				steps.push(new RemoveNodeMarkStep$1(pos, found));
				set = found.removeFromSet(set);
			}
			for (let i = steps.length - 1; i >= 0; i--) this.step(steps[i]);
		}
		return this;
	}
	/**
	Split the node at the given position, and optionally, if `depth` is
	greater than one, any number of nodes above that. By default, the
	parts split off will inherit the node type of the original node.
	This can be changed by passing an array of types and attributes to
	use after the split (with the outermost nodes coming first).
	*/
	split(pos, depth = 1, typesAfter) {
		split(this, pos, depth, typesAfter);
		return this;
	}
	/**
	Add the given mark to the inline content between `from` and `to`.
	*/
	addMark(from, to, mark) {
		addMark(this, from, to, mark);
		return this;
	}
	/**
	Remove marks from inline nodes between `from` and `to`. When
	`mark` is a single mark, remove precisely that mark. When it is
	a mark type, remove all marks of that type. When it is null,
	remove all marks of any type.
	*/
	removeMark(from, to, mark) {
		removeMark(this, from, to, mark);
		return this;
	}
	/**
	Removes all marks and nodes from the content of the node at
	`pos` that don't match the given new parent node type. Accepts
	an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
	third argument.
	*/
	clearIncompatible(pos, parentType, match) {
		clearIncompatible(this, pos, parentType, match);
		return this;
	}
};
//#endregion
//#region node_modules/prosemirror-state/dist/index.js
var classesById$1 = Object.create(null);
/**
Superclass for editor selections. Every selection type should
extend this. Should not be instantiated directly.
*/
var Selection$2 = class {
	/**
	Initialize a selection with the head and anchor and ranges. If no
	ranges are given, constructs a single range across `$anchor` and
	`$head`.
	*/
	constructor($anchor, $head, ranges) {
		this.$anchor = $anchor;
		this.$head = $head;
		this.ranges = ranges || [new SelectionRange$1($anchor.min($head), $anchor.max($head))];
	}
	/**
	The selection's anchor, as an unresolved position.
	*/
	get anchor() {
		return this.$anchor.pos;
	}
	/**
	The selection's head.
	*/
	get head() {
		return this.$head.pos;
	}
	/**
	The lower bound of the selection's main range.
	*/
	get from() {
		return this.$from.pos;
	}
	/**
	The upper bound of the selection's main range.
	*/
	get to() {
		return this.$to.pos;
	}
	/**
	The resolved lower  bound of the selection's main range.
	*/
	get $from() {
		return this.ranges[0].$from;
	}
	/**
	The resolved upper bound of the selection's main range.
	*/
	get $to() {
		return this.ranges[0].$to;
	}
	/**
	Indicates whether the selection contains any content.
	*/
	get empty() {
		let ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) if (ranges[i].$from.pos != ranges[i].$to.pos) return false;
		return true;
	}
	/**
	Get the content of this selection as a slice.
	*/
	content() {
		return this.$from.doc.slice(this.from, this.to, true);
	}
	/**
	Replace the selection with a slice or, if no slice is given,
	delete the selection. Will append to the given transaction.
	*/
	replace(tr, content = Slice$1.empty) {
		let lastNode = content.content.lastChild, lastParent = null;
		for (let i = 0; i < content.openEnd; i++) {
			lastParent = lastNode;
			lastNode = lastNode.lastChild;
		}
		let mapFrom = tr.steps.length, ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) {
			let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
			tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice$1.empty : content);
			if (i == 0) selectionToInsertionEnd$2(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
		}
	}
	/**
	Replace the selection with the given node, appending the changes
	to the given transaction.
	*/
	replaceWith(tr, node) {
		let mapFrom = tr.steps.length, ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) {
			let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
			let from = mapping.map($from.pos), to = mapping.map($to.pos);
			if (i) tr.deleteRange(from, to);
			else {
				tr.replaceRangeWith(from, to, node);
				selectionToInsertionEnd$2(tr, mapFrom, node.isInline ? -1 : 1);
			}
		}
	}
	/**
	Find a valid cursor or leaf node selection starting at the given
	position and searching back if `dir` is negative, and forward if
	positive. When `textOnly` is true, only consider cursor
	selections. Will return null when no valid selection position is
	found.
	*/
	static findFrom($pos, dir, textOnly = false) {
		let inner = $pos.parent.inlineContent ? new TextSelection$1($pos) : findSelectionIn$1($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
		if (inner) return inner;
		for (let depth = $pos.depth - 1; depth >= 0; depth--) {
			let found = dir < 0 ? findSelectionIn$1($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn$1($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
			if (found) return found;
		}
		return null;
	}
	/**
	Find a valid cursor or leaf node selection near the given
	position. Searches forward first by default, but if `bias` is
	negative, it will search backwards first.
	*/
	static near($pos, bias = 1) {
		return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection$1($pos.node(0));
	}
	/**
	Find the cursor or leaf node selection closest to the start of
	the given document. Will return an
	[`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
	exists.
	*/
	static atStart(doc) {
		return findSelectionIn$1(doc, doc, 0, 0, 1) || new AllSelection$1(doc);
	}
	/**
	Find the cursor or leaf node selection closest to the end of the
	given document.
	*/
	static atEnd(doc) {
		return findSelectionIn$1(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection$1(doc);
	}
	/**
	Deserialize the JSON representation of a selection. Must be
	implemented for custom classes (as a static class method).
	*/
	static fromJSON(doc, json) {
		if (!json || !json.type) throw new RangeError("Invalid input for Selection.fromJSON");
		let cls = classesById$1[json.type];
		if (!cls) throw new RangeError(`No selection type ${json.type} defined`);
		return cls.fromJSON(doc, json);
	}
	/**
	To be able to deserialize selections from JSON, custom selection
	classes must register themselves with an ID string, so that they
	can be disambiguated. Try to pick something that's unlikely to
	clash with classes from other modules.
	*/
	static jsonID(id, selectionClass) {
		if (id in classesById$1) throw new RangeError("Duplicate use of selection JSON ID " + id);
		classesById$1[id] = selectionClass;
		selectionClass.prototype.jsonID = id;
		return selectionClass;
	}
	/**
	Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
	which is a value that can be mapped without having access to a
	current document, and later resolved to a real selection for a
	given document again. (This is used mostly by the history to
	track and restore old selections.) The default implementation of
	this method just converts the selection to a text selection and
	returns the bookmark for that.
	*/
	getBookmark() {
		return TextSelection$1.between(this.$anchor, this.$head).getBookmark();
	}
};
Selection$2.prototype.visible = true;
/**
Represents a selected range in a document.
*/
var SelectionRange$1 = class {
	/**
	Create a range.
	*/
	constructor($from, $to) {
		this.$from = $from;
		this.$to = $to;
	}
};
var warnedAboutTextSelection$1 = false;
function checkTextSelection$1($pos) {
	if (!warnedAboutTextSelection$1 && !$pos.parent.inlineContent) {
		warnedAboutTextSelection$1 = true;
		console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
	}
}
/**
A text selection represents a classical editor selection, with a
head (the moving side) and anchor (immobile side), both of which
point into textblock nodes. It can be empty (a regular cursor
position).
*/
var TextSelection$1 = class TextSelection$1 extends Selection$2 {
	/**
	Construct a text selection between the given points.
	*/
	constructor($anchor, $head = $anchor) {
		checkTextSelection$1($anchor);
		checkTextSelection$1($head);
		super($anchor, $head);
	}
	/**
	Returns a resolved position if this is a cursor selection (an
	empty text selection), and null otherwise.
	*/
	get $cursor() {
		return this.$anchor.pos == this.$head.pos ? this.$head : null;
	}
	map(doc, mapping) {
		let $head = doc.resolve(mapping.map(this.head));
		if (!$head.parent.inlineContent) return Selection$2.near($head);
		let $anchor = doc.resolve(mapping.map(this.anchor));
		return new TextSelection$1($anchor.parent.inlineContent ? $anchor : $head, $head);
	}
	replace(tr, content = Slice$1.empty) {
		super.replace(tr, content);
		if (content == Slice$1.empty) {
			let marks = this.$from.marksAcross(this.$to);
			if (marks) tr.ensureMarks(marks);
		}
	}
	eq(other) {
		return other instanceof TextSelection$1 && other.anchor == this.anchor && other.head == this.head;
	}
	getBookmark() {
		return new TextBookmark$1(this.anchor, this.head);
	}
	toJSON() {
		return {
			type: "text",
			anchor: this.anchor,
			head: this.head
		};
	}
	/**
	@internal
	*/
	static fromJSON(doc, json) {
		if (typeof json.anchor != "number" || typeof json.head != "number") throw new RangeError("Invalid input for TextSelection.fromJSON");
		return new TextSelection$1(doc.resolve(json.anchor), doc.resolve(json.head));
	}
	/**
	Create a text selection from non-resolved positions.
	*/
	static create(doc, anchor, head = anchor) {
		let $anchor = doc.resolve(anchor);
		return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
	}
	/**
	Return a text selection that spans the given positions or, if
	they aren't text positions, find a text selection near them.
	`bias` determines whether the method searches forward (default)
	or backwards (negative number) first. Will fall back to calling
	[`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
	doesn't contain a valid text position.
	*/
	static between($anchor, $head, bias) {
		let dPos = $anchor.pos - $head.pos;
		if (!bias || dPos) bias = dPos >= 0 ? 1 : -1;
		if (!$head.parent.inlineContent) {
			let found = Selection$2.findFrom($head, bias, true) || Selection$2.findFrom($head, -bias, true);
			if (found) $head = found.$head;
			else return Selection$2.near($head, bias);
		}
		if (!$anchor.parent.inlineContent) if (dPos == 0) $anchor = $head;
		else {
			$anchor = (Selection$2.findFrom($anchor, -bias, true) || Selection$2.findFrom($anchor, bias, true)).$anchor;
			if ($anchor.pos < $head.pos != dPos < 0) $anchor = $head;
		}
		return new TextSelection$1($anchor, $head);
	}
};
Selection$2.jsonID("text", TextSelection$1);
var TextBookmark$1 = class TextBookmark$1 {
	constructor(anchor, head) {
		this.anchor = anchor;
		this.head = head;
	}
	map(mapping) {
		return new TextBookmark$1(mapping.map(this.anchor), mapping.map(this.head));
	}
	resolve(doc) {
		return TextSelection$1.between(doc.resolve(this.anchor), doc.resolve(this.head));
	}
};
/**
A node selection is a selection that points at a single node. All
nodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the
target of a node selection. In such a selection, `from` and `to`
point directly before and after the selected node, `anchor` equals
`from`, and `head` equals `to`..
*/
var NodeSelection$1 = class NodeSelection$1 extends Selection$2 {
	/**
	Create a node selection. Does not verify the validity of its
	argument.
	*/
	constructor($pos) {
		let node = $pos.nodeAfter;
		let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
		super($pos, $end);
		this.node = node;
	}
	map(doc, mapping) {
		let { deleted, pos } = mapping.mapResult(this.anchor);
		let $pos = doc.resolve(pos);
		if (deleted) return Selection$2.near($pos);
		return new NodeSelection$1($pos);
	}
	content() {
		return new Slice$1(Fragment$1.from(this.node), 0, 0);
	}
	eq(other) {
		return other instanceof NodeSelection$1 && other.anchor == this.anchor;
	}
	toJSON() {
		return {
			type: "node",
			anchor: this.anchor
		};
	}
	getBookmark() {
		return new NodeBookmark$1(this.anchor);
	}
	/**
	@internal
	*/
	static fromJSON(doc, json) {
		if (typeof json.anchor != "number") throw new RangeError("Invalid input for NodeSelection.fromJSON");
		return new NodeSelection$1(doc.resolve(json.anchor));
	}
	/**
	Create a node selection from non-resolved positions.
	*/
	static create(doc, from) {
		return new NodeSelection$1(doc.resolve(from));
	}
	/**
	Determines whether the given node may be selected as a node
	selection.
	*/
	static isSelectable(node) {
		return !node.isText && node.type.spec.selectable !== false;
	}
};
NodeSelection$1.prototype.visible = false;
Selection$2.jsonID("node", NodeSelection$1);
var NodeBookmark$1 = class NodeBookmark$1 {
	constructor(anchor) {
		this.anchor = anchor;
	}
	map(mapping) {
		let { deleted, pos } = mapping.mapResult(this.anchor);
		return deleted ? new TextBookmark$1(pos, pos) : new NodeBookmark$1(pos);
	}
	resolve(doc) {
		let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
		if (node && NodeSelection$1.isSelectable(node)) return new NodeSelection$1($pos);
		return Selection$2.near($pos);
	}
};
/**
A selection type that represents selecting the whole document
(which can not necessarily be expressed with a text selection, when
there are for example leaf block nodes at the start or end of the
document).
*/
var AllSelection$1 = class AllSelection$1 extends Selection$2 {
	/**
	Create an all-selection over the given document.
	*/
	constructor(doc) {
		super(doc.resolve(0), doc.resolve(doc.content.size));
	}
	replace(tr, content = Slice$1.empty) {
		if (content == Slice$1.empty) {
			tr.delete(0, tr.doc.content.size);
			let sel = Selection$2.atStart(tr.doc);
			if (!sel.eq(tr.selection)) tr.setSelection(sel);
		} else super.replace(tr, content);
	}
	toJSON() {
		return { type: "all" };
	}
	/**
	@internal
	*/
	static fromJSON(doc) {
		return new AllSelection$1(doc);
	}
	map(doc) {
		return new AllSelection$1(doc);
	}
	eq(other) {
		return other instanceof AllSelection$1;
	}
	getBookmark() {
		return AllBookmark$1;
	}
};
Selection$2.jsonID("all", AllSelection$1);
var AllBookmark$1 = {
	map() {
		return this;
	},
	resolve(doc) {
		return new AllSelection$1(doc);
	}
};
function findSelectionIn$1(doc, node, pos, index, dir, text = false) {
	if (node.inlineContent) return TextSelection$1.create(doc, pos);
	for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
		let child = node.child(i);
		if (!child.isAtom) {
			let inner = findSelectionIn$1(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
			if (inner) return inner;
		} else if (!text && NodeSelection$1.isSelectable(child)) return NodeSelection$1.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
		pos += child.nodeSize * dir;
	}
	return null;
}
function selectionToInsertionEnd$2(tr, startLen, bias) {
	let last = tr.steps.length - 1;
	if (last < startLen) return;
	let step = tr.steps[last];
	if (!(step instanceof ReplaceStep$1 || step instanceof ReplaceAroundStep$1)) return;
	let map = tr.mapping.maps[last], end;
	map.forEach((_from, _to, _newFrom, newTo) => {
		if (end == null) end = newTo;
	});
	tr.setSelection(Selection$2.near(tr.doc.resolve(end), bias));
}
var UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
/**
An editor state transaction, which can be applied to a state to
create an updated state. Use
[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.

Transactions track changes to the document (they are a subclass of
[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,
like selection updates and adjustments of the set of [stored
marks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store
metadata properties in a transaction, which are extra pieces of
information that client code or plugins can use to describe what a
transaction represents, so that they can update their [own
state](https://prosemirror.net/docs/ref/#state.StateField) accordingly.

The [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata
properties: it will attach a property `"pointer"` with the value
`true` to selection transactions directly caused by mouse or touch
input, a `"composition"` property holding an ID identifying the
composition that caused it to transactions caused by composed DOM
input, and a `"uiEvent"` property of that may be `"paste"`,
`"cut"`, or `"drop"`.
*/
var Transaction = class extends Transform {
	/**
	@internal
	*/
	constructor(state) {
		super(state.doc);
		this.curSelectionFor = 0;
		this.updated = 0;
		this.meta = Object.create(null);
		this.time = Date.now();
		this.curSelection = state.selection;
		this.storedMarks = state.storedMarks;
	}
	/**
	The transaction's current selection. This defaults to the editor
	selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the
	transaction, but can be overwritten with
	[`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
	*/
	get selection() {
		if (this.curSelectionFor < this.steps.length) {
			this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
			this.curSelectionFor = this.steps.length;
		}
		return this.curSelection;
	}
	/**
	Update the transaction's current selection. Will determine the
	selection that the editor gets when the transaction is applied.
	*/
	setSelection(selection) {
		if (selection.$from.doc != this.doc) throw new RangeError("Selection passed to setSelection must point at the current document");
		this.curSelection = selection;
		this.curSelectionFor = this.steps.length;
		this.updated = (this.updated | UPDATED_SEL) & -3;
		this.storedMarks = null;
		return this;
	}
	/**
	Whether the selection was explicitly updated by this transaction.
	*/
	get selectionSet() {
		return (this.updated & UPDATED_SEL) > 0;
	}
	/**
	Set the current stored marks.
	*/
	setStoredMarks(marks) {
		this.storedMarks = marks;
		this.updated |= UPDATED_MARKS;
		return this;
	}
	/**
	Make sure the current stored marks or, if that is null, the marks
	at the selection, match the given set of marks. Does nothing if
	this is already the case.
	*/
	ensureMarks(marks) {
		if (!Mark$2.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) this.setStoredMarks(marks);
		return this;
	}
	/**
	Add a mark to the set of stored marks.
	*/
	addStoredMark(mark) {
		return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
	}
	/**
	Remove a mark or mark type from the set of stored marks.
	*/
	removeStoredMark(mark) {
		return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
	}
	/**
	Whether the stored marks were explicitly set for this transaction.
	*/
	get storedMarksSet() {
		return (this.updated & UPDATED_MARKS) > 0;
	}
	/**
	@internal
	*/
	addStep(step, doc) {
		super.addStep(step, doc);
		this.updated = this.updated & -3;
		this.storedMarks = null;
	}
	/**
	Update the timestamp for the transaction.
	*/
	setTime(time) {
		this.time = time;
		return this;
	}
	/**
	Replace the current selection with the given slice.
	*/
	replaceSelection(slice) {
		this.selection.replace(this, slice);
		return this;
	}
	/**
	Replace the selection with the given node. When `inheritMarks` is
	true and the content is inline, it inherits the marks from the
	place where it is inserted.
	*/
	replaceSelectionWith(node, inheritMarks = true) {
		let selection = this.selection;
		if (inheritMarks) node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark$2.none));
		selection.replaceWith(this, node);
		return this;
	}
	/**
	Delete the selection.
	*/
	deleteSelection() {
		this.selection.replace(this);
		return this;
	}
	/**
	Replace the given range, or the selection if no range is given,
	with a text node containing the given string.
	*/
	insertText(text, from, to) {
		let schema = this.doc.type.schema;
		if (from == null) {
			if (!text) return this.deleteSelection();
			return this.replaceSelectionWith(schema.text(text), true);
		} else {
			if (to == null) to = from;
			if (!text) return this.deleteRange(from, to);
			let marks = this.storedMarks;
			if (!marks) {
				let $from = this.doc.resolve(from);
				marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
			}
			this.replaceRangeWith(from, to, schema.text(text, marks));
			if (!this.selection.empty && this.selection.to == from + text.length) this.setSelection(Selection$2.near(this.selection.$to));
			return this;
		}
	}
	/**
	Store a metadata property in this transaction, keyed either by
	name or by plugin.
	*/
	setMeta(key, value) {
		this.meta[typeof key == "string" ? key : key.key] = value;
		return this;
	}
	/**
	Retrieve a metadata property for a given name or plugin.
	*/
	getMeta(key) {
		return this.meta[typeof key == "string" ? key : key.key];
	}
	/**
	Returns true if this transaction doesn't contain any metadata,
	and can thus safely be extended.
	*/
	get isGeneric() {
		for (let _ in this.meta) return false;
		return true;
	}
	/**
	Indicate that the editor should scroll the selection into view
	when updated to the state produced by this transaction.
	*/
	scrollIntoView() {
		this.updated |= UPDATED_SCROLL;
		return this;
	}
	/**
	True when this transaction has had `scrollIntoView` called on it.
	*/
	get scrolledIntoView() {
		return (this.updated & UPDATED_SCROLL) > 0;
	}
};
function bind$1(f, self) {
	return !self || !f ? f : f.bind(self);
}
var FieldDesc$1 = class {
	constructor(name, desc, self) {
		this.name = name;
		this.init = bind$1(desc.init, self);
		this.apply = bind$1(desc.apply, self);
	}
};
var baseFields = [
	new FieldDesc$1("doc", {
		init(config) {
			return config.doc || config.schema.topNodeType.createAndFill();
		},
		apply(tr) {
			return tr.doc;
		}
	}),
	new FieldDesc$1("selection", {
		init(config, instance) {
			return config.selection || Selection$2.atStart(instance.doc);
		},
		apply(tr) {
			return tr.selection;
		}
	}),
	new FieldDesc$1("storedMarks", {
		init(config) {
			return config.storedMarks || null;
		},
		apply(tr, _marks, _old, state) {
			return state.selection.$cursor ? tr.storedMarks : null;
		}
	}),
	new FieldDesc$1("scrollToSelection", {
		init() {
			return 0;
		},
		apply(tr, prev) {
			return tr.scrolledIntoView ? prev + 1 : prev;
		}
	})
];
var Configuration = class {
	constructor(schema, plugins) {
		this.schema = schema;
		this.plugins = [];
		this.pluginsByKey = Object.create(null);
		this.fields = baseFields.slice();
		if (plugins) plugins.forEach((plugin) => {
			if (this.pluginsByKey[plugin.key]) throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
			this.plugins.push(plugin);
			this.pluginsByKey[plugin.key] = plugin;
			if (plugin.spec.state) this.fields.push(new FieldDesc$1(plugin.key, plugin.spec.state, plugin));
		});
	}
};
/**
The state of a ProseMirror editor is represented by an object of
this type. A state is a persistent data structure—it isn't
updated, but rather a new state value is computed from an old one
using the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.

A state holds a number of built-in fields, and plugins can
[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.
*/
var EditorState = class EditorState {
	/**
	@internal
	*/
	constructor(config) {
		this.config = config;
	}
	/**
	The schema of the state's document.
	*/
	get schema() {
		return this.config.schema;
	}
	/**
	The plugins that are active in this state.
	*/
	get plugins() {
		return this.config.plugins;
	}
	/**
	Apply the given transaction to produce a new state.
	*/
	apply(tr) {
		return this.applyTransaction(tr).state;
	}
	/**
	@internal
	*/
	filterTransaction(tr, ignore = -1) {
		for (let i = 0; i < this.config.plugins.length; i++) if (i != ignore) {
			let plugin = this.config.plugins[i];
			if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this)) return false;
		}
		return true;
	}
	/**
	Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
	returns the precise transactions that were applied (which might
	be influenced by the [transaction
	hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
	plugins) along with the new state.
	*/
	applyTransaction(rootTr) {
		if (!this.filterTransaction(rootTr)) return {
			state: this,
			transactions: []
		};
		let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
		for (;;) {
			let haveNew = false;
			for (let i = 0; i < this.config.plugins.length; i++) {
				let plugin = this.config.plugins[i];
				if (plugin.spec.appendTransaction) {
					let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;
					let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
					if (tr && newState.filterTransaction(tr, i)) {
						tr.setMeta("appendedTransaction", rootTr);
						if (!seen) {
							seen = [];
							for (let j = 0; j < this.config.plugins.length; j++) seen.push(j < i ? {
								state: newState,
								n: trs.length
							} : {
								state: this,
								n: 0
							});
						}
						trs.push(tr);
						newState = newState.applyInner(tr);
						haveNew = true;
					}
					if (seen) seen[i] = {
						state: newState,
						n: trs.length
					};
				}
			}
			if (!haveNew) return {
				state: newState,
				transactions: trs
			};
		}
	}
	/**
	@internal
	*/
	applyInner(tr) {
		if (!tr.before.eq(this.doc)) throw new RangeError("Applying a mismatched transaction");
		let newInstance = new EditorState(this.config), fields = this.config.fields;
		for (let i = 0; i < fields.length; i++) {
			let field = fields[i];
			newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
		}
		return newInstance;
	}
	/**
	Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
	*/
	get tr() {
		return new Transaction(this);
	}
	/**
	Create a new state.
	*/
	static create(config) {
		let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
		let instance = new EditorState($config);
		for (let i = 0; i < $config.fields.length; i++) instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
		return instance;
	}
	/**
	Create a new state based on this one, but with an adjusted set
	of active plugins. State fields that exist in both sets of
	plugins are kept unchanged. Those that no longer exist are
	dropped, and those that are new are initialized using their
	[`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
	configuration object..
	*/
	reconfigure(config) {
		let $config = new Configuration(this.schema, config.plugins);
		let fields = $config.fields, instance = new EditorState($config);
		for (let i = 0; i < fields.length; i++) {
			let name = fields[i].name;
			instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
		}
		return instance;
	}
	/**
	Serialize this state to JSON. If you want to serialize the state
	of plugins, pass an object mapping property names to use in the
	resulting JSON object to plugin objects. The argument may also be
	a string or number, in which case it is ignored, to support the
	way `JSON.stringify` calls `toString` methods.
	*/
	toJSON(pluginFields) {
		let result = {
			doc: this.doc.toJSON(),
			selection: this.selection.toJSON()
		};
		if (this.storedMarks) result.storedMarks = this.storedMarks.map((m) => m.toJSON());
		if (pluginFields && typeof pluginFields == "object") for (let prop in pluginFields) {
			if (prop == "doc" || prop == "selection") throw new RangeError("The JSON fields `doc` and `selection` are reserved");
			let plugin = pluginFields[prop], state = plugin.spec.state;
			if (state && state.toJSON) result[prop] = state.toJSON.call(plugin, this[plugin.key]);
		}
		return result;
	}
	/**
	Deserialize a JSON representation of a state. `config` should
	have at least a `schema` field, and should contain array of
	plugins to initialize the state with. `pluginFields` can be used
	to deserialize the state of plugins, by associating plugin
	instances with the property names they use in the JSON object.
	*/
	static fromJSON(config, json, pluginFields) {
		if (!json) throw new RangeError("Invalid input for EditorState.fromJSON");
		if (!config.schema) throw new RangeError("Required config field 'schema' missing");
		let $config = new Configuration(config.schema, config.plugins);
		let instance = new EditorState($config);
		$config.fields.forEach((field) => {
			if (field.name == "doc") instance.doc = Node$1.fromJSON(config.schema, json.doc);
			else if (field.name == "selection") instance.selection = Selection$2.fromJSON(instance.doc, json.selection);
			else if (field.name == "storedMarks") {
				if (json.storedMarks) instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
			} else {
				if (pluginFields) for (let prop in pluginFields) {
					let plugin = pluginFields[prop], state = plugin.spec.state;
					if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
						instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
						return;
					}
				}
				instance[field.name] = field.init(config, instance);
			}
		});
		return instance;
	}
};
function bindProps(obj, self, target) {
	for (let prop in obj) {
		let val = obj[prop];
		if (val instanceof Function) val = val.bind(self);
		else if (prop == "handleDOMEvents") val = bindProps(val, self, {});
		target[prop] = val;
	}
	return target;
}
/**
Plugins bundle functionality that can be added to an editor.
They are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and
may influence that state and the view that contains it.
*/
var Plugin = class {
	/**
	Create a plugin.
	*/
	constructor(spec) {
		this.spec = spec;
		/**
		The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.
		*/
		this.props = {};
		if (spec.props) bindProps(spec.props, this, this.props);
		this.key = spec.key ? spec.key.key : createKey("plugin");
	}
	/**
	Extract the plugin's state field from an editor state.
	*/
	getState(state) {
		return state[this.key];
	}
};
var keys = Object.create(null);
function createKey(name) {
	if (name in keys) return name + "$" + ++keys[name];
	keys[name] = 0;
	return name + "$";
}
/**
A key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way
that makes it possible to find them, given an editor state.
Assigning a key does mean only one plugin of that type can be
active in a state.
*/
var PluginKey = class {
	/**
	Create a plugin key.
	*/
	constructor(name = "key") {
		this.key = createKey(name);
	}
	/**
	Get the active plugin with this key, if any, from an editor
	state.
	*/
	get(state) {
		return state.config.pluginsByKey[this.key];
	}
	/**
	Get the plugin's state from an editor state.
	*/
	getState(state) {
		return state[this.key];
	}
};
//#endregion
//#region node_modules/prosemirror-commands/dist/index.js
/**
Delete the selection, if there is one.
*/
var deleteSelection$1 = (state, dispatch) => {
	if (state.selection.empty) return false;
	if (dispatch) dispatch(state.tr.deleteSelection().scrollIntoView());
	return true;
};
function atBlockStart(state, view) {
	let { $cursor } = state.selection;
	if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0)) return null;
	return $cursor;
}
/**
If the selection is empty and at the start of a textblock, try to
reduce the distance between that block and the one before it—if
there's a block directly before it that can be joined, join them.
If not, try to move the selected block closer to the next one in
the document structure by lifting it out of its parent or moving it
into a parent of the previous block. Will use the view for accurate
(bidi-aware) start-of-textblock detection if given.
*/
var joinBackward$1 = (state, dispatch, view) => {
	let $cursor = atBlockStart(state, view);
	if (!$cursor) return false;
	let $cut = findCutBefore($cursor);
	if (!$cut) {
		let range = $cursor.blockRange(), target = range && liftTarget(range);
		if (target == null) return false;
		if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
		return true;
	}
	let before = $cut.nodeBefore;
	if (deleteBarrier(state, $cut, dispatch, -1)) return true;
	if ($cursor.parent.content.size == 0 && (textblockAt(before, "end") || NodeSelection$1.isSelectable(before))) for (let depth = $cursor.depth;; depth--) {
		let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice$1.empty);
		if (delStep && delStep.slice.size < delStep.to - delStep.from) {
			if (dispatch) {
				let tr = state.tr.step(delStep);
				tr.setSelection(textblockAt(before, "end") ? Selection$2.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1) : NodeSelection$1.create(tr.doc, $cut.pos - before.nodeSize));
				dispatch(tr.scrollIntoView());
			}
			return true;
		}
		if (depth == 1 || $cursor.node(depth - 1).childCount > 1) break;
	}
	if (before.isAtom && $cut.depth == $cursor.depth - 1) {
		if (dispatch) dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());
		return true;
	}
	return false;
};
/**
A more limited form of [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward)
that only tries to join the current textblock to the one before
it, if the cursor is at the start of a textblock.
*/
var joinTextblockBackward$1 = (state, dispatch, view) => {
	let $cursor = atBlockStart(state, view);
	if (!$cursor) return false;
	let $cut = findCutBefore($cursor);
	return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
};
/**
A more limited form of [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward)
that only tries to join the current textblock to the one after
it, if the cursor is at the end of a textblock.
*/
var joinTextblockForward$1 = (state, dispatch, view) => {
	let $cursor = atBlockEnd(state, view);
	if (!$cursor) return false;
	let $cut = findCutAfter($cursor);
	return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
};
function joinTextblocksAround(state, $cut, dispatch) {
	let beforeText = $cut.nodeBefore, beforePos = $cut.pos - 1;
	for (; !beforeText.isTextblock; beforePos--) {
		if (beforeText.type.spec.isolating) return false;
		let child = beforeText.lastChild;
		if (!child) return false;
		beforeText = child;
	}
	let afterText = $cut.nodeAfter, afterPos = $cut.pos + 1;
	for (; !afterText.isTextblock; afterPos++) {
		if (afterText.type.spec.isolating) return false;
		let child = afterText.firstChild;
		if (!child) return false;
		afterText = child;
	}
	let step = replaceStep(state.doc, beforePos, afterPos, Slice$1.empty);
	if (!step || step.from != beforePos || step instanceof ReplaceStep$1 && step.slice.size >= afterPos - beforePos) return false;
	if (dispatch) {
		let tr = state.tr.step(step);
		tr.setSelection(TextSelection$1.create(tr.doc, beforePos));
		dispatch(tr.scrollIntoView());
	}
	return true;
}
function textblockAt(node, side, only = false) {
	for (let scan = node; scan; scan = side == "start" ? scan.firstChild : scan.lastChild) {
		if (scan.isTextblock) return true;
		if (only && scan.childCount != 1) return false;
	}
	return false;
}
/**
When the selection is empty and at the start of a textblock, select
the node before that textblock, if possible. This is intended to be
bound to keys like backspace, after
[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting
commands, as a fall-back behavior when the schema doesn't allow
deletion at the selected point.
*/
var selectNodeBackward$1 = (state, dispatch, view) => {
	let { $head, empty } = state.selection, $cut = $head;
	if (!empty) return false;
	if ($head.parent.isTextblock) {
		if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) return false;
		$cut = findCutBefore($head);
	}
	let node = $cut && $cut.nodeBefore;
	if (!node || !NodeSelection$1.isSelectable(node)) return false;
	if (dispatch) dispatch(state.tr.setSelection(NodeSelection$1.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());
	return true;
};
function findCutBefore($pos) {
	if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {
		if ($pos.index(i) > 0) return $pos.doc.resolve($pos.before(i + 1));
		if ($pos.node(i).type.spec.isolating) break;
	}
	return null;
}
function atBlockEnd(state, view) {
	let { $cursor } = state.selection;
	if (!$cursor || (view ? !view.endOfTextblock("forward", state) : $cursor.parentOffset < $cursor.parent.content.size)) return null;
	return $cursor;
}
/**
If the selection is empty and the cursor is at the end of a
textblock, try to reduce or remove the boundary between that block
and the one after it, either by joining them or by moving the other
block closer to this one in the tree structure. Will use the view
for accurate start-of-textblock detection if given.
*/
var joinForward$1 = (state, dispatch, view) => {
	let $cursor = atBlockEnd(state, view);
	if (!$cursor) return false;
	let $cut = findCutAfter($cursor);
	if (!$cut) return false;
	let after = $cut.nodeAfter;
	if (deleteBarrier(state, $cut, dispatch, 1)) return true;
	if ($cursor.parent.content.size == 0 && (textblockAt(after, "start") || NodeSelection$1.isSelectable(after))) {
		let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice$1.empty);
		if (delStep && delStep.slice.size < delStep.to - delStep.from) {
			if (dispatch) {
				let tr = state.tr.step(delStep);
				tr.setSelection(textblockAt(after, "start") ? Selection$2.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1) : NodeSelection$1.create(tr.doc, tr.mapping.map($cut.pos)));
				dispatch(tr.scrollIntoView());
			}
			return true;
		}
	}
	if (after.isAtom && $cut.depth == $cursor.depth - 1) {
		if (dispatch) dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());
		return true;
	}
	return false;
};
/**
When the selection is empty and at the end of a textblock, select
the node coming after that textblock, if possible. This is intended
to be bound to keys like delete, after
[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting
commands, to provide a fall-back behavior when the schema doesn't
allow deletion at the selected point.
*/
var selectNodeForward$1 = (state, dispatch, view) => {
	let { $head, empty } = state.selection, $cut = $head;
	if (!empty) return false;
	if ($head.parent.isTextblock) {
		if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size) return false;
		$cut = findCutAfter($head);
	}
	let node = $cut && $cut.nodeAfter;
	if (!node || !NodeSelection$1.isSelectable(node)) return false;
	if (dispatch) dispatch(state.tr.setSelection(NodeSelection$1.create(state.doc, $cut.pos)).scrollIntoView());
	return true;
};
function findCutAfter($pos) {
	if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {
		let parent = $pos.node(i);
		if ($pos.index(i) + 1 < parent.childCount) return $pos.doc.resolve($pos.after(i + 1));
		if (parent.type.spec.isolating) break;
	}
	return null;
}
/**
Join the selected block or, if there is a text selection, the
closest ancestor block of the selection that can be joined, with
the sibling above it.
*/
var joinUp$1 = (state, dispatch) => {
	let sel = state.selection, nodeSel = sel instanceof NodeSelection$1, point;
	if (nodeSel) {
		if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) return false;
		point = sel.from;
	} else {
		point = joinPoint(state.doc, sel.from, -1);
		if (point == null) return false;
	}
	if (dispatch) {
		let tr = state.tr.join(point);
		if (nodeSel) tr.setSelection(NodeSelection$1.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));
		dispatch(tr.scrollIntoView());
	}
	return true;
};
/**
Join the selected block, or the closest ancestor of the selection
that can be joined, with the sibling after it.
*/
var joinDown$1 = (state, dispatch) => {
	let sel = state.selection, point;
	if (sel instanceof NodeSelection$1) {
		if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) return false;
		point = sel.to;
	} else {
		point = joinPoint(state.doc, sel.to, 1);
		if (point == null) return false;
	}
	if (dispatch) dispatch(state.tr.join(point).scrollIntoView());
	return true;
};
/**
Lift the selected block, or the closest ancestor block of the
selection that can be lifted, out of its parent node.
*/
var lift$1 = (state, dispatch) => {
	let { $from, $to } = state.selection;
	let range = $from.blockRange($to), target = range && liftTarget(range);
	if (target == null) return false;
	if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
	return true;
};
/**
If the selection is in a node whose type has a truthy
[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the
selection with a newline character.
*/
var newlineInCode$1 = (state, dispatch) => {
	let { $head, $anchor } = state.selection;
	if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;
	if (dispatch) dispatch(state.tr.insertText("\n").scrollIntoView());
	return true;
};
function defaultBlockAt$1(match) {
	for (let i = 0; i < match.edgeCount; i++) {
		let { type } = match.edge(i);
		if (type.isTextblock && !type.hasRequiredAttrs()) return type;
	}
	return null;
}
/**
When the selection is in a node with a truthy
[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a
default block after the code block, and move the cursor there.
*/
var exitCode$1 = (state, dispatch) => {
	let { $head, $anchor } = state.selection;
	if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;
	let above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt$1(above.contentMatchAt(after));
	if (!type || !above.canReplaceWith(after, after, type)) return false;
	if (dispatch) {
		let pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());
		tr.setSelection(Selection$2.near(tr.doc.resolve(pos), 1));
		dispatch(tr.scrollIntoView());
	}
	return true;
};
/**
If a block node is selected, create an empty paragraph before (if
it is its parent's first child) or after it.
*/
var createParagraphNear$1 = (state, dispatch) => {
	let sel = state.selection, { $from, $to } = sel;
	if (sel instanceof AllSelection$1 || $from.parent.inlineContent || $to.parent.inlineContent) return false;
	let type = defaultBlockAt$1($to.parent.contentMatchAt($to.indexAfter()));
	if (!type || !type.isTextblock) return false;
	if (dispatch) {
		let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;
		let tr = state.tr.insert(side, type.createAndFill());
		tr.setSelection(TextSelection$1.create(tr.doc, side + 1));
		dispatch(tr.scrollIntoView());
	}
	return true;
};
/**
If the cursor is in an empty textblock that can be lifted, lift the
block.
*/
var liftEmptyBlock$1 = (state, dispatch) => {
	let { $cursor } = state.selection;
	if (!$cursor || $cursor.parent.content.size) return false;
	if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {
		let before = $cursor.before();
		if (canSplit(state.doc, before)) {
			if (dispatch) dispatch(state.tr.split(before).scrollIntoView());
			return true;
		}
	}
	let range = $cursor.blockRange(), target = range && liftTarget(range);
	if (target == null) return false;
	if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
	return true;
};
/**
Create a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses
a custom function to determine the type of the newly split off block.
*/
function splitBlockAs(splitNode) {
	return (state, dispatch) => {
		let { $from, $to } = state.selection;
		if (state.selection instanceof NodeSelection$1 && state.selection.node.isBlock) {
			if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;
			if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());
			return true;
		}
		if (!$from.depth) return false;
		let types = [];
		let splitDepth, deflt, atEnd = false, atStart = false;
		for (let d = $from.depth;; d--) if ($from.node(d).isBlock) {
			atEnd = $from.end(d) == $from.pos + ($from.depth - d);
			atStart = $from.start(d) == $from.pos - ($from.depth - d);
			deflt = defaultBlockAt$1($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
			let splitType = splitNode && splitNode($to.parent, atEnd, $from);
			types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));
			splitDepth = d;
			break;
		} else {
			if (d == 1) return false;
			types.unshift(null);
		}
		let tr = state.tr;
		if (state.selection instanceof TextSelection$1 || state.selection instanceof AllSelection$1) tr.deleteSelection();
		let splitPos = tr.mapping.map($from.pos);
		let can = canSplit(tr.doc, splitPos, types.length, types);
		if (!can) {
			types[0] = deflt ? { type: deflt } : null;
			can = canSplit(tr.doc, splitPos, types.length, types);
		}
		if (!can) return false;
		tr.split(splitPos, types.length, types);
		if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
			let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
			if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
		}
		if (dispatch) dispatch(tr.scrollIntoView());
		return true;
	};
}
/**
Split the parent block of the selection. If the selection is a text
selection, also delete its content.
*/
var splitBlock$1 = splitBlockAs();
/**
Move the selection to the node wrapping the current selection, if
any. (Will not select the document node.)
*/
var selectParentNode$1 = (state, dispatch) => {
	let { $from, to } = state.selection, pos;
	let same = $from.sharedDepth(to);
	if (same == 0) return false;
	pos = $from.before(same);
	if (dispatch) dispatch(state.tr.setSelection(NodeSelection$1.create(state.doc, pos)));
	return true;
};
/**
Select the whole document.
*/
var selectAll$1 = (state, dispatch) => {
	if (dispatch) dispatch(state.tr.setSelection(new AllSelection$1(state.doc)));
	return true;
};
function joinMaybeClear(state, $pos, dispatch) {
	let before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();
	if (!before || !after || !before.type.compatibleContent(after.type)) return false;
	if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {
		if (dispatch) dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());
		return true;
	}
	if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos))) return false;
	if (dispatch) dispatch(state.tr.join($pos.pos).scrollIntoView());
	return true;
}
function deleteBarrier(state, $cut, dispatch, dir) {
	let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;
	let isolated = before.type.spec.isolating || after.type.spec.isolating;
	if (!isolated && joinMaybeClear(state, $cut, dispatch)) return true;
	let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
	if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {
		if (dispatch) {
			let end = $cut.pos + after.nodeSize, wrap = Fragment$1.empty;
			for (let i = conn.length - 1; i >= 0; i--) wrap = Fragment$1.from(conn[i].create(null, wrap));
			wrap = Fragment$1.from(before.copy(wrap));
			let tr = state.tr.step(new ReplaceAroundStep$1($cut.pos - 1, end, $cut.pos, end, new Slice$1(wrap, 1, 0), conn.length, true));
			let $joinAt = tr.doc.resolve(end + 2 * conn.length);
			if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos)) tr.join($joinAt.pos);
			dispatch(tr.scrollIntoView());
		}
		return true;
	}
	let selAfter = after.type.spec.isolating || dir > 0 && isolated ? null : Selection$2.findFrom($cut, 1);
	let range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range);
	if (target != null && target >= $cut.depth) {
		if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
		return true;
	}
	if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) {
		let at = before, wrap = [];
		for (;;) {
			wrap.push(at);
			if (at.isTextblock) break;
			at = at.lastChild;
		}
		let afterText = after, afterDepth = 1;
		for (; !afterText.isTextblock; afterText = afterText.firstChild) afterDepth++;
		if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
			if (dispatch) {
				let end = Fragment$1.empty;
				for (let i = wrap.length - 1; i >= 0; i--) end = Fragment$1.from(wrap[i].copy(end));
				dispatch(state.tr.step(new ReplaceAroundStep$1($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice$1(end, wrap.length, 0), 0, true)).scrollIntoView());
			}
			return true;
		}
	}
	return false;
}
function selectTextblockSide(side) {
	return function(state, dispatch) {
		let sel = state.selection, $pos = side < 0 ? sel.$from : sel.$to;
		let depth = $pos.depth;
		while ($pos.node(depth).isInline) {
			if (!depth) return false;
			depth--;
		}
		if (!$pos.node(depth).isTextblock) return false;
		if (dispatch) dispatch(state.tr.setSelection(TextSelection$1.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));
		return true;
	};
}
/**
Moves the cursor to the start of current text block.
*/
var selectTextblockStart$1 = selectTextblockSide(-1);
/**
Moves the cursor to the end of current text block.
*/
var selectTextblockEnd$1 = selectTextblockSide(1);
/**
Wrap the selection in a node of the given type with the given
attributes.
*/
function wrapIn$1(nodeType, attrs = null) {
	return function(state, dispatch) {
		let { $from, $to } = state.selection;
		let range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs);
		if (!wrapping) return false;
		if (dispatch) dispatch(state.tr.wrap(range, wrapping).scrollIntoView());
		return true;
	};
}
/**
Returns a command that tries to set the selected textblocks to the
given node type with the given attributes.
*/
function setBlockType(nodeType, attrs = null) {
	return function(state, dispatch) {
		let applicable = false;
		for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {
			let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
			state.doc.nodesBetween(from, to, (node, pos) => {
				if (applicable) return false;
				if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return;
				if (node.type == nodeType) applicable = true;
				else {
					let $pos = state.doc.resolve(pos), index = $pos.index();
					applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);
				}
			});
		}
		if (!applicable) return false;
		if (dispatch) {
			let tr = state.tr;
			for (let i = 0; i < state.selection.ranges.length; i++) {
				let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
				tr.setBlockType(from, to, nodeType, attrs);
			}
			dispatch(tr.scrollIntoView());
		}
		return true;
	};
}
/**
Combine a number of command functions into a single function (which
calls them one by one until one returns true).
*/
function chainCommands(...commands) {
	return function(state, dispatch, view) {
		for (let i = 0; i < commands.length; i++) if (commands[i](state, dispatch, view)) return true;
		return false;
	};
}
var backspace = chainCommands(deleteSelection$1, joinBackward$1, selectNodeBackward$1);
var del = chainCommands(deleteSelection$1, joinForward$1, selectNodeForward$1);
/**
A basic keymap containing bindings not specific to any schema.
Binds the following keys (when multiple commands are listed, they
are chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):

* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`
* **Mod-Enter** to `exitCode`
* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`
* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
* **Mod-a** to `selectAll`
*/
var pcBaseKeymap = {
	"Enter": chainCommands(newlineInCode$1, createParagraphNear$1, liftEmptyBlock$1, splitBlock$1),
	"Mod-Enter": exitCode$1,
	"Backspace": backspace,
	"Mod-Backspace": backspace,
	"Shift-Backspace": backspace,
	"Delete": del,
	"Mod-Delete": del,
	"Mod-a": selectAll$1
};
/**
A copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,
**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and
**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like
Ctrl-Delete.
*/
var macBaseKeymap = {
	"Ctrl-h": pcBaseKeymap["Backspace"],
	"Alt-Backspace": pcBaseKeymap["Mod-Backspace"],
	"Ctrl-d": pcBaseKeymap["Delete"],
	"Ctrl-Alt-Backspace": pcBaseKeymap["Mod-Delete"],
	"Alt-Delete": pcBaseKeymap["Mod-Delete"],
	"Alt-d": pcBaseKeymap["Mod-Delete"],
	"Ctrl-a": selectTextblockStart$1,
	"Ctrl-e": selectTextblockEnd$1
};
for (let key in pcBaseKeymap) macBaseKeymap[key] = pcBaseKeymap[key];
typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform && os.platform();
//#endregion
//#region node_modules/prosemirror-schema-list/dist/index.js
/**
Returns a command function that wraps the selection in a list with
the given type an attributes. If `dispatch` is null, only return a
value to indicate whether this is possible, but don't actually
perform the change.
*/
function wrapInList$1(listType, attrs = null) {
	return function(state, dispatch) {
		let { $from, $to } = state.selection;
		let range = $from.blockRange($to);
		if (!range) return false;
		let tr = dispatch ? state.tr : null;
		if (!wrapRangeInList(tr, range, listType, attrs)) return false;
		if (dispatch) dispatch(tr.scrollIntoView());
		return true;
	};
}
/**
Try to wrap the given node range in a list of the given type.
Return `true` when this is possible, `false` otherwise. When `tr`
is non-null, the wrapping is added to that transaction. When it is
`null`, the function only queries whether the wrapping is
possible.
*/
function wrapRangeInList(tr, range, listType, attrs = null) {
	let doJoin = false, outerRange = range, doc = range.$from.doc;
	if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
		if (range.$from.index(range.depth - 1) == 0) return false;
		let $insert = doc.resolve(range.start - 2);
		outerRange = new NodeRange$1($insert, $insert, range.depth);
		if (range.endIndex < range.parent.childCount) range = new NodeRange$1(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);
		doJoin = true;
	}
	let wrap = findWrapping(outerRange, listType, attrs, range);
	if (!wrap) return false;
	if (tr) doWrapInList(tr, range, wrap, doJoin, listType);
	return true;
}
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
	let content = Fragment$1.empty;
	for (let i = wrappers.length - 1; i >= 0; i--) content = Fragment$1.from(wrappers[i].type.create(wrappers[i].attrs, content));
	tr.step(new ReplaceAroundStep$1(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice$1(content, 0, 0), wrappers.length, true));
	let found = 0;
	for (let i = 0; i < wrappers.length; i++) if (wrappers[i].type == listType) found = i + 1;
	let splitDepth = wrappers.length - found;
	let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;
	for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {
		if (!first && canSplit(tr.doc, splitPos, splitDepth)) {
			tr.split(splitPos, splitDepth);
			splitPos += 2 * splitDepth;
		}
		splitPos += parent.child(i).nodeSize;
	}
	return tr;
}
/**
Create a command to lift the list item around the selection up into
a wrapping list.
*/
function liftListItem$1(itemType) {
	return function(state, dispatch) {
		let { $from, $to } = state.selection;
		let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
		if (!range) return false;
		if (!dispatch) return true;
		if ($from.node(range.depth - 1).type == itemType) return liftToOuterList(state, dispatch, itemType, range);
		else return liftOutOfList(state, dispatch, range);
	};
}
function liftToOuterList(state, dispatch, itemType, range) {
	let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
	if (end < endOfList) {
		tr.step(new ReplaceAroundStep$1(end - 1, endOfList, end, endOfList, new Slice$1(Fragment$1.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
		range = new NodeRange$1(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
	}
	const target = liftTarget(range);
	if (target == null) return false;
	tr.lift(range, target);
	let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);
	if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type) tr.join($after.pos);
	dispatch(tr.scrollIntoView());
	return true;
}
function liftOutOfList(state, dispatch, range) {
	let tr = state.tr, list = range.parent;
	for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
		pos -= list.child(i).nodeSize;
		tr.delete(pos - 1, pos + 1);
	}
	let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;
	if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) return false;
	let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
	let parent = $start.node(-1), indexBefore = $start.index(-1);
	if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment$1.empty : Fragment$1.from(list)))) return false;
	let start = $start.pos, end = start + item.nodeSize;
	tr.step(new ReplaceAroundStep$1(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice$1((atStart ? Fragment$1.empty : Fragment$1.from(list.copy(Fragment$1.empty))).append(atEnd ? Fragment$1.empty : Fragment$1.from(list.copy(Fragment$1.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
	dispatch(tr.scrollIntoView());
	return true;
}
/**
Create a command to sink the list item around the selection down
into an inner list.
*/
function sinkListItem$1(itemType) {
	return function(state, dispatch) {
		let { $from, $to } = state.selection;
		let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
		if (!range) return false;
		let startIndex = range.startIndex;
		if (startIndex == 0) return false;
		let parent = range.parent, nodeBefore = parent.child(startIndex - 1);
		if (nodeBefore.type != itemType) return false;
		if (dispatch) {
			let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
			let inner = Fragment$1.from(nestedBefore ? itemType.create() : null);
			let slice = new Slice$1(Fragment$1.from(itemType.create(null, Fragment$1.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
			let before = range.start, after = range.end;
			dispatch(state.tr.step(new ReplaceAroundStep$1(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());
		}
		return true;
	};
}
//#endregion
//#region node_modules/prosemirror-view/dist/index.js
var domIndex = function(node) {
	for (var index = 0;; index++) {
		node = node.previousSibling;
		if (!node) return index;
	}
};
var parentNode = function(node) {
	let parent = node.assignedSlot || node.parentNode;
	return parent && parent.nodeType == 11 ? parent.host : parent;
};
var reusedRange = null;
var textRange = function(node, from, to) {
	let range = reusedRange || (reusedRange = document.createRange());
	range.setEnd(node, to == null ? node.nodeValue.length : to);
	range.setStart(node, from || 0);
	return range;
};
var clearReusedRange = function() {
	reusedRange = null;
};
var isEquivalentPosition = function(node, off, targetNode, targetOff) {
	return targetNode && (scanFor(node, off, targetNode, targetOff, -1) || scanFor(node, off, targetNode, targetOff, 1));
};
var atomElements = /^(img|br|input|textarea|hr)$/i;
function scanFor(node, off, targetNode, targetOff, dir) {
	var _a;
	for (;;) {
		if (node == targetNode && off == targetOff) return true;
		if (off == (dir < 0 ? 0 : nodeSize(node))) {
			let parent = node.parentNode;
			if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
			off = domIndex(node) + (dir < 0 ? 0 : 1);
			node = parent;
		} else if (node.nodeType == 1) {
			let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
			if (child.nodeType == 1 && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
			else return false;
			else {
				node = child;
				off = dir < 0 ? nodeSize(node) : 0;
			}
		} else return false;
	}
}
function nodeSize(node) {
	return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
}
function textNodeBefore$1(node, offset) {
	for (;;) {
		if (node.nodeType == 3 && offset) return node;
		if (node.nodeType == 1 && offset > 0) {
			if (node.contentEditable == "false") return null;
			node = node.childNodes[offset - 1];
			offset = nodeSize(node);
		} else if (node.parentNode && !hasBlockDesc(node)) {
			offset = domIndex(node);
			node = node.parentNode;
		} else return null;
	}
}
function textNodeAfter$1(node, offset) {
	for (;;) {
		if (node.nodeType == 3 && offset < node.nodeValue.length) return node;
		if (node.nodeType == 1 && offset < node.childNodes.length) {
			if (node.contentEditable == "false") return null;
			node = node.childNodes[offset];
			offset = 0;
		} else if (node.parentNode && !hasBlockDesc(node)) {
			offset = domIndex(node) + 1;
			node = node.parentNode;
		} else return null;
	}
}
function isOnEdge(node, offset, parent) {
	for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {
		if (node == parent) return true;
		let index = domIndex(node);
		node = node.parentNode;
		if (!node) return false;
		atStart = atStart && index == 0;
		atEnd = atEnd && index == nodeSize(node);
	}
}
function hasBlockDesc(dom) {
	let desc;
	for (let cur = dom; cur; cur = cur.parentNode) if (desc = cur.pmViewDesc) break;
	return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);
}
var selectionCollapsed = function(domSel) {
	return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);
};
function keyEvent(keyCode, key) {
	let event = document.createEvent("Event");
	event.initEvent("keydown", true, true);
	event.keyCode = keyCode;
	event.key = event.code = key;
	return event;
}
function deepActiveElement(doc) {
	let elt = doc.activeElement;
	while (elt && elt.shadowRoot) elt = elt.shadowRoot.activeElement;
	return elt;
}
function caretFromPoint(doc, x, y) {
	if (doc.caretPositionFromPoint) try {
		let pos = doc.caretPositionFromPoint(x, y);
		if (pos) return {
			node: pos.offsetNode,
			offset: Math.min(nodeSize(pos.offsetNode), pos.offset)
		};
	} catch (_) {}
	if (doc.caretRangeFromPoint) {
		let range = doc.caretRangeFromPoint(x, y);
		if (range) return {
			node: range.startContainer,
			offset: Math.min(nodeSize(range.startContainer), range.startOffset)
		};
	}
}
var nav = typeof navigator != "undefined" ? navigator : null;
var doc = typeof document != "undefined" ? document : null;
var agent = nav && nav.userAgent || "";
var ie_edge = /Edge\/(\d+)/.exec(agent);
var ie_upto10 = /MSIE \d/.exec(agent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
var ie$1 = !!(ie_upto10 || ie_11up || ie_edge);
var ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;
var gecko = !ie$1 && /gecko\/(\d+)/i.test(agent);
gecko && +(/Firefox\/(\d+)/.exec(agent) || [0, 0])[1];
var _chrome = !ie$1 && /Chrome\/(\d+)/.exec(agent);
var chrome = !!_chrome;
var chrome_version = _chrome ? +_chrome[1] : 0;
var safari = !ie$1 && !!nav && /Apple Computer/.test(nav.vendor);
var ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);
var mac$2 = ios || (nav ? /Mac/.test(nav.platform) : false);
var windows$1 = nav ? /Win/.test(nav.platform) : false;
var android = /Android \d/.test(agent);
var webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
var webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
function windowRect(doc) {
	let vp = doc.defaultView && doc.defaultView.visualViewport;
	if (vp) return {
		left: 0,
		right: vp.width,
		top: 0,
		bottom: vp.height
	};
	return {
		left: 0,
		right: doc.documentElement.clientWidth,
		top: 0,
		bottom: doc.documentElement.clientHeight
	};
}
function getSide(value, side) {
	return typeof value == "number" ? value : value[side];
}
function clientRect(node) {
	let rect = node.getBoundingClientRect();
	let scaleX = rect.width / node.offsetWidth || 1;
	let scaleY = rect.height / node.offsetHeight || 1;
	return {
		left: rect.left,
		right: rect.left + node.clientWidth * scaleX,
		top: rect.top,
		bottom: rect.top + node.clientHeight * scaleY
	};
}
function scrollRectIntoView(view, rect, startDOM) {
	let scrollThreshold = view.someProp("scrollThreshold") || 0, scrollMargin = view.someProp("scrollMargin") || 5;
	let doc = view.dom.ownerDocument;
	for (let parent = startDOM || view.dom;;) {
		if (!parent) break;
		if (parent.nodeType != 1) {
			parent = parentNode(parent);
			continue;
		}
		let elt = parent;
		let atTop = elt == doc.body;
		let bounding = atTop ? windowRect(doc) : clientRect(elt);
		let moveX = 0, moveY = 0;
		if (rect.top < bounding.top + getSide(scrollThreshold, "top")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
		else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
		if (rect.left < bounding.left + getSide(scrollThreshold, "left")) moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
		else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
		if (moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY);
		else {
			let startX = elt.scrollLeft, startY = elt.scrollTop;
			if (moveY) elt.scrollTop += moveY;
			if (moveX) elt.scrollLeft += moveX;
			let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;
			rect = {
				left: rect.left - dX,
				top: rect.top - dY,
				right: rect.right - dX,
				bottom: rect.bottom - dY
			};
		}
		let pos = atTop ? "fixed" : getComputedStyle(parent).position;
		if (/^(fixed|sticky)$/.test(pos)) break;
		parent = pos == "absolute" ? parent.offsetParent : parentNode(parent);
	}
}
function storeScrollPos(view) {
	let rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);
	let refDOM, refTop;
	for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {
		let dom = view.root.elementFromPoint(x, y);
		if (!dom || dom == view.dom || !view.dom.contains(dom)) continue;
		let localRect = dom.getBoundingClientRect();
		if (localRect.top >= startY - 20) {
			refDOM = dom;
			refTop = localRect.top;
			break;
		}
	}
	return {
		refDOM,
		refTop,
		stack: scrollStack(view.dom)
	};
}
function scrollStack(dom) {
	let stack = [], doc = dom.ownerDocument;
	for (let cur = dom; cur; cur = parentNode(cur)) {
		stack.push({
			dom: cur,
			top: cur.scrollTop,
			left: cur.scrollLeft
		});
		if (dom == doc) break;
	}
	return stack;
}
function resetScrollPos({ refDOM, refTop, stack }) {
	let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;
	restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);
}
function restoreScrollStack(stack, dTop) {
	for (let i = 0; i < stack.length; i++) {
		let { dom, top, left } = stack[i];
		if (dom.scrollTop != top + dTop) dom.scrollTop = top + dTop;
		if (dom.scrollLeft != left) dom.scrollLeft = left;
	}
}
var preventScrollSupported = null;
function focusPreventScroll(dom) {
	if (dom.setActive) return dom.setActive();
	if (preventScrollSupported) return dom.focus(preventScrollSupported);
	let stored = scrollStack(dom);
	dom.focus(preventScrollSupported == null ? { get preventScroll() {
		preventScrollSupported = { preventScroll: true };
		return true;
	} } : void 0);
	if (!preventScrollSupported) {
		preventScrollSupported = false;
		restoreScrollStack(stored, 0);
	}
}
function findOffsetInNode(node, coords) {
	let closest, dxClosest = 2e8, coordsClosest, offset = 0;
	let rowBot = coords.top, rowTop = coords.top;
	let firstBelow, coordsBelow;
	for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
		let rects;
		if (child.nodeType == 1) rects = child.getClientRects();
		else if (child.nodeType == 3) rects = textRange(child).getClientRects();
		else continue;
		for (let i = 0; i < rects.length; i++) {
			let rect = rects[i];
			if (rect.top <= rowBot && rect.bottom >= rowTop) {
				rowBot = Math.max(rect.bottom, rowBot);
				rowTop = Math.min(rect.top, rowTop);
				let dx = rect.left > coords.left ? rect.left - coords.left : rect.right < coords.left ? coords.left - rect.right : 0;
				if (dx < dxClosest) {
					closest = child;
					dxClosest = dx;
					coordsClosest = dx && closest.nodeType == 3 ? {
						left: rect.right < coords.left ? rect.right : rect.left,
						top: coords.top
					} : coords;
					if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
					continue;
				}
			} else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
				firstBelow = child;
				coordsBelow = {
					left: Math.max(rect.left, Math.min(rect.right, coords.left)),
					top: rect.top
				};
			}
			if (!closest && (coords.left >= rect.right && coords.top >= rect.top || coords.left >= rect.left && coords.top >= rect.bottom)) offset = childIndex + 1;
		}
	}
	if (!closest && firstBelow) {
		closest = firstBelow;
		coordsClosest = coordsBelow;
		dxClosest = 0;
	}
	if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);
	if (!closest || dxClosest && closest.nodeType == 1) return {
		node,
		offset
	};
	return findOffsetInNode(closest, coordsClosest);
}
function findOffsetInText(node, coords) {
	let len = node.nodeValue.length;
	let range = document.createRange(), result;
	for (let i = 0; i < len; i++) {
		range.setEnd(node, i + 1);
		range.setStart(node, i);
		let rect = singleRect(range, 1);
		if (rect.top == rect.bottom) continue;
		if (inRect(coords, rect)) {
			result = {
				node,
				offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)
			};
			break;
		}
	}
	range.detach();
	return result || {
		node,
		offset: 0
	};
}
function inRect(coords, rect) {
	return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 && coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;
}
function targetKludge(dom, coords) {
	let parent = dom.parentNode;
	if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left) return parent;
	return dom;
}
function posFromElement(view, elt, coords) {
	let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
	if (node.nodeType == 1 && !node.firstChild) {
		let rect = node.getBoundingClientRect();
		bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
	}
	return view.docView.posFromDOM(node, offset, bias);
}
function posFromCaret(view, node, offset, coords) {
	let outsideBlock = -1;
	for (let cur = node, sawBlock = false;;) {
		if (cur == view.dom) break;
		let desc = view.docView.nearestDesc(cur, true), rect;
		if (!desc) return null;
		if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
			if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
				if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;
				else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;
				sawBlock = true;
			}
			if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) return (desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2) ? desc.posBefore : desc.posAfter;
		}
		cur = desc.dom.parentNode;
	}
	return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);
}
function elementFromPoint(element, coords, box) {
	let len = element.childNodes.length;
	if (len && box.top < box.bottom) for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {
		let child = element.childNodes[i];
		if (child.nodeType == 1) {
			let rects = child.getClientRects();
			for (let j = 0; j < rects.length; j++) {
				let rect = rects[j];
				if (inRect(coords, rect)) return elementFromPoint(child, coords, rect);
			}
		}
		if ((i = (i + 1) % len) == startI) break;
	}
	return element;
}
function posAtCoords(view, coords) {
	let doc = view.dom.ownerDocument, node, offset = 0;
	let caret = caretFromPoint(doc, coords.left, coords.top);
	if (caret) ({node, offset} = caret);
	let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
	let pos;
	if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
		let box = view.dom.getBoundingClientRect();
		if (!inRect(coords, box)) return null;
		elt = elementFromPoint(view.dom, coords, box);
		if (!elt) return null;
	}
	if (safari) {
		for (let p = elt; node && p; p = parentNode(p)) if (p.draggable) node = void 0;
	}
	elt = targetKludge(elt, coords);
	if (node) {
		if (gecko && node.nodeType == 1) {
			offset = Math.min(offset, node.childNodes.length);
			if (offset < node.childNodes.length) {
				let next = node.childNodes[offset], box;
				if (next.nodeName == "IMG" && (box = next.getBoundingClientRect()).right <= coords.left && box.bottom > coords.top) offset++;
			}
		}
		let prev;
		if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
		if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
		else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
	}
	if (pos == null) pos = posFromElement(view, elt, coords);
	let desc = view.docView.nearestDesc(elt, true);
	return {
		pos,
		inside: desc ? desc.posAtStart - desc.border : -1
	};
}
function nonZero(rect) {
	return rect.top < rect.bottom || rect.left < rect.right;
}
function singleRect(target, bias) {
	let rects = target.getClientRects();
	if (rects.length) {
		let first = rects[bias < 0 ? 0 : rects.length - 1];
		if (nonZero(first)) return first;
	}
	return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();
}
var BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
function coordsAtPos(view, pos, side) {
	let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
	let supportEmptyRange = webkit || gecko;
	if (node.nodeType == 3) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
		let rect = singleRect(textRange(node, offset, offset), side);
		if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
			let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
			if (rectBefore.top == rect.top) {
				let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);
				if (rectAfter.top != rect.top) return flattenV(rectAfter, rectAfter.left < rectBefore.left);
			}
		}
		return rect;
	} else {
		let from = offset, to = offset, takeSide = side < 0 ? 1 : -1;
		if (side < 0 && !offset) {
			to++;
			takeSide = -1;
		} else if (side >= 0 && offset == node.nodeValue.length) {
			from--;
			takeSide = 1;
		} else if (side < 0) from--;
		else to++;
		return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);
	}
	if (!view.state.doc.resolve(pos - (atom || 0)).parent.inlineContent) {
		if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
			let before = node.childNodes[offset - 1];
			if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);
		}
		if (atom == null && offset < nodeSize(node)) {
			let after = node.childNodes[offset];
			if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);
		}
		return flattenH(node.getBoundingClientRect(), side >= 0);
	}
	if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
		let before = node.childNodes[offset - 1];
		let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
		if (target) return flattenV(singleRect(target, 1), false);
	}
	if (atom == null && offset < nodeSize(node)) {
		let after = node.childNodes[offset];
		while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;
		let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;
		if (target) return flattenV(singleRect(target, -1), true);
	}
	return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
}
function flattenV(rect, left) {
	if (rect.width == 0) return rect;
	let x = left ? rect.left : rect.right;
	return {
		top: rect.top,
		bottom: rect.bottom,
		left: x,
		right: x
	};
}
function flattenH(rect, top) {
	if (rect.height == 0) return rect;
	let y = top ? rect.top : rect.bottom;
	return {
		top: y,
		bottom: y,
		left: rect.left,
		right: rect.right
	};
}
function withFlushedState(view, state, f) {
	let viewState = view.state, active = view.root.activeElement;
	if (viewState != state) view.updateState(state);
	if (active != view.dom) view.focus();
	try {
		return f();
	} finally {
		if (viewState != state) view.updateState(viewState);
		if (active != view.dom && active) active.focus();
	}
}
function endOfTextblockVertical(view, state, dir) {
	let sel = state.selection;
	let $pos = dir == "up" ? sel.$from : sel.$to;
	return withFlushedState(view, state, () => {
		let { node: dom } = view.docView.domFromPos($pos.pos, dir == "up" ? -1 : 1);
		for (;;) {
			let nearest = view.docView.nearestDesc(dom, true);
			if (!nearest) break;
			if (nearest.node.isBlock) {
				dom = nearest.contentDOM || nearest.dom;
				break;
			}
			dom = nearest.dom.parentNode;
		}
		let coords = coordsAtPos(view, $pos.pos, 1);
		for (let child = dom.firstChild; child; child = child.nextSibling) {
			let boxes;
			if (child.nodeType == 1) boxes = child.getClientRects();
			else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
			else continue;
			for (let i = 0; i < boxes.length; i++) {
				let box = boxes[i];
				if (box.bottom > box.top + 1 && (dir == "up" ? coords.top - box.top > (box.bottom - coords.top) * 2 : box.bottom - coords.bottom > (coords.bottom - box.top) * 2)) return false;
			}
		}
		return true;
	});
}
var maybeRTL = /[\u0590-\u08ac]/;
function endOfTextblockHorizontal(view, state, dir) {
	let { $head } = state.selection;
	if (!$head.parent.isTextblock) return false;
	let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;
	let sel = view.domSelection();
	if (!sel) return $head.pos == $head.start() || $head.pos == $head.end();
	if (!maybeRTL.test($head.parent.textContent) || !sel.modify) return dir == "left" || dir == "backward" ? atStart : atEnd;
	return withFlushedState(view, state, () => {
		let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange();
		let oldBidiLevel = sel.caretBidiLevel;
		sel.modify("move", dir, "character");
		let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
		let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
		let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;
		try {
			sel.collapse(anchorNode, anchorOffset);
			if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);
		} catch (_) {}
		if (oldBidiLevel != null) sel.caretBidiLevel = oldBidiLevel;
		return result;
	});
}
var cachedState = null;
var cachedDir = null;
var cachedResult = false;
function endOfTextblock(view, state, dir) {
	if (cachedState == state && cachedDir == dir) return cachedResult;
	cachedState = state;
	cachedDir = dir;
	return cachedResult = dir == "up" || dir == "down" ? endOfTextblockVertical(view, state, dir) : endOfTextblockHorizontal(view, state, dir);
}
var NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;
var ViewDesc = class {
	constructor(parent, children, dom, contentDOM) {
		this.parent = parent;
		this.children = children;
		this.dom = dom;
		this.contentDOM = contentDOM;
		this.dirty = NOT_DIRTY;
		dom.pmViewDesc = this;
	}
	matchesWidget(widget) {
		return false;
	}
	matchesMark(mark) {
		return false;
	}
	matchesNode(node, outerDeco, innerDeco) {
		return false;
	}
	matchesHack(nodeName) {
		return false;
	}
	parseRule() {
		return null;
	}
	stopEvent(event) {
		return false;
	}
	get size() {
		let size = 0;
		for (let i = 0; i < this.children.length; i++) size += this.children[i].size;
		return size;
	}
	get border() {
		return 0;
	}
	destroy() {
		this.parent = void 0;
		if (this.dom.pmViewDesc == this) this.dom.pmViewDesc = void 0;
		for (let i = 0; i < this.children.length; i++) this.children[i].destroy();
	}
	posBeforeChild(child) {
		for (let i = 0, pos = this.posAtStart;; i++) {
			let cur = this.children[i];
			if (cur == child) return pos;
			pos += cur.size;
		}
	}
	get posBefore() {
		return this.parent.posBeforeChild(this);
	}
	get posAtStart() {
		return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
	}
	get posAfter() {
		return this.posBefore + this.size;
	}
	get posAtEnd() {
		return this.posAtStart + this.size - 2 * this.border;
	}
	localPosFromDOM(dom, offset, bias) {
		if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) if (bias < 0) {
			let domBefore, desc;
			if (dom == this.contentDOM) domBefore = dom.childNodes[offset - 1];
			else {
				while (dom.parentNode != this.contentDOM) dom = dom.parentNode;
				domBefore = dom.previousSibling;
			}
			while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) domBefore = domBefore.previousSibling;
			return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;
		} else {
			let domAfter, desc;
			if (dom == this.contentDOM) domAfter = dom.childNodes[offset];
			else {
				while (dom.parentNode != this.contentDOM) dom = dom.parentNode;
				domAfter = dom.nextSibling;
			}
			while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) domAfter = domAfter.nextSibling;
			return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;
		}
		let atEnd;
		if (dom == this.dom && this.contentDOM) atEnd = offset > domIndex(this.contentDOM);
		else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
		else if (this.dom.firstChild) {
			if (offset == 0) for (let search = dom;; search = search.parentNode) {
				if (search == this.dom) {
					atEnd = false;
					break;
				}
				if (search.previousSibling) break;
			}
			if (atEnd == null && offset == dom.childNodes.length) for (let search = dom;; search = search.parentNode) {
				if (search == this.dom) {
					atEnd = true;
					break;
				}
				if (search.nextSibling) break;
			}
		}
		return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;
	}
	nearestDesc(dom, onlyNodes = false) {
		for (let first = true, cur = dom; cur; cur = cur.parentNode) {
			let desc = this.getDesc(cur), nodeDOM;
			if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;
			else return desc;
		}
	}
	getDesc(dom) {
		let desc = dom.pmViewDesc;
		for (let cur = desc; cur; cur = cur.parent) if (cur == this) return desc;
	}
	posFromDOM(dom, offset, bias) {
		for (let scan = dom; scan; scan = scan.parentNode) {
			let desc = this.getDesc(scan);
			if (desc) return desc.localPosFromDOM(dom, offset, bias);
		}
		return -1;
	}
	descAt(pos) {
		for (let i = 0, offset = 0; i < this.children.length; i++) {
			let child = this.children[i], end = offset + child.size;
			if (offset == pos && end != offset) {
				while (!child.border && child.children.length) for (let i = 0; i < child.children.length; i++) {
					let inner = child.children[i];
					if (inner.size) {
						child = inner;
						break;
					}
				}
				return child;
			}
			if (pos < end) return child.descAt(pos - offset - child.border);
			offset = end;
		}
	}
	domFromPos(pos, side) {
		if (!this.contentDOM) return {
			node: this.dom,
			offset: 0,
			atom: pos + 1
		};
		let i = 0, offset = 0;
		for (let curPos = 0; i < this.children.length; i++) {
			let child = this.children[i], end = curPos + child.size;
			if (end > pos || child instanceof TrailingHackViewDesc) {
				offset = pos - curPos;
				break;
			}
			curPos = end;
		}
		if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);
		for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--);
		if (side <= 0) {
			let prev, enter = true;
			for (;; i--, enter = false) {
				prev = i ? this.children[i - 1] : null;
				if (!prev || prev.dom.parentNode == this.contentDOM) break;
			}
			if (prev && side && enter && !prev.border && !prev.domAtom) return prev.domFromPos(prev.size, side);
			return {
				node: this.contentDOM,
				offset: prev ? domIndex(prev.dom) + 1 : 0
			};
		} else {
			let next, enter = true;
			for (;; i++, enter = false) {
				next = i < this.children.length ? this.children[i] : null;
				if (!next || next.dom.parentNode == this.contentDOM) break;
			}
			if (next && enter && !next.border && !next.domAtom) return next.domFromPos(0, side);
			return {
				node: this.contentDOM,
				offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length
			};
		}
	}
	parseRange(from, to, base = 0) {
		if (this.children.length == 0) return {
			node: this.contentDOM,
			from,
			to,
			fromOffset: 0,
			toOffset: this.contentDOM.childNodes.length
		};
		let fromOffset = -1, toOffset = -1;
		for (let offset = base, i = 0;; i++) {
			let child = this.children[i], end = offset + child.size;
			if (fromOffset == -1 && from <= end) {
				let childBase = offset + child.border;
				if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) return child.parseRange(from, to, childBase);
				from = offset;
				for (let j = i; j > 0; j--) {
					let prev = this.children[j - 1];
					if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
						fromOffset = domIndex(prev.dom) + 1;
						break;
					}
					from -= prev.size;
				}
				if (fromOffset == -1) fromOffset = 0;
			}
			if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {
				to = end;
				for (let j = i + 1; j < this.children.length; j++) {
					let next = this.children[j];
					if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {
						toOffset = domIndex(next.dom);
						break;
					}
					to += next.size;
				}
				if (toOffset == -1) toOffset = this.contentDOM.childNodes.length;
				break;
			}
			offset = end;
		}
		return {
			node: this.contentDOM,
			from,
			to,
			fromOffset,
			toOffset
		};
	}
	emptyChildAt(side) {
		if (this.border || !this.contentDOM || !this.children.length) return false;
		let child = this.children[side < 0 ? 0 : this.children.length - 1];
		return child.size == 0 || child.emptyChildAt(side);
	}
	domAfterPos(pos) {
		let { node, offset } = this.domFromPos(pos, 0);
		if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
		return node.childNodes[offset];
	}
	setSelection(anchor, head, view, force = false) {
		let from = Math.min(anchor, head), to = Math.max(anchor, head);
		for (let i = 0, offset = 0; i < this.children.length; i++) {
			let child = this.children[i], end = offset + child.size;
			if (from > offset && to < end) return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);
			offset = end;
		}
		let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);
		let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);
		let domSel = view.root.getSelection();
		let selRange = view.domSelectionRange();
		let brKludge = false;
		if ((gecko || safari) && anchor == head) {
			let { node, offset } = anchorDOM;
			if (node.nodeType == 3) {
				brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
				if (brKludge && offset == node.nodeValue.length) for (let scan = node, after; scan; scan = scan.parentNode) {
					if (after = scan.nextSibling) {
						if (after.nodeName == "BR") anchorDOM = headDOM = {
							node: after.parentNode,
							offset: domIndex(after) + 1
						};
						break;
					}
					let desc = scan.pmViewDesc;
					if (desc && desc.node && desc.node.isBlock) break;
				}
			} else {
				let prev = node.childNodes[offset - 1];
				brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
			}
		}
		if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
			let after = selRange.focusNode.childNodes[selRange.focusOffset];
			if (after && after.contentEditable == "false") force = true;
		}
		if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset)) return;
		let domSelExtended = false;
		if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {
			domSel.collapse(anchorDOM.node, anchorDOM.offset);
			try {
				if (anchor != head) domSel.extend(headDOM.node, headDOM.offset);
				domSelExtended = true;
			} catch (_) {}
		}
		if (!domSelExtended) {
			if (anchor > head) {
				let tmp = anchorDOM;
				anchorDOM = headDOM;
				headDOM = tmp;
			}
			let range = document.createRange();
			range.setEnd(headDOM.node, headDOM.offset);
			range.setStart(anchorDOM.node, anchorDOM.offset);
			domSel.removeAllRanges();
			domSel.addRange(range);
		}
	}
	ignoreMutation(mutation) {
		return !this.contentDOM && mutation.type != "selection";
	}
	get contentLost() {
		return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
	}
	markDirty(from, to) {
		for (let offset = 0, i = 0; i < this.children.length; i++) {
			let child = this.children[i], end = offset + child.size;
			if (offset == end ? from <= end && to >= offset : from < end && to > offset) {
				let startInside = offset + child.border, endInside = end - child.border;
				if (from >= startInside && to <= endInside) {
					this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
					if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM)) child.dirty = NODE_DIRTY;
					else child.markDirty(from - startInside, to - startInside);
					return;
				} else child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;
			}
			offset = end;
		}
		this.dirty = CONTENT_DIRTY;
	}
	markParentsDirty() {
		let level = 1;
		for (let node = this.parent; node; node = node.parent, level++) {
			let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;
			if (node.dirty < dirty) node.dirty = dirty;
		}
	}
	get domAtom() {
		return false;
	}
	get ignoreForCoords() {
		return false;
	}
	get ignoreForSelection() {
		return false;
	}
	isText(text) {
		return false;
	}
};
var WidgetViewDesc = class extends ViewDesc {
	constructor(parent, widget, view, pos) {
		let self, dom = widget.type.toDOM;
		if (typeof dom == "function") dom = dom(view, () => {
			if (!self) return pos;
			if (self.parent) return self.parent.posBeforeChild(self);
		});
		if (!widget.type.spec.raw) {
			if (dom.nodeType != 1) {
				let wrap = document.createElement("span");
				wrap.appendChild(dom);
				dom = wrap;
			}
			dom.contentEditable = "false";
			dom.classList.add("ProseMirror-widget");
		}
		super(parent, [], dom, null);
		this.widget = widget;
		this.widget = widget;
		self = this;
	}
	matchesWidget(widget) {
		return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);
	}
	parseRule() {
		return { ignore: true };
	}
	stopEvent(event) {
		let stop = this.widget.spec.stopEvent;
		return stop ? stop(event) : false;
	}
	ignoreMutation(mutation) {
		return mutation.type != "selection" || this.widget.spec.ignoreSelection;
	}
	destroy() {
		this.widget.type.destroy(this.dom);
		super.destroy();
	}
	get domAtom() {
		return true;
	}
	get ignoreForSelection() {
		return !!this.widget.type.spec.relaxedSide;
	}
	get side() {
		return this.widget.type.side;
	}
};
var CompositionViewDesc = class extends ViewDesc {
	constructor(parent, dom, textDOM, text) {
		super(parent, [], dom, null);
		this.textDOM = textDOM;
		this.text = text;
	}
	get size() {
		return this.text.length;
	}
	localPosFromDOM(dom, offset) {
		if (dom != this.textDOM) return this.posAtStart + (offset ? this.size : 0);
		return this.posAtStart + offset;
	}
	domFromPos(pos) {
		return {
			node: this.textDOM,
			offset: pos
		};
	}
	ignoreMutation(mut) {
		return mut.type === "characterData" && mut.target.nodeValue == mut.oldValue;
	}
};
var MarkViewDesc = class MarkViewDesc extends ViewDesc {
	constructor(parent, mark, dom, contentDOM, spec) {
		super(parent, [], dom, contentDOM);
		this.mark = mark;
		this.spec = spec;
	}
	static create(parent, mark, inline, view) {
		let custom = view.nodeViews[mark.type.name];
		let spec = custom && custom(mark, view, inline);
		if (!spec || !spec.dom) spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);
		return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);
	}
	parseRule() {
		if (this.dirty & NODE_DIRTY || this.mark.type.spec.reparseInView) return null;
		return {
			mark: this.mark.type.name,
			attrs: this.mark.attrs,
			contentElement: this.contentDOM
		};
	}
	matchesMark(mark) {
		return this.dirty != NODE_DIRTY && this.mark.eq(mark);
	}
	markDirty(from, to) {
		super.markDirty(from, to);
		if (this.dirty != NOT_DIRTY) {
			let parent = this.parent;
			while (!parent.node) parent = parent.parent;
			if (parent.dirty < this.dirty) parent.dirty = this.dirty;
			this.dirty = NOT_DIRTY;
		}
	}
	slice(from, to, view) {
		let copy = MarkViewDesc.create(this.parent, this.mark, true, view);
		let nodes = this.children, size = this.size;
		if (to < size) nodes = replaceNodes(nodes, to, size, view);
		if (from > 0) nodes = replaceNodes(nodes, 0, from, view);
		for (let i = 0; i < nodes.length; i++) nodes[i].parent = copy;
		copy.children = nodes;
		return copy;
	}
	ignoreMutation(mutation) {
		return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
	}
	destroy() {
		if (this.spec.destroy) this.spec.destroy();
		super.destroy();
	}
};
var NodeViewDesc = class NodeViewDesc extends ViewDesc {
	constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {
		super(parent, [], dom, contentDOM);
		this.node = node;
		this.outerDeco = outerDeco;
		this.innerDeco = innerDeco;
		this.nodeDOM = nodeDOM;
	}
	static create(parent, node, outerDeco, innerDeco, view, pos) {
		let custom = view.nodeViews[node.type.name], descObj;
		let spec = custom && custom(node, view, () => {
			if (!descObj) return pos;
			if (descObj.parent) return descObj.parent.posBeforeChild(descObj);
		}, outerDeco, innerDeco);
		let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;
		if (node.isText) {
			if (!dom) dom = document.createTextNode(node.text);
			else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
		} else if (!dom) {
			let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
			({dom, contentDOM} = spec);
		}
		if (!contentDOM && !node.isText && dom.nodeName != "BR") {
			if (!dom.hasAttribute("contenteditable")) dom.contentEditable = "false";
			if (node.type.spec.draggable) dom.draggable = true;
		}
		let nodeDOM = dom;
		dom = applyOuterDeco(dom, outerDeco, node);
		if (spec) return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);
		else if (node.isText) return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);
		else return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);
	}
	parseRule() {
		if (this.node.type.spec.reparseInView) return null;
		let rule = {
			node: this.node.type.name,
			attrs: this.node.attrs
		};
		if (this.node.type.whitespace == "pre") rule.preserveWhitespace = "full";
		if (!this.contentDOM) rule.getContent = () => this.node.content;
		else if (!this.contentLost) rule.contentElement = this.contentDOM;
		else {
			for (let i = this.children.length - 1; i >= 0; i--) {
				let child = this.children[i];
				if (this.dom.contains(child.dom.parentNode)) {
					rule.contentElement = child.dom.parentNode;
					break;
				}
			}
			if (!rule.contentElement) rule.getContent = () => Fragment$1.empty;
		}
		return rule;
	}
	matchesNode(node, outerDeco, innerDeco) {
		return this.dirty == NOT_DIRTY && node.eq(this.node) && sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);
	}
	get size() {
		return this.node.nodeSize;
	}
	get border() {
		return this.node.isLeaf ? 0 : 1;
	}
	updateChildren(view, pos) {
		let inline = this.node.inlineContent, off = pos;
		let composition = view.composing ? this.localCompositionInfo(view, pos) : null;
		let localComposition = composition && composition.pos > -1 ? composition : null;
		let compositionInChild = composition && composition.pos < 0;
		let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
		iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
			if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view, i);
			else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark$2.none : this.node.child(i).marks, inline, view, i);
			updater.placeWidget(widget, view, off);
		}, (child, outerDeco, innerDeco, i) => {
			updater.syncToMarks(child.marks, inline, view, i);
			let compIndex;
			if (updater.findNodeMatch(child, outerDeco, innerDeco, i));
			else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view));
			else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off));
			else updater.addNode(child, outerDeco, innerDeco, view, off);
			off += child.nodeSize;
		});
		updater.syncToMarks([], inline, view, 0);
		if (this.node.isTextblock) updater.addTextblockHacks();
		updater.destroyRest();
		if (updater.changed || this.dirty == CONTENT_DIRTY) {
			if (localComposition) this.protectLocalComposition(view, localComposition);
			renderDescs(this.contentDOM, this.children, view);
			if (ios) iosHacks(this.dom);
		}
	}
	localCompositionInfo(view, pos) {
		let { from, to } = view.state.selection;
		if (!(view.state.selection instanceof TextSelection$1) || from < pos || to > pos + this.node.content.size) return null;
		let textNode = view.input.compositionNode;
		if (!textNode || !this.dom.contains(textNode.parentNode)) return null;
		if (this.node.inlineContent) {
			let text = textNode.nodeValue;
			let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);
			return textPos < 0 ? null : {
				node: textNode,
				pos: textPos,
				text
			};
		} else return {
			node: textNode,
			pos: -1,
			text: ""
		};
	}
	protectLocalComposition(view, { node, pos, text }) {
		if (this.getDesc(node)) return;
		let topNode = node;
		for (;; topNode = topNode.parentNode) {
			if (topNode.parentNode == this.contentDOM) break;
			while (topNode.previousSibling) topNode.parentNode.removeChild(topNode.previousSibling);
			while (topNode.nextSibling) topNode.parentNode.removeChild(topNode.nextSibling);
			if (topNode.pmViewDesc) topNode.pmViewDesc = void 0;
		}
		let desc = new CompositionViewDesc(this, topNode, node, text);
		view.input.compositionNodes.push(desc);
		this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);
	}
	update(node, outerDeco, innerDeco, view) {
		if (this.dirty == NODE_DIRTY || !node.sameMarkup(this.node)) return false;
		this.updateInner(node, outerDeco, innerDeco, view);
		return true;
	}
	updateInner(node, outerDeco, innerDeco, view) {
		this.updateOuterDeco(outerDeco);
		this.node = node;
		this.innerDeco = innerDeco;
		if (this.contentDOM) this.updateChildren(view, this.posAtStart);
		this.dirty = NOT_DIRTY;
	}
	updateOuterDeco(outerDeco) {
		if (sameOuterDeco(outerDeco, this.outerDeco)) return;
		let needsWrap = this.nodeDOM.nodeType != 1;
		let oldDOM = this.dom;
		this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
		if (this.dom != oldDOM) {
			oldDOM.pmViewDesc = void 0;
			this.dom.pmViewDesc = this;
		}
		this.outerDeco = outerDeco;
	}
	selectNode() {
		if (this.nodeDOM.nodeType == 1) {
			this.nodeDOM.classList.add("ProseMirror-selectednode");
			if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
		}
	}
	deselectNode() {
		if (this.nodeDOM.nodeType == 1) {
			this.nodeDOM.classList.remove("ProseMirror-selectednode");
			if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
		}
	}
	get domAtom() {
		return this.node.isAtom;
	}
};
function docViewDesc(doc, outerDeco, innerDeco, dom, view) {
	applyOuterDeco(dom, outerDeco, doc);
	let docView = new NodeViewDesc(void 0, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);
	if (docView.contentDOM) docView.updateChildren(view, 0);
	return docView;
}
var TextViewDesc = class TextViewDesc extends NodeViewDesc {
	constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {
		super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);
	}
	parseRule() {
		let skip = this.nodeDOM.parentNode;
		while (skip && skip != this.dom && !skip.pmIsDeco) skip = skip.parentNode;
		return { skip: skip || true };
	}
	update(node, outerDeco, innerDeco, view) {
		if (this.dirty == NODE_DIRTY || this.dirty != NOT_DIRTY && !this.inParent() || !node.sameMarkup(this.node)) return false;
		this.updateOuterDeco(outerDeco);
		if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {
			this.nodeDOM.nodeValue = node.text;
			if (view.trackWrites == this.nodeDOM) view.trackWrites = null;
		}
		this.node = node;
		this.dirty = NOT_DIRTY;
		return true;
	}
	inParent() {
		let parentDOM = this.parent.contentDOM;
		for (let n = this.nodeDOM; n; n = n.parentNode) if (n == parentDOM) return true;
		return false;
	}
	domFromPos(pos) {
		return {
			node: this.nodeDOM,
			offset: pos
		};
	}
	localPosFromDOM(dom, offset, bias) {
		if (dom == this.nodeDOM) return this.posAtStart + Math.min(offset, this.node.text.length);
		return super.localPosFromDOM(dom, offset, bias);
	}
	ignoreMutation(mutation) {
		return mutation.type != "characterData" && mutation.type != "selection";
	}
	slice(from, to, view) {
		let node = this.node.cut(from, to), dom = document.createTextNode(node.text);
		return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);
	}
	markDirty(from, to) {
		super.markDirty(from, to);
		if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length)) this.dirty = NODE_DIRTY;
	}
	get domAtom() {
		return false;
	}
	isText(text) {
		return this.node.text == text;
	}
};
var TrailingHackViewDesc = class extends ViewDesc {
	parseRule() {
		return { ignore: true };
	}
	matchesHack(nodeName) {
		return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName;
	}
	get domAtom() {
		return true;
	}
	get ignoreForCoords() {
		return this.dom.nodeName == "IMG";
	}
};
var CustomNodeViewDesc = class extends NodeViewDesc {
	constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {
		super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);
		this.spec = spec;
	}
	update(node, outerDeco, innerDeco, view) {
		if (this.dirty == NODE_DIRTY) return false;
		if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {
			let result = this.spec.update(node, outerDeco, innerDeco);
			if (result) this.updateInner(node, outerDeco, innerDeco, view);
			return result;
		} else if (!this.contentDOM && !node.isLeaf) return false;
		else return super.update(node, outerDeco, innerDeco, view);
	}
	selectNode() {
		this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
	}
	deselectNode() {
		this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
	}
	setSelection(anchor, head, view, force) {
		this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root) : super.setSelection(anchor, head, view, force);
	}
	destroy() {
		if (this.spec.destroy) this.spec.destroy();
		super.destroy();
	}
	stopEvent(event) {
		return this.spec.stopEvent ? this.spec.stopEvent(event) : false;
	}
	ignoreMutation(mutation) {
		return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
	}
};
function renderDescs(parentDOM, descs, view) {
	let dom = parentDOM.firstChild, written = false;
	for (let i = 0; i < descs.length; i++) {
		let desc = descs[i], childDOM = desc.dom;
		if (childDOM.parentNode == parentDOM) {
			while (childDOM != dom) {
				dom = rm(dom);
				written = true;
			}
			dom = dom.nextSibling;
		} else {
			written = true;
			parentDOM.insertBefore(childDOM, dom);
		}
		if (desc instanceof MarkViewDesc) {
			let pos = dom ? dom.previousSibling : parentDOM.lastChild;
			renderDescs(desc.contentDOM, desc.children, view);
			dom = pos ? pos.nextSibling : parentDOM.firstChild;
		}
	}
	while (dom) {
		dom = rm(dom);
		written = true;
	}
	if (written && view.trackWrites == parentDOM) view.trackWrites = null;
}
var OuterDecoLevel = function(nodeName) {
	if (nodeName) this.nodeName = nodeName;
};
OuterDecoLevel.prototype = Object.create(null);
var noDeco = [new OuterDecoLevel()];
function computeOuterDeco(outerDeco, node, needsWrap) {
	if (outerDeco.length == 0) return noDeco;
	let top = needsWrap ? noDeco[0] : new OuterDecoLevel(), result = [top];
	for (let i = 0; i < outerDeco.length; i++) {
		let attrs = outerDeco[i].type.attrs;
		if (!attrs) continue;
		if (attrs.nodeName) result.push(top = new OuterDecoLevel(attrs.nodeName));
		for (let name in attrs) {
			let val = attrs[name];
			if (val == null) continue;
			if (needsWrap && result.length == 1) result.push(top = new OuterDecoLevel(node.isInline ? "span" : "div"));
			if (name == "class") top.class = (top.class ? top.class + " " : "") + val;
			else if (name == "style") top.style = (top.style ? top.style + ";" : "") + val;
			else if (name != "nodeName") top[name] = val;
		}
	}
	return result;
}
function patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {
	if (prevComputed == noDeco && curComputed == noDeco) return nodeDOM;
	let curDOM = nodeDOM;
	for (let i = 0; i < curComputed.length; i++) {
		let deco = curComputed[i], prev = prevComputed[i];
		if (i) {
			let parent;
			if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM && (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) curDOM = parent;
			else {
				parent = document.createElement(deco.nodeName);
				parent.pmIsDeco = true;
				parent.appendChild(curDOM);
				prev = noDeco[0];
				curDOM = parent;
			}
		}
		patchAttributes(curDOM, prev || noDeco[0], deco);
	}
	return curDOM;
}
function patchAttributes(dom, prev, cur) {
	for (let name in prev) if (name != "class" && name != "style" && name != "nodeName" && !(name in cur)) dom.removeAttribute(name);
	for (let name in cur) if (name != "class" && name != "style" && name != "nodeName" && cur[name] != prev[name]) dom.setAttribute(name, cur[name]);
	if (prev.class != cur.class) {
		let prevList = prev.class ? prev.class.split(" ").filter(Boolean) : [];
		let curList = cur.class ? cur.class.split(" ").filter(Boolean) : [];
		for (let i = 0; i < prevList.length; i++) if (curList.indexOf(prevList[i]) == -1) dom.classList.remove(prevList[i]);
		for (let i = 0; i < curList.length; i++) if (prevList.indexOf(curList[i]) == -1) dom.classList.add(curList[i]);
		if (dom.classList.length == 0) dom.removeAttribute("class");
	}
	if (prev.style != cur.style) {
		if (prev.style) {
			let prop = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m;
			while (m = prop.exec(prev.style)) dom.style.removeProperty(m[1]);
		}
		if (cur.style) dom.style.cssText += cur.style;
	}
}
function applyOuterDeco(dom, deco, node) {
	return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
}
function sameOuterDeco(a, b) {
	if (a.length != b.length) return false;
	for (let i = 0; i < a.length; i++) if (!a[i].type.eq(b[i].type)) return false;
	return true;
}
function rm(dom) {
	let next = dom.nextSibling;
	dom.parentNode.removeChild(dom);
	return next;
}
var ViewTreeUpdater = class {
	constructor(top, lock, view) {
		this.lock = lock;
		this.view = view;
		this.index = 0;
		this.stack = [];
		this.changed = false;
		this.top = top;
		this.preMatch = preMatch(top.node.content, top);
	}
	destroyBetween(start, end) {
		if (start == end) return;
		for (let i = start; i < end; i++) this.top.children[i].destroy();
		this.top.children.splice(start, end - start);
		this.changed = true;
	}
	destroyRest() {
		this.destroyBetween(this.index, this.top.children.length);
	}
	syncToMarks(marks, inline, view, parentIndex) {
		let keep = 0, depth = this.stack.length >> 1;
		let maxKeep = Math.min(depth, marks.length);
		while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false) keep++;
		while (keep < depth) {
			this.destroyRest();
			this.top.dirty = NOT_DIRTY;
			this.index = this.stack.pop();
			this.top = this.stack.pop();
			depth--;
		}
		while (depth < marks.length) {
			this.stack.push(this.top, this.index + 1);
			let found = -1, scanTo = this.top.children.length;
			if (parentIndex < this.preMatch.index) scanTo = Math.min(this.index + 3, scanTo);
			for (let i = this.index; i < scanTo; i++) {
				let next = this.top.children[i];
				if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {
					found = i;
					break;
				}
			}
			if (found > -1) {
				if (found > this.index) {
					this.changed = true;
					this.destroyBetween(this.index, found);
				}
				this.top = this.top.children[this.index];
			} else {
				let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);
				this.top.children.splice(this.index, 0, markDesc);
				this.top = markDesc;
				this.changed = true;
			}
			this.index = 0;
			depth++;
		}
	}
	findNodeMatch(node, outerDeco, innerDeco, index) {
		let found = -1, targetDesc;
		if (index >= this.preMatch.index && (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top && targetDesc.matchesNode(node, outerDeco, innerDeco)) found = this.top.children.indexOf(targetDesc, this.index);
		else for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {
			let child = this.top.children[i];
			if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {
				found = i;
				break;
			}
		}
		if (found < 0) return false;
		this.destroyBetween(this.index, found);
		this.index++;
		return true;
	}
	updateNodeAt(node, outerDeco, innerDeco, index, view) {
		let child = this.top.children[index];
		if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) child.dirty = CONTENT_DIRTY;
		if (!child.update(node, outerDeco, innerDeco, view)) return false;
		this.destroyBetween(this.index, index);
		this.index++;
		return true;
	}
	findIndexWithChild(domNode) {
		for (;;) {
			let parent = domNode.parentNode;
			if (!parent) return -1;
			if (parent == this.top.contentDOM) {
				let desc = domNode.pmViewDesc;
				if (desc) {
					for (let i = this.index; i < this.top.children.length; i++) if (this.top.children[i] == desc) return i;
				}
				return -1;
			}
			domNode = parent;
		}
	}
	updateNextNode(node, outerDeco, innerDeco, view, index, pos) {
		for (let i = this.index; i < this.top.children.length; i++) {
			let next = this.top.children[i];
			if (next instanceof NodeViewDesc) {
				let preMatch = this.preMatch.matched.get(next);
				if (preMatch != null && preMatch != index) return false;
				let nextDOM = next.dom, updated;
				let locked = this.isLocked(nextDOM) && !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text && next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));
				if (!locked && next.update(node, outerDeco, innerDeco, view)) {
					this.destroyBetween(this.index, i);
					if (next.dom != nextDOM) this.changed = true;
					this.index++;
					return true;
				} else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
					this.destroyBetween(this.index, i);
					this.top.children[this.index] = updated;
					if (updated.contentDOM) {
						updated.dirty = CONTENT_DIRTY;
						updated.updateChildren(view, pos + 1);
						updated.dirty = NOT_DIRTY;
					}
					this.changed = true;
					this.index++;
					return true;
				}
				break;
			}
		}
		return false;
	}
	recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {
		if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null;
		let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
		if (wrapper.contentDOM) {
			wrapper.children = next.children;
			next.children = [];
			for (let ch of wrapper.children) ch.parent = wrapper;
		}
		next.destroy();
		return wrapper;
	}
	addNode(node, outerDeco, innerDeco, view, pos) {
		let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
		if (desc.contentDOM) desc.updateChildren(view, pos + 1);
		this.top.children.splice(this.index++, 0, desc);
		this.changed = true;
	}
	placeWidget(widget, view, pos) {
		let next = this.index < this.top.children.length ? this.top.children[this.index] : null;
		if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) this.index++;
		else {
			let desc = new WidgetViewDesc(this.top, widget, view, pos);
			this.top.children.splice(this.index++, 0, desc);
			this.changed = true;
		}
	}
	addTextblockHacks() {
		let lastChild = this.top.children[this.index - 1], parent = this.top;
		while (lastChild instanceof MarkViewDesc) {
			parent = lastChild;
			lastChild = parent.children[parent.children.length - 1];
		}
		if (!lastChild || !(lastChild instanceof TextViewDesc) || /\n$/.test(lastChild.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(lastChild.node.text)) {
			if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == "false") this.addHackNode("IMG", parent);
			this.addHackNode("BR", this.top);
		}
	}
	addHackNode(nodeName, parent) {
		if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) this.index++;
		else {
			let dom = document.createElement(nodeName);
			if (nodeName == "IMG") {
				dom.className = "ProseMirror-separator";
				dom.alt = "";
			}
			if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak";
			let hack = new TrailingHackViewDesc(this.top, [], dom, null);
			if (parent != this.top) parent.children.push(hack);
			else parent.children.splice(this.index++, 0, hack);
			this.changed = true;
		}
	}
	isLocked(node) {
		return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
	}
};
function preMatch(frag, parentDesc) {
	let curDesc = parentDesc, descI = curDesc.children.length;
	let fI = frag.childCount, matched = /* @__PURE__ */ new Map(), matches = [];
	outer: while (fI > 0) {
		let desc;
		for (;;) if (descI) {
			let next = curDesc.children[descI - 1];
			if (next instanceof MarkViewDesc) {
				curDesc = next;
				descI = next.children.length;
			} else {
				desc = next;
				descI--;
				break;
			}
		} else if (curDesc == parentDesc) break outer;
		else {
			descI = curDesc.parent.children.indexOf(curDesc);
			curDesc = curDesc.parent;
		}
		let node = desc.node;
		if (!node) continue;
		if (node != frag.child(fI - 1)) break;
		--fI;
		matched.set(desc, fI);
		matches.push(desc);
	}
	return {
		index: fI,
		matched,
		matches: matches.reverse()
	};
}
function compareSide(a, b) {
	return a.type.side - b.type.side;
}
function iterDeco(parent, deco, onWidget, onNode) {
	let locals = deco.locals(parent), offset = 0;
	if (locals.length == 0) {
		for (let i = 0; i < parent.childCount; i++) {
			let child = parent.child(i);
			onNode(child, locals, deco.forChild(offset, child), i);
			offset += child.nodeSize;
		}
		return;
	}
	let decoIndex = 0, active = [], restNode = null;
	for (let parentIndex = 0;;) {
		let widget, widgets;
		while (decoIndex < locals.length && locals[decoIndex].to == offset) {
			let next = locals[decoIndex++];
			if (next.widget) if (!widget) widget = next;
			else (widgets || (widgets = [widget])).push(next);
		}
		if (widget) if (widgets) {
			widgets.sort(compareSide);
			for (let i = 0; i < widgets.length; i++) onWidget(widgets[i], parentIndex, !!restNode);
		} else onWidget(widget, parentIndex, !!restNode);
		let child, index;
		if (restNode) {
			index = -1;
			child = restNode;
			restNode = null;
		} else if (parentIndex < parent.childCount) {
			index = parentIndex;
			child = parent.child(parentIndex++);
		} else break;
		for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1);
		while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) active.push(locals[decoIndex++]);
		let end = offset + child.nodeSize;
		if (child.isText) {
			let cutAt = end;
			if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from;
			for (let i = 0; i < active.length; i++) if (active[i].to < cutAt) cutAt = active[i].to;
			if (cutAt < end) {
				restNode = child.cut(cutAt - offset);
				child = child.cut(0, cutAt - offset);
				end = cutAt;
				index = -1;
			}
		} else while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++;
		let outerDeco = child.isInline && !child.isLeaf ? active.filter((d) => !d.inline) : active.slice();
		onNode(child, outerDeco, deco.forChild(offset, child), index);
		offset = end;
	}
}
function iosHacks(dom) {
	if (dom.nodeName == "UL" || dom.nodeName == "OL") {
		let oldCSS = dom.style.cssText;
		dom.style.cssText = oldCSS + "; list-style: square !important";
		window.getComputedStyle(dom).listStyle;
		dom.style.cssText = oldCSS;
	}
}
function findTextInFragment(frag, text, from, to) {
	for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {
		let child = frag.child(i++), childStart = pos;
		pos += child.nodeSize;
		if (!child.isText) continue;
		let str = child.text;
		while (i < frag.childCount) {
			let next = frag.child(i++);
			pos += next.nodeSize;
			if (!next.isText) break;
			str += next.text;
		}
		if (pos >= from) {
			if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text) return to - text.length;
			let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
			if (found >= 0 && found + text.length + childStart >= from) return childStart + found;
			if (from == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text) return to;
		}
	}
	return -1;
}
function replaceNodes(nodes, from, to, view, replacement) {
	let result = [];
	for (let i = 0, off = 0; i < nodes.length; i++) {
		let child = nodes[i], start = off, end = off += child.size;
		if (start >= to || end <= from) result.push(child);
		else {
			if (start < from) result.push(child.slice(0, from - start, view));
			if (replacement) {
				result.push(replacement);
				replacement = void 0;
			}
			if (end > to) result.push(child.slice(to - start, child.size, view));
		}
	}
	return result;
}
function selectionFromDOM(view, origin = null) {
	let domSel = view.domSelectionRange(), doc = view.state.doc;
	if (!domSel.focusNode) return null;
	let nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;
	let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);
	if (head < 0) return null;
	let $head = doc.resolve(head), anchor, selection;
	if (selectionCollapsed(domSel)) {
		anchor = head;
		while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;
		let nearestDescNode = nearestDesc.node;
		if (nearestDesc && nearestDescNode.isAtom && NodeSelection$1.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
			let pos = nearestDesc.posBefore;
			selection = new NodeSelection$1(head == pos ? $head : doc.resolve(pos));
		}
	} else {
		if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
			let min = head, max = head;
			for (let i = 0; i < domSel.rangeCount; i++) {
				let range = domSel.getRangeAt(i);
				min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));
				max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));
			}
			if (min < 0) return null;
			[anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];
			$head = doc.resolve(head);
		} else anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
		if (anchor < 0) return null;
	}
	let $anchor = doc.resolve(anchor);
	if (!selection) {
		let bias = origin == "pointer" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1;
		selection = selectionBetween(view, $anchor, $head, bias);
	}
	return selection;
}
function editorOwnsSelection(view) {
	return view.editable ? view.hasFocus() : hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);
}
function selectionToDOM(view, force = false) {
	let sel = view.state.selection;
	syncNodeSelection(view, sel);
	if (!editorOwnsSelection(view)) return;
	if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {
		let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;
		if (domSel.anchorNode && curSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {
			view.input.mouseDown.delayedSelectionSync = true;
			view.domObserver.setCurSelection();
			return;
		}
	}
	view.domObserver.disconnectSelection();
	if (view.cursorWrapper) selectCursorWrapper(view);
	else {
		let { anchor, head } = sel, resetEditableFrom, resetEditableTo;
		if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection$1)) {
			if (!sel.$from.parent.inlineContent) resetEditableFrom = temporarilyEditableNear(view, sel.from);
			if (!sel.empty && !sel.$from.parent.inlineContent) resetEditableTo = temporarilyEditableNear(view, sel.to);
		}
		view.docView.setSelection(anchor, head, view, force);
		if (brokenSelectBetweenUneditable) {
			if (resetEditableFrom) resetEditable(resetEditableFrom);
			if (resetEditableTo) resetEditable(resetEditableTo);
		}
		if (sel.visible) view.dom.classList.remove("ProseMirror-hideselection");
		else {
			view.dom.classList.add("ProseMirror-hideselection");
			if ("onselectionchange" in document) removeClassOnSelectionChange(view);
		}
	}
	view.domObserver.setCurSelection();
	view.domObserver.connectSelection();
}
var brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;
function temporarilyEditableNear(view, pos) {
	let { node, offset } = view.docView.domFromPos(pos, 0);
	let after = offset < node.childNodes.length ? node.childNodes[offset] : null;
	let before = offset ? node.childNodes[offset - 1] : null;
	if (safari && after && after.contentEditable == "false") return setEditable(after);
	if ((!after || after.contentEditable == "false") && (!before || before.contentEditable == "false")) {
		if (after) return setEditable(after);
		else if (before) return setEditable(before);
	}
}
function setEditable(element) {
	element.contentEditable = "true";
	if (safari && element.draggable) {
		element.draggable = false;
		element.wasDraggable = true;
	}
	return element;
}
function resetEditable(element) {
	element.contentEditable = "false";
	if (element.wasDraggable) {
		element.draggable = true;
		element.wasDraggable = null;
	}
}
function removeClassOnSelectionChange(view) {
	let doc = view.dom.ownerDocument;
	doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
	let domSel = view.domSelectionRange();
	let node = domSel.anchorNode, offset = domSel.anchorOffset;
	doc.addEventListener("selectionchange", view.input.hideSelectionGuard = () => {
		if (domSel.anchorNode != node || domSel.anchorOffset != offset) {
			doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
			setTimeout(() => {
				if (!editorOwnsSelection(view) || view.state.selection.visible) view.dom.classList.remove("ProseMirror-hideselection");
			}, 20);
		}
	});
}
function selectCursorWrapper(view) {
	let domSel = view.domSelection();
	if (!domSel) return;
	let node = view.cursorWrapper.dom, img = node.nodeName == "IMG";
	if (img) domSel.collapse(node.parentNode, domIndex(node) + 1);
	else domSel.collapse(node, 0);
	if (!img && !view.state.selection.visible && ie$1 && ie_version <= 11) {
		node.disabled = true;
		node.disabled = false;
	}
}
function syncNodeSelection(view, sel) {
	if (sel instanceof NodeSelection$1) {
		let desc = view.docView.descAt(sel.from);
		if (desc != view.lastSelectedViewDesc) {
			clearNodeSelection(view);
			if (desc) desc.selectNode();
			view.lastSelectedViewDesc = desc;
		}
	} else clearNodeSelection(view);
}
function clearNodeSelection(view) {
	if (view.lastSelectedViewDesc) {
		if (view.lastSelectedViewDesc.parent) view.lastSelectedViewDesc.deselectNode();
		view.lastSelectedViewDesc = void 0;
	}
}
function selectionBetween(view, $anchor, $head, bias) {
	return view.someProp("createSelectionBetween", (f) => f(view, $anchor, $head)) || TextSelection$1.between($anchor, $head, bias);
}
function hasFocusAndSelection(view) {
	if (view.editable && !view.hasFocus()) return false;
	return hasSelection(view);
}
function hasSelection(view) {
	let sel = view.domSelectionRange();
	if (!sel.anchorNode) return false;
	try {
		return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));
	} catch (_) {
		return false;
	}
}
function anchorInRightPlace(view) {
	let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);
	let domSel = view.domSelectionRange();
	return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);
}
function moveSelectionBlock(state, dir) {
	let { $anchor, $head } = state.selection;
	let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);
	let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;
	return $start && Selection$2.findFrom($start, dir);
}
function apply(view, sel) {
	view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());
	return true;
}
function selectHorizontally(view, dir, mods) {
	let sel = view.state.selection;
	if (sel instanceof TextSelection$1) {
		if (mods.indexOf("s") > -1) {
			let { $head } = sel, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;
			if (!node || node.isText || !node.isLeaf) return false;
			let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));
			return apply(view, new TextSelection$1(sel.$anchor, $newHead));
		} else if (!sel.empty) return false;
		else if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) {
			let next = moveSelectionBlock(view.state, dir);
			if (next && next instanceof NodeSelection$1) return apply(view, next);
			return false;
		} else if (!(mac$2 && mods.indexOf("m") > -1)) {
			let $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;
			if (!node || node.isText) return false;
			let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
			if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;
			if (NodeSelection$1.isSelectable(node)) return apply(view, new NodeSelection$1(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
			else if (webkit) return apply(view, new TextSelection$1(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
			else return false;
		}
	} else if (sel instanceof NodeSelection$1 && sel.node.isInline) return apply(view, new TextSelection$1(dir > 0 ? sel.$to : sel.$from));
	else {
		let next = moveSelectionBlock(view.state, dir);
		if (next) return apply(view, next);
		return false;
	}
}
function nodeLen(node) {
	return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
}
function isIgnorable(dom, dir) {
	let desc = dom.pmViewDesc;
	return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
}
function skipIgnoredNodes(view, dir) {
	return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
}
function skipIgnoredNodesBefore(view) {
	let sel = view.domSelectionRange();
	let node = sel.focusNode, offset = sel.focusOffset;
	if (!node) return;
	let moveNode, moveOffset, force = false;
	if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
	for (;;) if (offset > 0) if (node.nodeType != 1) break;
	else {
		let before = node.childNodes[offset - 1];
		if (isIgnorable(before, -1)) {
			moveNode = node;
			moveOffset = --offset;
		} else if (before.nodeType == 3) {
			node = before;
			offset = node.nodeValue.length;
		} else break;
	}
	else if (isBlockNode(node)) break;
	else {
		let prev = node.previousSibling;
		while (prev && isIgnorable(prev, -1)) {
			moveNode = node.parentNode;
			moveOffset = domIndex(prev);
			prev = prev.previousSibling;
		}
		if (!prev) {
			node = node.parentNode;
			if (node == view.dom) break;
			offset = 0;
		} else {
			node = prev;
			offset = nodeLen(node);
		}
	}
	if (force) setSelFocus(view, node, offset);
	else if (moveNode) setSelFocus(view, moveNode, moveOffset);
}
function skipIgnoredNodesAfter(view) {
	let sel = view.domSelectionRange();
	let node = sel.focusNode, offset = sel.focusOffset;
	if (!node) return;
	let len = nodeLen(node);
	let moveNode, moveOffset;
	for (;;) if (offset < len) {
		if (node.nodeType != 1) break;
		let after = node.childNodes[offset];
		if (isIgnorable(after, 1)) {
			moveNode = node;
			moveOffset = ++offset;
		} else break;
	} else if (isBlockNode(node)) break;
	else {
		let next = node.nextSibling;
		while (next && isIgnorable(next, 1)) {
			moveNode = next.parentNode;
			moveOffset = domIndex(next) + 1;
			next = next.nextSibling;
		}
		if (!next) {
			node = node.parentNode;
			if (node == view.dom) break;
			offset = len = 0;
		} else {
			node = next;
			offset = 0;
			len = nodeLen(node);
		}
	}
	if (moveNode) setSelFocus(view, moveNode, moveOffset);
}
function isBlockNode(dom) {
	let desc = dom.pmViewDesc;
	return desc && desc.node && desc.node.isBlock;
}
function textNodeAfter(node, offset) {
	while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {
		offset = domIndex(node) + 1;
		node = node.parentNode;
	}
	while (node && offset < node.childNodes.length) {
		let next = node.childNodes[offset];
		if (next.nodeType == 3) return next;
		if (next.nodeType == 1 && next.contentEditable == "false") break;
		node = next;
		offset = 0;
	}
}
function textNodeBefore(node, offset) {
	while (node && !offset && !hasBlockDesc(node)) {
		offset = domIndex(node);
		node = node.parentNode;
	}
	while (node && offset) {
		let next = node.childNodes[offset - 1];
		if (next.nodeType == 3) return next;
		if (next.nodeType == 1 && next.contentEditable == "false") break;
		node = next;
		offset = node.childNodes.length;
	}
}
function setSelFocus(view, node, offset) {
	if (node.nodeType != 3) {
		let before, after;
		if (after = textNodeAfter(node, offset)) {
			node = after;
			offset = 0;
		} else if (before = textNodeBefore(node, offset)) {
			node = before;
			offset = before.nodeValue.length;
		}
	}
	let sel = view.domSelection();
	if (!sel) return;
	if (selectionCollapsed(sel)) {
		let range = document.createRange();
		range.setEnd(node, offset);
		range.setStart(node, offset);
		sel.removeAllRanges();
		sel.addRange(range);
	} else if (sel.extend) sel.extend(node, offset);
	view.domObserver.setCurSelection();
	let { state } = view;
	setTimeout(() => {
		if (view.state == state) selectionToDOM(view);
	}, 50);
}
function findDirection(view, pos) {
	let $pos = view.state.doc.resolve(pos);
	if (!(chrome || windows$1) && $pos.parent.inlineContent) {
		let coords = view.coordsAtPos(pos);
		if (pos > $pos.start()) {
			let before = view.coordsAtPos(pos - 1);
			let mid = (before.top + before.bottom) / 2;
			if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) return before.left < coords.left ? "ltr" : "rtl";
		}
		if (pos < $pos.end()) {
			let after = view.coordsAtPos(pos + 1);
			let mid = (after.top + after.bottom) / 2;
			if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? "ltr" : "rtl";
		}
	}
	return getComputedStyle(view.dom).direction == "rtl" ? "rtl" : "ltr";
}
function selectVertically(view, dir, mods) {
	let sel = view.state.selection;
	if (sel instanceof TextSelection$1 && !sel.empty || mods.indexOf("s") > -1) return false;
	if (mac$2 && mods.indexOf("m") > -1) return false;
	let { $from, $to } = sel;
	if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) {
		let next = moveSelectionBlock(view.state, dir);
		if (next && next instanceof NodeSelection$1) return apply(view, next);
	}
	if (!$from.parent.inlineContent) {
		let side = dir < 0 ? $from : $to;
		let beyond = sel instanceof AllSelection$1 ? Selection$2.near(side, dir) : Selection$2.findFrom(side, dir);
		return beyond ? apply(view, beyond) : false;
	}
	return false;
}
function stopNativeHorizontalDelete(view, dir) {
	if (!(view.state.selection instanceof TextSelection$1)) return true;
	let { $head, $anchor, empty } = view.state.selection;
	if (!$head.sameParent($anchor)) return true;
	if (!empty) return false;
	if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) return true;
	let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);
	if (nextNode && !nextNode.isText) {
		let tr = view.state.tr;
		if (dir < 0) tr.delete($head.pos - nextNode.nodeSize, $head.pos);
		else tr.delete($head.pos, $head.pos + nextNode.nodeSize);
		view.dispatch(tr);
		return true;
	}
	return false;
}
function switchEditable(view, node, state) {
	view.domObserver.stop();
	node.contentEditable = state;
	view.domObserver.start();
}
function safariDownArrowBug(view) {
	if (!safari || view.state.selection.$head.parentOffset > 0) return false;
	let { focusNode, focusOffset } = view.domSelectionRange();
	if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
		let child = focusNode.firstChild;
		switchEditable(view, child, "true");
		setTimeout(() => switchEditable(view, child, "false"), 20);
	}
	return false;
}
function getMods(event) {
	let result = "";
	if (event.ctrlKey) result += "c";
	if (event.metaKey) result += "m";
	if (event.altKey) result += "a";
	if (event.shiftKey) result += "s";
	return result;
}
function captureKeyDown(view, event) {
	let code = event.keyCode, mods = getMods(event);
	if (code == 8 || mac$2 && code == 72 && mods == "c") return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);
	else if (code == 46 && !event.shiftKey || mac$2 && code == 68 && mods == "c") return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);
	else if (code == 13 || code == 27) return true;
	else if (code == 37 || mac$2 && code == 66 && mods == "c") {
		let dir = code == 37 ? findDirection(view, view.state.selection.from) == "ltr" ? -1 : 1 : -1;
		return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
	} else if (code == 39 || mac$2 && code == 70 && mods == "c") {
		let dir = code == 39 ? findDirection(view, view.state.selection.from) == "ltr" ? 1 : -1 : 1;
		return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
	} else if (code == 38 || mac$2 && code == 80 && mods == "c") return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);
	else if (code == 40 || mac$2 && code == 78 && mods == "c") return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);
	else if (mods == (mac$2 ? "m" : "c") && (code == 66 || code == 73 || code == 89 || code == 90)) return true;
	return false;
}
function serializeForClipboard(view, slice) {
	view.someProp("transformCopied", (f) => {
		slice = f(slice, view);
	});
	let context = [], { content, openStart, openEnd } = slice;
	while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
		openStart--;
		openEnd--;
		let node = content.firstChild;
		context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);
		content = node.content;
	}
	let serializer = view.someProp("clipboardSerializer") || DOMSerializer.fromSchema(view.state.schema);
	let doc = detachedDoc(), wrap = doc.createElement("div");
	wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
	let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
	while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
		for (let i = needsWrap.length - 1; i >= 0; i--) {
			let wrapper = doc.createElement(needsWrap[i]);
			while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
			wrap.appendChild(wrapper);
			wrappers++;
		}
		firstChild = wrap.firstChild;
	}
	if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
	return {
		dom: wrap,
		text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
		slice
	};
}
function parseFromClipboard(view, text, html, plainText, $context) {
	let inCode = $context.parent.type.spec.code;
	let dom, slice;
	if (!html && !text) return null;
	let asText = !!text && (plainText || inCode || !html);
	if (asText) {
		view.someProp("transformPastedText", (f) => {
			text = f(text, inCode || plainText, view);
		});
		if (inCode) {
			slice = new Slice$1(Fragment$1.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0);
			view.someProp("transformPasted", (f) => {
				slice = f(slice, view, true);
			});
			return slice;
		}
		let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
		if (parsed) slice = parsed;
		else {
			let marks = $context.marks();
			let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);
			dom = document.createElement("div");
			text.split(/(?:\r\n?|\n)+/).forEach((block) => {
				let p = dom.appendChild(document.createElement("p"));
				if (block) p.appendChild(serializer.serializeNode(schema.text(block, marks)));
			});
		}
	} else {
		view.someProp("transformPastedHTML", (f) => {
			html = f(html, view);
		});
		dom = readHTML(html);
		if (webkit) restoreReplacedSpaces(dom);
	}
	let contextNode = dom && dom.querySelector("[data-pm-slice]");
	let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
	if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {
		let child = dom.firstChild;
		while (child && child.nodeType != 1) child = child.nextSibling;
		if (!child) break;
		dom = child;
	}
	if (!slice) slice = (view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema)).parseSlice(dom, {
		preserveWhitespace: !!(asText || sliceData),
		context: $context,
		ruleFromNode(dom) {
			if (dom.nodeName == "BR" && !dom.nextSibling && dom.parentNode && !inlineParents.test(dom.parentNode.nodeName)) return { ignore: true };
			return null;
		}
	});
	if (sliceData) slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);
	else {
		slice = Slice$1.maxOpen(normalizeSiblings(slice.content, $context), true);
		if (slice.openStart || slice.openEnd) {
			let openStart = 0, openEnd = 0;
			for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild);
			for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild);
			slice = closeSlice(slice, openStart, openEnd);
		}
	}
	view.someProp("transformPasted", (f) => {
		slice = f(slice, view, asText);
	});
	return slice;
}
var inlineParents = /^(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 normalizeSiblings(fragment, $context) {
	if (fragment.childCount < 2) return fragment;
	for (let d = $context.depth; d >= 0; d--) {
		let match = $context.node(d).contentMatchAt($context.index(d));
		let lastWrap, result = [];
		fragment.forEach((node) => {
			if (!result) return;
			let wrap = match.findWrapping(node.type), inLast;
			if (!wrap) return result = null;
			if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) result[result.length - 1] = inLast;
			else {
				if (result.length) result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);
				let wrapped = withWrappers(node, wrap);
				result.push(wrapped);
				match = match.matchType(wrapped.type);
				lastWrap = wrap;
			}
		});
		if (result) return Fragment$1.from(result);
	}
	return fragment;
}
function withWrappers(node, wrap, from = 0) {
	for (let i = wrap.length - 1; i >= from; i--) node = wrap[i].create(null, Fragment$1.from(node));
	return node;
}
function addToSibling(wrap, lastWrap, node, sibling, depth) {
	if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {
		let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);
		if (inner) return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
		if (sibling.contentMatchAt(sibling.childCount).matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1])) return sibling.copy(sibling.content.append(Fragment$1.from(withWrappers(node, wrap, depth + 1))));
	}
}
function closeRight(node, depth) {
	if (depth == 0) return node;
	let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));
	let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment$1.empty, true);
	return node.copy(fragment.append(fill));
}
function closeRange(fragment, side, from, to, depth, openEnd) {
	let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;
	if (fragment.childCount > 1) openEnd = 0;
	if (depth < to - 1) inner = closeRange(inner, side, from, to, depth + 1, openEnd);
	if (depth >= from) inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment$1.empty, true));
	return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
}
function closeSlice(slice, openStart, openEnd) {
	if (openStart < slice.openStart) slice = new Slice$1(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);
	if (openEnd < slice.openEnd) slice = new Slice$1(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);
	return slice;
}
var wrapMap = {
	thead: ["table"],
	tbody: ["table"],
	tfoot: ["table"],
	caption: ["table"],
	colgroup: ["table"],
	col: ["table", "colgroup"],
	tr: ["table", "tbody"],
	td: [
		"table",
		"tbody",
		"tr"
	],
	th: [
		"table",
		"tbody",
		"tr"
	]
};
var _detachedDoc = null;
function detachedDoc() {
	return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
}
var _policy = null;
function maybeWrapTrusted(html) {
	let trustedTypes = window.trustedTypes;
	if (!trustedTypes) return html;
	if (!_policy) _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
	return _policy.createHTML(html);
}
function readHTML(html) {
	let metas = /^(\s*<meta [^>]*>)*/.exec(html);
	if (metas) html = html.slice(metas[0].length);
	let elt = detachedDoc().createElement("div");
	let firstTag = /<([a-z][^>\s]+)/i.exec(html), wrap;
	if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) html = wrap.map((n) => "<" + n + ">").join("") + html + wrap.map((n) => "</" + n + ">").reverse().join("");
	elt.innerHTML = maybeWrapTrusted(html);
	if (wrap) for (let i = 0; i < wrap.length; i++) elt = elt.querySelector(wrap[i]) || elt;
	return elt;
}
function restoreReplacedSpaces(dom) {
	let nodes = dom.querySelectorAll(chrome ? "span:not([class]):not([style])" : "span.Apple-converted-space");
	for (let i = 0; i < nodes.length; i++) {
		let node = nodes[i];
		if (node.childNodes.length == 1 && node.textContent == "\xA0" && node.parentNode) node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node);
	}
}
function addContext(slice, context) {
	if (!slice.size) return slice;
	let schema = slice.content.firstChild.type.schema, array;
	try {
		array = JSON.parse(context);
	} catch (e) {
		return slice;
	}
	let { content, openStart, openEnd } = slice;
	for (let i = array.length - 2; i >= 0; i -= 2) {
		let type = schema.nodes[array[i]];
		if (!type || type.hasRequiredAttrs()) break;
		content = Fragment$1.from(type.create(array[i + 1], content));
		openStart++;
		openEnd++;
	}
	return new Slice$1(content, openStart, openEnd);
}
var handlers = {};
var editHandlers = {};
var passiveHandlers = {
	touchstart: true,
	touchmove: true
};
var InputState = class {
	constructor() {
		this.shiftKey = false;
		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 = false;
		this.compositionNode = null;
		this.composingTimeout = -1;
		this.compositionNodes = [];
		this.compositionEndedAt = -2e8;
		this.compositionID = 1;
		this.badSafariComposition = false;
		this.compositionPendingChanges = 0;
		this.domChangeCount = 0;
		this.eventHandlers = Object.create(null);
		this.hideSelectionGuard = null;
	}
};
function initInput(view) {
	for (let event in handlers) {
		let handler = handlers[event];
		view.dom.addEventListener(event, view.input.eventHandlers[event] = (event) => {
			if (eventBelongsToView(view, event) && !runCustomHandler(view, event) && (view.editable || !(event.type in editHandlers))) handler(view, event);
		}, passiveHandlers[event] ? { passive: true } : void 0);
	}
	if (safari) view.dom.addEventListener("input", () => null);
	ensureListeners(view);
}
function setSelectionOrigin(view, origin) {
	view.input.lastSelectionOrigin = origin;
	view.input.lastSelectionTime = Date.now();
}
function destroyInput(view) {
	view.domObserver.stop();
	for (let type in view.input.eventHandlers) view.dom.removeEventListener(type, view.input.eventHandlers[type]);
	clearTimeout(view.input.composingTimeout);
	clearTimeout(view.input.lastIOSEnterFallbackTimeout);
}
function ensureListeners(view) {
	view.someProp("handleDOMEvents", (currentHandlers) => {
		for (let type in currentHandlers) if (!view.input.eventHandlers[type]) view.dom.addEventListener(type, view.input.eventHandlers[type] = (event) => runCustomHandler(view, event));
	});
}
function runCustomHandler(view, event) {
	return view.someProp("handleDOMEvents", (handlers) => {
		let handler = handlers[event.type];
		return handler ? handler(view, event) || event.defaultPrevented : false;
	});
}
function eventBelongsToView(view, event) {
	if (!event.bubbles) return true;
	if (event.defaultPrevented) return false;
	for (let node = event.target; node != view.dom; node = node.parentNode) if (!node || node.nodeType == 11 || node.pmViewDesc && node.pmViewDesc.stopEvent(event)) return false;
	return true;
}
function dispatchEvent(view, event) {
	if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) handlers[event.type](view, event);
}
editHandlers.keydown = (view, _event) => {
	let event = _event;
	view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
	if (inOrNearComposition(view, event)) return;
	view.input.lastKeyCode = event.keyCode;
	view.input.lastKeyCodeTime = Date.now();
	if (android && chrome && event.keyCode == 13) return;
	if (event.keyCode != 229) view.domObserver.forceFlush();
	if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {
		let now = Date.now();
		view.input.lastIOSEnter = now;
		view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
			if (view.input.lastIOSEnter == now) {
				view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")));
				view.input.lastIOSEnter = 0;
			}
		}, 200);
	} else if (view.someProp("handleKeyDown", (f) => f(view, event)) || captureKeyDown(view, event)) event.preventDefault();
	else setSelectionOrigin(view, "key");
};
editHandlers.keyup = (view, event) => {
	if (event.keyCode == 16) view.input.shiftKey = false;
};
editHandlers.keypress = (view, _event) => {
	let event = _event;
	if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac$2 && event.metaKey) return;
	if (view.someProp("handleKeyPress", (f) => f(view, event))) {
		event.preventDefault();
		return;
	}
	let sel = view.state.selection;
	if (!(sel instanceof TextSelection$1) || !sel.$from.sameParent(sel.$to)) {
		let text = String.fromCharCode(event.charCode);
		let deflt = () => view.state.tr.insertText(text).scrollIntoView();
		if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text, deflt))) view.dispatch(deflt());
		event.preventDefault();
	}
};
function eventCoords(event) {
	return {
		left: event.clientX,
		top: event.clientY
	};
}
function isNear(event, click) {
	let dx = click.x - event.clientX, dy = click.y - event.clientY;
	return dx * dx + dy * dy < 100;
}
function runHandlerOnContext(view, propName, pos, inside, event) {
	if (inside == -1) return false;
	let $pos = view.state.doc.resolve(inside);
	for (let i = $pos.depth + 1; i > 0; i--) if (view.someProp(propName, (f) => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true) : f(view, pos, $pos.node(i), $pos.before(i), event, false))) return true;
	return false;
}
function updateSelection(view, selection, origin) {
	if (!view.focused) view.focus();
	if (view.state.selection.eq(selection)) return;
	let tr = view.state.tr.setSelection(selection);
	if (origin == "pointer") tr.setMeta("pointer", true);
	view.dispatch(tr);
}
function selectClickedLeaf(view, inside) {
	if (inside == -1) return false;
	let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
	if (node && node.isAtom && NodeSelection$1.isSelectable(node)) {
		updateSelection(view, new NodeSelection$1($pos), "pointer");
		return true;
	}
	return false;
}
function selectClickedNode(view, inside) {
	if (inside == -1) return false;
	let sel = view.state.selection, selectedNode, selectAt;
	if (sel instanceof NodeSelection$1) selectedNode = sel.node;
	let $pos = view.state.doc.resolve(inside);
	for (let i = $pos.depth + 1; i > 0; i--) {
		let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
		if (NodeSelection$1.isSelectable(node)) {
			if (selectedNode && sel.$from.depth > 0 && i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos) selectAt = $pos.before(sel.$from.depth);
			else selectAt = $pos.before(i);
			break;
		}
	}
	if (selectAt != null) {
		updateSelection(view, NodeSelection$1.create(view.state.doc, selectAt), "pointer");
		return true;
	} else return false;
}
function handleSingleClick(view, pos, inside, event, selectNode) {
	return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || view.someProp("handleClick", (f) => f(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));
}
function handleDoubleClick(view, pos, inside, event) {
	return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) || view.someProp("handleDoubleClick", (f) => f(view, pos, event));
}
function handleTripleClick(view, pos, inside, event) {
	return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) || view.someProp("handleTripleClick", (f) => f(view, pos, event)) || defaultTripleClick(view, inside, event);
}
function defaultTripleClick(view, inside, event) {
	if (event.button != 0) return false;
	let doc = view.state.doc;
	if (inside == -1) {
		if (doc.inlineContent) {
			updateSelection(view, TextSelection$1.create(doc, 0, doc.content.size), "pointer");
			return true;
		}
		return false;
	}
	let $pos = doc.resolve(inside);
	for (let i = $pos.depth + 1; i > 0; i--) {
		let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
		let nodePos = $pos.before(i);
		if (node.inlineContent) updateSelection(view, TextSelection$1.create(doc, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
		else if (NodeSelection$1.isSelectable(node)) updateSelection(view, NodeSelection$1.create(doc, nodePos), "pointer");
		else continue;
		return true;
	}
}
function forceDOMFlush(view) {
	return endComposition(view);
}
var selectNodeModifier = mac$2 ? "metaKey" : "ctrlKey";
handlers.mousedown = (view, _event) => {
	let event = _event;
	view.input.shiftKey = event.shiftKey;
	let flushed = forceDOMFlush(view);
	let now = Date.now(), type = "singleClick";
	if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier] && view.input.lastClick.button == event.button) {
		if (view.input.lastClick.type == "singleClick") type = "doubleClick";
		else if (view.input.lastClick.type == "doubleClick") type = "tripleClick";
	}
	view.input.lastClick = {
		time: now,
		x: event.clientX,
		y: event.clientY,
		type,
		button: event.button
	};
	let pos = view.posAtCoords(eventCoords(event));
	if (!pos) return;
	if (type == "singleClick") {
		if (view.input.mouseDown) view.input.mouseDown.done();
		view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
	} else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) event.preventDefault();
	else setSelectionOrigin(view, "pointer");
};
var MouseDown = class {
	constructor(view, pos, event, flushed) {
		this.view = view;
		this.pos = pos;
		this.event = event;
		this.flushed = flushed;
		this.delayedSelectionSync = false;
		this.mightDrag = null;
		this.startDoc = view.state.doc;
		this.selectNode = !!event[selectNodeModifier];
		this.allowDefault = event.shiftKey;
		let targetNode, targetPos;
		if (pos.inside > -1) {
			targetNode = view.state.doc.nodeAt(pos.inside);
			targetPos = pos.inside;
		} else {
			let $pos = view.state.doc.resolve(pos.pos);
			targetNode = $pos.parent;
			targetPos = $pos.depth ? $pos.before() : 0;
		}
		const target = flushed ? null : event.target;
		const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
		this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
		let { selection } = view.state;
		if (event.button == 0 && (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection$1 && selection.from <= targetPos && selection.to > targetPos)) this.mightDrag = {
			node: targetNode,
			pos: targetPos,
			addAttr: !!(this.target && !this.target.draggable),
			setUneditable: !!(this.target && gecko && !this.target.hasAttribute("contentEditable"))
		};
		if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {
			this.view.domObserver.stop();
			if (this.mightDrag.addAttr) this.target.draggable = true;
			if (this.mightDrag.setUneditable) setTimeout(() => {
				if (this.view.input.mouseDown == this) this.target.setAttribute("contentEditable", "false");
			}, 20);
			this.view.domObserver.start();
		}
		view.root.addEventListener("mouseup", this.up = this.up.bind(this));
		view.root.addEventListener("mousemove", this.move = this.move.bind(this));
		setSelectionOrigin(view, "pointer");
	}
	done() {
		this.view.root.removeEventListener("mouseup", this.up);
		this.view.root.removeEventListener("mousemove", this.move);
		if (this.mightDrag && this.target) {
			this.view.domObserver.stop();
			if (this.mightDrag.addAttr) this.target.removeAttribute("draggable");
			if (this.mightDrag.setUneditable) this.target.removeAttribute("contentEditable");
			this.view.domObserver.start();
		}
		if (this.delayedSelectionSync) setTimeout(() => selectionToDOM(this.view));
		this.view.input.mouseDown = null;
	}
	up(event) {
		this.done();
		if (!this.view.dom.contains(event.target)) return;
		let pos = this.pos;
		if (this.view.state.doc != this.startDoc) pos = this.view.posAtCoords(eventCoords(event));
		this.updateAllowDefault(event);
		if (this.allowDefault || !pos) setSelectionOrigin(this.view, "pointer");
		else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) event.preventDefault();
		else if (event.button == 0 && (this.flushed || safari && this.mightDrag && !this.mightDrag.node.isAtom || chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
			updateSelection(this.view, Selection$2.near(this.view.state.doc.resolve(pos.pos)), "pointer");
			event.preventDefault();
		} else setSelectionOrigin(this.view, "pointer");
	}
	move(event) {
		this.updateAllowDefault(event);
		setSelectionOrigin(this.view, "pointer");
		if (event.buttons == 0) this.done();
	}
	updateAllowDefault(event) {
		if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 || Math.abs(this.event.y - event.clientY) > 4)) this.allowDefault = true;
	}
};
handlers.touchstart = (view) => {
	view.input.lastTouch = Date.now();
	forceDOMFlush(view);
	setSelectionOrigin(view, "pointer");
};
handlers.touchmove = (view) => {
	view.input.lastTouch = Date.now();
	setSelectionOrigin(view, "pointer");
};
handlers.contextmenu = (view) => forceDOMFlush(view);
function inOrNearComposition(view, event) {
	if (view.composing) return true;
	if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {
		view.input.compositionEndedAt = -2e8;
		return true;
	}
	return false;
}
var timeoutComposition = android ? 5e3 : -1;
editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
	if (!view.composing) {
		view.domObserver.flush();
		let { state } = view, $pos = state.selection.$to;
		if (state.selection instanceof TextSelection$1 && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
			view.markCursor = view.state.storedMarks || $pos.marks();
			endComposition(view, true);
			view.markCursor = null;
		} else {
			endComposition(view, !state.selection.empty);
			if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
				let sel = view.domSelectionRange();
				for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
					let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
					if (!before) break;
					if (before.nodeType == 3) {
						let sel = view.domSelection();
						if (sel) sel.collapse(before, before.nodeValue.length);
						break;
					} else {
						node = before;
						offset = -1;
					}
				}
			}
		}
		view.input.composing = true;
	}
	scheduleComposeEnd(view, timeoutComposition);
};
function selectionBeforeUneditable(view) {
	let { focusNode, focusOffset } = view.domSelectionRange();
	if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length) return false;
	let next = focusNode.childNodes[focusOffset];
	return next.nodeType == 1 && next.contentEditable == "false";
}
editHandlers.compositionend = (view, event) => {
	if (view.composing) {
		view.input.composing = false;
		view.input.compositionEndedAt = event.timeStamp;
		view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
		view.input.compositionNode = null;
		if (view.input.badSafariComposition) view.domObserver.forceFlush();
		else if (view.input.compositionPendingChanges) Promise.resolve().then(() => view.domObserver.flush());
		view.input.compositionID++;
		scheduleComposeEnd(view, 20);
	}
};
function scheduleComposeEnd(view, delay) {
	clearTimeout(view.input.composingTimeout);
	if (delay > -1) view.input.composingTimeout = setTimeout(() => endComposition(view), delay);
}
function clearComposition(view) {
	if (view.composing) {
		view.input.composing = false;
		view.input.compositionEndedAt = timestampFromCustomEvent();
	}
	while (view.input.compositionNodes.length > 0) view.input.compositionNodes.pop().markParentsDirty();
}
function findCompositionNode(view) {
	let sel = view.domSelectionRange();
	if (!sel.focusNode) return null;
	let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
	let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
	if (textBefore && textAfter && textBefore != textAfter) {
		let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
		if (textBefore == lastChanged || textAfter == lastChanged) return lastChanged;
		if (!descAfter || !descAfter.isText(textAfter.nodeValue)) return textAfter;
		else if (view.input.compositionNode == textAfter) {
			let descBefore = textBefore.pmViewDesc;
			if (!(!descBefore || !descBefore.isText(textBefore.nodeValue))) return textAfter;
		}
	}
	return textBefore || textAfter;
}
function timestampFromCustomEvent() {
	let event = document.createEvent("Event");
	event.initEvent("event", true, true);
	return event.timeStamp;
}
/**
@internal
*/
function endComposition(view, restarting = false) {
	if (android && view.domObserver.flushingSoon >= 0) return;
	view.domObserver.forceFlush();
	clearComposition(view);
	if (restarting || view.docView && view.docView.dirty) {
		let sel = selectionFromDOM(view), cur = view.state.selection;
		if (sel && !sel.eq(cur)) view.dispatch(view.state.tr.setSelection(sel));
		else if ((view.markCursor || restarting) && !cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent) view.dispatch(view.state.tr.deleteSelection());
		else view.updateState(view.state);
		return true;
	}
	return false;
}
function captureCopy(view, dom) {
	if (!view.dom.parentNode) return;
	let wrap = view.dom.parentNode.appendChild(document.createElement("div"));
	wrap.appendChild(dom);
	wrap.style.cssText = "position: fixed; left: -10000px; top: 10px";
	let sel = getSelection(), range = document.createRange();
	range.selectNodeContents(dom);
	view.dom.blur();
	sel.removeAllRanges();
	sel.addRange(range);
	setTimeout(() => {
		if (wrap.parentNode) wrap.parentNode.removeChild(wrap);
		view.focus();
	}, 50);
}
var brokenClipboardAPI = ie$1 && ie_version < 15 || ios && webkit_version < 604;
handlers.copy = editHandlers.cut = (view, _event) => {
	let event = _event;
	let sel = view.state.selection, cut = event.type == "cut";
	if (sel.empty) return;
	let data = brokenClipboardAPI ? null : event.clipboardData;
	let { dom, text } = serializeForClipboard(view, sel.content());
	if (data) {
		event.preventDefault();
		data.clearData();
		data.setData("text/html", dom.innerHTML);
		data.setData("text/plain", text);
	} else captureCopy(view, dom);
	if (cut) view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
};
function sliceSingleNode(slice) {
	return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;
}
function capturePaste(view, event) {
	if (!view.dom.parentNode) return;
	let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;
	let target = view.dom.parentNode.appendChild(document.createElement(plainText ? "textarea" : "div"));
	if (!plainText) target.contentEditable = "true";
	target.style.cssText = "position: fixed; left: -10000px; top: 10px";
	target.focus();
	let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
	setTimeout(() => {
		view.focus();
		if (target.parentNode) target.parentNode.removeChild(target);
		if (plainText) doPaste(view, target.value, null, plain, event);
		else doPaste(view, target.textContent, target.innerHTML, plain, event);
	}, 50);
}
function doPaste(view, text, html, preferPlain, event) {
	let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
	if (view.someProp("handlePaste", (f) => f(view, event, slice || Slice$1.empty))) return true;
	if (!slice) return false;
	let singleNode = sliceSingleNode(slice);
	let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice);
	view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
	return true;
}
function getText$1(clipboardData) {
	let text = clipboardData.getData("text/plain") || clipboardData.getData("Text");
	if (text) return text;
	let uris = clipboardData.getData("text/uri-list");
	return uris ? uris.replace(/\r?\n/g, " ") : "";
}
editHandlers.paste = (view, _event) => {
	let event = _event;
	if (view.composing && !android) return;
	let data = brokenClipboardAPI ? null : event.clipboardData;
	let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
	if (data && doPaste(view, getText$1(data), data.getData("text/html"), plain, event)) event.preventDefault();
	else capturePaste(view, event);
};
var Dragging = class {
	constructor(slice, move, node) {
		this.slice = slice;
		this.move = move;
		this.node = node;
	}
};
var dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
function dragMoves(view, event) {
	let copy;
	view.someProp("dragCopies", (test) => {
		copy = copy || test(event);
	});
	return copy != null ? !copy : !event[dragCopyModifier];
}
handlers.dragstart = (view, _event) => {
	let event = _event;
	let mouseDown = view.input.mouseDown;
	if (mouseDown) mouseDown.done();
	if (!event.dataTransfer) return;
	let sel = view.state.selection;
	let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));
	let node;
	if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection$1 ? sel.to - 1 : sel.to));
	else if (mouseDown && mouseDown.mightDrag) node = NodeSelection$1.create(view.state.doc, mouseDown.mightDrag.pos);
	else if (event.target && event.target.nodeType == 1) {
		let desc = view.docView.nearestDesc(event.target, true);
		if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection$1.create(view.state.doc, desc.posBefore);
	}
	let { dom, text, slice } = serializeForClipboard(view, (node || view.state.selection).content());
	if (!event.dataTransfer.files.length || !chrome || chrome_version > 120) event.dataTransfer.clearData();
	event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
	event.dataTransfer.effectAllowed = "copyMove";
	if (!brokenClipboardAPI) event.dataTransfer.setData("text/plain", text);
	view.dragging = new Dragging(slice, dragMoves(view, event), node);
};
handlers.dragend = (view) => {
	let dragging = view.dragging;
	window.setTimeout(() => {
		if (view.dragging == dragging) view.dragging = null;
	}, 50);
};
editHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();
editHandlers.drop = (view, event) => {
	try {
		handleDrop(view, event, view.dragging);
	} finally {
		view.dragging = null;
	}
};
function handleDrop(view, event, dragging) {
	if (!event.dataTransfer) return;
	let eventPos = view.posAtCoords(eventCoords(event));
	if (!eventPos) return;
	let $mouse = view.state.doc.resolve(eventPos.pos);
	let slice = dragging && dragging.slice;
	if (slice) view.someProp("transformPasted", (f) => {
		slice = f(slice, view, false);
	});
	else slice = parseFromClipboard(view, getText$1(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
	let move = !!(dragging && dragMoves(view, event));
	if (view.someProp("handleDrop", (f) => f(view, event, slice || Slice$1.empty, move))) {
		event.preventDefault();
		return;
	}
	if (!slice) return;
	event.preventDefault();
	let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;
	if (insertPos == null) insertPos = $mouse.pos;
	let tr = view.state.tr;
	if (move) {
		let { node } = dragging;
		if (node) node.replace(tr);
		else tr.deleteSelection();
	}
	let pos = tr.mapping.map(insertPos);
	let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;
	let beforeInsert = tr.doc;
	if (isNode) tr.replaceRangeWith(pos, pos, slice.content.firstChild);
	else tr.replaceRange(pos, pos, slice);
	if (tr.doc.eq(beforeInsert)) return;
	let $pos = tr.doc.resolve(pos);
	if (isNode && NodeSelection$1.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) tr.setSelection(new NodeSelection$1($pos));
	else {
		let end = tr.mapping.map(insertPos);
		tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);
		tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));
	}
	view.focus();
	view.dispatch(tr.setMeta("uiEvent", "drop"));
}
handlers.focus = (view) => {
	view.input.lastFocus = Date.now();
	if (!view.focused) {
		view.domObserver.stop();
		view.dom.classList.add("ProseMirror-focused");
		view.domObserver.start();
		view.focused = true;
		setTimeout(() => {
			if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) selectionToDOM(view);
		}, 20);
	}
};
handlers.blur = (view, _event) => {
	let event = _event;
	if (view.focused) {
		view.domObserver.stop();
		view.dom.classList.remove("ProseMirror-focused");
		view.domObserver.start();
		if (event.relatedTarget && view.dom.contains(event.relatedTarget)) view.domObserver.currentSelection.clear();
		view.focused = false;
	}
};
handlers.beforeinput = (view, _event) => {
	if (chrome && android && _event.inputType == "deleteContentBackward") {
		view.domObserver.flushSoon();
		let { domChangeCount } = view.input;
		setTimeout(() => {
			if (view.input.domChangeCount != domChangeCount) return;
			view.dom.blur();
			view.focus();
			if (view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) return;
			let { $cursor } = view.state.selection;
			if ($cursor && $cursor.pos > 0) view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());
		}, 50);
	}
};
for (let prop in editHandlers) handlers[prop] = editHandlers[prop];
function compareObjs(a, b) {
	if (a == b) return true;
	for (let p in a) if (a[p] !== b[p]) return false;
	for (let p in b) if (!(p in a)) return false;
	return true;
}
var WidgetType = class WidgetType {
	constructor(toDOM, spec) {
		this.toDOM = toDOM;
		this.spec = spec || noSpec;
		this.side = this.spec.side || 0;
	}
	map(mapping, span, offset, oldOffset) {
		let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);
		return deleted ? null : new Decoration(pos - offset, pos - offset, this);
	}
	valid() {
		return true;
	}
	eq(other) {
		return this == other || other instanceof WidgetType && (this.spec.key && this.spec.key == other.spec.key || this.toDOM == other.toDOM && compareObjs(this.spec, other.spec));
	}
	destroy(node) {
		if (this.spec.destroy) this.spec.destroy(node);
	}
};
var InlineType = class InlineType {
	constructor(attrs, spec) {
		this.attrs = attrs;
		this.spec = spec || noSpec;
	}
	map(mapping, span, offset, oldOffset) {
		let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
		let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;
		return from >= to ? null : new Decoration(from, to, this);
	}
	valid(_, span) {
		return span.from < span.to;
	}
	eq(other) {
		return this == other || other instanceof InlineType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);
	}
	static is(span) {
		return span.type instanceof InlineType;
	}
	destroy() {}
};
var NodeType = class NodeType {
	constructor(attrs, spec) {
		this.attrs = attrs;
		this.spec = spec || noSpec;
	}
	map(mapping, span, offset, oldOffset) {
		let from = mapping.mapResult(span.from + oldOffset, 1);
		if (from.deleted) return null;
		let to = mapping.mapResult(span.to + oldOffset, -1);
		if (to.deleted || to.pos <= from.pos) return null;
		return new Decoration(from.pos - offset, to.pos - offset, this);
	}
	valid(node, span) {
		let { index, offset } = node.content.findIndex(span.from), child;
		return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;
	}
	eq(other) {
		return this == other || other instanceof NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);
	}
	destroy() {}
};
/**
Decoration objects can be provided to the view through the
[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in
several variants—see the static members of this class for details.
*/
var Decoration = class Decoration {
	/**
	@internal
	*/
	constructor(from, to, type) {
		this.from = from;
		this.to = to;
		this.type = type;
	}
	/**
	@internal
	*/
	copy(from, to) {
		return new Decoration(from, to, this.type);
	}
	/**
	@internal
	*/
	eq(other, offset = 0) {
		return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;
	}
	/**
	@internal
	*/
	map(mapping, offset, oldOffset) {
		return this.type.map(mapping, this, offset, oldOffset);
	}
	/**
	Creates a widget decoration, which is a DOM node that's shown in
	the document at the given position. It is recommended that you
	delay rendering the widget by passing a function that will be
	called when the widget is actually drawn in a view, but you can
	also directly pass a DOM node. `getPos` can be used to find the
	widget's current document position.
	*/
	static widget(pos, toDOM, spec) {
		return new Decoration(pos, pos, new WidgetType(toDOM, spec));
	}
	/**
	Creates an inline decoration, which adds the given attributes to
	each inline node between `from` and `to`.
	*/
	static inline(from, to, attrs, spec) {
		return new Decoration(from, to, new InlineType(attrs, spec));
	}
	/**
	Creates a node decoration. `from` and `to` should point precisely
	before and after a node in the document. That node, and only that
	node, will receive the given attributes.
	*/
	static node(from, to, attrs, spec) {
		return new Decoration(from, to, new NodeType(attrs, spec));
	}
	/**
	The spec provided when creating this decoration. Can be useful
	if you've stored extra information in that object.
	*/
	get spec() {
		return this.type.spec;
	}
	/**
	@internal
	*/
	get inline() {
		return this.type instanceof InlineType;
	}
	/**
	@internal
	*/
	get widget() {
		return this.type instanceof WidgetType;
	}
};
var none = [], noSpec = {};
/**
A collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such
a way that the drawing algorithm can efficiently use and compare
them. This is a persistent data structure—it is not modified,
updates create a new value.
*/
var DecorationSet = class DecorationSet {
	/**
	@internal
	*/
	constructor(local, children) {
		this.local = local.length ? local : none;
		this.children = children.length ? children : none;
	}
	/**
	Create a set of decorations, using the structure of the given
	document. This will consume (modify) the `decorations` array, so
	you must make a copy if you want need to preserve that.
	*/
	static create(doc, decorations) {
		return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;
	}
	/**
	Find all decorations in this set which touch the given range
	(including decorations that start or end directly at the
	boundaries) and match the given predicate on their spec. When
	`start` and `end` are omitted, all decorations in the set are
	considered. When `predicate` isn't given, all decorations are
	assumed to match.
	*/
	find(start, end, predicate) {
		let result = [];
		this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);
		return result;
	}
	findInner(start, end, result, offset, predicate) {
		for (let i = 0; i < this.local.length; i++) {
			let span = this.local[i];
			if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec))) result.push(span.copy(span.from + offset, span.to + offset));
		}
		for (let i = 0; i < this.children.length; i += 3) if (this.children[i] < end && this.children[i + 1] > start) {
			let childOff = this.children[i] + 1;
			this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);
		}
	}
	/**
	Map the set of decorations in response to a change in the
	document.
	*/
	map(mapping, doc, options) {
		if (this == empty || mapping.maps.length == 0) return this;
		return this.mapInner(mapping, doc, 0, 0, options || noSpec);
	}
	/**
	@internal
	*/
	mapInner(mapping, node, offset, oldOffset, options) {
		let newLocal;
		for (let i = 0; i < this.local.length; i++) {
			let mapped = this.local[i].map(mapping, offset, oldOffset);
			if (mapped && mapped.type.valid(node, mapped)) (newLocal || (newLocal = [])).push(mapped);
			else if (options.onRemove) options.onRemove(this.local[i].spec);
		}
		if (this.children.length) return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);
		else return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;
	}
	/**
	Add the given array of decorations to the ones in the set,
	producing a new set. Consumes the `decorations` array. Needs
	access to the current document to create the appropriate tree
	structure.
	*/
	add(doc, decorations) {
		if (!decorations.length) return this;
		if (this == empty) return DecorationSet.create(doc, decorations);
		return this.addInner(doc, decorations, 0);
	}
	addInner(doc, decorations, offset) {
		let children, childIndex = 0;
		doc.forEach((childNode, childOffset) => {
			let baseOffset = childOffset + offset, found;
			if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) return;
			if (!children) children = this.children.slice();
			while (childIndex < children.length && children[childIndex] < childOffset) childIndex += 3;
			if (children[childIndex] == childOffset) children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);
			else children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));
			childIndex += 3;
		});
		let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);
		for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i])) local.splice(i--, 1);
		return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);
	}
	/**
	Create a new set that contains the decorations in this set, minus
	the ones in the given array.
	*/
	remove(decorations) {
		if (decorations.length == 0 || this == empty) return this;
		return this.removeInner(decorations, 0);
	}
	removeInner(decorations, offset) {
		let children = this.children, local = this.local;
		for (let i = 0; i < children.length; i += 3) {
			let found;
			let from = children[i] + offset, to = children[i + 1] + offset;
			for (let j = 0, span; j < decorations.length; j++) if (span = decorations[j]) {
				if (span.from > from && span.to < to) {
					decorations[j] = null;
					(found || (found = [])).push(span);
				}
			}
			if (!found) continue;
			if (children == this.children) children = this.children.slice();
			let removed = children[i + 2].removeInner(found, from + 1);
			if (removed != empty) children[i + 2] = removed;
			else {
				children.splice(i, 3);
				i -= 3;
			}
		}
		if (local.length) {
			for (let i = 0, span; i < decorations.length; i++) if (span = decorations[i]) {
				for (let j = 0; j < local.length; j++) if (local[j].eq(span, offset)) {
					if (local == this.local) local = this.local.slice();
					local.splice(j--, 1);
				}
			}
		}
		if (children == this.children && local == this.local) return this;
		return local.length || children.length ? new DecorationSet(local, children) : empty;
	}
	forChild(offset, node) {
		if (this == empty) return this;
		if (node.isLeaf) return DecorationSet.empty;
		let child, local;
		for (let i = 0; i < this.children.length; i += 3) if (this.children[i] >= offset) {
			if (this.children[i] == offset) child = this.children[i + 2];
			break;
		}
		let start = offset + 1, end = start + node.content.size;
		for (let i = 0; i < this.local.length; i++) {
			let dec = this.local[i];
			if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {
				let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
				if (from < to) (local || (local = [])).push(dec.copy(from, to));
			}
		}
		if (local) {
			let localSet = new DecorationSet(local.sort(byPos), none);
			return child ? new DecorationGroup([localSet, child]) : localSet;
		}
		return child || empty;
	}
	/**
	@internal
	*/
	eq(other) {
		if (this == other) return true;
		if (!(other instanceof DecorationSet) || this.local.length != other.local.length || this.children.length != other.children.length) return false;
		for (let i = 0; i < this.local.length; i++) if (!this.local[i].eq(other.local[i])) return false;
		for (let i = 0; i < this.children.length; i += 3) if (this.children[i] != other.children[i] || this.children[i + 1] != other.children[i + 1] || !this.children[i + 2].eq(other.children[i + 2])) return false;
		return true;
	}
	/**
	@internal
	*/
	locals(node) {
		return removeOverlap(this.localsInner(node));
	}
	/**
	@internal
	*/
	localsInner(node) {
		if (this == empty) return none;
		if (node.inlineContent || !this.local.some(InlineType.is)) return this.local;
		let result = [];
		for (let i = 0; i < this.local.length; i++) if (!(this.local[i].type instanceof InlineType)) result.push(this.local[i]);
		return result;
	}
	forEachSet(f) {
		f(this);
	}
};
/**
The empty set of decorations.
*/
DecorationSet.empty = new DecorationSet([], []);
/**
@internal
*/
DecorationSet.removeOverlap = removeOverlap;
var empty = DecorationSet.empty;
var DecorationGroup = class DecorationGroup {
	constructor(members) {
		this.members = members;
	}
	map(mapping, doc) {
		const mappedDecos = this.members.map((member) => member.map(mapping, doc, noSpec));
		return DecorationGroup.from(mappedDecos);
	}
	forChild(offset, child) {
		if (child.isLeaf) return DecorationSet.empty;
		let found = [];
		for (let i = 0; i < this.members.length; i++) {
			let result = this.members[i].forChild(offset, child);
			if (result == empty) continue;
			if (result instanceof DecorationGroup) found = found.concat(result.members);
			else found.push(result);
		}
		return DecorationGroup.from(found);
	}
	eq(other) {
		if (!(other instanceof DecorationGroup) || other.members.length != this.members.length) return false;
		for (let i = 0; i < this.members.length; i++) if (!this.members[i].eq(other.members[i])) return false;
		return true;
	}
	locals(node) {
		let result, sorted = true;
		for (let i = 0; i < this.members.length; i++) {
			let locals = this.members[i].localsInner(node);
			if (!locals.length) continue;
			if (!result) result = locals;
			else {
				if (sorted) {
					result = result.slice();
					sorted = false;
				}
				for (let j = 0; j < locals.length; j++) result.push(locals[j]);
			}
		}
		return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;
	}
	static from(members) {
		switch (members.length) {
			case 0: return empty;
			case 1: return members[0];
			default: return new DecorationGroup(members.every((m) => m instanceof DecorationSet) ? members : members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));
		}
	}
	forEachSet(f) {
		for (let i = 0; i < this.members.length; i++) this.members[i].forEachSet(f);
	}
};
function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {
	let children = oldChildren.slice();
	for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {
		let moved = 0;
		mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {
			let dSize = newEnd - newStart - (oldEnd - oldStart);
			for (let i = 0; i < children.length; i += 3) {
				let end = children[i + 1];
				if (end < 0 || oldStart > end + baseOffset - moved) continue;
				let start = children[i] + baseOffset - moved;
				if (oldEnd >= start) children[i + 1] = oldStart <= start ? -2 : -1;
				else if (oldStart >= baseOffset && dSize) {
					children[i] += dSize;
					children[i + 1] += dSize;
				}
			}
			moved += dSize;
		});
		baseOffset = mapping.maps[i].map(baseOffset, -1);
	}
	let mustRebuild = false;
	for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {
		if (children[i + 1] == -2) {
			mustRebuild = true;
			children[i + 1] = -1;
			continue;
		}
		let from = mapping.map(oldChildren[i] + oldOffset), fromLocal = from - offset;
		if (fromLocal < 0 || fromLocal >= node.content.size) {
			mustRebuild = true;
			continue;
		}
		let toLocal = mapping.map(oldChildren[i + 1] + oldOffset, -1) - offset;
		let { index, offset: childOffset } = node.content.findIndex(fromLocal);
		let childNode = node.maybeChild(index);
		if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {
			let mapped = children[i + 2].mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);
			if (mapped != empty) {
				children[i] = fromLocal;
				children[i + 1] = toLocal;
				children[i + 2] = mapped;
			} else {
				children[i + 1] = -2;
				mustRebuild = true;
			}
		} else mustRebuild = true;
	}
	if (mustRebuild) {
		let built = buildTree(mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options), node, 0, options);
		newLocal = built.local;
		for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {
			children.splice(i, 3);
			i -= 3;
		}
		for (let i = 0, j = 0; i < built.children.length; i += 3) {
			let from = built.children[i];
			while (j < children.length && children[j] < from) j += 3;
			children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);
		}
	}
	return new DecorationSet(newLocal.sort(byPos), children);
}
function moveSpans(spans, offset) {
	if (!offset || !spans.length) return spans;
	let result = [];
	for (let i = 0; i < spans.length; i++) {
		let span = spans[i];
		result.push(new Decoration(span.from + offset, span.to + offset, span.type));
	}
	return result;
}
function mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {
	function gather(set, oldOffset) {
		for (let i = 0; i < set.local.length; i++) {
			let mapped = set.local[i].map(mapping, offset, oldOffset);
			if (mapped) decorations.push(mapped);
			else if (options.onRemove) options.onRemove(set.local[i].spec);
		}
		for (let i = 0; i < set.children.length; i += 3) gather(set.children[i + 2], set.children[i] + oldOffset + 1);
	}
	for (let i = 0; i < children.length; i += 3) if (children[i + 1] == -1) gather(children[i + 2], oldChildren[i] + oldOffset + 1);
	return decorations;
}
function takeSpansForNode(spans, node, offset) {
	if (node.isLeaf) return null;
	let end = offset + node.nodeSize, found = null;
	for (let i = 0, span; i < spans.length; i++) if ((span = spans[i]) && span.from > offset && span.to < end) {
		(found || (found = [])).push(span);
		spans[i] = null;
	}
	return found;
}
function withoutNulls(array) {
	let result = [];
	for (let i = 0; i < array.length; i++) if (array[i] != null) result.push(array[i]);
	return result;
}
function buildTree(spans, node, offset, options) {
	let children = [], hasNulls = false;
	node.forEach((childNode, localStart) => {
		let found = takeSpansForNode(spans, childNode, localStart + offset);
		if (found) {
			hasNulls = true;
			let subtree = buildTree(found, childNode, offset + localStart + 1, options);
			if (subtree != empty) children.push(localStart, localStart + childNode.nodeSize, subtree);
		}
	});
	let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);
	for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i])) {
		if (options.onRemove) options.onRemove(locals[i].spec);
		locals.splice(i--, 1);
	}
	return locals.length || children.length ? new DecorationSet(locals, children) : empty;
}
function byPos(a, b) {
	return a.from - b.from || a.to - b.to;
}
function removeOverlap(spans) {
	let working = spans;
	for (let i = 0; i < working.length - 1; i++) {
		let span = working[i];
		if (span.from != span.to) for (let j = i + 1; j < working.length; j++) {
			let next = working[j];
			if (next.from == span.from) {
				if (next.to != span.to) {
					if (working == spans) working = spans.slice();
					working[j] = next.copy(next.from, span.to);
					insertAhead(working, j + 1, next.copy(span.to, next.to));
				}
				continue;
			} else {
				if (next.from < span.to) {
					if (working == spans) working = spans.slice();
					working[i] = span.copy(span.from, next.from);
					insertAhead(working, j, span.copy(next.from, span.to));
				}
				break;
			}
		}
	}
	return working;
}
function insertAhead(array, i, deco) {
	while (i < array.length && byPos(deco, array[i]) > 0) i++;
	array.splice(i, 0, deco);
}
function viewDecorations(view) {
	let found = [];
	view.someProp("decorations", (f) => {
		let result = f(view.state);
		if (result && result != empty) found.push(result);
	});
	if (view.cursorWrapper) found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));
	return DecorationGroup.from(found);
}
var observeOptions = {
	childList: true,
	characterData: true,
	characterDataOldValue: true,
	attributes: true,
	attributeOldValue: true,
	subtree: true
};
var useCharData = ie$1 && ie_version <= 11;
var SelectionState = class {
	constructor() {
		this.anchorNode = null;
		this.anchorOffset = 0;
		this.focusNode = null;
		this.focusOffset = 0;
	}
	set(sel) {
		this.anchorNode = sel.anchorNode;
		this.anchorOffset = sel.anchorOffset;
		this.focusNode = sel.focusNode;
		this.focusOffset = sel.focusOffset;
	}
	clear() {
		this.anchorNode = this.focusNode = null;
	}
	eq(sel) {
		return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset && sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;
	}
};
var DOMObserver = class {
	constructor(view, handleDOMChange) {
		this.view = view;
		this.handleDOMChange = handleDOMChange;
		this.queue = [];
		this.flushingSoon = -1;
		this.observer = null;
		this.currentSelection = new SelectionState();
		this.onCharData = null;
		this.suppressingSelectionUpdates = false;
		this.lastChangedTextNode = null;
		this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
			for (let i = 0; i < mutations.length; i++) this.queue.push(mutations[i]);
			if (ie$1 && ie_version <= 11 && mutations.some((m) => m.type == "childList" && m.removedNodes.length || m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length)) this.flushSoon();
			else if (safari && view.composing && mutations.some((m) => m.type == "childList" && m.target.nodeName == "TR")) {
				view.input.badSafariComposition = true;
				this.flushSoon();
			} else this.flush();
		});
		if (useCharData) this.onCharData = (e) => {
			this.queue.push({
				target: e.target,
				type: "characterData",
				oldValue: e.prevValue
			});
			this.flushSoon();
		};
		this.onSelectionChange = this.onSelectionChange.bind(this);
	}
	flushSoon() {
		if (this.flushingSoon < 0) this.flushingSoon = window.setTimeout(() => {
			this.flushingSoon = -1;
			this.flush();
		}, 20);
	}
	forceFlush() {
		if (this.flushingSoon > -1) {
			window.clearTimeout(this.flushingSoon);
			this.flushingSoon = -1;
			this.flush();
		}
	}
	start() {
		if (this.observer) {
			this.observer.takeRecords();
			this.observer.observe(this.view.dom, observeOptions);
		}
		if (this.onCharData) this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData);
		this.connectSelection();
	}
	stop() {
		if (this.observer) {
			let take = this.observer.takeRecords();
			if (take.length) {
				for (let i = 0; i < take.length; i++) this.queue.push(take[i]);
				window.setTimeout(() => this.flush(), 20);
			}
			this.observer.disconnect();
		}
		if (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 = true;
		setTimeout(() => this.suppressingSelectionUpdates = false, 50);
	}
	onSelectionChange() {
		if (!hasFocusAndSelection(this.view)) return;
		if (this.suppressingSelectionUpdates) return selectionToDOM(this.view);
		if (ie$1 && ie_version <= 11 && !this.view.state.selection.empty) {
			let sel = this.view.domSelectionRange();
			if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) return this.flushSoon();
		}
		this.flush();
	}
	setCurSelection() {
		this.currentSelection.set(this.view.domSelectionRange());
	}
	ignoreSelectionChange(sel) {
		if (!sel.focusNode) return true;
		let ancestors = /* @__PURE__ */ new Set(), container;
		for (let scan = sel.focusNode; scan; scan = parentNode(scan)) ancestors.add(scan);
		for (let scan = sel.anchorNode; scan; scan = parentNode(scan)) if (ancestors.has(scan)) {
			container = scan;
			break;
		}
		let desc = container && this.view.docView.nearestDesc(container);
		if (desc && desc.ignoreMutation({
			type: "selection",
			target: container.nodeType == 3 ? container.parentNode : container
		})) {
			this.setCurSelection();
			return true;
		}
	}
	pendingRecords() {
		if (this.observer) for (let mut of this.observer.takeRecords()) this.queue.push(mut);
		return this.queue;
	}
	flush() {
		let { view } = this;
		if (!view.docView || this.flushingSoon > -1) return;
		let mutations = this.pendingRecords();
		if (mutations.length) this.queue = [];
		let sel = view.domSelectionRange();
		let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
		let from = -1, to = -1, typeOver = false, added = [];
		if (view.editable) for (let i = 0; i < mutations.length; i++) {
			let result = this.registerMutation(mutations[i], added);
			if (result) {
				from = from < 0 ? result.from : Math.min(result.from, from);
				to = to < 0 ? result.to : Math.max(result.to, to);
				if (result.typeOver) typeOver = true;
			}
		}
		if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
			for (let node of added) if (node.nodeName == "BR" && node.parentNode) {
				let after = node.nextSibling;
				while (after && after.nodeType == 1) {
					if (after.contentEditable == "false") {
						node.parentNode.removeChild(node);
						break;
					}
					after = after.firstChild;
				}
			}
		} else if (gecko && added.length) {
			let brs = added.filter((n) => n.nodeName == "BR");
			if (brs.length == 2) {
				let [a, b] = brs;
				if (a.parentNode && a.parentNode.parentNode == b.parentNode) b.remove();
				else a.remove();
			} else {
				let { focusNode } = this.currentSelection;
				for (let br of brs) {
					let parent = br.parentNode;
					if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent)) br.remove();
				}
			}
		}
		let readSel = null;
		if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection$2.near(view.state.doc.resolve(0), 1))) {
			view.input.lastFocus = 0;
			selectionToDOM(view);
			this.currentSelection.set(sel);
			view.scrollToSelection();
		} else if (from > -1 || newSel) {
			if (from > -1) {
				view.docView.markDirty(from, to);
				checkCSS(view);
			}
			if (view.input.badSafariComposition) {
				view.input.badSafariComposition = false;
				fixUpBadSafariComposition(view, added);
			}
			this.handleDOMChange(from, to, typeOver, added);
			if (view.docView && view.docView.dirty) view.updateState(view.state);
			else if (!this.currentSelection.eq(sel)) selectionToDOM(view);
			this.currentSelection.set(sel);
		}
	}
	registerMutation(mut, added) {
		if (added.indexOf(mut.target) > -1) return null;
		let desc = this.view.docView.nearestDesc(mut.target);
		if (mut.type == "attributes" && (desc == this.view.docView || mut.attributeName == "contenteditable" || mut.attributeName == "style" && !mut.oldValue && !mut.target.getAttribute("style"))) return null;
		if (!desc || desc.ignoreMutation(mut)) return null;
		if (mut.type == "childList") {
			for (let i = 0; i < mut.addedNodes.length; i++) {
				let node = mut.addedNodes[i];
				added.push(node);
				if (node.nodeType == 3) this.lastChangedTextNode = node;
			}
			if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {
				from: desc.posBefore,
				to: desc.posAfter
			};
			let prev = mut.previousSibling, next = mut.nextSibling;
			if (ie$1 && ie_version <= 11 && mut.addedNodes.length) for (let i = 0; i < mut.addedNodes.length; i++) {
				let { previousSibling, nextSibling } = mut.addedNodes[i];
				if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) prev = previousSibling;
				if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) next = nextSibling;
			}
			let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;
			let from = desc.localPosFromDOM(mut.target, fromOffset, -1);
			let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;
			return {
				from,
				to: desc.localPosFromDOM(mut.target, toOffset, 1)
			};
		} else if (mut.type == "attributes") return {
			from: desc.posAtStart - desc.border,
			to: desc.posAtEnd + desc.border
		};
		else {
			this.lastChangedTextNode = mut.target;
			return {
				from: desc.posAtStart,
				to: desc.posAtEnd,
				typeOver: mut.target.nodeValue == mut.oldValue
			};
		}
	}
};
var cssChecked = /* @__PURE__ */ new WeakMap();
var cssCheckWarned = false;
function checkCSS(view) {
	if (cssChecked.has(view)) return;
	cssChecked.set(view, null);
	if ([
		"normal",
		"nowrap",
		"pre-line"
	].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {
		view.requiresGeckoHackNode = gecko;
		if (cssCheckWarned) return;
		console["warn"]("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.");
		cssCheckWarned = true;
	}
}
function rangeToSelectionRange(view, range) {
	let anchorNode = range.startContainer, anchorOffset = range.startOffset;
	let focusNode = range.endContainer, focusOffset = range.endOffset;
	let currentAnchor = view.domAtPos(view.state.selection.anchor);
	if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset)) [anchorNode, anchorOffset, focusNode, focusOffset] = [
		focusNode,
		focusOffset,
		anchorNode,
		anchorOffset
	];
	return {
		anchorNode,
		anchorOffset,
		focusNode,
		focusOffset
	};
}
function safariShadowSelectionRange(view, selection) {
	if (selection.getComposedRanges) {
		let range = selection.getComposedRanges(view.root)[0];
		if (range) return rangeToSelectionRange(view, range);
	}
	let found;
	function read(event) {
		event.preventDefault();
		event.stopImmediatePropagation();
		found = event.getTargetRanges()[0];
	}
	view.dom.addEventListener("beforeinput", read, true);
	document.execCommand("indent");
	view.dom.removeEventListener("beforeinput", read, true);
	return found ? rangeToSelectionRange(view, found) : null;
}
function blockParent(view, node) {
	for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {
		let desc = view.docView.nearestDesc(p, true);
		if (desc && desc.node.isBlock) return p;
	}
	return null;
}
function fixUpBadSafariComposition(view, addedNodes) {
	var _a;
	let { focusNode, focusOffset } = view.domSelectionRange();
	for (let node of addedNodes) if (((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName) == "TR") {
		let nextCell = node.nextSibling;
		while (nextCell && nextCell.nodeName != "TD" && nextCell.nodeName != "TH") nextCell = nextCell.nextSibling;
		if (nextCell) {
			let parent = nextCell;
			for (;;) {
				let first = parent.firstChild;
				if (!first || first.nodeType != 1 || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
				parent = first;
			}
			parent.insertBefore(node, parent.firstChild);
			if (focusNode == node) view.domSelection().collapse(node, focusOffset);
		} else node.parentNode.removeChild(node);
	}
}
function parseBetween(view, from_, to_) {
	let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);
	let domSel = view.domSelectionRange();
	let find;
	let anchor = domSel.anchorNode;
	if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
		find = [{
			node: anchor,
			offset: domSel.anchorOffset
		}];
		if (!selectionCollapsed(domSel)) find.push({
			node: domSel.focusNode,
			offset: domSel.focusOffset
		});
	}
	if (chrome && view.input.lastKeyCode === 8) for (let off = toOffset; off > fromOffset; off--) {
		let node = parent.childNodes[off - 1], desc = node.pmViewDesc;
		if (node.nodeName == "BR" && !desc) {
			toOffset = off;
			break;
		}
		if (!desc || desc.size) break;
	}
	let startDoc = view.state.doc;
	let parser = view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
	let $from = startDoc.resolve(from);
	let sel = null, doc = parser.parse(parent, {
		topNode: $from.parent,
		topMatch: $from.parent.contentMatchAt($from.index()),
		topOpen: true,
		from: fromOffset,
		to: toOffset,
		preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true,
		findPositions: find,
		ruleFromNode,
		context: $from
	});
	if (find && find[0].pos != null) {
		let anchor = find[0].pos, head = find[1] && find[1].pos;
		if (head == null) head = anchor;
		sel = {
			anchor: anchor + from,
			head: head + from
		};
	}
	return {
		doc,
		sel,
		from,
		to
	};
}
function ruleFromNode(dom) {
	let desc = dom.pmViewDesc;
	if (desc) return desc.parseRule();
	else if (dom.nodeName == "BR" && dom.parentNode) {
		if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {
			let skip = document.createElement("div");
			skip.appendChild(document.createElement("li"));
			return { skip };
		} else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) return { ignore: true };
	} else if (dom.nodeName == "IMG" && dom.getAttribute("mark-placeholder")) return { ignore: true };
	return null;
}
var isInline = /^(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 readDOMChange(view, from, to, typeOver, addedNodes) {
	let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
	view.input.compositionPendingChanges = 0;
	if (from < 0) {
		let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
		let newSel = selectionFromDOM(view, origin);
		if (newSel && !view.state.selection.eq(newSel)) {
			if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) return;
			let tr = view.state.tr.setSelection(newSel);
			if (origin == "pointer") tr.setMeta("pointer", true);
			else if (origin == "key") tr.scrollIntoView();
			if (compositionID) tr.setMeta("composition", compositionID);
			view.dispatch(tr);
		}
		return;
	}
	let $before = view.state.doc.resolve(from);
	let shared = $before.sharedDepth(to);
	from = $before.before(shared + 1);
	to = view.state.doc.resolve(to).after(shared + 1);
	let sel = view.state.selection;
	let parse = parseBetween(view, from, to);
	let doc = view.state.doc, compare = doc.slice(parse.from, parse.to);
	let preferredPos, preferredSide;
	if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {
		preferredPos = view.state.selection.to;
		preferredSide = "end";
	} else {
		preferredPos = view.state.selection.from;
		preferredSide = "start";
	}
	view.input.lastKeyCode = null;
	let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
	if (change) view.input.domChangeCount++;
	if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
		view.input.lastIOSEnter = 0;
		return;
	}
	if (!change) if (typeOver && sel instanceof TextSelection$1 && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) change = {
		start: sel.from,
		endA: sel.to,
		endB: sel.to
	};
	else {
		if (parse.sel) {
			let sel = resolveSelection(view, view.state.doc, parse.sel);
			if (sel && !sel.eq(view.state.selection)) {
				let tr = view.state.tr.setSelection(sel);
				if (compositionID) tr.setMeta("composition", compositionID);
				view.dispatch(tr);
			}
		}
		return;
	}
	if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection$1) {
		if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse.from) change.start = view.state.selection.from;
		else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse.to) {
			change.endB += view.state.selection.to - change.endA;
			change.endA = view.state.selection.to;
		}
	}
	if (ie$1 && ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse.from && parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == " \xA0") {
		change.start--;
		change.endA--;
		change.endB--;
	}
	let $from = parse.doc.resolveNoCache(change.start - parse.from);
	let $to = parse.doc.resolveNoCache(change.endB - parse.from);
	let $fromA = doc.resolve(change.start);
	let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
	if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
		view.input.lastIOSEnter = 0;
		return;
	}
	if (view.state.selection.anchor > change.start && looksLikeBackspace(doc, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) {
		if (android && chrome) view.domObserver.suppressSelectionUpdates();
		return;
	}
	if (chrome && change.endB == change.start) view.input.lastChromeDelete = Date.now();
	if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {
		change.endB -= 2;
		$to = parse.doc.resolveNoCache(change.endB - parse.from);
		setTimeout(() => {
			view.someProp("handleKeyDown", function(f) {
				return f(view, keyEvent(13, "Enter"));
			});
		}, 20);
	}
	let chFrom = change.start, chTo = change.endA;
	let mkTr = (base) => {
		let tr = base || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
		if (parse.sel) {
			let sel = resolveSelection(view, tr.doc, parse.sel);
			if (sel && !(chrome && view.composing && sel.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) || ie$1 && sel.empty && sel.head == chFrom)) tr.setSelection(sel);
		}
		if (compositionID) tr.setMeta("composition", compositionID);
		return tr.scrollIntoView();
	};
	let markChange;
	if (inlineChange) if ($from.pos == $to.pos) {
		if (ie$1 && ie_version <= 11 && $from.parentOffset == 0) {
			view.domObserver.suppressSelectionUpdates();
			setTimeout(() => selectionToDOM(view), 20);
		}
		let tr = mkTr(view.state.tr.delete(chFrom, chTo));
		let marks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));
		if (marks) tr.ensureMarks(marks);
		view.dispatch(tr);
	} else if (change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {
		let tr = mkTr(view.state.tr);
		if (markChange.type == "add") tr.addMark(chFrom, chTo, markChange.mark);
		else tr.removeMark(chFrom, chTo, markChange.mark);
		view.dispatch(tr);
	} else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {
		let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);
		let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
		if (!view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text, deflt))) view.dispatch(deflt());
	} else view.dispatch(mkTr());
	else view.dispatch(mkTr());
}
function resolveSelection(view, doc, parsedSel) {
	if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) return null;
	return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));
}
function isMarkChange(cur, prev) {
	let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;
	let added = curMarks, removed = prevMarks, type, mark, update;
	for (let i = 0; i < prevMarks.length; i++) added = prevMarks[i].removeFromSet(added);
	for (let i = 0; i < curMarks.length; i++) removed = curMarks[i].removeFromSet(removed);
	if (added.length == 1 && removed.length == 0) {
		mark = added[0];
		type = "add";
		update = (node) => node.mark(mark.addToSet(node.marks));
	} else if (added.length == 0 && removed.length == 1) {
		mark = removed[0];
		type = "remove";
		update = (node) => node.mark(mark.removeFromSet(node.marks));
	} else return null;
	let updated = [];
	for (let i = 0; i < prev.childCount; i++) updated.push(update(prev.child(i)));
	if (Fragment$1.from(updated).eq(cur)) return {
		mark,
		type
	};
}
function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
	if (end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, true, false) < $newEnd.pos) return false;
	let $start = old.resolve(start);
	if (!$newStart.parent.isTextblock) {
		let after = $start.nodeAfter;
		return after != null && end == start + after.nodeSize;
	}
	if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return false;
	let $next = old.resolve(skipClosingAndOpening($start, true, true));
	if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;
	return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
}
function skipClosingAndOpening($pos, fromEnd, mayOpen) {
	let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
	while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
		depth--;
		end++;
		fromEnd = false;
	}
	if (mayOpen) {
		let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));
		while (next && !next.isLeaf) {
			next = next.firstChild;
			end++;
		}
	}
	return end;
}
function findDiff(a, b, pos, preferredPos, preferredSide) {
	let start = a.findDiffStart(b, pos);
	if (start == null) return null;
	let { a: endA, b: endB } = a.findDiffEnd(b, pos + a.size, pos + b.size);
	if (preferredSide == "end") {
		let adjust = Math.max(0, start - Math.min(endA, endB));
		preferredPos -= endA + adjust - start;
	}
	if (endA < start && a.size < b.size) {
		let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
		start -= move;
		if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1))) start += move ? 1 : -1;
		endB = start + (endB - endA);
		endA = start;
	} else if (endB < start) {
		let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
		start -= move;
		if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1))) start += move ? 1 : -1;
		endA = start + (endA - endB);
		endB = start;
	}
	return {
		start,
		endA,
		endB
	};
}
function isSurrogatePair(str) {
	if (str.length != 2) return false;
	let a = str.charCodeAt(0), b = str.charCodeAt(1);
	return a >= 56320 && a <= 57343 && b >= 55296 && b <= 56319;
}
/**
An editor view manages the DOM structure that represents an
editable document. Its state and behavior are determined by its
[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).
*/
var EditorView = class {
	/**
	Create a view. `place` may be a DOM node that the editor should
	be appended to, a function that will place it into the document,
	or an object whose `mount` property holds the node to use as the
	document container. If it is `null`, the editor will not be
	added to the document.
	*/
	constructor(place, props) {
		this._root = null;
		/**
		@internal
		*/
		this.focused = false;
		/**
		Kludge used to work around a Chrome bug @internal
		*/
		this.trackWrites = null;
		this.mounted = false;
		/**
		@internal
		*/
		this.markCursor = null;
		/**
		@internal
		*/
		this.cursorWrapper = null;
		/**
		@internal
		*/
		this.lastSelectedViewDesc = void 0;
		/**
		@internal
		*/
		this.input = new InputState();
		this.prevDirectPlugins = [];
		this.pluginViews = [];
		/**
		Holds `true` when a hack node is needed in Firefox to prevent the
		[space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)
		@internal
		*/
		this.requiresGeckoHackNode = false;
		/**
		When editor content is being dragged, this object contains
		information about the dragged slice and whether it is being
		copied or moved. At any other time, it is null.
		*/
		this.dragging = null;
		this._props = props;
		this.state = props.state;
		this.directPlugins = props.plugins || [];
		this.directPlugins.forEach(checkStateComponent);
		this.dispatch = this.dispatch.bind(this);
		this.dom = place && place.mount || document.createElement("div");
		if (place) {
			if (place.appendChild) place.appendChild(this.dom);
			else if (typeof place == "function") place(this.dom);
			else if (place.mount) this.mounted = true;
		}
		this.editable = getEditable(this);
		updateCursorWrapper(this);
		this.nodeViews = buildNodeViews(this);
		this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);
		this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));
		this.domObserver.start();
		initInput(this);
		this.updatePluginViews();
	}
	/**
	Holds `true` when a
	[composition](https://w3c.github.io/uievents/#events-compositionevents)
	is active.
	*/
	get composing() {
		return this.input.composing;
	}
	/**
	The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
	*/
	get props() {
		if (this._props.state != this.state) {
			let prev = this._props;
			this._props = {};
			for (let name in prev) this._props[name] = prev[name];
			this._props.state = this.state;
		}
		return this._props;
	}
	/**
	Update the view's props. Will immediately cause an update to
	the DOM.
	*/
	update(props) {
		if (props.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);
		let prevProps = this._props;
		this._props = props;
		if (props.plugins) {
			props.plugins.forEach(checkStateComponent);
			this.directPlugins = props.plugins;
		}
		this.updateStateInner(props.state, prevProps);
	}
	/**
	Update the view by updating existing props object with the object
	given as argument. Equivalent to `view.update(Object.assign({},
	view.props, props))`.
	*/
	setProps(props) {
		let updated = {};
		for (let name in this._props) updated[name] = this._props[name];
		updated.state = this.state;
		for (let name in props) updated[name] = props[name];
		this.update(updated);
	}
	/**
	Update the editor's `state` prop, without touching any of the
	other props.
	*/
	updateState(state) {
		this.updateStateInner(state, this._props);
	}
	updateStateInner(state, prevProps) {
		var _a;
		let prev = this.state, redraw = false, updateSel = false;
		if (state.storedMarks && this.composing) {
			clearComposition(this);
			updateSel = true;
		}
		this.state = state;
		let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;
		if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {
			let nodeViews = buildNodeViews(this);
			if (changedNodeViews(nodeViews, this.nodeViews)) {
				this.nodeViews = nodeViews;
				redraw = true;
			}
		}
		if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);
		this.editable = getEditable(this);
		updateCursorWrapper(this);
		let innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);
		let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? "reset" : state.scrollToSelection > prev.scrollToSelection ? "to selection" : "preserve";
		let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);
		if (updateDoc || !state.selection.eq(prev.selection)) updateSel = true;
		let oldScrollPos = scroll == "preserve" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);
		if (updateSel) {
			this.domObserver.stop();
			let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);
			if (updateDoc) {
				let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
				if (this.composing) this.input.compositionNode = findCompositionNode(this);
				if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {
					this.docView.updateOuterDeco(outerDeco);
					this.docView.destroy();
					this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);
				}
				if (chromeKludge && (!this.trackWrites || !this.dom.contains(this.trackWrites))) forceSelUpdate = true;
			}
			if (forceSelUpdate || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && anchorInRightPlace(this))) selectionToDOM(this, forceSelUpdate);
			else {
				syncNodeSelection(this, state.selection);
				this.domObserver.setCurSelection();
			}
			this.domObserver.start();
		}
		this.updatePluginViews(prev);
		if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc)) this.updateDraggedNode(this.dragging, prev);
		if (scroll == "reset") this.dom.scrollTop = 0;
		else if (scroll == "to selection") this.scrollToSelection();
		else if (oldScrollPos) resetScrollPos(oldScrollPos);
	}
	/**
	@internal
	*/
	scrollToSelection() {
		let startDOM = this.domSelectionRange().focusNode;
		if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode));
		else if (this.someProp("handleScrollToSelection", (f) => f(this)));
		else if (this.state.selection instanceof NodeSelection$1) {
			let target = this.docView.domAfterPos(this.state.selection.from);
			if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
		} else scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
	}
	destroyPluginViews() {
		let view;
		while (view = this.pluginViews.pop()) if (view.destroy) view.destroy();
	}
	updatePluginViews(prevState) {
		if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
			this.prevDirectPlugins = this.directPlugins;
			this.destroyPluginViews();
			for (let i = 0; i < this.directPlugins.length; i++) {
				let plugin = this.directPlugins[i];
				if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));
			}
			for (let i = 0; i < this.state.plugins.length; i++) {
				let plugin = this.state.plugins[i];
				if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));
			}
		} else for (let i = 0; i < this.pluginViews.length; i++) {
			let pluginView = this.pluginViews[i];
			if (pluginView.update) pluginView.update(this, prevState);
		}
	}
	updateDraggedNode(dragging, prev) {
		let sel = dragging.node, found = -1;
		if (sel.from < this.state.doc.content.size && this.state.doc.nodeAt(sel.from) == sel.node) found = sel.from;
		else {
			let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);
			if ((movedPos > 0 && movedPos < this.state.doc.content.size && this.state.doc.nodeAt(movedPos)) == sel.node) found = movedPos;
		}
		this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? void 0 : NodeSelection$1.create(this.state.doc, found));
	}
	someProp(propName, f) {
		let prop = this._props && this._props[propName], value;
		if (prop != null && (value = f ? f(prop) : prop)) return value;
		for (let i = 0; i < this.directPlugins.length; i++) {
			let prop = this.directPlugins[i].props[propName];
			if (prop != null && (value = f ? f(prop) : prop)) return value;
		}
		let plugins = this.state.plugins;
		if (plugins) for (let i = 0; i < plugins.length; i++) {
			let prop = plugins[i].props[propName];
			if (prop != null && (value = f ? f(prop) : prop)) return value;
		}
	}
	/**
	Query whether the view has focus.
	*/
	hasFocus() {
		if (ie$1) {
			let node = this.root.activeElement;
			if (node == this.dom) return true;
			if (!node || !this.dom.contains(node)) return false;
			while (node && this.dom != node && this.dom.contains(node)) {
				if (node.contentEditable == "false") return false;
				node = node.parentElement;
			}
			return true;
		}
		return this.root.activeElement == this.dom;
	}
	/**
	Focus the editor.
	*/
	focus() {
		this.domObserver.stop();
		if (this.editable) focusPreventScroll(this.dom);
		selectionToDOM(this);
		this.domObserver.start();
	}
	/**
	Get the document root in which the editor exists. This will
	usually be the top-level `document`, but might be a [shadow
	DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
	root if the editor is inside one.
	*/
	get root() {
		let cached = this._root;
		if (cached == null) {
			for (let search = this.dom.parentNode; search; search = search.parentNode) if (search.nodeType == 9 || search.nodeType == 11 && search.host) {
				if (!search.getSelection) Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();
				return this._root = search;
			}
		}
		return cached || document;
	}
	/**
	When an existing editor view is moved to a new document or
	shadow tree, call this to make it recompute its root.
	*/
	updateRoot() {
		this._root = null;
	}
	/**
	Given a pair of viewport coordinates, return the document
	position that corresponds to them. May return null if the given
	coordinates aren't inside of the editor. When an object is
	returned, its `pos` property is the position nearest to the
	coordinates, and its `inside` property holds the position of the
	inner node that the position falls inside of, or -1 if it is at
	the top level, not in any node.
	*/
	posAtCoords(coords) {
		return posAtCoords(this, coords);
	}
	/**
	Returns the viewport rectangle at a given document position.
	`left` and `right` will be the same number, as this returns a
	flat cursor-ish rectangle. If the position is between two things
	that aren't directly adjacent, `side` determines which element
	is used. When < 0, the element before the position is used,
	otherwise the element after.
	*/
	coordsAtPos(pos, side = 1) {
		return coordsAtPos(this, pos, side);
	}
	/**
	Find the DOM position that corresponds to the given document
	position. When `side` is negative, find the position as close as
	possible to the content before the position. When positive,
	prefer positions close to the content after the position. When
	zero, prefer as shallow a position as possible.
	
	Note that you should **not** mutate the editor's internal DOM,
	only inspect it (and even that is usually not necessary).
	*/
	domAtPos(pos, side = 0) {
		return this.docView.domFromPos(pos, side);
	}
	/**
	Find the DOM node that represents the document node after the
	given position. May return `null` when the position doesn't point
	in front of a node or if the node is inside an opaque node view.
	
	This is intended to be able to call things like
	`getBoundingClientRect` on that DOM node. Do **not** mutate the
	editor DOM directly, or add styling this way, since that will be
	immediately overriden by the editor as it redraws the node.
	*/
	nodeDOM(pos) {
		let desc = this.docView.descAt(pos);
		return desc ? desc.nodeDOM : null;
	}
	/**
	Find the document position that corresponds to a given DOM
	position. (Whenever possible, it is preferable to inspect the
	document structure directly, rather than poking around in the
	DOM, but sometimes—for example when interpreting an event
	target—you don't have a choice.)
	
	The `bias` parameter can be used to influence which side of a DOM
	node to use when the position is inside a leaf node.
	*/
	posAtDOM(node, offset, bias = -1) {
		let pos = this.docView.posFromDOM(node, offset, bias);
		if (pos == null) throw new RangeError("DOM position not inside the editor");
		return pos;
	}
	/**
	Find out whether the selection is at the end of a textblock when
	moving in a given direction. When, for example, given `"left"`,
	it will return true if moving left from the current cursor
	position would leave that position's parent textblock. Will apply
	to the view's current state by default, but it is possible to
	pass a different state.
	*/
	endOfTextblock(dir, state) {
		return endOfTextblock(this, state || this.state, dir);
	}
	/**
	Run the editor's paste logic with the given HTML string. The
	`event`, if given, will be passed to the
	[`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
	*/
	pasteHTML(html, event) {
		return doPaste(this, "", html, false, event || new ClipboardEvent("paste"));
	}
	/**
	Run the editor's paste logic with the given plain-text input.
	*/
	pasteText(text, event) {
		return doPaste(this, text, null, true, event || new ClipboardEvent("paste"));
	}
	/**
	Serialize the given slice as it would be if it was copied from
	this editor. Returns a DOM element that contains a
	representation of the slice as its children, a textual
	representation, and the transformed slice (which can be
	different from the given input due to hooks like
	[`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
	*/
	serializeForClipboard(slice) {
		return serializeForClipboard(this, slice);
	}
	/**
	Removes the editor from the DOM and destroys all [node
	views](https://prosemirror.net/docs/ref/#view.NodeView).
	*/
	destroy() {
		if (!this.docView) return;
		destroyInput(this);
		this.destroyPluginViews();
		if (this.mounted) {
			this.docView.update(this.state.doc, [], viewDecorations(this), this);
			this.dom.textContent = "";
		} else if (this.dom.parentNode) this.dom.parentNode.removeChild(this.dom);
		this.docView.destroy();
		this.docView = null;
		clearReusedRange();
	}
	/**
	This is true when the view has been
	[destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
	used anymore).
	*/
	get isDestroyed() {
		return this.docView == null;
	}
	/**
	Used for testing.
	*/
	dispatchEvent(event) {
		return dispatchEvent(this, event);
	}
	/**
	@internal
	*/
	domSelectionRange() {
		let sel = this.domSelection();
		if (!sel) return {
			focusNode: null,
			focusOffset: 0,
			anchorNode: null,
			anchorOffset: 0
		};
		return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
	}
	/**
	@internal
	*/
	domSelection() {
		return this.root.getSelection();
	}
};
EditorView.prototype.dispatch = function(tr) {
	let dispatchTransaction = this._props.dispatchTransaction;
	if (dispatchTransaction) dispatchTransaction.call(this, tr);
	else this.updateState(this.state.apply(tr));
};
function computeDocDeco(view) {
	let attrs = Object.create(null);
	attrs.class = "ProseMirror";
	attrs.contenteditable = String(view.editable);
	view.someProp("attributes", (value) => {
		if (typeof value == "function") value = value(view.state);
		if (value) {
			for (let attr in value) if (attr == "class") attrs.class += " " + value[attr];
			else if (attr == "style") attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];
			else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName") attrs[attr] = String(value[attr]);
		}
	});
	if (!attrs.translate) attrs.translate = "no";
	return [Decoration.node(0, view.state.doc.content.size, attrs)];
}
function updateCursorWrapper(view) {
	if (view.markCursor) {
		let dom = document.createElement("img");
		dom.className = "ProseMirror-separator";
		dom.setAttribute("mark-placeholder", "true");
		dom.setAttribute("alt", "");
		view.cursorWrapper = {
			dom,
			deco: Decoration.widget(view.state.selection.from, dom, {
				raw: true,
				marks: view.markCursor
			})
		};
	} else view.cursorWrapper = null;
}
function getEditable(view) {
	return !view.someProp("editable", (value) => value(view.state) === false);
}
function selectionContextChanged(sel1, sel2) {
	let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));
	return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);
}
function buildNodeViews(view) {
	let result = Object.create(null);
	function add(obj) {
		for (let prop in obj) if (!Object.prototype.hasOwnProperty.call(result, prop)) result[prop] = obj[prop];
	}
	view.someProp("nodeViews", add);
	view.someProp("markViews", add);
	return result;
}
function changedNodeViews(a, b) {
	let nA = 0, nB = 0;
	for (let prop in a) {
		if (a[prop] != b[prop]) return true;
		nA++;
	}
	for (let _ in b) nB++;
	return nA != nB;
}
function checkStateComponent(plugin) {
	if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw new RangeError("Plugins passed directly to the view must not have a state component");
}
//#endregion
//#region node_modules/w3c-keyname/index.js
var base = {
	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: "'"
};
var shift = {
	48: ")",
	49: "!",
	50: "@",
	51: "#",
	52: "$",
	53: "%",
	54: "^",
	55: "&",
	56: "*",
	57: "(",
	59: ":",
	61: "+",
	173: "_",
	186: ":",
	187: "+",
	188: "<",
	189: "_",
	190: ">",
	191: "?",
	192: "~",
	219: "{",
	220: "|",
	221: "}",
	222: "\""
};
var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);
for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i;
for (var i = 65; i <= 90; i++) {
	base[i] = String.fromCharCode(i + 32);
	shift[i] = String.fromCharCode(i);
}
for (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];
function keyName(event) {
	var name = !(mac$1 && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified") && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || "Unidentified";
	if (name == "Esc") name = "Escape";
	if (name == "Del") name = "Delete";
	if (name == "Left") name = "ArrowLeft";
	if (name == "Up") name = "ArrowUp";
	if (name == "Right") name = "ArrowRight";
	if (name == "Down") name = "ArrowDown";
	return name;
}
//#endregion
//#region node_modules/prosemirror-keymap/dist/index.js
var mac = typeof navigator != "undefined" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
var windows = typeof navigator != "undefined" && /Win/.test(navigator.platform);
function normalizeKeyName$1(name) {
	let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];
	if (result == "Space") result = " ";
	let alt, ctrl, shift, meta;
	for (let i = 0; i < parts.length - 1; i++) {
		let mod = parts[i];
		if (/^(cmd|meta|m)$/i.test(mod)) meta = true;
		else if (/^a(lt)?$/i.test(mod)) alt = true;
		else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;
		else if (/^s(hift)?$/i.test(mod)) shift = true;
		else if (/^mod$/i.test(mod)) if (mac) meta = true;
		else ctrl = true;
		else throw new Error("Unrecognized modifier name: " + mod);
	}
	if (alt) result = "Alt-" + result;
	if (ctrl) result = "Ctrl-" + result;
	if (meta) result = "Meta-" + result;
	if (shift) result = "Shift-" + result;
	return result;
}
function normalize(map) {
	let copy = Object.create(null);
	for (let prop in map) copy[normalizeKeyName$1(prop)] = map[prop];
	return copy;
}
function modifiers(name, event, shift = true) {
	if (event.altKey) name = "Alt-" + name;
	if (event.ctrlKey) name = "Ctrl-" + name;
	if (event.metaKey) name = "Meta-" + name;
	if (shift && event.shiftKey) name = "Shift-" + name;
	return name;
}
/**
Create a keymap plugin for the given set of bindings.

Bindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style
functions, which will be called with `(EditorState, dispatch,
EditorView)` arguments, and should return true when they've handled
the key. Note that the view argument isn't part of the command
protocol, but can be used as an escape hatch if a binding needs to
directly interact with the UI.

Key names may be strings like `"Shift-Ctrl-Enter"`—a key
identifier prefixed with zero or more modifiers. Key identifiers
are based on the strings that can appear in
[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
Use lowercase letters to refer to letter keys (or uppercase letters
if you want shift to be held). You may use `"Space"` as an alias
for the `" "` name.

Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or
`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or
`Meta-`) are recognized. For characters that are created by holding
shift, the `Shift-` prefix is implied, and should not be added
explicitly.

You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on
other platforms.

You can add multiple keymap plugins to an editor. The order in
which they appear determines their precedence (the ones early in
the array get to dispatch first).
*/
function keymap(bindings) {
	return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
}
/**
Given a set of bindings (using the same format as
[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown
handler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.
*/
function keydownHandler(bindings) {
	let map = normalize(bindings);
	return function(view, event) {
		let name = keyName(event), baseName, direct = map[modifiers(name, event)];
		if (direct && direct(view.state, view.dispatch, view)) return true;
		if (name.length == 1 && name != " ") {
			if (event.shiftKey) {
				let noShift = map[modifiers(name, event, false)];
				if (noShift && noShift(view.state, view.dispatch, view)) return true;
			}
			if ((event.altKey || event.metaKey || event.ctrlKey) && !(windows && event.ctrlKey && event.altKey) && (baseName = base[event.keyCode]) && baseName != name) {
				let fromCode = map[modifiers(baseName, event)];
				if (fromCode && fromCode(view.state, view.dispatch, view)) return true;
			}
		}
		return false;
	};
}
//#endregion
//#region node_modules/@tiptap/core/dist/index.js
var import_core = /* @__PURE__ */ __toESM(require_core());
var __defProp$1 = Object.defineProperty;
var __export$1 = (target, all) => {
	for (var name in all) __defProp$1(target, name, {
		get: all[name],
		enumerable: true
	});
};
function createChainableState(config) {
	const { state, transaction } = config;
	let { selection } = transaction;
	let { doc } = transaction;
	let { storedMarks } = transaction;
	return {
		...state,
		apply: state.apply.bind(state),
		applyTransaction: state.applyTransaction.bind(state),
		plugins: state.plugins,
		schema: state.schema,
		reconfigure: state.reconfigure.bind(state),
		toJSON: state.toJSON.bind(state),
		get storedMarks() {
			return storedMarks;
		},
		get selection() {
			return selection;
		},
		get doc() {
			return doc;
		},
		get tr() {
			selection = transaction.selection;
			doc = transaction.doc;
			storedMarks = transaction.storedMarks;
			return transaction;
		}
	};
}
var CommandManager = class {
	constructor(props) {
		this.editor = props.editor;
		this.rawCommands = this.editor.extensionManager.commands;
		this.customState = props.state;
	}
	get hasCustomState() {
		return !!this.customState;
	}
	get state() {
		return this.customState || this.editor.state;
	}
	get commands() {
		const { rawCommands, editor, state } = this;
		const { view } = editor;
		const { tr } = state;
		const props = this.buildProps(tr);
		return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
			const method = (...args) => {
				const callback = command2(...args)(props);
				if (!tr.getMeta("preventDispatch") && !this.hasCustomState) view.dispatch(tr);
				return callback;
			};
			return [name, method];
		}));
	}
	get chain() {
		return () => this.createChain();
	}
	get can() {
		return () => this.createCan();
	}
	createChain(startTr, shouldDispatch = true) {
		const { rawCommands, editor, state } = this;
		const { view } = editor;
		const callbacks = [];
		const hasStartTransaction = !!startTr;
		const tr = startTr || state.tr;
		const run3 = () => {
			if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) view.dispatch(tr);
			return callbacks.every((callback) => callback === true);
		};
		const chain = {
			...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
				const chainedCommand = (...args) => {
					const props = this.buildProps(tr, shouldDispatch);
					const callback = command2(...args)(props);
					callbacks.push(callback);
					return chain;
				};
				return [name, chainedCommand];
			})),
			run: run3
		};
		return chain;
	}
	createCan(startTr) {
		const { rawCommands, state } = this;
		const dispatch = false;
		const tr = startTr || state.tr;
		const props = this.buildProps(tr, dispatch);
		return {
			...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
				return [name, (...args) => command2(...args)({
					...props,
					dispatch: void 0
				})];
			})),
			chain: () => this.createChain(tr, dispatch)
		};
	}
	buildProps(tr, shouldDispatch = true) {
		const { rawCommands, editor, state } = this;
		const { view } = editor;
		const props = {
			tr,
			editor,
			view,
			state: createChainableState({
				state,
				transaction: tr
			}),
			dispatch: shouldDispatch ? () => void 0 : void 0,
			chain: () => this.createChain(tr, shouldDispatch),
			can: () => this.createCan(tr),
			get commands() {
				return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
					return [name, (...args) => command2(...args)(props)];
				}));
			}
		};
		return props;
	}
};
var commands_exports = {};
__export$1(commands_exports, {
	blur: () => blur,
	clearContent: () => clearContent,
	clearNodes: () => clearNodes,
	command: () => command,
	createParagraphNear: () => createParagraphNear,
	cut: () => cut,
	deleteCurrentNode: () => deleteCurrentNode,
	deleteNode: () => deleteNode,
	deleteRange: () => deleteRange,
	deleteSelection: () => deleteSelection,
	enter: () => enter,
	exitCode: () => exitCode,
	extendMarkRange: () => extendMarkRange,
	first: () => first,
	focus: () => focus,
	forEach: () => forEach,
	insertContent: () => insertContent,
	insertContentAt: () => insertContentAt,
	joinBackward: () => joinBackward,
	joinDown: () => joinDown,
	joinForward: () => joinForward,
	joinItemBackward: () => joinItemBackward,
	joinItemForward: () => joinItemForward,
	joinTextblockBackward: () => joinTextblockBackward,
	joinTextblockForward: () => joinTextblockForward,
	joinUp: () => joinUp,
	keyboardShortcut: () => keyboardShortcut,
	lift: () => lift,
	liftEmptyBlock: () => liftEmptyBlock,
	liftListItem: () => liftListItem,
	newlineInCode: () => newlineInCode,
	resetAttributes: () => resetAttributes,
	scrollIntoView: () => scrollIntoView,
	selectAll: () => selectAll,
	selectNodeBackward: () => selectNodeBackward,
	selectNodeForward: () => selectNodeForward,
	selectParentNode: () => selectParentNode,
	selectTextblockEnd: () => selectTextblockEnd,
	selectTextblockStart: () => selectTextblockStart,
	setContent: () => setContent,
	setMark: () => setMark,
	setMeta: () => setMeta,
	setNode: () => setNode,
	setNodeSelection: () => setNodeSelection,
	setTextDirection: () => setTextDirection,
	setTextSelection: () => setTextSelection,
	sinkListItem: () => sinkListItem,
	splitBlock: () => splitBlock,
	splitListItem: () => splitListItem,
	toggleList: () => toggleList,
	toggleMark: () => toggleMark,
	toggleNode: () => toggleNode,
	toggleWrap: () => toggleWrap,
	undoInputRule: () => undoInputRule,
	unsetAllMarks: () => unsetAllMarks,
	unsetMark: () => unsetMark,
	unsetTextDirection: () => unsetTextDirection,
	updateAttributes: () => updateAttributes,
	wrapIn: () => wrapIn,
	wrapInList: () => wrapInList
});
var blur = () => ({ editor, view }) => {
	requestAnimationFrame(() => {
		var _a;
		if (!editor.isDestroyed) {
			view.dom.blur();
			(_a = window == null ? void 0 : window.getSelection()) == null || _a.removeAllRanges();
		}
	});
	return true;
};
var clearContent = (emitUpdate = true) => ({ commands }) => {
	return commands.setContent("", { emitUpdate });
};
var clearNodes = () => ({ state, tr, dispatch }) => {
	const { selection } = tr;
	const { ranges } = selection;
	if (!dispatch) return true;
	ranges.forEach(({ $from, $to }) => {
		state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
			if (node.type.isText) return;
			const { doc, mapping } = tr;
			const $mappedFrom = doc.resolve(mapping.map(pos));
			const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
			const nodeRange = $mappedFrom.blockRange($mappedTo);
			if (!nodeRange) return;
			const targetLiftDepth = liftTarget(nodeRange);
			if (node.type.isTextblock) {
				const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
				tr.setNodeMarkup(nodeRange.start, defaultType);
			}
			if (targetLiftDepth || targetLiftDepth === 0) tr.lift(nodeRange, targetLiftDepth);
		});
	});
	return true;
};
var command = (fn) => (props) => {
	return fn(props);
};
var createParagraphNear = () => ({ state, dispatch }) => {
	return createParagraphNear$1(state, dispatch);
};
var cut = (originRange, targetPos) => ({ editor, tr }) => {
	const { state } = editor;
	const contentSlice = state.doc.slice(originRange.from, originRange.to);
	tr.deleteRange(originRange.from, originRange.to);
	const newPos = tr.mapping.map(targetPos);
	tr.insert(newPos, contentSlice.content);
	tr.setSelection(new TextSelection$1(tr.doc.resolve(Math.max(newPos - 1, 0))));
	return true;
};
var deleteCurrentNode = () => ({ tr, dispatch }) => {
	const { selection } = tr;
	const currentNode = selection.$anchor.node();
	if (currentNode.content.size > 0) return false;
	const $pos = tr.selection.$anchor;
	for (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === currentNode.type) {
		if (dispatch) {
			const from = $pos.before(depth);
			const to = $pos.after(depth);
			tr.delete(from, to).scrollIntoView();
		}
		return true;
	}
	return false;
};
function getNodeType(nameOrType, schema) {
	if (typeof nameOrType === "string") {
		if (!schema.nodes[nameOrType]) throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
		return schema.nodes[nameOrType];
	}
	return nameOrType;
}
var deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
	const type = getNodeType(typeOrName, state.schema);
	const $pos = tr.selection.$anchor;
	for (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === type) {
		if (dispatch) {
			const from = $pos.before(depth);
			const to = $pos.after(depth);
			tr.delete(from, to).scrollIntoView();
		}
		return true;
	}
	return false;
};
var deleteRange = (range) => ({ tr, dispatch }) => {
	const { from, to } = range;
	if (dispatch) tr.delete(from, to);
	return true;
};
var hasTextContent = (nodeSpec) => {
	if (!nodeSpec.content) return false;
	return /^text(\*|\+)/.test(nodeSpec.content);
};
var expandSelectionForSide = ($pos, schema, side) => {
	if (!$pos.parent.isInline) return $pos.pos;
	if (side === "left" && $pos.pos > $pos.start() || side === "right" && $pos.pos < $pos.end()) return $pos.pos;
	const parentContent = schema.nodes[$pos.parent.type.name].spec;
	if (!hasTextContent(parentContent)) return $pos.pos;
	return side === "left" ? $pos.start() - 1 : $pos.end() + 1;
};
var expandSelectionForInlineText = ($from, $to, schema) => {
	return {
		from: expandSelectionForSide($from, schema, "left"),
		to: expandSelectionForSide($to, schema, "right")
	};
};
var deleteSelection = () => ({ state, dispatch }) => {
	const { $from, $to } = state.selection;
	if (state.selection.empty) return false;
	const { from, to } = expandSelectionForInlineText($from, $to, state.schema);
	if (dispatch) {
		state.tr.deleteRange(from, to).scrollIntoView();
		dispatch(state.tr);
	}
	return true;
};
var enter = () => ({ commands }) => {
	return commands.keyboardShortcut("Enter");
};
var exitCode = () => ({ state, dispatch }) => {
	return exitCode$1(state, dispatch);
};
function isRegExp(value) {
	return Object.prototype.toString.call(value) === "[object RegExp]";
}
function objectIncludes(object1, object2, options = { strict: true }) {
	const keys = Object.keys(object2);
	if (!keys.length) return true;
	return keys.every((key) => {
		if (options.strict) return object2[key] === object1[key];
		if (isRegExp(object2[key])) return object2[key].test(object1[key]);
		return object2[key] === object1[key];
	});
}
function findMarkInSet(marks, type, attributes = {}) {
	return marks.find((item) => {
		return item.type === type && objectIncludes(Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])), attributes);
	});
}
function isMarkInSet(marks, type, attributes = {}) {
	return !!findMarkInSet(marks, type, attributes);
}
function getMarkRange($pos, type, attributes) {
	if (!$pos || !type) return;
	let start = $pos.parent.childAfter($pos.parentOffset);
	if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) start = $pos.parent.childBefore($pos.parentOffset);
	if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) return;
	if (!attributes) {
		const firstMark = start.node.marks.find((mark2) => mark2.type === type);
		if (firstMark) attributes = firstMark.attrs;
	}
	if (!findMarkInSet([...start.node.marks], type, attributes)) return;
	let startIndex = start.index;
	let startPos = $pos.start() + start.offset;
	let endIndex = startIndex + 1;
	let endPos = startPos + start.node.nodeSize;
	while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
		startIndex -= 1;
		startPos -= $pos.parent.child(startIndex).nodeSize;
	}
	while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
		endPos += $pos.parent.child(endIndex).nodeSize;
		endIndex += 1;
	}
	return {
		from: startPos,
		to: endPos
	};
}
function getMarkType(nameOrType, schema) {
	if (typeof nameOrType === "string") {
		if (!schema.marks[nameOrType]) throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
		return schema.marks[nameOrType];
	}
	return nameOrType;
}
var extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
	const type = getMarkType(typeOrName, state.schema);
	const { doc, selection } = tr;
	const { $from, from, to } = selection;
	if (dispatch) {
		const range = getMarkRange($from, type, attributes);
		if (range && range.from <= from && range.to >= to) {
			const newSelection = TextSelection$1.create(doc, range.from, range.to);
			tr.setSelection(newSelection);
		}
	}
	return true;
};
var first = (commands) => (props) => {
	const items = typeof commands === "function" ? commands(props) : commands;
	for (let i = 0; i < items.length; i += 1) if (items[i](props)) return true;
	return false;
};
function isTextSelection(value) {
	return value instanceof TextSelection$1;
}
function minMax(value = 0, min = 0, max = 0) {
	return Math.min(Math.max(value, min), max);
}
function resolveFocusPosition(doc, position = null) {
	if (!position) return null;
	const selectionAtStart = Selection$2.atStart(doc);
	const selectionAtEnd = Selection$2.atEnd(doc);
	if (position === "start" || position === true) return selectionAtStart;
	if (position === "end") return selectionAtEnd;
	const minPos = selectionAtStart.from;
	const maxPos = selectionAtEnd.to;
	if (position === "all") return TextSelection$1.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
	return TextSelection$1.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
}
function isAndroid() {
	return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
}
function isiOS() {
	return [
		"iPad Simulator",
		"iPhone Simulator",
		"iPod Simulator",
		"iPad",
		"iPhone",
		"iPod"
	].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
}
function isSafari() {
	return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
}
var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
	options = {
		scrollIntoView: true,
		...options
	};
	const delayedFocus = () => {
		if (isiOS() || isAndroid()) view.dom.focus();
		if (isSafari() && !isiOS() && !isAndroid()) view.dom.focus({ preventScroll: true });
		requestAnimationFrame(() => {
			if (!editor.isDestroyed) {
				view.focus();
				if (options == null ? void 0 : options.scrollIntoView) editor.commands.scrollIntoView();
			}
		});
	};
	try {
		if (view.hasFocus() && position === null || position === false) return true;
	} catch {
		return false;
	}
	if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
		delayedFocus();
		return true;
	}
	const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
	const isSameSelection = editor.state.selection.eq(selection);
	if (dispatch) {
		if (!isSameSelection) tr.setSelection(selection);
		if (isSameSelection && tr.storedMarks) tr.setStoredMarks(tr.storedMarks);
		delayedFocus();
	}
	return true;
};
var forEach = (items, fn) => (props) => {
	return items.every((item, index) => fn(item, {
		...props,
		index
	}));
};
var insertContent = (value, options) => ({ tr, commands }) => {
	return commands.insertContentAt({
		from: tr.selection.from,
		to: tr.selection.to
	}, value, options);
};
var removeWhitespaces = (node) => {
	const children = node.childNodes;
	for (let i = children.length - 1; i >= 0; i -= 1) {
		const child = children[i];
		if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) node.removeChild(child);
		else if (child.nodeType === 1) removeWhitespaces(child);
	}
	return node;
};
function elementFromString(value) {
	if (typeof window === "undefined") throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
	const wrappedValue = `<body>${value}</body>`;
	const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
	return removeWhitespaces(html);
}
function createNodeFromContent(content, schema, options) {
	if (content instanceof Node$1 || content instanceof Fragment$1) return content;
	options = {
		slice: true,
		parseOptions: {},
		...options
	};
	const isJSONContent = typeof content === "object" && content !== null;
	const isTextContent = typeof content === "string";
	if (isJSONContent) try {
		if (Array.isArray(content) && content.length > 0) return Fragment$1.fromArray(content.map((item) => schema.nodeFromJSON(item)));
		const node = schema.nodeFromJSON(content);
		if (options.errorOnInvalidContent) node.check();
		return node;
	} catch (error) {
		if (options.errorOnInvalidContent) throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
		console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
		return createNodeFromContent("", schema, options);
	}
	if (isTextContent) {
		if (options.errorOnInvalidContent) {
			let hasInvalidContent = false;
			let invalidContent = "";
			const contentCheckSchema = new Schema({
				topNode: schema.spec.topNode,
				marks: schema.spec.marks,
				nodes: schema.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
					content: "inline*",
					group: "block",
					parseDOM: [{
						tag: "*",
						getAttrs: (e) => {
							hasInvalidContent = true;
							invalidContent = typeof e === "string" ? e : e.outerHTML;
							return null;
						}
					}]
				} })
			});
			if (options.slice) DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
			else DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
			if (options.errorOnInvalidContent && hasInvalidContent) throw new Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ new Error(`Invalid element found: ${invalidContent}`) });
		}
		const parser = DOMParser.fromSchema(schema);
		if (options.slice) return parser.parseSlice(elementFromString(content), options.parseOptions).content;
		return parser.parse(elementFromString(content), options.parseOptions);
	}
	return createNodeFromContent("", schema, options);
}
function selectionToInsertionEnd$1(tr, startLen, bias) {
	const last = tr.steps.length - 1;
	if (last < startLen) return;
	const step = tr.steps[last];
	if (!(step instanceof ReplaceStep$1 || step instanceof ReplaceAroundStep$1)) return;
	const map = tr.mapping.maps[last];
	let end = 0;
	map.forEach((_from, _to, _newFrom, newTo) => {
		if (end === 0) end = newTo;
	});
	tr.setSelection(Selection$2.near(tr.doc.resolve(end), bias));
}
var isFragment = (nodeOrFragment) => {
	return !("type" in nodeOrFragment);
};
var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
	var _a;
	if (dispatch) {
		options = {
			parseOptions: editor.options.parseOptions,
			updateSelection: true,
			applyInputRules: false,
			applyPasteRules: false,
			...options
		};
		let content;
		const emitContentError = (error) => {
			editor.emit("contentError", {
				editor,
				error,
				disableCollaboration: () => {
					if ("collaboration" in editor.storage && typeof editor.storage.collaboration === "object" && editor.storage.collaboration) editor.storage.collaboration.isDisabled = true;
				}
			});
		};
		const parseOptions = {
			preserveWhitespace: "full",
			...options.parseOptions
		};
		if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) try {
			createNodeFromContent(value, editor.schema, {
				parseOptions,
				errorOnInvalidContent: true
			});
		} catch (e) {
			emitContentError(e);
		}
		try {
			content = createNodeFromContent(value, editor.schema, {
				parseOptions,
				errorOnInvalidContent: (_a = options.errorOnInvalidContent) != null ? _a : editor.options.enableContentCheck
			});
		} catch (e) {
			emitContentError(e);
			return false;
		}
		let { from, to } = typeof position === "number" ? {
			from: position,
			to: position
		} : {
			from: position.from,
			to: position.to
		};
		let isOnlyTextContent = true;
		let isOnlyBlockContent = true;
		(isFragment(content) ? content : [content]).forEach((node) => {
			node.check();
			isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
			isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
		});
		if (from === to && isOnlyBlockContent) {
			const { parent } = tr.doc.resolve(from);
			if (parent.isTextblock && !parent.type.spec.code && !parent.childCount) {
				from -= 1;
				to += 1;
			}
		}
		let newContent;
		if (isOnlyTextContent) {
			if (Array.isArray(value)) newContent = value.map((v) => v.text || "").join("");
			else if (value instanceof Fragment$1) {
				let text = "";
				value.forEach((node) => {
					if (node.text) text += node.text;
				});
				newContent = text;
			} else if (typeof value === "object" && !!value && !!value.text) newContent = value.text;
			else newContent = value;
			tr.insertText(newContent, from, to);
		} else {
			newContent = content;
			const $from = tr.doc.resolve(from);
			const $fromNode = $from.node();
			const fromSelectionAtStart = $from.parentOffset === 0;
			const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
			const hasContent = $fromNode.content.size > 0;
			if (fromSelectionAtStart && isTextSelection2 && hasContent && isOnlyBlockContent) from = Math.max(0, from - 1);
			tr.replaceWith(from, to, newContent);
		}
		if (options.updateSelection) selectionToInsertionEnd$1(tr, tr.steps.length - 1, -1);
		if (options.applyInputRules) tr.setMeta("applyInputRules", {
			from,
			text: newContent
		});
		if (options.applyPasteRules) tr.setMeta("applyPasteRules", {
			from,
			text: newContent
		});
	}
	return true;
};
var joinUp = () => ({ state, dispatch }) => {
	return joinUp$1(state, dispatch);
};
var joinDown = () => ({ state, dispatch }) => {
	return joinDown$1(state, dispatch);
};
var joinBackward = () => ({ state, dispatch }) => {
	return joinBackward$1(state, dispatch);
};
var joinForward = () => ({ state, dispatch }) => {
	return joinForward$1(state, dispatch);
};
var joinItemBackward = () => ({ state, dispatch, tr }) => {
	try {
		const point = joinPoint(state.doc, state.selection.$from.pos, -1);
		if (point === null || point === void 0) return false;
		tr.join(point, 2);
		if (dispatch) dispatch(tr);
		return true;
	} catch {
		return false;
	}
};
var joinItemForward = () => ({ state, dispatch, tr }) => {
	try {
		const point = joinPoint(state.doc, state.selection.$from.pos, 1);
		if (point === null || point === void 0) return false;
		tr.join(point, 2);
		if (dispatch) dispatch(tr);
		return true;
	} catch {
		return false;
	}
};
var joinTextblockBackward = () => ({ state, dispatch }) => {
	return joinTextblockBackward$1(state, dispatch);
};
var joinTextblockForward = () => ({ state, dispatch }) => {
	return joinTextblockForward$1(state, dispatch);
};
function isMacOS() {
	return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
}
function normalizeKeyName(name) {
	const parts = name.split(/-(?!$)/);
	let result = parts[parts.length - 1];
	if (result === "Space") result = " ";
	let alt;
	let ctrl;
	let shift;
	let meta;
	for (let i = 0; i < parts.length - 1; i += 1) {
		const mod = parts[i];
		if (/^(cmd|meta|m)$/i.test(mod)) meta = true;
		else if (/^a(lt)?$/i.test(mod)) alt = true;
		else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;
		else if (/^s(hift)?$/i.test(mod)) shift = true;
		else if (/^mod$/i.test(mod)) if (isiOS() || isMacOS()) meta = true;
		else ctrl = true;
		else throw new Error(`Unrecognized modifier name: ${mod}`);
	}
	if (alt) result = `Alt-${result}`;
	if (ctrl) result = `Ctrl-${result}`;
	if (meta) result = `Meta-${result}`;
	if (shift) result = `Shift-${result}`;
	return result;
}
var keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
	const keys = normalizeKeyName(name).split(/-(?!$)/);
	const key = keys.find((item) => ![
		"Alt",
		"Ctrl",
		"Meta",
		"Shift"
	].includes(item));
	const event = new KeyboardEvent("keydown", {
		key: key === "Space" ? " " : key,
		altKey: keys.includes("Alt"),
		ctrlKey: keys.includes("Ctrl"),
		metaKey: keys.includes("Meta"),
		shiftKey: keys.includes("Shift"),
		bubbles: true,
		cancelable: true
	});
	editor.captureTransaction(() => {
		view.someProp("handleKeyDown", (f) => f(view, event));
	})?.steps.forEach((step) => {
		const newStep = step.map(tr.mapping);
		if (newStep && dispatch) tr.maybeStep(newStep);
	});
	return true;
};
function isNodeActive(state, typeOrName, attributes = {}) {
	const { from, to, empty } = state.selection;
	const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
	const nodeRanges = [];
	state.doc.nodesBetween(from, to, (node, pos) => {
		if (node.isText) return;
		const relativeFrom = Math.max(from, pos);
		const relativeTo = Math.min(to, pos + node.nodeSize);
		nodeRanges.push({
			node,
			from: relativeFrom,
			to: relativeTo
		});
	});
	const selectionRange = to - from;
	const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
		if (!type) return true;
		return type.name === nodeRange.node.type.name;
	}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
	if (empty) return !!matchedNodeRanges.length;
	return matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0) >= selectionRange;
}
var lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
	if (!isNodeActive(state, getNodeType(typeOrName, state.schema), attributes)) return false;
	return lift$1(state, dispatch);
};
var liftEmptyBlock = () => ({ state, dispatch }) => {
	return liftEmptyBlock$1(state, dispatch);
};
var liftListItem = (typeOrName) => ({ state, dispatch }) => {
	return liftListItem$1(getNodeType(typeOrName, state.schema))(state, dispatch);
};
var newlineInCode = () => ({ state, dispatch }) => {
	return newlineInCode$1(state, dispatch);
};
function getSchemaTypeNameByName(name, schema) {
	if (schema.nodes[name]) return "node";
	if (schema.marks[name]) return "mark";
	return null;
}
function deleteProps(obj, propOrProps) {
	const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
	return Object.keys(obj).reduce((newObj, prop) => {
		if (!props.includes(prop)) newObj[prop] = obj[prop];
		return newObj;
	}, {});
}
var resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
	let nodeType = null;
	let markType = null;
	const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
	if (!schemaType) return false;
	if (schemaType === "node") nodeType = getNodeType(typeOrName, state.schema);
	if (schemaType === "mark") markType = getMarkType(typeOrName, state.schema);
	let canReset = false;
	tr.selection.ranges.forEach((range) => {
		state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
			if (nodeType && nodeType === node.type) {
				canReset = true;
				if (dispatch) tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
			}
			if (markType && node.marks.length) node.marks.forEach((mark) => {
				if (markType === mark.type) {
					canReset = true;
					if (dispatch) tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
				}
			});
		});
	});
	return canReset;
};
var scrollIntoView = () => ({ tr, dispatch }) => {
	if (dispatch) tr.scrollIntoView();
	return true;
};
var selectAll = () => ({ tr, dispatch }) => {
	if (dispatch) {
		const selection = new AllSelection$1(tr.doc);
		tr.setSelection(selection);
	}
	return true;
};
var selectNodeBackward = () => ({ state, dispatch }) => {
	return selectNodeBackward$1(state, dispatch);
};
var selectNodeForward = () => ({ state, dispatch }) => {
	return selectNodeForward$1(state, dispatch);
};
var selectParentNode = () => ({ state, dispatch }) => {
	return selectParentNode$1(state, dispatch);
};
var selectTextblockEnd = () => ({ state, dispatch }) => {
	return selectTextblockEnd$1(state, dispatch);
};
var selectTextblockStart = () => ({ state, dispatch }) => {
	return selectTextblockStart$1(state, dispatch);
};
function createDocument(content, schema, parseOptions = {}, options = {}) {
	return createNodeFromContent(content, schema, {
		slice: false,
		parseOptions,
		errorOnInvalidContent: options.errorOnInvalidContent
	});
}
var setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {
	const { doc } = tr;
	if (parseOptions.preserveWhitespace !== "full") {
		const document2 = createDocument(content, editor.schema, parseOptions, { errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck });
		if (dispatch) tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
		return true;
	}
	if (dispatch) tr.setMeta("preventUpdate", !emitUpdate);
	return commands.insertContentAt({
		from: 0,
		to: doc.content.size
	}, content, {
		parseOptions,
		errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck
	});
};
function getMarkAttributes(state, typeOrName) {
	const type = getMarkType(typeOrName, state.schema);
	const { from, to, empty } = state.selection;
	const marks = [];
	if (empty) {
		if (state.storedMarks) marks.push(...state.storedMarks);
		marks.push(...state.selection.$head.marks());
	} else state.doc.nodesBetween(from, to, (node) => {
		marks.push(...node.marks);
	});
	const mark = marks.find((markItem) => markItem.type.name === type.name);
	if (!mark) return {};
	return { ...mark.attrs };
}
function combineTransactionSteps(oldDoc, transactions) {
	const transform = new Transform(oldDoc);
	transactions.forEach((transaction) => {
		transaction.steps.forEach((step) => {
			transform.step(step);
		});
	});
	return transform;
}
function defaultBlockAt(match) {
	for (let i = 0; i < match.edgeCount; i += 1) {
		const { type } = match.edge(i);
		if (type.isTextblock && !type.hasRequiredAttrs()) return type;
	}
	return null;
}
function findChildren(node, predicate) {
	const nodesWithPos = [];
	node.descendants((child, pos) => {
		if (predicate(child)) nodesWithPos.push({
			node: child,
			pos
		});
	});
	return nodesWithPos;
}
function findChildrenInRange(node, range, predicate) {
	const nodesWithPos = [];
	node.nodesBetween(range.from, range.to, (child, pos) => {
		if (predicate(child)) nodesWithPos.push({
			node: child,
			pos
		});
	});
	return nodesWithPos;
}
function findParentNodeClosestToPos($pos, predicate) {
	for (let i = $pos.depth; i > 0; i -= 1) {
		const node = $pos.node(i);
		if (predicate(node)) return {
			pos: i > 0 ? $pos.before(i) : 0,
			start: $pos.start(i),
			depth: i,
			node
		};
	}
}
function findParentNode(predicate) {
	return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
}
function getExtensionField(extension, field, context) {
	if (extension.config[field] === void 0 && extension.parent) return getExtensionField(extension.parent, field, context);
	if (typeof extension.config[field] === "function") return extension.config[field].bind({
		...context,
		parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
	});
	return extension.config[field];
}
function flattenExtensions(extensions) {
	return extensions.map((extension) => {
		const addExtensions = getExtensionField(extension, "addExtensions", {
			name: extension.name,
			options: extension.options,
			storage: extension.storage
		});
		if (addExtensions) return [extension, ...flattenExtensions(addExtensions())];
		return extension;
	}).flat(10);
}
function getHTMLFromFragment(fragment, schema) {
	const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);
	const container = document.implementation.createHTMLDocument().createElement("div");
	container.appendChild(documentFragment);
	return container.innerHTML;
}
function isFunction$1(value) {
	return typeof value === "function";
}
function callOrReturn(value, context = void 0, ...props) {
	if (isFunction$1(value)) {
		if (context) return value.bind(context)(...props);
		return value(...props);
	}
	return value;
}
function isEmptyObject(value = {}) {
	return Object.keys(value).length === 0 && value.constructor === Object;
}
function splitExtensions(extensions) {
	return {
		baseExtensions: extensions.filter((extension) => extension.type === "extension"),
		nodeExtensions: extensions.filter((extension) => extension.type === "node"),
		markExtensions: extensions.filter((extension) => extension.type === "mark")
	};
}
function getAttributesFromExtensions(extensions) {
	const extensionAttributes = [];
	const { nodeExtensions, markExtensions } = splitExtensions(extensions);
	const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];
	const defaultAttribute = {
		default: null,
		validate: void 0,
		rendered: true,
		renderHTML: null,
		parseHTML: null,
		keepOnSplit: true,
		isRequired: false
	};
	const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
	const markExtensionTypes = markExtensions.map((ext) => ext.name);
	const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
	extensions.forEach((extension) => {
		const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", {
			name: extension.name,
			options: extension.options,
			storage: extension.storage,
			extensions: nodeAndMarkExtensions
		});
		if (!addGlobalAttributes) return;
		addGlobalAttributes().forEach((globalAttribute) => {
			let resolvedTypes;
			if (Array.isArray(globalAttribute.types)) resolvedTypes = globalAttribute.types;
			else if (globalAttribute.types === "*") resolvedTypes = allExtensionTypes;
			else if (globalAttribute.types === "nodes") resolvedTypes = nodeExtensionTypes;
			else if (globalAttribute.types === "marks") resolvedTypes = markExtensionTypes;
			else resolvedTypes = [];
			resolvedTypes.forEach((type) => {
				Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
					extensionAttributes.push({
						type,
						name,
						attribute: {
							...defaultAttribute,
							...attribute
						}
					});
				});
			});
		});
	});
	nodeAndMarkExtensions.forEach((extension) => {
		const addAttributes = getExtensionField(extension, "addAttributes", {
			name: extension.name,
			options: extension.options,
			storage: extension.storage
		});
		if (!addAttributes) return;
		const attributes = addAttributes();
		Object.entries(attributes).forEach(([name, attribute]) => {
			const mergedAttr = {
				...defaultAttribute,
				...attribute
			};
			if (typeof (mergedAttr == null ? void 0 : mergedAttr.default) === "function") mergedAttr.default = mergedAttr.default();
			if ((mergedAttr == null ? void 0 : mergedAttr.isRequired) && (mergedAttr == null ? void 0 : mergedAttr.default) === void 0) delete mergedAttr.default;
			extensionAttributes.push({
				type: extension.name,
				name,
				attribute: mergedAttr
			});
		});
	});
	return extensionAttributes;
}
function splitStyleDeclarations(styles) {
	const result = [];
	let current = "";
	let inSingleQuote = false;
	let inDoubleQuote = false;
	let parenDepth = 0;
	const length = styles.length;
	for (let i = 0; i < length; i += 1) {
		const char = styles[i];
		if (char === "'" && !inDoubleQuote) {
			inSingleQuote = !inSingleQuote;
			current += char;
			continue;
		}
		if (char === "\"" && !inSingleQuote) {
			inDoubleQuote = !inDoubleQuote;
			current += char;
			continue;
		}
		if (!inSingleQuote && !inDoubleQuote) {
			if (char === "(") {
				parenDepth += 1;
				current += char;
				continue;
			}
			if (char === ")" && parenDepth > 0) {
				parenDepth -= 1;
				current += char;
				continue;
			}
			if (char === ";" && parenDepth === 0) {
				result.push(current);
				current = "";
				continue;
			}
		}
		current += char;
	}
	if (current) result.push(current);
	return result;
}
function parseStyleEntries(styles) {
	const pairs = [];
	const declarations = splitStyleDeclarations(styles || "");
	const numDeclarations = declarations.length;
	for (let i = 0; i < numDeclarations; i += 1) {
		const declaration = declarations[i];
		const firstColonIndex = declaration.indexOf(":");
		if (firstColonIndex === -1) continue;
		const property = declaration.slice(0, firstColonIndex).trim();
		const value = declaration.slice(firstColonIndex + 1).trim();
		if (property && value) pairs.push([property, value]);
	}
	return pairs;
}
function mergeAttributes(...objects) {
	return objects.filter((item) => !!item).reduce((items, item) => {
		const mergedAttributes = { ...items };
		Object.entries(item).forEach(([key, value]) => {
			if (!mergedAttributes[key]) {
				mergedAttributes[key] = value;
				return;
			}
			if (key === "class") {
				const valueClasses = value ? String(value).split(" ") : [];
				const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
				const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
				mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
			} else if (key === "style") {
				const styleMap = new Map([...parseStyleEntries(mergedAttributes[key]), ...parseStyleEntries(value)]);
				mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
			} else mergedAttributes[key] = value;
		});
		return mergedAttributes;
	}, {});
}
function getRenderedAttributes(nodeOrMark, extensionAttributes) {
	return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {
		if (!item.attribute.renderHTML) return { [item.name]: nodeOrMark.attrs[item.name] };
		return item.attribute.renderHTML(nodeOrMark.attrs) || {};
	}).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});
}
function fromString(value) {
	if (typeof value !== "string") return value;
	if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) return Number(value);
	if (value === "true") return true;
	if (value === "false") return false;
	return value;
}
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
	if ("style" in parseRule) return parseRule;
	return {
		...parseRule,
		getAttrs: (node) => {
			const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;
			if (oldAttributes === false) return false;
			const newAttributes = extensionAttributes.reduce((items, item) => {
				const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));
				if (value === null || value === void 0) return items;
				return {
					...items,
					[item.name]: value
				};
			}, {});
			return {
				...oldAttributes,
				...newAttributes
			};
		}
	};
}
function cleanUpSchemaItem(data) {
	return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
		if (key === "attrs" && isEmptyObject(value)) return false;
		return value !== null && value !== void 0;
	}));
}
function buildAttributeSpec(extensionAttribute) {
	var _a, _b;
	const spec = {};
	if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && "default" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) spec.default = extensionAttribute.attribute.default;
	if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) spec.validate = extensionAttribute.attribute.validate;
	return [extensionAttribute.name, spec];
}
function getSchemaByResolvedExtensions(extensions, editor) {
	var _a;
	const allAttributes = getAttributesFromExtensions(extensions);
	const { nodeExtensions, markExtensions } = splitExtensions(extensions);
	return new Schema({
		topNode: (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) == null ? void 0 : _a.name,
		nodes: Object.fromEntries(nodeExtensions.map((extension) => {
			const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
			const context = {
				name: extension.name,
				options: extension.options,
				storage: extension.storage,
				editor
			};
			const schema = cleanUpSchemaItem({
				...extensions.reduce((fields, e) => {
					const extendNodeSchema = getExtensionField(e, "extendNodeSchema", context);
					return {
						...fields,
						...extendNodeSchema ? extendNodeSchema(extension) : {}
					};
				}, {}),
				content: callOrReturn(getExtensionField(extension, "content", context)),
				marks: callOrReturn(getExtensionField(extension, "marks", context)),
				group: callOrReturn(getExtensionField(extension, "group", context)),
				inline: callOrReturn(getExtensionField(extension, "inline", context)),
				atom: callOrReturn(getExtensionField(extension, "atom", context)),
				selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
				draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
				code: callOrReturn(getExtensionField(extension, "code", context)),
				whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
				linebreakReplacement: callOrReturn(getExtensionField(extension, "linebreakReplacement", context)),
				defining: callOrReturn(getExtensionField(extension, "defining", context)),
				isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
				attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
			});
			const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
			if (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
			const renderHTML = getExtensionField(extension, "renderHTML", context);
			if (renderHTML) schema.toDOM = (node) => renderHTML({
				node,
				HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
			});
			const renderText = getExtensionField(extension, "renderText", context);
			if (renderText) schema.toText = renderText;
			return [extension.name, schema];
		})),
		marks: Object.fromEntries(markExtensions.map((extension) => {
			const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
			const context = {
				name: extension.name,
				options: extension.options,
				storage: extension.storage,
				editor
			};
			const schema = cleanUpSchemaItem({
				...extensions.reduce((fields, e) => {
					const extendMarkSchema = getExtensionField(e, "extendMarkSchema", context);
					return {
						...fields,
						...extendMarkSchema ? extendMarkSchema(extension) : {}
					};
				}, {}),
				inclusive: callOrReturn(getExtensionField(extension, "inclusive", context)),
				excludes: callOrReturn(getExtensionField(extension, "excludes", context)),
				group: callOrReturn(getExtensionField(extension, "group", context)),
				spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
				code: callOrReturn(getExtensionField(extension, "code", context)),
				attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
			});
			const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
			if (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
			const renderHTML = getExtensionField(extension, "renderHTML", context);
			if (renderHTML) schema.toDOM = (mark) => renderHTML({
				mark,
				HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)
			});
			return [extension.name, schema];
		}))
	});
}
function findDuplicates(items) {
	const filtered = items.filter((el, index) => items.indexOf(el) !== index);
	return Array.from(new Set(filtered));
}
function sortExtensions(extensions) {
	const defaultPriority = 100;
	return extensions.sort((a, b) => {
		const priorityA = getExtensionField(a, "priority") || defaultPriority;
		const priorityB = getExtensionField(b, "priority") || defaultPriority;
		if (priorityA > priorityB) return -1;
		if (priorityA < priorityB) return 1;
		return 0;
	});
}
function resolveExtensions(extensions) {
	const resolvedExtensions = sortExtensions(flattenExtensions(extensions));
	const duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));
	if (duplicatedNames.length) console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(", ")}]. This can lead to issues.`);
	return resolvedExtensions;
}
function getTextBetween(startNode, range, options) {
	const { from, to } = range;
	const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
	let text = "";
	startNode.nodesBetween(from, to, (node, pos, parent, index) => {
		var _a;
		if (node.isBlock && pos > from) text += blockSeparator;
		const textSerializer = textSerializers == null ? void 0 : textSerializers[node.type.name];
		if (textSerializer) {
			if (parent) text += textSerializer({
				node,
				pos,
				parent,
				index,
				range
			});
			return false;
		}
		if (node.isText) text += (_a = node == null ? void 0 : node.text) == null ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
	});
	return text;
}
function getText(node, options) {
	return getTextBetween(node, {
		from: 0,
		to: node.content.size
	}, options);
}
function getTextSerializersFromSchema(schema) {
	return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));
}
function getNodeAttributes(state, typeOrName) {
	const type = getNodeType(typeOrName, state.schema);
	const { from, to } = state.selection;
	const nodes = [];
	state.doc.nodesBetween(from, to, (node2) => {
		nodes.push(node2);
	});
	const node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);
	if (!node) return {};
	return { ...node.attrs };
}
function getAttributes(state, typeOrName) {
	const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
	if (schemaType === "node") return getNodeAttributes(state, typeOrName);
	if (schemaType === "mark") return getMarkAttributes(state, typeOrName);
	return {};
}
function removeDuplicates(array, by = JSON.stringify) {
	const seen = {};
	return array.filter((item) => {
		const key = by(item);
		return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;
	});
}
function simplifyChangedRanges(changes) {
	const uniqueChanges = removeDuplicates(changes);
	return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
		return !uniqueChanges.filter((_, i) => i !== index).some((otherChange) => {
			return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
		});
	});
}
function getChangedRanges(transform) {
	const { mapping, steps } = transform;
	const changes = [];
	mapping.maps.forEach((stepMap, index) => {
		const ranges = [];
		if (!stepMap.ranges.length) {
			const { from, to } = steps[index];
			if (from === void 0 || to === void 0) return;
			ranges.push({
				from,
				to
			});
		} else stepMap.forEach((from, to) => {
			ranges.push({
				from,
				to
			});
		});
		ranges.forEach(({ from, to }) => {
			const newStart = mapping.slice(index).map(from, -1);
			const newEnd = mapping.slice(index).map(to);
			const oldStart = mapping.invert().map(newStart, -1);
			const oldEnd = mapping.invert().map(newEnd);
			changes.push({
				oldRange: {
					from: oldStart,
					to: oldEnd
				},
				newRange: {
					from: newStart,
					to: newEnd
				}
			});
		});
	});
	return simplifyChangedRanges(changes);
}
function getMarksBetween(from, to, doc) {
	const marks = [];
	if (from === to) doc.resolve(from).marks().forEach((mark) => {
		const range = getMarkRange(doc.resolve(from), mark.type);
		if (!range) return;
		marks.push({
			mark,
			...range
		});
	});
	else doc.nodesBetween(from, to, (node, pos) => {
		if (!node || (node == null ? void 0 : node.nodeSize) === void 0) return;
		marks.push(...node.marks.map((mark) => ({
			from: pos,
			to: pos + node.nodeSize,
			mark
		})));
	});
	return marks;
}
var getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {
	const $pos = state.doc.resolve(pos);
	let currentDepth = maxDepth;
	let node = null;
	while (currentDepth > 0 && node === null) {
		const currentNode = $pos.node(currentDepth);
		if ((currentNode == null ? void 0 : currentNode.type.name) === typeOrName) node = currentNode;
		else currentDepth -= 1;
	}
	return [node, currentDepth];
};
function getSchemaTypeByName(name, schema) {
	return schema.nodes[name] || schema.marks[name] || null;
}
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
	return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
		const extensionAttribute = extensionAttributes.find((item) => {
			return item.type === typeName && item.name === name;
		});
		if (!extensionAttribute) return false;
		return extensionAttribute.attribute.keepOnSplit;
	}));
}
var getTextContentFromNodes = ($from, maxMatch = 500) => {
	let textBefore = "";
	const sliceEndPos = $from.parentOffset;
	$from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
		var _a, _b;
		const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {
			node,
			pos,
			parent,
			index
		})) || node.textContent || "%leaf%";
		textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
	});
	return textBefore;
};
function isMarkActive(state, typeOrName, attributes = {}) {
	const { empty, ranges } = state.selection;
	const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
	if (empty) return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
		if (!type) return true;
		return type.name === mark.type.name;
	}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
	let selectionRange = 0;
	const markRanges = [];
	ranges.forEach(({ $from, $to }) => {
		const from = $from.pos;
		const to = $to.pos;
		state.doc.nodesBetween(from, to, (node, pos) => {
			if (type && node.inlineContent && !node.type.allowsMarkType(type)) return false;
			if (!node.isText && !node.marks.length) return;
			const relativeFrom = Math.max(from, pos);
			const relativeTo = Math.min(to, pos + node.nodeSize);
			const range2 = relativeTo - relativeFrom;
			selectionRange += range2;
			markRanges.push(...node.marks.map((mark) => ({
				mark,
				from: relativeFrom,
				to: relativeTo
			})));
		});
	});
	if (selectionRange === 0) return false;
	const matchedRange = markRanges.filter((markRange) => {
		if (!type) return true;
		return type.name === markRange.mark.type.name;
	}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
	const excludedRange = markRanges.filter((markRange) => {
		if (!type) return true;
		return markRange.mark.type !== type && markRange.mark.type.excludes(type);
	}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
	return (matchedRange > 0 ? matchedRange + excludedRange : matchedRange) >= selectionRange;
}
function isActive(state, name, attributes = {}) {
	if (!name) return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);
	const schemaType = getSchemaTypeNameByName(name, state.schema);
	if (schemaType === "node") return isNodeActive(state, name, attributes);
	if (schemaType === "mark") return isMarkActive(state, name, attributes);
	return false;
}
var isAtEndOfNode = (state, nodeType) => {
	const { $from, $to, $anchor } = state.selection;
	if (nodeType) {
		const parentNode = findParentNode((node) => node.type.name === nodeType)(state.selection);
		if (!parentNode) return false;
		const $parentPos = state.doc.resolve(parentNode.pos + 1);
		if ($anchor.pos + 1 === $parentPos.end()) return true;
		return false;
	}
	if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) return false;
	return true;
};
var isAtStartOfNode = (state) => {
	const { $from, $to } = state.selection;
	if ($from.parentOffset > 0 || $from.pos !== $to.pos) return false;
	return true;
};
function isExtensionRulesEnabled(extension, enabled) {
	if (Array.isArray(enabled)) return enabled.some((enabledExtension) => {
		return (typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name) === extension.name;
	});
	return enabled;
}
function isList(name, extensions) {
	const { nodeExtensions } = splitExtensions(extensions);
	const extension = nodeExtensions.find((item) => item.name === name);
	if (!extension) return false;
	const group = callOrReturn(getExtensionField(extension, "group", {
		name: extension.name,
		options: extension.options,
		storage: extension.storage
	}));
	if (typeof group !== "string") return false;
	return group.split(" ").includes("list");
}
function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {
	var _a;
	if (ignoreWhitespace) {
		if (node.type.name === "hardBreak") return true;
		if (node.isText) return !/\S/.test((_a = node.text) != null ? _a : "");
	}
	if (node.isText) return !node.text;
	if (node.isAtom || node.isLeaf) return false;
	if (node.content.childCount === 0) return true;
	if (checkChildren) {
		let isContentEmpty = true;
		node.content.forEach((childNode) => {
			if (isContentEmpty === false) return;
			if (!isNodeEmpty(childNode, {
				ignoreWhitespace,
				checkChildren
			})) isContentEmpty = false;
		});
		return isContentEmpty;
	}
	return false;
}
function isNodeSelection(value) {
	return value instanceof NodeSelection$1;
}
var MappablePosition = class _MappablePosition {
	constructor(position) {
		this.position = position;
	}
	/**
	* Creates a MappablePosition from a JSON object.
	*/
	static fromJSON(json) {
		return new _MappablePosition(json.position);
	}
	/**
	* Converts the MappablePosition to a JSON object.
	*/
	toJSON() {
		return { position: this.position };
	}
};
function getUpdatedPosition(position, transaction) {
	const mapResult = transaction.mapping.mapResult(position.position);
	return {
		position: new MappablePosition(mapResult.pos),
		mapResult
	};
}
function createMappablePosition(position) {
	return new MappablePosition(position);
}
function canSetMark(state, tr, newMarkType) {
	var _a;
	const { selection } = tr;
	let cursor = null;
	if (isTextSelection(selection)) cursor = selection.$cursor;
	if (cursor) {
		const currentMarks = (_a = state.storedMarks) != null ? _a : cursor.marks();
		return cursor.parent.type.allowsMarkType(newMarkType) && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));
	}
	const { ranges } = selection;
	return ranges.some(({ $from, $to }) => {
		let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
		state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
			if (someNodeSupportsMark) return false;
			if (node.isInline) {
				const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
				const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
				someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
			}
			return !someNodeSupportsMark;
		});
		return someNodeSupportsMark;
	});
}
var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
	const { selection } = tr;
	const { empty, ranges } = selection;
	const type = getMarkType(typeOrName, state.schema);
	if (dispatch) if (empty) {
		const oldAttributes = getMarkAttributes(state, type);
		tr.addStoredMark(type.create({
			...oldAttributes,
			...attributes
		}));
	} else ranges.forEach((range) => {
		const from = range.$from.pos;
		const to = range.$to.pos;
		state.doc.nodesBetween(from, to, (node, pos) => {
			const trimmedFrom = Math.max(pos, from);
			const trimmedTo = Math.min(pos + node.nodeSize, to);
			if (node.marks.find((mark) => mark.type === type)) node.marks.forEach((mark) => {
				if (type === mark.type) tr.addMark(trimmedFrom, trimmedTo, type.create({
					...mark.attrs,
					...attributes
				}));
			});
			else tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
		});
	});
	return canSetMark(state, tr, type);
};
var setMeta = (key, value) => ({ tr }) => {
	tr.setMeta(key, value);
	return true;
};
var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
	const type = getNodeType(typeOrName, state.schema);
	let attributesToCopy;
	if (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;
	if (!type.isTextblock) {
		console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes.");
		return false;
	}
	return chain().command(({ commands }) => {
		if (setBlockType(type, {
			...attributesToCopy,
			...attributes
		})(state)) return true;
		return commands.clearNodes();
	}).command(({ state: updatedState }) => {
		return setBlockType(type, {
			...attributesToCopy,
			...attributes
		})(updatedState, dispatch);
	}).run();
};
var setNodeSelection = (position) => ({ tr, dispatch }) => {
	if (dispatch) {
		const { doc } = tr;
		const from = minMax(position, 0, doc.content.size);
		const selection = NodeSelection$1.create(doc, from);
		tr.setSelection(selection);
	}
	return true;
};
var setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {
	const { selection } = state;
	let from;
	let to;
	if (typeof position === "number") {
		from = position;
		to = position;
	} else if (position && "from" in position && "to" in position) {
		from = position.from;
		to = position.to;
	} else {
		from = selection.from;
		to = selection.to;
	}
	if (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {
		if (node.isText) return;
		tr.setNodeMarkup(pos, void 0, {
			...node.attrs,
			dir: direction
		});
	});
	return true;
};
var setTextSelection = (position) => ({ tr, dispatch }) => {
	if (dispatch) {
		const { doc } = tr;
		const { from, to } = typeof position === "number" ? {
			from: position,
			to: position
		} : position;
		const minPos = TextSelection$1.atStart(doc).from;
		const maxPos = TextSelection$1.atEnd(doc).to;
		const resolvedFrom = minMax(from, minPos, maxPos);
		const resolvedEnd = minMax(to, minPos, maxPos);
		const selection = TextSelection$1.create(doc, resolvedFrom, resolvedEnd);
		tr.setSelection(selection);
	}
	return true;
};
var sinkListItem = (typeOrName) => ({ state, dispatch }) => {
	return sinkListItem$1(getNodeType(typeOrName, state.schema))(state, dispatch);
};
function ensureMarks(state, splittableMarks) {
	const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
	if (marks) {
		const filteredMarks = marks.filter((mark) => splittableMarks == null ? void 0 : splittableMarks.includes(mark.type.name));
		state.tr.ensureMarks(filteredMarks);
	}
}
var splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
	const { selection, doc } = tr;
	const { $from, $to } = selection;
	const extensionAttributes = editor.extensionManager.attributes;
	const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
	if (selection instanceof NodeSelection$1 && selection.node.isBlock) {
		if (!$from.parentOffset || !canSplit(doc, $from.pos)) return false;
		if (dispatch) {
			if (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);
			tr.split($from.pos).scrollIntoView();
		}
		return true;
	}
	if (!$from.parent.isBlock) return false;
	const atEnd = $to.parentOffset === $to.parent.content.size;
	const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
	let types = atEnd && deflt ? [{
		type: deflt,
		attrs: newAttributes
	}] : void 0;
	let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
	if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
		can = true;
		types = deflt ? [{
			type: deflt,
			attrs: newAttributes
		}] : void 0;
	}
	if (dispatch) {
		if (can) {
			if (selection instanceof TextSelection$1) tr.deleteSelection();
			tr.split(tr.mapping.map($from.pos), 1, types);
			if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
				const first2 = tr.mapping.map($from.before());
				const $first = tr.doc.resolve(first2);
				if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
			}
		}
		if (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);
		tr.scrollIntoView();
	}
	return can;
};
var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
	var _a;
	const type = getNodeType(typeOrName, state.schema);
	const { $from, $to } = state.selection;
	const node = state.selection.node;
	if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;
	const grandParent = $from.node(-1);
	if (grandParent.type !== type) return false;
	const extensionAttributes = editor.extensionManager.attributes;
	if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
		if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) return false;
		if (dispatch) {
			let wrap = Fragment$1.empty;
			const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
			for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) wrap = Fragment$1.from($from.node(d).copy(wrap));
			const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
			const newNextTypeAttributes2 = {
				...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
				...overrideAttrs
			};
			const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
			wrap = wrap.append(Fragment$1.from(type.createAndFill(null, nextType2) || void 0));
			const start = $from.before($from.depth - (depthBefore - 1));
			tr.replace(start, $from.after(-depthAfter), new Slice$1(wrap, 4 - depthBefore, 0));
			let sel = -1;
			tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
				if (sel > -1) return false;
				if (n.isTextblock && n.content.size === 0) sel = pos + 1;
			});
			if (sel > -1) tr.setSelection(TextSelection$1.near(tr.doc.resolve(sel)));
			tr.scrollIntoView();
		}
		return true;
	}
	const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
	const newTypeAttributes = {
		...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
		...overrideAttrs
	};
	const newNextTypeAttributes = {
		...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
		...overrideAttrs
	};
	tr.delete($from.pos, $to.pos);
	const types = nextType ? [{
		type,
		attrs: newTypeAttributes
	}, {
		type: nextType,
		attrs: newNextTypeAttributes
	}] : [{
		type,
		attrs: newTypeAttributes
	}];
	if (!canSplit(tr.doc, $from.pos, 2)) return false;
	if (dispatch) {
		const { selection, storedMarks } = state;
		const { splittableMarks } = editor.extensionManager;
		const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
		tr.split($from.pos, 2, types).scrollIntoView();
		if (!marks || !dispatch) return true;
		const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
		tr.ensureMarks(filteredMarks);
	}
	return true;
};
var joinListBackwards = (tr, listType) => {
	const list = findParentNode((node) => node.type === listType)(tr.selection);
	if (!list) return true;
	const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
	if (before === void 0) return true;
	const nodeBefore = tr.doc.nodeAt(before);
	if (!(list.node.type === (nodeBefore == null ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos))) return true;
	tr.join(list.pos);
	return true;
};
var joinListForwards = (tr, listType) => {
	const list = findParentNode((node) => node.type === listType)(tr.selection);
	if (!list) return true;
	const after = tr.doc.resolve(list.start).after(list.depth);
	if (after === void 0) return true;
	const nodeAfter = tr.doc.nodeAt(after);
	if (!(list.node.type === (nodeAfter == null ? void 0 : nodeAfter.type) && canJoin(tr.doc, after))) return true;
	tr.join(after);
	return true;
};
function createInnerSelectionForWholeDocList(tr) {
	const doc = tr.doc;
	const list = doc.firstChild;
	if (!list) return null;
	const $start = doc.resolve(1);
	const $end = doc.resolve(list.nodeSize - 1);
	return TextSelection$1.between($start, $end);
}
var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
	const { extensions, splittableMarks } = editor.extensionManager;
	const listType = getNodeType(listTypeOrName, state.schema);
	const itemType = getNodeType(itemTypeOrName, state.schema);
	const { selection, storedMarks } = state;
	const { $from, $to } = selection;
	const range = $from.blockRange($to);
	const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
	if (!range) return false;
	const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
	const isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;
	const topLevelNodes = state.doc.content.content;
	const soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;
	const allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {
		node: soleTopLevelNode,
		pos: 0,
		depth: 0
	} : null;
	const currentList = parentList != null ? parentList : allSelectionList;
	const isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;
	const hasWholeDocSelectedList = !!allSelectionList;
	if ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {
		if (currentList.node.type === listType) {
			if (isAllSelection && hasWholeDocSelectedList) return chain().command(({ tr: trx, dispatch: disp }) => {
				const nextSelection = createInnerSelectionForWholeDocList(trx);
				if (!nextSelection) return false;
				trx.setSelection(nextSelection);
				if (disp) disp(trx);
				return true;
			}).liftListItem(itemType).run();
			return commands.liftListItem(itemType);
		}
		if (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) return chain().command(() => {
			tr.setNodeMarkup(currentList.pos, listType);
			return true;
		}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
	}
	if (!keepMarks || !marks || !dispatch) return chain().command(() => {
		if (can().wrapInList(listType, attributes)) return true;
		return commands.clearNodes();
	}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
	return chain().command(() => {
		const canWrapInList = can().wrapInList(listType, attributes);
		const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
		tr.ensureMarks(filteredMarks);
		if (canWrapInList) return true;
		return commands.clearNodes();
	}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
};
var toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {
	const { extendEmptyMarkRange = false } = options;
	const type = getMarkType(typeOrName, state.schema);
	if (isMarkActive(state, type, attributes)) return commands.unsetMark(type, { extendEmptyMarkRange });
	return commands.setMark(type, attributes);
};
var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {
	const type = getNodeType(typeOrName, state.schema);
	const toggleType = getNodeType(toggleTypeOrName, state.schema);
	const isActive2 = isNodeActive(state, type, attributes);
	let attributesToCopy;
	if (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;
	if (isActive2) return commands.setNode(toggleType, attributesToCopy);
	return commands.setNode(type, {
		...attributesToCopy,
		...attributes
	});
};
var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {
	const type = getNodeType(typeOrName, state.schema);
	if (isNodeActive(state, type, attributes)) return commands.lift(type);
	return commands.wrapIn(type, attributes);
};
var undoInputRule = () => ({ state, dispatch }) => {
	const plugins = state.plugins;
	for (let i = 0; i < plugins.length; i += 1) {
		const plugin = plugins[i];
		let undoable;
		if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
			if (dispatch) {
				const tr = state.tr;
				const toUndo = undoable.transform;
				for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
				if (undoable.text) {
					const marks = tr.doc.resolve(undoable.from).marks();
					tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
				} else tr.delete(undoable.from, undoable.to);
			}
			return true;
		}
	}
	return false;
};
var unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {
	const { ignoreClearable = false } = options;
	const { selection } = tr;
	const { empty, ranges } = selection;
	if (empty) return true;
	const { nonClearableMarks } = editor.extensionManager;
	if (dispatch) {
		const clearableMarkTypes = Object.values(editor.schema.marks).filter((markType) => ignoreClearable || !nonClearableMarks.includes(markType.name));
		ranges.forEach((range) => {
			for (const markType of clearableMarkTypes) tr.removeMark(range.$from.pos, range.$to.pos, markType);
		});
	}
	return true;
};
var unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
	var _a;
	const { extendEmptyMarkRange = false } = options;
	const { selection } = tr;
	const type = getMarkType(typeOrName, state.schema);
	const { $from, empty, ranges } = selection;
	if (!dispatch) return true;
	if (empty && extendEmptyMarkRange) {
		let { from, to } = selection;
		const range = getMarkRange($from, type, (_a = $from.marks().find((mark) => mark.type === type)) == null ? void 0 : _a.attrs);
		if (range) {
			from = range.from;
			to = range.to;
		}
		tr.removeMark(from, to, type);
	} else ranges.forEach((range) => {
		tr.removeMark(range.$from.pos, range.$to.pos, type);
	});
	tr.removeStoredMark(type);
	return true;
};
var unsetTextDirection = (position) => ({ tr, state, dispatch }) => {
	const { selection } = state;
	let from;
	let to;
	if (typeof position === "number") {
		from = position;
		to = position;
	} else if (position && "from" in position && "to" in position) {
		from = position.from;
		to = position.to;
	} else {
		from = selection.from;
		to = selection.to;
	}
	if (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {
		if (node.isText) return;
		const newAttrs = { ...node.attrs };
		delete newAttrs.dir;
		tr.setNodeMarkup(pos, void 0, newAttrs);
	});
	return true;
};
var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
	let nodeType = null;
	let markType = null;
	const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
	if (!schemaType) return false;
	if (schemaType === "node") nodeType = getNodeType(typeOrName, state.schema);
	if (schemaType === "mark") markType = getMarkType(typeOrName, state.schema);
	let canUpdate = false;
	tr.selection.ranges.forEach((range) => {
		const from = range.$from.pos;
		const to = range.$to.pos;
		let lastPos;
		let lastNode;
		let trimmedFrom;
		let trimmedTo;
		if (tr.selection.empty) state.doc.nodesBetween(from, to, (node, pos) => {
			if (nodeType && nodeType === node.type) {
				canUpdate = true;
				trimmedFrom = Math.max(pos, from);
				trimmedTo = Math.min(pos + node.nodeSize, to);
				lastPos = pos;
				lastNode = node;
			}
		});
		else state.doc.nodesBetween(from, to, (node, pos) => {
			if (pos < from && nodeType && nodeType === node.type) {
				canUpdate = true;
				trimmedFrom = Math.max(pos, from);
				trimmedTo = Math.min(pos + node.nodeSize, to);
				lastPos = pos;
				lastNode = node;
			}
			if (pos >= from && pos <= to) {
				if (nodeType && nodeType === node.type) {
					canUpdate = true;
					if (dispatch) tr.setNodeMarkup(pos, void 0, {
						...node.attrs,
						...attributes
					});
				}
				if (markType && node.marks.length) node.marks.forEach((mark) => {
					if (markType === mark.type) {
						canUpdate = true;
						if (dispatch) {
							const trimmedFrom2 = Math.max(pos, from);
							const trimmedTo2 = Math.min(pos + node.nodeSize, to);
							tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
								...mark.attrs,
								...attributes
							}));
						}
					}
				});
			}
		});
		if (lastNode) {
			if (lastPos !== void 0 && dispatch) tr.setNodeMarkup(lastPos, void 0, {
				...lastNode.attrs,
				...attributes
			});
			if (markType && lastNode.marks.length) lastNode.marks.forEach((mark) => {
				if (markType === mark.type && dispatch) tr.addMark(trimmedFrom, trimmedTo, markType.create({
					...mark.attrs,
					...attributes
				}));
			});
		}
	});
	return canUpdate;
};
var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
	return wrapIn$1(getNodeType(typeOrName, state.schema), attributes)(state, dispatch);
};
var wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
	return wrapInList$1(getNodeType(typeOrName, state.schema), attributes)(state, dispatch);
};
var EventEmitter = class {
	constructor() {
		this.callbacks = {};
	}
	on(event, fn) {
		if (!this.callbacks[event]) this.callbacks[event] = [];
		this.callbacks[event].push(fn);
		return this;
	}
	emit(event, ...args) {
		const callbacks = this.callbacks[event];
		if (callbacks) callbacks.forEach((callback) => callback.apply(this, args));
		return this;
	}
	off(event, fn) {
		const callbacks = this.callbacks[event];
		if (callbacks) if (fn) this.callbacks[event] = callbacks.filter((callback) => callback !== fn);
		else delete this.callbacks[event];
		return this;
	}
	once(event, fn) {
		const onceFn = (...args) => {
			this.off(event, onceFn);
			fn.apply(this, args);
		};
		return this.on(event, onceFn);
	}
	removeAllListeners() {
		this.callbacks = {};
	}
};
var InputRule = class {
	constructor(config) {
		var _a;
		this.find = config.find;
		this.handler = config.handler;
		this.undoable = (_a = config.undoable) != null ? _a : true;
	}
};
var inputRuleMatcherHandler = (text, find) => {
	if (isRegExp(find)) return find.exec(text);
	const inputRuleMatch = find(text);
	if (!inputRuleMatch) return null;
	const result = [inputRuleMatch.text];
	result.index = inputRuleMatch.index;
	result.input = text;
	result.data = inputRuleMatch.data;
	if (inputRuleMatch.replaceWith) {
		if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\".");
		result.push(inputRuleMatch.replaceWith);
	}
	return result;
};
function run$2(config) {
	var _a;
	const { editor, from, to, text, rules, plugin } = config;
	const { view } = editor;
	if (view.composing) return false;
	const $from = view.state.doc.resolve(from);
	if ($from.parent.type.spec.code || !!((_a = $from.nodeBefore || $from.nodeAfter) == null ? void 0 : _a.marks.find((mark) => mark.type.spec.code))) return false;
	let matched = false;
	const textBefore = getTextContentFromNodes($from) + text;
	rules.forEach((rule) => {
		if (matched) return;
		const match = inputRuleMatcherHandler(textBefore, rule.find);
		if (!match) return;
		const tr = view.state.tr;
		const state = createChainableState({
			state: view.state,
			transaction: tr
		});
		const range = {
			from: from - (match[0].length - text.length),
			to
		};
		const { commands, chain, can } = new CommandManager({
			editor,
			state
		});
		if (rule.handler({
			state,
			range,
			match,
			commands,
			chain,
			can
		}) === null || !tr.steps.length) return;
		if (rule.undoable) tr.setMeta(plugin, {
			transform: tr,
			from,
			to,
			text
		});
		view.dispatch(tr);
		matched = true;
	});
	return matched;
}
function inputRulesPlugin(props) {
	const { editor, rules } = props;
	const plugin = new Plugin({
		state: {
			init() {
				return null;
			},
			apply(tr, prev, state) {
				const stored = tr.getMeta(plugin);
				if (stored) return stored;
				const simulatedInputMeta = tr.getMeta("applyInputRules");
				if (!!simulatedInputMeta) setTimeout(() => {
					let { text } = simulatedInputMeta;
					if (typeof text === "string") text = text;
					else text = getHTMLFromFragment(Fragment$1.from(text), state.schema);
					const { from } = simulatedInputMeta;
					run$2({
						editor,
						from,
						to: from + text.length,
						text,
						rules,
						plugin
					});
				});
				return tr.selectionSet || tr.docChanged ? null : prev;
			}
		},
		props: {
			handleTextInput(view, from, to, text) {
				return run$2({
					editor,
					from,
					to,
					text,
					rules,
					plugin
				});
			},
			handleDOMEvents: { compositionend: (view) => {
				setTimeout(() => {
					const { $cursor } = view.state.selection;
					if ($cursor) run$2({
						editor,
						from: $cursor.pos,
						to: $cursor.pos,
						text: "",
						rules,
						plugin
					});
				});
				return false;
			} },
			handleKeyDown(view, event) {
				if (event.key !== "Enter") return false;
				const { $cursor } = view.state.selection;
				if ($cursor) return run$2({
					editor,
					from: $cursor.pos,
					to: $cursor.pos,
					text: "\n",
					rules,
					plugin
				});
				return false;
			}
		},
		isInputRules: true
	});
	return plugin;
}
function getType(value) {
	return Object.prototype.toString.call(value).slice(8, -1);
}
function isPlainObject(value) {
	if (getType(value) !== "Object") return false;
	return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
}
function mergeDeep(target, source) {
	const output = { ...target };
	if (isPlainObject(target) && isPlainObject(source)) Object.keys(source).forEach((key) => {
		if (isPlainObject(source[key]) && isPlainObject(target[key])) output[key] = mergeDeep(target[key], source[key]);
		else output[key] = source[key];
	});
	return output;
}
var Extendable = class {
	constructor(config = {}) {
		this.type = "extendable";
		this.parent = null;
		this.child = null;
		this.name = "";
		this.config = { name: this.name };
		this.config = {
			...this.config,
			...config
		};
		this.name = this.config.name;
	}
	get options() {
		return { ...callOrReturn(getExtensionField(this, "addOptions", { name: this.name })) };
	}
	get storage() {
		return { ...callOrReturn(getExtensionField(this, "addStorage", {
			name: this.name,
			options: this.options
		})) };
	}
	configure(options = {}) {
		const extension = this.extend({
			...this.config,
			addOptions: () => {
				return mergeDeep(this.options, options);
			}
		});
		extension.name = this.name;
		extension.parent = this.parent;
		this.child = null;
		return extension;
	}
	extend(extendedConfig = {}) {
		const extension = new this.constructor({
			...this.config,
			...extendedConfig
		});
		extension.parent = this;
		this.child = extension;
		extension.name = "name" in extendedConfig ? extendedConfig.name : extension.parent.name;
		return extension;
	}
};
var Mark$1 = class _Mark extends Extendable {
	constructor() {
		super(...arguments);
		this.type = "mark";
	}
	/**
	* Create a new Mark instance
	* @param config - Mark configuration object or a function that returns a configuration object
	*/
	static create(config = {}) {
		return new _Mark(typeof config === "function" ? config() : config);
	}
	static handleExit({ editor, mark }) {
		const { tr } = editor.state;
		const currentPos = editor.state.selection.$from;
		if (currentPos.pos === currentPos.end()) {
			const currentMarks = currentPos.marks();
			if (!!!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name)) return false;
			const removeMark = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
			if (removeMark) tr.removeStoredMark(removeMark);
			tr.insertText(" ", currentPos.pos);
			editor.view.dispatch(tr);
			return true;
		}
		return false;
	}
	configure(options) {
		return super.configure(options);
	}
	extend(extendedConfig) {
		const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
		return super.extend(resolvedConfig);
	}
};
function isNumber(value) {
	return typeof value === "number";
}
var PasteRule = class {
	constructor(config) {
		this.find = config.find;
		this.handler = config.handler;
	}
};
var pasteRuleMatcherHandler = (text, find, event) => {
	if (isRegExp(find)) return [...text.matchAll(find)];
	const matches = find(text, event);
	if (!matches) return [];
	return matches.map((pasteRuleMatch) => {
		const result = [pasteRuleMatch.text];
		result.index = pasteRuleMatch.index;
		result.input = text;
		result.data = pasteRuleMatch.data;
		if (pasteRuleMatch.replaceWith) {
			if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\".");
			result.push(pasteRuleMatch.replaceWith);
		}
		return result;
	});
};
function run2(config) {
	const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;
	const { commands, chain, can } = new CommandManager({
		editor,
		state
	});
	const handlers = [];
	state.doc.nodesBetween(from, to, (node, pos) => {
		var _a, _b, _c, _d, _e;
		if (((_b = (_a = node.type) == null ? void 0 : _a.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) return;
		const contentSize = (_e = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e : 0;
		const resolvedFrom = Math.max(from, pos);
		const resolvedTo = Math.min(to, pos + contentSize);
		if (resolvedFrom >= resolvedTo) return;
		pasteRuleMatcherHandler(node.isText ? node.text || "" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "￼"), rule.find, pasteEvent).forEach((match) => {
			if (match.index === void 0) return;
			const start = resolvedFrom + match.index + 1;
			const end = start + match[0].length;
			const range = {
				from: state.tr.mapping.map(start),
				to: state.tr.mapping.map(end)
			};
			const handler = rule.handler({
				state,
				range,
				match,
				commands,
				chain,
				can,
				pasteEvent,
				dropEvent
			});
			handlers.push(handler);
		});
	});
	return handlers.every((handler) => handler !== null);
}
var tiptapDragFromOtherEditor = null;
var createClipboardPasteEvent = (text) => {
	var _a;
	const event = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
	(_a = event.clipboardData) == null || _a.setData("text/html", text);
	return event;
};
function pasteRulesPlugin(props) {
	const { editor, rules } = props;
	let dragSourceElement = null;
	let isPastedFromProseMirror = false;
	let isDroppedFromProseMirror = false;
	let pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
	let dropEvent;
	try {
		dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
	} catch {
		dropEvent = null;
	}
	const processEvent = ({ state, from, to, rule, pasteEvt }) => {
		const tr = state.tr;
		if (!run2({
			editor,
			state: createChainableState({
				state,
				transaction: tr
			}),
			from: Math.max(from - 1, 0),
			to: to.b - 1,
			rule,
			pasteEvent: pasteEvt,
			dropEvent
		}) || !tr.steps.length) return;
		try {
			dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
		} catch {
			dropEvent = null;
		}
		pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
		return tr;
	};
	return rules.map((rule) => {
		return new Plugin({
			view(view) {
				const handleDragstart = (event) => {
					var _a;
					dragSourceElement = ((_a = view.dom.parentElement) == null ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;
					if (dragSourceElement) tiptapDragFromOtherEditor = editor;
				};
				const handleDragend = () => {
					if (tiptapDragFromOtherEditor) tiptapDragFromOtherEditor = null;
				};
				window.addEventListener("dragstart", handleDragstart);
				window.addEventListener("dragend", handleDragend);
				return { destroy() {
					window.removeEventListener("dragstart", handleDragstart);
					window.removeEventListener("dragend", handleDragend);
				} };
			},
			props: { handleDOMEvents: {
				drop: (view, event) => {
					isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
					dropEvent = event;
					if (!isDroppedFromProseMirror) {
						const dragFromOtherEditor = tiptapDragFromOtherEditor;
						if (dragFromOtherEditor == null ? void 0 : dragFromOtherEditor.isEditable) setTimeout(() => {
							const selection = dragFromOtherEditor.state.selection;
							if (selection) dragFromOtherEditor.commands.deleteRange({
								from: selection.from,
								to: selection.to
							});
						}, 10);
					}
					return false;
				},
				paste: (_view, event) => {
					var _a;
					const html = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/html");
					pasteEvent = event;
					isPastedFromProseMirror = !!(html == null ? void 0 : html.includes("data-pm-slice"));
					return false;
				}
			} },
			appendTransaction: (transactions, oldState, state) => {
				const transaction = transactions[0];
				const isPaste = transaction.getMeta("uiEvent") === "paste" && !isPastedFromProseMirror;
				const isDrop = transaction.getMeta("uiEvent") === "drop" && !isDroppedFromProseMirror;
				const simulatedPasteMeta = transaction.getMeta("applyPasteRules");
				const isSimulatedPaste = !!simulatedPasteMeta;
				if (!isPaste && !isDrop && !isSimulatedPaste) return;
				if (isSimulatedPaste) {
					let { text } = simulatedPasteMeta;
					if (typeof text === "string") text = text;
					else text = getHTMLFromFragment(Fragment$1.from(text), state.schema);
					const { from: from2 } = simulatedPasteMeta;
					const to2 = from2 + text.length;
					const pasteEvt = createClipboardPasteEvent(text);
					return processEvent({
						rule,
						state,
						from: from2,
						to: { b: to2 },
						pasteEvt
					});
				}
				const from = oldState.doc.content.findDiffStart(state.doc.content);
				const to = oldState.doc.content.findDiffEnd(state.doc.content);
				if (!isNumber(from) || !to || from === to.b) return;
				return processEvent({
					rule,
					state,
					from,
					to,
					pasteEvt: pasteEvent
				});
			}
		});
	});
}
var ExtensionManager = class {
	constructor(extensions, editor) {
		this.splittableMarks = [];
		this.nonClearableMarks = [];
		this.editor = editor;
		this.baseExtensions = extensions;
		this.extensions = resolveExtensions(extensions);
		this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
		this.setupExtensions();
	}
	/**
	* Get all commands from the extensions.
	* @returns An object with all commands where the key is the command name and the value is the command function
	*/
	get commands() {
		return this.extensions.reduce((commands, extension) => {
			const addCommands = getExtensionField(extension, "addCommands", {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor: this.editor,
				type: getSchemaTypeByName(extension.name, this.schema)
			});
			if (!addCommands) return commands;
			return {
				...commands,
				...addCommands()
			};
		}, {});
	}
	/**
	* Get all registered Prosemirror plugins from the extensions.
	* @returns An array of Prosemirror plugins
	*/
	get plugins() {
		const { editor } = this;
		return sortExtensions([...this.extensions].reverse()).flatMap((extension) => {
			const context = {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor,
				type: getSchemaTypeByName(extension.name, this.schema)
			};
			const plugins = [];
			const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
			let defaultBindings = {};
			if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) defaultBindings.ArrowRight = () => Mark$1.handleExit({
				editor,
				mark: extension
			});
			if (addKeyboardShortcuts) {
				const bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {
					return [shortcut, () => method({ editor })];
				}));
				defaultBindings = {
					...defaultBindings,
					...bindings
				};
			}
			const keyMapPlugin = keymap(defaultBindings);
			plugins.push(keyMapPlugin);
			const addInputRules = getExtensionField(extension, "addInputRules", context);
			if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
				const rules = addInputRules();
				if (rules && rules.length) {
					const inputResult = inputRulesPlugin({
						editor,
						rules
					});
					const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];
					plugins.push(...inputPlugins);
				}
			}
			const addPasteRules = getExtensionField(extension, "addPasteRules", context);
			if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
				const rules = addPasteRules();
				if (rules && rules.length) {
					const pasteRules = pasteRulesPlugin({
						editor,
						rules
					});
					plugins.push(...pasteRules);
				}
			}
			const addProseMirrorPlugins = getExtensionField(extension, "addProseMirrorPlugins", context);
			if (addProseMirrorPlugins) {
				const proseMirrorPlugins = addProseMirrorPlugins();
				plugins.push(...proseMirrorPlugins);
			}
			return plugins;
		});
	}
	/**
	* Get all attributes from the extensions.
	* @returns An array of attributes
	*/
	get attributes() {
		return getAttributesFromExtensions(this.extensions);
	}
	/**
	* Get all node views from the extensions.
	* @returns An object with all node views where the key is the node name and the value is the node view function
	*/
	get nodeViews() {
		const { editor } = this;
		const { nodeExtensions } = splitExtensions(this.extensions);
		return Object.fromEntries(nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
			const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
			const addNodeView = getExtensionField(extension, "addNodeView", {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor,
				type: getNodeType(extension.name, this.schema)
			});
			if (!addNodeView) return [];
			const nodeViewResult = addNodeView();
			if (!nodeViewResult) return [];
			const nodeview = (node, view, getPos, decorations, innerDecorations) => {
				return nodeViewResult({
					node,
					view,
					getPos,
					decorations,
					innerDecorations,
					editor,
					extension,
					HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
				});
			};
			return [extension.name, nodeview];
		}));
	}
	/**
	* Get the composed dispatchTransaction function from all extensions.
	* @param baseDispatch The base dispatch function (e.g. from the editor or user props)
	* @returns A composed dispatch function
	*/
	dispatchTransaction(baseDispatch) {
		const { editor } = this;
		return sortExtensions([...this.extensions].reverse()).reduceRight((next, extension) => {
			const context = {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor,
				type: getSchemaTypeByName(extension.name, this.schema)
			};
			const dispatchTransaction = getExtensionField(extension, "dispatchTransaction", context);
			if (!dispatchTransaction) return next;
			return (transaction) => {
				dispatchTransaction.call(context, {
					transaction,
					next
				});
			};
		}, baseDispatch);
	}
	/**
	* Get the composed transformPastedHTML function from all extensions.
	* @param baseTransform The base transform function (e.g. from the editor props)
	* @returns A composed transform function that chains all extension transforms
	*/
	transformPastedHTML(baseTransform) {
		const { editor } = this;
		return sortExtensions([...this.extensions]).reduce((transform, extension) => {
			const context = {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor,
				type: getSchemaTypeByName(extension.name, this.schema)
			};
			const extensionTransform = getExtensionField(extension, "transformPastedHTML", context);
			if (!extensionTransform) return transform;
			return (html, view) => {
				const transformedHtml = transform(html, view);
				return extensionTransform.call(context, transformedHtml);
			};
		}, baseTransform || ((html) => html));
	}
	get markViews() {
		const { editor } = this;
		const { markExtensions } = splitExtensions(this.extensions);
		return Object.fromEntries(markExtensions.filter((extension) => !!getExtensionField(extension, "addMarkView")).map((extension) => {
			const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
			const addMarkView = getExtensionField(extension, "addMarkView", {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor,
				type: getMarkType(extension.name, this.schema)
			});
			if (!addMarkView) return [];
			const markView = (mark, view, inline) => {
				const HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);
				return addMarkView()({
					mark,
					view,
					inline,
					editor,
					extension,
					HTMLAttributes,
					updateAttributes: (attrs) => {
						updateMarkViewAttributes(mark, editor, attrs);
					}
				});
			};
			return [extension.name, markView];
		}));
	}
	/**
	* Destroy the extension manager and clean up all extension references
	* to prevent memory leaks through parent/child extension chains.
	*
	* Walks each extension's full parent chain and nulls every forward
	* `parent.child → current` link where the parent still points to the
	* current node. This breaks the retention path from module-scope
	* singleton roots through deep extend() chains.
	*
	* Only ancestor `.child` links matching the current chain are cleared.
	* The `.parent` pointer on ancestors is never touched — extensions
	* may be shared across live editors, so their own backward references
	* and non-matching forward links must remain intact.
	*/
	destroy() {
		this.extensions.forEach((extension) => {
			let current = extension;
			while (current.parent) {
				const parent = current.parent;
				if (parent.child === current) parent.child = null;
				current = parent;
			}
		});
		this.extensions = [];
		this.baseExtensions = [];
		this.schema = null;
		this.editor = null;
	}
	/**
	* Go through all extensions, create extension storages & setup marks
	* & bind editor event listener.
	*/
	setupExtensions() {
		const extensions = this.extensions;
		this.editor.extensionStorage = Object.fromEntries(extensions.map((extension) => [extension.name, extension.storage]));
		extensions.forEach((extension) => {
			var _a, _b;
			const context = {
				name: extension.name,
				options: extension.options,
				storage: this.editor.extensionStorage[extension.name],
				editor: this.editor,
				type: getSchemaTypeByName(extension.name, this.schema)
			};
			if (extension.type === "mark") {
				if ((_a = callOrReturn(getExtensionField(extension, "keepOnSplit", context))) != null ? _a : true) this.splittableMarks.push(extension.name);
				if (!((_b = callOrReturn(getExtensionField(extension, "clearable", context))) != null ? _b : true)) this.nonClearableMarks.push(extension.name);
			}
			const onBeforeCreate = getExtensionField(extension, "onBeforeCreate", context);
			const onCreate = getExtensionField(extension, "onCreate", context);
			const onUpdate = getExtensionField(extension, "onUpdate", context);
			const onSelectionUpdate = getExtensionField(extension, "onSelectionUpdate", context);
			const onTransaction = getExtensionField(extension, "onTransaction", context);
			const onFocus = getExtensionField(extension, "onFocus", context);
			const onBlur = getExtensionField(extension, "onBlur", context);
			const onDestroy = getExtensionField(extension, "onDestroy", context);
			if (onBeforeCreate) this.editor.on("beforeCreate", onBeforeCreate);
			if (onCreate) this.editor.on("create", onCreate);
			if (onUpdate) this.editor.on("update", onUpdate);
			if (onSelectionUpdate) this.editor.on("selectionUpdate", onSelectionUpdate);
			if (onTransaction) this.editor.on("transaction", onTransaction);
			if (onFocus) this.editor.on("focus", onFocus);
			if (onBlur) this.editor.on("blur", onBlur);
			if (onDestroy) this.editor.on("destroy", onDestroy);
		});
	}
};
ExtensionManager.resolve = resolveExtensions;
ExtensionManager.sort = sortExtensions;
ExtensionManager.flatten = flattenExtensions;
__export$1({}, {
	ClipboardTextSerializer: () => ClipboardTextSerializer,
	Commands: () => Commands,
	Delete: () => Delete,
	Drop: () => Drop,
	Editable: () => Editable,
	FocusEvents: () => FocusEvents,
	Keymap: () => Keymap,
	Paste: () => Paste,
	Tabindex: () => Tabindex,
	TextDirection: () => TextDirection,
	focusEventsPluginKey: () => focusEventsPluginKey
});
var Extension = class _Extension extends Extendable {
	constructor() {
		super(...arguments);
		this.type = "extension";
	}
	/**
	* Create a new Extension instance
	* @param config - Extension configuration object or a function that returns a configuration object
	*/
	static create(config = {}) {
		return new _Extension(typeof config === "function" ? config() : config);
	}
	configure(options) {
		return super.configure(options);
	}
	extend(extendedConfig) {
		const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
		return super.extend(resolvedConfig);
	}
};
var ClipboardTextSerializer = Extension.create({
	name: "clipboardTextSerializer",
	addOptions() {
		return { blockSeparator: void 0 };
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("clipboardTextSerializer"),
			props: { clipboardTextSerializer: () => {
				const { editor } = this;
				const { state, schema } = editor;
				const { doc, selection } = state;
				const textSerializers = getTextSerializersFromSchema(schema);
				const { blockSeparator } = this.options;
				const options = {
					...blockSeparator !== void 0 ? { blockSeparator } : {},
					textSerializers
				};
				return [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos).map(({ $from, $to }) => getTextBetween(doc, {
					from: $from.pos,
					to: $to.pos
				}, options)).join(blockSeparator != null ? blockSeparator : "\n\n");
			} }
		})];
	}
});
var Commands = Extension.create({
	name: "commands",
	addCommands() {
		return { ...commands_exports };
	}
});
var Delete = Extension.create({
	name: "delete",
	onUpdate({ transaction, appendedTransactions }) {
		var _a, _b, _c;
		const callback = () => {
			var _a2, _b2, _c2, _d;
			if ((_d = (_c2 = (_b2 = (_a2 = this.editor.options.coreExtensionOptions) == null ? void 0 : _a2.delete) == null ? void 0 : _b2.filterTransaction) == null ? void 0 : _c2.call(_b2, transaction)) != null ? _d : transaction.getMeta("y-sync$")) return;
			const nextTransaction = combineTransactionSteps(transaction.before, [transaction, ...appendedTransactions]);
			getChangedRanges(nextTransaction).forEach((change) => {
				if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) nextTransaction.before.nodesBetween(change.oldRange.from, change.oldRange.to, (node, from) => {
					const to = from + node.nodeSize - 2;
					const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;
					this.editor.emit("delete", {
						type: "node",
						node,
						from,
						to,
						newFrom: nextTransaction.mapping.map(from),
						newTo: nextTransaction.mapping.map(to),
						deletedRange: change.oldRange,
						newRange: change.newRange,
						partial: !isFullyWithinRange,
						editor: this.editor,
						transaction,
						combinedTransform: nextTransaction
					});
				});
			});
			const mapping = nextTransaction.mapping;
			nextTransaction.steps.forEach((step, index) => {
				var _a3, _b3;
				if (step instanceof RemoveMarkStep$1) {
					const newStart = mapping.slice(index).map(step.from, -1);
					const newEnd = mapping.slice(index).map(step.to);
					const oldStart = mapping.invert().map(newStart, -1);
					const oldEnd = mapping.invert().map(newEnd);
					const foundBeforeMark = newStart > 0 ? (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark)) : false;
					const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
					this.editor.emit("delete", {
						type: "mark",
						mark: step.mark,
						from: step.from,
						to: step.to,
						deletedRange: {
							from: oldStart,
							to: oldEnd
						},
						newRange: {
							from: newStart,
							to: newEnd
						},
						partial: Boolean(foundAfterMark || foundBeforeMark),
						editor: this.editor,
						transaction,
						combinedTransform: nextTransaction
					});
				}
			});
		};
		if ((_c = (_b = (_a = this.editor.options.coreExtensionOptions) == null ? void 0 : _a.delete) == null ? void 0 : _b.async) != null ? _c : true) setTimeout(callback, 0);
		else callback();
	}
});
var Drop = Extension.create({
	name: "drop",
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("tiptapDrop"),
			props: { handleDrop: (_, e, slice, moved) => {
				this.editor.emit("drop", {
					editor: this.editor,
					event: e,
					slice,
					moved
				});
			} }
		})];
	}
});
var Editable = Extension.create({
	name: "editable",
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("editable"),
			props: { editable: () => this.editor.options.editable }
		})];
	}
});
var focusEventsPluginKey = new PluginKey("focusEvents");
var FocusEvents = Extension.create({
	name: "focusEvents",
	addProseMirrorPlugins() {
		const { editor } = this;
		return [new Plugin({
			key: focusEventsPluginKey,
			props: { handleDOMEvents: {
				focus: (view, event) => {
					editor.isFocused = true;
					const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
					view.dispatch(transaction);
					return false;
				},
				blur: (view, event) => {
					editor.isFocused = false;
					const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
					view.dispatch(transaction);
					return false;
				}
			} }
		})];
	}
});
var Keymap = Extension.create({
	name: "keymap",
	addKeyboardShortcuts() {
		const handleBackspace = () => this.editor.commands.first(({ commands }) => [
			() => commands.undoInputRule(),
			() => commands.command(({ tr }) => {
				const { selection, doc } = tr;
				const { empty, $anchor } = selection;
				const { pos, parent } = $anchor;
				const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
				const parentIsIsolating = $parentPos.parent.type.spec.isolating;
				const parentPos = $anchor.pos - $anchor.parentOffset;
				const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection$2.atStart(doc).from === pos;
				if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") return false;
				return commands.clearNodes();
			}),
			() => commands.deleteSelection(),
			() => commands.joinBackward(),
			() => commands.selectNodeBackward()
		]);
		const handleDelete = () => this.editor.commands.first(({ commands }) => [
			() => commands.deleteSelection(),
			() => commands.deleteCurrentNode(),
			() => commands.joinForward(),
			() => commands.selectNodeForward()
		]);
		const handleEnter = () => this.editor.commands.first(({ commands }) => [
			() => commands.newlineInCode(),
			() => commands.createParagraphNear(),
			() => commands.liftEmptyBlock(),
			() => commands.splitBlock()
		]);
		const baseKeymap = {
			Enter: handleEnter,
			"Mod-Enter": () => this.editor.commands.exitCode(),
			Backspace: handleBackspace,
			"Mod-Backspace": handleBackspace,
			"Shift-Backspace": handleBackspace,
			Delete: handleDelete,
			"Mod-Delete": handleDelete,
			"Mod-a": () => this.editor.commands.selectAll()
		};
		const pcKeymap = { ...baseKeymap };
		const macKeymap = {
			...baseKeymap,
			"Ctrl-h": handleBackspace,
			"Alt-Backspace": handleBackspace,
			"Ctrl-d": handleDelete,
			"Ctrl-Alt-Backspace": handleDelete,
			"Alt-Delete": handleDelete,
			"Alt-d": handleDelete,
			"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
			"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
		};
		if (isiOS() || isMacOS()) return macKeymap;
		return pcKeymap;
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("clearDocument"),
			appendTransaction: (transactions, oldState, newState) => {
				if (transactions.some((tr2) => tr2.getMeta("composition"))) return;
				const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
				const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
				if (!docChanges || ignoreTr) return;
				const { empty, from, to } = oldState.selection;
				const allFrom = Selection$2.atStart(oldState.doc).from;
				const allEnd = Selection$2.atEnd(oldState.doc).to;
				if (empty || !(from === allFrom && to === allEnd)) return;
				if (!isNodeEmpty(newState.doc)) return;
				const tr = newState.tr;
				const state = createChainableState({
					state: newState,
					transaction: tr
				});
				const { commands } = new CommandManager({
					editor: this.editor,
					state
				});
				commands.clearNodes();
				if (!tr.steps.length) return;
				return tr;
			}
		})];
	}
});
var Paste = Extension.create({
	name: "paste",
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("tiptapPaste"),
			props: { handlePaste: (_view, e, slice) => {
				this.editor.emit("paste", {
					editor: this.editor,
					event: e,
					slice
				});
			} }
		})];
	}
});
var Tabindex = Extension.create({
	name: "tabindex",
	addOptions() {
		return { value: void 0 };
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("tabindex"),
			props: { attributes: () => {
				var _a;
				if (!this.editor.isEditable && this.options.value === void 0) return {};
				return { tabindex: (_a = this.options.value) != null ? _a : "0" };
			} }
		})];
	}
});
var TextDirection = Extension.create({
	name: "textDirection",
	addOptions() {
		return { direction: void 0 };
	},
	addGlobalAttributes() {
		if (!this.options.direction) return [];
		const { nodeExtensions } = splitExtensions(this.extensions);
		return [{
			types: nodeExtensions.filter((extension) => extension.name !== "text").map((extension) => extension.name),
			attributes: { dir: {
				default: this.options.direction,
				parseHTML: (element) => {
					const dir = element.getAttribute("dir");
					if (dir && (dir === "ltr" || dir === "rtl" || dir === "auto")) return dir;
					return this.options.direction;
				},
				renderHTML: (attributes) => {
					if (!attributes.dir) return {};
					return { dir: attributes.dir };
				}
			} }
		}];
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("textDirection"),
			props: { attributes: () => {
				const direction = this.options.direction;
				if (!direction) return {};
				return { dir: direction };
			} }
		})];
	}
});
var NodePos = class _NodePos {
	constructor(pos, editor, isBlock = false, node = null) {
		this.currentNode = null;
		this.actualDepth = null;
		this.isBlock = isBlock;
		this.resolvedPos = pos;
		this.editor = editor;
		this.currentNode = node;
	}
	get name() {
		return this.node.type.name;
	}
	get node() {
		return this.currentNode || this.resolvedPos.node();
	}
	get element() {
		return this.editor.view.domAtPos(this.pos).node;
	}
	get depth() {
		var _a;
		return (_a = this.actualDepth) != null ? _a : this.resolvedPos.depth;
	}
	get pos() {
		return this.resolvedPos.pos;
	}
	get content() {
		return this.node.content;
	}
	set content(content) {
		let from = this.from;
		let to = 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;
			}
			from = this.from + 1;
			to = this.to - 1;
		}
		this.editor.commands.insertContentAt({
			from,
			to
		}, content);
	}
	get attributes() {
		return this.node.attrs;
	}
	get textContent() {
		return this.node.textContent;
	}
	get size() {
		return this.node.nodeSize;
	}
	get from() {
		if (this.isBlock) return this.pos;
		return this.resolvedPos.start(this.resolvedPos.depth);
	}
	get range() {
		return {
			from: this.from,
			to: this.to
		};
	}
	get to() {
		if (this.isBlock) return this.pos + this.size;
		return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
	}
	get parent() {
		if (this.depth === 0) return null;
		const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);
		return new _NodePos(this.resolvedPos.doc.resolve(parentPos), this.editor);
	}
	get before() {
		let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
		if ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.from - 3);
		return new _NodePos($pos, this.editor);
	}
	get after() {
		let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
		if ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.to + 3);
		return new _NodePos($pos, this.editor);
	}
	get children() {
		const children = [];
		this.node.content.forEach((node, offset) => {
			const isBlock = node.isBlock && !node.isTextblock;
			const isNonTextAtom = node.isAtom && !node.isText;
			const isInline = node.isInline;
			const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
			if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) return;
			const $pos = this.resolvedPos.doc.resolve(targetPos);
			if (!isBlock && !isInline && $pos.depth <= this.depth) return;
			const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);
			if (isBlock) childNodePos.actualDepth = this.depth + 1;
			children.push(childNodePos);
		});
		return children;
	}
	get firstChild() {
		return this.children[0] || null;
	}
	get lastChild() {
		const children = this.children;
		return children[children.length - 1] || null;
	}
	closest(selector, attributes = {}) {
		let node = null;
		let currentNode = this.parent;
		while (currentNode && !node) {
			if (currentNode.node.type.name === selector) if (Object.keys(attributes).length > 0) {
				const nodeAttributes = currentNode.node.attrs;
				const attrKeys = Object.keys(attributes);
				for (let index = 0; index < attrKeys.length; index += 1) {
					const key = attrKeys[index];
					if (nodeAttributes[key] !== attributes[key]) break;
				}
			} else node = currentNode;
			currentNode = currentNode.parent;
		}
		return node;
	}
	querySelector(selector, attributes = {}) {
		return this.querySelectorAll(selector, attributes, true)[0] || null;
	}
	querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
		let nodes = [];
		if (!this.children || this.children.length === 0) return nodes;
		const attrKeys = Object.keys(attributes);
		this.children.forEach((childPos) => {
			if (firstItemOnly && nodes.length > 0) return;
			if (childPos.node.type.name === selector) {
				if (attrKeys.every((key) => attributes[key] === childPos.node.attrs[key])) nodes.push(childPos);
			}
			if (firstItemOnly && nodes.length > 0) return;
			nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
		});
		return nodes;
	}
	setAttribute(attributes) {
		const { tr } = this.editor.state;
		tr.setNodeMarkup(this.from, void 0, {
			...this.node.attrs,
			...attributes
		});
		this.editor.view.dispatch(tr);
	}
};
var style = `.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}`;
function createStyleTag(style2, nonce, suffix) {
	const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
	if (tiptapStyleTag !== null) return tiptapStyleTag;
	const styleNode = document.createElement("style");
	if (nonce) styleNode.setAttribute("nonce", nonce);
	styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
	styleNode.innerHTML = style2;
	document.getElementsByTagName("head")[0].appendChild(styleNode);
	return styleNode;
}
var Editor$1 = class extends EventEmitter {
	constructor(options = {}) {
		super();
		this.css = null;
		this.className = "tiptap";
		this.editorView = null;
		this.isFocused = false;
		this.destroyed = false;
		/**
		* The editor is considered initialized after the `create` event has been emitted.
		*/
		this.isInitialized = false;
		this.extensionStorage = {};
		/**
		* A unique ID for this editor instance.
		*/
		this.instanceId = Math.random().toString(36).slice(2, 9);
		this.options = {
			element: typeof document !== "undefined" ? document.createElement("div") : null,
			content: "",
			injectCSS: true,
			injectNonce: void 0,
			extensions: [],
			autofocus: false,
			editable: true,
			textDirection: void 0,
			editorProps: {},
			parseOptions: {},
			coreExtensionOptions: {},
			enableInputRules: true,
			enablePasteRules: true,
			enableCoreExtensions: true,
			enableContentCheck: false,
			emitContentError: false,
			onBeforeCreate: () => null,
			onCreate: () => null,
			onMount: () => null,
			onUnmount: () => null,
			onUpdate: () => null,
			onSelectionUpdate: () => null,
			onTransaction: () => null,
			onFocus: () => null,
			onBlur: () => null,
			onDestroy: () => null,
			onContentError: ({ error }) => {
				throw error;
			},
			onPaste: () => null,
			onDrop: () => null,
			onDelete: () => null,
			enableExtensionDispatchTransaction: true
		};
		this.isCapturingTransaction = false;
		this.capturedTransaction = null;
		/**
		* Returns a set of utilities for working with positions and ranges.
		*/
		this.utils = {
			getUpdatedPosition,
			createMappablePosition
		};
		this.setOptions(options);
		this.createExtensionManager();
		this.createCommandManager();
		this.createSchema();
		this.on("beforeCreate", this.options.onBeforeCreate);
		this.emit("beforeCreate", { editor: this });
		this.on("mount", this.options.onMount);
		this.on("unmount", this.options.onUnmount);
		this.on("contentError", this.options.onContentError);
		this.on("create", this.options.onCreate);
		this.on("update", this.options.onUpdate);
		this.on("selectionUpdate", this.options.onSelectionUpdate);
		this.on("transaction", this.options.onTransaction);
		this.on("focus", this.options.onFocus);
		this.on("blur", this.options.onBlur);
		this.on("destroy", this.options.onDestroy);
		this.on("drop", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));
		this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
		this.on("delete", this.options.onDelete);
		const initialDoc = this.createDoc();
		const selection = resolveFocusPosition(initialDoc, this.options.autofocus);
		this.editorState = EditorState.create({
			doc: initialDoc,
			schema: this.schema,
			selection: selection || void 0
		});
		if (this.options.element) this.mount(this.options.element);
	}
	/**
	* Attach the editor to the DOM, creating a new editor view.
	*/
	mount(el) {
		if (typeof document === "undefined") throw new Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);
		this.createView(el);
		this.emit("mount", { editor: this });
		if (this.css && !document.head.contains(this.css)) document.head.appendChild(this.css);
		window.setTimeout(() => {
			if (this.isDestroyed) return;
			if (this.options.autofocus !== false && this.options.autofocus !== null) this.commands.focus(this.options.autofocus);
			this.emit("create", { editor: this });
			this.isInitialized = true;
		}, 0);
	}
	/**
	* Remove the editor from the DOM, but still allow remounting at a different point in time
	*/
	unmount() {
		if (this.editorView) {
			const dom = this.editorView.dom;
			if (dom == null ? void 0 : dom.editor) delete dom.editor;
			this.editorView.destroy();
		}
		this.editorView = null;
		this.isInitialized = false;
		if (this.css && !document.querySelectorAll(`.${this.className}`).length) try {
			if (typeof this.css.remove === "function") this.css.remove();
			else if (this.css.parentNode) this.css.parentNode.removeChild(this.css);
		} catch (error) {
			console.warn("Failed to remove CSS element:", error);
		}
		this.css = null;
		this.emit("unmount", { editor: this });
	}
	/**
	* Returns the editor storage.
	*/
	get storage() {
		return this.extensionStorage;
	}
	/**
	* An object of all registered commands.
	*/
	get commands() {
		return this.commandManager.commands;
	}
	/**
	* Create a command chain to call multiple commands at once.
	*/
	chain() {
		return this.commandManager.chain();
	}
	/**
	* Check if a command or a command chain can be executed. Without executing it.
	*/
	can() {
		return this.commandManager.can();
	}
	/**
	* Inject CSS styles.
	*/
	injectCSS() {
		if (this.options.injectCSS && typeof document !== "undefined") this.css = createStyleTag(style, this.options.injectNonce);
	}
	/**
	* Update editor options.
	*
	* @param options A list of options
	*/
	setOptions(options = {}) {
		this.options = {
			...this.options,
			...options
		};
		if (!this.editorView || !this.state || this.isDestroyed) return;
		if (this.options.editorProps) this.view.setProps(this.options.editorProps);
		this.view.updateState(this.state);
	}
	/**
	* Update editable state of the editor.
	*/
	setEditable(editable, emitUpdate = true) {
		this.setOptions({ editable });
		if (emitUpdate) this.emit("update", {
			editor: this,
			transaction: this.state.tr,
			appendedTransactions: []
		});
	}
	/**
	* Returns whether the editor is editable.
	*/
	get isEditable() {
		return this.options.editable && this.view && this.view.editable;
	}
	/**
	* Returns the editor view.
	*/
	get view() {
		if (this.editorView) return this.editorView;
		return new Proxy({
			state: this.editorState,
			updateState: (state) => {
				this.editorState = state;
			},
			dispatch: (tr) => {
				this.dispatchTransaction(tr);
			},
			composing: false,
			dragging: null,
			editable: true,
			isDestroyed: false
		}, { get: (obj, key) => {
			if (this.editorView) return this.editorView[key];
			if (key === "state") return this.editorState;
			if (key in obj) return Reflect.get(obj, key);
			throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`);
		} });
	}
	/**
	* Returns the editor state.
	*/
	get state() {
		if (this.editorView) this.editorState = this.view.state;
		return this.editorState;
	}
	/**
	* Register a ProseMirror plugin.
	*
	* @param plugin A ProseMirror plugin
	* @param handlePlugins Control how to merge the plugin into the existing plugins.
	* @returns The new editor state
	*/
	registerPlugin(plugin, handlePlugins) {
		const plugins = isFunction$1(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];
		const state = this.state.reconfigure({ plugins });
		this.view.updateState(state);
		return state;
	}
	/**
	* Unregister a ProseMirror plugin.
	*
	* @param nameOrPluginKeyToRemove The plugins name
	* @returns The new editor state or undefined if the editor is destroyed
	*/
	unregisterPlugin(nameOrPluginKeyToRemove) {
		if (this.isDestroyed) return;
		const prevPlugins = this.state.plugins;
		let plugins = prevPlugins;
		[].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {
			const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
			plugins = plugins.filter((plugin) => !plugin.key.startsWith(name));
		});
		if (prevPlugins.length === plugins.length) return;
		const state = this.state.reconfigure({ plugins });
		this.view.updateState(state);
		return state;
	}
	/**
	* Creates an extension manager.
	*/
	createExtensionManager() {
		var _a, _b, _c, _d;
		const allExtensions = [...this.options.enableCoreExtensions ? [
			Editable,
			ClipboardTextSerializer.configure({ blockSeparator: (_b = (_a = this.options.coreExtensionOptions) == null ? void 0 : _a.clipboardTextSerializer) == null ? void 0 : _b.blockSeparator }),
			Commands,
			FocusEvents,
			Keymap,
			Tabindex.configure({ value: (_d = (_c = this.options.coreExtensionOptions) == null ? void 0 : _c.tabindex) == null ? void 0 : _d.value }),
			Drop,
			Paste,
			Delete,
			TextDirection.configure({ direction: this.options.textDirection })
		].filter((ext) => {
			if (typeof this.options.enableCoreExtensions === "object") return this.options.enableCoreExtensions[ext.name] !== false;
			return true;
		}) : [], ...this.options.extensions].filter((extension) => {
			return [
				"extension",
				"node",
				"mark"
			].includes(extension == null ? void 0 : extension.type);
		});
		this.extensionManager = new ExtensionManager(allExtensions, this);
	}
	/**
	* Creates an command manager.
	*/
	createCommandManager() {
		this.commandManager = new CommandManager({ editor: this });
	}
	/**
	* Creates a ProseMirror schema.
	*/
	createSchema() {
		this.schema = this.extensionManager.schema;
	}
	/**
	* Creates the initial document.
	*/
	createDoc() {
		let doc;
		try {
			doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
		} catch (e) {
			if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
			this.emit("contentError", {
				editor: this,
				error: e,
				disableCollaboration: () => {
					if ("collaboration" in this.storage && typeof this.storage.collaboration === "object" && this.storage.collaboration) this.storage.collaboration.isDisabled = true;
					this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
					this.createExtensionManager();
				}
			});
			doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
		}
		return doc;
	}
	/**
	* Creates a ProseMirror view.
	*/
	createView(element) {
		const { editorProps, enableExtensionDispatchTransaction } = this.options;
		const baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);
		const dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;
		const baseTransformPastedHTML = editorProps.transformPastedHTML;
		const transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);
		this.editorView = new EditorView(element, {
			...editorProps,
			attributes: {
				role: "textbox",
				...editorProps == null ? void 0 : editorProps.attributes
			},
			dispatchTransaction: dispatch,
			transformPastedHTML,
			state: this.editorState,
			markViews: this.extensionManager.markViews,
			nodeViews: this.extensionManager.nodeViews
		});
		const newState = this.state.reconfigure({ plugins: this.extensionManager.plugins });
		this.view.updateState(newState);
		this.prependClass();
		this.injectCSS();
		const dom = this.view.dom;
		dom.editor = this;
	}
	/**
	* Creates all node and mark views.
	*/
	createNodeViews() {
		if (this.view.isDestroyed) return;
		this.view.setProps({
			markViews: this.extensionManager.markViews,
			nodeViews: this.extensionManager.nodeViews
		});
	}
	/**
	* Prepend class name to element.
	*/
	prependClass() {
		this.view.dom.className = `${this.className} ${this.view.dom.className}`;
	}
	captureTransaction(fn) {
		this.isCapturingTransaction = true;
		fn();
		this.isCapturingTransaction = false;
		const tr = this.capturedTransaction;
		this.capturedTransaction = null;
		return tr;
	}
	/**
	* The callback over which to send transactions (state updates) produced by the view.
	*
	* @param transaction An editor state transaction
	*/
	dispatchTransaction(transaction) {
		if (this.view.isDestroyed) return;
		if (this.isCapturingTransaction) {
			if (!this.capturedTransaction) {
				this.capturedTransaction = transaction;
				return;
			}
			transaction.steps.forEach((step) => {
				var _a;
				return (_a = this.capturedTransaction) == null ? void 0 : _a.step(step);
			});
			return;
		}
		const { state, transactions } = this.state.applyTransaction(transaction);
		const selectionHasChanged = !this.state.selection.eq(state.selection);
		const rootTrWasApplied = transactions.includes(transaction);
		const prevState = this.state;
		this.emit("beforeTransaction", {
			editor: this,
			transaction,
			nextState: state
		});
		if (!rootTrWasApplied) return;
		this.view.updateState(state);
		this.emit("transaction", {
			editor: this,
			transaction,
			appendedTransactions: transactions.slice(1)
		});
		if (selectionHasChanged) this.emit("selectionUpdate", {
			editor: this,
			transaction
		});
		const mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta("focus") || tr.getMeta("blur"));
		const focus2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("focus");
		const blur2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("blur");
		if (focus2) this.emit("focus", {
			editor: this,
			event: focus2.event,
			transaction: mostRecentFocusTr
		});
		if (blur2) this.emit("blur", {
			editor: this,
			event: blur2.event,
			transaction: mostRecentFocusTr
		});
		if (transaction.getMeta("preventUpdate") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) return;
		this.emit("update", {
			editor: this,
			transaction,
			appendedTransactions: transactions.slice(1)
		});
	}
	/**
	* Get attributes of the currently selected node or mark.
	*/
	getAttributes(nameOrType) {
		return getAttributes(this.state, nameOrType);
	}
	isActive(nameOrAttributes, attributesOrUndefined) {
		const name = typeof nameOrAttributes === "string" ? nameOrAttributes : null;
		const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
		return isActive(this.state, name, attributes);
	}
	/**
	* Get the document as JSON.
	*/
	getJSON() {
		return this.state.doc.toJSON();
	}
	/**
	* Get the document as HTML.
	*/
	getHTML() {
		return getHTMLFromFragment(this.state.doc.content, this.schema);
	}
	/**
	* Get the document as text.
	*/
	getText(options) {
		const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
		return getText(this.state.doc, {
			blockSeparator,
			textSerializers: {
				...getTextSerializersFromSchema(this.schema),
				...textSerializers
			}
		});
	}
	/**
	* Check if there is no content.
	*/
	get isEmpty() {
		return isNodeEmpty(this.state.doc);
	}
	/**
	* Destroy the editor.
	*/
	destroy() {
		if (this.destroyed) return;
		this.destroyed = true;
		this.emit("destroy");
		this.unmount();
		this.removeAllListeners();
		this.extensionManager.destroy();
		this.extensionManager = null;
		this.schema = null;
		this.commandManager = null;
		this.extensionStorage = {};
	}
	/**
	* Check if the editor is already destroyed.
	*/
	get isDestroyed() {
		var _a, _b;
		return (_b = (_a = this.editorView) == null ? void 0 : _a.isDestroyed) != null ? _b : true;
	}
	$node(selector, attributes) {
		var _a;
		return ((_a = this.$doc) == null ? void 0 : _a.querySelector(selector, attributes)) || null;
	}
	$nodes(selector, attributes) {
		var _a;
		return ((_a = this.$doc) == null ? void 0 : _a.querySelectorAll(selector, attributes)) || null;
	}
	$pos(pos) {
		const $pos = this.state.doc.resolve(pos);
		const node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText ? $pos.nodeAfter : null;
		return new NodePos($pos, this, false, node);
	}
	get $doc() {
		return this.$pos(0);
	}
};
function markInputRule(config) {
	return new InputRule({
		find: config.find,
		handler: ({ state, range, match }) => {
			const attributes = callOrReturn(config.getAttributes, void 0, match);
			if (attributes === false || attributes === null) return null;
			const { tr } = state;
			const captureGroup = match[match.length - 1];
			const fullMatch = match[0];
			if (captureGroup) {
				const startSpaces = fullMatch.search(/\S/);
				const textStart = range.from + fullMatch.indexOf(captureGroup);
				const textEnd = textStart + captureGroup.length;
				if (getMarksBetween(range.from, range.to, state.doc).filter((item) => {
					return item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);
				}).filter((item) => item.to > textStart).length) return null;
				if (textEnd < range.to) tr.delete(textEnd, range.to);
				if (textStart > range.from) tr.delete(range.from + startSpaces, textStart);
				const markEnd = range.from + startSpaces + captureGroup.length;
				tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
				tr.removeStoredMark(config.type);
			}
		},
		undoable: config.undoable
	});
}
function nodeInputRule(config) {
	return new InputRule({
		find: config.find,
		handler: ({ state, range, match }) => {
			const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
			const { tr } = state;
			const start = range.from;
			let end = range.to;
			const newNode = config.type.create(attributes);
			if (match[1]) {
				let matchStart = start + match[0].lastIndexOf(match[1]);
				if (matchStart > end) matchStart = end;
				else end = matchStart + match[1].length;
				const lastChar = match[0][match[0].length - 1];
				tr.insertText(lastChar, start + match[0].length - 1);
				tr.replaceWith(matchStart, end, newNode);
			} else if (match[0]) {
				const insertionStart = config.type.isInline ? start : start - 1;
				tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
			}
			tr.scrollIntoView();
		},
		undoable: config.undoable
	});
}
function textblockTypeInputRule(config) {
	return new InputRule({
		find: config.find,
		handler: ({ state, range, match }) => {
			const $start = state.doc.resolve(range.from);
			const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
			if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) return null;
			state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);
		},
		undoable: config.undoable
	});
}
function wrappingInputRule(config) {
	return new InputRule({
		find: config.find,
		handler: ({ state, range, match, chain }) => {
			const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
			const tr = state.tr.delete(range.from, range.to);
			const blockRange = tr.doc.resolve(range.from).blockRange();
			const wrapping = blockRange && findWrapping(blockRange, config.type, attributes);
			if (!wrapping) return null;
			tr.wrap(blockRange, wrapping);
			if (config.keepMarks && config.editor) {
				const { selection, storedMarks } = state;
				const { splittableMarks } = config.editor.extensionManager;
				const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
				if (marks) {
					const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
					tr.ensureMarks(filteredMarks);
				}
			}
			if (config.keepAttributes) {
				const nodeType = config.type.name === "bulletList" || config.type.name === "orderedList" ? "listItem" : "taskList";
				chain().updateAttributes(nodeType, attributes).run();
			}
			const before = tr.doc.resolve(range.from - 1).nodeBefore;
			if (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) tr.join(range.from - 1);
		},
		undoable: config.undoable
	});
}
var isTouchEvent = (e) => {
	return "touches" in e;
};
var ResizableNodeView = class {
	/**
	* Creates a new ResizableNodeView instance.
	*
	* The constructor sets up the resize handles, applies initial sizing from
	* node attributes, and configures all resize behavior options.
	*
	* @param options - Configuration options for the resizable node view
	*/
	constructor(options) {
		/** Active resize handle directions */
		this.directions = [
			"bottom-left",
			"bottom-right",
			"top-left",
			"top-right"
		];
		/** Minimum allowed dimensions */
		this.minSize = {
			height: 8,
			width: 8
		};
		/** Whether to always preserve aspect ratio */
		this.preserveAspectRatio = false;
		/** CSS class names for elements */
		this.classNames = {
			container: "",
			wrapper: "",
			handle: "",
			resizing: ""
		};
		/** Initial width of the element (for aspect ratio calculation) */
		this.initialWidth = 0;
		/** Initial height of the element (for aspect ratio calculation) */
		this.initialHeight = 0;
		/** Calculated aspect ratio (width / height) */
		this.aspectRatio = 1;
		/** Whether a resize operation is currently active */
		this.isResizing = false;
		/** The handle currently being dragged */
		this.activeHandle = null;
		/** Starting mouse X position when resize began */
		this.startX = 0;
		/** Starting mouse Y position when resize began */
		this.startY = 0;
		/** Element width when resize began */
		this.startWidth = 0;
		/** Element height when resize began */
		this.startHeight = 0;
		/** Whether Shift key is currently pressed (for temporary aspect ratio lock) */
		this.isShiftKeyPressed = false;
		/** Last known editable state of the editor */
		this.lastEditableState = void 0;
		/** Map of handle elements by direction */
		this.handleMap = /* @__PURE__ */ new Map();
		/**
		* Handles mouse movement during an active resize.
		*
		* Calculates the delta from the starting position, computes new dimensions
		* based on the active handle direction, applies constraints and aspect ratio,
		* then updates the element's style and calls the onResize callback.
		*
		* @param event - The mouse move event
		*/
		this.handleMouseMove = (event) => {
			if (!this.isResizing || !this.activeHandle) return;
			const deltaX = event.clientX - this.startX;
			const deltaY = event.clientY - this.startY;
			this.handleResize(deltaX, deltaY);
		};
		this.handleTouchMove = (event) => {
			if (!this.isResizing || !this.activeHandle) return;
			const touch = event.touches[0];
			if (!touch) return;
			const deltaX = touch.clientX - this.startX;
			const deltaY = touch.clientY - this.startY;
			this.handleResize(deltaX, deltaY);
		};
		/**
		* Completes the resize operation when the mouse button is released.
		*
		* Captures final dimensions, calls the onCommit callback to persist changes,
		* removes the resizing state and class, and cleans up document-level listeners.
		*/
		this.handleMouseUp = () => {
			if (!this.isResizing) return;
			const finalWidth = this.element.offsetWidth;
			const finalHeight = this.element.offsetHeight;
			this.onCommit(finalWidth, finalHeight);
			this.isResizing = false;
			this.activeHandle = null;
			this.container.dataset.resizeState = "false";
			if (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);
			document.removeEventListener("mousemove", this.handleMouseMove);
			document.removeEventListener("mouseup", this.handleMouseUp);
			document.removeEventListener("keydown", this.handleKeyDown);
			document.removeEventListener("keyup", this.handleKeyUp);
		};
		/**
		* Tracks Shift key state to enable temporary aspect ratio locking.
		*
		* When Shift is pressed during resize, aspect ratio is preserved even if
		* preserveAspectRatio is false.
		*
		* @param event - The keyboard event
		*/
		this.handleKeyDown = (event) => {
			if (event.key === "Shift") this.isShiftKeyPressed = true;
		};
		/**
		* Tracks Shift key release to disable temporary aspect ratio locking.
		*
		* @param event - The keyboard event
		*/
		this.handleKeyUp = (event) => {
			if (event.key === "Shift") this.isShiftKeyPressed = false;
		};
		var _a, _b, _c, _d, _e, _f;
		this.node = options.node;
		this.editor = options.editor;
		this.element = options.element;
		this.element.draggable = false;
		this.contentElement = options.contentElement;
		this.getPos = options.getPos;
		this.onResize = options.onResize;
		this.onCommit = options.onCommit;
		this.onUpdate = options.onUpdate;
		if ((_a = options.options) == null ? void 0 : _a.min) this.minSize = {
			...this.minSize,
			...options.options.min
		};
		if ((_b = options.options) == null ? void 0 : _b.max) this.maxSize = options.options.max;
		if ((_c = options == null ? void 0 : options.options) == null ? void 0 : _c.directions) this.directions = options.options.directions;
		if ((_d = options.options) == null ? void 0 : _d.preserveAspectRatio) this.preserveAspectRatio = options.options.preserveAspectRatio;
		if ((_e = options.options) == null ? void 0 : _e.className) this.classNames = {
			container: options.options.className.container || "",
			wrapper: options.options.className.wrapper || "",
			handle: options.options.className.handle || "",
			resizing: options.options.className.resizing || ""
		};
		if ((_f = options.options) == null ? void 0 : _f.createCustomHandle) this.createCustomHandle = options.options.createCustomHandle;
		this.wrapper = this.createWrapper();
		this.container = this.createContainer();
		this.applyInitialSize();
		this.attachHandles();
		this.editor.on("update", this.handleEditorUpdate.bind(this));
	}
	/**
	* Returns the top-level DOM node that should be placed in the editor.
	*
	* This is required by the ProseMirror NodeView interface. The container
	* includes the wrapper, handles, and the actual content element.
	*
	* @returns The container element to be inserted into the editor
	*/
	get dom() {
		return this.container;
	}
	get contentDOM() {
		var _a;
		return (_a = this.contentElement) != null ? _a : null;
	}
	handleEditorUpdate() {
		const isEditable = this.editor.isEditable;
		if (isEditable === this.lastEditableState) return;
		this.lastEditableState = isEditable;
		if (!isEditable) this.removeHandles();
		else if (isEditable && this.handleMap.size === 0) this.attachHandles();
	}
	/**
	* Called when the node's content or attributes change.
	*
	* Updates the internal node reference. If a custom `onUpdate` callback
	* was provided, it will be called to handle additional update logic.
	*
	* @param node - The new/updated node
	* @param decorations - Node decorations
	* @param innerDecorations - Inner decorations
	* @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`
	*/
	update(node, decorations, innerDecorations) {
		if (node.type !== this.node.type) return false;
		this.node = node;
		if (this.onUpdate) return this.onUpdate(node, decorations, innerDecorations);
		return true;
	}
	/**
	* Cleanup method called when the node view is being removed.
	*
	* Removes all event listeners to prevent memory leaks. This is required
	* by the ProseMirror NodeView interface. If a resize is active when
	* destroy is called, it will be properly cancelled.
	*/
	destroy() {
		if (this.isResizing) {
			this.container.dataset.resizeState = "false";
			if (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);
			document.removeEventListener("mousemove", this.handleMouseMove);
			document.removeEventListener("mouseup", this.handleMouseUp);
			document.removeEventListener("keydown", this.handleKeyDown);
			document.removeEventListener("keyup", this.handleKeyUp);
			this.isResizing = false;
			this.activeHandle = null;
		}
		this.editor.off("update", this.handleEditorUpdate.bind(this));
		this.container.remove();
	}
	/**
	* Creates the outer container element.
	*
	* The container is the top-level element returned by the NodeView and
	* wraps the entire resizable node. It's set up with flexbox to handle
	* alignment and includes data attributes for styling and identification.
	*
	* @returns The container element
	*/
	createContainer() {
		const element = document.createElement("div");
		element.dataset.resizeContainer = "";
		element.dataset.node = this.node.type.name;
		element.style.display = this.node.type.isInline ? "inline-flex" : "flex";
		if (this.classNames.container) element.className = this.classNames.container;
		element.appendChild(this.wrapper);
		return element;
	}
	/**
	* Creates the wrapper element that contains the content and handles.
	*
	* The wrapper uses relative positioning so that resize handles can be
	* positioned absolutely within it. This is the direct parent of the
	* content element being made resizable.
	*
	* @returns The wrapper element
	*/
	createWrapper() {
		const element = document.createElement("div");
		element.style.position = "relative";
		element.style.display = "block";
		element.dataset.resizeWrapper = "";
		if (this.classNames.wrapper) element.className = this.classNames.wrapper;
		element.appendChild(this.element);
		return element;
	}
	/**
	* Creates a resize handle element for a specific direction.
	*
	* Each handle is absolutely positioned and includes a data attribute
	* identifying its direction for styling purposes.
	*
	* @param direction - The resize direction for this handle
	* @returns The handle element
	*/
	createHandle(direction) {
		const handle = document.createElement("div");
		handle.dataset.resizeHandle = direction;
		handle.style.position = "absolute";
		if (this.classNames.handle) handle.className = this.classNames.handle;
		return handle;
	}
	/**
	* Positions a handle element according to its direction.
	*
	* Corner handles (e.g., 'top-left') are positioned at the intersection
	* of two edges. Edge handles (e.g., 'top') span the full width or height.
	*
	* @param handle - The handle element to position
	* @param direction - The direction determining the position
	*/
	positionHandle(handle, direction) {
		const isTop = direction.includes("top");
		const isBottom = direction.includes("bottom");
		const isLeft = direction.includes("left");
		const isRight = direction.includes("right");
		if (isTop) handle.style.top = "0";
		if (isBottom) handle.style.bottom = "0";
		if (isLeft) handle.style.left = "0";
		if (isRight) handle.style.right = "0";
		if (direction === "top" || direction === "bottom") {
			handle.style.left = "0";
			handle.style.right = "0";
		}
		if (direction === "left" || direction === "right") {
			handle.style.top = "0";
			handle.style.bottom = "0";
		}
	}
	/**
	* Creates and attaches all resize handles to the wrapper.
	*
	* Iterates through the configured directions, creates a handle for each,
	* positions it, attaches the mousedown listener, and appends it to the DOM.
	*/
	attachHandles() {
		this.directions.forEach((direction) => {
			let handle;
			if (this.createCustomHandle) handle = this.createCustomHandle(direction);
			else handle = this.createHandle(direction);
			if (!(handle instanceof HTMLElement)) {
				console.warn(`[ResizableNodeView] createCustomHandle("${direction}") did not return an HTMLElement. Falling back to default handle.`);
				handle = this.createHandle(direction);
			}
			if (!this.createCustomHandle) this.positionHandle(handle, direction);
			handle.addEventListener("mousedown", (event) => this.handleResizeStart(event, direction));
			handle.addEventListener("touchstart", (event) => this.handleResizeStart(event, direction));
			this.handleMap.set(direction, handle);
			this.wrapper.appendChild(handle);
		});
	}
	/**
	* Removes all resize handles from the wrapper.
	*
	* Cleans up the handle map and removes each handle element from the DOM.
	*/
	removeHandles() {
		this.handleMap.forEach((el) => el.remove());
		this.handleMap.clear();
	}
	/**
	* Applies initial sizing from node attributes to the element.
	*
	* If width/height attributes exist on the node, they're applied to the element.
	* Otherwise, the element's natural/current dimensions are measured. The aspect
	* ratio is calculated for later use in aspect-ratio-preserving resizes.
	*/
	applyInitialSize() {
		const width = this.node.attrs.width;
		const height = this.node.attrs.height;
		if (width) {
			this.element.style.width = `${width}px`;
			this.initialWidth = width;
		} else this.initialWidth = this.element.offsetWidth;
		if (height) {
			this.element.style.height = `${height}px`;
			this.initialHeight = height;
		} else this.initialHeight = this.element.offsetHeight;
		if (this.initialWidth > 0 && this.initialHeight > 0) this.aspectRatio = this.initialWidth / this.initialHeight;
	}
	/**
	* Initiates a resize operation when a handle is clicked.
	*
	* Captures the starting mouse position and element dimensions, sets up
	* the resize state, adds the resizing class and state attribute, and
	* attaches document-level listeners for mouse movement and keyboard input.
	*
	* @param event - The mouse down event
	* @param direction - The direction of the handle being dragged
	*/
	handleResizeStart(event, direction) {
		event.preventDefault();
		event.stopPropagation();
		this.isResizing = true;
		this.activeHandle = direction;
		if (isTouchEvent(event)) {
			this.startX = event.touches[0].clientX;
			this.startY = event.touches[0].clientY;
		} else {
			this.startX = event.clientX;
			this.startY = event.clientY;
		}
		this.startWidth = this.element.offsetWidth;
		this.startHeight = this.element.offsetHeight;
		if (this.startWidth > 0 && this.startHeight > 0) this.aspectRatio = this.startWidth / this.startHeight;
		if (this.getPos() !== void 0) {}
		this.container.dataset.resizeState = "true";
		if (this.classNames.resizing) this.container.classList.add(this.classNames.resizing);
		document.addEventListener("mousemove", this.handleMouseMove);
		document.addEventListener("touchmove", this.handleTouchMove);
		document.addEventListener("mouseup", this.handleMouseUp);
		document.addEventListener("keydown", this.handleKeyDown);
		document.addEventListener("keyup", this.handleKeyUp);
	}
	handleResize(deltaX, deltaY) {
		if (!this.activeHandle) return;
		const shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;
		const { width, height } = this.calculateNewDimensions(this.activeHandle, deltaX, deltaY);
		const constrained = this.applyConstraints(width, height, shouldPreserveAspectRatio);
		this.element.style.width = `${constrained.width}px`;
		this.element.style.height = `${constrained.height}px`;
		if (this.onResize) this.onResize(constrained.width, constrained.height);
	}
	/**
	* Calculates new dimensions based on mouse delta and resize direction.
	*
	* Takes the starting dimensions and applies the mouse movement delta
	* according to the handle direction. For corner handles, both dimensions
	* are affected. For edge handles, only one dimension changes. If aspect
	* ratio should be preserved, delegates to applyAspectRatio.
	*
	* @param direction - The active resize handle direction
	* @param deltaX - Horizontal mouse movement since resize start
	* @param deltaY - Vertical mouse movement since resize start
	* @returns The calculated width and height
	*/
	calculateNewDimensions(direction, deltaX, deltaY) {
		let newWidth = this.startWidth;
		let newHeight = this.startHeight;
		const isRight = direction.includes("right");
		const isLeft = direction.includes("left");
		const isBottom = direction.includes("bottom");
		const isTop = direction.includes("top");
		if (isRight) newWidth = this.startWidth + deltaX;
		else if (isLeft) newWidth = this.startWidth - deltaX;
		if (isBottom) newHeight = this.startHeight + deltaY;
		else if (isTop) newHeight = this.startHeight - deltaY;
		if (direction === "right" || direction === "left") newWidth = this.startWidth + (isRight ? deltaX : -deltaX);
		if (direction === "top" || direction === "bottom") newHeight = this.startHeight + (isBottom ? deltaY : -deltaY);
		if (this.preserveAspectRatio || this.isShiftKeyPressed) return this.applyAspectRatio(newWidth, newHeight, direction);
		return {
			width: newWidth,
			height: newHeight
		};
	}
	/**
	* Applies min/max constraints to dimensions.
	*
	* When aspect ratio is NOT preserved, constraints are applied independently
	* to width and height. When aspect ratio IS preserved, constraints are
	* applied while maintaining the aspect ratio—if one dimension hits a limit,
	* the other is recalculated proportionally.
	*
	* This ensures that aspect ratio is never broken when constrained.
	*
	* @param width - The unconstrained width
	* @param height - The unconstrained height
	* @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
	* @returns The constrained dimensions
	*/
	applyConstraints(width, height, preserveAspectRatio) {
		var _a, _b, _c, _d;
		if (!preserveAspectRatio) {
			let constrainedWidth2 = Math.max(this.minSize.width, width);
			let constrainedHeight2 = Math.max(this.minSize.height, height);
			if ((_a = this.maxSize) == null ? void 0 : _a.width) constrainedWidth2 = Math.min(this.maxSize.width, constrainedWidth2);
			if ((_b = this.maxSize) == null ? void 0 : _b.height) constrainedHeight2 = Math.min(this.maxSize.height, constrainedHeight2);
			return {
				width: constrainedWidth2,
				height: constrainedHeight2
			};
		}
		let constrainedWidth = width;
		let constrainedHeight = height;
		if (constrainedWidth < this.minSize.width) {
			constrainedWidth = this.minSize.width;
			constrainedHeight = constrainedWidth / this.aspectRatio;
		}
		if (constrainedHeight < this.minSize.height) {
			constrainedHeight = this.minSize.height;
			constrainedWidth = constrainedHeight * this.aspectRatio;
		}
		if (((_c = this.maxSize) == null ? void 0 : _c.width) && constrainedWidth > this.maxSize.width) {
			constrainedWidth = this.maxSize.width;
			constrainedHeight = constrainedWidth / this.aspectRatio;
		}
		if (((_d = this.maxSize) == null ? void 0 : _d.height) && constrainedHeight > this.maxSize.height) {
			constrainedHeight = this.maxSize.height;
			constrainedWidth = constrainedHeight * this.aspectRatio;
		}
		return {
			width: constrainedWidth,
			height: constrainedHeight
		};
	}
	/**
	* Adjusts dimensions to maintain the original aspect ratio.
	*
	* For horizontal handles (left/right), uses width as the primary dimension
	* and calculates height from it. For vertical handles (top/bottom), uses
	* height as primary and calculates width. For corner handles, uses width
	* as the primary dimension.
	*
	* @param width - The new width
	* @param height - The new height
	* @param direction - The active resize direction
	* @returns Dimensions adjusted to preserve aspect ratio
	*/
	applyAspectRatio(width, height, direction) {
		const isHorizontal = direction === "left" || direction === "right";
		const isVertical = direction === "top" || direction === "bottom";
		if (isHorizontal) return {
			width,
			height: width / this.aspectRatio
		};
		if (isVertical) return {
			width: height * this.aspectRatio,
			height
		};
		return {
			width,
			height: width / this.aspectRatio
		};
	}
};
function canInsertNode(state, nodeType) {
	const { selection } = state;
	const { $from } = selection;
	if (selection instanceof NodeSelection$1) {
		const index = $from.index();
		return $from.parent.canReplaceWith(index, index + 1, nodeType);
	}
	let depth = $from.depth;
	while (depth >= 0) {
		const index = $from.index(depth);
		if ($from.node(depth).contentMatchAt(index).matchType(nodeType)) return true;
		depth -= 1;
	}
	return false;
}
function escapeForRegEx(string) {
	return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}
__export$1({}, {
	createAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,
	createBlockMarkdownSpec: () => createBlockMarkdownSpec,
	createInlineMarkdownSpec: () => createInlineMarkdownSpec,
	parseAttributes: () => parseAttributes,
	parseIndentedBlocks: () => parseIndentedBlocks,
	renderNestedMarkdownContent: () => renderNestedMarkdownContent,
	serializeAttributes: () => serializeAttributes
});
function parseAttributes(attrString) {
	if (!(attrString == null ? void 0 : attrString.trim())) return {};
	const attributes = {};
	const quotedStrings = [];
	const tempString = attrString.replace(/["']([^"']*)["']/g, (match) => {
		quotedStrings.push(match);
		return `__QUOTED_${quotedStrings.length - 1}__`;
	});
	const classMatches = tempString.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
	if (classMatches) attributes.class = classMatches.map((match) => match.trim().slice(1)).join(" ");
	const idMatch = tempString.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
	if (idMatch) attributes.id = idMatch[1];
	Array.from(tempString.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([, key, quotedRef]) => {
		var _a;
		const quotedValue = quotedStrings[parseInt(((_a = quotedRef.match(/__QUOTED_(\d+)__/)) == null ? void 0 : _a[1]) || "0", 10)];
		if (quotedValue) attributes[key] = quotedValue.slice(1, -1);
	});
	const cleanString = tempString.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
	if (cleanString) cleanString.split(/\s+/).filter(Boolean).forEach((attr) => {
		if (attr.match(/^[a-zA-Z][\w-]*$/)) attributes[attr] = true;
	});
	return attributes;
}
function serializeAttributes(attributes) {
	if (!attributes || Object.keys(attributes).length === 0) return "";
	const parts = [];
	if (attributes.class) String(attributes.class).split(/\s+/).filter(Boolean).forEach((cls) => parts.push(`.${cls}`));
	if (attributes.id) parts.push(`#${attributes.id}`);
	Object.entries(attributes).forEach(([key, value]) => {
		if (key === "class" || key === "id") return;
		if (value === true) parts.push(key);
		else if (value !== false && value != null) parts.push(`${key}="${String(value)}"`);
	});
	return parts.join(" ");
}
function createAtomBlockMarkdownSpec(options) {
	const { nodeName, name: markdownName, parseAttributes: parseAttributes2 = parseAttributes, serializeAttributes: serializeAttributes2 = serializeAttributes, defaultAttributes = {}, requiredAttributes = [], allowedAttributes } = options;
	const blockName = markdownName || nodeName;
	const filterAttributes = (attrs) => {
		if (!allowedAttributes) return attrs;
		const filtered = {};
		allowedAttributes.forEach((key) => {
			if (key in attrs) filtered[key] = attrs[key];
		});
		return filtered;
	};
	return {
		parseMarkdown: (token, h2) => {
			const attrs = {
				...defaultAttributes,
				...token.attributes
			};
			return h2.createNode(nodeName, attrs, []);
		},
		markdownTokenizer: {
			name: nodeName,
			level: "block",
			start(src) {
				var _a;
				const regex = new RegExp(`^:::${blockName}(?:\\s|$)`, "m");
				const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
				return index !== void 0 ? index : -1;
			},
			tokenize(src, _tokens, _lexer) {
				const regex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`);
				const match = src.match(regex);
				if (!match) return;
				const attributes = parseAttributes2(match[1] || "");
				if (requiredAttributes.find((required) => !(required in attributes))) return;
				return {
					type: nodeName,
					raw: match[0],
					attributes
				};
			}
		},
		renderMarkdown: (node) => {
			const attrs = serializeAttributes2(filterAttributes(node.attrs || {}));
			return `:::${blockName}${attrs ? ` {${attrs}}` : ""} :::`;
		}
	};
}
function createBlockMarkdownSpec(options) {
	const { nodeName, name: markdownName, getContent, parseAttributes: parseAttributes2 = parseAttributes, serializeAttributes: serializeAttributes2 = serializeAttributes, defaultAttributes = {}, content = "block", allowedAttributes } = options;
	const blockName = markdownName || nodeName;
	const filterAttributes = (attrs) => {
		if (!allowedAttributes) return attrs;
		const filtered = {};
		allowedAttributes.forEach((key) => {
			if (key in attrs) filtered[key] = attrs[key];
		});
		return filtered;
	};
	return {
		parseMarkdown: (token, h2) => {
			let nodeContent;
			if (getContent) {
				const contentResult = getContent(token);
				nodeContent = typeof contentResult === "string" ? [{
					type: "text",
					text: contentResult
				}] : contentResult;
			} else if (content === "block") nodeContent = h2.parseChildren(token.tokens || []);
			else nodeContent = h2.parseInline(token.tokens || []);
			const attrs = {
				...defaultAttributes,
				...token.attributes
			};
			return h2.createNode(nodeName, attrs, nodeContent);
		},
		markdownTokenizer: {
			name: nodeName,
			level: "block",
			start(src) {
				var _a;
				const regex = new RegExp(`^:::${blockName}`, "m");
				const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
				return index !== void 0 ? index : -1;
			},
			tokenize(src, _tokens, lexer) {
				var _a;
				const openingRegex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*\\n`);
				const openingMatch = src.match(openingRegex);
				if (!openingMatch) return;
				const [openingTag, attrString = ""] = openingMatch;
				const attributes = parseAttributes2(attrString);
				let level = 1;
				const position = openingTag.length;
				let matchedContent = "";
				const blockPattern = /^:::([\w-]*)(\s.*)?/gm;
				const remaining = src.slice(position);
				blockPattern.lastIndex = 0;
				for (;;) {
					const match = blockPattern.exec(remaining);
					if (match === null) break;
					const matchPos = match.index;
					const blockType = match[1];
					if ((_a = match[2]) == null ? void 0 : _a.endsWith(":::")) continue;
					if (blockType) level += 1;
					else {
						level -= 1;
						if (level === 0) {
							const rawContent = remaining.slice(0, matchPos);
							matchedContent = rawContent.trim();
							const fullMatch = src.slice(0, position + matchPos + match[0].length);
							let contentTokens = [];
							if (matchedContent) if (content === "block") {
								contentTokens = lexer.blockTokens(rawContent);
								contentTokens.forEach((token) => {
									if (token.text && (!token.tokens || token.tokens.length === 0)) token.tokens = lexer.inlineTokens(token.text);
								});
								while (contentTokens.length > 0) {
									const lastToken = contentTokens[contentTokens.length - 1];
									if (lastToken.type === "paragraph" && (!lastToken.text || lastToken.text.trim() === "")) contentTokens.pop();
									else break;
								}
							} else contentTokens = lexer.inlineTokens(matchedContent);
							return {
								type: nodeName,
								raw: fullMatch,
								attributes,
								content: matchedContent,
								tokens: contentTokens
							};
						}
					}
				}
			}
		},
		renderMarkdown: (node, h2) => {
			const attrs = serializeAttributes2(filterAttributes(node.attrs || {}));
			return `:::${blockName}${attrs ? ` {${attrs}}` : ""}

${h2.renderChildren(node.content || [], "\n\n")}

:::`;
		}
	};
}
function parseShortcodeAttributes(attrString) {
	if (!attrString.trim()) return {};
	const attributes = {};
	const regex = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
	let match = regex.exec(attrString);
	while (match !== null) {
		const [, key, doubleQuoted, singleQuoted] = match;
		attributes[key] = doubleQuoted || singleQuoted;
		match = regex.exec(attrString);
	}
	return attributes;
}
function serializeShortcodeAttributes(attrs) {
	return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}="${value}"`).join(" ");
}
function createInlineMarkdownSpec(options) {
	const { nodeName, name: shortcodeName, getContent, parseAttributes: parseAttributes2 = parseShortcodeAttributes, serializeAttributes: serializeAttributes2 = serializeShortcodeAttributes, defaultAttributes = {}, selfClosing = false, allowedAttributes } = options;
	const shortcode = shortcodeName || nodeName;
	const filterAttributes = (attrs) => {
		if (!allowedAttributes) return attrs;
		const filtered = {};
		allowedAttributes.forEach((attr) => {
			const attrName = typeof attr === "string" ? attr : attr.name;
			const skipIfDefault = typeof attr === "string" ? void 0 : attr.skipIfDefault;
			if (attrName in attrs) {
				const value = attrs[attrName];
				if (skipIfDefault !== void 0 && value === skipIfDefault) return;
				filtered[attrName] = value;
			}
		});
		return filtered;
	};
	const escapedShortcode = shortcode.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
	return {
		parseMarkdown: (token, h2) => {
			const attrs = {
				...defaultAttributes,
				...token.attributes
			};
			if (selfClosing) return h2.createNode(nodeName, attrs);
			const content = getContent ? getContent(token) : token.content || "";
			if (content) return h2.createNode(nodeName, attrs, [h2.createTextNode(content)]);
			return h2.createNode(nodeName, attrs, []);
		},
		markdownTokenizer: {
			name: nodeName,
			level: "inline",
			start(src) {
				const startPattern = selfClosing ? new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\]`) : new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${escapedShortcode}\\]`);
				const match = src.match(startPattern);
				const index = match == null ? void 0 : match.index;
				return index !== void 0 ? index : -1;
			},
			tokenize(src, _tokens, _lexer) {
				const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`);
				const match = src.match(tokenPattern);
				if (!match) return;
				let content = "";
				let attrString = "";
				if (selfClosing) {
					const [, attrs] = match;
					attrString = attrs;
				} else {
					const [, attrs, contentMatch] = match;
					attrString = attrs;
					content = contentMatch || "";
				}
				const attributes = parseAttributes2(attrString.trim());
				return {
					type: nodeName,
					raw: match[0],
					content: content.trim(),
					attributes
				};
			}
		},
		renderMarkdown: (node) => {
			let content = "";
			if (getContent) content = getContent(node);
			else if (node.content && node.content.length > 0) content = node.content.filter((child) => child.type === "text").map((child) => child.text).join("");
			const attrs = serializeAttributes2(filterAttributes(node.attrs || {}));
			const attrString = attrs ? ` ${attrs}` : "";
			if (selfClosing) return `[${shortcode}${attrString}]`;
			return `[${shortcode}${attrString}]${content}[/${shortcode}]`;
		}
	};
}
function parseIndentedBlocks(src, config, lexer) {
	var _a, _b, _c, _d;
	const lines = src.split("\n");
	const items = [];
	let totalRaw = "";
	let i = 0;
	const baseIndentSize = config.baseIndentSize || 2;
	while (i < lines.length) {
		const currentLine = lines[i];
		const itemMatch = currentLine.match(config.itemPattern);
		if (!itemMatch) if (items.length > 0) break;
		else if (currentLine.trim() === "") {
			i += 1;
			totalRaw = `${totalRaw}${currentLine}
`;
			continue;
		} else return;
		const itemData = config.extractItemData(itemMatch);
		const { indentLevel, mainContent } = itemData;
		totalRaw = `${totalRaw}${currentLine}
`;
		const itemContent = [mainContent];
		i += 1;
		while (i < lines.length) {
			const nextLine = lines[i];
			if (nextLine.trim() === "") {
				const nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== "");
				if (nextNonEmptyIndex === -1) break;
				if ((((_b = (_a = lines[i + 1 + nextNonEmptyIndex].match(/^(\s*)/)) == null ? void 0 : _a[1]) == null ? void 0 : _b.length) || 0) > indentLevel) {
					itemContent.push(nextLine);
					totalRaw = `${totalRaw}${nextLine}
`;
					i += 1;
					continue;
				} else break;
			}
			if ((((_d = (_c = nextLine.match(/^(\s*)/)) == null ? void 0 : _c[1]) == null ? void 0 : _d.length) || 0) > indentLevel) {
				itemContent.push(nextLine);
				totalRaw = `${totalRaw}${nextLine}
`;
				i += 1;
			} else break;
		}
		let nestedTokens;
		const nestedContent = itemContent.slice(1);
		if (nestedContent.length > 0) {
			const dedentedNested = nestedContent.map((nestedLine) => nestedLine.slice(indentLevel + baseIndentSize)).join("\n");
			if (dedentedNested.trim()) if (config.customNestedParser) nestedTokens = config.customNestedParser(dedentedNested);
			else nestedTokens = lexer.blockTokens(dedentedNested);
		}
		const token = config.createToken(itemData, nestedTokens);
		items.push(token);
	}
	if (items.length === 0) return;
	return {
		items,
		raw: totalRaw
	};
}
function renderNestedMarkdownContent(node, h2, prefixOrGenerator, ctx) {
	if (!node || !Array.isArray(node.content)) return "";
	const prefix = typeof prefixOrGenerator === "function" ? prefixOrGenerator(ctx) : prefixOrGenerator;
	const [content, ...children] = node.content;
	let output = `${prefix}${h2.renderChildren([content])}`;
	if (children && children.length > 0) children.forEach((child, index) => {
		var _a, _b;
		const childContent = (_b = (_a = h2.renderChild) == null ? void 0 : _a.call(h2, child, index + 1)) != null ? _b : h2.renderChildren([child]);
		if (childContent !== void 0 && childContent !== null) {
			const indentedChild = childContent.split("\n").map((line) => line ? h2.indent(line) : h2.indent("")).join("\n");
			output += child.type === "paragraph" ? `

${indentedChild}` : `
${indentedChild}`;
		}
	});
	return output;
}
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
	const { state } = editor;
	const { doc, tr } = state;
	const thisMark = checkMark;
	doc.descendants((node, pos) => {
		const from = tr.mapping.map(pos);
		const to = tr.mapping.map(pos) + node.nodeSize;
		let foundMark = null;
		node.marks.forEach((mark) => {
			if (mark !== thisMark) return false;
			foundMark = mark;
		});
		if (!foundMark) return;
		let needsUpdate = false;
		Object.keys(attrs).forEach((k) => {
			if (attrs[k] !== foundMark.attrs[k]) needsUpdate = true;
		});
		if (needsUpdate) {
			const updatedMark = checkMark.type.create({
				...checkMark.attrs,
				...attrs
			});
			tr.removeMark(from, to, checkMark.type);
			tr.addMark(from, to, updatedMark);
		}
	});
	if (tr.docChanged) editor.view.dispatch(tr);
}
var Node3 = class _Node extends Extendable {
	constructor() {
		super(...arguments);
		this.type = "node";
	}
	/**
	* Create a new Node instance
	* @param config - Node configuration object or a function that returns a configuration object
	*/
	static create(config = {}) {
		return new _Node(typeof config === "function" ? config() : config);
	}
	configure(options) {
		return super.configure(options);
	}
	extend(extendedConfig) {
		const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
		return super.extend(resolvedConfig);
	}
};
function markPasteRule(config) {
	return new PasteRule({
		find: config.find,
		handler: ({ state, range, match, pasteEvent }) => {
			const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
			if (attributes === false || attributes === null) return null;
			const { tr } = state;
			const captureGroup = match[match.length - 1];
			const fullMatch = match[0];
			let markEnd = range.to;
			if (captureGroup) {
				const startSpaces = fullMatch.search(/\S/);
				const textStart = range.from + fullMatch.indexOf(captureGroup);
				const textEnd = textStart + captureGroup.length;
				if (getMarksBetween(range.from, range.to, state.doc).filter((item) => {
					return item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);
				}).filter((item) => item.to > textStart).length) return null;
				if (textEnd < range.to) tr.delete(textEnd, range.to);
				if (textStart > range.from) tr.delete(range.from + startSpaces, textStart);
				markEnd = range.from + startSpaces + captureGroup.length;
				tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
				if (!(match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length)) tr.removeStoredMark(config.type);
			}
		}
	});
}
//#endregion
//#region node_modules/@tiptap/vue-3/dist/index.js
function useDebouncedRef(value) {
	return (0, vue_exports.customRef)((track, trigger) => {
		return {
			get() {
				track();
				return value;
			},
			set(newValue) {
				value = newValue;
				requestAnimationFrame(() => {
					requestAnimationFrame(() => {
						trigger();
					});
				});
			}
		};
	});
}
var Editor = class extends Editor$1 {
	constructor(options = {}) {
		super(options);
		this.contentComponent = null;
		this.appContext = null;
		this.reactiveState = useDebouncedRef(this.view.state);
		this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage);
		this.on("beforeTransaction", ({ nextState }) => {
			this.reactiveState.value = nextState;
			this.reactiveExtensionStorage.value = this.extensionStorage;
		});
		return (0, vue_exports.markRaw)(this);
	}
	get state() {
		return this.reactiveState ? this.reactiveState.value : this.view.state;
	}
	get storage() {
		return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
	}
	/**
	* Register a ProseMirror plugin.
	*/
	registerPlugin(plugin, handlePlugins) {
		const nextState = super.registerPlugin(plugin, handlePlugins);
		if (this.reactiveState) this.reactiveState.value = nextState;
		return nextState;
	}
	/**
	* Unregister a ProseMirror plugin.
	*/
	unregisterPlugin(nameOrPluginKey) {
		const nextState = super.unregisterPlugin(nameOrPluginKey);
		if (this.reactiveState && nextState) this.reactiveState.value = nextState;
		return nextState;
	}
};
var EditorContent = (0, vue_exports.defineComponent)({
	name: "EditorContent",
	props: { editor: {
		default: null,
		type: Object
	} },
	setup(props) {
		const rootEl = (0, vue_exports.ref)();
		const instance = (0, vue_exports.getCurrentInstance)();
		(0, vue_exports.watchEffect)(() => {
			const editor = props.editor;
			if (editor && editor.options.element && rootEl.value) (0, vue_exports.nextTick)(() => {
				var _a;
				if (!rootEl.value || !((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) return;
				const element = (0, vue_exports.unref)(rootEl.value);
				rootEl.value.append(...editor.view.dom.parentNode.childNodes);
				editor.contentComponent = instance.ctx._;
				if (instance) editor.appContext = {
					...instance.appContext,
					provides: instance.provides
				};
				editor.setOptions({ element });
				editor.createNodeViews();
			});
		});
		(0, vue_exports.onBeforeUnmount)(() => {
			const editor = props.editor;
			if (!editor) return;
			editor.contentComponent = null;
			editor.appContext = null;
		});
		return { rootEl };
	},
	render() {
		return (0, vue_exports.h)("div", { ref: (el) => {
			this.rootEl = el;
		} });
	}
});
(0, vue_exports.defineComponent)({
	name: "NodeViewContent",
	props: { as: {
		type: String,
		default: "div"
	} },
	inject: { nodeViewContentRef: { default: void 0 } },
	mounted() {
		const ref3 = this.nodeViewContentRef;
		if (ref3 && this.$el) ref3(this.$el);
	},
	beforeUnmount() {
		const ref3 = this.nodeViewContentRef;
		if (ref3) ref3(null);
	},
	render() {
		return (0, vue_exports.h)(this.as, {
			style: { whiteSpace: "pre-wrap" },
			"data-node-view-content": ""
		});
	}
});
(0, vue_exports.defineComponent)({
	name: "NodeViewWrapper",
	props: { as: {
		type: String,
		default: "div"
	} },
	inject: ["onDragStart", "decorationClasses"],
	render() {
		var _a, _b;
		return (0, vue_exports.h)(this.as, {
			class: this.decorationClasses,
			style: { whiteSpace: "normal" },
			"data-node-view-wrapper": "",
			onDragstart: this.onDragStart
		}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
	}
});
var useEditor = (options = {}) => {
	const editor = (0, vue_exports.shallowRef)();
	(0, vue_exports.onMounted)(() => {
		editor.value = new Editor(options);
	});
	(0, vue_exports.onBeforeUnmount)(() => {
		var _a;
		(_a = editor.value) == null || _a.destroy();
	});
	return editor;
};
var VueRenderer = class {
	constructor(component, { props = {}, editor }) {
		/**
		* Flag to track if the renderer has been destroyed, preventing queued or asynchronous renders from executing after teardown.
		*/
		this.destroyed = false;
		this.editor = editor;
		this.component = (0, vue_exports.markRaw)(component);
		this.el = document.createElement("div");
		this.props = (0, vue_exports.reactive)(props);
		this.renderedComponent = this.renderComponent();
	}
	get element() {
		return this.renderedComponent.el;
	}
	get ref() {
		var _a, _b, _c, _d;
		if ((_b = (_a = this.renderedComponent.vNode) == null ? void 0 : _a.component) == null ? void 0 : _b.exposed) return this.renderedComponent.vNode.component.exposed;
		return (_d = (_c = this.renderedComponent.vNode) == null ? void 0 : _c.component) == null ? void 0 : _d.proxy;
	}
	renderComponent() {
		if (this.destroyed) return this.renderedComponent;
		let vNode = (0, vue_exports.h)(this.component, this.props);
		if (this.editor.appContext) vNode.appContext = this.editor.appContext;
		if (typeof document !== "undefined" && this.el) (0, vue_exports.render)(vNode, this.el);
		const destroy = () => {
			if (this.el) (0, vue_exports.render)(null, this.el);
			this.el = null;
			vNode = null;
		};
		return {
			vNode,
			destroy,
			el: this.el ? this.el.firstElementChild : null
		};
	}
	updateProps(props = {}) {
		if (this.destroyed) return;
		Object.entries(props).forEach(([key, value]) => {
			this.props[key] = value;
		});
		this.renderComponent();
	}
	destroy() {
		if (this.destroyed) return;
		this.destroyed = true;
		this.renderedComponent.destroy();
	}
};
(0, vue_exports.defineComponent)({
	name: "MarkViewContent",
	props: { as: {
		type: String,
		default: "span"
	} },
	render() {
		return (0, vue_exports.h)(this.as, {
			style: { whiteSpace: "inherit" },
			"data-mark-view-content": ""
		});
	}
});
//#endregion
//#region node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
var h = (tag, attributes) => {
	if (tag === "slot") return 0;
	if (tag instanceof Function) return tag(attributes);
	const { children, ...rest } = attributes != null ? attributes : {};
	if (tag === "svg") throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
	return [
		tag,
		rest,
		children
	];
};
//#endregion
//#region node_modules/@tiptap/extension-blockquote/dist/index.js
function findDiffStart(a, b, pos) {
	for (let i = 0;; i++) {
		if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
		let childA = a.child(i), childB = b.child(i);
		if (childA == childB) {
			pos += childA.nodeSize;
			continue;
		}
		if (!childA.sameMarkup(childB)) return pos;
		if (childA.isText && childA.text != childB.text) {
			for (let j = 0; childA.text[j] == childB.text[j]; j++) pos++;
			return pos;
		}
		if (childA.content.size || childB.content.size) {
			let inner = findDiffStart(childA.content, childB.content, pos + 1);
			if (inner != null) return inner;
		}
		pos += childA.nodeSize;
	}
}
function findDiffEnd(a, b, posA, posB) {
	for (let iA = a.childCount, iB = b.childCount;;) {
		if (iA == 0 || iB == 0) return iA == iB ? null : {
			a: posA,
			b: posB
		};
		let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;
		if (childA == childB) {
			posA -= size;
			posB -= size;
			continue;
		}
		if (!childA.sameMarkup(childB)) return {
			a: posA,
			b: posB
		};
		if (childA.isText && childA.text != childB.text) {
			let same = 0, minSize = Math.min(childA.text.length, childB.text.length);
			while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
				same++;
				posA--;
				posB--;
			}
			return {
				a: posA,
				b: posB
			};
		}
		if (childA.content.size || childB.content.size) {
			let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);
			if (inner) return inner;
		}
		posA -= size;
		posB -= size;
	}
}
var Fragment = class _Fragment {
	/**
	@internal
	*/
	constructor(content, size) {
		this.content = content;
		this.size = size || 0;
		if (size == null) for (let i = 0; i < content.length; i++) this.size += content[i].nodeSize;
	}
	/**
	Invoke a callback for all descendant nodes between the given two
	positions (relative to start of this fragment). Doesn't descend
	into a node when the callback returns `false`.
	*/
	nodesBetween(from, to, f, nodeStart = 0, parent) {
		for (let i = 0, pos = 0; pos < to; i++) {
			let child = this.content[i], end = pos + child.nodeSize;
			if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
				let start = pos + 1;
				child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
			}
			pos = end;
		}
	}
	/**
	Call the given callback for every descendant node. `pos` will be
	relative to the start of the fragment. The callback may return
	`false` to prevent traversal of a given node's children.
	*/
	descendants(f) {
		this.nodesBetween(0, this.size, f);
	}
	/**
	Extract the text between `from` and `to`. See the same method on
	[`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
	*/
	textBetween(from, to, blockSeparator, leafText) {
		let text = "", first = true;
		this.nodesBetween(from, to, (node, pos) => {
			let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
			if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) if (first) first = false;
			else text += blockSeparator;
			text += nodeText;
		}, 0);
		return text;
	}
	/**
	Create a new fragment containing the combined content of this
	fragment and the other.
	*/
	append(other) {
		if (!other.size) return this;
		if (!this.size) return other;
		let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;
		if (last.isText && last.sameMarkup(first)) {
			content[content.length - 1] = last.withText(last.text + first.text);
			i = 1;
		}
		for (; i < other.content.length; i++) content.push(other.content[i]);
		return new _Fragment(content, this.size + other.size);
	}
	/**
	Cut out the sub-fragment between the two given positions.
	*/
	cut(from, to = this.size) {
		if (from == 0 && to == this.size) return this;
		let result = [], size = 0;
		if (to > from) for (let i = 0, pos = 0; pos < to; i++) {
			let child = this.content[i], end = pos + child.nodeSize;
			if (end > from) {
				if (pos < from || end > to) if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));
				else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
				result.push(child);
				size += child.nodeSize;
			}
			pos = end;
		}
		return new _Fragment(result, size);
	}
	/**
	@internal
	*/
	cutByIndex(from, to) {
		if (from == to) return _Fragment.empty;
		if (from == 0 && to == this.content.length) return this;
		return new _Fragment(this.content.slice(from, to));
	}
	/**
	Create a new fragment in which the node at the given index is
	replaced by the given node.
	*/
	replaceChild(index, node) {
		let current = this.content[index];
		if (current == node) return this;
		let copy = this.content.slice();
		let size = this.size + node.nodeSize - current.nodeSize;
		copy[index] = node;
		return new _Fragment(copy, size);
	}
	/**
	Create a new fragment by prepending the given node to this
	fragment.
	*/
	addToStart(node) {
		return new _Fragment([node].concat(this.content), this.size + node.nodeSize);
	}
	/**
	Create a new fragment by appending the given node to this
	fragment.
	*/
	addToEnd(node) {
		return new _Fragment(this.content.concat(node), this.size + node.nodeSize);
	}
	/**
	Compare this fragment to another one.
	*/
	eq(other) {
		if (this.content.length != other.content.length) return false;
		for (let i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;
		return true;
	}
	/**
	The first child of the fragment, or `null` if it is empty.
	*/
	get firstChild() {
		return this.content.length ? this.content[0] : null;
	}
	/**
	The last child of the fragment, or `null` if it is empty.
	*/
	get lastChild() {
		return this.content.length ? this.content[this.content.length - 1] : null;
	}
	/**
	The number of child nodes in this fragment.
	*/
	get childCount() {
		return this.content.length;
	}
	/**
	Get the child node at the given index. Raise an error when the
	index is out of range.
	*/
	child(index) {
		let found2 = this.content[index];
		if (!found2) throw new RangeError("Index " + index + " out of range for " + this);
		return found2;
	}
	/**
	Get the child node at the given index, if it exists.
	*/
	maybeChild(index) {
		return this.content[index] || null;
	}
	/**
	Call `f` for every child node, passing the node, its offset
	into this parent node, and its index.
	*/
	forEach(f) {
		for (let i = 0, p = 0; i < this.content.length; i++) {
			let child = this.content[i];
			f(child, p, i);
			p += child.nodeSize;
		}
	}
	/**
	Find the first position at which this fragment and another
	fragment differ, or `null` if they are the same.
	*/
	findDiffStart(other, pos = 0) {
		return findDiffStart(this, other, pos);
	}
	/**
	Find the first position, searching from the end, at which this
	fragment and the given fragment differ, or `null` if they are
	the same. Since this position will not be the same in both
	nodes, an object with two separate positions is returned.
	*/
	findDiffEnd(other, pos = this.size, otherPos = other.size) {
		return findDiffEnd(this, other, pos, otherPos);
	}
	/**
	Find the index and inner offset corresponding to a given relative
	position in this fragment. The result object will be reused
	(overwritten) the next time the function is called. @internal
	*/
	findIndex(pos) {
		if (pos == 0) return retIndex(0, pos);
		if (pos == this.size) return retIndex(this.content.length, pos);
		if (pos > this.size || pos < 0) throw new RangeError(`Position ${pos} outside of fragment (${this})`);
		for (let i = 0, curPos = 0;; i++) {
			let cur = this.child(i), end = curPos + cur.nodeSize;
			if (end >= pos) {
				if (end == pos) return retIndex(i + 1, end);
				return retIndex(i, curPos);
			}
			curPos = end;
		}
	}
	/**
	Return a debugging string that describes this fragment.
	*/
	toString() {
		return "<" + this.toStringInner() + ">";
	}
	/**
	@internal
	*/
	toStringInner() {
		return this.content.join(", ");
	}
	/**
	Create a JSON-serializeable representation of this fragment.
	*/
	toJSON() {
		return this.content.length ? this.content.map((n) => n.toJSON()) : null;
	}
	/**
	Deserialize a fragment from its JSON representation.
	*/
	static fromJSON(schema, value) {
		if (!value) return _Fragment.empty;
		if (!Array.isArray(value)) throw new RangeError("Invalid input for Fragment.fromJSON");
		return _Fragment.fromArray(value.map(schema.nodeFromJSON));
	}
	/**
	Build a fragment from an array of nodes. Ensures that adjacent
	text nodes with the same marks are joined together.
	*/
	static fromArray(array) {
		if (!array.length) return _Fragment.empty;
		let joined, size = 0;
		for (let i = 0; i < array.length; i++) {
			let node = array[i];
			size += node.nodeSize;
			if (i && node.isText && array[i - 1].sameMarkup(node)) {
				if (!joined) joined = array.slice(0, i);
				joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);
			} else if (joined) joined.push(node);
		}
		return new _Fragment(joined || array, size);
	}
	/**
	Create a fragment from something that can be interpreted as a
	set of nodes. For `null`, it returns the empty fragment. For a
	fragment, the fragment itself. For a node or array of nodes, a
	fragment containing those nodes.
	*/
	static from(nodes) {
		if (!nodes) return _Fragment.empty;
		if (nodes instanceof _Fragment) return nodes;
		if (Array.isArray(nodes)) return this.fromArray(nodes);
		if (nodes.attrs) return new _Fragment([nodes], nodes.nodeSize);
		throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
	}
};
Fragment.empty = new Fragment([], 0);
var found = {
	index: 0,
	offset: 0
};
function retIndex(index, offset) {
	found.index = index;
	found.offset = offset;
	return found;
}
function compareDeep(a, b) {
	if (a === b) return true;
	if (!(a && typeof a == "object") || !(b && typeof b == "object")) return false;
	let array = Array.isArray(a);
	if (Array.isArray(b) != array) return false;
	if (array) {
		if (a.length != b.length) return false;
		for (let i = 0; i < a.length; i++) if (!compareDeep(a[i], b[i])) return false;
	} else {
		for (let p in a) if (!(p in b) || !compareDeep(a[p], b[p])) return false;
		for (let p in b) if (!(p in a)) return false;
	}
	return true;
}
var Mark = class _Mark {
	/**
	@internal
	*/
	constructor(type, attrs) {
		this.type = type;
		this.attrs = attrs;
	}
	/**
	Given a set of marks, create a new set which contains this one as
	well, in the right position. If this mark is already in the set,
	the set itself is returned. If any marks that are set to be
	[exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
	those are replaced by this one.
	*/
	addToSet(set) {
		let copy, placed = false;
		for (let i = 0; i < set.length; i++) {
			let other = set[i];
			if (this.eq(other)) return set;
			if (this.type.excludes(other.type)) {
				if (!copy) copy = set.slice(0, i);
			} else if (other.type.excludes(this.type)) return set;
			else {
				if (!placed && other.type.rank > this.type.rank) {
					if (!copy) copy = set.slice(0, i);
					copy.push(this);
					placed = true;
				}
				if (copy) copy.push(other);
			}
		}
		if (!copy) copy = set.slice();
		if (!placed) copy.push(this);
		return copy;
	}
	/**
	Remove this mark from the given set, returning a new set. If this
	mark is not in the set, the set itself is returned.
	*/
	removeFromSet(set) {
		for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));
		return set;
	}
	/**
	Test whether this mark is in the given set of marks.
	*/
	isInSet(set) {
		for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return true;
		return false;
	}
	/**
	Test whether this mark has the same type and attributes as
	another mark.
	*/
	eq(other) {
		return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);
	}
	/**
	Convert this mark to a JSON-serializeable representation.
	*/
	toJSON() {
		let obj = { type: this.type.name };
		for (let _ in this.attrs) {
			obj.attrs = this.attrs;
			break;
		}
		return obj;
	}
	/**
	Deserialize a mark from JSON.
	*/
	static fromJSON(schema, json) {
		if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
		let type = schema.marks[json.type];
		if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
		let mark = type.create(json.attrs);
		type.checkAttrs(mark.attrs);
		return mark;
	}
	/**
	Test whether two sets of marks are identical.
	*/
	static sameSet(a, b) {
		if (a == b) return true;
		if (a.length != b.length) return false;
		for (let i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;
		return true;
	}
	/**
	Create a properly sorted mark set from null, a single mark, or an
	unsorted array of marks.
	*/
	static setFrom(marks) {
		if (!marks || Array.isArray(marks) && marks.length == 0) return _Mark.none;
		if (marks instanceof _Mark) return [marks];
		let copy = marks.slice();
		copy.sort((a, b) => a.type.rank - b.type.rank);
		return copy;
	}
};
Mark.none = [];
var ReplaceError = class extends Error {};
var Slice = class _Slice {
	/**
	Create a slice. When specifying a non-zero open depth, you must
	make sure that there are nodes of at least that depth at the
	appropriate side of the fragment—i.e. if the fragment is an
	empty paragraph node, `openStart` and `openEnd` can't be greater
	than 1.
	
	It is not necessary for the content of open nodes to conform to
	the schema's content constraints, though it should be a valid
	start/end/middle for such a node, depending on which sides are
	open.
	*/
	constructor(content, openStart, openEnd) {
		this.content = content;
		this.openStart = openStart;
		this.openEnd = openEnd;
	}
	/**
	The size this slice would add when inserted into a document.
	*/
	get size() {
		return this.content.size - this.openStart - this.openEnd;
	}
	/**
	@internal
	*/
	insertAt(pos, fragment) {
		let content = insertInto(this.content, pos + this.openStart, fragment, this.openStart + 1, this.openEnd + 1);
		return content && new _Slice(content, this.openStart, this.openEnd);
	}
	/**
	@internal
	*/
	removeBetween(from, to) {
		return new _Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
	}
	/**
	Tests whether this slice is equal to another slice.
	*/
	eq(other) {
		return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;
	}
	/**
	@internal
	*/
	toString() {
		return this.content + "(" + this.openStart + "," + this.openEnd + ")";
	}
	/**
	Convert a slice to a JSON-serializable representation.
	*/
	toJSON() {
		if (!this.content.size) return null;
		let json = { content: this.content.toJSON() };
		if (this.openStart > 0) json.openStart = this.openStart;
		if (this.openEnd > 0) json.openEnd = this.openEnd;
		return json;
	}
	/**
	Deserialize a slice from its JSON representation.
	*/
	static fromJSON(schema, json) {
		if (!json) return _Slice.empty;
		let openStart = json.openStart || 0, openEnd = json.openEnd || 0;
		if (typeof openStart != "number" || typeof openEnd != "number") throw new RangeError("Invalid input for Slice.fromJSON");
		return new _Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);
	}
	/**
	Create a slice from a fragment by taking the maximum possible
	open value on both side of the fragment.
	*/
	static maxOpen(fragment, openIsolating = true) {
		let openStart = 0, openEnd = 0;
		for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;
		for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++;
		return new _Slice(fragment, openStart, openEnd);
	}
};
Slice.empty = new Slice(Fragment.empty, 0, 0);
function removeRange(content, from, to) {
	let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
	let { index: indexTo, offset: offsetTo } = content.findIndex(to);
	if (offset == from || child.isText) {
		if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError("Removing non-flat range");
		return content.cut(0, from).append(content.cut(to));
	}
	if (index != indexTo) throw new RangeError("Removing non-flat range");
	return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
}
function insertInto(content, dist, insert, openStart, openEnd, parent) {
	let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
	if (offset == dist || child.isText) {
		if (parent && openStart <= 0 && openEnd <= 0 && !parent.canReplace(index, index, insert)) return null;
		return content.cut(0, dist).append(insert).append(content.cut(dist));
	}
	let inner = insertInto(child.content, dist - offset - 1, insert, index == 0 ? openStart - 1 : 0, index == content.childCount - 1 ? openEnd - 1 : 0, child);
	return inner && content.replaceChild(index, child.copy(inner));
}
function replace($from, $to, slice) {
	if (slice.openStart > $from.depth) throw new ReplaceError("Inserted content deeper than insertion position");
	if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError("Inconsistent open depths");
	return replaceOuter($from, $to, slice, 0);
}
function replaceOuter($from, $to, slice, depth) {
	let index = $from.index(depth), node = $from.node(depth);
	if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
		let inner = replaceOuter($from, $to, slice, depth + 1);
		return node.copy(node.content.replaceChild(index, inner));
	} else if (!slice.content.size) return close(node, replaceTwoWay($from, $to, depth));
	else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {
		let parent = $from.parent, content = parent.content;
		return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
	} else {
		let { start, end } = prepareSliceForReplace(slice, $from);
		return close(node, replaceThreeWay($from, start, end, $to, depth));
	}
}
function checkJoin(main, sub) {
	if (!sub.type.compatibleContent(main.type)) throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name);
}
function joinable($before, $after, depth) {
	let node = $before.node(depth);
	checkJoin(node, $after.node(depth));
	return node;
}
function addNode(child, target) {
	let last = target.length - 1;
	if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);
	else target.push(child);
}
function addRange($start, $end, depth, target) {
	let node = ($end || $start).node(depth);
	let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;
	if ($start) {
		startIndex = $start.index(depth);
		if ($start.depth > depth) startIndex++;
		else if ($start.textOffset) {
			addNode($start.nodeAfter, target);
			startIndex++;
		}
	}
	for (let i = startIndex; i < endIndex; i++) addNode(node.child(i), target);
	if ($end && $end.depth == depth && $end.textOffset) addNode($end.nodeBefore, target);
}
function close(node, content) {
	node.type.checkContent(content);
	return node.copy(content);
}
function replaceThreeWay($from, $start, $end, $to, depth) {
	let openStart = $from.depth > depth && joinable($from, $start, depth + 1);
	let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);
	let content = [];
	addRange(null, $from, depth, content);
	if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {
		checkJoin(openStart, openEnd);
		addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);
	} else {
		if (openStart) addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);
		addRange($start, $end, depth, content);
		if (openEnd) addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
	}
	addRange($to, null, depth, content);
	return new Fragment(content);
}
function replaceTwoWay($from, $to, depth) {
	let content = [];
	addRange(null, $from, depth, content);
	if ($from.depth > depth) addNode(close(joinable($from, $to, depth + 1), replaceTwoWay($from, $to, depth + 1)), content);
	addRange($to, null, depth, content);
	return new Fragment(content);
}
function prepareSliceForReplace(slice, $along) {
	let extra = $along.depth - slice.openStart;
	let node = $along.node(extra).copy(slice.content);
	for (let i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment.from(node));
	return {
		start: node.resolveNoCache(slice.openStart + extra),
		end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
	};
}
var ResolvedPos = class _ResolvedPos {
	/**
	@internal
	*/
	constructor(pos, path, parentOffset) {
		this.pos = pos;
		this.path = path;
		this.parentOffset = parentOffset;
		this.depth = path.length / 3 - 1;
	}
	/**
	@internal
	*/
	resolveDepth(val) {
		if (val == null) return this.depth;
		if (val < 0) return this.depth + val;
		return val;
	}
	/**
	The parent node that the position points into. Note that even if
	a position points into a text node, that node is not considered
	the parent—text nodes are ‘flat’ in this model, and have no content.
	*/
	get parent() {
		return this.node(this.depth);
	}
	/**
	The root node in which the position was resolved.
	*/
	get doc() {
		return this.node(0);
	}
	/**
	The ancestor node at the given level. `p.node(p.depth)` is the
	same as `p.parent`.
	*/
	node(depth) {
		return this.path[this.resolveDepth(depth) * 3];
	}
	/**
	The index into the ancestor at the given level. If this points
	at the 3rd node in the 2nd paragraph on the top level, for
	example, `p.index(0)` is 1 and `p.index(1)` is 2.
	*/
	index(depth) {
		return this.path[this.resolveDepth(depth) * 3 + 1];
	}
	/**
	The index pointing after this position into the ancestor at the
	given level.
	*/
	indexAfter(depth) {
		depth = this.resolveDepth(depth);
		return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);
	}
	/**
	The (absolute) position at the start of the node at the given
	level.
	*/
	start(depth) {
		depth = this.resolveDepth(depth);
		return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
	}
	/**
	The (absolute) position at the end of the node at the given
	level.
	*/
	end(depth) {
		depth = this.resolveDepth(depth);
		return this.start(depth) + this.node(depth).content.size;
	}
	/**
	The (absolute) position directly before the wrapping node at the
	given level, or, when `depth` is `this.depth + 1`, the original
	position.
	*/
	before(depth) {
		depth = this.resolveDepth(depth);
		if (!depth) throw new RangeError("There is no position before the top-level node");
		return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];
	}
	/**
	The (absolute) position directly after the wrapping node at the
	given level, or the original position when `depth` is `this.depth + 1`.
	*/
	after(depth) {
		depth = this.resolveDepth(depth);
		if (!depth) throw new RangeError("There is no position after the top-level node");
		return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;
	}
	/**
	When this position points into a text node, this returns the
	distance between the position and the start of the text node.
	Will be zero for positions that point between nodes.
	*/
	get textOffset() {
		return this.pos - this.path[this.path.length - 1];
	}
	/**
	Get the node directly after the position, if any. If the position
	points into a text node, only the part of that node after the
	position is returned.
	*/
	get nodeAfter() {
		let parent = this.parent, index = this.index(this.depth);
		if (index == parent.childCount) return null;
		let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);
		return dOff ? parent.child(index).cut(dOff) : child;
	}
	/**
	Get the node directly before the position, if any. If the
	position points into a text node, only the part of that node
	before the position is returned.
	*/
	get nodeBefore() {
		let index = this.index(this.depth);
		let dOff = this.pos - this.path[this.path.length - 1];
		if (dOff) return this.parent.child(index).cut(0, dOff);
		return index == 0 ? null : this.parent.child(index - 1);
	}
	/**
	Get the position at the given index in the parent node at the
	given depth (which defaults to `this.depth`).
	*/
	posAtIndex(index, depth) {
		depth = this.resolveDepth(depth);
		let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
		for (let i = 0; i < index; i++) pos += node.child(i).nodeSize;
		return pos;
	}
	/**
	Get the marks at this position, factoring in the surrounding
	marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
	position is at the start of a non-empty node, the marks of the
	node after it (if any) are returned.
	*/
	marks() {
		let parent = this.parent, index = this.index();
		if (parent.content.size == 0) return Mark.none;
		if (this.textOffset) return parent.child(index).marks;
		let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);
		if (!main) {
			let tmp = main;
			main = other;
			other = tmp;
		}
		let marks = main.marks;
		for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);
		return marks;
	}
	/**
	Get the marks after the current position, if any, except those
	that are non-inclusive and not present at position `$end`. This
	is mostly useful for getting the set of marks to preserve after a
	deletion. Will return `null` if this position is at the end of
	its parent node or its parent node isn't a textblock (in which
	case no marks should be preserved).
	*/
	marksAcross($end) {
		let after = this.parent.maybeChild(this.index());
		if (!after || !after.isInline) return null;
		let marks = after.marks, next = $end.parent.maybeChild($end.index());
		for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);
		return marks;
	}
	/**
	The depth up to which this position and the given (non-resolved)
	position share the same parent nodes.
	*/
	sharedDepth(pos) {
		for (let depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;
		return 0;
	}
	/**
	Returns a range based on the place where this position and the
	given position diverge around block content. If both point into
	the same textblock, for example, a range around that textblock
	will be returned. If they point into different blocks, the range
	around those blocks in their shared ancestor is returned. You can
	pass in an optional predicate that will be called with a parent
	node to see if a range into that parent is acceptable.
	*/
	blockRange(other = this, pred) {
		if (other.pos < this.pos) return other.blockRange(this);
		for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange(this, other, d);
		return null;
	}
	/**
	Query whether the given position shares the same parent node.
	*/
	sameParent(other) {
		return this.pos - this.parentOffset == other.pos - other.parentOffset;
	}
	/**
	Return the greater of this and the given position.
	*/
	max(other) {
		return other.pos > this.pos ? other : this;
	}
	/**
	Return the smaller of this and the given position.
	*/
	min(other) {
		return other.pos < this.pos ? other : this;
	}
	/**
	@internal
	*/
	toString() {
		let str = "";
		for (let i = 1; i <= this.depth; i++) str += (str ? "/" : "") + this.node(i).type.name + "_" + this.index(i - 1);
		return str + ":" + this.parentOffset;
	}
	/**
	@internal
	*/
	static resolve(doc, pos) {
		if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError("Position " + pos + " out of range");
		let path = [];
		let start = 0, parentOffset = pos;
		for (let node = doc;;) {
			let { index, offset } = node.content.findIndex(parentOffset);
			let rem = parentOffset - offset;
			path.push(node, index, start + offset);
			if (!rem) break;
			node = node.child(index);
			if (node.isText) break;
			parentOffset = rem - 1;
			start += offset + 1;
		}
		return new _ResolvedPos(pos, path, parentOffset);
	}
	/**
	@internal
	*/
	static resolveCached(doc, pos) {
		let cache = resolveCache.get(doc);
		if (cache) for (let i = 0; i < cache.elts.length; i++) {
			let elt = cache.elts[i];
			if (elt.pos == pos) return elt;
		}
		else resolveCache.set(doc, cache = new ResolveCache());
		let result = cache.elts[cache.i] = _ResolvedPos.resolve(doc, pos);
		cache.i = (cache.i + 1) % resolveCacheSize;
		return result;
	}
};
var ResolveCache = class {
	constructor() {
		this.elts = [];
		this.i = 0;
	}
};
var resolveCacheSize = 12;
var resolveCache = /* @__PURE__ */ new WeakMap();
var NodeRange = class {
	/**
	Construct a node range. `$from` and `$to` should point into the
	same node until at least the given `depth`, since a node range
	denotes an adjacent set of nodes in a single parent node.
	*/
	constructor($from, $to, depth) {
		this.$from = $from;
		this.$to = $to;
		this.depth = depth;
	}
	/**
	The position at the start of the range.
	*/
	get start() {
		return this.$from.before(this.depth + 1);
	}
	/**
	The position at the end of the range.
	*/
	get end() {
		return this.$to.after(this.depth + 1);
	}
	/**
	The parent node that the range points into.
	*/
	get parent() {
		return this.$from.node(this.depth);
	}
	/**
	The start index of the range in the parent node.
	*/
	get startIndex() {
		return this.$from.index(this.depth);
	}
	/**
	The end index of the range in the parent node.
	*/
	get endIndex() {
		return this.$to.indexAfter(this.depth);
	}
};
var emptyAttrs = /* @__PURE__ */ Object.create(null);
var Node = class _Node {
	/**
	@internal
	*/
	constructor(type, attrs, content, marks = Mark.none) {
		this.type = type;
		this.attrs = attrs;
		this.marks = marks;
		this.content = content || Fragment.empty;
	}
	/**
	The array of this node's child nodes.
	*/
	get children() {
		return this.content.content;
	}
	/**
	The size of this node, as defined by the integer-based [indexing
	scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
	amount of characters. For other leaf nodes, it is one. For
	non-leaf nodes, it is the size of the content plus two (the
	start and end token).
	*/
	get nodeSize() {
		return this.isLeaf ? 1 : 2 + this.content.size;
	}
	/**
	The number of children that the node has.
	*/
	get childCount() {
		return this.content.childCount;
	}
	/**
	Get the child node at the given index. Raises an error when the
	index is out of range.
	*/
	child(index) {
		return this.content.child(index);
	}
	/**
	Get the child node at the given index, if it exists.
	*/
	maybeChild(index) {
		return this.content.maybeChild(index);
	}
	/**
	Call `f` for every child node, passing the node, its offset
	into this parent node, and its index.
	*/
	forEach(f) {
		this.content.forEach(f);
	}
	/**
	Invoke a callback for all descendant nodes recursively overlapping
	the given two positions that are relative to start of this
	node's content. This includes all ancestors of the nodes
	containing the two positions. The callback is invoked with the
	node, its position relative to the original node (method receiver),
	its parent node, and its child index. When the callback returns
	false for a given node, that node's children will not be
	recursed over. The last parameter can be used to specify a
	starting position to count from.
	*/
	nodesBetween(from, to, f, startPos = 0) {
		this.content.nodesBetween(from, to, f, startPos, this);
	}
	/**
	Call the given callback for every descendant node. Doesn't
	descend into a node when the callback returns `false`.
	*/
	descendants(f) {
		this.nodesBetween(0, this.content.size, f);
	}
	/**
	Concatenates all the text nodes found in this fragment and its
	children.
	*/
	get textContent() {
		return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
	}
	/**
	Get all text between positions `from` and `to`. When
	`blockSeparator` is given, it will be inserted to separate text
	from different block nodes. If `leafText` is given, it'll be
	inserted for every non-text leaf node encountered, otherwise
	[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
	*/
	textBetween(from, to, blockSeparator, leafText) {
		return this.content.textBetween(from, to, blockSeparator, leafText);
	}
	/**
	Returns this node's first child, or `null` if there are no
	children.
	*/
	get firstChild() {
		return this.content.firstChild;
	}
	/**
	Returns this node's last child, or `null` if there are no
	children.
	*/
	get lastChild() {
		return this.content.lastChild;
	}
	/**
	Test whether two nodes represent the same piece of document.
	*/
	eq(other) {
		return this == other || this.sameMarkup(other) && this.content.eq(other.content);
	}
	/**
	Compare the markup (type, attributes, and marks) of this node to
	those of another. Returns `true` if both have the same markup.
	*/
	sameMarkup(other) {
		return this.hasMarkup(other.type, other.attrs, other.marks);
	}
	/**
	Check whether this node's markup correspond to the given type,
	attributes, and marks.
	*/
	hasMarkup(type, attrs, marks) {
		return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark.sameSet(this.marks, marks || Mark.none);
	}
	/**
	Create a new node with the same markup as this node, containing
	the given content (or empty, if no content is given).
	*/
	copy(content = null) {
		if (content == this.content) return this;
		return new _Node(this.type, this.attrs, content, this.marks);
	}
	/**
	Create a copy of this node, with the given set of marks instead
	of the node's own marks.
	*/
	mark(marks) {
		return marks == this.marks ? this : new _Node(this.type, this.attrs, this.content, marks);
	}
	/**
	Create a copy of this node with only the content between the
	given positions. If `to` is not given, it defaults to the end of
	the node.
	*/
	cut(from, to = this.content.size) {
		if (from == 0 && to == this.content.size) return this;
		return this.copy(this.content.cut(from, to));
	}
	/**
	Cut out the part of the document between the given positions, and
	return it as a `Slice` object.
	*/
	slice(from, to = this.content.size, includeParents = false) {
		if (from == to) return Slice.empty;
		let $from = this.resolve(from), $to = this.resolve(to);
		let depth = includeParents ? 0 : $from.sharedDepth(to);
		let start = $from.start(depth);
		return new Slice($from.node(depth).content.cut($from.pos - start, $to.pos - start), $from.depth - depth, $to.depth - depth);
	}
	/**
	Replace the part of the document between the given positions with
	the given slice. The slice must 'fit', meaning its open sides
	must be able to connect to the surrounding content, and its
	content nodes must be valid children for the node they are placed
	into. If any of this is violated, an error of type
	[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
	*/
	replace(from, to, slice) {
		return replace(this.resolve(from), this.resolve(to), slice);
	}
	/**
	Find the node directly after the given position.
	*/
	nodeAt(pos) {
		for (let node = this;;) {
			let { index, offset } = node.content.findIndex(pos);
			node = node.maybeChild(index);
			if (!node) return null;
			if (offset == pos || node.isText) return node;
			pos -= offset + 1;
		}
	}
	/**
	Find the (direct) child node after the given offset, if any,
	and return it along with its index and offset relative to this
	node.
	*/
	childAfter(pos) {
		let { index, offset } = this.content.findIndex(pos);
		return {
			node: this.content.maybeChild(index),
			index,
			offset
		};
	}
	/**
	Find the (direct) child node before the given offset, if any,
	and return it along with its index and offset relative to this
	node.
	*/
	childBefore(pos) {
		if (pos == 0) return {
			node: null,
			index: 0,
			offset: 0
		};
		let { index, offset } = this.content.findIndex(pos);
		if (offset < pos) return {
			node: this.content.child(index),
			index,
			offset
		};
		let node = this.content.child(index - 1);
		return {
			node,
			index: index - 1,
			offset: offset - node.nodeSize
		};
	}
	/**
	Resolve the given position in the document, returning an
	[object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
	*/
	resolve(pos) {
		return ResolvedPos.resolveCached(this, pos);
	}
	/**
	@internal
	*/
	resolveNoCache(pos) {
		return ResolvedPos.resolve(this, pos);
	}
	/**
	Test whether a given mark or mark type occurs in this document
	between the two given positions.
	*/
	rangeHasMark(from, to, type) {
		let found2 = false;
		if (to > from) this.nodesBetween(from, to, (node) => {
			if (type.isInSet(node.marks)) found2 = true;
			return !found2;
		});
		return found2;
	}
	/**
	True when this is a block (non-inline node)
	*/
	get isBlock() {
		return this.type.isBlock;
	}
	/**
	True when this is a textblock node, a block node with inline
	content.
	*/
	get isTextblock() {
		return this.type.isTextblock;
	}
	/**
	True when this node allows inline content.
	*/
	get inlineContent() {
		return this.type.inlineContent;
	}
	/**
	True when this is an inline node (a text node or a node that can
	appear among text).
	*/
	get isInline() {
		return this.type.isInline;
	}
	/**
	True when this is a text node.
	*/
	get isText() {
		return this.type.isText;
	}
	/**
	True when this is a leaf node.
	*/
	get isLeaf() {
		return this.type.isLeaf;
	}
	/**
	True when this is an atom, i.e. when it does not have directly
	editable content. This is usually the same as `isLeaf`, but can
	be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
	on a node's spec (typically used when the node is displayed as
	an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
	*/
	get isAtom() {
		return this.type.isAtom;
	}
	/**
	Return a string representation of this node for debugging
	purposes.
	*/
	toString() {
		if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
		let name = this.type.name;
		if (this.content.size) name += "(" + this.content.toStringInner() + ")";
		return wrapMarks(this.marks, name);
	}
	/**
	Get the content match in this node at the given index.
	*/
	contentMatchAt(index) {
		let match = this.type.contentMatch.matchFragment(this.content, 0, index);
		if (!match) throw new Error("Called contentMatchAt on a node with invalid content");
		return match;
	}
	/**
	Test whether replacing the range between `from` and `to` (by
	child index) with the given replacement fragment (which defaults
	to the empty fragment) would leave the node's content valid. You
	can optionally pass `start` and `end` indices into the
	replacement fragment.
	*/
	canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {
		let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
		let two = one && one.matchFragment(this.content, to);
		if (!two || !two.validEnd) return false;
		for (let i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;
		return true;
	}
	/**
	Test whether replacing the range `from` to `to` (by index) with
	a node of the given type would leave the node's content valid.
	*/
	canReplaceWith(from, to, type, marks) {
		if (marks && !this.type.allowsMarks(marks)) return false;
		let start = this.contentMatchAt(from).matchType(type);
		let end = start && start.matchFragment(this.content, to);
		return end ? end.validEnd : false;
	}
	/**
	Test whether the given node's content could be appended to this
	node. If that node is empty, this will only return true if there
	is at least one node type that can appear in both nodes (to avoid
	merging completely incompatible nodes).
	*/
	canAppend(other) {
		if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);
		else return this.type.compatibleContent(other.type);
	}
	/**
	Check whether this node and its descendants conform to the
	schema, and raise an exception when they do not.
	*/
	check() {
		this.type.checkContent(this.content);
		this.type.checkAttrs(this.attrs);
		let copy = Mark.none;
		for (let i = 0; i < this.marks.length; i++) {
			let mark = this.marks[i];
			mark.type.checkAttrs(mark.attrs);
			copy = mark.addToSet(copy);
		}
		if (!Mark.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
		this.content.forEach((node) => node.check());
	}
	/**
	Return a JSON-serializeable representation of this node.
	*/
	toJSON() {
		let obj = { type: this.type.name };
		for (let _ in this.attrs) {
			obj.attrs = this.attrs;
			break;
		}
		if (this.content.size) obj.content = this.content.toJSON();
		if (this.marks.length) obj.marks = this.marks.map((n) => n.toJSON());
		return obj;
	}
	/**
	Deserialize a node from its JSON representation.
	*/
	static fromJSON(schema, json) {
		if (!json) throw new RangeError("Invalid input for Node.fromJSON");
		let marks = void 0;
		if (json.marks) {
			if (!Array.isArray(json.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
			marks = json.marks.map(schema.markFromJSON);
		}
		if (json.type == "text") {
			if (typeof json.text != "string") throw new RangeError("Invalid text node in JSON");
			return schema.text(json.text, marks);
		}
		let content = Fragment.fromJSON(schema, json.content);
		let node = schema.nodeType(json.type).create(json.attrs, content, marks);
		node.type.checkAttrs(node.attrs);
		return node;
	}
};
Node.prototype.text = void 0;
function wrapMarks(marks, str) {
	for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
	return str;
}
var ContentMatch = class _ContentMatch {
	/**
	@internal
	*/
	constructor(validEnd) {
		this.validEnd = validEnd;
		this.next = [];
		this.wrapCache = [];
	}
	/**
	@internal
	*/
	static parse(string, nodeTypes) {
		let stream = new TokenStream(string, nodeTypes);
		if (stream.next == null) return _ContentMatch.empty;
		let expr = parseExpr(stream);
		if (stream.next) stream.err("Unexpected trailing text");
		let match = dfa(nfa(expr));
		checkForDeadEnds(match, stream);
		return match;
	}
	/**
	Match a node type, returning a match after that node if
	successful.
	*/
	matchType(type) {
		for (let i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;
		return null;
	}
	/**
	Try to match a fragment. Returns the resulting match when
	successful.
	*/
	matchFragment(frag, start = 0, end = frag.childCount) {
		let cur = this;
		for (let i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);
		return cur;
	}
	/**
	@internal
	*/
	get inlineContent() {
		return this.next.length != 0 && this.next[0].type.isInline;
	}
	/**
	Get the first matching node type at this match position that can
	be generated.
	*/
	get defaultType() {
		for (let i = 0; i < this.next.length; i++) {
			let { type } = this.next[i];
			if (!(type.isText || type.hasRequiredAttrs())) return type;
		}
		return null;
	}
	/**
	@internal
	*/
	compatible(other) {
		for (let i = 0; i < this.next.length; i++) for (let j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;
		return false;
	}
	/**
	Try to match the given fragment, and if that fails, see if it can
	be made to match by inserting nodes in front of it. When
	successful, return a fragment of inserted nodes (which may be
	empty if nothing had to be inserted). When `toEnd` is true, only
	return a fragment if the resulting match goes to the end of the
	content expression.
	*/
	fillBefore(after, toEnd = false, startIndex = 0) {
		let seen = [this];
		function search(match, types) {
			let finished = match.matchFragment(after, startIndex);
			if (finished && (!toEnd || finished.validEnd)) return Fragment.from(types.map((tp) => tp.createAndFill()));
			for (let i = 0; i < match.next.length; i++) {
				let { type, next } = match.next[i];
				if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
					seen.push(next);
					let found2 = search(next, types.concat(type));
					if (found2) return found2;
				}
			}
			return null;
		}
		return search(this, []);
	}
	/**
	Find a set of wrapping node types that would allow a node of the
	given type to appear at this position. The result may be empty
	(when it fits directly) and will be null when no such wrapping
	exists.
	*/
	findWrapping(target) {
		for (let i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];
		let computed = this.computeWrapping(target);
		this.wrapCache.push(target, computed);
		return computed;
	}
	/**
	@internal
	*/
	computeWrapping(target) {
		let seen = /* @__PURE__ */ Object.create(null), active = [{
			match: this,
			type: null,
			via: null
		}];
		while (active.length) {
			let current = active.shift(), match = current.match;
			if (match.matchType(target)) {
				let result = [];
				for (let obj = current; obj.type; obj = obj.via) result.push(obj.type);
				return result.reverse();
			}
			for (let i = 0; i < match.next.length; i++) {
				let { type, next } = match.next[i];
				if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {
					active.push({
						match: type.contentMatch,
						type,
						via: current
					});
					seen[type.name] = true;
				}
			}
		}
		return null;
	}
	/**
	The number of outgoing edges this node has in the finite
	automaton that describes the content expression.
	*/
	get edgeCount() {
		return this.next.length;
	}
	/**
	Get the _n_​th outgoing edge from this node in the finite
	automaton that describes the content expression.
	*/
	edge(n) {
		if (n >= this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`);
		return this.next[n];
	}
	/**
	@internal
	*/
	toString() {
		let seen = [];
		function scan(m) {
			seen.push(m);
			for (let i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);
		}
		scan(this);
		return seen.map((m, i) => {
			let out = i + (m.validEnd ? "*" : " ") + " ";
			for (let i2 = 0; i2 < m.next.length; i2++) out += (i2 ? ", " : "") + m.next[i2].type.name + "->" + seen.indexOf(m.next[i2].next);
			return out;
		}).join("\n");
	}
};
ContentMatch.empty = new ContentMatch(true);
var TokenStream = class {
	constructor(string, nodeTypes) {
		this.string = string;
		this.nodeTypes = nodeTypes;
		this.inline = null;
		this.pos = 0;
		this.tokens = string.split(/\s*(?=\b|\W|$)/);
		if (this.tokens[this.tokens.length - 1] == "") this.tokens.pop();
		if (this.tokens[0] == "") this.tokens.shift();
	}
	get next() {
		return this.tokens[this.pos];
	}
	eat(tok) {
		return this.next == tok && (this.pos++ || true);
	}
	err(str) {
		throw new SyntaxError(str + " (in content expression '" + this.string + "')");
	}
};
function parseExpr(stream) {
	let exprs = [];
	do
		exprs.push(parseExprSeq(stream));
	while (stream.eat("|"));
	return exprs.length == 1 ? exprs[0] : {
		type: "choice",
		exprs
	};
}
function parseExprSeq(stream) {
	let exprs = [];
	do
		exprs.push(parseExprSubscript(stream));
	while (stream.next && stream.next != ")" && stream.next != "|");
	return exprs.length == 1 ? exprs[0] : {
		type: "seq",
		exprs
	};
}
function parseExprSubscript(stream) {
	let expr = parseExprAtom(stream);
	for (;;) if (stream.eat("+")) expr = {
		type: "plus",
		expr
	};
	else if (stream.eat("*")) expr = {
		type: "star",
		expr
	};
	else if (stream.eat("?")) expr = {
		type: "opt",
		expr
	};
	else if (stream.eat("{")) expr = parseExprRange(stream, expr);
	else break;
	return expr;
}
function parseNum(stream) {
	if (/\D/.test(stream.next)) stream.err("Expected number, got '" + stream.next + "'");
	let result = Number(stream.next);
	stream.pos++;
	return result;
}
function parseExprRange(stream, expr) {
	let min = parseNum(stream), max = min;
	if (stream.eat(",")) if (stream.next != "}") max = parseNum(stream);
	else max = -1;
	if (!stream.eat("}")) stream.err("Unclosed braced range");
	return {
		type: "range",
		min,
		max,
		expr
	};
}
function resolveName(stream, name) {
	let types = stream.nodeTypes, type = types[name];
	if (type) return [type];
	let result = [];
	for (let typeName in types) {
		let type2 = types[typeName];
		if (type2.isInGroup(name)) result.push(type2);
	}
	if (result.length == 0) stream.err("No node type or group '" + name + "' found");
	return result;
}
function parseExprAtom(stream) {
	if (stream.eat("(")) {
		let expr = parseExpr(stream);
		if (!stream.eat(")")) stream.err("Missing closing paren");
		return expr;
	} else if (!/\W/.test(stream.next)) {
		let exprs = resolveName(stream, stream.next).map((type) => {
			if (stream.inline == null) stream.inline = type.isInline;
			else if (stream.inline != type.isInline) stream.err("Mixing inline and block content");
			return {
				type: "name",
				value: type
			};
		});
		stream.pos++;
		return exprs.length == 1 ? exprs[0] : {
			type: "choice",
			exprs
		};
	} else stream.err("Unexpected token '" + stream.next + "'");
}
function nfa(expr) {
	let nfa2 = [[]];
	connect(compile(expr, 0), node());
	return nfa2;
	function node() {
		return nfa2.push([]) - 1;
	}
	function edge(from, to, term) {
		let edge2 = {
			term,
			to
		};
		nfa2[from].push(edge2);
		return edge2;
	}
	function connect(edges, to) {
		edges.forEach((edge2) => edge2.to = to);
	}
	function compile(expr2, from) {
		if (expr2.type == "choice") return expr2.exprs.reduce((out, expr3) => out.concat(compile(expr3, from)), []);
		else if (expr2.type == "seq") for (let i = 0;; i++) {
			let next = compile(expr2.exprs[i], from);
			if (i == expr2.exprs.length - 1) return next;
			connect(next, from = node());
		}
		else if (expr2.type == "star") {
			let loop = node();
			edge(from, loop);
			connect(compile(expr2.expr, loop), loop);
			return [edge(loop)];
		} else if (expr2.type == "plus") {
			let loop = node();
			connect(compile(expr2.expr, from), loop);
			connect(compile(expr2.expr, loop), loop);
			return [edge(loop)];
		} else if (expr2.type == "opt") return [edge(from)].concat(compile(expr2.expr, from));
		else if (expr2.type == "range") {
			let cur = from;
			for (let i = 0; i < expr2.min; i++) {
				let next = node();
				connect(compile(expr2.expr, cur), next);
				cur = next;
			}
			if (expr2.max == -1) connect(compile(expr2.expr, cur), cur);
			else for (let i = expr2.min; i < expr2.max; i++) {
				let next = node();
				edge(cur, next);
				connect(compile(expr2.expr, cur), next);
				cur = next;
			}
			return [edge(cur)];
		} else if (expr2.type == "name") return [edge(from, void 0, expr2.value)];
		else throw new Error("Unknown expr type");
	}
}
function cmp(a, b) {
	return b - a;
}
function nullFrom(nfa2, node) {
	let result = [];
	scan(node);
	return result.sort(cmp);
	function scan(node2) {
		let edges = nfa2[node2];
		if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);
		result.push(node2);
		for (let i = 0; i < edges.length; i++) {
			let { term, to } = edges[i];
			if (!term && result.indexOf(to) == -1) scan(to);
		}
	}
}
function dfa(nfa2) {
	let labeled = /* @__PURE__ */ Object.create(null);
	return explore(nullFrom(nfa2, 0));
	function explore(states) {
		let out = [];
		states.forEach((node) => {
			nfa2[node].forEach(({ term, to }) => {
				if (!term) return;
				let set;
				for (let i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];
				nullFrom(nfa2, to).forEach((node2) => {
					if (!set) out.push([term, set = []]);
					if (set.indexOf(node2) == -1) set.push(node2);
				});
			});
		});
		let state = labeled[states.join(",")] = new ContentMatch(states.indexOf(nfa2.length - 1) > -1);
		for (let i = 0; i < out.length; i++) {
			let states2 = out[i][1].sort(cmp);
			state.next.push({
				type: out[i][0],
				next: labeled[states2.join(",")] || explore(states2)
			});
		}
		return state;
	}
}
function checkForDeadEnds(match, stream) {
	for (let i = 0, work = [match]; i < work.length; i++) {
		let state = work[i], dead = !state.validEnd, nodes = [];
		for (let j = 0; j < state.next.length; j++) {
			let { type, next } = state.next[j];
			nodes.push(type.name);
			if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;
			if (work.indexOf(next) == -1) work.push(next);
		}
		if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
	}
}
var lower16 = 65535;
var factor16 = Math.pow(2, 16);
function makeRecover(index, offset) {
	return index + offset * factor16;
}
function recoverIndex(value) {
	return value & lower16;
}
function recoverOffset(value) {
	return (value - (value & lower16)) / factor16;
}
var DEL_BEFORE = 1;
var DEL_AFTER = 2;
var DEL_ACROSS = 4;
var DEL_SIDE = 8;
var MapResult = class {
	/**
	@internal
	*/
	constructor(pos, delInfo, recover) {
		this.pos = pos;
		this.delInfo = delInfo;
		this.recover = recover;
	}
	/**
	Tells you whether the position was deleted, that is, whether the
	step removed the token on the side queried (via the `assoc`)
	argument from the document.
	*/
	get deleted() {
		return (this.delInfo & DEL_SIDE) > 0;
	}
	/**
	Tells you whether the token before the mapped position was deleted.
	*/
	get deletedBefore() {
		return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;
	}
	/**
	True when the token after the mapped position was deleted.
	*/
	get deletedAfter() {
		return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
	}
	/**
	Tells whether any of the steps mapped through deletes across the
	position (including both the token before and after the
	position).
	*/
	get deletedAcross() {
		return (this.delInfo & DEL_ACROSS) > 0;
	}
};
var StepMap = class _StepMap {
	/**
	Create a position map. The modifications to the document are
	represented as an array of numbers, in which each group of three
	represents a modified chunk as `[start, oldSize, newSize]`.
	*/
	constructor(ranges, inverted = false) {
		this.ranges = ranges;
		this.inverted = inverted;
		if (!ranges.length && _StepMap.empty) return _StepMap.empty;
	}
	/**
	@internal
	*/
	recover(value) {
		let diff = 0, index = recoverIndex(value);
		if (!this.inverted) for (let i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
		return this.ranges[index * 3] + diff + recoverOffset(value);
	}
	mapResult(pos, assoc = 1) {
		return this._map(pos, assoc, false);
	}
	map(pos, assoc = 1) {
		return this._map(pos, assoc, true);
	}
	/**
	@internal
	*/
	_map(pos, assoc, simple) {
		let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i] - (this.inverted ? diff : 0);
			if (start > pos) break;
			let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
			if (pos <= end) {
				let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
				let result = start + diff + (side < 0 ? 0 : newSize);
				if (simple) return result;
				let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
				let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
				if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
				return new MapResult(result, del, recover);
			}
			diff += newSize - oldSize;
		}
		return simple ? pos + diff : new MapResult(pos + diff, 0, null);
	}
	/**
	@internal
	*/
	touches(pos, recover) {
		let diff = 0, index = recoverIndex(recover);
		let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i] - (this.inverted ? diff : 0);
			if (start > pos) break;
			let oldSize = this.ranges[i + oldIndex];
			if (pos <= start + oldSize && i == index * 3) return true;
			diff += this.ranges[i + newIndex] - oldSize;
		}
		return false;
	}
	/**
	Calls the given function on each of the changed ranges included in
	this map.
	*/
	forEach(f) {
		let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
		for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
			let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
			let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
			f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
			diff += newSize - oldSize;
		}
	}
	/**
	Create an inverted version of this map. The result can be used to
	map positions in the post-step document to the pre-step document.
	*/
	invert() {
		return new _StepMap(this.ranges, !this.inverted);
	}
	/**
	@internal
	*/
	toString() {
		return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
	}
	/**
	Create a map that moves all positions by offset `n` (which may be
	negative). This can be useful when applying steps meant for a
	sub-document to a larger document, or vice-versa.
	*/
	static offset(n) {
		return n == 0 ? _StepMap.empty : new _StepMap(n < 0 ? [
			0,
			-n,
			0
		] : [
			0,
			0,
			n
		]);
	}
};
StepMap.empty = new StepMap([]);
var stepsByID = /* @__PURE__ */ Object.create(null);
var Step = class {
	/**
	Get the step map that represents the changes made by this step,
	and which can be used to transform between positions in the old
	and the new document.
	*/
	getMap() {
		return StepMap.empty;
	}
	/**
	Try to merge this step with another one, to be applied directly
	after it. Returns the merged step when possible, null if the
	steps can't be merged.
	*/
	merge(other) {
		return null;
	}
	/**
	Deserialize a step from its JSON representation. Will call
	through to the step class' own implementation of this method.
	*/
	static fromJSON(schema, json) {
		if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON");
		let type = stepsByID[json.stepType];
		if (!type) throw new RangeError(`No step type ${json.stepType} defined`);
		return type.fromJSON(schema, json);
	}
	/**
	To be able to serialize steps to JSON, each step needs a string
	ID to attach to its JSON representation. Use this method to
	register an ID for your step classes. Try to pick something
	that's unlikely to clash with steps from other modules.
	*/
	static jsonID(id, stepClass) {
		if (id in stepsByID) throw new RangeError("Duplicate use of step JSON ID " + id);
		stepsByID[id] = stepClass;
		stepClass.prototype.jsonID = id;
		return stepClass;
	}
};
var StepResult = class _StepResult {
	/**
	@internal
	*/
	constructor(doc, failed) {
		this.doc = doc;
		this.failed = failed;
	}
	/**
	Create a successful step result.
	*/
	static ok(doc) {
		return new _StepResult(doc, null);
	}
	/**
	Create a failed step result.
	*/
	static fail(message) {
		return new _StepResult(null, message);
	}
	/**
	Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
	arguments. Create a successful result if it succeeds, and a
	failed one if it throws a `ReplaceError`.
	*/
	static fromReplace(doc, from, to, slice) {
		try {
			return _StepResult.ok(doc.replace(from, to, slice));
		} catch (e) {
			if (e instanceof ReplaceError) return _StepResult.fail(e.message);
			throw e;
		}
	}
};
function mapFragment(fragment, f, parent) {
	let mapped = [];
	for (let i = 0; i < fragment.childCount; i++) {
		let child = fragment.child(i);
		if (child.content.size) child = child.copy(mapFragment(child.content, f, child));
		if (child.isInline) child = f(child, parent, i);
		mapped.push(child);
	}
	return Fragment.fromArray(mapped);
}
var AddMarkStep = class _AddMarkStep extends Step {
	/**
	Create a mark step.
	*/
	constructor(from, to, mark) {
		super();
		this.from = from;
		this.to = to;
		this.mark = mark;
	}
	apply(doc) {
		let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
		let parent = $from.node($from.sharedDepth(this.to));
		let slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
			if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type)) return node;
			return node.mark(this.mark.addToSet(node.marks));
		}, parent), oldSlice.openStart, oldSlice.openEnd);
		return StepResult.fromReplace(doc, this.from, this.to, slice);
	}
	invert() {
		return new RemoveMarkStep(this.from, this.to, this.mark);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		if (from.deleted && to.deleted || from.pos >= to.pos) return null;
		return new _AddMarkStep(from.pos, to.pos, this.mark);
	}
	merge(other) {
		if (other instanceof _AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new _AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
		return null;
	}
	toJSON() {
		return {
			stepType: "addMark",
			mark: this.mark.toJSON(),
			from: this.from,
			to: this.to
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
		return new _AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
	}
};
Step.jsonID("addMark", AddMarkStep);
var RemoveMarkStep = class _RemoveMarkStep extends Step {
	/**
	Create a mark-removing step.
	*/
	constructor(from, to, mark) {
		super();
		this.from = from;
		this.to = to;
		this.mark = mark;
	}
	apply(doc) {
		let oldSlice = doc.slice(this.from, this.to);
		let slice = new Slice(mapFragment(oldSlice.content, (node) => {
			return node.mark(this.mark.removeFromSet(node.marks));
		}, doc), oldSlice.openStart, oldSlice.openEnd);
		return StepResult.fromReplace(doc, this.from, this.to, slice);
	}
	invert() {
		return new AddMarkStep(this.from, this.to, this.mark);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		if (from.deleted && to.deleted || from.pos >= to.pos) return null;
		return new _RemoveMarkStep(from.pos, to.pos, this.mark);
	}
	merge(other) {
		if (other instanceof _RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new _RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
		return null;
	}
	toJSON() {
		return {
			stepType: "removeMark",
			mark: this.mark.toJSON(),
			from: this.from,
			to: this.to
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
		return new _RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
	}
};
Step.jsonID("removeMark", RemoveMarkStep);
var AddNodeMarkStep = class _AddNodeMarkStep extends Step {
	/**
	Create a node mark step.
	*/
	constructor(pos, mark) {
		super();
		this.pos = pos;
		this.mark = mark;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult.fail("No node at mark step's position");
		let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
		return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	invert(doc) {
		let node = doc.nodeAt(this.pos);
		if (node) {
			let newSet = this.mark.addToSet(node.marks);
			if (newSet.length == node.marks.length) {
				for (let i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new _AddNodeMarkStep(this.pos, node.marks[i]);
				return new _AddNodeMarkStep(this.pos, this.mark);
			}
		}
		return new RemoveNodeMarkStep(this.pos, this.mark);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new _AddNodeMarkStep(pos.pos, this.mark);
	}
	toJSON() {
		return {
			stepType: "addNodeMark",
			pos: this.pos,
			mark: this.mark.toJSON()
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
		return new _AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
	}
};
Step.jsonID("addNodeMark", AddNodeMarkStep);
var RemoveNodeMarkStep = class _RemoveNodeMarkStep extends Step {
	/**
	Create a mark-removing step.
	*/
	constructor(pos, mark) {
		super();
		this.pos = pos;
		this.mark = mark;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult.fail("No node at mark step's position");
		let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
		return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	invert(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node || !this.mark.isInSet(node.marks)) return this;
		return new AddNodeMarkStep(this.pos, this.mark);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new _RemoveNodeMarkStep(pos.pos, this.mark);
	}
	toJSON() {
		return {
			stepType: "removeNodeMark",
			pos: this.pos,
			mark: this.mark.toJSON()
		};
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
		return new _RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
	}
};
Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
var ReplaceStep = class _ReplaceStep extends Step {
	/**
	The given `slice` should fit the 'gap' between `from` and
	`to`—the depths must line up, and the surrounding nodes must be
	able to be joined with the open sides of the slice. When
	`structure` is true, the step will fail if the content between
	from and to is not just a sequence of closing and then opening
	tokens (this is to guard against rebased replace steps
	overwriting something they weren't supposed to).
	*/
	constructor(from, to, slice, structure = false) {
		super();
		this.from = from;
		this.to = to;
		this.slice = slice;
		this.structure = structure;
	}
	apply(doc) {
		if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail("Structure replace would overwrite content");
		return StepResult.fromReplace(doc, this.from, this.to, this.slice);
	}
	getMap() {
		return new StepMap([
			this.from,
			this.to - this.from,
			this.slice.size
		]);
	}
	invert(doc) {
		return new _ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
	}
	map(mapping) {
		let to = mapping.mapResult(this.to, -1);
		let from = this.from == this.to && _ReplaceStep.MAP_BIAS < 0 ? to : mapping.mapResult(this.from, 1);
		if (from.deletedAcross && to.deletedAcross) return null;
		return new _ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
	}
	merge(other) {
		if (!(other instanceof _ReplaceStep) || other.structure || this.structure) return null;
		if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
			let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
			return new _ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
		} else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
			let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
			return new _ReplaceStep(other.from, this.to, slice, this.structure);
		} else return null;
	}
	toJSON() {
		let json = {
			stepType: "replace",
			from: this.from,
			to: this.to
		};
		if (this.slice.size) json.slice = this.slice.toJSON();
		if (this.structure) json.structure = true;
		return json;
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
		return new _ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
	}
};
ReplaceStep.MAP_BIAS = 1;
Step.jsonID("replace", ReplaceStep);
var ReplaceAroundStep = class _ReplaceAroundStep extends Step {
	/**
	Create a replace-around step with the given range and gap.
	`insert` should be the point in the slice into which the content
	of the gap should be moved. `structure` has the same meaning as
	it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
	*/
	constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
		super();
		this.from = from;
		this.to = to;
		this.gapFrom = gapFrom;
		this.gapTo = gapTo;
		this.slice = slice;
		this.insert = insert;
		this.structure = structure;
	}
	apply(doc) {
		if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail("Structure gap-replace would overwrite content");
		let gap = doc.slice(this.gapFrom, this.gapTo);
		if (gap.openStart || gap.openEnd) return StepResult.fail("Gap is not a flat range");
		let inserted = this.slice.insertAt(this.insert, gap.content);
		if (!inserted) return StepResult.fail("Content does not fit in gap");
		return StepResult.fromReplace(doc, this.from, this.to, inserted);
	}
	getMap() {
		return new StepMap([
			this.from,
			this.gapFrom - this.from,
			this.insert,
			this.gapTo,
			this.to - this.gapTo,
			this.slice.size - this.insert
		]);
	}
	invert(doc) {
		let gap = this.gapTo - this.gapFrom;
		return new _ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
	}
	map(mapping) {
		let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
		let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
		let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
		if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
		return new _ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
	}
	toJSON() {
		let json = {
			stepType: "replaceAround",
			from: this.from,
			to: this.to,
			gapFrom: this.gapFrom,
			gapTo: this.gapTo,
			insert: this.insert
		};
		if (this.slice.size) json.slice = this.slice.toJSON();
		if (this.structure) json.structure = true;
		return json;
	}
	/**
	@internal
	*/
	static fromJSON(schema, json) {
		if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
		return new _ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
	}
};
Step.jsonID("replaceAround", ReplaceAroundStep);
function contentBetween(doc, from, to) {
	let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
	while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
		depth--;
		dist--;
	}
	if (dist > 0) {
		let next = $from.node(depth).maybeChild($from.indexAfter(depth));
		while (dist > 0) {
			if (!next || next.isLeaf) return true;
			next = next.firstChild;
			dist--;
		}
	}
	return false;
}
var AttrStep = class _AttrStep extends Step {
	/**
	Construct an attribute step.
	*/
	constructor(pos, attr, value) {
		super();
		this.pos = pos;
		this.attr = attr;
		this.value = value;
	}
	apply(doc) {
		let node = doc.nodeAt(this.pos);
		if (!node) return StepResult.fail("No node at attribute step's position");
		let attrs = /* @__PURE__ */ Object.create(null);
		for (let name in node.attrs) attrs[name] = node.attrs[name];
		attrs[this.attr] = this.value;
		let updated = node.type.create(attrs, null, node.marks);
		return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
	}
	getMap() {
		return StepMap.empty;
	}
	invert(doc) {
		return new _AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
	}
	map(mapping) {
		let pos = mapping.mapResult(this.pos, 1);
		return pos.deletedAfter ? null : new _AttrStep(pos.pos, this.attr, this.value);
	}
	toJSON() {
		return {
			stepType: "attr",
			pos: this.pos,
			attr: this.attr,
			value: this.value
		};
	}
	static fromJSON(schema, json) {
		if (typeof json.pos != "number" || typeof json.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
		return new _AttrStep(json.pos, json.attr, json.value);
	}
};
Step.jsonID("attr", AttrStep);
var DocAttrStep = class _DocAttrStep extends Step {
	/**
	Construct an attribute step.
	*/
	constructor(attr, value) {
		super();
		this.attr = attr;
		this.value = value;
	}
	apply(doc) {
		let attrs = /* @__PURE__ */ Object.create(null);
		for (let name in doc.attrs) attrs[name] = doc.attrs[name];
		attrs[this.attr] = this.value;
		let updated = doc.type.create(attrs, doc.content, doc.marks);
		return StepResult.ok(updated);
	}
	getMap() {
		return StepMap.empty;
	}
	invert(doc) {
		return new _DocAttrStep(this.attr, doc.attrs[this.attr]);
	}
	map(mapping) {
		return this;
	}
	toJSON() {
		return {
			stepType: "docAttr",
			attr: this.attr,
			value: this.value
		};
	}
	static fromJSON(schema, json) {
		if (typeof json.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
		return new _DocAttrStep(json.attr, json.value);
	}
};
Step.jsonID("docAttr", DocAttrStep);
var TransformError = class extends Error {};
TransformError = function TransformError2(message) {
	let err = Error.call(this, message);
	err.__proto__ = TransformError2.prototype;
	return err;
};
TransformError.prototype = Object.create(Error.prototype);
TransformError.prototype.constructor = TransformError;
TransformError.prototype.name = "TransformError";
var classesById = /* @__PURE__ */ Object.create(null);
var Selection$1 = class {
	/**
	Initialize a selection with the head and anchor and ranges. If no
	ranges are given, constructs a single range across `$anchor` and
	`$head`.
	*/
	constructor($anchor, $head, ranges) {
		this.$anchor = $anchor;
		this.$head = $head;
		this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
	}
	/**
	The selection's anchor, as an unresolved position.
	*/
	get anchor() {
		return this.$anchor.pos;
	}
	/**
	The selection's head.
	*/
	get head() {
		return this.$head.pos;
	}
	/**
	The lower bound of the selection's main range.
	*/
	get from() {
		return this.$from.pos;
	}
	/**
	The upper bound of the selection's main range.
	*/
	get to() {
		return this.$to.pos;
	}
	/**
	The resolved lower  bound of the selection's main range.
	*/
	get $from() {
		return this.ranges[0].$from;
	}
	/**
	The resolved upper bound of the selection's main range.
	*/
	get $to() {
		return this.ranges[0].$to;
	}
	/**
	Indicates whether the selection contains any content.
	*/
	get empty() {
		let ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) if (ranges[i].$from.pos != ranges[i].$to.pos) return false;
		return true;
	}
	/**
	Get the content of this selection as a slice.
	*/
	content() {
		return this.$from.doc.slice(this.from, this.to, true);
	}
	/**
	Replace the selection with a slice or, if no slice is given,
	delete the selection. Will append to the given transaction.
	*/
	replace(tr, content = Slice.empty) {
		let lastNode = content.content.lastChild, lastParent = null;
		for (let i = 0; i < content.openEnd; i++) {
			lastParent = lastNode;
			lastNode = lastNode.lastChild;
		}
		let mapFrom = tr.steps.length, ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) {
			let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
			tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
			if (i == 0) selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
		}
	}
	/**
	Replace the selection with the given node, appending the changes
	to the given transaction.
	*/
	replaceWith(tr, node) {
		let mapFrom = tr.steps.length, ranges = this.ranges;
		for (let i = 0; i < ranges.length; i++) {
			let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
			let from = mapping.map($from.pos), to = mapping.map($to.pos);
			if (i) tr.deleteRange(from, to);
			else {
				tr.replaceRangeWith(from, to, node);
				selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
			}
		}
	}
	/**
	Find a valid cursor or leaf node selection starting at the given
	position and searching back if `dir` is negative, and forward if
	positive. When `textOnly` is true, only consider cursor
	selections. Will return null when no valid selection position is
	found.
	*/
	static findFrom($pos, dir, textOnly = false) {
		let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
		if (inner) return inner;
		for (let depth = $pos.depth - 1; depth >= 0; depth--) {
			let found2 = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
			if (found2) return found2;
		}
		return null;
	}
	/**
	Find a valid cursor or leaf node selection near the given
	position. Searches forward first by default, but if `bias` is
	negative, it will search backwards first.
	*/
	static near($pos, bias = 1) {
		return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
	}
	/**
	Find the cursor or leaf node selection closest to the start of
	the given document. Will return an
	[`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
	exists.
	*/
	static atStart(doc) {
		return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
	}
	/**
	Find the cursor or leaf node selection closest to the end of the
	given document.
	*/
	static atEnd(doc) {
		return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
	}
	/**
	Deserialize the JSON representation of a selection. Must be
	implemented for custom classes (as a static class method).
	*/
	static fromJSON(doc, json) {
		if (!json || !json.type) throw new RangeError("Invalid input for Selection.fromJSON");
		let cls = classesById[json.type];
		if (!cls) throw new RangeError(`No selection type ${json.type} defined`);
		return cls.fromJSON(doc, json);
	}
	/**
	To be able to deserialize selections from JSON, custom selection
	classes must register themselves with an ID string, so that they
	can be disambiguated. Try to pick something that's unlikely to
	clash with classes from other modules.
	*/
	static jsonID(id, selectionClass) {
		if (id in classesById) throw new RangeError("Duplicate use of selection JSON ID " + id);
		classesById[id] = selectionClass;
		selectionClass.prototype.jsonID = id;
		return selectionClass;
	}
	/**
	Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
	which is a value that can be mapped without having access to a
	current document, and later resolved to a real selection for a
	given document again. (This is used mostly by the history to
	track and restore old selections.) The default implementation of
	this method just converts the selection to a text selection and
	returns the bookmark for that.
	*/
	getBookmark() {
		return TextSelection.between(this.$anchor, this.$head).getBookmark();
	}
};
Selection$1.prototype.visible = true;
var SelectionRange = class {
	/**
	Create a range.
	*/
	constructor($from, $to) {
		this.$from = $from;
		this.$to = $to;
	}
};
var warnedAboutTextSelection = false;
function checkTextSelection($pos) {
	if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
		warnedAboutTextSelection = true;
		console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
	}
}
var TextSelection = class _TextSelection extends Selection$1 {
	/**
	Construct a text selection between the given points.
	*/
	constructor($anchor, $head = $anchor) {
		checkTextSelection($anchor);
		checkTextSelection($head);
		super($anchor, $head);
	}
	/**
	Returns a resolved position if this is a cursor selection (an
	empty text selection), and null otherwise.
	*/
	get $cursor() {
		return this.$anchor.pos == this.$head.pos ? this.$head : null;
	}
	map(doc, mapping) {
		let $head = doc.resolve(mapping.map(this.head));
		if (!$head.parent.inlineContent) return Selection$1.near($head);
		let $anchor = doc.resolve(mapping.map(this.anchor));
		return new _TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
	}
	replace(tr, content = Slice.empty) {
		super.replace(tr, content);
		if (content == Slice.empty) {
			let marks = this.$from.marksAcross(this.$to);
			if (marks) tr.ensureMarks(marks);
		}
	}
	eq(other) {
		return other instanceof _TextSelection && other.anchor == this.anchor && other.head == this.head;
	}
	getBookmark() {
		return new TextBookmark(this.anchor, this.head);
	}
	toJSON() {
		return {
			type: "text",
			anchor: this.anchor,
			head: this.head
		};
	}
	/**
	@internal
	*/
	static fromJSON(doc, json) {
		if (typeof json.anchor != "number" || typeof json.head != "number") throw new RangeError("Invalid input for TextSelection.fromJSON");
		return new _TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
	}
	/**
	Create a text selection from non-resolved positions.
	*/
	static create(doc, anchor, head = anchor) {
		let $anchor = doc.resolve(anchor);
		return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
	}
	/**
	Return a text selection that spans the given positions or, if
	they aren't text positions, find a text selection near them.
	`bias` determines whether the method searches forward (default)
	or backwards (negative number) first. Will fall back to calling
	[`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
	doesn't contain a valid text position.
	*/
	static between($anchor, $head, bias) {
		let dPos = $anchor.pos - $head.pos;
		if (!bias || dPos) bias = dPos >= 0 ? 1 : -1;
		if (!$head.parent.inlineContent) {
			let found2 = Selection$1.findFrom($head, bias, true) || Selection$1.findFrom($head, -bias, true);
			if (found2) $head = found2.$head;
			else return Selection$1.near($head, bias);
		}
		if (!$anchor.parent.inlineContent) if (dPos == 0) $anchor = $head;
		else {
			$anchor = (Selection$1.findFrom($anchor, -bias, true) || Selection$1.findFrom($anchor, bias, true)).$anchor;
			if ($anchor.pos < $head.pos != dPos < 0) $anchor = $head;
		}
		return new _TextSelection($anchor, $head);
	}
};
Selection$1.jsonID("text", TextSelection);
var TextBookmark = class _TextBookmark {
	constructor(anchor, head) {
		this.anchor = anchor;
		this.head = head;
	}
	map(mapping) {
		return new _TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
	}
	resolve(doc) {
		return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
	}
};
var NodeSelection = class _NodeSelection extends Selection$1 {
	/**
	Create a node selection. Does not verify the validity of its
	argument.
	*/
	constructor($pos) {
		let node = $pos.nodeAfter;
		let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
		super($pos, $end);
		this.node = node;
	}
	map(doc, mapping) {
		let { deleted, pos } = mapping.mapResult(this.anchor);
		let $pos = doc.resolve(pos);
		if (deleted) return Selection$1.near($pos);
		return new _NodeSelection($pos);
	}
	content() {
		return new Slice(Fragment.from(this.node), 0, 0);
	}
	eq(other) {
		return other instanceof _NodeSelection && other.anchor == this.anchor;
	}
	toJSON() {
		return {
			type: "node",
			anchor: this.anchor
		};
	}
	getBookmark() {
		return new NodeBookmark(this.anchor);
	}
	/**
	@internal
	*/
	static fromJSON(doc, json) {
		if (typeof json.anchor != "number") throw new RangeError("Invalid input for NodeSelection.fromJSON");
		return new _NodeSelection(doc.resolve(json.anchor));
	}
	/**
	Create a node selection from non-resolved positions.
	*/
	static create(doc, from) {
		return new _NodeSelection(doc.resolve(from));
	}
	/**
	Determines whether the given node may be selected as a node
	selection.
	*/
	static isSelectable(node) {
		return !node.isText && node.type.spec.selectable !== false;
	}
};
NodeSelection.prototype.visible = false;
Selection$1.jsonID("node", NodeSelection);
var NodeBookmark = class _NodeBookmark {
	constructor(anchor) {
		this.anchor = anchor;
	}
	map(mapping) {
		let { deleted, pos } = mapping.mapResult(this.anchor);
		return deleted ? new TextBookmark(pos, pos) : new _NodeBookmark(pos);
	}
	resolve(doc) {
		let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
		if (node && NodeSelection.isSelectable(node)) return new NodeSelection($pos);
		return Selection$1.near($pos);
	}
};
var AllSelection = class _AllSelection extends Selection$1 {
	/**
	Create an all-selection over the given document.
	*/
	constructor(doc) {
		super(doc.resolve(0), doc.resolve(doc.content.size));
	}
	replace(tr, content = Slice.empty) {
		if (content == Slice.empty) {
			tr.delete(0, tr.doc.content.size);
			let sel = Selection$1.atStart(tr.doc);
			if (!sel.eq(tr.selection)) tr.setSelection(sel);
		} else super.replace(tr, content);
	}
	toJSON() {
		return { type: "all" };
	}
	/**
	@internal
	*/
	static fromJSON(doc) {
		return new _AllSelection(doc);
	}
	map(doc) {
		return new _AllSelection(doc);
	}
	eq(other) {
		return other instanceof _AllSelection;
	}
	getBookmark() {
		return AllBookmark;
	}
};
Selection$1.jsonID("all", AllSelection);
var AllBookmark = {
	map() {
		return this;
	},
	resolve(doc) {
		return new AllSelection(doc);
	}
};
function findSelectionIn(doc, node, pos, index, dir, text = false) {
	if (node.inlineContent) return TextSelection.create(doc, pos);
	for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
		let child = node.child(i);
		if (!child.isAtom) {
			let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
			if (inner) return inner;
		} else if (!text && NodeSelection.isSelectable(child)) return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
		pos += child.nodeSize * dir;
	}
	return null;
}
function selectionToInsertionEnd(tr, startLen, bias) {
	let last = tr.steps.length - 1;
	if (last < startLen) return;
	let step = tr.steps[last];
	if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;
	let map = tr.mapping.maps[last], end;
	map.forEach((_from, _to, _newFrom, newTo) => {
		if (end == null) end = newTo;
	});
	tr.setSelection(Selection$1.near(tr.doc.resolve(end), bias));
}
function bind(f, self) {
	return !self || !f ? f : f.bind(self);
}
var FieldDesc = class {
	constructor(name, desc, self) {
		this.name = name;
		this.init = bind(desc.init, self);
		this.apply = bind(desc.apply, self);
	}
};
new FieldDesc("doc", {
	init(config) {
		return config.doc || config.schema.topNodeType.createAndFill();
	},
	apply(tr) {
		return tr.doc;
	}
}), new FieldDesc("selection", {
	init(config, instance) {
		return config.selection || Selection$1.atStart(instance.doc);
	},
	apply(tr) {
		return tr.selection;
	}
}), new FieldDesc("storedMarks", {
	init(config) {
		return config.storedMarks || null;
	},
	apply(tr, _marks, _old, state) {
		return state.selection.$cursor ? tr.storedMarks : null;
	}
}), new FieldDesc("scrollToSelection", {
	init() {
		return 0;
	},
	apply(tr, prev) {
		return tr.scrolledIntoView ? prev + 1 : prev;
	}
});
var handleBackspace$1 = (editor, type) => {
	var _a;
	const { state, view } = editor;
	const { selection } = state;
	if (!selection.empty) return false;
	const { $from } = selection;
	if ($from.parentOffset !== 0) return false;
	const parentDepth = $from.depth - 1;
	const parent = $from.node(parentDepth);
	const index = $from.index(parentDepth);
	if (index === 0) return false;
	if (parent.type === type) return editor.commands.lift(type.name);
	const previous = parent.child(index - 1);
	if (previous.type !== type || !((_a = previous.lastChild) == null ? void 0 : _a.isTextblock)) return false;
	const blockStart = $from.before();
	const targetPos = blockStart - 1 - 1;
	const { tr } = state;
	tr.delete(blockStart, $from.after()).insert(targetPos, $from.parent.content);
	tr.setSelection(TextSelection.create(tr.doc, targetPos));
	view.dispatch(tr.scrollIntoView());
	return true;
};
var inputRegex$3 = /^\s*>\s$/;
var Blockquote = Node3.create({
	name: "blockquote",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	content: "block+",
	group: "block",
	defining: true,
	parseHTML() {
		return [{ tag: "blockquote" }];
	},
	renderHTML({ HTMLAttributes }) {
		return /* @__PURE__ */ h("blockquote", {
			...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			children: /* @__PURE__ */ h("slot", {})
		});
	},
	parseMarkdown: (token, helpers) => {
		var _a;
		const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren;
		return helpers.createNode("blockquote", void 0, parseBlockChildren(token.tokens || []));
	},
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		const prefix = ">";
		const result = [];
		node.content.forEach((child, index) => {
			var _a, _b;
			const linesWithPrefix = ((_b = (_a = h.renderChild) == null ? void 0 : _a.call(h, child, index)) != null ? _b : h.renderChildren([child])).split("\n").map((line) => {
				if (line.trim() === "") return prefix;
				return `${prefix} ${line}`;
			});
			result.push(linesWithPrefix.join("\n"));
		});
		return result.join(`
${prefix}
`);
	},
	addCommands() {
		return {
			setBlockquote: () => ({ commands }) => {
				return commands.wrapIn(this.name);
			},
			toggleBlockquote: () => ({ commands }) => {
				return commands.toggleWrap(this.name);
			},
			unsetBlockquote: () => ({ commands }) => {
				return commands.lift(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
			Backspace: () => handleBackspace$1(this.editor, this.type)
		};
	},
	addInputRules() {
		return [wrappingInputRule({
			find: inputRegex$3,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-bold/dist/index.js
var starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
var starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
var underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
var underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
var Bold = Mark$1.create({
	name: "bold",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	parseHTML() {
		return [
			{ tag: "strong" },
			{
				tag: "b",
				getAttrs: (node) => node.style.fontWeight !== "normal" && null
			},
			{
				style: "font-weight=400",
				clearMark: (mark) => mark.type.name === this.name
			},
			{
				style: "font-weight",
				getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
			}
		];
	},
	renderHTML({ HTMLAttributes }) {
		return /* @__PURE__ */ h("strong", {
			...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			children: /* @__PURE__ */ h("slot", {})
		});
	},
	markdownTokenName: "strong",
	parseMarkdown: (token, helpers) => {
		return helpers.applyMark("bold", helpers.parseInline(token.tokens || []));
	},
	markdownOptions: { htmlReopen: {
		open: "<strong>",
		close: "</strong>"
	} },
	renderMarkdown: (node, h) => {
		return `**${h.renderChildren(node)}**`;
	},
	addCommands() {
		return {
			setBold: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleBold: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetBold: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-b": () => this.editor.commands.toggleBold(),
			"Mod-B": () => this.editor.commands.toggleBold()
		};
	},
	addInputRules() {
		return [markInputRule({
			find: starInputRegex$1,
			type: this.type
		}), markInputRule({
			find: underscoreInputRegex$1,
			type: this.type
		})];
	},
	addPasteRules() {
		return [markPasteRule({
			find: starPasteRegex$1,
			type: this.type
		}), markPasteRule({
			find: underscorePasteRegex$1,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-code/dist/index.js
var inputRegexMatch = (text) => {
	const match = /`([^`]+)`(?!`)$/.exec(text);
	if (!match) return null;
	if (match.index > 0 && text[match.index - 1] === "`") return null;
	return {
		index: match.index,
		text: match[0],
		replaceWith: match[1]
	};
};
var pasteRegexMatch = (text) => {
	const regex = /`([^`]+)`(?!`)/g;
	const matches = [];
	let match;
	while ((match = regex.exec(text)) !== null) {
		if (match.index > 0 && text[match.index - 1] === "`") continue;
		matches.push({
			index: match.index,
			text: match[0],
			replaceWith: match[1]
		});
	}
	return matches;
};
var Code = Mark$1.create({
	name: "code",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	excludes: "_",
	code: true,
	exitable: true,
	parseHTML() {
		return [{ tag: "code" }];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"code",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "codespan",
	parseMarkdown: (token, helpers) => {
		return helpers.applyMark("code", [{
			type: "text",
			text: token.text || ""
		}]);
	},
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		return `\`${h.renderChildren(node.content)}\``;
	},
	addCommands() {
		return {
			setCode: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleCode: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetCode: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return { "Mod-e": () => this.editor.commands.toggleCode() };
	},
	addInputRules() {
		return [markInputRule({
			find: inputRegexMatch,
			type: this.type
		})];
	},
	addPasteRules() {
		return [markPasteRule({
			find: pasteRegexMatch,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-code-block/dist/index.js
var DEFAULT_TAB_SIZE = 4;
var backtickInputRegex = /^```([a-z]+)?[\s\n]$/;
var tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
var CodeBlock = Node3.create({
	name: "codeBlock",
	addOptions() {
		return {
			languageClassPrefix: "language-",
			exitOnTripleEnter: true,
			exitOnArrowDown: true,
			defaultLanguage: null,
			enableTabIndentation: false,
			tabSize: DEFAULT_TAB_SIZE,
			HTMLAttributes: {}
		};
	},
	content: "text*",
	marks: "",
	group: "block",
	code: true,
	defining: true,
	addAttributes() {
		return { language: {
			default: this.options.defaultLanguage,
			parseHTML: (element) => {
				var _a;
				const { languageClassPrefix } = this.options;
				if (!languageClassPrefix) return null;
				const language = [...((_a = element.firstElementChild) == null ? void 0 : _a.classList) || []].filter((className) => className.startsWith(languageClassPrefix)).map((className) => className.replace(languageClassPrefix, ""))[0];
				if (!language) return null;
				return language;
			},
			rendered: false
		} };
	},
	parseHTML() {
		return [{
			tag: "pre",
			preserveWhitespace: "full"
		}];
	},
	renderHTML({ node, HTMLAttributes }) {
		return [
			"pre",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			[
				"code",
				{ class: node.attrs.language ? this.options.languageClassPrefix + node.attrs.language : null },
				0
			]
		];
	},
	markdownTokenName: "code",
	parseMarkdown: (token, helpers) => {
		var _a, _b;
		if (((_a = token.raw) == null ? void 0 : _a.startsWith("```")) === false && ((_b = token.raw) == null ? void 0 : _b.startsWith("~~~")) === false && token.codeBlockStyle !== "indented") return [];
		return helpers.createNode("codeBlock", { language: token.lang || null }, token.text ? [helpers.createTextNode(token.text)] : []);
	},
	renderMarkdown: (node, h) => {
		var _a;
		let output = "";
		const language = ((_a = node.attrs) == null ? void 0 : _a.language) || "";
		if (!node.content) output = `\`\`\`${language}

\`\`\``;
		else output = [
			`\`\`\`${language}`,
			h.renderChildren(node.content),
			"```"
		].join("\n");
		return output;
	},
	addCommands() {
		return {
			setCodeBlock: (attributes) => ({ commands }) => {
				return commands.setNode(this.name, attributes);
			},
			toggleCodeBlock: (attributes) => ({ commands }) => {
				return commands.toggleNode(this.name, "paragraph", attributes);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
			Backspace: () => {
				const { empty, $anchor } = this.editor.state.selection;
				const isAtStart = $anchor.pos === 1;
				if (!empty || $anchor.parent.type.name !== this.name) return false;
				if (isAtStart || !$anchor.parent.textContent.length) return this.editor.commands.clearNodes();
				return false;
			},
			Tab: ({ editor }) => {
				var _a;
				if (!this.options.enableTabIndentation) return false;
				const tabSize = (_a = this.options.tabSize) != null ? _a : DEFAULT_TAB_SIZE;
				const { state } = editor;
				const { selection } = state;
				const { $from, empty } = selection;
				if ($from.parent.type !== this.type) return false;
				const indent = " ".repeat(tabSize);
				if (empty) return editor.commands.insertContent(indent);
				return editor.commands.command(({ tr }) => {
					const { from, to } = selection;
					const indentedText = state.doc.textBetween(from, to, "\n", "\n").split("\n").map((line) => indent + line).join("\n");
					tr.replaceWith(from, to, state.schema.text(indentedText));
					return true;
				});
			},
			"Shift-Tab": ({ editor }) => {
				var _a;
				if (!this.options.enableTabIndentation) return false;
				const tabSize = (_a = this.options.tabSize) != null ? _a : DEFAULT_TAB_SIZE;
				const { state } = editor;
				const { selection } = state;
				const { $from, empty } = selection;
				if ($from.parent.type !== this.type) return false;
				if (empty) return editor.commands.command(({ tr }) => {
					var _a2;
					const { pos } = $from;
					const codeBlockStart = $from.start();
					const codeBlockEnd = $from.end();
					const lines = state.doc.textBetween(codeBlockStart, codeBlockEnd, "\n", "\n").split("\n");
					let currentLineIndex = 0;
					let charCount = 0;
					const relativeCursorPos = pos - codeBlockStart;
					for (let i = 0; i < lines.length; i += 1) {
						if (charCount + lines[i].length >= relativeCursorPos) {
							currentLineIndex = i;
							break;
						}
						charCount += lines[i].length + 1;
					}
					const leadingSpaces = ((_a2 = lines[currentLineIndex].match(/^ */)) == null ? void 0 : _a2[0]) || "";
					const spacesToRemove = Math.min(leadingSpaces.length, tabSize);
					if (spacesToRemove === 0) return true;
					let lineStartPos = codeBlockStart;
					for (let i = 0; i < currentLineIndex; i += 1) lineStartPos += lines[i].length + 1;
					tr.delete(lineStartPos, lineStartPos + spacesToRemove);
					if (pos - lineStartPos <= spacesToRemove) tr.setSelection(TextSelection$1.create(tr.doc, lineStartPos));
					return true;
				});
				return editor.commands.command(({ tr }) => {
					const { from, to } = selection;
					const reverseIndentText = state.doc.textBetween(from, to, "\n", "\n").split("\n").map((line) => {
						var _a2;
						const leadingSpaces = ((_a2 = line.match(/^ */)) == null ? void 0 : _a2[0]) || "";
						const spacesToRemove = Math.min(leadingSpaces.length, tabSize);
						return line.slice(spacesToRemove);
					}).join("\n");
					tr.replaceWith(from, to, state.schema.text(reverseIndentText));
					return true;
				});
			},
			Enter: ({ editor }) => {
				if (!this.options.exitOnTripleEnter) return false;
				const { state } = editor;
				const { selection } = state;
				const { $from, empty } = selection;
				if (!empty || $from.parent.type !== this.type) return false;
				const isAtEnd = $from.parentOffset === $from.parent.nodeSize - 2;
				const endsWithDoubleNewline = $from.parent.textContent.endsWith("\n\n");
				if (!isAtEnd || !endsWithDoubleNewline) return false;
				return editor.chain().command(({ tr }) => {
					tr.delete($from.pos - 2, $from.pos);
					return true;
				}).exitCode().run();
			},
			ArrowDown: ({ editor }) => {
				if (!this.options.exitOnArrowDown) return false;
				const { state } = editor;
				const { selection, doc } = state;
				const { $from, empty } = selection;
				if (!empty || $from.parent.type !== this.type) return false;
				if (!($from.parentOffset === $from.parent.nodeSize - 2)) return false;
				const after = $from.after();
				if (after === void 0) return false;
				if (doc.nodeAt(after)) return editor.commands.command(({ tr }) => {
					tr.setSelection(Selection$2.near(doc.resolve(after)));
					return true;
				});
				return editor.commands.exitCode();
			}
		};
	},
	addInputRules() {
		return [textblockTypeInputRule({
			find: backtickInputRegex,
			type: this.type,
			getAttributes: (match) => ({ language: match[1] })
		}), textblockTypeInputRule({
			find: tildeInputRegex,
			type: this.type,
			getAttributes: (match) => ({ language: match[1] })
		})];
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("codeBlockVSCodeHandler"),
			props: { handlePaste: (view, event) => {
				if (!event.clipboardData) return false;
				if (this.editor.isActive(this.type.name)) return false;
				const text = event.clipboardData.getData("text/plain");
				const vscode = event.clipboardData.getData("vscode-editor-data");
				const vscodeData = vscode ? JSON.parse(vscode) : void 0;
				const language = vscodeData == null ? void 0 : vscodeData.mode;
				if (!text || !language) return false;
				const { tr, schema } = view.state;
				const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
				tr.replaceSelectionWith(this.type.create({ language }, textNode));
				if (tr.selection.$from.parent.type !== this.type) tr.setSelection(TextSelection$1.near(tr.doc.resolve(Math.max(0, tr.selection.from - 2))));
				tr.setMeta("paste", true);
				view.dispatch(tr);
				return true;
			} }
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-document/dist/index.js
var Document = Node3.create({
	name: "doc",
	topNode: true,
	content: "block+",
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		return h.renderChildren(node.content, "\n\n");
	}
});
//#endregion
//#region node_modules/@tiptap/extension-hard-break/dist/index.js
var HardBreak = Node3.create({
	name: "hardBreak",
	markdownTokenName: "br",
	addOptions() {
		return {
			keepMarks: true,
			HTMLAttributes: {}
		};
	},
	inline: true,
	group: "inline",
	selectable: false,
	linebreakReplacement: true,
	parseHTML() {
		return [{ tag: "br" }];
	},
	renderHTML({ HTMLAttributes }) {
		return ["br", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
	},
	renderText() {
		return "\n";
	},
	renderMarkdown: () => `  
`,
	parseMarkdown: () => {
		return { type: "hardBreak" };
	},
	addCommands() {
		return { setHardBreak: () => ({ commands, chain, state, editor }) => {
			return commands.first([() => commands.exitCode(), () => commands.command(() => {
				const { selection, storedMarks } = state;
				if (selection.$from.parent.type.spec.isolating) return false;
				const { keepMarks } = this.options;
				const { splittableMarks } = editor.extensionManager;
				const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
				return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
					if (dispatch && marks && keepMarks) {
						const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
						tr.ensureMarks(filteredMarks);
					}
					return true;
				}).run();
			})]);
		} };
	},
	addKeyboardShortcuts() {
		return {
			"Mod-Enter": () => this.editor.commands.setHardBreak(),
			"Shift-Enter": () => this.editor.commands.setHardBreak()
		};
	}
});
//#endregion
//#region node_modules/@tiptap/extension-heading/dist/index.js
var Heading = Node3.create({
	name: "heading",
	addOptions() {
		return {
			levels: [
				1,
				2,
				3,
				4,
				5,
				6
			],
			HTMLAttributes: {}
		};
	},
	content: "inline*",
	group: "block",
	defining: true,
	addAttributes() {
		return { level: {
			default: 1,
			rendered: false
		} };
	},
	parseHTML() {
		return this.options.levels.map((level) => ({
			tag: `h${level}`,
			attrs: { level }
		}));
	},
	renderHTML({ node, HTMLAttributes }) {
		return [
			`h${this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0]}`,
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	parseMarkdown: (token, helpers) => {
		return helpers.createNode("heading", { level: token.depth || 1 }, helpers.parseInline(token.tokens || []));
	},
	renderMarkdown: (node, h) => {
		var _a;
		const level = ((_a = node.attrs) == null ? void 0 : _a.level) ? parseInt(node.attrs.level, 10) : 1;
		const headingChars = "#".repeat(level);
		if (!node.content) return "";
		return `${headingChars} ${h.renderChildren(node.content)}`;
	},
	addCommands() {
		return {
			setHeading: (attributes) => ({ commands }) => {
				if (!this.options.levels.includes(attributes.level)) return false;
				return commands.setNode(this.name, attributes);
			},
			toggleHeading: (attributes) => ({ commands }) => {
				if (!this.options.levels.includes(attributes.level)) return false;
				return commands.toggleNode(this.name, "paragraph", attributes);
			}
		};
	},
	addKeyboardShortcuts() {
		return this.options.levels.reduce((items, level) => ({
			...items,
			[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
		}), {});
	},
	addInputRules() {
		return this.options.levels.map((level) => {
			return textblockTypeInputRule({
				find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
				type: this.type,
				getAttributes: { level }
			});
		});
	}
});
//#endregion
//#region node_modules/@tiptap/extension-horizontal-rule/dist/index.js
var HorizontalRule = Node3.create({
	name: "horizontalRule",
	addOptions() {
		return {
			HTMLAttributes: {},
			nextNodeType: "paragraph"
		};
	},
	group: "block",
	parseHTML() {
		return [{ tag: "hr" }];
	},
	renderHTML({ HTMLAttributes }) {
		return ["hr", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
	},
	markdownTokenName: "hr",
	parseMarkdown: (token, helpers) => {
		return helpers.createNode("horizontalRule");
	},
	renderMarkdown: () => {
		return "---";
	},
	addCommands() {
		return { setHorizontalRule: () => ({ chain, state }) => {
			if (!canInsertNode(state, state.schema.nodes[this.name])) return false;
			const { selection } = state;
			const { $to: $originTo } = selection;
			const currentChain = chain();
			if (isNodeSelection(selection)) currentChain.insertContentAt($originTo.pos, { type: this.name });
			else currentChain.insertContent({ type: this.name });
			return currentChain.command(({ state: chainState, tr, dispatch }) => {
				if (dispatch) {
					const { $to } = tr.selection;
					const posAfter = $to.end();
					if ($to.nodeAfter) if ($to.nodeAfter.isTextblock) tr.setSelection(TextSelection$1.create(tr.doc, $to.pos + 1));
					else if ($to.nodeAfter.isBlock) tr.setSelection(NodeSelection$1.create(tr.doc, $to.pos));
					else tr.setSelection(TextSelection$1.create(tr.doc, $to.pos));
					else {
						const nodeType = chainState.schema.nodes[this.options.nextNodeType] || $to.parent.type.contentMatch.defaultType;
						const node = nodeType == null ? void 0 : nodeType.create();
						if (node) {
							tr.insert(posAfter, node);
							tr.setSelection(TextSelection$1.create(tr.doc, posAfter + 1));
						}
					}
					tr.scrollIntoView();
				}
				return true;
			}).run();
		} };
	},
	addInputRules() {
		return [nodeInputRule({
			find: /^(?:---|—-|___\s|\*\*\*\s)$/,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-italic/dist/index.js
var starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
var starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
var underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
var underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
var Italic = Mark$1.create({
	name: "italic",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	parseHTML() {
		return [
			{ tag: "em" },
			{
				tag: "i",
				getAttrs: (node) => node.style.fontStyle !== "normal" && null
			},
			{
				style: "font-style=normal",
				clearMark: (mark) => mark.type.name === this.name
			},
			{ style: "font-style=italic" }
		];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"em",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	addCommands() {
		return {
			setItalic: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleItalic: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetItalic: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	markdownTokenName: "em",
	parseMarkdown: (token, helpers) => {
		return helpers.applyMark("italic", helpers.parseInline(token.tokens || []));
	},
	markdownOptions: { htmlReopen: {
		open: "<em>",
		close: "</em>"
	} },
	renderMarkdown: (node, h) => {
		return `*${h.renderChildren(node)}*`;
	},
	addKeyboardShortcuts() {
		return {
			"Mod-i": () => this.editor.commands.toggleItalic(),
			"Mod-I": () => this.editor.commands.toggleItalic()
		};
	},
	addInputRules() {
		return [markInputRule({
			find: starInputRegex,
			type: this.type
		}), markInputRule({
			find: underscoreInputRegex,
			type: this.type
		})];
	},
	addPasteRules() {
		return [markPasteRule({
			find: starPasteRegex,
			type: this.type
		}), markPasteRule({
			find: underscorePasteRegex,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/linkifyjs/dist/linkify.mjs
var encodedTlds = " ögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
var encodedUtlds = "ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2";
/**
* Finite State Machine generation utilities
*/
/**
* @template T
* @typedef {{ [group: string]: T[] }} Collections
*/
/**
* @typedef {{ [group: string]: true }} Flags
*/
var numeric = "numeric";
var ascii = "ascii";
var alpha = "alpha";
var asciinumeric = "asciinumeric";
var alphanumeric = "alphanumeric";
var domain = "domain";
var emoji = "emoji";
var scheme = "scheme";
var slashscheme = "slashscheme";
var whitespace = "whitespace";
/**
* @template T
* @param {string} name
* @param {Collections<T>} groups to register in
* @returns {T[]} Current list of tokens in the given collection
*/
function registerGroup(name, groups) {
	if (!(name in groups)) groups[name] = [];
	return groups[name];
}
/**
* @template T
* @param {T} t token to add
* @param {Collections<T>} groups
* @param {Flags} flags
*/
function addToGroups(t, flags, groups) {
	if (flags[numeric]) {
		flags[asciinumeric] = true;
		flags[alphanumeric] = true;
	}
	if (flags[ascii]) {
		flags[asciinumeric] = true;
		flags[alpha] = true;
	}
	if (flags[asciinumeric]) flags[alphanumeric] = true;
	if (flags[alpha]) flags[alphanumeric] = true;
	if (flags[alphanumeric]) flags[domain] = true;
	if (flags[emoji]) flags[domain] = true;
	for (const k in flags) {
		const group = registerGroup(k, groups);
		if (group.indexOf(t) < 0) group.push(t);
	}
}
/**
* @template T
* @param {T} t token to check
* @param {Collections<T>} groups
* @returns {Flags} group flags that contain this token
*/
function flagsForToken(t, groups) {
	const result = {};
	for (const c in groups) if (groups[c].indexOf(t) >= 0) result[c] = true;
	return result;
}
/**
* @template T
* @typedef {null | T } Transition
*/
/**
* Define a basic state machine state. j is the list of character transitions,
* jr is the list of regex-match transitions, jd is the default state to
* transition to t is the accepting token type, if any. If this is the terminal
* state, then it does not emit a token.
*
* The template type T represents the type of the token this state accepts. This
* should be a string (such as of the token exports in `text.js`) or a
* MultiToken subclass (from `multi.js`)
*
* @template T
* @param {T} [token] Token that this state emits
*/
function State(token = null) {
	/** @type {{ [input: string]: State<T> }} j */
	this.j = {};
	/** @type {[RegExp, State<T>][]} jr */
	this.jr = [];
	/** @type {?State<T>} jd */
	this.jd = null;
	/** @type {?T} t */
	this.t = token;
}
/**
* Scanner token groups
* @type Collections<string>
*/
State.groups = {};
State.prototype = {
	accepts() {
		return !!this.t;
	},
	/**
	* Follow an existing transition from the given input to the next state.
	* Does not mutate.
	* @param {string} input character or token type to transition on
	* @returns {?State<T>} the next state, if any
	*/
	go(input) {
		const state = this;
		const nextState = state.j[input];
		if (nextState) return nextState;
		for (let i = 0; i < state.jr.length; i++) {
			const regex = state.jr[i][0];
			const nextState = state.jr[i][1];
			if (nextState && regex.test(input)) return nextState;
		}
		return state.jd;
	},
	/**
	* Whether the state has a transition for the given input. Set the second
	* argument to true to only look for an exact match (and not a default or
	* regular-expression-based transition)
	* @param {string} input
	* @param {boolean} exactOnly
	*/
	has(input, exactOnly = false) {
		return exactOnly ? input in this.j : !!this.go(input);
	},
	/**
	* Short for "transition all"; create a transition from the array of items
	* in the given list to the same final resulting state.
	* @param {string | string[]} inputs Group of inputs to transition on
	* @param {Transition<T> | State<T>} [next] Transition options
	* @param {Flags} [flags] Collections flags to add token to
	* @param {Collections<T>} [groups] Master list of token groups
	*/
	ta(inputs, next, flags, groups) {
		for (let i = 0; i < inputs.length; i++) this.tt(inputs[i], next, flags, groups);
	},
	/**
	* Short for "take regexp transition"; defines a transition for this state
	* when it encounters a token which matches the given regular expression
	* @param {RegExp} regexp Regular expression transition (populate first)
	* @param {T | State<T>} [next] Transition options
	* @param {Flags} [flags] Collections flags to add token to
	* @param {Collections<T>} [groups] Master list of token groups
	* @returns {State<T>} taken after the given input
	*/
	tr(regexp, next, flags, groups) {
		groups = groups || State.groups;
		let nextState;
		if (next && next.j) nextState = next;
		else {
			nextState = new State(next);
			if (flags && groups) addToGroups(next, flags, groups);
		}
		this.jr.push([regexp, nextState]);
		return nextState;
	},
	/**
	* Short for "take transitions", will take as many sequential transitions as
	* the length of the given input and returns the
	* resulting final state.
	* @param {string | string[]} input
	* @param {T | State<T>} [next] Transition options
	* @param {Flags} [flags] Collections flags to add token to
	* @param {Collections<T>} [groups] Master list of token groups
	* @returns {State<T>} taken after the given input
	*/
	ts(input, next, flags, groups) {
		let state = this;
		const len = input.length;
		if (!len) return state;
		for (let i = 0; i < len - 1; i++) state = state.tt(input[i]);
		return state.tt(input[len - 1], next, flags, groups);
	},
	/**
	* Short for "take transition", this is a method for building/working with
	* state machines.
	*
	* If a state already exists for the given input, returns it.
	*
	* If a token is specified, that state will emit that token when reached by
	* the linkify engine.
	*
	* If no state exists, it will be initialized with some default transitions
	* that resemble existing default transitions.
	*
	* If a state is given for the second argument, that state will be
	* transitioned to on the given input regardless of what that input
	* previously did.
	*
	* Specify a token group flags to define groups that this token belongs to.
	* The token will be added to corresponding entires in the given groups
	* object.
	*
	* @param {string} input character, token type to transition on
	* @param {T | State<T>} [next] Transition options
	* @param {Flags} [flags] Collections flags to add token to
	* @param {Collections<T>} [groups] Master list of groups
	* @returns {State<T>} taken after the given input
	*/
	tt(input, next, flags, groups) {
		groups = groups || State.groups;
		const state = this;
		if (next && next.j) {
			state.j[input] = next;
			return next;
		}
		const t = next;
		let nextState, templateState = state.go(input);
		if (templateState) {
			nextState = new State();
			Object.assign(nextState.j, templateState.j);
			nextState.jr.push.apply(nextState.jr, templateState.jr);
			nextState.jd = templateState.jd;
			nextState.t = templateState.t;
		} else nextState = new State();
		if (t) {
			if (groups) {
				if (nextState.t && typeof nextState.t === "string") addToGroups(t, Object.assign(flagsForToken(nextState.t, groups), flags), groups);
				else if (flags) addToGroups(t, flags, groups);
			}
			nextState.t = t;
		}
		state.j[input] = nextState;
		return nextState;
	}
};
/**
* @template T
* @param {State<T>} state
* @param {string | string[]} input
* @param {Flags} [flags]
* @param {Collections<T>} [groups]
*/
var ta = (state, input, next, flags, groups) => state.ta(input, next, flags, groups);
/**
* @template T
* @param {State<T>} state
* @param {RegExp} regexp
* @param {T | State<T>} [next]
* @param {Flags} [flags]
* @param {Collections<T>} [groups]
*/
var tr = (state, regexp, next, flags, groups) => state.tr(regexp, next, flags, groups);
/**
* @template T
* @param {State<T>} state
* @param {string | string[]} input
* @param {T | State<T>} [next]
* @param {Flags} [flags]
* @param {Collections<T>} [groups]
*/
var ts = (state, input, next, flags, groups) => state.ts(input, next, flags, groups);
/**
* @template T
* @param {State<T>} state
* @param {string} input
* @param {T | State<T>} [next]
* @param {Collections<T>} [groups]
* @param {Flags} [flags]
*/
var tt = (state, input, next, flags, groups) => state.tt(input, next, flags, groups);
/******************************************************************************
Text Tokens
Identifiers for token outputs from the regexp scanner
******************************************************************************/
var WORD = "WORD";
var UWORD = "UWORD";
var ASCIINUMERICAL = "ASCIINUMERICAL";
var ALPHANUMERICAL = "ALPHANUMERICAL";
var LOCALHOST = "LOCALHOST";
var TLD = "TLD";
var UTLD = "UTLD";
var SCHEME = "SCHEME";
var SLASH_SCHEME = "SLASH_SCHEME";
var NUM = "NUM";
var WS = "WS";
var NL = "NL";
var OPENBRACE = "OPENBRACE";
var CLOSEBRACE = "CLOSEBRACE";
var OPENBRACKET = "OPENBRACKET";
var CLOSEBRACKET = "CLOSEBRACKET";
var OPENPAREN = "OPENPAREN";
var CLOSEPAREN = "CLOSEPAREN";
var OPENANGLEBRACKET = "OPENANGLEBRACKET";
var CLOSEANGLEBRACKET = "CLOSEANGLEBRACKET";
var FULLWIDTHLEFTPAREN = "FULLWIDTHLEFTPAREN";
var FULLWIDTHRIGHTPAREN = "FULLWIDTHRIGHTPAREN";
var LEFTCORNERBRACKET = "LEFTCORNERBRACKET";
var RIGHTCORNERBRACKET = "RIGHTCORNERBRACKET";
var LEFTWHITECORNERBRACKET = "LEFTWHITECORNERBRACKET";
var RIGHTWHITECORNERBRACKET = "RIGHTWHITECORNERBRACKET";
var FULLWIDTHLESSTHAN = "FULLWIDTHLESSTHAN";
var FULLWIDTHGREATERTHAN = "FULLWIDTHGREATERTHAN";
var AMPERSAND = "AMPERSAND";
var APOSTROPHE = "APOSTROPHE";
var ASTERISK = "ASTERISK";
var AT = "AT";
var BACKSLASH = "BACKSLASH";
var BACKTICK = "BACKTICK";
var CARET = "CARET";
var COLON = "COLON";
var COMMA = "COMMA";
var DOLLAR = "DOLLAR";
var DOT = "DOT";
var EQUALS = "EQUALS";
var EXCLAMATION = "EXCLAMATION";
var HYPHEN = "HYPHEN";
var PERCENT = "PERCENT";
var PIPE = "PIPE";
var PLUS = "PLUS";
var POUND = "POUND";
var QUERY = "QUERY";
var QUOTE = "QUOTE";
var FULLWIDTHMIDDLEDOT = "FULLWIDTHMIDDLEDOT";
var SEMI = "SEMI";
var SLASH = "SLASH";
var TILDE = "TILDE";
var UNDERSCORE = "UNDERSCORE";
var EMOJI$1 = "EMOJI";
var SYM = "SYM";
var tk = /*#__PURE__*/ Object.freeze({
	__proto__: null,
	ALPHANUMERICAL,
	AMPERSAND,
	APOSTROPHE,
	ASCIINUMERICAL,
	ASTERISK,
	AT,
	BACKSLASH,
	BACKTICK,
	CARET,
	CLOSEANGLEBRACKET,
	CLOSEBRACE,
	CLOSEBRACKET,
	CLOSEPAREN,
	COLON,
	COMMA,
	DOLLAR,
	DOT,
	EMOJI: EMOJI$1,
	EQUALS,
	EXCLAMATION,
	FULLWIDTHGREATERTHAN,
	FULLWIDTHLEFTPAREN,
	FULLWIDTHLESSTHAN,
	FULLWIDTHMIDDLEDOT,
	FULLWIDTHRIGHTPAREN,
	HYPHEN,
	LEFTCORNERBRACKET,
	LEFTWHITECORNERBRACKET,
	LOCALHOST,
	NL,
	NUM,
	OPENANGLEBRACKET,
	OPENBRACE,
	OPENBRACKET,
	OPENPAREN,
	PERCENT,
	PIPE,
	PLUS,
	POUND,
	QUERY,
	QUOTE,
	RIGHTCORNERBRACKET,
	RIGHTWHITECORNERBRACKET,
	SCHEME,
	SEMI,
	SLASH,
	SLASH_SCHEME,
	SYM,
	TILDE,
	TLD,
	UNDERSCORE,
	UTLD,
	UWORD,
	WORD,
	WS
});
var ASCII_LETTER = /[a-z]/;
var LETTER = /\p{L}/u;
var EMOJI = /\p{Emoji}/u;
var DIGIT = /\d/;
var SPACE = /\s/;
/**
The scanner provides an interface that takes a string of text as input, and
outputs an array of tokens instances that can be used for easy URL parsing.
*/
var CR = "\r";
var LF = "\n";
var EMOJI_VARIATION = "️";
var EMOJI_JOINER = "‍";
var OBJECT_REPLACEMENT = "￼";
var tlds = null, utlds = null;
/**
* Scanner output token:
* - `t` is the token name (e.g., 'NUM', 'EMOJI', 'TLD')
* - `v` is the value of the token (e.g., '123', '❤️', 'com')
* - `s` is the start index of the token in the original string
* - `e` is the end index of the token in the original string
* @typedef {{t: string, v: string, s: number, e: number}} Token
*/
/**
* @template T
* @typedef {{ [collection: string]: T[] }} Collections
*/
/**
* Initialize the scanner character-based state machine for the given start
* state
* @param {[string, boolean][]} customSchemes List of custom schemes, where each
* item is a length-2 tuple with the first element set to the string scheme, and
* the second element set to `true` if the `://` after the scheme is optional
*/
function init$2(customSchemes = []) {
	/** @type Collections<string> */
	const groups = {};
	State.groups = groups;
	/** @type State<string> */
	const Start = new State();
	if (tlds == null) tlds = decodeTlds(encodedTlds);
	if (utlds == null) utlds = decodeTlds(encodedUtlds);
	tt(Start, "'", APOSTROPHE);
	tt(Start, "{", OPENBRACE);
	tt(Start, "}", CLOSEBRACE);
	tt(Start, "[", OPENBRACKET);
	tt(Start, "]", CLOSEBRACKET);
	tt(Start, "(", OPENPAREN);
	tt(Start, ")", CLOSEPAREN);
	tt(Start, "<", OPENANGLEBRACKET);
	tt(Start, ">", CLOSEANGLEBRACKET);
	tt(Start, "（", FULLWIDTHLEFTPAREN);
	tt(Start, "）", FULLWIDTHRIGHTPAREN);
	tt(Start, "「", LEFTCORNERBRACKET);
	tt(Start, "」", RIGHTCORNERBRACKET);
	tt(Start, "『", LEFTWHITECORNERBRACKET);
	tt(Start, "』", RIGHTWHITECORNERBRACKET);
	tt(Start, "＜", FULLWIDTHLESSTHAN);
	tt(Start, "＞", FULLWIDTHGREATERTHAN);
	tt(Start, "&", AMPERSAND);
	tt(Start, "*", ASTERISK);
	tt(Start, "@", AT);
	tt(Start, "`", BACKTICK);
	tt(Start, "^", CARET);
	tt(Start, ":", COLON);
	tt(Start, ",", COMMA);
	tt(Start, "$", DOLLAR);
	tt(Start, ".", DOT);
	tt(Start, "=", EQUALS);
	tt(Start, "!", EXCLAMATION);
	tt(Start, "-", HYPHEN);
	tt(Start, "%", PERCENT);
	tt(Start, "|", PIPE);
	tt(Start, "+", PLUS);
	tt(Start, "#", POUND);
	tt(Start, "?", QUERY);
	tt(Start, "\"", QUOTE);
	tt(Start, "/", SLASH);
	tt(Start, ";", SEMI);
	tt(Start, "~", TILDE);
	tt(Start, "_", UNDERSCORE);
	tt(Start, "\\", BACKSLASH);
	tt(Start, "・", FULLWIDTHMIDDLEDOT);
	const Num = tr(Start, DIGIT, NUM, { [numeric]: true });
	tr(Num, DIGIT, Num);
	const Asciinumeric = tr(Num, ASCII_LETTER, ASCIINUMERICAL, { [asciinumeric]: true });
	const Alphanumeric = tr(Num, LETTER, ALPHANUMERICAL, { [alphanumeric]: true });
	const Word = tr(Start, ASCII_LETTER, WORD, { [ascii]: true });
	tr(Word, DIGIT, Asciinumeric);
	tr(Word, ASCII_LETTER, Word);
	tr(Asciinumeric, DIGIT, Asciinumeric);
	tr(Asciinumeric, ASCII_LETTER, Asciinumeric);
	const UWord = tr(Start, LETTER, UWORD, { [alpha]: true });
	tr(UWord, ASCII_LETTER);
	tr(UWord, DIGIT, Alphanumeric);
	tr(UWord, LETTER, UWord);
	tr(Alphanumeric, DIGIT, Alphanumeric);
	tr(Alphanumeric, ASCII_LETTER);
	tr(Alphanumeric, LETTER, Alphanumeric);
	const Nl = tt(Start, LF, NL, { [whitespace]: true });
	const Cr = tt(Start, CR, WS, { [whitespace]: true });
	const Ws = tr(Start, SPACE, WS, { [whitespace]: true });
	tt(Start, OBJECT_REPLACEMENT, Ws);
	tt(Cr, LF, Nl);
	tt(Cr, OBJECT_REPLACEMENT, Ws);
	tr(Cr, SPACE, Ws);
	tt(Ws, CR);
	tt(Ws, LF);
	tr(Ws, SPACE, Ws);
	tt(Ws, OBJECT_REPLACEMENT, Ws);
	const Emoji = tr(Start, EMOJI, EMOJI$1, { [emoji]: true });
	tt(Emoji, "#");
	tr(Emoji, EMOJI, Emoji);
	tt(Emoji, EMOJI_VARIATION, Emoji);
	const EmojiJoiner = tt(Emoji, EMOJI_JOINER);
	tt(EmojiJoiner, "#");
	tr(EmojiJoiner, EMOJI, Emoji);
	const wordjr = [[ASCII_LETTER, Word], [DIGIT, Asciinumeric]];
	const uwordjr = [
		[ASCII_LETTER, null],
		[LETTER, UWord],
		[DIGIT, Alphanumeric]
	];
	for (let i = 0; i < tlds.length; i++) fastts(Start, tlds[i], TLD, WORD, wordjr);
	for (let i = 0; i < utlds.length; i++) fastts(Start, utlds[i], UTLD, UWORD, uwordjr);
	addToGroups(TLD, {
		tld: true,
		ascii: true
	}, groups);
	addToGroups(UTLD, {
		utld: true,
		alpha: true
	}, groups);
	fastts(Start, "file", SCHEME, WORD, wordjr);
	fastts(Start, "mailto", SCHEME, WORD, wordjr);
	fastts(Start, "http", SLASH_SCHEME, WORD, wordjr);
	fastts(Start, "https", SLASH_SCHEME, WORD, wordjr);
	fastts(Start, "ftp", SLASH_SCHEME, WORD, wordjr);
	fastts(Start, "ftps", SLASH_SCHEME, WORD, wordjr);
	addToGroups(SCHEME, {
		scheme: true,
		ascii: true
	}, groups);
	addToGroups(SLASH_SCHEME, {
		slashscheme: true,
		ascii: true
	}, groups);
	customSchemes = customSchemes.sort((a, b) => a[0] > b[0] ? 1 : -1);
	for (let i = 0; i < customSchemes.length; i++) {
		const sch = customSchemes[i][0];
		const flags = customSchemes[i][1] ? { [scheme]: true } : { [slashscheme]: true };
		if (sch.indexOf("-") >= 0) flags[domain] = true;
		else if (!ASCII_LETTER.test(sch)) flags[numeric] = true;
		else if (DIGIT.test(sch)) flags[asciinumeric] = true;
		else flags[ascii] = true;
		ts(Start, sch, sch, flags);
	}
	ts(Start, "localhost", LOCALHOST, { ascii: true });
	Start.jd = new State(SYM);
	return {
		start: Start,
		tokens: Object.assign({ groups }, tk)
	};
}
/**
Given a string, returns an array of TOKEN instances representing the
composition of that string.

@method run
@param {State<string>} start scanner starting state
@param {string} str input string to scan
@return {Token[]} list of tokens, each with a type and value
*/
function run$1(start, str) {
	const iterable = stringToArray(str.replace(/[A-Z]/g, (c) => c.toLowerCase()));
	const charCount = iterable.length;
	const tokens = [];
	let cursor = 0;
	let charCursor = 0;
	while (charCursor < charCount) {
		let state = start;
		let nextState = null;
		let tokenLength = 0;
		let latestAccepting = null;
		let sinceAccepts = -1;
		let charsSinceAccepts = -1;
		while (charCursor < charCount && (nextState = state.go(iterable[charCursor]))) {
			state = nextState;
			if (state.accepts()) {
				sinceAccepts = 0;
				charsSinceAccepts = 0;
				latestAccepting = state;
			} else if (sinceAccepts >= 0) {
				sinceAccepts += iterable[charCursor].length;
				charsSinceAccepts++;
			}
			tokenLength += iterable[charCursor].length;
			cursor += iterable[charCursor].length;
			charCursor++;
		}
		cursor -= sinceAccepts;
		charCursor -= charsSinceAccepts;
		tokenLength -= sinceAccepts;
		tokens.push({
			t: latestAccepting.t,
			v: str.slice(cursor - tokenLength, cursor),
			s: cursor - tokenLength,
			e: cursor
		});
	}
	return tokens;
}
/**
* Convert a String to an Array of characters, taking into account that some
* characters like emojis take up two string indexes.
*
* Adapted from core-js (MIT license)
* https://github.com/zloirock/core-js/blob/2d69cf5f99ab3ea3463c395df81e5a15b68f49d9/packages/core-js/internals/string-multibyte.js
*
* @function stringToArray
* @param {string} str
* @returns {string[]}
*/
function stringToArray(str) {
	const result = [];
	const len = str.length;
	let index = 0;
	while (index < len) {
		let first = str.charCodeAt(index);
		let second;
		let char = first < 55296 || first > 56319 || index + 1 === len || (second = str.charCodeAt(index + 1)) < 56320 || second > 57343 ? str[index] : str.slice(index, index + 2);
		result.push(char);
		index += char.length;
	}
	return result;
}
/**
* Fast version of ts function for when transition defaults are well known
* @param {State<string>} state
* @param {string} input
* @param {string} t
* @param {string} defaultt
* @param {[RegExp, State<string>][]} jr
* @returns {State<string>}
*/
function fastts(state, input, t, defaultt, jr) {
	let next;
	const len = input.length;
	for (let i = 0; i < len - 1; i++) {
		const char = input[i];
		if (state.j[char]) next = state.j[char];
		else {
			next = new State(defaultt);
			next.jr = jr.slice();
			state.j[char] = next;
		}
		state = next;
	}
	next = new State(t);
	next.jr = jr.slice();
	state.j[input[len - 1]] = next;
	return next;
}
/**
* Converts a string of Top-Level Domain names encoded in update-tlds.js back
* into a list of strings.
* @param {str} encoded encoded TLDs string
* @returns {str[]} original TLDs list
*/
function decodeTlds(encoded) {
	const words = [];
	const stack = [];
	let i = 0;
	let digits = "0123456789";
	while (i < encoded.length) {
		let popDigitCount = 0;
		while (digits.indexOf(encoded[i + popDigitCount]) >= 0) popDigitCount++;
		if (popDigitCount > 0) {
			words.push(stack.join(""));
			for (let popCount = parseInt(encoded.substring(i, i + popDigitCount), 10); popCount > 0; popCount--) stack.pop();
			i += popDigitCount;
		} else {
			stack.push(encoded[i]);
			i++;
		}
	}
	return words;
}
/**
* An object where each key is a valid DOM Event Name such as `click` or `focus`
* and each value is an event handler function.
*
* https://developer.mozilla.org/en-US/docs/Web/API/Element#events
* @typedef {?{ [event: string]: Function }} EventListeners
*/
/**
* All formatted properties required to render a link, including `tagName`,
* `attributes`, `content` and `eventListeners`.
* @typedef {{ tagName: any, attributes: {[attr: string]: any}, content: string,
* eventListeners: EventListeners }} IntermediateRepresentation
*/
/**
* Specify either an object described by the template type `O` or a function.
*
* The function takes a string value (usually the link's href attribute), the
* link type (`'url'`, `'hashtag`', etc.) and an internal token representation
* of the link. It should return an object of the template type `O`
* @template O
* @typedef {O | ((value: string, type: string, token: MultiToken) => O)} OptObj
*/
/**
* Specify either a function described by template type `F` or an object.
*
* Each key in the object should be a link type (`'url'`, `'hashtag`', etc.). Each
* value should be a function with template type `F` that is called when the
* corresponding link type is encountered.
* @template F
* @typedef {F | { [type: string]: F}} OptFn
*/
/**
* Specify either a value with template type `V`, a function that returns `V` or
* an object where each value resolves to `V`.
*
* The function takes a string value (usually the link's href attribute), the
* link type (`'url'`, `'hashtag`', etc.) and an internal token representation
* of the link. It should return an object of the template type `V`
*
* For the object, each key should be a link type (`'url'`, `'hashtag`', etc.).
* Each value should either have type `V` or a function that returns V. This
* function similarly takes a string value and a token.
*
* Example valid types for `Opt<string>`:
*
* ```js
* 'hello'
* (value, type, token) => 'world'
* { url: 'hello', email: (value, token) => 'world'}
* ```
* @template V
* @typedef {V | ((value: string, type: string, token: MultiToken) => V) | { [type: string]: V | ((value: string, token: MultiToken) => V) }} Opt
*/
/**
* See available options: https://linkify.js.org/docs/options.html
* @typedef {{
* 	defaultProtocol?: string,
*  events?: OptObj<EventListeners>,
* 	format?: Opt<string>,
* 	formatHref?: Opt<string>,
* 	nl2br?: boolean,
* 	tagName?: Opt<any>,
* 	target?: Opt<string>,
* 	rel?: Opt<string>,
* 	validate?: Opt<boolean>,
* 	truncate?: Opt<number>,
* 	className?: Opt<string>,
* 	attributes?: OptObj<({ [attr: string]: any })>,
*  ignoreTags?: string[],
* 	render?: OptFn<((ir: IntermediateRepresentation) => any)>
* }} Opts
*/
/**
* @type Required<Opts>
*/
var defaults = {
	defaultProtocol: "http",
	events: null,
	format: noop,
	formatHref: noop,
	nl2br: false,
	tagName: "a",
	target: null,
	rel: null,
	validate: true,
	truncate: Infinity,
	className: null,
	attributes: null,
	ignoreTags: [],
	render: null
};
/**
* Utility class for linkify interfaces to apply specified
* {@link Opts formatting and rendering options}.
*
* @param {Opts | Options} [opts] Option value overrides.
* @param {(ir: IntermediateRepresentation) => any} [defaultRender] (For
*   internal use) default render function that determines how to generate an
*   HTML element based on a link token's derived tagName, attributes and HTML.
*   Similar to render option
*/
function Options(opts, defaultRender = null) {
	let o = Object.assign({}, defaults);
	if (opts) o = Object.assign(o, opts instanceof Options ? opts.o : opts);
	const ignoredTags = o.ignoreTags;
	const uppercaseIgnoredTags = [];
	for (let i = 0; i < ignoredTags.length; i++) uppercaseIgnoredTags.push(ignoredTags[i].toUpperCase());
	/** @protected */
	this.o = o;
	if (defaultRender) this.defaultRender = defaultRender;
	this.ignoreTags = uppercaseIgnoredTags;
}
Options.prototype = {
	o: defaults,
	/**
	* @type string[]
	*/
	ignoreTags: [],
	/**
	* @param {IntermediateRepresentation} ir
	* @returns {any}
	*/
	defaultRender(ir) {
		return ir;
	},
	/**
	* Returns true or false based on whether a token should be displayed as a
	* link based on the user options.
	* @param {MultiToken} token
	* @returns {boolean}
	*/
	check(token) {
		return this.get("validate", token.toString(), token);
	},
	/**
	* Resolve an option's value based on the value of the option and the given
	* params. If operator and token are specified and the target option is
	* callable, automatically calls the function with the given argument.
	* @template {keyof Opts} K
	* @param {K} key Name of option to use
	* @param {string} [operator] will be passed to the target option if it's a
	* function. If not specified, RAW function value gets returned
	* @param {MultiToken} [token] The token from linkify.tokenize
	* @returns {Opts[K] | any}
	*/
	get(key, operator, token) {
		const isCallable = operator != null;
		let option = this.o[key];
		if (!option) return option;
		if (typeof option === "object") {
			option = token.t in option ? option[token.t] : defaults[key];
			if (typeof option === "function" && isCallable) option = option(operator, token);
		} else if (typeof option === "function" && isCallable) option = option(operator, token.t, token);
		return option;
	},
	/**
	* @template {keyof Opts} L
	* @param {L} key Name of options object to use
	* @param {string} [operator]
	* @param {MultiToken} [token]
	* @returns {Opts[L] | any}
	*/
	getObj(key, operator, token) {
		let obj = this.o[key];
		if (typeof obj === "function" && operator != null) obj = obj(operator, token.t, token);
		return obj;
	},
	/**
	* Convert the given token to a rendered element that may be added to the
	* calling-interface's DOM
	* @param {MultiToken} token Token to render to an HTML element
	* @returns {any} Render result; e.g., HTML string, DOM element, React
	*   Component, etc.
	*/
	render(token) {
		const ir = token.render(this);
		return (this.get("render", null, token) || this.defaultRender)(ir, token.t, token);
	}
};
function noop(val) {
	return val;
}
/******************************************************************************
Multi-Tokens
Tokens composed of arrays of TextTokens
******************************************************************************/
/**
* @param {string} value
* @param {Token[]} tokens
*/
function MultiToken(value, tokens) {
	this.t = "token";
	this.v = value;
	this.tk = tokens;
}
/**
* Abstract class used for manufacturing tokens of text tokens. That is rather
* than the value for a token being a small string of text, it's value an array
* of text tokens.
*
* Used for grouping together URLs, emails, hashtags, and other potential
* creations.
* @class MultiToken
* @property {string} t
* @property {string} v
* @property {Token[]} tk
* @abstract
*/
MultiToken.prototype = {
	isLink: false,
	/**
	* Return the string this token represents.
	* @return {string}
	*/
	toString() {
		return this.v;
	},
	/**
	* What should the value for this token be in the `href` HTML attribute?
	* Returns the `.toString` value by default.
	* @param {string} [scheme]
	* @return {string}
	*/
	toHref(scheme) {
		return this.toString();
	},
	/**
	* @param {Options} options Formatting options
	* @returns {string}
	*/
	toFormattedString(options) {
		const val = this.toString();
		const truncate = options.get("truncate", val, this);
		const formatted = options.get("format", val, this);
		return truncate && formatted.length > truncate ? formatted.substring(0, truncate) + "…" : formatted;
	},
	/**
	*
	* @param {Options} options
	* @returns {string}
	*/
	toFormattedHref(options) {
		return options.get("formatHref", this.toHref(options.get("defaultProtocol")), this);
	},
	/**
	* The start index of this token in the original input string
	* @returns {number}
	*/
	startIndex() {
		return this.tk[0].s;
	},
	/**
	* The end index of this token in the original input string (up to this
	* index but not including it)
	* @returns {number}
	*/
	endIndex() {
		return this.tk[this.tk.length - 1].e;
	},
	/**
	Returns an object  of relevant values for this token, which includes keys
	* type - Kind of token ('url', 'email', etc.)
	* value - Original text
	* href - The value that should be added to the anchor tag's href
	attribute
	@method toObject
	@param {string} [protocol] `'http'` by default
	*/
	toObject(protocol = defaults.defaultProtocol) {
		return {
			type: this.t,
			value: this.toString(),
			isLink: this.isLink,
			href: this.toHref(protocol),
			start: this.startIndex(),
			end: this.endIndex()
		};
	},
	/**
	*
	* @param {Options} options Formatting option
	*/
	toFormattedObject(options) {
		return {
			type: this.t,
			value: this.toFormattedString(options),
			isLink: this.isLink,
			href: this.toFormattedHref(options),
			start: this.startIndex(),
			end: this.endIndex()
		};
	},
	/**
	* Whether this token should be rendered as a link according to the given options
	* @param {Options} options
	* @returns {boolean}
	*/
	validate(options) {
		return options.get("validate", this.toString(), this);
	},
	/**
	* Return an object that represents how this link should be rendered.
	* @param {Options} options Formattinng options
	*/
	render(options) {
		const token = this;
		const href = this.toHref(options.get("defaultProtocol"));
		const formattedHref = options.get("formatHref", href, this);
		const tagName = options.get("tagName", href, token);
		const content = this.toFormattedString(options);
		const attributes = {};
		const className = options.get("className", href, token);
		const target = options.get("target", href, token);
		const rel = options.get("rel", href, token);
		const attrs = options.getObj("attributes", href, token);
		const eventListeners = options.getObj("events", href, token);
		attributes.href = formattedHref;
		if (className) attributes.class = className;
		if (target) attributes.target = target;
		if (rel) attributes.rel = rel;
		if (attrs) Object.assign(attributes, attrs);
		return {
			tagName,
			attributes,
			content,
			eventListeners
		};
	}
};
/**
* Create a new token that can be emitted by the parser state machine
* @param {string} type readable type of the token
* @param {object} props properties to assign or override, including isLink = true or false
* @returns {new (value: string, tokens: Token[]) => MultiToken} new token class
*/
function createTokenClass(type, props) {
	class Token extends MultiToken {
		constructor(value, tokens) {
			super(value, tokens);
			this.t = type;
		}
	}
	for (const p in props) Token.prototype[p] = props[p];
	Token.t = type;
	return Token;
}
/**
Represents a list of tokens making up a valid email address
*/
var Email = createTokenClass("email", {
	isLink: true,
	toHref() {
		return "mailto:" + this.toString();
	}
});
/**
Represents some plain text
*/
var Text$1 = createTokenClass("text");
/**
Multi-linebreak token - represents a line break
@class Nl
*/
var Nl = createTokenClass("nl");
/**
Represents a list of text tokens making up a valid URL
@class Url
*/
var Url = createTokenClass("url", {
	isLink: true,
	/**
	Lowercases relevant parts of the domain and adds the protocol if
	required. Note that this will not escape unsafe HTML characters in the
	URL.
	@param {string} [scheme] default scheme (e.g., 'https')
	@return {string} the full href
	*/
	toHref(scheme = defaults.defaultProtocol) {
		return this.hasProtocol() ? this.v : `${scheme}://${this.v}`;
	},
	/**
	* Check whether this URL token has a protocol
	* @return {boolean}
	*/
	hasProtocol() {
		const tokens = this.tk;
		return tokens.length >= 2 && tokens[0].t !== LOCALHOST && tokens[1].t === COLON;
	}
});
/**
Not exactly parser, more like the second-stage scanner (although we can
theoretically hotswap the code here with a real parser in the future... but
for a little URL-finding utility abstract syntax trees may be a little
overkill).

URL format: http://en.wikipedia.org/wiki/URI_scheme
Email format: http://en.wikipedia.org/wiki/EmailAddress (links to RFC in
reference)

@module linkify
@submodule parser
@main run
*/
var makeState = (arg) => new State(arg);
/**
* Generate the parser multi token-based state machine
* @param {{ groups: Collections<string> }} tokens
*/
function init$1({ groups }) {
	const qsAccepting = groups.domain.concat([
		AMPERSAND,
		ASTERISK,
		AT,
		BACKSLASH,
		BACKTICK,
		CARET,
		DOLLAR,
		EQUALS,
		HYPHEN,
		NUM,
		PERCENT,
		PIPE,
		PLUS,
		POUND,
		SLASH,
		SYM,
		TILDE,
		UNDERSCORE
	]);
	const qsNonAccepting = [
		APOSTROPHE,
		COLON,
		COMMA,
		DOT,
		EXCLAMATION,
		PERCENT,
		QUERY,
		QUOTE,
		SEMI,
		OPENANGLEBRACKET,
		CLOSEANGLEBRACKET,
		OPENBRACE,
		CLOSEBRACE,
		CLOSEBRACKET,
		OPENBRACKET,
		OPENPAREN,
		CLOSEPAREN,
		FULLWIDTHLEFTPAREN,
		FULLWIDTHRIGHTPAREN,
		LEFTCORNERBRACKET,
		RIGHTCORNERBRACKET,
		LEFTWHITECORNERBRACKET,
		RIGHTWHITECORNERBRACKET,
		FULLWIDTHLESSTHAN,
		FULLWIDTHGREATERTHAN
	];
	const localpartAccepting = [
		AMPERSAND,
		APOSTROPHE,
		ASTERISK,
		BACKSLASH,
		BACKTICK,
		CARET,
		DOLLAR,
		EQUALS,
		HYPHEN,
		OPENBRACE,
		CLOSEBRACE,
		PERCENT,
		PIPE,
		PLUS,
		POUND,
		QUERY,
		SLASH,
		SYM,
		TILDE,
		UNDERSCORE
	];
	/**
	* @type State<Token>
	*/
	const Start = makeState();
	const Localpart = tt(Start, TILDE);
	ta(Localpart, localpartAccepting, Localpart);
	ta(Localpart, groups.domain, Localpart);
	const Domain = makeState(), Scheme = makeState(), SlashScheme = makeState();
	ta(Start, groups.domain, Domain);
	ta(Start, groups.scheme, Scheme);
	ta(Start, groups.slashscheme, SlashScheme);
	ta(Domain, localpartAccepting, Localpart);
	ta(Domain, groups.domain, Domain);
	const LocalpartAt = tt(Domain, AT);
	tt(Localpart, AT, LocalpartAt);
	tt(Scheme, AT, LocalpartAt);
	tt(SlashScheme, AT, LocalpartAt);
	const LocalpartDot = tt(Localpart, DOT);
	ta(LocalpartDot, localpartAccepting, Localpart);
	ta(LocalpartDot, groups.domain, Localpart);
	const EmailDomain = makeState();
	ta(LocalpartAt, groups.domain, EmailDomain);
	ta(EmailDomain, groups.domain, EmailDomain);
	const EmailDomainDot = tt(EmailDomain, DOT);
	ta(EmailDomainDot, groups.domain, EmailDomain);
	const Email$1 = makeState(Email);
	ta(EmailDomainDot, groups.tld, Email$1);
	ta(EmailDomainDot, groups.utld, Email$1);
	tt(LocalpartAt, LOCALHOST, Email$1);
	const EmailDomainHyphen = tt(EmailDomain, HYPHEN);
	tt(EmailDomainHyphen, HYPHEN, EmailDomainHyphen);
	ta(EmailDomainHyphen, groups.domain, EmailDomain);
	ta(Email$1, groups.domain, EmailDomain);
	tt(Email$1, DOT, EmailDomainDot);
	tt(Email$1, HYPHEN, EmailDomainHyphen);
	const DomainHyphen = tt(Domain, HYPHEN);
	const DomainDot = tt(Domain, DOT);
	tt(DomainHyphen, HYPHEN, DomainHyphen);
	ta(DomainHyphen, groups.domain, Domain);
	ta(DomainDot, localpartAccepting, Localpart);
	ta(DomainDot, groups.domain, Domain);
	const DomainDotTld = makeState(Url);
	ta(DomainDot, groups.tld, DomainDotTld);
	ta(DomainDot, groups.utld, DomainDotTld);
	ta(DomainDotTld, groups.domain, Domain);
	ta(DomainDotTld, localpartAccepting, Localpart);
	tt(DomainDotTld, DOT, DomainDot);
	tt(DomainDotTld, HYPHEN, DomainHyphen);
	tt(DomainDotTld, AT, LocalpartAt);
	const DomainDotTldColon = tt(DomainDotTld, COLON);
	const DomainDotTldColonPort = makeState(Url);
	ta(DomainDotTldColon, groups.numeric, DomainDotTldColonPort);
	const Url$1 = makeState(Url);
	const UrlNonaccept = makeState();
	ta(Url$1, qsAccepting, Url$1);
	ta(Url$1, qsNonAccepting, UrlNonaccept);
	ta(UrlNonaccept, qsAccepting, Url$1);
	ta(UrlNonaccept, qsNonAccepting, UrlNonaccept);
	tt(DomainDotTld, SLASH, Url$1);
	tt(DomainDotTldColonPort, SLASH, Url$1);
	const SchemeColon = tt(Scheme, COLON);
	const UriPrefix = tt(tt(tt(SlashScheme, COLON), SLASH), SLASH);
	ta(Scheme, groups.domain, Domain);
	tt(Scheme, DOT, DomainDot);
	tt(Scheme, HYPHEN, DomainHyphen);
	ta(SlashScheme, groups.domain, Domain);
	tt(SlashScheme, DOT, DomainDot);
	tt(SlashScheme, HYPHEN, DomainHyphen);
	ta(SchemeColon, groups.domain, Url$1);
	tt(SchemeColon, SLASH, Url$1);
	tt(SchemeColon, QUERY, Url$1);
	ta(UriPrefix, groups.domain, Url$1);
	ta(UriPrefix, qsAccepting, Url$1);
	tt(UriPrefix, SLASH, Url$1);
	const bracketPairs = [
		[OPENBRACE, CLOSEBRACE],
		[OPENBRACKET, CLOSEBRACKET],
		[OPENPAREN, CLOSEPAREN],
		[OPENANGLEBRACKET, CLOSEANGLEBRACKET],
		[FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN],
		[LEFTCORNERBRACKET, RIGHTCORNERBRACKET],
		[LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET],
		[FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN]
	];
	for (let i = 0; i < bracketPairs.length; i++) {
		const [OPEN, CLOSE] = bracketPairs[i];
		const UrlOpen = tt(Url$1, OPEN);
		tt(UrlNonaccept, OPEN, UrlOpen);
		const UrlOpenQ = makeState(Url);
		ta(UrlOpen, qsAccepting, UrlOpenQ);
		const UrlOpenSyms = makeState();
		ta(UrlOpen, qsNonAccepting, UrlOpenSyms);
		tt(UrlOpen, CLOSE, Url$1);
		ta(UrlOpenQ, qsAccepting, UrlOpenQ);
		ta(UrlOpenQ, qsNonAccepting, UrlOpenSyms);
		ta(UrlOpenSyms, qsAccepting, UrlOpenQ);
		ta(UrlOpenSyms, qsNonAccepting, UrlOpenSyms);
		tt(UrlOpenQ, CLOSE, Url$1);
		tt(UrlOpenSyms, CLOSE, Url$1);
	}
	tt(Start, LOCALHOST, DomainDotTld);
	tt(Start, NL, Nl);
	return {
		start: Start,
		tokens: tk
	};
}
/**
* Run the parser state machine on a list of scanned string-based tokens to
* create a list of multi tokens, each of which represents a URL, email address,
* plain text, etc.
*
* @param {State<MultiToken>} start parser start state
* @param {string} input the original input used to generate the given tokens
* @param {Token[]} tokens list of scanned tokens
* @returns {MultiToken[]}
*/
function run(start, input, tokens) {
	let len = tokens.length;
	let cursor = 0;
	let multis = [];
	let textTokens = [];
	while (cursor < len) {
		let state = start;
		let secondState = null;
		let nextState = null;
		let multiLength = 0;
		let latestAccepting = null;
		let sinceAccepts = -1;
		while (cursor < len && !(secondState = state.go(tokens[cursor].t))) textTokens.push(tokens[cursor++]);
		while (cursor < len && (nextState = secondState || state.go(tokens[cursor].t))) {
			secondState = null;
			state = nextState;
			if (state.accepts()) {
				sinceAccepts = 0;
				latestAccepting = state;
			} else if (sinceAccepts >= 0) sinceAccepts++;
			cursor++;
			multiLength++;
		}
		if (sinceAccepts < 0) {
			cursor -= multiLength;
			if (cursor < len) {
				textTokens.push(tokens[cursor]);
				cursor++;
			}
		} else {
			if (textTokens.length > 0) {
				multis.push(initMultiToken(Text$1, input, textTokens));
				textTokens = [];
			}
			cursor -= sinceAccepts;
			multiLength -= sinceAccepts;
			const Multi = latestAccepting.t;
			const subtokens = tokens.slice(cursor - multiLength, cursor);
			multis.push(initMultiToken(Multi, input, subtokens));
		}
	}
	if (textTokens.length > 0) multis.push(initMultiToken(Text$1, input, textTokens));
	return multis;
}
/**
* Utility function for instantiating a new multitoken with all the relevant
* fields during parsing.
* @param {new (value: string, tokens: Token[]) => MultiToken} Multi class to instantiate
* @param {string} input original input string
* @param {Token[]} tokens consecutive tokens scanned from input string
* @returns {MultiToken}
*/
function initMultiToken(Multi, input, tokens) {
	const startIdx = tokens[0].s;
	const endIdx = tokens[tokens.length - 1].e;
	return new Multi(input.slice(startIdx, endIdx), tokens);
}
var warn = typeof console !== "undefined" && console && console.warn || (() => {});
var warnAdvice = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.";
var INIT = {
	scanner: null,
	parser: null,
	tokenQueue: [],
	pluginQueue: [],
	customSchemes: [],
	initialized: false
};
/**
* @typedef {{
* 	start: State<string>,
* 	tokens: { groups: Collections<string> } & typeof tk
* }} ScannerInit
*/
/**
* @typedef {{
* 	start: State<MultiToken>,
* 	tokens: typeof multi
* }} ParserInit
*/
/**
* @typedef {(arg: { scanner: ScannerInit }) => void} TokenPlugin
*/
/**
* @typedef {(arg: { scanner: ScannerInit, parser: ParserInit }) => void} Plugin
*/
/**
* De-register all plugins and reset the internal state-machine. Used for
* testing; not required in practice.
* @private
*/
function reset() {
	State.groups = {};
	INIT.scanner = null;
	INIT.parser = null;
	INIT.tokenQueue = [];
	INIT.pluginQueue = [];
	INIT.customSchemes = [];
	INIT.initialized = false;
	return INIT;
}
/**
* Detect URLs with the following additional protocol. Anything with format
* "protocol://..." will be considered a link. If `optionalSlashSlash` is set to
* `true`, anything with format "protocol:..." will be considered a link.
* @param {string} scheme
* @param {boolean} [optionalSlashSlash]
*/
function registerCustomProtocol(scheme, optionalSlashSlash = false) {
	if (INIT.initialized) warn(`linkifyjs: already initialized - will not register custom scheme "${scheme}" ${warnAdvice}`);
	if (!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(scheme)) 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`);
	INIT.customSchemes.push([scheme, optionalSlashSlash]);
}
/**
* Initialize the linkify state machine. Called automatically the first time
* linkify is called on a string, but may be called manually as well.
*/
function init() {
	INIT.scanner = init$2(INIT.customSchemes);
	for (let i = 0; i < INIT.tokenQueue.length; i++) INIT.tokenQueue[i][1]({ scanner: INIT.scanner });
	INIT.parser = init$1(INIT.scanner.tokens);
	for (let i = 0; i < INIT.pluginQueue.length; i++) INIT.pluginQueue[i][1]({
		scanner: INIT.scanner,
		parser: INIT.parser
	});
	INIT.initialized = true;
	return INIT;
}
/**
* Parse a string into tokens that represent linkable and non-linkable sub-components
* @param {string} str
* @return {MultiToken[]} tokens
*/
function tokenize(str) {
	if (!INIT.initialized) init();
	return run(INIT.parser.start, str, run$1(INIT.scanner.start, str));
}
tokenize.scan = run$1;
/**
* Find a list of linkable items in the given string.
* @param {string} str string to find links in
* @param {string | Opts} [type] either formatting options or specific type of
* links to find, e.g., 'url' or 'email'
* @param {Opts} [opts] formatting options for final output. Cannot be specified
* if opts already provided in `type` argument
*/
function find(str, type = null, opts = null) {
	if (type && typeof type === "object") {
		if (opts) throw Error(`linkifyjs: Invalid link type ${type}; must be a string`);
		opts = type;
		type = null;
	}
	const options = new Options(opts);
	const tokens = tokenize(str);
	const filtered = [];
	for (let i = 0; i < tokens.length; i++) {
		const token = tokens[i];
		if (token.isLink && (!type || token.t === type) && options.check(token)) filtered.push(token.toFormattedObject(options));
	}
	return filtered;
}
//#endregion
//#region node_modules/@tiptap/extension-link/dist/index.js
var UNICODE_WHITESPACE_PATTERN = "[\0- \xA0 ᠎ -\u2029 　]";
var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
var UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);
var UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, "g");
function isValidLinkStructure(tokens) {
	if (tokens.length === 1) return tokens[0].isLink;
	if (tokens.length === 3 && tokens[1].isLink) return ["()", "[]"].includes(tokens[0].value + tokens[2].value);
	return false;
}
function autolink(options) {
	return new Plugin({
		key: new PluginKey("autolink"),
		appendTransaction: (transactions, oldState, newState) => {
			const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
			const preventAutolink = transactions.some((transaction) => transaction.getMeta("preventAutolink"));
			if (!docChanges || preventAutolink) return;
			const { tr } = newState;
			getChangedRanges(combineTransactionSteps(oldState.doc, [...transactions])).forEach(({ newRange }) => {
				const nodesInChangedRanges = findChildrenInRange(newState.doc, newRange, (node) => node.isTextblock);
				let textBlock;
				let textBeforeWhitespace;
				if (nodesInChangedRanges.length > 1) {
					textBlock = nodesInChangedRanges[0];
					textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, textBlock.pos + textBlock.node.nodeSize, void 0, " ");
				} else if (nodesInChangedRanges.length) {
					const endText = newState.doc.textBetween(newRange.from, newRange.to, " ", " ");
					if (!UNICODE_WHITESPACE_REGEX_END.test(endText)) return;
					textBlock = nodesInChangedRanges[0];
					textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, void 0, " ");
				}
				if (textBlock && textBeforeWhitespace) {
					const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);
					if (wordsBeforeWhitespace.length <= 0) return false;
					const lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];
					const lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);
					if (!lastWordBeforeSpace) return false;
					const linksBeforeSpace = tokenize(lastWordBeforeSpace).map((t) => t.toObject(options.defaultProtocol));
					if (!isValidLinkStructure(linksBeforeSpace)) return false;
					linksBeforeSpace.filter((link) => link.isLink).map((link) => ({
						...link,
						from: lastWordAndBlockOffset + link.start + 1,
						to: lastWordAndBlockOffset + link.end + 1
					})).filter((link) => {
						if (!newState.schema.marks.code) return true;
						return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
					}).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {
						if (getMarksBetween(link.from, link.to, newState.doc).some((item) => item.mark.type === options.type)) return;
						tr.addMark(link.from, link.to, options.type.create({ href: link.href }));
					});
				}
			});
			if (!tr.steps.length) return;
			return tr;
		}
	});
}
function clickHandler(options) {
	return new Plugin({
		key: new PluginKey("handleClickLink"),
		props: { handleClick: (view, pos, event) => {
			var _a, _b;
			if (event.button !== 0) return false;
			if (!view.editable) return false;
			let link = null;
			if (event.target instanceof HTMLAnchorElement) link = event.target;
			else {
				const target = event.target;
				if (!target) return false;
				const root = options.editor.view.dom;
				link = target.closest("a");
				if (link && !root.contains(link)) link = null;
			}
			if (!link) return false;
			let handled = false;
			if (options.enableClickSelection) handled = options.editor.commands.extendMarkRange(options.type.name);
			if (options.openOnClick) {
				const attrs = getAttributes(view.state, options.type.name);
				const href = (_a = link.href) != null ? _a : attrs.href;
				const target = (_b = link.target) != null ? _b : attrs.target;
				if (href) {
					window.open(href, target);
					handled = true;
				}
			}
			return handled;
		} }
	});
}
function pasteHandler(options) {
	return new Plugin({
		key: new PluginKey("handlePasteLink"),
		props: { handlePaste: (view, _event, slice) => {
			const { shouldAutoLink } = options;
			const { state } = view;
			const { selection } = state;
			const { empty } = selection;
			if (empty) return false;
			let textContent = "";
			slice.content.forEach((node) => {
				textContent += node.textContent;
			});
			const link = find(textContent, { defaultProtocol: options.defaultProtocol }).find((item) => item.isLink && item.value === textContent);
			if (!textContent || !link || shouldAutoLink !== void 0 && !shouldAutoLink(link.value)) return false;
			return options.editor.commands.setMark(options.type, { href: link.href });
		} }
	});
}
function isAllowedUri(uri, protocols) {
	const allowedProtocols = [
		"http",
		"https",
		"ftp",
		"ftps",
		"mailto",
		"tel",
		"callto",
		"sms",
		"cid",
		"xmpp"
	];
	if (protocols) protocols.forEach((protocol) => {
		const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
		if (nextProtocol) allowedProtocols.push(nextProtocol);
	});
	return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, "").match(new RegExp(`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`, "i"));
}
var Link = Mark$1.create({
	name: "link",
	priority: 1e3,
	keepOnSplit: false,
	exitable: true,
	onCreate() {
		if (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((protocol) => {
			if (typeof protocol === "string") {
				registerCustomProtocol(protocol);
				return;
			}
			registerCustomProtocol(protocol.scheme, protocol.optionalSlashes);
		});
	},
	onDestroy() {
		reset();
	},
	inclusive() {
		return this.options.autolink;
	},
	addOptions() {
		return {
			openOnClick: true,
			enableClickSelection: false,
			linkOnPaste: true,
			autolink: true,
			protocols: [],
			defaultProtocol: "http",
			HTMLAttributes: {
				target: "_blank",
				rel: "noopener noreferrer nofollow",
				class: null
			},
			isAllowedUri: (url, ctx) => !!isAllowedUri(url, ctx.protocols),
			validate: (url) => !!url,
			shouldAutoLink: (url) => {
				const hasProtocol = /^[a-z][a-z0-9+.-]*:\/\//i.test(url);
				const hasMaybeProtocol = /^[a-z][a-z0-9+.-]*:/i.test(url);
				if (hasProtocol || hasMaybeProtocol && !url.includes("@")) return true;
				const hostname = (url.includes("@") ? url.split("@").pop() : url).split(/[/?#:]/)[0];
				if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)) return false;
				if (!/\./.test(hostname)) return false;
				return true;
			}
		};
	},
	addAttributes() {
		return {
			href: {
				default: null,
				parseHTML(element) {
					return element.getAttribute("href");
				}
			},
			target: { default: this.options.HTMLAttributes.target },
			rel: { default: this.options.HTMLAttributes.rel },
			class: { default: this.options.HTMLAttributes.class },
			title: { default: null }
		};
	},
	parseHTML() {
		return [{
			tag: "a[href]",
			getAttrs: (dom) => {
				const href = dom.getAttribute("href");
				if (!href || !this.options.isAllowedUri(href, {
					defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
					protocols: this.options.protocols,
					defaultProtocol: this.options.defaultProtocol
				})) return false;
				return null;
			}
		}];
	},
	renderHTML({ HTMLAttributes }) {
		if (!this.options.isAllowedUri(HTMLAttributes.href, {
			defaultValidate: (href) => !!isAllowedUri(href, this.options.protocols),
			protocols: this.options.protocols,
			defaultProtocol: this.options.defaultProtocol
		})) return [
			"a",
			mergeAttributes(this.options.HTMLAttributes, {
				...HTMLAttributes,
				href: ""
			}),
			0
		];
		return [
			"a",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "link",
	parseMarkdown: (token, helpers) => {
		return helpers.applyMark("link", helpers.parseInline(token.tokens || []), {
			href: token.href,
			title: token.title || null
		});
	},
	renderMarkdown: (node, h) => {
		var _a, _b, _c, _d;
		const href = (_b = (_a = node.attrs) == null ? void 0 : _a.href) != null ? _b : "";
		const title = (_d = (_c = node.attrs) == null ? void 0 : _c.title) != null ? _d : "";
		const text = h.renderChildren(node);
		return title ? `[${text}](${href} "${title}")` : `[${text}](${href})`;
	},
	addCommands() {
		return {
			setLink: (attributes) => ({ chain }) => {
				const { href } = attributes;
				if (!this.options.isAllowedUri(href, {
					defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
					protocols: this.options.protocols,
					defaultProtocol: this.options.defaultProtocol
				})) return false;
				return chain().setMark(this.name, attributes).setMeta("preventAutolink", true).run();
			},
			toggleLink: (attributes) => ({ chain }) => {
				const { href } = attributes || {};
				if (href && !this.options.isAllowedUri(href, {
					defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
					protocols: this.options.protocols,
					defaultProtocol: this.options.defaultProtocol
				})) return false;
				return chain().toggleMark(this.name, attributes, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
			},
			unsetLink: () => ({ chain }) => {
				return chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
			}
		};
	},
	addPasteRules() {
		return [markPasteRule({
			find: (text) => {
				const foundLinks = [];
				if (text) {
					const { protocols, defaultProtocol } = this.options;
					const links = find(text).filter((item) => item.isLink && this.options.isAllowedUri(item.value, {
						defaultValidate: (href) => !!isAllowedUri(href, protocols),
						protocols,
						defaultProtocol
					}));
					if (links.length) links.forEach((link) => {
						if (!this.options.shouldAutoLink(link.value)) return;
						foundLinks.push({
							text: link.value,
							data: { href: link.href },
							index: link.start
						});
					});
				}
				return foundLinks;
			},
			type: this.type,
			getAttributes: (match) => {
				var _a;
				return { href: (_a = match.data) == null ? void 0 : _a.href };
			}
		})];
	},
	addProseMirrorPlugins() {
		const plugins = [];
		const { protocols, defaultProtocol } = this.options;
		if (this.options.autolink) plugins.push(autolink({
			type: this.type,
			defaultProtocol: this.options.defaultProtocol,
			validate: (url) => this.options.isAllowedUri(url, {
				defaultValidate: (href) => !!isAllowedUri(href, protocols),
				protocols,
				defaultProtocol
			}),
			shouldAutoLink: this.options.shouldAutoLink
		}));
		plugins.push(clickHandler({
			type: this.type,
			editor: this.editor,
			openOnClick: this.options.openOnClick === "whenNotEditable" ? true : this.options.openOnClick,
			enableClickSelection: this.options.enableClickSelection
		}));
		if (this.options.linkOnPaste) plugins.push(pasteHandler({
			editor: this.editor,
			defaultProtocol: this.options.defaultProtocol,
			type: this.type,
			shouldAutoLink: this.options.shouldAutoLink
		}));
		return plugins;
	}
});
var index_default$6 = Link;
//#endregion
//#region node_modules/@tiptap/extension-list/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
	for (var name in all) __defProp(target, name, {
		get: all[name],
		enumerable: true
	});
};
var ListItemName = "listItem";
var TextStyleName = "textStyle";
var bulletListInputRegex = /^\s*([-+*])\s$/;
var BulletList = Node3.create({
	name: "bulletList",
	addOptions() {
		return {
			itemTypeName: "listItem",
			HTMLAttributes: {},
			keepMarks: false,
			keepAttributes: false
		};
	},
	group: "block list",
	content() {
		return `${this.options.itemTypeName}+`;
	},
	parseHTML() {
		return [{ tag: "ul" }];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"ul",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "list",
	parseMarkdown: (token, helpers) => {
		if (token.type !== "list" || token.ordered) return [];
		return {
			type: "bulletList",
			content: token.items ? helpers.parseChildren(token.items) : []
		};
	},
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		return h.renderChildren(node.content, "\n");
	},
	markdownOptions: { indentsContent: true },
	addCommands() {
		return { toggleBulletList: () => ({ commands, chain }) => {
			if (this.options.keepAttributes) return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
			return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
		} };
	},
	addKeyboardShortcuts() {
		return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
	},
	addInputRules() {
		let inputRule = wrappingInputRule({
			find: bulletListInputRegex,
			type: this.type
		});
		if (this.options.keepMarks || this.options.keepAttributes) inputRule = wrappingInputRule({
			find: bulletListInputRegex,
			type: this.type,
			keepMarks: this.options.keepMarks,
			keepAttributes: this.options.keepAttributes,
			getAttributes: () => {
				return this.editor.getAttributes(TextStyleName);
			},
			editor: this.editor
		});
		return [inputRule];
	}
});
var getBranchingNestedListAtCursor = (state, itemName, wrapperNames) => {
	const { selection } = state;
	if (!selection.empty) return null;
	const { $from } = selection;
	if (!$from.parent.isTextblock) return null;
	if ($from.parentOffset !== $from.parent.content.size) return null;
	let listItemDepth = -1;
	for (let depth = $from.depth; depth > 0; depth -= 1) if ($from.node(depth).type.name === itemName) {
		listItemDepth = depth;
		break;
	}
	if (listItemDepth < 0) return null;
	const listItem = $from.node(listItemDepth);
	const indexInListItem = $from.index(listItemDepth);
	if (indexInListItem + 1 >= listItem.childCount) return null;
	const nextChild = listItem.child(indexInListItem + 1);
	if (!wrapperNames.includes(nextChild.type.name)) return null;
	const itemType = state.schema.nodes[itemName];
	let hasBranching = false;
	nextChild.forEach((child) => {
		if (child.type === itemType && child.childCount > 1) hasBranching = true;
	});
	if (!hasBranching) return null;
	const nodeAfter = state.doc.resolve($from.after()).nodeAfter;
	if (!nodeAfter || !wrapperNames.includes(nodeAfter.type.name)) return null;
	const items = [];
	nodeAfter.forEach((child) => {
		items.push(child);
	});
	if (items.length === 0) return null;
	return {
		listItemDepth,
		nestedList: nodeAfter,
		nestedListPos: $from.after(),
		insertPos: $from.after(listItemDepth),
		items
	};
};
var hoistBranchingNestedList = (state, dispatch, itemName, wrapperNames) => {
	const context = getBranchingNestedListAtCursor(state, itemName, wrapperNames);
	if (!context) return false;
	const { selection } = state;
	const { nestedList, nestedListPos, insertPos, items } = context;
	const tr = state.tr;
	tr.delete(nestedListPos, nestedListPos + nestedList.nodeSize);
	const mappedInsertPos = tr.mapping.map(insertPos);
	tr.insert(mappedInsertPos, Fragment$1.from(items));
	tr.setSelection(selection.map(tr.doc, tr.mapping));
	if (dispatch) dispatch(tr);
	return true;
};
var handleDeleteBranchingNestedList = (editor, itemName, wrapperNames) => {
	return hoistBranchingNestedList(editor.state, editor.view.dispatch, itemName, wrapperNames);
};
var createBranchingListDeleteKeymap = (itemName, wrapperNames) => {
	return Extension.create({
		name: `${itemName}BranchingDeleteKeymap`,
		priority: 101,
		addKeyboardShortcuts() {
			const handleDelete2 = () => handleDeleteBranchingNestedList(this.editor, itemName, wrapperNames);
			return {
				Delete: handleDelete2,
				"Mod-Delete": handleDelete2
			};
		}
	});
};
function isSameLineOrderedListToken(token) {
	var _a, _b;
	const nestedToken = (_a = token.tokens) == null ? void 0 : _a[0];
	return Boolean(token.text && ((_b = token.tokens) == null ? void 0 : _b.length) === 1 && (nestedToken == null ? void 0 : nestedToken.type) === "list" && nestedToken.ordered && nestedToken.raw === token.text);
}
function parseSameLineOrderedListText(text, helpers) {
	if (helpers.tokenizeInline) return helpers.parseInline(helpers.tokenizeInline(text));
	return helpers.parseInline([{
		type: "text",
		raw: text,
		text
	}]);
}
var ListItem = Node3.create({
	name: "listItem",
	addOptions() {
		return {
			HTMLAttributes: {},
			bulletListTypeName: "bulletList",
			orderedListTypeName: "orderedList"
		};
	},
	content: "paragraph block*",
	defining: true,
	parseHTML() {
		return [{ tag: "li" }];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"li",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "list_item",
	parseMarkdown: (token, helpers) => {
		var _a;
		if (token.type !== "list_item") return [];
		const parseBlockChildren = (_a = helpers.parseBlockChildren) != null ? _a : helpers.parseChildren;
		let content = [];
		if (token.tokens && token.tokens.length > 0) {
			if (isSameLineOrderedListToken(token)) return {
				type: "listItem",
				content: [{
					type: "paragraph",
					content: parseSameLineOrderedListText(token.text || "", helpers)
				}]
			};
			if (token.tokens.some((t) => t.type === "paragraph")) content = parseBlockChildren(token.tokens);
			else {
				const firstToken = token.tokens[0];
				if (firstToken && firstToken.type === "text" && firstToken.tokens && firstToken.tokens.length > 0) {
					content = [{
						type: "paragraph",
						content: helpers.parseInline(firstToken.tokens)
					}];
					if (token.tokens.length > 1) {
						const additionalContent = parseBlockChildren(token.tokens.slice(1));
						content.push(...additionalContent);
					}
				} else content = parseBlockChildren(token.tokens);
			}
		}
		if (content.length === 0) content = [{
			type: "paragraph",
			content: []
		}];
		return {
			type: "listItem",
			content
		};
	},
	renderMarkdown: (node, h, ctx) => {
		return renderNestedMarkdownContent(node, h, (context) => {
			var _a, _b;
			if (context.parentType === "bulletList") return "- ";
			if (context.parentType === "orderedList") return `${(((_b = (_a = context.meta) == null ? void 0 : _a.parentAttrs) == null ? void 0 : _b.start) || 1) + context.index}. `;
			return "- ";
		}, ctx);
	},
	addExtensions() {
		return [createBranchingListDeleteKeymap(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
	},
	addKeyboardShortcuts() {
		return {
			Enter: () => this.editor.commands.splitListItem(this.name),
			Tab: () => this.editor.commands.sinkListItem(this.name),
			"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
		};
	}
});
__export({}, {
	findListItemPos: () => findListItemPos,
	getNextListDepth: () => getNextListDepth,
	handleBackspace: () => handleBackspace,
	handleDelete: () => handleDelete,
	hasListBefore: () => hasListBefore,
	hasListItemAfter: () => hasListItemAfter,
	hasListItemBefore: () => hasListItemBefore,
	listItemHasSubList: () => listItemHasSubList,
	nextListIsDeeper: () => nextListIsDeeper,
	nextListIsHigher: () => nextListIsHigher
});
var findListItemPos = (typeOrName, state) => {
	const { $from } = state.selection;
	const nodeType = getNodeType(typeOrName, state.schema);
	let currentNode = null;
	let currentDepth = $from.depth;
	let currentPos = $from.pos;
	let targetDepth = null;
	while (currentDepth > 0 && targetDepth === null) {
		currentNode = $from.node(currentDepth);
		if (currentNode.type === nodeType) targetDepth = currentDepth;
		else {
			currentDepth -= 1;
			currentPos -= 1;
		}
	}
	if (targetDepth === null) return null;
	return {
		$pos: state.doc.resolve(currentPos),
		depth: targetDepth
	};
};
var getNextListDepth = (typeOrName, state) => {
	const listItemPos = findListItemPos(typeOrName, state);
	if (!listItemPos) return false;
	const [, depth] = getNodeAtPosition(state, typeOrName, listItemPos.$pos.pos + 4);
	return depth;
};
var hasListBefore = (editorState, name, parentListTypes) => {
	const { $anchor } = editorState.selection;
	const previousNodePos = Math.max(0, $anchor.pos - 2);
	const previousNode = editorState.doc.resolve(previousNodePos).node();
	if (!previousNode || !parentListTypes.includes(previousNode.type.name)) return false;
	return true;
};
var handleBackspace = (editor, name, parentListTypes) => {
	if (editor.commands.undoInputRule()) return true;
	if (editor.state.selection.from !== editor.state.selection.to) return false;
	if (!isNodeActive(editor.state, name) && hasListBefore(editor.state, name, parentListTypes)) {
		const { $anchor } = editor.state.selection;
		const $listPos = editor.state.doc.resolve($anchor.before() - 1);
		const listDescendants = [];
		$listPos.node().descendants((node, pos) => {
			if (node.type.name === name) listDescendants.push({
				node,
				pos
			});
		});
		const lastItem = listDescendants.at(-1);
		if (!lastItem) return false;
		const $lastItemPos = editor.state.doc.resolve($listPos.start() + lastItem.pos + 1);
		return editor.chain().cut({
			from: $anchor.start() - 1,
			to: $anchor.end() + 1
		}, $lastItemPos.end()).joinForward().run();
	}
	if (!isNodeActive(editor.state, name)) return false;
	if (!isAtStartOfNode(editor.state)) return false;
	return editor.chain().liftListItem(name).run();
};
var nextListIsDeeper = (typeOrName, state) => {
	const listDepth = getNextListDepth(typeOrName, state);
	const listItemPos = findListItemPos(typeOrName, state);
	if (!listItemPos || !listDepth) return false;
	if (listDepth > listItemPos.depth) return true;
	return false;
};
var nextListIsHigher = (typeOrName, state) => {
	const listDepth = getNextListDepth(typeOrName, state);
	const listItemPos = findListItemPos(typeOrName, state);
	if (!listItemPos || !listDepth) return false;
	if (listDepth < listItemPos.depth) return true;
	return false;
};
var handleDelete = (editor, name) => {
	if (!isNodeActive(editor.state, name)) return false;
	if (!isAtEndOfNode(editor.state, name)) return false;
	const { selection } = editor.state;
	const { $from, $to } = selection;
	if (!selection.empty && $from.sameParent($to)) return false;
	if (nextListIsDeeper(name, editor.state)) return editor.chain().focus(editor.state.selection.from + 4).lift(name).joinBackward().run();
	if (nextListIsHigher(name, editor.state)) return editor.chain().joinForward().joinBackward().run();
	return editor.commands.joinItemForward();
};
var hasListItemAfter = (typeOrName, state) => {
	var _a;
	const { $anchor } = state.selection;
	const $targetPos = state.doc.resolve($anchor.pos - $anchor.parentOffset - 2);
	if ($targetPos.index() === $targetPos.parent.childCount - 1) return false;
	if (((_a = $targetPos.nodeAfter) == null ? void 0 : _a.type.name) !== typeOrName) return false;
	return true;
};
var hasListItemBefore = (typeOrName, state) => {
	var _a;
	const { $anchor } = state.selection;
	const $targetPos = state.doc.resolve($anchor.pos - 2);
	if ($targetPos.index() === 0) return false;
	if (((_a = $targetPos.nodeBefore) == null ? void 0 : _a.type.name) !== typeOrName) return false;
	return true;
};
var listItemHasSubList = (typeOrName, state, node) => {
	if (!node) return false;
	const nodeType = getNodeType(typeOrName, state.schema);
	let hasSubList = false;
	node.descendants((child) => {
		if (child.type === nodeType) hasSubList = true;
	});
	return hasSubList;
};
var ListKeymap = Extension.create({
	name: "listKeymap",
	addOptions() {
		return { listTypes: [{
			itemName: "listItem",
			wrapperNames: ["bulletList", "orderedList"]
		}, {
			itemName: "taskItem",
			wrapperNames: ["taskList"]
		}] };
	},
	addKeyboardShortcuts() {
		return {
			Delete: ({ editor }) => {
				let handled = false;
				this.options.listTypes.forEach(({ itemName }) => {
					if (editor.state.schema.nodes[itemName] === void 0) return;
					if (handleDelete(editor, itemName)) handled = true;
				});
				return handled;
			},
			"Mod-Delete": ({ editor }) => {
				let handled = false;
				this.options.listTypes.forEach(({ itemName }) => {
					if (editor.state.schema.nodes[itemName] === void 0) return;
					if (handleDelete(editor, itemName)) handled = true;
				});
				return handled;
			},
			Backspace: ({ editor }) => {
				let handled = false;
				this.options.listTypes.forEach(({ itemName, wrapperNames }) => {
					if (editor.state.schema.nodes[itemName] === void 0) return;
					if (handleBackspace(editor, itemName, wrapperNames)) handled = true;
				});
				return handled;
			},
			"Mod-Backspace": ({ editor }) => {
				let handled = false;
				this.options.listTypes.forEach(({ itemName, wrapperNames }) => {
					if (editor.state.schema.nodes[itemName] === void 0) return;
					if (handleBackspace(editor, itemName, wrapperNames)) handled = true;
				});
				return handled;
			}
		};
	}
});
var ORDERED_LIST_ITEM_REGEX = /^(\s*)(\d+)\.\s+(.*)$/;
var INDENTED_LINE_REGEX = /^\s/;
function isBlockContentLine(line) {
	const trimmedLine = line.trimStart();
	return /^[-+*]\s+/.test(trimmedLine) || /^\d+\.\s+/.test(trimmedLine) || /^>\s?/.test(trimmedLine) || /^```/.test(trimmedLine) || /^~~~/.test(trimmedLine);
}
function splitItemContent(contentLines) {
	const paragraphLines = [];
	const blockLines = [];
	let reachedBlockBoundary = false;
	contentLines.forEach((line) => {
		if (reachedBlockBoundary) {
			blockLines.push(line);
			return;
		}
		if (line.trim() === "") {
			reachedBlockBoundary = true;
			blockLines.push(line);
			return;
		}
		if (paragraphLines.length > 0 && isBlockContentLine(line)) {
			reachedBlockBoundary = true;
			blockLines.push(line);
			return;
		}
		paragraphLines.push(line);
	});
	return {
		paragraphLines,
		blockLines
	};
}
function collectOrderedListItems(lines) {
	const listItems = [];
	let currentLineIndex = 0;
	let consumed = 0;
	while (currentLineIndex < lines.length) {
		const line = lines[currentLineIndex];
		const match = line.match(ORDERED_LIST_ITEM_REGEX);
		if (!match) break;
		const [, indent, number, content] = match;
		const indentLevel = indent.length;
		const itemContentLines = [content];
		let nextLineIndex = currentLineIndex + 1;
		const itemLines = [line];
		let sawBlankLine = false;
		while (nextLineIndex < lines.length) {
			const nextLine = lines[nextLineIndex];
			if (nextLine.match(ORDERED_LIST_ITEM_REGEX)) break;
			if (nextLine.trim() === "") {
				itemLines.push(nextLine);
				itemContentLines.push("");
				sawBlankLine = true;
				nextLineIndex += 1;
			} else if (nextLine.match(INDENTED_LINE_REGEX)) {
				itemLines.push(nextLine);
				itemContentLines.push(nextLine.slice(indentLevel + 2));
				nextLineIndex += 1;
			} else {
				if (sawBlankLine) break;
				itemLines.push(nextLine);
				itemContentLines.push(nextLine);
				nextLineIndex += 1;
			}
		}
		listItems.push({
			indent: indentLevel,
			number: parseInt(number, 10),
			content: itemContentLines.join("\n").trim(),
			contentLines: itemContentLines,
			raw: itemLines.join("\n")
		});
		consumed = nextLineIndex;
		currentLineIndex = nextLineIndex;
	}
	return [listItems, consumed];
}
function buildNestedStructure(items, baseIndent, lexer) {
	const result = [];
	let currentIndex = 0;
	while (currentIndex < items.length) {
		const item = items[currentIndex];
		if (item.indent === baseIndent) {
			const { paragraphLines, blockLines } = splitItemContent(item.contentLines);
			const mainText = paragraphLines.join("\n").trim();
			const tokens = [];
			if (mainText) tokens.push({
				type: "paragraph",
				raw: mainText,
				tokens: lexer.inlineTokens(mainText)
			});
			const additionalContent = blockLines.join("\n").trim();
			if (additionalContent) {
				const blockTokens = lexer.blockTokens(additionalContent);
				tokens.push(...blockTokens);
			}
			let lookAheadIndex = currentIndex + 1;
			const nestedItems = [];
			while (lookAheadIndex < items.length && items[lookAheadIndex].indent > baseIndent) {
				nestedItems.push(items[lookAheadIndex]);
				lookAheadIndex += 1;
			}
			if (nestedItems.length > 0) {
				const nestedListItems = buildNestedStructure(nestedItems, Math.min(...nestedItems.map((nestedItem) => nestedItem.indent)), lexer);
				tokens.push({
					type: "list",
					ordered: true,
					start: nestedItems[0].number,
					items: nestedListItems,
					raw: nestedItems.map((nestedItem) => nestedItem.raw).join("\n")
				});
			}
			result.push({
				type: "list_item",
				raw: item.raw,
				tokens
			});
			currentIndex = lookAheadIndex;
		} else currentIndex += 1;
	}
	return result;
}
function parseListItems(items, helpers) {
	return items.map((item) => {
		if (item.type !== "list_item") return helpers.parseChildren([item])[0];
		const content = [];
		if (item.tokens && item.tokens.length > 0) item.tokens.forEach((itemToken) => {
			if (itemToken.type === "paragraph" || itemToken.type === "list" || itemToken.type === "blockquote" || itemToken.type === "code") content.push(...helpers.parseChildren([itemToken]));
			else if (itemToken.type === "text" && itemToken.tokens) {
				const inlineContent = helpers.parseChildren([itemToken]);
				content.push({
					type: "paragraph",
					content: inlineContent
				});
			} else {
				const parsed = helpers.parseChildren([itemToken]);
				if (parsed.length > 0) content.push(...parsed);
			}
		});
		return {
			type: "listItem",
			content
		};
	});
}
var ListItemName2 = "listItem";
var TextStyleName2 = "textStyle";
var orderedListInputRegex = /^(\d+)\.\s$/;
var OrderedList = Node3.create({
	name: "orderedList",
	addOptions() {
		return {
			itemTypeName: "listItem",
			HTMLAttributes: {},
			keepMarks: false,
			keepAttributes: false
		};
	},
	group: "block list",
	content() {
		return `${this.options.itemTypeName}+`;
	},
	addAttributes() {
		return {
			start: {
				default: 1,
				parseHTML: (element) => {
					return element.hasAttribute("start") ? parseInt(element.getAttribute("start") || "", 10) : 1;
				}
			},
			type: {
				default: null,
				parseHTML: (element) => element.getAttribute("type")
			}
		};
	},
	parseHTML() {
		return [{ tag: "ol" }];
	},
	renderHTML({ HTMLAttributes }) {
		const { start, ...attributesWithoutStart } = HTMLAttributes;
		return start === 1 ? [
			"ol",
			mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart),
			0
		] : [
			"ol",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "list",
	parseMarkdown: (token, helpers) => {
		if (token.type !== "list" || !token.ordered) return [];
		const startValue = token.start || 1;
		const content = token.items ? parseListItems(token.items, helpers) : [];
		if (startValue !== 1) return {
			type: "orderedList",
			attrs: { start: startValue },
			content
		};
		return {
			type: "orderedList",
			content
		};
	},
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		return h.renderChildren(node.content, "\n");
	},
	markdownTokenizer: {
		name: "orderedList",
		level: "block",
		start: (src) => {
			const match = src.match(/^(\s*)(\d+)\.\s+/);
			const index = match == null ? void 0 : match.index;
			return index !== void 0 ? index : -1;
		},
		tokenize: (src, _tokens, lexer) => {
			var _a;
			const lines = src.split("\n");
			const [listItems, consumed] = collectOrderedListItems(lines);
			if (listItems.length === 0) return;
			const items = buildNestedStructure(listItems, 0, lexer);
			if (items.length === 0) return;
			return {
				type: "list",
				ordered: true,
				start: ((_a = listItems[0]) == null ? void 0 : _a.number) || 1,
				items,
				raw: lines.slice(0, consumed).join("\n")
			};
		}
	},
	markdownOptions: { indentsContent: true },
	addCommands() {
		return { toggleOrderedList: () => ({ commands, chain }) => {
			if (this.options.keepAttributes) return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName2, this.editor.getAttributes(TextStyleName2)).run();
			return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
		} };
	},
	addKeyboardShortcuts() {
		return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
	},
	addInputRules() {
		let inputRule = wrappingInputRule({
			find: orderedListInputRegex,
			type: this.type,
			getAttributes: (match) => ({ start: +match[1] }),
			joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1]
		});
		if (this.options.keepMarks || this.options.keepAttributes) inputRule = wrappingInputRule({
			find: orderedListInputRegex,
			type: this.type,
			keepMarks: this.options.keepMarks,
			keepAttributes: this.options.keepAttributes,
			getAttributes: (match) => ({
				start: +match[1],
				...this.editor.getAttributes(TextStyleName2)
			}),
			joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
			editor: this.editor
		});
		return [inputRule];
	}
});
var inputRegex$2 = /^\s*(\[([( |x])?\])\s$/;
var TaskItem = Node3.create({
	name: "taskItem",
	addOptions() {
		return {
			nested: false,
			HTMLAttributes: {},
			taskListTypeName: "taskList",
			a11y: void 0
		};
	},
	content() {
		return this.options.nested ? "paragraph block*" : "paragraph+";
	},
	defining: true,
	addAttributes() {
		return { checked: {
			default: false,
			keepOnSplit: false,
			parseHTML: (element) => {
				const dataChecked = element.getAttribute("data-checked");
				return dataChecked === "" || dataChecked === "true";
			},
			renderHTML: (attributes) => ({ "data-checked": attributes.checked })
		} };
	},
	parseHTML() {
		return [{
			tag: `li[data-type="${this.name}"]`,
			priority: 51
		}];
	},
	renderHTML({ node, HTMLAttributes }) {
		return [
			"li",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }),
			[
				"label",
				["input", {
					type: "checkbox",
					checked: node.attrs.checked ? "checked" : null
				}],
				["span"]
			],
			["div", 0]
		];
	},
	parseMarkdown: (token, h) => {
		const content = [];
		if (token.tokens && token.tokens.length > 0) content.push(h.createNode("paragraph", {}, h.parseInline(token.tokens)));
		else if (token.text) content.push(h.createNode("paragraph", {}, [h.createNode("text", { text: token.text })]));
		else content.push(h.createNode("paragraph", {}, []));
		if (token.nestedTokens && token.nestedTokens.length > 0) {
			const nestedContent = h.parseChildren(token.nestedTokens);
			content.push(...nestedContent);
		}
		return h.createNode("taskItem", { checked: token.checked || false }, content);
	},
	renderMarkdown: (node, h) => {
		var _a;
		return renderNestedMarkdownContent(node, h, `- [${((_a = node.attrs) == null ? void 0 : _a.checked) ? "x" : " "}] `);
	},
	addExtensions() {
		if (!this.options.nested) return [];
		return [createBranchingListDeleteKeymap(this.name, [this.options.taskListTypeName])];
	},
	addKeyboardShortcuts() {
		const shortcuts = {
			Enter: () => this.editor.commands.splitListItem(this.name),
			"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
		};
		if (!this.options.nested) return shortcuts;
		return {
			...shortcuts,
			Tab: () => this.editor.commands.sinkListItem(this.name)
		};
	},
	addNodeView() {
		return ({ node, HTMLAttributes, getPos, editor }) => {
			const listItem = document.createElement("li");
			const checkboxWrapper = document.createElement("label");
			const checkboxStyler = document.createElement("span");
			const checkbox = document.createElement("input");
			const content = document.createElement("div");
			const updateA11Y = (currentNode) => {
				var _a, _b;
				checkbox.ariaLabel = ((_b = (_a = this.options.a11y) == null ? void 0 : _a.checkboxLabel) == null ? void 0 : _b.call(_a, currentNode, checkbox.checked)) || `Task item checkbox for ${currentNode.textContent || "empty task item"}`;
			};
			updateA11Y(node);
			checkboxWrapper.contentEditable = "false";
			checkbox.type = "checkbox";
			checkbox.addEventListener("mousedown", (event) => event.preventDefault());
			checkbox.addEventListener("change", (event) => {
				if (!editor.isEditable && !this.options.onReadOnlyChecked) {
					checkbox.checked = !checkbox.checked;
					return;
				}
				const { checked } = event.target;
				if (editor.isEditable && typeof getPos === "function") editor.chain().focus(void 0, { scrollIntoView: false }).command(({ tr }) => {
					const position = getPos();
					if (typeof position !== "number") return false;
					const currentNode = tr.doc.nodeAt(position);
					tr.setNodeMarkup(position, void 0, {
						...currentNode == null ? void 0 : currentNode.attrs,
						checked
					});
					return true;
				}).run();
				if (!editor.isEditable && this.options.onReadOnlyChecked) {
					if (!this.options.onReadOnlyChecked(node, checked)) checkbox.checked = !checkbox.checked;
				}
			});
			Object.entries(this.options.HTMLAttributes).forEach(([key, value]) => {
				listItem.setAttribute(key, value);
			});
			listItem.dataset.checked = node.attrs.checked;
			checkbox.checked = node.attrs.checked;
			checkboxWrapper.append(checkbox, checkboxStyler);
			listItem.append(checkboxWrapper, content);
			Object.entries(HTMLAttributes).forEach(([key, value]) => {
				listItem.setAttribute(key, value);
			});
			let prevRenderedAttributeKeys = new Set(Object.keys(HTMLAttributes));
			return {
				dom: listItem,
				contentDOM: content,
				update: (updatedNode) => {
					if (updatedNode.type !== this.type) return false;
					listItem.dataset.checked = updatedNode.attrs.checked;
					checkbox.checked = updatedNode.attrs.checked;
					updateA11Y(updatedNode);
					const extensionAttributes = editor.extensionManager.attributes;
					const newHTMLAttributes = getRenderedAttributes(updatedNode, extensionAttributes);
					const newKeys = new Set(Object.keys(newHTMLAttributes));
					const staticAttrs = this.options.HTMLAttributes;
					prevRenderedAttributeKeys.forEach((key) => {
						if (!newKeys.has(key)) if (key in staticAttrs) listItem.setAttribute(key, staticAttrs[key]);
						else listItem.removeAttribute(key);
					});
					Object.entries(newHTMLAttributes).forEach(([key, value]) => {
						if (value === null || value === void 0) if (key in staticAttrs) listItem.setAttribute(key, staticAttrs[key]);
						else listItem.removeAttribute(key);
						else listItem.setAttribute(key, value);
					});
					prevRenderedAttributeKeys = newKeys;
					return true;
				}
			};
		};
	},
	addInputRules() {
		return [wrappingInputRule({
			find: inputRegex$2,
			type: this.type,
			getAttributes: (match) => ({ checked: match[match.length - 1] === "x" })
		})];
	}
});
var TaskList = Node3.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 }) {
		return [
			"ul",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }),
			0
		];
	},
	parseMarkdown: (token, h) => {
		return h.createNode("taskList", {}, h.parseChildren(token.items || []));
	},
	renderMarkdown: (node, h) => {
		if (!node.content) return "";
		return h.renderChildren(node.content, "\n");
	},
	markdownTokenizer: {
		name: "taskList",
		level: "block",
		start(src) {
			var _a;
			const index = (_a = src.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : _a.index;
			return index !== void 0 ? index : -1;
		},
		tokenize(src, tokens, lexer) {
			const parseTaskListContent = (content) => {
				const nestedResult = parseIndentedBlocks(content, {
					itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
					extractItemData: (match) => ({
						indentLevel: match[1].length,
						mainContent: match[4],
						checked: match[3].toLowerCase() === "x"
					}),
					createToken: (data, nestedTokens) => ({
						type: "taskItem",
						raw: "",
						mainContent: data.mainContent,
						indentLevel: data.indentLevel,
						checked: data.checked,
						text: data.mainContent,
						tokens: lexer.inlineTokens(data.mainContent),
						nestedTokens
					}),
					customNestedParser: parseTaskListContent
				}, lexer);
				if (nestedResult) return [{
					type: "taskList",
					raw: nestedResult.raw,
					items: nestedResult.items
				}];
				return lexer.blockTokens(content);
			};
			const result = parseIndentedBlocks(src, {
				itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
				extractItemData: (match) => ({
					indentLevel: match[1].length,
					mainContent: match[4],
					checked: match[3].toLowerCase() === "x"
				}),
				createToken: (data, nestedTokens) => ({
					type: "taskItem",
					raw: "",
					mainContent: data.mainContent,
					indentLevel: data.indentLevel,
					checked: data.checked,
					text: data.mainContent,
					tokens: lexer.inlineTokens(data.mainContent),
					nestedTokens
				}),
				customNestedParser: parseTaskListContent
			}, lexer);
			if (!result) return;
			return {
				type: "taskList",
				raw: result.raw,
				items: result.items
			};
		}
	},
	markdownOptions: { indentsContent: true },
	addCommands() {
		return { toggleTaskList: () => ({ commands }) => {
			return commands.toggleList(this.name, this.options.itemTypeName);
		} };
	},
	addKeyboardShortcuts() {
		return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
	}
});
Extension.create({
	name: "listKit",
	addExtensions() {
		const extensions = [];
		if (this.options.bulletList !== false) extensions.push(BulletList.configure(this.options.bulletList));
		if (this.options.listItem !== false) extensions.push(ListItem.configure(this.options.listItem));
		if (this.options.listKeymap !== false) extensions.push(ListKeymap.configure(this.options.listKeymap));
		if (this.options.orderedList !== false) extensions.push(OrderedList.configure(this.options.orderedList));
		if (this.options.taskItem !== false) extensions.push(TaskItem.configure(this.options.taskItem));
		if (this.options.taskList !== false) extensions.push(TaskList.configure(this.options.taskList));
		return extensions;
	}
});
//#endregion
//#region node_modules/@tiptap/extension-paragraph/dist/index.js
var EMPTY_PARAGRAPH_MARKDOWN = "&nbsp;";
var NBSP_CHAR = "\xA0";
var Paragraph = Node3.create({
	name: "paragraph",
	priority: 1e3,
	addOptions() {
		return { HTMLAttributes: {} };
	},
	group: "block",
	content: "inline*",
	parseHTML() {
		return [{ tag: "p" }];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"p",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	parseMarkdown: (token, helpers) => {
		const tokens = token.tokens || [];
		if (tokens.length === 1 && tokens[0].type === "image") return helpers.parseChildren([tokens[0]]);
		const content = helpers.parseInline(tokens);
		if (tokens.length === 1 && tokens[0].type === "text" && (tokens[0].raw === EMPTY_PARAGRAPH_MARKDOWN || tokens[0].text === EMPTY_PARAGRAPH_MARKDOWN || tokens[0].raw === NBSP_CHAR || tokens[0].text === NBSP_CHAR) && content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) return helpers.createNode("paragraph", void 0, []);
		return helpers.createNode("paragraph", void 0, content);
	},
	renderMarkdown: (node, h, ctx) => {
		var _a, _b;
		if (!node) return "";
		const content = Array.isArray(node.content) ? node.content : [];
		if (content.length === 0) {
			const previousContent = Array.isArray((_a = ctx == null ? void 0 : ctx.previousNode) == null ? void 0 : _a.content) ? ctx.previousNode.content : [];
			return ((_b = ctx == null ? void 0 : ctx.previousNode) == null ? void 0 : _b.type) === "paragraph" && previousContent.length === 0 ? EMPTY_PARAGRAPH_MARKDOWN : "";
		}
		return h.renderChildren(content);
	},
	addCommands() {
		return { setParagraph: () => ({ commands }) => {
			return commands.setNode(this.name);
		} };
	},
	addKeyboardShortcuts() {
		return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
	}
});
//#endregion
//#region node_modules/@tiptap/extension-strike/dist/index.js
var inputRegex$1 = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
var Strike = Mark$1.create({
	name: "strike",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	parseHTML() {
		return [
			{ tag: "s" },
			{ tag: "del" },
			{ tag: "strike" },
			{
				style: "text-decoration",
				consuming: false,
				getAttrs: (style) => style.includes("line-through") ? {} : false
			}
		];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"s",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	markdownTokenName: "del",
	parseMarkdown: (token, helpers) => {
		return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
	},
	renderMarkdown: (node, h) => {
		return `~~${h.renderChildren(node)}~~`;
	},
	addCommands() {
		return {
			setStrike: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleStrike: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetStrike: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
	},
	addInputRules() {
		return [markInputRule({
			find: inputRegex$1,
			type: this.type
		})];
	},
	addPasteRules() {
		return [markPasteRule({
			find: pasteRegex,
			type: this.type
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-text/dist/index.js
var Text = Node3.create({
	name: "text",
	group: "inline",
	parseMarkdown: (token) => {
		return {
			type: "text",
			text: token.text || ""
		};
	},
	renderMarkdown: (node) => node.text || ""
});
//#endregion
//#region node_modules/@tiptap/extension-underline/dist/index.js
var Underline = Mark$1.create({
	name: "underline",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	parseHTML() {
		return [{ tag: "u" }, {
			style: "text-decoration",
			consuming: false,
			getAttrs: (style) => style.includes("underline") ? {} : false
		}];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"u",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	parseMarkdown(token, helpers) {
		return helpers.applyMark(this.name || "underline", helpers.parseInline(token.tokens || []));
	},
	renderMarkdown(node, helpers) {
		return `++${helpers.renderChildren(node)}++`;
	},
	markdownTokenizer: {
		name: "underline",
		level: "inline",
		start(src) {
			return src.indexOf("++");
		},
		tokenize(src, _tokens, lexer) {
			const match = /^(\+\+)([\s\S]+?)(\+\+)/.exec(src);
			if (!match) return;
			const innerContent = match[2].trim();
			return {
				type: "underline",
				raw: match[0],
				text: innerContent,
				tokens: lexer.inlineTokens(innerContent)
			};
		}
	},
	addCommands() {
		return {
			setUnderline: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleUnderline: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetUnderline: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-u": () => this.editor.commands.toggleUnderline(),
			"Mod-U": () => this.editor.commands.toggleUnderline()
		};
	}
});
var index_default$5 = Underline;
//#endregion
//#region node_modules/prosemirror-dropcursor/dist/index.js
/**
Create a plugin that, when added to a ProseMirror instance,
causes a decoration to show up at the drop position when something
is dragged over the editor.

Nodes may add a `disableDropCursor` property to their spec to
control the showing of a drop cursor inside them. This may be a
boolean or a function, which will be called with a view and a
position, and should return a boolean.
*/
function dropCursor(options = {}) {
	return new Plugin({ view(editorView) {
		return new DropCursorView(editorView, options);
	} });
}
var DropCursorView = class {
	constructor(editorView, options) {
		var _a;
		this.editorView = editorView;
		this.cursorPos = null;
		this.element = null;
		this.timeout = -1;
		this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
		this.color = options.color === false ? void 0 : options.color || "black";
		this.class = options.class;
		this.handlers = [
			"dragover",
			"dragend",
			"drop",
			"dragleave"
		].map((name) => {
			let handler = (e) => {
				this[name](e);
			};
			editorView.dom.addEventListener(name, handler);
			return {
				name,
				handler
			};
		});
	}
	destroy() {
		this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));
	}
	update(editorView, prevState) {
		if (this.cursorPos != null && prevState.doc != editorView.state.doc) if (this.cursorPos > editorView.state.doc.content.size) this.setCursor(null);
		else this.updateOverlay();
	}
	setCursor(pos) {
		if (pos == this.cursorPos) return;
		this.cursorPos = pos;
		if (pos == null) {
			this.element.parentNode.removeChild(this.element);
			this.element = null;
		} else this.updateOverlay();
	}
	updateOverlay() {
		let $pos = this.editorView.state.doc.resolve(this.cursorPos);
		let isBlock = !$pos.parent.inlineContent, rect;
		let editorDOM = this.editorView.dom, editorRect = editorDOM.getBoundingClientRect();
		let scaleX = editorRect.width / editorDOM.offsetWidth, scaleY = editorRect.height / editorDOM.offsetHeight;
		if (isBlock) {
			let before = $pos.nodeBefore, after = $pos.nodeAfter;
			if (before || after) {
				let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));
				if (node) {
					let nodeRect = node.getBoundingClientRect();
					let top = before ? nodeRect.bottom : nodeRect.top;
					if (before && after) top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;
					let halfWidth = this.width / 2 * scaleY;
					rect = {
						left: nodeRect.left,
						right: nodeRect.right,
						top: top - halfWidth,
						bottom: top + halfWidth
					};
				}
			}
		}
		if (!rect) {
			let coords = this.editorView.coordsAtPos(this.cursorPos);
			let halfWidth = this.width / 2 * scaleX;
			rect = {
				left: coords.left - halfWidth,
				right: coords.left + halfWidth,
				top: coords.top,
				bottom: coords.bottom
			};
		}
		let parent = this.editorView.dom.offsetParent;
		if (!this.element) {
			this.element = parent.appendChild(document.createElement("div"));
			if (this.class) this.element.className = this.class;
			this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;";
			if (this.color) this.element.style.backgroundColor = this.color;
		}
		this.element.classList.toggle("prosemirror-dropcursor-block", isBlock);
		this.element.classList.toggle("prosemirror-dropcursor-inline", !isBlock);
		let parentLeft, parentTop;
		if (!parent || parent == document.body && getComputedStyle(parent).position == "static") {
			parentLeft = -pageXOffset;
			parentTop = -pageYOffset;
		} else {
			let rect = parent.getBoundingClientRect();
			let parentScaleX = rect.width / parent.offsetWidth, parentScaleY = rect.height / parent.offsetHeight;
			parentLeft = rect.left - parent.scrollLeft * parentScaleX;
			parentTop = rect.top - parent.scrollTop * parentScaleY;
		}
		this.element.style.left = (rect.left - parentLeft) / scaleX + "px";
		this.element.style.top = (rect.top - parentTop) / scaleY + "px";
		this.element.style.width = (rect.right - rect.left) / scaleX + "px";
		this.element.style.height = (rect.bottom - rect.top) / scaleY + "px";
	}
	scheduleRemoval(timeout) {
		clearTimeout(this.timeout);
		this.timeout = setTimeout(() => this.setCursor(null), timeout);
	}
	dragover(event) {
		if (!this.editorView.editable) return;
		let pos = this.editorView.posAtCoords({
			left: event.clientX,
			top: event.clientY
		});
		let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
		let disableDropCursor = node && node.type.spec.disableDropCursor;
		let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
		if (pos && !disabled) {
			let target = pos.pos;
			if (this.editorView.dragging && this.editorView.dragging.slice) {
				let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
				if (point != null) target = point;
			}
			this.setCursor(target);
			this.scheduleRemoval(5e3);
		}
	}
	dragend() {
		this.scheduleRemoval(20);
	}
	drop() {
		this.scheduleRemoval(20);
	}
	dragleave(event) {
		if (!this.editorView.dom.contains(event.relatedTarget)) this.setCursor(null);
	}
};
//#endregion
//#region node_modules/prosemirror-gapcursor/dist/index.js
/**
Gap cursor selections are represented using this class. Its
`$anchor` and `$head` properties both point at the cursor position.
*/
var GapCursor = class GapCursor extends Selection$2 {
	/**
	Create a gap cursor.
	*/
	constructor($pos) {
		super($pos, $pos);
	}
	map(doc, mapping) {
		let $pos = doc.resolve(mapping.map(this.head));
		return GapCursor.valid($pos) ? new GapCursor($pos) : Selection$2.near($pos);
	}
	content() {
		return Slice$1.empty;
	}
	eq(other) {
		return other instanceof GapCursor && other.head == this.head;
	}
	toJSON() {
		return {
			type: "gapcursor",
			pos: this.head
		};
	}
	/**
	@internal
	*/
	static fromJSON(doc, json) {
		if (typeof json.pos != "number") throw new RangeError("Invalid input for GapCursor.fromJSON");
		return new GapCursor(doc.resolve(json.pos));
	}
	/**
	@internal
	*/
	getBookmark() {
		return new GapBookmark(this.anchor);
	}
	/**
	@internal
	*/
	static valid($pos) {
		let parent = $pos.parent;
		if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos)) return false;
		let override = parent.type.spec.allowGapCursor;
		if (override != null) return override;
		let deflt = parent.contentMatchAt($pos.index()).defaultType;
		return deflt && deflt.isTextblock;
	}
	/**
	@internal
	*/
	static findGapCursorFrom($pos, dir, mustMove = false) {
		search: for (;;) {
			if (!mustMove && GapCursor.valid($pos)) return $pos;
			let pos = $pos.pos, next = null;
			for (let d = $pos.depth;; d--) {
				let parent = $pos.node(d);
				if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
					next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
					break;
				} else if (d == 0) return null;
				pos += dir;
				let $cur = $pos.doc.resolve(pos);
				if (GapCursor.valid($cur)) return $cur;
			}
			for (;;) {
				let inside = dir > 0 ? next.firstChild : next.lastChild;
				if (!inside) {
					if (next.isAtom && !next.isText && !NodeSelection$1.isSelectable(next)) {
						$pos = $pos.doc.resolve(pos + next.nodeSize * dir);
						mustMove = false;
						continue search;
					}
					break;
				}
				next = inside;
				pos += dir;
				let $cur = $pos.doc.resolve(pos);
				if (GapCursor.valid($cur)) return $cur;
			}
			return null;
		}
	}
};
GapCursor.prototype.visible = false;
GapCursor.findFrom = GapCursor.findGapCursorFrom;
Selection$2.jsonID("gapcursor", GapCursor);
var GapBookmark = class GapBookmark {
	constructor(pos) {
		this.pos = pos;
	}
	map(mapping) {
		return new GapBookmark(mapping.map(this.pos));
	}
	resolve(doc) {
		let $pos = doc.resolve(this.pos);
		return GapCursor.valid($pos) ? new GapCursor($pos) : Selection$2.near($pos);
	}
};
function needsGap(type) {
	return type.isAtom || type.spec.isolating || type.spec.createGapCursor;
}
function closedBefore($pos) {
	for (let d = $pos.depth; d >= 0; d--) {
		let index = $pos.index(d), parent = $pos.node(d);
		if (index == 0) {
			if (parent.type.spec.isolating) return true;
			continue;
		}
		for (let before = parent.child(index - 1);; before = before.lastChild) {
			if (before.childCount == 0 && !before.inlineContent || needsGap(before.type)) return true;
			if (before.inlineContent) return false;
		}
	}
	return true;
}
function closedAfter($pos) {
	for (let d = $pos.depth; d >= 0; d--) {
		let index = $pos.indexAfter(d), parent = $pos.node(d);
		if (index == parent.childCount) {
			if (parent.type.spec.isolating) return true;
			continue;
		}
		for (let after = parent.child(index);; after = after.firstChild) {
			if (after.childCount == 0 && !after.inlineContent || needsGap(after.type)) return true;
			if (after.inlineContent) return false;
		}
	}
	return true;
}
/**
Create a gap cursor plugin. When enabled, this will capture clicks
near and arrow-key-motion past places that don't have a normally
selectable position nearby, and create a gap cursor selection for
them. The cursor is drawn as an element with class
`ProseMirror-gapcursor`. You can either include
`style/gapcursor.css` from the package's directory or add your own
styles to make it visible.
*/
function gapCursor() {
	return new Plugin({ props: {
		decorations: drawGapCursor,
		createSelectionBetween(_view, $anchor, $head) {
			return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
		},
		handleClick,
		handleKeyDown,
		handleDOMEvents: { beforeinput }
	} });
}
var handleKeyDown = keydownHandler({
	"ArrowLeft": arrow("horiz", -1),
	"ArrowRight": arrow("horiz", 1),
	"ArrowUp": arrow("vert", -1),
	"ArrowDown": arrow("vert", 1)
});
function arrow(axis, dir) {
	const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
	return function(state, dispatch, view) {
		let sel = state.selection;
		let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;
		if (sel instanceof TextSelection$1) {
			if (!view.endOfTextblock(dirStr) || $start.depth == 0) return false;
			mustMove = false;
			$start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());
		}
		let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
		if (!$found) return false;
		if (dispatch) dispatch(state.tr.setSelection(new GapCursor($found)));
		return true;
	};
}
function handleClick(view, pos, event) {
	if (!view || !view.editable) return false;
	let $pos = view.state.doc.resolve(pos);
	if (!GapCursor.valid($pos)) return false;
	let clickPos = view.posAtCoords({
		left: event.clientX,
		top: event.clientY
	});
	if (clickPos && clickPos.inside > -1 && NodeSelection$1.isSelectable(view.state.doc.nodeAt(clickPos.inside))) return false;
	view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
	return true;
}
function beforeinput(view, event) {
	if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor)) return false;
	let { $from } = view.state.selection;
	let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
	if (!insert) return false;
	let frag = Fragment$1.empty;
	for (let i = insert.length - 1; i >= 0; i--) frag = Fragment$1.from(insert[i].createAndFill(null, frag));
	let tr = view.state.tr.replace($from.pos, $from.pos, new Slice$1(frag, 0, 0));
	tr.setSelection(TextSelection$1.near(tr.doc.resolve($from.pos + 1)));
	view.dispatch(tr);
	return false;
}
function drawGapCursor(state) {
	if (!(state.selection instanceof GapCursor)) return null;
	let node = document.createElement("div");
	node.className = "ProseMirror-gapcursor";
	return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: "gapcursor" })]);
}
//#endregion
//#region node_modules/rope-sequence/dist/index.js
var GOOD_LEAF_SIZE = 200;
var RopeSequence = function RopeSequence() {};
RopeSequence.prototype.append = function append(other) {
	if (!other.length) return this;
	other = RopeSequence.from(other);
	return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
};
RopeSequence.prototype.prepend = function prepend(other) {
	if (!other.length) return this;
	return RopeSequence.from(other).append(this);
};
RopeSequence.prototype.appendInner = function appendInner(other) {
	return new Append(this, other);
};
RopeSequence.prototype.slice = function slice(from, to) {
	if (from === void 0) from = 0;
	if (to === void 0) to = this.length;
	if (from >= to) return RopeSequence.empty;
	return this.sliceInner(Math.max(0, from), Math.min(this.length, to));
};
RopeSequence.prototype.get = function get(i) {
	if (i < 0 || i >= this.length) return;
	return this.getInner(i);
};
RopeSequence.prototype.forEach = function forEach(f, from, to) {
	if (from === void 0) from = 0;
	if (to === void 0) to = this.length;
	if (from <= to) this.forEachInner(f, from, to, 0);
	else this.forEachInvertedInner(f, from, to, 0);
};
RopeSequence.prototype.map = function map(f, from, to) {
	if (from === void 0) from = 0;
	if (to === void 0) to = this.length;
	var result = [];
	this.forEach(function(elt, i) {
		return result.push(f(elt, i));
	}, from, to);
	return result;
};
RopeSequence.from = function from(values) {
	if (values instanceof RopeSequence) return values;
	return values && values.length ? new Leaf(values) : RopeSequence.empty;
};
var Leaf = /* @__PURE__ */ function(RopeSequence) {
	function Leaf(values) {
		RopeSequence.call(this);
		this.values = values;
	}
	if (RopeSequence) Leaf.__proto__ = RopeSequence;
	Leaf.prototype = Object.create(RopeSequence && RopeSequence.prototype);
	Leaf.prototype.constructor = Leaf;
	var prototypeAccessors = {
		length: { configurable: true },
		depth: { configurable: true }
	};
	Leaf.prototype.flatten = function flatten() {
		return this.values;
	};
	Leaf.prototype.sliceInner = function sliceInner(from, to) {
		if (from == 0 && to == this.length) return this;
		return new Leaf(this.values.slice(from, to));
	};
	Leaf.prototype.getInner = function getInner(i) {
		return this.values[i];
	};
	Leaf.prototype.forEachInner = function forEachInner(f, from, to, start) {
		for (var i = from; i < to; i++) if (f(this.values[i], start + i) === false) return false;
	};
	Leaf.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
		for (var i = from - 1; i >= to; i--) if (f(this.values[i], start + i) === false) return false;
	};
	Leaf.prototype.leafAppend = function leafAppend(other) {
		if (this.length + other.length <= GOOD_LEAF_SIZE) return new Leaf(this.values.concat(other.flatten()));
	};
	Leaf.prototype.leafPrepend = function leafPrepend(other) {
		if (this.length + other.length <= GOOD_LEAF_SIZE) return new Leaf(other.flatten().concat(this.values));
	};
	prototypeAccessors.length.get = function() {
		return this.values.length;
	};
	prototypeAccessors.depth.get = function() {
		return 0;
	};
	Object.defineProperties(Leaf.prototype, prototypeAccessors);
	return Leaf;
}(RopeSequence);
RopeSequence.empty = new Leaf([]);
var Append = /* @__PURE__ */ function(RopeSequence) {
	function Append(left, right) {
		RopeSequence.call(this);
		this.left = left;
		this.right = right;
		this.length = left.length + right.length;
		this.depth = Math.max(left.depth, right.depth) + 1;
	}
	if (RopeSequence) Append.__proto__ = RopeSequence;
	Append.prototype = Object.create(RopeSequence && RopeSequence.prototype);
	Append.prototype.constructor = Append;
	Append.prototype.flatten = function flatten() {
		return this.left.flatten().concat(this.right.flatten());
	};
	Append.prototype.getInner = function getInner(i) {
		return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
	};
	Append.prototype.forEachInner = function forEachInner(f, from, to, start) {
		var leftLen = this.left.length;
		if (from < leftLen && this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false) return false;
		if (to > leftLen && this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) return false;
	};
	Append.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
		var leftLen = this.left.length;
		if (from > leftLen && this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) return false;
		if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false) return false;
	};
	Append.prototype.sliceInner = function sliceInner(from, to) {
		if (from == 0 && to == this.length) return this;
		var leftLen = this.left.length;
		if (to <= leftLen) return this.left.slice(from, to);
		if (from >= leftLen) return this.right.slice(from - leftLen, to - leftLen);
		return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen));
	};
	Append.prototype.leafAppend = function leafAppend(other) {
		var inner = this.right.leafAppend(other);
		if (inner) return new Append(this.left, inner);
	};
	Append.prototype.leafPrepend = function leafPrepend(other) {
		var inner = this.left.leafPrepend(other);
		if (inner) return new Append(inner, this.right);
	};
	Append.prototype.appendInner = function appendInner(other) {
		if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1) return new Append(this.left, new Append(this.right, other));
		return new Append(this, other);
	};
	return Append;
}(RopeSequence);
//#endregion
//#region node_modules/prosemirror-history/dist/index.js
var max_empty_items = 500;
var Branch = class Branch {
	constructor(items, eventCount) {
		this.items = items;
		this.eventCount = eventCount;
	}
	popEvent(state, preserveItems) {
		if (this.eventCount == 0) return null;
		let end = this.items.length;
		for (;; end--) if (this.items.get(end - 1).selection) {
			--end;
			break;
		}
		let remap, mapFrom;
		if (preserveItems) {
			remap = this.remapping(end, this.items.length);
			mapFrom = remap.maps.length;
		}
		let transform = state.tr;
		let selection, remaining;
		let addAfter = [], addBefore = [];
		this.items.forEach((item, i) => {
			if (!item.step) {
				if (!remap) {
					remap = this.remapping(end, i + 1);
					mapFrom = remap.maps.length;
				}
				mapFrom--;
				addBefore.push(item);
				return;
			}
			if (remap) {
				addBefore.push(new Item(item.map));
				let step = item.step.map(remap.slice(mapFrom)), map;
				if (step && transform.maybeStep(step).doc) {
					map = transform.mapping.maps[transform.mapping.maps.length - 1];
					addAfter.push(new Item(map, void 0, void 0, addAfter.length + addBefore.length));
				}
				mapFrom--;
				if (map) remap.appendMap(map, mapFrom);
			} else transform.maybeStep(item.step);
			if (item.selection) {
				selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
				remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
				return false;
			}
		}, this.items.length, 0);
		return {
			remaining,
			transform,
			selection
		};
	}
	addTransform(transform, selection, histOptions, preserveItems) {
		let newItems = [], eventCount = this.eventCount;
		let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
		for (let i = 0; i < transform.steps.length; i++) {
			let step = transform.steps[i].invert(transform.docs[i]);
			let item = new Item(transform.mapping.maps[i], step, selection), merged;
			if (merged = lastItem && lastItem.merge(item)) {
				item = merged;
				if (i) newItems.pop();
				else oldItems = oldItems.slice(0, oldItems.length - 1);
			}
			newItems.push(item);
			if (selection) {
				eventCount++;
				selection = void 0;
			}
			if (!preserveItems) lastItem = item;
		}
		let overflow = eventCount - histOptions.depth;
		if (overflow > DEPTH_OVERFLOW) {
			oldItems = cutOffEvents(oldItems, overflow);
			eventCount -= overflow;
		}
		return new Branch(oldItems.append(newItems), eventCount);
	}
	remapping(from, to) {
		let maps = new Mapping();
		this.items.forEach((item, i) => {
			let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from ? maps.maps.length - item.mirrorOffset : void 0;
			maps.appendMap(item.map, mirrorPos);
		}, from, to);
		return maps;
	}
	addMaps(array) {
		if (this.eventCount == 0) return this;
		return new Branch(this.items.append(array.map((map) => new Item(map))), this.eventCount);
	}
	rebased(rebasedTransform, rebasedCount) {
		if (!this.eventCount) return this;
		let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);
		let mapping = rebasedTransform.mapping;
		let newUntil = rebasedTransform.steps.length;
		let eventCount = this.eventCount;
		this.items.forEach((item) => {
			if (item.selection) eventCount--;
		}, start);
		let iRebased = rebasedCount;
		this.items.forEach((item) => {
			let pos = mapping.getMirror(--iRebased);
			if (pos == null) return;
			newUntil = Math.min(newUntil, pos);
			let map = mapping.maps[pos];
			if (item.step) {
				let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);
				let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
				if (selection) eventCount++;
				rebasedItems.push(new Item(map, step, selection));
			} else rebasedItems.push(new Item(map));
		}, start);
		let newMaps = [];
		for (let i = rebasedCount; i < newUntil; i++) newMaps.push(new Item(mapping.maps[i]));
		let branch = new Branch(this.items.slice(0, start).append(newMaps).append(rebasedItems), eventCount);
		if (branch.emptyItemCount() > max_empty_items) branch = branch.compress(this.items.length - rebasedItems.length);
		return branch;
	}
	emptyItemCount() {
		let count = 0;
		this.items.forEach((item) => {
			if (!item.step) count++;
		});
		return count;
	}
	compress(upto = this.items.length) {
		let remap = this.remapping(0, upto), mapFrom = remap.maps.length;
		let items = [], events = 0;
		this.items.forEach((item, i) => {
			if (i >= upto) {
				items.push(item);
				if (item.selection) events++;
			} else if (item.step) {
				let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();
				mapFrom--;
				if (map) remap.appendMap(map, mapFrom);
				if (step) {
					let selection = item.selection && item.selection.map(remap.slice(mapFrom));
					if (selection) events++;
					let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;
					if (merged = items.length && items[last].merge(newItem)) items[last] = merged;
					else items.push(newItem);
				}
			} else if (item.map) mapFrom--;
		}, this.items.length, 0);
		return new Branch(RopeSequence.from(items.reverse()), events);
	}
};
Branch.empty = new Branch(RopeSequence.empty, 0);
function cutOffEvents(items, n) {
	let cutPoint;
	items.forEach((item, i) => {
		if (item.selection && n-- == 0) {
			cutPoint = i;
			return false;
		}
	});
	return items.slice(cutPoint);
}
var Item = class Item {
	constructor(map, step, selection, mirrorOffset) {
		this.map = map;
		this.step = step;
		this.selection = selection;
		this.mirrorOffset = mirrorOffset;
	}
	merge(other) {
		if (this.step && other.step && !other.selection) {
			let step = other.step.merge(this.step);
			if (step) return new Item(step.getMap().invert(), step, this.selection);
		}
	}
};
var HistoryState = class {
	constructor(done, undone, prevRanges, prevTime, prevComposition) {
		this.done = done;
		this.undone = undone;
		this.prevRanges = prevRanges;
		this.prevTime = prevTime;
		this.prevComposition = prevComposition;
	}
};
var DEPTH_OVERFLOW = 20;
function applyTransaction(history, state, tr, options) {
	let historyTr = tr.getMeta(historyKey), rebased;
	if (historyTr) return historyTr.historyState;
	if (tr.getMeta(closeHistoryKey)) history = new HistoryState(history.done, history.undone, null, 0, -1);
	let appended = tr.getMeta("appendedTransaction");
	if (tr.steps.length == 0) return history;
	else if (appended && appended.getMeta(historyKey)) if (appended.getMeta(historyKey).redo) return new HistoryState(history.done.addTransform(tr, void 0, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);
	else return new HistoryState(history.done, history.undone.addTransform(tr, void 0, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);
	else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
		let composition = tr.getMeta("composition");
		let newGroup = history.prevTime == 0 || !appended && history.prevComposition != composition && (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges));
		let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);
		return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : void 0, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);
	} else if (rebased = tr.getMeta("rebased")) return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);
	else return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);
}
function isAdjacentTo(transform, prevRanges) {
	if (!prevRanges) return false;
	if (!transform.docChanged) return true;
	let adjacent = false;
	transform.mapping.maps[0].forEach((start, end) => {
		for (let i = 0; i < prevRanges.length; i += 2) if (start <= prevRanges[i + 1] && end >= prevRanges[i]) adjacent = true;
	});
	return adjacent;
}
function rangesFor(maps) {
	let result = [];
	for (let i = maps.length - 1; i >= 0 && result.length == 0; i--) maps[i].forEach((_from, _to, from, to) => result.push(from, to));
	return result;
}
function mapRanges(ranges, mapping) {
	if (!ranges) return null;
	let result = [];
	for (let i = 0; i < ranges.length; i += 2) {
		let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);
		if (from <= to) result.push(from, to);
	}
	return result;
}
function histTransaction(history, state, redo) {
	let preserveItems = mustPreserveItems(state);
	let histOptions = historyKey.get(state).spec.config;
	let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);
	if (!pop) return null;
	let selection = pop.selection.resolve(pop.transform.doc);
	let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);
	let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);
	return pop.transform.setSelection(selection).setMeta(historyKey, {
		redo,
		historyState: newHist
	});
}
var cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
function mustPreserveItems(state) {
	let plugins = state.plugins;
	if (cachedPreserveItemsPlugins != plugins) {
		cachedPreserveItems = false;
		cachedPreserveItemsPlugins = plugins;
		for (let i = 0; i < plugins.length; i++) if (plugins[i].spec.historyPreserveItems) {
			cachedPreserveItems = true;
			break;
		}
	}
	return cachedPreserveItems;
}
var historyKey = new PluginKey("history");
var closeHistoryKey = new PluginKey("closeHistory");
/**
Returns a plugin that enables the undo history for an editor. The
plugin will track undo and redo stacks, which can be used with the
[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.

You can set an `"addToHistory"` [metadata
property](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction
to prevent it from being rolled back by undo.
*/
function history(config = {}) {
	config = {
		depth: config.depth || 100,
		newGroupDelay: config.newGroupDelay || 500
	};
	return new Plugin({
		key: historyKey,
		state: {
			init() {
				return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
			},
			apply(tr, hist, state) {
				return applyTransaction(hist, state, tr, config);
			}
		},
		config,
		props: { handleDOMEvents: { beforeinput(view, e) {
			let inputType = e.inputType;
			let command = inputType == "historyUndo" ? undo : inputType == "historyRedo" ? redo : null;
			if (!command || !view.editable) return false;
			e.preventDefault();
			return command(view.state, view.dispatch);
		} } }
	});
}
function buildCommand(redo, scroll) {
	return (state, dispatch) => {
		let hist = historyKey.getState(state);
		if (!hist || (redo ? hist.undone : hist.done).eventCount == 0) return false;
		if (dispatch) {
			let tr = histTransaction(hist, state, redo);
			if (tr) dispatch(scroll ? tr.scrollIntoView() : tr);
		}
		return true;
	};
}
/**
A command function that undoes the last change, if any.
*/
var undo = buildCommand(false, true);
/**
A command function that redoes the last undone change, if any.
*/
var redo = buildCommand(true, true);
Extension.create({
	name: "characterCount",
	addOptions() {
		return {
			limit: null,
			autoTrim: true,
			mode: "textSize",
			textCounter: (text) => text.length,
			wordCounter: (text) => text.split(" ").filter((word) => word !== "").length
		};
	},
	addStorage() {
		return {
			characters: () => 0,
			words: () => 0
		};
	},
	onBeforeCreate() {
		this.storage.characters = (options) => {
			const node = (options == null ? void 0 : options.node) || this.editor.state.doc;
			if (((options == null ? void 0 : options.mode) || this.options.mode) === "textSize") {
				const text = node.textBetween(0, node.content.size, void 0, " ");
				return this.options.textCounter(text);
			}
			return node.nodeSize;
		};
		this.storage.words = (options) => {
			const node = (options == null ? void 0 : options.node) || this.editor.state.doc;
			const text = node.textBetween(0, node.content.size, " ", " ");
			return this.options.wordCounter(text);
		};
	},
	addProseMirrorPlugins() {
		let initialEvaluationDone = false;
		return [new Plugin({
			key: new PluginKey("characterCount"),
			appendTransaction: (transactions, oldState, newState) => {
				if (initialEvaluationDone) return;
				const limit = this.options.limit;
				const autoTrim = this.options.autoTrim;
				if (limit === null || limit === void 0 || limit === 0 || autoTrim === false) {
					initialEvaluationDone = true;
					return;
				}
				const initialContentSize = this.storage.characters({ node: newState.doc });
				if (initialContentSize > limit) {
					const over = initialContentSize - limit;
					const from = 0;
					const to = over;
					console.warn(`[CharacterCount] Initial content exceeded limit of ${limit} characters. Content was automatically trimmed.`);
					const tr = newState.tr.deleteRange(from, to);
					initialEvaluationDone = true;
					return tr;
				}
				initialEvaluationDone = true;
			},
			filterTransaction: (transaction, state) => {
				const limit = this.options.limit;
				if (!transaction.docChanged || limit === 0 || limit === null || limit === void 0) return true;
				const oldSize = this.storage.characters({ node: state.doc });
				const newSize = this.storage.characters({ node: transaction.doc });
				if (newSize <= limit) return true;
				if (oldSize > limit && newSize > limit && newSize <= oldSize) return true;
				if (oldSize > limit && newSize > limit && newSize > oldSize) return false;
				if (!transaction.getMeta("paste")) return false;
				const pos = transaction.selection.$head.pos;
				const from = pos - (newSize - limit);
				const to = pos;
				transaction.deleteRange(from, to);
				if (this.storage.characters({ node: transaction.doc }) > limit) return false;
				return true;
			}
		})];
	}
});
var Dropcursor = Extension.create({
	name: "dropCursor",
	addOptions() {
		return {
			color: "currentColor",
			width: 1,
			class: void 0
		};
	},
	addProseMirrorPlugins() {
		return [dropCursor(this.options)];
	}
});
Extension.create({
	name: "focus",
	addOptions() {
		return {
			className: "has-focus",
			mode: "all"
		};
	},
	addProseMirrorPlugins() {
		return [new Plugin({
			key: new PluginKey("focus"),
			props: { decorations: ({ doc, selection }) => {
				const { isEditable, isFocused } = this.editor;
				const { anchor } = selection;
				const decorations = [];
				if (!isEditable || !isFocused) return DecorationSet.create(doc, []);
				let maxLevels = 0;
				if (this.options.mode === "deepest") doc.descendants((node, pos) => {
					if (node.isText) return;
					if (!(anchor >= pos && anchor <= pos + node.nodeSize - 1)) return false;
					maxLevels += 1;
				});
				let currentLevel = 0;
				doc.descendants((node, pos) => {
					if (node.isText) return false;
					if (!(anchor >= pos && anchor <= pos + node.nodeSize - 1)) return false;
					currentLevel += 1;
					if (this.options.mode === "deepest" && maxLevels - currentLevel > 0 || this.options.mode === "shallowest" && currentLevel > 1) return this.options.mode === "deepest";
					decorations.push(Decoration.node(pos, pos + node.nodeSize, { class: this.options.className }));
				});
				return DecorationSet.create(doc, decorations);
			} }
		})];
	}
});
var Gapcursor = Extension.create({
	name: "gapCursor",
	addProseMirrorPlugins() {
		return [gapCursor()];
	},
	extendNodeSchema(extension) {
		var _a;
		return { allowGapCursor: (_a = callOrReturn(getExtensionField(extension, "allowGapCursor", {
			name: extension.name,
			options: extension.options,
			storage: extension.storage
		}))) != null ? _a : null };
	}
});
var DEFAULT_DATA_ATTRIBUTE = "placeholder";
var PLUGIN_KEY = new PluginKey("tiptap__placeholder");
var VIEWPORT_OVERSCAN_PX = 200;
function createPlaceholderDecoration(options) {
	const { editor, placeholder, dataAttribute, pos, node, isEmptyDoc, hasAnchor, classes: { emptyNode, emptyEditor } } = options;
	const classes = [emptyNode];
	if (isEmptyDoc) classes.push(emptyEditor);
	return Decoration.node(pos, pos + node.nodeSize, {
		class: classes.join(" "),
		[dataAttribute]: typeof placeholder === "function" ? placeholder({
			editor,
			node,
			pos,
			hasAnchor
		}) : placeholder
	});
}
function resolveEmptyNodeClass(emptyNodeClass, props) {
	return typeof emptyNodeClass === "function" ? emptyNodeClass(props) : emptyNodeClass;
}
function buildPlaceholderDecorations({ editor, options, dataAttribute, doc, selection }) {
	var _a, _b;
	if (!(editor.isEditable || !options.showOnlyWhenEditable)) return null;
	const { anchor } = selection;
	const decorations = [];
	const isEmptyDoc = editor.isEmpty;
	if (options.showOnlyCurrent && !options.includeChildren) {
		const resolved = doc.resolve(anchor);
		const node = resolved.depth > 0 ? resolved.node(1) : resolved.nodeAfter;
		const nodeStart = resolved.depth > 0 ? resolved.before(1) : anchor;
		if (node && node.type.isTextblock && isNodeEmpty(node)) {
			const hasAnchor = anchor >= nodeStart && anchor <= nodeStart + node.nodeSize;
			decorations.push(createPlaceholderDecoration({
				editor,
				isEmptyDoc,
				dataAttribute,
				hasAnchor,
				placeholder: options.placeholder,
				classes: {
					emptyEditor: options.emptyEditorClass,
					emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
						editor,
						node,
						pos: nodeStart,
						hasAnchor
					})
				},
				node,
				pos: nodeStart
			}));
		}
	} else {
		const pluginState = PLUGIN_KEY.getState(editor.state);
		const from = (_a = pluginState == null ? void 0 : pluginState.topPos) != null ? _a : 0;
		const to = (_b = pluginState == null ? void 0 : pluginState.bottomPos) != null ? _b : doc.content.size;
		doc.nodesBetween(from, to, (node, pos) => {
			const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
			const isEmpty = !node.isLeaf && isNodeEmpty(node);
			if (!node.type.isTextblock) return options.includeChildren;
			if ((hasAnchor || !options.showOnlyCurrent) && isEmpty) decorations.push(createPlaceholderDecoration({
				editor,
				isEmptyDoc,
				dataAttribute,
				hasAnchor,
				placeholder: options.placeholder,
				classes: {
					emptyEditor: options.emptyEditorClass,
					emptyNode: resolveEmptyNodeClass(options.emptyNodeClass, {
						editor,
						node,
						pos,
						hasAnchor
					})
				},
				node,
				pos
			}));
			return options.includeChildren;
		});
	}
	return DecorationSet.create(doc, decorations);
}
function preparePlaceholderAttribute(attr) {
	return attr.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
}
function isScrollable(el) {
	const style = getComputedStyle(el);
	const overflow = `${style.overflow} ${style.overflowY} ${style.overflowX}`;
	return /auto|scroll|overlay/.test(overflow);
}
function findScrollParent(element) {
	let el = element;
	while (el) {
		if (isScrollable(el)) return el;
		const parent = el.parentElement;
		if (!parent) {
			const root = el.getRootNode();
			if (root instanceof ShadowRoot) {
				el = root.host;
				continue;
			}
			return window;
		}
		el = parent;
	}
	return window;
}
function getContainerRect(container) {
	if (container === window) return {
		top: 0,
		bottom: window.innerHeight
	};
	return container.getBoundingClientRect();
}
function getViewportBoundaryPositions({ doc, view, scrollContainer }) {
	const editorRect = view.dom.getBoundingClientRect();
	const containerRect = scrollContainer ? getContainerRect(scrollContainer) : {
		top: 0,
		bottom: window.innerHeight
	};
	const visibleTop = Math.max(editorRect.top, containerRect.top) - VIEWPORT_OVERSCAN_PX;
	const visibleBottom = Math.min(editorRect.bottom, containerRect.bottom) + VIEWPORT_OVERSCAN_PX;
	if (visibleTop >= visibleBottom) return {
		top: 0,
		bottom: doc.content.size
	};
	const x = getComputedStyle(view.dom).direction === "rtl" ? Math.max(editorRect.right - 2, editorRect.left + 2) : editorRect.left + 2;
	const topPos = view.posAtCoords({
		left: x,
		top: visibleTop + 2
	});
	const bottomPos = view.posAtCoords({
		left: x,
		top: visibleBottom - 2
	});
	return {
		top: topPos ? topPos.pos : 0,
		bottom: bottomPos ? bottomPos.pos : doc.content.size
	};
}
var viewportPluginState = {
	/**
	* Initialises the viewport state with no known positions.
	* @returns The initial viewport state.
	*/
	init() {
		return {
			topPos: null,
			bottomPos: null
		};
	},
	/**
	* Updates the viewport state from incoming transactions.
	* @param tr - The transaction being applied.
	* @param prev - The previous viewport state.
	* @returns The next viewport state.
	*/
	apply(tr, prev) {
		const meta = tr.getMeta(PLUGIN_KEY);
		if (meta == null ? void 0 : meta.positions) return {
			topPos: meta.positions.top,
			bottomPos: meta.positions.bottom
		};
		if (!tr.docChanged) return prev;
		return {
			topPos: prev.topPos !== null ? tr.mapping.map(prev.topPos) : null,
			bottomPos: prev.bottomPos !== null ? tr.mapping.map(prev.bottomPos) : null
		};
	}
};
function createViewportPluginView(view) {
	const scrollContainer = findScrollParent(view.dom);
	const computeAndDispatch = () => {
		const positions = getViewportBoundaryPositions({
			view,
			doc: view.state.doc,
			scrollContainer
		});
		const prev = PLUGIN_KEY.getState(view.state);
		if ((prev == null ? void 0 : prev.topPos) === positions.top && (prev == null ? void 0 : prev.bottomPos) === positions.bottom) return;
		const tr = view.state.tr.setMeta(PLUGIN_KEY, { positions });
		view.dispatch(tr);
	};
	let frame = null;
	let lastCompute = 0;
	const MIN_SCROLL_INTERVAL = 150;
	const scheduleFrame = () => {
		if (frame !== null) return;
		frame = requestAnimationFrame(() => {
			frame = null;
			const now = performance.now();
			if (now - lastCompute >= MIN_SCROLL_INTERVAL) {
				lastCompute = now;
				computeAndDispatch();
			} else scheduleFrame();
		});
	};
	scrollContainer.addEventListener("scroll", scheduleFrame, { passive: true });
	computeAndDispatch();
	return {
		update(_view, prevState) {
			if (view.state.doc.content.size !== prevState.doc.content.size) scheduleFrame();
		},
		destroy: () => {
			if (frame !== null) cancelAnimationFrame(frame);
			scrollContainer.removeEventListener("scroll", scheduleFrame);
		}
	};
}
function createPlaceholderPlugin({ editor, options }) {
	const dataAttribute = options.dataAttribute ? `data-${preparePlaceholderAttribute(options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;
	return new Plugin({
		key: PLUGIN_KEY,
		state: viewportPluginState,
		view: createViewportPluginView,
		props: { decorations: ({ doc, selection }) => buildPlaceholderDecorations({
			editor,
			options,
			dataAttribute,
			doc,
			selection
		}) }
	});
}
var Placeholder = Extension.create({
	name: "placeholder",
	addOptions() {
		return {
			emptyEditorClass: "is-editor-empty",
			emptyNodeClass: "is-empty",
			dataAttribute: DEFAULT_DATA_ATTRIBUTE,
			placeholder: "Write something …",
			showOnlyWhenEditable: true,
			showOnlyCurrent: true,
			includeChildren: false
		};
	},
	addProseMirrorPlugins() {
		return [createPlaceholderPlugin({
			editor: this.editor,
			options: this.options
		})];
	}
});
var selectionStyle = `.ProseMirror:not(.ProseMirror-focused) *::selection {
  background: transparent;
}

.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
  background: transparent;
}`;
Extension.create({
	name: "selection",
	addOptions() {
		return { className: "selection" };
	},
	addProseMirrorPlugins() {
		const { editor, options } = this;
		if (editor.options.injectCSS && typeof document !== "undefined") createStyleTag(selectionStyle, editor.options.injectNonce, "selection");
		return [new Plugin({
			key: new PluginKey("selection"),
			props: { decorations(state) {
				if (state.selection.empty || editor.isFocused || !editor.isEditable || isNodeSelection(state.selection) || editor.view.dragging) return null;
				return DecorationSet.create(state.doc, [Decoration.inline(state.selection.from, state.selection.to, { class: options.className })]);
			} }
		})];
	}
});
function nodeEqualsType({ types, node }) {
	return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;
}
var TrailingNode = Extension.create({
	name: "trailingNode",
	addOptions() {
		return {
			node: void 0,
			notAfter: []
		};
	},
	addProseMirrorPlugins() {
		var _a;
		const plugin = new PluginKey(this.name);
		const defaultNode = this.options.node || ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) || "paragraph";
		const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => (this.options.notAfter || []).concat(defaultNode).includes(node.name));
		return [new Plugin({
			key: plugin,
			appendTransaction: (transactions, __, state) => {
				const { doc, tr, schema } = state;
				const shouldInsertNodeAtEnd = plugin.getState(state);
				const endPosition = doc.content.size;
				const type = schema.nodes[defaultNode];
				if (transactions.some((transaction) => transaction.getMeta("skipTrailingNode"))) return;
				if (!shouldInsertNodeAtEnd) return;
				return tr.insert(endPosition, type.create());
			},
			state: {
				init: (_, state) => {
					const lastNode = state.tr.doc.lastChild;
					return !nodeEqualsType({
						node: lastNode,
						types: disabledNodes
					});
				},
				apply: (tr, value) => {
					if (!tr.docChanged) return value;
					if (tr.getMeta("__uniqueIDTransaction")) return value;
					const lastNode = tr.doc.lastChild;
					return !nodeEqualsType({
						node: lastNode,
						types: disabledNodes
					});
				}
			}
		})];
	}
});
var UndoRedo = Extension.create({
	name: "undoRedo",
	addOptions() {
		return {
			depth: 100,
			newGroupDelay: 500
		};
	},
	addCommands() {
		return {
			undo: () => ({ state, dispatch }) => {
				return undo(state, dispatch);
			},
			redo: () => ({ state, dispatch }) => {
				return redo(state, dispatch);
			}
		};
	},
	addProseMirrorPlugins() {
		return [history(this.options)];
	},
	addKeyboardShortcuts() {
		return {
			"Mod-z": () => this.editor.commands.undo(),
			"Shift-Mod-z": () => this.editor.commands.redo(),
			"Mod-y": () => this.editor.commands.redo(),
			"Mod-я": () => this.editor.commands.undo(),
			"Shift-Mod-я": () => this.editor.commands.redo()
		};
	}
});
var index_default$4 = Extension.create({
	name: "starterKit",
	addExtensions() {
		var _a, _b, _c, _d;
		const extensions = [];
		if (this.options.bold !== false) extensions.push(Bold.configure(this.options.bold));
		if (this.options.blockquote !== false) extensions.push(Blockquote.configure(this.options.blockquote));
		if (this.options.bulletList !== false) extensions.push(BulletList.configure(this.options.bulletList));
		if (this.options.code !== false) extensions.push(Code.configure(this.options.code));
		if (this.options.codeBlock !== false) extensions.push(CodeBlock.configure(this.options.codeBlock));
		if (this.options.document !== false) extensions.push(Document.configure(this.options.document));
		if (this.options.dropcursor !== false) extensions.push(Dropcursor.configure(this.options.dropcursor));
		if (this.options.gapcursor !== false) extensions.push(Gapcursor.configure(this.options.gapcursor));
		if (this.options.hardBreak !== false) extensions.push(HardBreak.configure(this.options.hardBreak));
		if (this.options.heading !== false) extensions.push(Heading.configure(this.options.heading));
		if (this.options.undoRedo !== false) extensions.push(UndoRedo.configure(this.options.undoRedo));
		if (this.options.horizontalRule !== false) extensions.push(HorizontalRule.configure(this.options.horizontalRule));
		if (this.options.italic !== false) extensions.push(Italic.configure(this.options.italic));
		if (this.options.listItem !== false) extensions.push(ListItem.configure(this.options.listItem));
		if (this.options.listKeymap !== false) extensions.push(ListKeymap.configure((_a = this.options) == null ? void 0 : _a.listKeymap));
		if (this.options.link !== false) extensions.push(Link.configure((_b = this.options) == null ? void 0 : _b.link));
		if (this.options.orderedList !== false) extensions.push(OrderedList.configure(this.options.orderedList));
		if (this.options.paragraph !== false) extensions.push(Paragraph.configure(this.options.paragraph));
		if (this.options.strike !== false) extensions.push(Strike.configure(this.options.strike));
		if (this.options.text !== false) extensions.push(Text.configure(this.options.text));
		if (this.options.underline !== false) extensions.push(Underline.configure((_c = this.options) == null ? void 0 : _c.underline));
		if (this.options.trailingNode !== false) extensions.push(TrailingNode.configure((_d = this.options) == null ? void 0 : _d.trailingNode));
		return extensions;
	}
});
//#endregion
//#region node_modules/@tiptap/extension-image/dist/index.js
var inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
var index_default$3 = Node3.create({
	name: "image",
	addOptions() {
		return {
			inline: false,
			allowBase64: false,
			HTMLAttributes: {},
			resize: false
		};
	},
	inline() {
		return this.options.inline;
	},
	group() {
		return this.options.inline ? "inline" : "block";
	},
	draggable: true,
	addAttributes() {
		return {
			src: { default: null },
			alt: { default: null },
			title: { default: null },
			width: { default: null },
			height: { default: null }
		};
	},
	parseHTML() {
		return [{ tag: this.options.allowBase64 ? "img[src]" : "img[src]:not([src^=\"data:\"])" }];
	},
	renderHTML({ HTMLAttributes }) {
		return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
	},
	parseMarkdown: (token, helpers) => {
		return helpers.createNode("image", {
			src: token.href,
			title: token.title,
			alt: token.text
		});
	},
	renderMarkdown: (node) => {
		var _a, _b, _c, _d, _e, _f;
		const src = (_b = (_a = node.attrs) == null ? void 0 : _a.src) != null ? _b : "";
		const alt = (_d = (_c = node.attrs) == null ? void 0 : _c.alt) != null ? _d : "";
		const title = (_f = (_e = node.attrs) == null ? void 0 : _e.title) != null ? _f : "";
		return title ? `![${alt}](${src} "${title}")` : `![${alt}](${src})`;
	},
	addNodeView() {
		if (!this.options.resize || !this.options.resize.enabled || typeof document === "undefined") return null;
		const { directions, minWidth, minHeight, alwaysPreserveAspectRatio } = this.options.resize;
		return ({ node, getPos, HTMLAttributes, editor }) => {
			const el = document.createElement("img");
			el.draggable = false;
			const mergedAttributes = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes);
			Object.entries(mergedAttributes).forEach(([key, value]) => {
				if (value != null) switch (key) {
					case "width":
					case "height": break;
					default:
						el.setAttribute(key, value);
						break;
				}
			});
			if (mergedAttributes.src !== null) el.src = mergedAttributes.src;
			const nodeView = new ResizableNodeView({
				element: el,
				editor,
				node,
				getPos,
				onResize: (width, height) => {
					el.style.width = `${width}px`;
					el.style.height = `${height}px`;
				},
				onCommit: (width, height) => {
					const pos = getPos();
					if (pos === void 0) return;
					this.editor.chain().setNodeSelection(pos).updateAttributes(this.name, {
						width,
						height
					}).run();
				},
				onUpdate: (updatedNode, _decorations, _innerDecorations) => {
					if (updatedNode.type !== node.type) return false;
					return true;
				},
				options: {
					directions,
					min: {
						width: minWidth,
						height: minHeight
					},
					preserveAspectRatio: alwaysPreserveAspectRatio === true
				}
			});
			const dom = nodeView.dom;
			dom.style.visibility = "hidden";
			dom.style.pointerEvents = "none";
			el.onload = () => {
				dom.style.visibility = "";
				dom.style.pointerEvents = "";
			};
			return nodeView;
		};
	},
	addCommands() {
		return { setImage: (options) => ({ commands }) => {
			return commands.insertContent({
				type: this.name,
				attrs: options
			});
		} };
	},
	addInputRules() {
		return [nodeInputRule({
			find: inputRegex,
			type: this.type,
			getAttributes: (match) => {
				const [, , alt, src, title] = match;
				return {
					src,
					alt,
					title
				};
			}
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/extension-placeholder/dist/index.js
var index_default$2 = Placeholder;
//#endregion
//#region node_modules/highlight.js/es/core.js
var core_default = import_core.default;
//#endregion
//#region node_modules/@tiptap/extension-code-block-lowlight/dist/index.js
function parseNodes(nodes, className = []) {
	return nodes.flatMap((node) => {
		const classes = [...className, ...node.properties ? node.properties.className : []];
		if (node.children) return parseNodes(node.children, classes);
		return {
			text: node.value,
			classes
		};
	});
}
function getHighlightNodes(result) {
	return result.value || result.children || [];
}
function registered(aliasOrLanguage) {
	return Boolean(core_default.getLanguage(aliasOrLanguage));
}
function getDecorations({ doc, name, lowlight, defaultLanguage }) {
	const decorations = [];
	findChildren(doc, (node) => node.type.name === name).forEach((block) => {
		var _a;
		let from = block.pos + 1;
		const language = block.node.attrs.language || defaultLanguage;
		const languages = lowlight.listLanguages();
		parseNodes(language && (languages.includes(language) || registered(language) || ((_a = lowlight.registered) == null ? void 0 : _a.call(lowlight, language))) ? getHighlightNodes(lowlight.highlight(language, block.node.textContent)) : getHighlightNodes(lowlight.highlightAuto(block.node.textContent))).forEach((node) => {
			const to = from + node.text.length;
			if (node.classes.length) {
				const decoration = Decoration.inline(from, to, { class: node.classes.join(" ") });
				decorations.push(decoration);
			}
			from = to;
		});
	});
	return DecorationSet.create(doc, decorations);
}
function isFunction(param) {
	return typeof param === "function";
}
function LowlightPlugin({ name, lowlight, defaultLanguage }) {
	if (![
		"highlight",
		"highlightAuto",
		"listLanguages"
	].every((api) => isFunction(lowlight[api]))) throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");
	const lowlightPlugin = new Plugin({
		key: new PluginKey("lowlight"),
		state: {
			init: (_, { doc }) => getDecorations({
				doc,
				name,
				lowlight,
				defaultLanguage
			}),
			apply: (transaction, decorationSet, oldState, newState) => {
				const oldNodeName = oldState.selection.$head.parent.type.name;
				const newNodeName = newState.selection.$head.parent.type.name;
				const oldNodes = findChildren(oldState.doc, (node) => node.type.name === name);
				const newNodes = findChildren(newState.doc, (node) => node.type.name === name);
				if (transaction.docChanged && ([oldNodeName, newNodeName].includes(name) || newNodes.length !== oldNodes.length || transaction.steps.some((step) => {
					return step.from !== void 0 && step.to !== void 0 && oldNodes.some((node) => {
						return node.pos >= step.from && node.pos + node.node.nodeSize <= step.to;
					});
				}))) return getDecorations({
					doc: transaction.doc,
					name,
					lowlight,
					defaultLanguage
				});
				return decorationSet.map(transaction.mapping, transaction.doc);
			}
		},
		props: { decorations(state) {
			return lowlightPlugin.getState(state);
		} }
	});
	return lowlightPlugin;
}
var index_default$1 = CodeBlock.extend({
	addOptions() {
		var _a;
		return {
			...(_a = this.parent) == null ? void 0 : _a.call(this),
			lowlight: {},
			languageClassPrefix: "language-",
			exitOnTripleEnter: true,
			exitOnArrowDown: true,
			defaultLanguage: null,
			enableTabIndentation: false,
			tabSize: 4,
			HTMLAttributes: {}
		};
	},
	addProseMirrorPlugins() {
		var _a;
		return [...((_a = this.parent) == null ? void 0 : _a.call(this)) || [], LowlightPlugin({
			name: this.name,
			lowlight: this.options.lowlight,
			defaultLanguage: this.options.defaultLanguage
		})];
	}
});
//#endregion
//#region node_modules/@tiptap/suggestion/dist/index.js
function findSuggestionMatch(config) {
	var _a;
	const { char, allowSpaces: allowSpacesOption, allowToIncludeChar, allowedPrefixes, startOfLine, $position } = config;
	const allowSpaces = allowSpacesOption && !allowToIncludeChar;
	const escapedChar = escapeForRegEx(char);
	const suffix = new RegExp(`\\s${escapedChar}$`);
	const prefix = startOfLine ? "^" : "";
	const finalEscapedChar = allowToIncludeChar ? "" : escapedChar;
	const regexp = allowSpaces ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${finalEscapedChar}|$)`, "gm") : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${finalEscapedChar}]*`, "gm");
	const text = ((_a = $position.nodeBefore) == null ? void 0 : _a.isText) && $position.nodeBefore.text;
	if (!text) return null;
	const textFrom = $position.pos - text.length;
	const match = Array.from(text.matchAll(regexp)).pop();
	if (!match || match.input === void 0 || match.index === void 0) return null;
	const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);
	const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes == null ? void 0 : allowedPrefixes.join("")}\0]?$`).test(matchPrefix);
	if (allowedPrefixes !== null && !matchPrefixIsAllowed) return null;
	const from = textFrom + match.index;
	let to = from + match[0].length;
	if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
		match[0] += " ";
		to += 1;
	}
	if (from < $position.pos && to >= $position.pos) return {
		range: {
			from,
			to
		},
		query: match[0].slice(char.length),
		text: match[0]
	};
	return null;
}
function hasInsertedWhitespace(transaction) {
	if (!transaction.docChanged) return false;
	return transaction.steps.some((step) => {
		const slice = step.slice;
		if (!(slice == null ? void 0 : slice.content)) return false;
		const inserted = slice.content.textBetween(0, slice.content.size, "\n");
		return /\s/.test(inserted);
	});
}
var SuggestionPluginKey = new PluginKey("suggestion");
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = "@", allowSpaces = false, allowToIncludeChar = false, allowedPrefixes = [" "], startOfLine = false, decorationTag = "span", decorationClass = "suggestion", decorationContent = "", decorationEmptyClass = "is-empty", command = () => null, items = () => [], render = () => ({}), allow = () => true, findSuggestionMatch: findSuggestionMatch2 = findSuggestionMatch, shouldShow, shouldResetDismissed }) {
	let props;
	const renderer = render == null ? void 0 : render();
	const effectiveAllowSpaces = allowSpaces && !allowToIncludeChar;
	const getAnchorClientRect = () => {
		const pos = editor.state.selection.$anchor.pos;
		const { top, right, bottom, left } = editor.view.coordsAtPos(pos);
		try {
			return new DOMRect(left, top, right - left, bottom - top);
		} catch {
			return null;
		}
	};
	const clientRectFor = (view, decorationNode) => {
		if (!decorationNode) return getAnchorClientRect;
		return () => {
			const state = pluginKey.getState(editor.state);
			const decorationId = state == null ? void 0 : state.decorationId;
			const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`);
			return (currentDecorationNode == null ? void 0 : currentDecorationNode.getBoundingClientRect()) || null;
		};
	};
	const shouldKeepDismissed = ({ match, dismissedRange, state, transaction }) => {
		if (shouldResetDismissed == null ? void 0 : shouldResetDismissed({
			editor,
			state,
			range: dismissedRange,
			match,
			transaction,
			allowSpaces: effectiveAllowSpaces
		})) return false;
		if (effectiveAllowSpaces) return match.range.from === dismissedRange.from;
		return match.range.from === dismissedRange.from && !hasInsertedWhitespace(transaction);
	};
	function dispatchExit(view, pluginKeyRef) {
		var _a;
		try {
			const state = pluginKey.getState(view.state);
			const decorationNode = (state == null ? void 0 : state.decorationId) ? view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`) : null;
			const exitProps = {
				editor,
				range: (state == null ? void 0 : state.range) || {
					from: 0,
					to: 0
				},
				query: (state == null ? void 0 : state.query) || null,
				text: (state == null ? void 0 : state.text) || null,
				items: [],
				command: (commandProps) => {
					return command({
						editor,
						range: (state == null ? void 0 : state.range) || {
							from: 0,
							to: 0
						},
						props: commandProps
					});
				},
				decorationNode,
				clientRect: clientRectFor(view, decorationNode)
			};
			(_a = renderer == null ? void 0 : renderer.onExit) == null || _a.call(renderer, exitProps);
		} catch {}
		const tr = view.state.tr.setMeta(pluginKeyRef, { exit: true });
		view.dispatch(tr);
	}
	const plugin = new Plugin({
		key: pluginKey,
		view() {
			return {
				update: async (view, prevState) => {
					var _a, _b, _c, _d, _e, _f, _g;
					const prev = (_a = this.key) == null ? void 0 : _a.getState(prevState);
					const next = (_b = this.key) == null ? void 0 : _b.getState(view.state);
					const moved = prev.active && next.active && prev.range.from !== next.range.from;
					const started = !prev.active && next.active;
					const stopped = prev.active && !next.active;
					const changed = !started && !stopped && prev.query !== next.query;
					const handleStart = started || moved && changed;
					const handleChange = changed || moved;
					const handleExit = stopped || moved && changed;
					if (!handleStart && !handleChange && !handleExit) return;
					const state = handleExit && !handleStart ? prev : next;
					const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`);
					props = {
						editor,
						range: state.range,
						query: state.query,
						text: state.text,
						items: [],
						command: (commandProps) => {
							return command({
								editor,
								range: state.range,
								props: commandProps
							});
						},
						decorationNode,
						clientRect: clientRectFor(view, decorationNode)
					};
					if (handleStart) (_c = renderer == null ? void 0 : renderer.onBeforeStart) == null || _c.call(renderer, props);
					if (handleChange) (_d = renderer == null ? void 0 : renderer.onBeforeUpdate) == null || _d.call(renderer, props);
					if (handleChange || handleStart) props.items = await items({
						editor,
						query: state.query
					});
					if (handleExit) (_e = renderer == null ? void 0 : renderer.onExit) == null || _e.call(renderer, props);
					if (handleChange) (_f = renderer == null ? void 0 : renderer.onUpdate) == null || _f.call(renderer, props);
					if (handleStart) (_g = renderer == null ? void 0 : renderer.onStart) == null || _g.call(renderer, props);
				},
				destroy: () => {
					var _a;
					if (!props) return;
					(_a = renderer == null ? void 0 : renderer.onExit) == null || _a.call(renderer, props);
				}
			};
		},
		state: {
			init() {
				return {
					active: false,
					range: {
						from: 0,
						to: 0
					},
					query: null,
					text: null,
					composing: false,
					dismissedRange: null
				};
			},
			apply(transaction, prev, _oldState, state) {
				const { isEditable } = editor;
				const { composing } = editor.view;
				const { selection } = transaction;
				const { empty, from } = selection;
				const next = { ...prev };
				const meta = transaction.getMeta(pluginKey);
				if (meta && meta.exit) {
					next.active = false;
					next.decorationId = null;
					next.range = {
						from: 0,
						to: 0
					};
					next.query = null;
					next.text = null;
					next.dismissedRange = prev.active ? { ...prev.range } : prev.dismissedRange;
					return next;
				}
				next.composing = composing;
				if (transaction.docChanged && next.dismissedRange !== null) next.dismissedRange = {
					from: transaction.mapping.map(next.dismissedRange.from),
					to: transaction.mapping.map(next.dismissedRange.to)
				};
				if (isEditable && (empty || editor.view.composing)) {
					if ((from < prev.range.from || from > prev.range.to) && !composing && !prev.composing) next.active = false;
					const match = findSuggestionMatch2({
						char,
						allowSpaces,
						allowToIncludeChar,
						allowedPrefixes,
						startOfLine,
						$position: selection.$from
					});
					const decorationId = `id_${Math.floor(Math.random() * 4294967295)}`;
					if (match && allow({
						editor,
						state,
						range: match.range,
						isActive: prev.active
					}) && (!shouldShow || shouldShow({
						editor,
						range: match.range,
						query: match.query,
						text: match.text,
						transaction
					}))) {
						if (next.dismissedRange !== null && !shouldKeepDismissed({
							match,
							dismissedRange: next.dismissedRange,
							state,
							transaction
						})) next.dismissedRange = null;
						if (next.dismissedRange === null) {
							next.active = true;
							next.decorationId = prev.decorationId ? prev.decorationId : decorationId;
							next.range = match.range;
							next.query = match.query;
							next.text = match.text;
						} else next.active = false;
					} else {
						if (!match) next.dismissedRange = null;
						next.active = false;
					}
				} else next.active = false;
				if (!next.active) {
					next.decorationId = null;
					next.range = {
						from: 0,
						to: 0
					};
					next.query = null;
					next.text = null;
				}
				return next;
			}
		},
		props: {
			handleKeyDown(view, event) {
				var _a, _b;
				const { active, range } = plugin.getState(view.state);
				if (!active) return false;
				if (event.key === "Escape" || event.key === "Esc") {
					const state = plugin.getState(view.state);
					(_a = renderer == null ? void 0 : renderer.onKeyDown) == null || _a.call(renderer, {
						view,
						event,
						range: state.range
					});
					dispatchExit(view, pluginKey);
					return true;
				}
				return ((_b = renderer == null ? void 0 : renderer.onKeyDown) == null ? void 0 : _b.call(renderer, {
					view,
					event,
					range
				})) || false;
			},
			decorations(state) {
				const { active, range, decorationId, query } = plugin.getState(state);
				if (!active) return null;
				const isEmpty = !(query == null ? void 0 : query.length);
				const classNames = [decorationClass];
				if (isEmpty) classNames.push(decorationEmptyClass);
				return DecorationSet.create(state.doc, [Decoration.inline(range.from, range.to, {
					nodeName: decorationTag,
					class: classNames.join(" "),
					"data-decoration-id": decorationId,
					"data-decoration-content": decorationContent
				})]);
			}
		}
	});
	return plugin;
}
var index_default = Suggestion;
//#endregion
//#region resources/js/Components/MentionList.vue?vue&type=script&setup=true&lang.ts
var MentionList_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue_exports.defineComponent)({
	__name: "MentionList",
	__ssrInlineRender: true,
	props: {
		items: {},
		command: { type: Function }
	},
	setup(__props, { expose: __expose }) {
		const props = __props;
		const selected = (0, vue_exports.ref)(0);
		(0, vue_exports.watch)(() => props.items, () => {
			selected.value = 0;
		});
		function select(i) {
			const item = props.items[i];
			if (item) props.command(item);
		}
		function onKeyDown({ event }) {
			if (!props.items.length) return false;
			if (event.key === "ArrowDown") {
				selected.value = (selected.value + 1) % props.items.length;
				return true;
			}
			if (event.key === "ArrowUp") {
				selected.value = (selected.value - 1 + props.items.length) % props.items.length;
				return true;
			}
			if (event.key === "Enter" || event.key === "Tab") {
				select(selected.value);
				return true;
			}
			return false;
		}
		__expose({ onKeyDown });
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<div${(0, server_renderer_exports.ssrRenderAttrs)((0, vue_exports.mergeProps)({ class: "w-64 overflow-hidden rounded-c border border-line bg-surface py-1 shadow-2xl shadow-black/20" }, _attrs))}><!--[-->`);
			(0, server_renderer_exports.ssrRenderList)(__props.items, (item, i) => {
				_push(`<button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([i === selected.value ? "bg-primary/15" : "hover:bg-surface-2", "flex w-full items-center gap-2.5 px-3 py-2 text-left"])}">`);
				_push((0, server_renderer_exports.ssrRenderComponent)(Avatar_default, {
					avatar: item,
					size: 28
				}, null, _parent));
				_push(`<span class="truncate text-sm font-semibold text-ink">${(0, server_renderer_exports.ssrInterpolate)(item.name)}</span><span class="ml-auto truncate text-xs text-ink-muted">@${(0, server_renderer_exports.ssrInterpolate)(item.id)}</span></button>`);
			});
			_push(`<!--]-->`);
			if (!__props.items.length) _push(`<div class="px-3 py-2 text-sm text-ink-muted">${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("No matching members"))}</div>`);
			else _push(`<!---->`);
			_push(`</div>`);
		};
	}
});
//#endregion
//#region resources/js/Components/MentionList.vue
var _sfc_setup$1 = MentionList_vue_vue_type_script_setup_true_lang_default.setup;
MentionList_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
	const ssrContext = (0, vue_exports.useSSRContext)();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Components/MentionList.vue");
	return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
var MentionList_default = MentionList_vue_vue_type_script_setup_true_lang_default;
//#endregion
//#region resources/js/lib/mentionSuggestion.ts
function place(el, clientRect) {
	const rect = clientRect?.();
	if (!rect) return;
	el.style.left = `${rect.left + window.scrollX}px`;
	el.style.top = `${rect.bottom + window.scrollY + 6}px`;
}
/**
* `@` typeahead that inserts the user's handle as plain text (e.g. "@riley.west "),
* which the server-side Mentions parser already understands — no custom node, so
* it survives HTML sanitization cleanly.
*/
var MentionText = Extension.create({
	name: "mentionText",
	addProseMirrorPlugins() {
		return [index_default({
			editor: this.editor,
			char: "@",
			allowSpaces: false,
			items: async ({ query }) => {
				try {
					const res = await fetch(`/users/search?q=${encodeURIComponent(query)}`, {
						headers: { Accept: "application/json" },
						credentials: "same-origin"
					});
					return res.ok ? await res.json() : [];
				} catch {
					return [];
				}
			},
			command: ({ editor, range, props }) => {
				editor.chain().focus().insertContentAt(range, `@${props.id} `).run();
			},
			render: () => {
				let component = null;
				let popup = null;
				return {
					onStart: (props) => {
						component = new VueRenderer(MentionList_default, {
							props,
							editor: props.editor
						});
						popup = document.createElement("div");
						popup.style.position = "absolute";
						popup.style.zIndex = "70";
						document.body.appendChild(popup);
						popup.appendChild(component.element);
						place(popup, props.clientRect);
					},
					onUpdate: (props) => {
						component?.updateProps(props);
						place(popup, props.clientRect);
					},
					onKeyDown: (props) => {
						if (props.event.key === "Escape") return true;
						return (component?.ref)?.onKeyDown?.(props) ?? false;
					},
					onExit: () => {
						popup?.remove();
						popup = null;
						component?.destroy();
						component = null;
					}
				};
			}
		})];
	}
});
//#endregion
//#region resources/js/lib/Spoiler.ts
var Spoiler = Node3.create({
	name: "spoiler",
	group: "block",
	content: "block+",
	defining: true,
	parseHTML() {
		return [{
			tag: "details.spoiler",
			contentElement: "div"
		}];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"details",
			mergeAttributes(HTMLAttributes, { class: "spoiler" }),
			[
				"summary",
				{ contenteditable: "false" },
				"Spoiler"
			],
			[
				"div",
				{},
				0
			]
		];
	},
	addCommands() {
		return { toggleSpoiler: () => ({ commands }) => commands.toggleWrap(this.name) };
	}
});
//#endregion
//#region node_modules/highlight.js/es/languages/arduino.js
/** @type LanguageFn */
function cPlusPlus(hljs) {
	const regex = hljs.regex;
	const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
	const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
	const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
	const FUNCTION_TYPE_RE = "(?!struct)(decltype\\(auto\\)|" + regex.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex.optional("<[^<>]+>") + ")";
	const CPP_PRIMITIVE_TYPES = {
		className: "type",
		begin: "\\b[a-z\\d_]*_t\\b"
	};
	const STRINGS = {
		className: "string",
		variants: [
			{
				begin: "(u8?|U|L)?\"",
				end: "\"",
				illegal: "\\n",
				contains: [hljs.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: "."
			},
			hljs.END_SAME_AS_BEGIN({
				begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
				end: /\)([^()\\ ]{0,16})"/
			})
		]
	};
	const NUMBERS = {
		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
	};
	const PREPROCESSOR = {
		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
			},
			hljs.inherit(STRINGS, { className: "string" }),
			{
				className: "string",
				begin: /<.*?>/
			},
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE
		]
	};
	const TITLE_MODE = {
		className: "title",
		begin: regex.optional(NAMESPACE_RE) + hljs.IDENT_RE,
		relevance: 0
	};
	const FUNCTION_TITLE = regex.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
	const RESERVED_KEYWORDS = [
		"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"
	];
	const RESERVED_TYPES = [
		"bool",
		"char",
		"char16_t",
		"char32_t",
		"char8_t",
		"double",
		"float",
		"int",
		"long",
		"short",
		"void",
		"wchar_t",
		"unsigned",
		"signed",
		"const",
		"static"
	];
	const TYPE_HINTS = [
		"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"
	];
	const FUNCTION_HINTS = [
		"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"
	];
	const CPP_KEYWORDS = {
		type: RESERVED_TYPES,
		keyword: RESERVED_KEYWORDS,
		literal: [
			"NULL",
			"false",
			"nullopt",
			"nullptr",
			"true"
		],
		built_in: ["_Pragma"],
		_type_hints: TYPE_HINTS
	};
	const FUNCTION_DISPATCH = {
		className: "function.dispatch",
		relevance: 0,
		keywords: { _hint: FUNCTION_HINTS },
		begin: regex.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex.lookahead(/(<[^<>]+>|)\s*\(/))
	};
	const EXPRESSION_CONTAINS = [
		FUNCTION_DISPATCH,
		PREPROCESSOR,
		CPP_PRIMITIVE_TYPES,
		C_LINE_COMMENT_MODE,
		hljs.C_BLOCK_COMMENT_MODE,
		NUMBERS,
		STRINGS
	];
	const EXPRESSION_CONTEXT = {
		variants: [
			{
				begin: /=/,
				end: /;/
			},
			{
				begin: /\(/,
				end: /\)/
			},
			{
				beginKeywords: "new throw return else",
				end: /;/
			}
		],
		keywords: CPP_KEYWORDS,
		contains: EXPRESSION_CONTAINS.concat([{
			begin: /\(/,
			end: /\)/,
			keywords: CPP_KEYWORDS,
			contains: EXPRESSION_CONTAINS.concat(["self"]),
			relevance: 0
		}]),
		relevance: 0
	};
	const FUNCTION_DECLARATION = {
		className: "function",
		begin: "(" + FUNCTION_TYPE_RE + "[\\*&\\s]+)+" + FUNCTION_TITLE,
		returnBegin: true,
		end: /[{;=]/,
		excludeEnd: true,
		keywords: CPP_KEYWORDS,
		illegal: /[^\w\s\*&:<>.]/,
		contains: [
			{
				begin: DECLTYPE_AUTO_RE,
				keywords: CPP_KEYWORDS,
				relevance: 0
			},
			{
				begin: FUNCTION_TITLE,
				returnBegin: true,
				contains: [TITLE_MODE],
				relevance: 0
			},
			{
				begin: /::/,
				relevance: 0
			},
			{
				begin: /:/,
				endsWithParent: true,
				contains: [STRINGS, NUMBERS]
			},
			{
				relevance: 0,
				match: /,/
			},
			{
				className: "params",
				begin: /\(/,
				end: /\)/,
				keywords: CPP_KEYWORDS,
				relevance: 0,
				contains: [
					C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE,
					STRINGS,
					NUMBERS,
					CPP_PRIMITIVE_TYPES,
					{
						begin: /\(/,
						end: /\)/,
						keywords: CPP_KEYWORDS,
						relevance: 0,
						contains: [
							"self",
							C_LINE_COMMENT_MODE,
							hljs.C_BLOCK_COMMENT_MODE,
							STRINGS,
							NUMBERS,
							CPP_PRIMITIVE_TYPES
						]
					}
				]
			},
			CPP_PRIMITIVE_TYPES,
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			PREPROCESSOR
		]
	};
	return {
		name: "C++",
		aliases: [
			"cc",
			"c++",
			"h++",
			"hpp",
			"hh",
			"hxx",
			"cxx"
		],
		keywords: CPP_KEYWORDS,
		illegal: "</",
		classNameAliases: { "function.dispatch": "built_in" },
		contains: [].concat(EXPRESSION_CONTEXT, FUNCTION_DECLARATION, FUNCTION_DISPATCH, EXPRESSION_CONTAINS, [
			PREPROCESSOR,
			{
				begin: "\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",
				end: ">",
				keywords: CPP_KEYWORDS,
				contains: ["self", CPP_PRIMITIVE_TYPES]
			},
			{
				begin: hljs.IDENT_RE + "::",
				keywords: CPP_KEYWORDS
			},
			{
				match: [
					/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,
					/\s+/,
					/\w+/
				],
				className: {
					1: "keyword",
					3: "title.class"
				}
			}
		])
	};
}
/** @type LanguageFn */
function arduino(hljs) {
	const ARDUINO_KW = {
		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"
		]
	};
	const ARDUINO = cPlusPlus(hljs);
	const kws = ARDUINO.keywords;
	kws.type = [...kws.type, ...ARDUINO_KW.type];
	kws.literal = [...kws.literal, ...ARDUINO_KW.literal];
	kws.built_in = [...kws.built_in, ...ARDUINO_KW.built_in];
	kws._hints = ARDUINO_KW._hints;
	ARDUINO.name = "Arduino";
	ARDUINO.aliases = ["ino"];
	ARDUINO.supersetOf = "cpp";
	return ARDUINO;
}
//#endregion
//#region node_modules/highlight.js/es/languages/bash.js
/** @type LanguageFn */
function bash(hljs) {
	const regex = hljs.regex;
	const VAR = {};
	const BRACED_VAR = {
		begin: /\$\{/,
		end: /\}/,
		contains: ["self", {
			begin: /:-/,
			contains: [VAR]
		}]
	};
	Object.assign(VAR, {
		className: "variable",
		variants: [{ begin: regex.concat(/\$[\w\d#@][\w\d_]*/, `(?![\\w\\d])(?![$])`) }, BRACED_VAR]
	});
	const SUBST = {
		className: "subst",
		begin: /\$\(/,
		end: /\)/,
		contains: [hljs.BACKSLASH_ESCAPE]
	};
	const COMMENT = hljs.inherit(hljs.COMMENT(), {
		match: [/(^|\s)/, /#.*$/],
		scope: { 2: "comment" }
	});
	const HERE_DOC = {
		begin: /<<-?\s*(?=\w+)/,
		starts: { contains: [hljs.END_SAME_AS_BEGIN({
			begin: /(\w+)/,
			end: /(\w+)/,
			className: "string"
		})] }
	};
	const QUOTE_STRING = {
		className: "string",
		begin: /"/,
		end: /"/,
		contains: [
			hljs.BACKSLASH_ESCAPE,
			VAR,
			SUBST
		]
	};
	SUBST.contains.push(QUOTE_STRING);
	const ESCAPED_QUOTE = { match: /\\"/ };
	const APOS_STRING = {
		className: "string",
		begin: /'/,
		end: /'/
	};
	const ESCAPED_APOS = { match: /\\'/ };
	const ARITHMETIC = {
		begin: /\$?\(\(/,
		end: /\)\)/,
		contains: [
			{
				begin: /\d+#[0-9a-f]+/,
				className: "number"
			},
			hljs.NUMBER_MODE,
			VAR
		]
	};
	const KNOWN_SHEBANG = hljs.SHEBANG({
		binary: `(${[
			"fish",
			"bash",
			"zsh",
			"sh",
			"csh",
			"ksh",
			"tcsh",
			"dash",
			"scsh"
		].join("|")})`,
		relevance: 10
	});
	const FUNCTION = {
		className: "function",
		begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
		returnBegin: true,
		contains: [hljs.inherit(hljs.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
		relevance: 0
	};
	const KEYWORDS = [
		"if",
		"then",
		"else",
		"elif",
		"fi",
		"time",
		"for",
		"while",
		"until",
		"in",
		"do",
		"done",
		"case",
		"esac",
		"coproc",
		"function",
		"select"
	];
	const LITERALS = ["true", "false"];
	const PATH_MODE = { match: /(\/[a-z._-]+)+/ };
	const SHELL_BUILT_INS = [
		"break",
		"cd",
		"continue",
		"eval",
		"exec",
		"exit",
		"export",
		"getopts",
		"hash",
		"pwd",
		"readonly",
		"return",
		"shift",
		"test",
		"times",
		"trap",
		"umask",
		"unset"
	];
	const BASH_BUILT_INS = [
		"alias",
		"bind",
		"builtin",
		"caller",
		"command",
		"declare",
		"echo",
		"enable",
		"help",
		"let",
		"local",
		"logout",
		"mapfile",
		"printf",
		"read",
		"readarray",
		"source",
		"sudo",
		"type",
		"typeset",
		"ulimit",
		"unalias"
	];
	const ZSH_BUILT_INS = [
		"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"
	];
	const GNU_CORE_UTILS = [
		"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: KEYWORDS,
			literal: LITERALS,
			built_in: [
				...SHELL_BUILT_INS,
				...BASH_BUILT_INS,
				"set",
				"shopt",
				...ZSH_BUILT_INS,
				...GNU_CORE_UTILS
			]
		},
		contains: [
			KNOWN_SHEBANG,
			hljs.SHEBANG(),
			FUNCTION,
			ARITHMETIC,
			COMMENT,
			HERE_DOC,
			PATH_MODE,
			QUOTE_STRING,
			ESCAPED_QUOTE,
			APOS_STRING,
			ESCAPED_APOS,
			VAR
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/c.js
/** @type LanguageFn */
function c(hljs) {
	const regex = hljs.regex;
	const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
	const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
	const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
	const FUNCTION_TYPE_RE = "(decltype\\(auto\\)|" + regex.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex.optional("<[^<>]+>") + ")";
	const TYPES = {
		className: "type",
		variants: [{ begin: "\\b[a-z\\d_]*_t\\b" }, { match: /\batomic_[a-z]{3,6}\b/ }]
	};
	const STRINGS = {
		className: "string",
		variants: [
			{
				begin: "(u8?|U|L)?\"",
				end: "\"",
				illegal: "\\n",
				contains: [hljs.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: "."
			},
			hljs.END_SAME_AS_BEGIN({
				begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
				end: /\)([^()\\ ]{0,16})"/
			})
		]
	};
	const NUMBERS = {
		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
	};
	const PREPROCESSOR = {
		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
			},
			hljs.inherit(STRINGS, { className: "string" }),
			{
				className: "string",
				begin: /<.*?>/
			},
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE
		]
	};
	const TITLE_MODE = {
		className: "title",
		begin: regex.optional(NAMESPACE_RE) + hljs.IDENT_RE,
		relevance: 0
	};
	const FUNCTION_TITLE = regex.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
	const KEYWORDS = {
		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"
	};
	const EXPRESSION_CONTAINS = [
		PREPROCESSOR,
		TYPES,
		C_LINE_COMMENT_MODE,
		hljs.C_BLOCK_COMMENT_MODE,
		NUMBERS,
		STRINGS
	];
	const EXPRESSION_CONTEXT = {
		variants: [
			{
				begin: /=/,
				end: /;/
			},
			{
				begin: /\(/,
				end: /\)/
			},
			{
				beginKeywords: "new throw return else",
				end: /;/
			}
		],
		keywords: KEYWORDS,
		contains: EXPRESSION_CONTAINS.concat([{
			begin: /\(/,
			end: /\)/,
			keywords: KEYWORDS,
			contains: EXPRESSION_CONTAINS.concat(["self"]),
			relevance: 0
		}]),
		relevance: 0
	};
	const FUNCTION_DECLARATION = {
		begin: "(" + FUNCTION_TYPE_RE + "[\\*&\\s]+)+" + FUNCTION_TITLE,
		returnBegin: true,
		end: /[{;=]/,
		excludeEnd: true,
		keywords: KEYWORDS,
		illegal: /[^\w\s\*&:<>.]/,
		contains: [
			{
				begin: DECLTYPE_AUTO_RE,
				keywords: KEYWORDS,
				relevance: 0
			},
			{
				begin: FUNCTION_TITLE,
				returnBegin: true,
				contains: [hljs.inherit(TITLE_MODE, { className: "title.function" })],
				relevance: 0
			},
			{
				relevance: 0,
				match: /,/
			},
			{
				className: "params",
				begin: /\(/,
				end: /\)/,
				keywords: KEYWORDS,
				relevance: 0,
				contains: [
					C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE,
					STRINGS,
					NUMBERS,
					TYPES,
					{
						begin: /\(/,
						end: /\)/,
						keywords: KEYWORDS,
						relevance: 0,
						contains: [
							"self",
							C_LINE_COMMENT_MODE,
							hljs.C_BLOCK_COMMENT_MODE,
							STRINGS,
							NUMBERS,
							TYPES
						]
					}
				]
			},
			TYPES,
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			PREPROCESSOR
		]
	};
	return {
		name: "C",
		aliases: ["h"],
		keywords: KEYWORDS,
		disableAutodetect: true,
		illegal: "</",
		contains: [].concat(EXPRESSION_CONTEXT, FUNCTION_DECLARATION, EXPRESSION_CONTAINS, [
			PREPROCESSOR,
			{
				begin: hljs.IDENT_RE + "::",
				keywords: KEYWORDS
			},
			{
				className: "class",
				beginKeywords: "enum class struct union",
				end: /[{;:<>=]/,
				contains: [{ beginKeywords: "final class struct" }, hljs.TITLE_MODE]
			}
		]),
		exports: {
			preprocessor: PREPROCESSOR,
			strings: STRINGS,
			keywords: KEYWORDS
		}
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/cpp.js
/** @type LanguageFn */
function cpp(hljs) {
	const regex = hljs.regex;
	const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
	const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
	const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
	const FUNCTION_TYPE_RE = "(?!struct)(decltype\\(auto\\)|" + regex.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex.optional("<[^<>]+>") + ")";
	const CPP_PRIMITIVE_TYPES = {
		className: "type",
		begin: "\\b[a-z\\d_]*_t\\b"
	};
	const STRINGS = {
		className: "string",
		variants: [
			{
				begin: "(u8?|U|L)?\"",
				end: "\"",
				illegal: "\\n",
				contains: [hljs.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: "."
			},
			hljs.END_SAME_AS_BEGIN({
				begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
				end: /\)([^()\\ ]{0,16})"/
			})
		]
	};
	const NUMBERS = {
		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
	};
	const PREPROCESSOR = {
		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
			},
			hljs.inherit(STRINGS, { className: "string" }),
			{
				className: "string",
				begin: /<.*?>/
			},
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE
		]
	};
	const TITLE_MODE = {
		className: "title",
		begin: regex.optional(NAMESPACE_RE) + hljs.IDENT_RE,
		relevance: 0
	};
	const FUNCTION_TITLE = regex.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
	const RESERVED_KEYWORDS = [
		"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"
	];
	const RESERVED_TYPES = [
		"bool",
		"char",
		"char16_t",
		"char32_t",
		"char8_t",
		"double",
		"float",
		"int",
		"long",
		"short",
		"void",
		"wchar_t",
		"unsigned",
		"signed",
		"const",
		"static"
	];
	const TYPE_HINTS = [
		"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"
	];
	const FUNCTION_HINTS = [
		"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"
	];
	const CPP_KEYWORDS = {
		type: RESERVED_TYPES,
		keyword: RESERVED_KEYWORDS,
		literal: [
			"NULL",
			"false",
			"nullopt",
			"nullptr",
			"true"
		],
		built_in: ["_Pragma"],
		_type_hints: TYPE_HINTS
	};
	const FUNCTION_DISPATCH = {
		className: "function.dispatch",
		relevance: 0,
		keywords: { _hint: FUNCTION_HINTS },
		begin: regex.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex.lookahead(/(<[^<>]+>|)\s*\(/))
	};
	const EXPRESSION_CONTAINS = [
		FUNCTION_DISPATCH,
		PREPROCESSOR,
		CPP_PRIMITIVE_TYPES,
		C_LINE_COMMENT_MODE,
		hljs.C_BLOCK_COMMENT_MODE,
		NUMBERS,
		STRINGS
	];
	const EXPRESSION_CONTEXT = {
		variants: [
			{
				begin: /=/,
				end: /;/
			},
			{
				begin: /\(/,
				end: /\)/
			},
			{
				beginKeywords: "new throw return else",
				end: /;/
			}
		],
		keywords: CPP_KEYWORDS,
		contains: EXPRESSION_CONTAINS.concat([{
			begin: /\(/,
			end: /\)/,
			keywords: CPP_KEYWORDS,
			contains: EXPRESSION_CONTAINS.concat(["self"]),
			relevance: 0
		}]),
		relevance: 0
	};
	const FUNCTION_DECLARATION = {
		className: "function",
		begin: "(" + FUNCTION_TYPE_RE + "[\\*&\\s]+)+" + FUNCTION_TITLE,
		returnBegin: true,
		end: /[{;=]/,
		excludeEnd: true,
		keywords: CPP_KEYWORDS,
		illegal: /[^\w\s\*&:<>.]/,
		contains: [
			{
				begin: DECLTYPE_AUTO_RE,
				keywords: CPP_KEYWORDS,
				relevance: 0
			},
			{
				begin: FUNCTION_TITLE,
				returnBegin: true,
				contains: [TITLE_MODE],
				relevance: 0
			},
			{
				begin: /::/,
				relevance: 0
			},
			{
				begin: /:/,
				endsWithParent: true,
				contains: [STRINGS, NUMBERS]
			},
			{
				relevance: 0,
				match: /,/
			},
			{
				className: "params",
				begin: /\(/,
				end: /\)/,
				keywords: CPP_KEYWORDS,
				relevance: 0,
				contains: [
					C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE,
					STRINGS,
					NUMBERS,
					CPP_PRIMITIVE_TYPES,
					{
						begin: /\(/,
						end: /\)/,
						keywords: CPP_KEYWORDS,
						relevance: 0,
						contains: [
							"self",
							C_LINE_COMMENT_MODE,
							hljs.C_BLOCK_COMMENT_MODE,
							STRINGS,
							NUMBERS,
							CPP_PRIMITIVE_TYPES
						]
					}
				]
			},
			CPP_PRIMITIVE_TYPES,
			C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			PREPROCESSOR
		]
	};
	return {
		name: "C++",
		aliases: [
			"cc",
			"c++",
			"h++",
			"hpp",
			"hh",
			"hxx",
			"cxx"
		],
		keywords: CPP_KEYWORDS,
		illegal: "</",
		classNameAliases: { "function.dispatch": "built_in" },
		contains: [].concat(EXPRESSION_CONTEXT, FUNCTION_DECLARATION, FUNCTION_DISPATCH, EXPRESSION_CONTAINS, [
			PREPROCESSOR,
			{
				begin: "\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",
				end: ">",
				keywords: CPP_KEYWORDS,
				contains: ["self", CPP_PRIMITIVE_TYPES]
			},
			{
				begin: hljs.IDENT_RE + "::",
				keywords: CPP_KEYWORDS
			},
			{
				match: [
					/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,
					/\s+/,
					/\w+/
				],
				className: {
					1: "keyword",
					3: "title.class"
				}
			}
		])
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/csharp.js
/** @type LanguageFn */
function csharp(hljs) {
	const BUILT_IN_KEYWORDS = [
		"bool",
		"byte",
		"char",
		"decimal",
		"delegate",
		"double",
		"dynamic",
		"enum",
		"float",
		"int",
		"long",
		"nint",
		"nuint",
		"object",
		"sbyte",
		"short",
		"string",
		"ulong",
		"uint",
		"ushort"
	];
	const FUNCTION_MODIFIERS = [
		"public",
		"private",
		"protected",
		"static",
		"internal",
		"protected",
		"abstract",
		"async",
		"extern",
		"override",
		"unsafe",
		"virtual",
		"new",
		"sealed",
		"partial"
	];
	const KEYWORDS = {
		keyword: [
			"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"
		].concat([
			"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"
		]),
		built_in: BUILT_IN_KEYWORDS,
		literal: [
			"default",
			"false",
			"null",
			"true"
		]
	};
	const TITLE_MODE = hljs.inherit(hljs.TITLE_MODE, { begin: "[a-zA-Z](\\.?\\w)*" });
	const NUMBERS = {
		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
	};
	const RAW_STRING = {
		className: "string",
		begin: /"""("*)(?!")(.|\n)*?"""\1/,
		relevance: 1
	};
	const VERBATIM_STRING = {
		className: "string",
		begin: "@\"",
		end: "\"",
		contains: [{ begin: "\"\"" }]
	};
	const VERBATIM_STRING_NO_LF = hljs.inherit(VERBATIM_STRING, { illegal: /\n/ });
	const SUBST = {
		className: "subst",
		begin: /\{/,
		end: /\}/,
		keywords: KEYWORDS
	};
	const SUBST_NO_LF = hljs.inherit(SUBST, { illegal: /\n/ });
	const INTERPOLATED_STRING = {
		className: "string",
		begin: /\$"/,
		end: "\"",
		illegal: /\n/,
		contains: [
			{ begin: /\{\{/ },
			{ begin: /\}\}/ },
			hljs.BACKSLASH_ESCAPE,
			SUBST_NO_LF
		]
	};
	const INTERPOLATED_VERBATIM_STRING = {
		className: "string",
		begin: /\$@"/,
		end: "\"",
		contains: [
			{ begin: /\{\{/ },
			{ begin: /\}\}/ },
			{ begin: "\"\"" },
			SUBST
		]
	};
	const INTERPOLATED_VERBATIM_STRING_NO_LF = hljs.inherit(INTERPOLATED_VERBATIM_STRING, {
		illegal: /\n/,
		contains: [
			{ begin: /\{\{/ },
			{ begin: /\}\}/ },
			{ begin: "\"\"" },
			SUBST_NO_LF
		]
	});
	SUBST.contains = [
		INTERPOLATED_VERBATIM_STRING,
		INTERPOLATED_STRING,
		VERBATIM_STRING,
		hljs.APOS_STRING_MODE,
		hljs.QUOTE_STRING_MODE,
		NUMBERS,
		hljs.C_BLOCK_COMMENT_MODE
	];
	SUBST_NO_LF.contains = [
		INTERPOLATED_VERBATIM_STRING_NO_LF,
		INTERPOLATED_STRING,
		VERBATIM_STRING_NO_LF,
		hljs.APOS_STRING_MODE,
		hljs.QUOTE_STRING_MODE,
		NUMBERS,
		hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, { illegal: /\n/ })
	];
	const STRING = { variants: [
		RAW_STRING,
		INTERPOLATED_VERBATIM_STRING,
		INTERPOLATED_STRING,
		VERBATIM_STRING,
		hljs.APOS_STRING_MODE,
		hljs.QUOTE_STRING_MODE
	] };
	const GENERIC_MODIFIER = {
		begin: "<",
		end: ">",
		contains: [{ beginKeywords: "in out" }, TITLE_MODE]
	};
	const TYPE_IDENT_RE = hljs.IDENT_RE + "(<" + hljs.IDENT_RE + "(\\s*,\\s*" + hljs.IDENT_RE + ")*>)?(\\[\\])?";
	const AT_IDENTIFIER = {
		begin: "@" + hljs.IDENT_RE,
		relevance: 0
	};
	return {
		name: "C#",
		aliases: ["cs", "c#"],
		keywords: KEYWORDS,
		illegal: /::/,
		contains: [
			hljs.COMMENT("///", "$", {
				returnBegin: true,
				contains: [{
					className: "doctag",
					variants: [
						{
							begin: "///",
							relevance: 0
						},
						{ begin: "<!--|-->" },
						{
							begin: "</?",
							end: ">"
						}
					]
				}]
			}),
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			{
				className: "meta",
				begin: "#",
				end: "$",
				keywords: { keyword: "if else elif endif define undef warning error line region endregion pragma checksum" }
			},
			STRING,
			NUMBERS,
			{
				beginKeywords: "class interface",
				relevance: 0,
				end: /[{;=]/,
				illegal: /[^\s:,]/,
				contains: [
					{ beginKeywords: "where class" },
					TITLE_MODE,
					GENERIC_MODIFIER,
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			{
				beginKeywords: "namespace",
				relevance: 0,
				end: /[{;=]/,
				illegal: /[^\s:]/,
				contains: [
					TITLE_MODE,
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			{
				beginKeywords: "record",
				relevance: 0,
				end: /[{;=]/,
				illegal: /[^\s:]/,
				contains: [
					TITLE_MODE,
					GENERIC_MODIFIER,
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			{
				className: "meta",
				begin: "^\\s*\\[(?=[\\w])",
				excludeBegin: true,
				end: "\\]",
				excludeEnd: true,
				contains: [{
					className: "string",
					begin: /"/,
					end: /"/
				}]
			},
			{
				beginKeywords: "new return throw await else",
				relevance: 0
			},
			{
				className: "function",
				begin: "(" + TYPE_IDENT_RE + "\\s+)+" + hljs.IDENT_RE + "\\s*(<[^=]+>\\s*)?\\(",
				returnBegin: true,
				end: /\s*[{;=]/,
				excludeEnd: true,
				keywords: KEYWORDS,
				contains: [
					{
						beginKeywords: FUNCTION_MODIFIERS.join(" "),
						relevance: 0
					},
					{
						begin: hljs.IDENT_RE + "\\s*(<[^=]+>\\s*)?\\(",
						returnBegin: true,
						contains: [hljs.TITLE_MODE, GENERIC_MODIFIER],
						relevance: 0
					},
					{ match: /\(\)/ },
					{
						className: "params",
						begin: /\(/,
						end: /\)/,
						excludeBegin: true,
						excludeEnd: true,
						keywords: KEYWORDS,
						relevance: 0,
						contains: [
							STRING,
							NUMBERS,
							hljs.C_BLOCK_COMMENT_MODE
						]
					},
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			AT_IDENTIFIER
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/css.js
var MODES$2 = (hljs) => {
	return {
		IMPORTANT: {
			scope: "meta",
			begin: "!important"
		},
		BLOCK_COMMENT: hljs.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: [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
		},
		CSS_NUMBER_MODE: {
			scope: "number",
			begin: hljs.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_-]*/
		}
	};
};
var HTML_TAGS$2 = [
	"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"
];
var SVG_TAGS$2 = [
	"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"
];
var TAGS$2 = [...HTML_TAGS$2, ...SVG_TAGS$2];
var MEDIA_FEATURES$2 = [
	"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();
var PSEUDO_CLASSES$2 = [
	"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();
var PSEUDO_ELEMENTS$2 = [
	"after",
	"backdrop",
	"before",
	"cue",
	"cue-region",
	"first-letter",
	"first-line",
	"grammar-error",
	"marker",
	"part",
	"placeholder",
	"selection",
	"slotted",
	"spelling-error"
].sort().reverse();
var ATTRIBUTES$2 = [
	"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();
/** @type LanguageFn */
function css(hljs) {
	const regex = hljs.regex;
	const modes = MODES$2(hljs);
	const VENDOR_PREFIX = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ };
	const AT_MODIFIERS = "and or not only";
	const AT_PROPERTY_RE = /@-?\w[\w]*(-\w+)*/;
	const STRINGS = [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE];
	return {
		name: "CSS",
		case_insensitive: true,
		illegal: /[=|'\$]/,
		keywords: { keyframePosition: "from to" },
		classNameAliases: { keyframePosition: "selector-tag" },
		contains: [
			modes.BLOCK_COMMENT,
			VENDOR_PREFIX,
			modes.CSS_NUMBER_MODE,
			{
				className: "selector-id",
				begin: /#[A-Za-z0-9_-]+/,
				relevance: 0
			},
			{
				className: "selector-class",
				begin: "\\.[a-zA-Z-][a-zA-Z0-9_-]*",
				relevance: 0
			},
			modes.ATTRIBUTE_SELECTOR_MODE,
			{
				className: "selector-pseudo",
				variants: [{ begin: ":(" + PSEUDO_CLASSES$2.join("|") + ")" }, { begin: ":(:)?(" + PSEUDO_ELEMENTS$2.join("|") + ")" }]
			},
			modes.CSS_VARIABLE,
			{
				className: "attribute",
				begin: "\\b(" + ATTRIBUTES$2.join("|") + ")\\b"
			},
			{
				begin: /:/,
				end: /[;}{]/,
				contains: [
					modes.BLOCK_COMMENT,
					modes.HEXCOLOR,
					modes.IMPORTANT,
					modes.CSS_NUMBER_MODE,
					...STRINGS,
					{
						begin: /(url|data-uri)\(/,
						end: /\)/,
						relevance: 0,
						keywords: { built_in: "url data-uri" },
						contains: [...STRINGS, {
							className: "string",
							begin: /[^)]/,
							endsWithParent: true,
							excludeEnd: true
						}]
					},
					modes.FUNCTION_DISPATCH
				]
			},
			{
				begin: regex.lookahead(/@/),
				end: "[{;]",
				relevance: 0,
				illegal: /:/,
				contains: [{
					className: "keyword",
					begin: AT_PROPERTY_RE
				}, {
					begin: /\s/,
					endsWithParent: true,
					excludeEnd: true,
					relevance: 0,
					keywords: {
						$pattern: /[a-z-]+/,
						keyword: AT_MODIFIERS,
						attribute: MEDIA_FEATURES$2.join(" ")
					},
					contains: [
						{
							begin: /[a-z-]+(?=:)/,
							className: "attribute"
						},
						...STRINGS,
						modes.CSS_NUMBER_MODE
					]
				}]
			},
			{
				className: "selector-tag",
				begin: "\\b(" + TAGS$2.join("|") + ")\\b"
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/diff.js
/** @type LanguageFn */
function diff(hljs) {
	const regex = hljs.regex;
	return {
		name: "Diff",
		aliases: ["patch"],
		contains: [
			{
				className: "meta",
				relevance: 10,
				match: regex.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/, /^\*\*\* +\d+,\d+ +\*\*\*\*$/, /^--- +\d+,\d+ +----$/)
			},
			{
				className: "comment",
				variants: [{
					begin: regex.either(/Index: /, /^index/, /={3,}/, /^-{3}/, /^\*{3} /, /^\+{3}/, /^diff --git/),
					end: /$/
				}, { match: /^\*{15}$/ }]
			},
			{
				className: "addition",
				begin: /^\+/,
				end: /$/
			},
			{
				className: "deletion",
				begin: /^-/,
				end: /$/
			},
			{
				className: "addition",
				begin: /^!/,
				end: /$/
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/go.js
function go(hljs) {
	const KEYWORDS = {
		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: KEYWORDS,
		illegal: "</",
		contains: [
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			{
				className: "string",
				variants: [
					hljs.QUOTE_STRING_MODE,
					hljs.APOS_STRING_MODE,
					{
						begin: "`",
						end: "`"
					}
				]
			},
			{
				className: "number",
				variants: [
					{
						match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,
						relevance: 0
					},
					{
						match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,
						relevance: 0
					},
					{
						match: /-?\b0[oO](_?[0-7])*i?/,
						relevance: 0
					},
					{
						match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,
						relevance: 0
					},
					{
						match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,
						relevance: 0
					}
				]
			},
			{ begin: /:=/ },
			{
				className: "function",
				beginKeywords: "func",
				end: "\\s*(\\{|$)",
				excludeEnd: true,
				contains: [hljs.TITLE_MODE, {
					className: "params",
					begin: /\(/,
					end: /\)/,
					endsParent: true,
					keywords: KEYWORDS,
					illegal: /["']/
				}]
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/graphql.js
/** @type LanguageFn */
function graphql(hljs) {
	const regex = hljs.regex;
	return {
		name: "GraphQL",
		aliases: ["gql"],
		case_insensitive: true,
		disableAutodetect: false,
		keywords: {
			keyword: [
				"query",
				"mutation",
				"subscription",
				"type",
				"input",
				"schema",
				"directive",
				"interface",
				"union",
				"scalar",
				"fragment",
				"enum",
				"on"
			],
			literal: [
				"true",
				"false",
				"null"
			]
		},
		contains: [
			hljs.HASH_COMMENT_MODE,
			hljs.QUOTE_STRING_MODE,
			hljs.NUMBER_MODE,
			{
				scope: "punctuation",
				match: /[.]{3}/,
				relevance: 0
			},
			{
				scope: "punctuation",
				begin: /[\!\(\)\:\=\[\]\{\|\}]{1}/,
				relevance: 0
			},
			{
				scope: "variable",
				begin: /\$/,
				end: /\W/,
				excludeEnd: true,
				relevance: 0
			},
			{
				scope: "meta",
				match: /@\w+/,
				excludeEnd: true
			},
			{
				scope: "symbol",
				begin: regex.concat(/[_A-Za-z][_0-9A-Za-z]*/, regex.lookahead(/\s*:/)),
				relevance: 0
			}
		],
		illegal: [/[;<']/, /BEGIN/]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/ini.js
function ini(hljs) {
	const regex = hljs.regex;
	const NUMBERS = {
		className: "number",
		relevance: 0,
		variants: [{ begin: /([+-]+)?[\d]+_[\d_]+/ }, { begin: hljs.NUMBER_RE }]
	};
	const COMMENTS = hljs.COMMENT();
	COMMENTS.variants = [{
		begin: /;/,
		end: /$/
	}, {
		begin: /#/,
		end: /$/
	}];
	const VARIABLES = {
		className: "variable",
		variants: [{ begin: /\$[\w\d"][\w\d_]*/ }, { begin: /\$\{(.*?)\}/ }]
	};
	const LITERALS = {
		className: "literal",
		begin: /\bon|off|true|false|yes|no\b/
	};
	const STRINGS = {
		className: "string",
		contains: [hljs.BACKSLASH_ESCAPE],
		variants: [
			{
				begin: "'''",
				end: "'''",
				relevance: 10
			},
			{
				begin: "\"\"\"",
				end: "\"\"\"",
				relevance: 10
			},
			{
				begin: "\"",
				end: "\""
			},
			{
				begin: "'",
				end: "'"
			}
		]
	};
	const ARRAY = {
		begin: /\[/,
		end: /\]/,
		contains: [
			COMMENTS,
			LITERALS,
			VARIABLES,
			STRINGS,
			NUMBERS,
			"self"
		],
		relevance: 0
	};
	const ANY_KEY = regex.either(/[A-Za-z0-9_-]+/, /"(\\"|[^"])*"/, /'[^']*'/);
	return {
		name: "TOML, also INI",
		aliases: ["toml"],
		case_insensitive: true,
		illegal: /\S/,
		contains: [
			COMMENTS,
			{
				className: "section",
				begin: /\[+/,
				end: /\]+/
			},
			{
				begin: regex.concat(ANY_KEY, "(\\s*\\.\\s*", ANY_KEY, ")*", regex.lookahead(/\s*=\s*[^#\s]/)),
				className: "attr",
				starts: {
					end: /$/,
					contains: [
						COMMENTS,
						ARRAY,
						LITERALS,
						VARIABLES,
						STRINGS,
						NUMBERS
					]
				}
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/java.js
var decimalDigits$1 = "[0-9](_*[0-9])*";
var frac$1 = `\\.(${decimalDigits$1})`;
var hexDigits$1 = "[0-9a-fA-F](_*[0-9a-fA-F])*";
var NUMERIC$1 = {
	className: "number",
	variants: [
		{ begin: `(\\b(${decimalDigits$1})((${frac$1})|\\.)?|(${frac$1}))[eE][+-]?(${decimalDigits$1})[fFdD]?\\b` },
		{ begin: `\\b(${decimalDigits$1})((${frac$1})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
		{ begin: `(${frac$1})[fFdD]?\\b` },
		{ begin: `\\b(${decimalDigits$1})[fFdD]\\b` },
		{ begin: `\\b0[xX]((${hexDigits$1})\\.?|(${hexDigits$1})?\\.(${hexDigits$1}))[pP][+-]?(${decimalDigits$1})[fFdD]?\\b` },
		{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
		{ begin: `\\b0[xX](${hexDigits$1})[lL]?\\b` },
		{ begin: "\\b0(_*[0-7])*[lL]?\\b" },
		{ begin: "\\b0[bB][01](_*[01])*[lL]?\\b" }
	],
	relevance: 0
};
/**
* Allows recursive regex expressions to a given depth
*
* ie: recurRegex("(abc~~~)", /~~~/g, 2) becomes:
* (abc(abc(abc)))
*
* @param {string} re
* @param {RegExp} substitution (should be a g mode regex)
* @param {number} depth
* @returns {string}``
*/
function recurRegex(re, substitution, depth) {
	if (depth === -1) return "";
	return re.replace(substitution, (_) => {
		return recurRegex(re, substitution, depth - 1);
	});
}
/** @type LanguageFn */
function java(hljs) {
	const regex = hljs.regex;
	const JAVA_IDENT_RE = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*";
	const GENERIC_IDENT_RE = JAVA_IDENT_RE + recurRegex("(?:<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?", /~~~/g, 2);
	const KEYWORDS = {
		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"]
	};
	const ANNOTATION = {
		className: "meta",
		begin: "@[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",
		contains: [{
			begin: /\(/,
			end: /\)/,
			contains: ["self"]
		}]
	};
	const PARAMS = {
		className: "params",
		begin: /\(/,
		end: /\)/,
		keywords: KEYWORDS,
		relevance: 0,
		contains: [hljs.C_BLOCK_COMMENT_MODE],
		endsParent: true
	};
	return {
		name: "Java",
		aliases: ["jsp"],
		keywords: KEYWORDS,
		illegal: /<\/|#/,
		contains: [
			hljs.COMMENT("/\\*\\*", "\\*/", {
				relevance: 0,
				contains: [{
					begin: /\w+@/,
					relevance: 0
				}, {
					className: "doctag",
					begin: "@[A-Za-z]+"
				}]
			}),
			{
				begin: /import java\.[a-z]+\./,
				keywords: "import",
				relevance: 2
			},
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			{
				begin: /"""/,
				end: /"""/,
				className: "string",
				contains: [hljs.BACKSLASH_ESCAPE]
			},
			hljs.APOS_STRING_MODE,
			hljs.QUOTE_STRING_MODE,
			{
				match: [
					/\b(?:class|interface|enum|extends|implements|new)/,
					/\s+/,
					JAVA_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "title.class"
				}
			},
			{
				match: /non-sealed/,
				scope: "keyword"
			},
			{
				begin: [
					regex.concat(/(?!else)/, JAVA_IDENT_RE),
					/\s+/,
					JAVA_IDENT_RE,
					/\s+/,
					/=(?!=)/
				],
				className: {
					1: "type",
					3: "variable",
					5: "operator"
				}
			},
			{
				begin: [
					/record/,
					/\s+/,
					JAVA_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "title.class"
				},
				contains: [
					PARAMS,
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			{
				beginKeywords: "new throw return else",
				relevance: 0
			},
			{
				begin: [
					"(?:" + GENERIC_IDENT_RE + "\\s+)",
					hljs.UNDERSCORE_IDENT_RE,
					/\s*(?=\()/
				],
				className: { 2: "title.function" },
				keywords: KEYWORDS,
				contains: [
					{
						className: "params",
						begin: /\(/,
						end: /\)/,
						keywords: KEYWORDS,
						relevance: 0,
						contains: [
							ANNOTATION,
							hljs.APOS_STRING_MODE,
							hljs.QUOTE_STRING_MODE,
							NUMERIC$1,
							hljs.C_BLOCK_COMMENT_MODE
						]
					},
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			NUMERIC$1,
			ANNOTATION
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/javascript.js
var IDENT_RE$2 = "[A-Za-z$_][0-9A-Za-z$_]*";
var KEYWORDS$2 = [
	"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"
];
var LITERALS$1 = [
	"true",
	"false",
	"null",
	"undefined",
	"NaN",
	"Infinity"
];
var TYPES$1 = [
	"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"
];
var ERROR_TYPES$1 = [
	"Error",
	"EvalError",
	"InternalError",
	"RangeError",
	"ReferenceError",
	"SyntaxError",
	"TypeError",
	"URIError"
];
var BUILT_IN_GLOBALS$1 = [
	"setInterval",
	"setTimeout",
	"clearInterval",
	"clearTimeout",
	"require",
	"exports",
	"eval",
	"isFinite",
	"isNaN",
	"parseFloat",
	"parseInt",
	"decodeURI",
	"decodeURIComponent",
	"encodeURI",
	"encodeURIComponent",
	"escape",
	"unescape"
];
var BUILT_IN_VARIABLES$1 = [
	"arguments",
	"this",
	"super",
	"console",
	"window",
	"document",
	"localStorage",
	"sessionStorage",
	"module",
	"global"
];
var BUILT_INS$1 = [].concat(BUILT_IN_GLOBALS$1, TYPES$1, ERROR_TYPES$1);
/** @type LanguageFn */
function javascript$1(hljs) {
	const regex = hljs.regex;
	/**
	* Takes a string like "<Booger" and checks to see
	* if we can find a matching "</Booger" later in the
	* content.
	* @param {RegExpMatchArray} match
	* @param {{after:number}} param1
	*/
	const hasClosingTag = (match, { after }) => {
		const tag = "</" + match[0].slice(1);
		return match.input.indexOf(tag, after) !== -1;
	};
	const IDENT_RE$1 = IDENT_RE$2;
	const FRAGMENT = {
		begin: "<>",
		end: "</>"
	};
	const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
	const XML_TAG = {
		begin: /<[A-Za-z0-9\\._:-]+/,
		end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
		/**
		* @param {RegExpMatchArray} match
		* @param {CallbackResponse} response
		*/
		isTrulyOpeningTag: (match, response) => {
			const afterMatchIndex = match[0].length + match.index;
			const nextChar = match.input[afterMatchIndex];
			if (nextChar === "<" || nextChar === ",") {
				response.ignoreMatch();
				return;
			}
			if (nextChar === ">") {
				if (!hasClosingTag(match, { after: afterMatchIndex })) response.ignoreMatch();
			}
			let m;
			const afterMatch = match.input.substring(afterMatchIndex);
			if (m = afterMatch.match(/^\s*=/)) {
				response.ignoreMatch();
				return;
			}
			if (m = afterMatch.match(/^\s+extends\s+/)) {
				if (m.index === 0) {
					response.ignoreMatch();
					return;
				}
			}
		}
	};
	const KEYWORDS$1 = {
		$pattern: IDENT_RE$2,
		keyword: KEYWORDS$2,
		literal: LITERALS$1,
		built_in: BUILT_INS$1,
		"variable.language": BUILT_IN_VARIABLES$1
	};
	const decimalDigits = "[0-9](_?[0-9])*";
	const frac = `\\.(${decimalDigits})`;
	const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
	const NUMBER = {
		className: "number",
		variants: [
			{ begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
			{ begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\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
	};
	const SUBST = {
		className: "subst",
		begin: "\\$\\{",
		end: "\\}",
		keywords: KEYWORDS$1,
		contains: []
	};
	const HTML_TEMPLATE = {
		begin: ".?html`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "xml"
		}
	};
	const CSS_TEMPLATE = {
		begin: ".?css`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "css"
		}
	};
	const GRAPHQL_TEMPLATE = {
		begin: ".?gql`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "graphql"
		}
	};
	const TEMPLATE_STRING = {
		className: "string",
		begin: "`",
		end: "`",
		contains: [hljs.BACKSLASH_ESCAPE, SUBST]
	};
	const COMMENT = {
		className: "comment",
		variants: [
			hljs.COMMENT(/\/\*\*(?!\/)/, "\\*/", {
				relevance: 0,
				contains: [{
					begin: "(?=@[A-Za-z]+)",
					relevance: 0,
					contains: [
						{
							className: "doctag",
							begin: "@[A-Za-z]+"
						},
						{
							className: "type",
							begin: "\\{",
							end: "\\}",
							excludeEnd: true,
							excludeBegin: true,
							relevance: 0
						},
						{
							className: "variable",
							begin: "[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)",
							endsParent: true,
							relevance: 0
						},
						{
							begin: /(?=[^\n])\s/,
							relevance: 0
						}
					]
				}]
			}),
			hljs.C_BLOCK_COMMENT_MODE,
			hljs.C_LINE_COMMENT_MODE
		]
	};
	const SUBST_INTERNALS = [
		hljs.APOS_STRING_MODE,
		hljs.QUOTE_STRING_MODE,
		HTML_TEMPLATE,
		CSS_TEMPLATE,
		GRAPHQL_TEMPLATE,
		TEMPLATE_STRING,
		{ match: /\$\d+/ },
		NUMBER
	];
	SUBST.contains = SUBST_INTERNALS.concat({
		begin: /\{/,
		end: /\}/,
		keywords: KEYWORDS$1,
		contains: ["self"].concat(SUBST_INTERNALS)
	});
	const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
	const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([{
		begin: /(\s*)\(/,
		end: /\)/,
		keywords: KEYWORDS$1,
		contains: ["self"].concat(SUBST_AND_COMMENTS)
	}]);
	const PARAMS = {
		className: "params",
		begin: /(\s*)\(/,
		end: /\)/,
		excludeBegin: true,
		excludeEnd: true,
		keywords: KEYWORDS$1,
		contains: PARAMS_CONTAINS
	};
	const CLASS_OR_EXTENDS = { variants: [{
		match: [
			/class/,
			/\s+/,
			IDENT_RE$1,
			/\s+/,
			/extends/,
			/\s+/,
			regex.concat(IDENT_RE$1, "(", regex.concat(/\./, IDENT_RE$1), ")*")
		],
		scope: {
			1: "keyword",
			3: "title.class",
			5: "keyword",
			7: "title.class.inherited"
		}
	}, {
		match: [
			/class/,
			/\s+/,
			IDENT_RE$1
		],
		scope: {
			1: "keyword",
			3: "title.class"
		}
	}] };
	const CLASS_REFERENCE = {
		relevance: 0,
		match: regex.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: { _: [...TYPES$1, ...ERROR_TYPES$1] }
	};
	const USE_STRICT = {
		label: "use_strict",
		className: "meta",
		relevance: 10,
		begin: /^\s*['"]use (strict|asm)['"]/
	};
	const FUNCTION_DEFINITION = {
		variants: [{ match: [
			/function/,
			/\s+/,
			IDENT_RE$1,
			/(?=\s*\()/
		] }, { match: [/function/, /\s*(?=\()/] }],
		className: {
			1: "keyword",
			3: "title.function"
		},
		label: "func.def",
		contains: [PARAMS],
		illegal: /%/
	};
	const UPPER_CASE_CONSTANT = {
		relevance: 0,
		match: /\b[A-Z][A-Z_0-9]+\b/,
		className: "variable.constant"
	};
	function noneOf(list) {
		return regex.concat("(?!", list.join("|"), ")");
	}
	const FUNCTION_CALL = {
		match: regex.concat(/\b/, noneOf([
			...BUILT_IN_GLOBALS$1,
			"super",
			"import"
		].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex.lookahead(/\s*\(/)),
		className: "title.function",
		relevance: 0
	};
	const PROPERTY_ACCESS = {
		begin: regex.concat(/\./, regex.lookahead(regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
		end: IDENT_RE$1,
		excludeBegin: true,
		keywords: "prototype",
		className: "property",
		relevance: 0
	};
	const GETTER_OR_SETTER = {
		match: [
			/get|set/,
			/\s+/,
			IDENT_RE$1,
			/(?=\()/
		],
		className: {
			1: "keyword",
			3: "title.function"
		},
		contains: [{ begin: /\(\)/ }, PARAMS]
	};
	const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
	const FUNCTION_VARIABLE = {
		match: [
			/const|var|let/,
			/\s+/,
			IDENT_RE$1,
			/\s*/,
			/=\s*/,
			/(async\s*)?/,
			regex.lookahead(FUNC_LEAD_IN_RE)
		],
		keywords: "async",
		className: {
			1: "keyword",
			3: "title.function"
		},
		contains: [PARAMS]
	};
	return {
		name: "JavaScript",
		aliases: [
			"js",
			"jsx",
			"mjs",
			"cjs"
		],
		keywords: KEYWORDS$1,
		exports: {
			PARAMS_CONTAINS,
			CLASS_REFERENCE
		},
		illegal: /#(?![$_A-z])/,
		contains: [
			hljs.SHEBANG({
				label: "shebang",
				binary: "node",
				relevance: 5
			}),
			USE_STRICT,
			hljs.APOS_STRING_MODE,
			hljs.QUOTE_STRING_MODE,
			HTML_TEMPLATE,
			CSS_TEMPLATE,
			GRAPHQL_TEMPLATE,
			TEMPLATE_STRING,
			COMMENT,
			{ match: /\$\d+/ },
			NUMBER,
			CLASS_REFERENCE,
			{
				scope: "attr",
				match: IDENT_RE$1 + regex.lookahead(":"),
				relevance: 0
			},
			FUNCTION_VARIABLE,
			{
				begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
				keywords: "return throw case",
				relevance: 0,
				contains: [
					COMMENT,
					hljs.REGEXP_MODE,
					{
						className: "function",
						begin: FUNC_LEAD_IN_RE,
						returnBegin: true,
						end: "\\s*=>",
						contains: [{
							className: "params",
							variants: [
								{
									begin: hljs.UNDERSCORE_IDENT_RE,
									relevance: 0
								},
								{
									className: null,
									begin: /\(\s*\)/,
									skip: true
								},
								{
									begin: /(\s*)\(/,
									end: /\)/,
									excludeBegin: true,
									excludeEnd: true,
									keywords: KEYWORDS$1,
									contains: PARAMS_CONTAINS
								}
							]
						}]
					},
					{
						begin: /,/,
						relevance: 0
					},
					{
						match: /\s+/,
						relevance: 0
					},
					{
						variants: [
							{
								begin: FRAGMENT.begin,
								end: FRAGMENT.end
							},
							{ match: XML_SELF_CLOSING },
							{
								begin: XML_TAG.begin,
								"on:begin": XML_TAG.isTrulyOpeningTag,
								end: XML_TAG.end
							}
						],
						subLanguage: "xml",
						contains: [{
							begin: XML_TAG.begin,
							end: XML_TAG.end,
							skip: true,
							contains: ["self"]
						}]
					}
				]
			},
			FUNCTION_DEFINITION,
			{ beginKeywords: "while if switch catch for" },
			{
				begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
				returnBegin: true,
				label: "func.def",
				contains: [PARAMS, hljs.inherit(hljs.TITLE_MODE, {
					begin: IDENT_RE$1,
					className: "title.function"
				})]
			},
			{
				match: /\.\.\./,
				relevance: 0
			},
			PROPERTY_ACCESS,
			{
				match: "\\$[A-Za-z$_][0-9A-Za-z$_]*",
				relevance: 0
			},
			{
				match: [/\bconstructor(?=\s*\()/],
				className: { 1: "title.function" },
				contains: [PARAMS]
			},
			FUNCTION_CALL,
			UPPER_CASE_CONSTANT,
			CLASS_OR_EXTENDS,
			GETTER_OR_SETTER,
			{ match: /\$[(.]/ }
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/json.js
function json(hljs) {
	const ATTRIBUTE = {
		className: "attr",
		begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,
		relevance: 1.01
	};
	const PUNCTUATION = {
		match: /[{}[\],:]/,
		className: "punctuation",
		relevance: 0
	};
	const LITERALS = [
		"true",
		"false",
		"null"
	];
	const LITERALS_MODE = {
		scope: "literal",
		beginKeywords: LITERALS.join(" ")
	};
	return {
		name: "JSON",
		aliases: ["jsonc"],
		keywords: { literal: LITERALS },
		contains: [
			ATTRIBUTE,
			PUNCTUATION,
			hljs.QUOTE_STRING_MODE,
			LITERALS_MODE,
			hljs.C_NUMBER_MODE,
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE
		],
		illegal: "\\S"
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/kotlin.js
var decimalDigits = "[0-9](_*[0-9])*";
var frac = `\\.(${decimalDigits})`;
var hexDigits = "[0-9a-fA-F](_*[0-9a-fA-F])*";
var NUMERIC = {
	className: "number",
	variants: [
		{ begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})[fFdD]?\\b` },
		{ begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
		{ begin: `(${frac})[fFdD]?\\b` },
		{ begin: `\\b(${decimalDigits})[fFdD]\\b` },
		{ begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))[pP][+-]?(${decimalDigits})[fFdD]?\\b` },
		{ begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
		{ begin: `\\b0[xX](${hexDigits})[lL]?\\b` },
		{ begin: "\\b0(_*[0-7])*[lL]?\\b" },
		{ begin: "\\b0[bB][01](_*[01])*[lL]?\\b" }
	],
	relevance: 0
};
function kotlin(hljs) {
	const KEYWORDS = {
		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"
	};
	const KEYWORDS_WITH_LABEL = {
		className: "keyword",
		begin: /\b(break|continue|return|this)\b/,
		starts: { contains: [{
			className: "symbol",
			begin: /@\w+/
		}] }
	};
	const LABEL = {
		className: "symbol",
		begin: hljs.UNDERSCORE_IDENT_RE + "@"
	};
	const SUBST = {
		className: "subst",
		begin: /\$\{/,
		end: /\}/,
		contains: [hljs.C_NUMBER_MODE]
	};
	const VARIABLE = {
		className: "variable",
		begin: "\\$" + hljs.UNDERSCORE_IDENT_RE
	};
	const STRING = {
		className: "string",
		variants: [
			{
				begin: "\"\"\"",
				end: "\"\"\"(?=[^\"])",
				contains: [VARIABLE, SUBST]
			},
			{
				begin: "'",
				end: "'",
				illegal: /\n/,
				contains: [hljs.BACKSLASH_ESCAPE]
			},
			{
				begin: "\"",
				end: "\"",
				illegal: /\n/,
				contains: [
					hljs.BACKSLASH_ESCAPE,
					VARIABLE,
					SUBST
				]
			}
		]
	};
	SUBST.contains.push(STRING);
	const ANNOTATION_USE_SITE = {
		className: "meta",
		begin: "@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*" + hljs.UNDERSCORE_IDENT_RE + ")?"
	};
	const ANNOTATION = {
		className: "meta",
		begin: "@" + hljs.UNDERSCORE_IDENT_RE,
		contains: [{
			begin: /\(/,
			end: /\)/,
			contains: [hljs.inherit(STRING, { className: "string" }), "self"]
		}]
	};
	const KOTLIN_NUMBER_MODE = NUMERIC;
	const KOTLIN_NESTED_COMMENT = hljs.COMMENT("/\\*", "\\*/", { contains: [hljs.C_BLOCK_COMMENT_MODE] });
	const KOTLIN_PAREN_TYPE = { variants: [{
		className: "type",
		begin: hljs.UNDERSCORE_IDENT_RE
	}, {
		begin: /\(/,
		end: /\)/,
		contains: []
	}] };
	const KOTLIN_PAREN_TYPE2 = KOTLIN_PAREN_TYPE;
	KOTLIN_PAREN_TYPE2.variants[1].contains = [KOTLIN_PAREN_TYPE];
	KOTLIN_PAREN_TYPE.variants[1].contains = [KOTLIN_PAREN_TYPE2];
	return {
		name: "Kotlin",
		aliases: ["kt", "kts"],
		keywords: KEYWORDS,
		contains: [
			hljs.COMMENT("/\\*\\*", "\\*/", {
				relevance: 0,
				contains: [{
					className: "doctag",
					begin: "@[A-Za-z]+"
				}]
			}),
			hljs.C_LINE_COMMENT_MODE,
			KOTLIN_NESTED_COMMENT,
			KEYWORDS_WITH_LABEL,
			LABEL,
			ANNOTATION_USE_SITE,
			ANNOTATION,
			{
				className: "function",
				beginKeywords: "fun",
				end: "[(]|$",
				returnBegin: true,
				excludeEnd: true,
				keywords: KEYWORDS,
				relevance: 5,
				contains: [
					{
						begin: hljs.UNDERSCORE_IDENT_RE + "\\s*\\(",
						returnBegin: true,
						relevance: 0,
						contains: [hljs.UNDERSCORE_TITLE_MODE]
					},
					{
						className: "type",
						begin: /</,
						end: />/,
						keywords: "reified",
						relevance: 0
					},
					{
						className: "params",
						begin: /\(/,
						end: /\)/,
						endsParent: true,
						keywords: KEYWORDS,
						relevance: 0,
						contains: [
							{
								begin: /:/,
								end: /[=,\/]/,
								endsWithParent: true,
								contains: [
									KOTLIN_PAREN_TYPE,
									hljs.C_LINE_COMMENT_MODE,
									KOTLIN_NESTED_COMMENT
								],
								relevance: 0
							},
							hljs.C_LINE_COMMENT_MODE,
							KOTLIN_NESTED_COMMENT,
							ANNOTATION_USE_SITE,
							ANNOTATION,
							STRING,
							hljs.C_NUMBER_MODE
						]
					},
					KOTLIN_NESTED_COMMENT
				]
			},
			{
				begin: [
					/class|interface|trait/,
					/\s+/,
					hljs.UNDERSCORE_IDENT_RE
				],
				beginScope: { 3: "title.class" },
				keywords: "class interface trait",
				end: /[:\{(]|$/,
				excludeEnd: true,
				illegal: "extends implements",
				contains: [
					{ beginKeywords: "public protected internal private constructor" },
					hljs.UNDERSCORE_TITLE_MODE,
					{
						className: "type",
						begin: /</,
						end: />/,
						excludeBegin: true,
						excludeEnd: true,
						relevance: 0
					},
					{
						className: "type",
						begin: /[,:]\s*/,
						end: /[<\(,){\s]|$/,
						excludeBegin: true,
						returnEnd: true
					},
					ANNOTATION_USE_SITE,
					ANNOTATION
				]
			},
			STRING,
			{
				className: "meta",
				begin: "^#!/usr/bin/env",
				end: "$",
				illegal: "\n"
			},
			KOTLIN_NUMBER_MODE
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/less.js
var MODES$1 = (hljs) => {
	return {
		IMPORTANT: {
			scope: "meta",
			begin: "!important"
		},
		BLOCK_COMMENT: hljs.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: [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
		},
		CSS_NUMBER_MODE: {
			scope: "number",
			begin: hljs.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_-]*/
		}
	};
};
var HTML_TAGS$1 = [
	"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"
];
var SVG_TAGS$1 = [
	"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"
];
var TAGS$1 = [...HTML_TAGS$1, ...SVG_TAGS$1];
var MEDIA_FEATURES$1 = [
	"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();
var PSEUDO_CLASSES$1 = [
	"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();
var PSEUDO_ELEMENTS$1 = [
	"after",
	"backdrop",
	"before",
	"cue",
	"cue-region",
	"first-letter",
	"first-line",
	"grammar-error",
	"marker",
	"part",
	"placeholder",
	"selection",
	"slotted",
	"spelling-error"
].sort().reverse();
var ATTRIBUTES$1 = [
	"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();
var PSEUDO_SELECTORS = PSEUDO_CLASSES$1.concat(PSEUDO_ELEMENTS$1).sort().reverse();
/** @type LanguageFn */
function less(hljs) {
	const modes = MODES$1(hljs);
	const PSEUDO_SELECTORS$1 = PSEUDO_SELECTORS;
	const AT_MODIFIERS = "and or not only";
	const INTERP_IDENT_RE = "([\\w-]+|@\\{[\\w-]+\\})";
	const RULES = [];
	const VALUE_MODES = [];
	const STRING_MODE = function(c) {
		return {
			className: "string",
			begin: "~?" + c + ".*?" + c
		};
	};
	const IDENT_MODE = function(name, begin, relevance) {
		return {
			className: name,
			begin,
			relevance
		};
	};
	const AT_KEYWORDS = {
		$pattern: /[a-z-]+/,
		keyword: AT_MODIFIERS,
		attribute: MEDIA_FEATURES$1.join(" ")
	};
	const PARENS_MODE = {
		begin: "\\(",
		end: "\\)",
		contains: VALUE_MODES,
		keywords: AT_KEYWORDS,
		relevance: 0
	};
	VALUE_MODES.push(hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, STRING_MODE("'"), STRING_MODE("\""), modes.CSS_NUMBER_MODE, {
		begin: "(url|data-uri)\\(",
		starts: {
			className: "string",
			end: "[\\)\\n]",
			excludeEnd: true
		}
	}, modes.HEXCOLOR, PARENS_MODE, IDENT_MODE("variable", "@@?[\\w-]+", 10), IDENT_MODE("variable", "@\\{[\\w-]+\\}"), IDENT_MODE("built_in", "~?`[^`]*?`"), {
		className: "attribute",
		begin: "[\\w-]+\\s*:",
		end: ":",
		returnBegin: true,
		excludeEnd: true
	}, modes.IMPORTANT, { beginKeywords: "and not" }, modes.FUNCTION_DISPATCH);
	const VALUE_WITH_RULESETS = VALUE_MODES.concat({
		begin: /\{/,
		end: /\}/,
		contains: RULES
	});
	const MIXIN_GUARD_MODE = {
		beginKeywords: "when",
		endsWithParent: true,
		contains: [{ beginKeywords: "and not" }].concat(VALUE_MODES)
	};
	const RULE_MODE = {
		begin: "([\\w-]+|@\\{[\\w-]+\\})\\s*:",
		returnBegin: true,
		end: /[;}]/,
		relevance: 0,
		contains: [
			{ begin: /-(webkit|moz|ms|o)-/ },
			modes.CSS_VARIABLE,
			{
				className: "attribute",
				begin: "\\b(" + ATTRIBUTES$1.join("|") + ")\\b",
				end: /(?=:)/,
				starts: {
					endsWithParent: true,
					illegal: "[<=$]",
					relevance: 0,
					contains: VALUE_MODES
				}
			}
		]
	};
	const AT_RULE_MODE = {
		className: "keyword",
		begin: "@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",
		starts: {
			end: "[;{}]",
			keywords: AT_KEYWORDS,
			returnEnd: true,
			contains: VALUE_MODES,
			relevance: 0
		}
	};
	const VAR_RULE_MODE = {
		className: "variable",
		variants: [{
			begin: "@[\\w-]+\\s*:",
			relevance: 15
		}, { begin: "@[\\w-]+" }],
		starts: {
			end: "[;}]",
			returnEnd: true,
			contains: VALUE_WITH_RULESETS
		}
	};
	const SELECTOR_MODE = {
		variants: [{
			begin: "[\\.#:&\\[>]",
			end: "[;{}]"
		}, {
			begin: INTERP_IDENT_RE,
			end: /\{/
		}],
		returnBegin: true,
		returnEnd: true,
		illegal: "[<='$\"]",
		relevance: 0,
		contains: [
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			MIXIN_GUARD_MODE,
			IDENT_MODE("keyword", "all\\b"),
			IDENT_MODE("variable", "@\\{[\\w-]+\\}"),
			{
				begin: "\\b(" + TAGS$1.join("|") + ")\\b",
				className: "selector-tag"
			},
			modes.CSS_NUMBER_MODE,
			IDENT_MODE("selector-tag", INTERP_IDENT_RE, 0),
			IDENT_MODE("selector-id", "#([\\w-]+|@\\{[\\w-]+\\})"),
			IDENT_MODE("selector-class", "\\.([\\w-]+|@\\{[\\w-]+\\})", 0),
			IDENT_MODE("selector-tag", "&", 0),
			modes.ATTRIBUTE_SELECTOR_MODE,
			{
				className: "selector-pseudo",
				begin: ":(" + PSEUDO_CLASSES$1.join("|") + ")"
			},
			{
				className: "selector-pseudo",
				begin: ":(:)?(" + PSEUDO_ELEMENTS$1.join("|") + ")"
			},
			{
				begin: /\(/,
				end: /\)/,
				relevance: 0,
				contains: VALUE_WITH_RULESETS
			},
			{ begin: "!important" },
			modes.FUNCTION_DISPATCH
		]
	};
	const PSEUDO_SELECTOR_MODE = {
		begin: `[\\w-]+:(:)?(${PSEUDO_SELECTORS$1.join("|")})`,
		returnBegin: true,
		contains: [SELECTOR_MODE]
	};
	RULES.push(hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, AT_RULE_MODE, VAR_RULE_MODE, PSEUDO_SELECTOR_MODE, RULE_MODE, SELECTOR_MODE, MIXIN_GUARD_MODE, modes.FUNCTION_DISPATCH);
	return {
		name: "Less",
		case_insensitive: true,
		illegal: "[=>'/<($\"]",
		contains: RULES
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/lua.js
function lua(hljs) {
	const OPENING_LONG_BRACKET = "\\[=*\\[";
	const CLOSING_LONG_BRACKET = "\\]=*\\]";
	const LONG_BRACKETS = {
		begin: OPENING_LONG_BRACKET,
		end: CLOSING_LONG_BRACKET,
		contains: ["self"]
	};
	const COMMENTS = [hljs.COMMENT("--(?!\\[=*\\[)", "$"), hljs.COMMENT("--\\[=*\\[", CLOSING_LONG_BRACKET, {
		contains: [LONG_BRACKETS],
		relevance: 10
	})];
	return {
		name: "Lua",
		aliases: ["pluto"],
		keywords: {
			$pattern: hljs.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: COMMENTS.concat([
			{
				className: "function",
				beginKeywords: "function",
				end: "\\)",
				contains: [hljs.inherit(hljs.TITLE_MODE, { begin: "([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*" }), {
					className: "params",
					begin: "\\(",
					endsWithParent: true,
					contains: COMMENTS
				}].concat(COMMENTS)
			},
			hljs.C_NUMBER_MODE,
			hljs.APOS_STRING_MODE,
			hljs.QUOTE_STRING_MODE,
			{
				className: "string",
				begin: OPENING_LONG_BRACKET,
				end: CLOSING_LONG_BRACKET,
				contains: [LONG_BRACKETS],
				relevance: 5
			}
		])
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/makefile.js
function makefile(hljs) {
	const VARIABLE = {
		className: "variable",
		variants: [{
			begin: "\\$\\(" + hljs.UNDERSCORE_IDENT_RE + "\\)",
			contains: [hljs.BACKSLASH_ESCAPE]
		}, { begin: /\$[@%<?\^\+\*]/ }]
	};
	const QUOTE_STRING = {
		className: "string",
		begin: /"/,
		end: /"/,
		contains: [hljs.BACKSLASH_ESCAPE, VARIABLE]
	};
	const FUNC = {
		className: "variable",
		begin: /\$\([\w-]+\s/,
		end: /\)/,
		keywords: { built_in: "subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value" },
		contains: [VARIABLE, QUOTE_STRING]
	};
	const ASSIGNMENT = { begin: "^" + hljs.UNDERSCORE_IDENT_RE + "\\s*(?=[:+?]?=)" };
	const META = {
		className: "meta",
		begin: /^\.PHONY:/,
		end: /$/,
		keywords: {
			$pattern: /[\.\w]+/,
			keyword: ".PHONY"
		}
	};
	const TARGET = {
		className: "section",
		begin: /^[^\s]+:/,
		end: /$/,
		contains: [VARIABLE]
	};
	return {
		name: "Makefile",
		aliases: [
			"mk",
			"mak",
			"make"
		],
		keywords: {
			$pattern: /[\w-]+/,
			keyword: "define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"
		},
		contains: [
			hljs.HASH_COMMENT_MODE,
			VARIABLE,
			QUOTE_STRING,
			FUNC,
			ASSIGNMENT,
			META,
			TARGET
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/markdown.js
function markdown(hljs) {
	const regex = hljs.regex;
	const INLINE_HTML = {
		begin: /<\/?[A-Za-z_]/,
		end: ">",
		subLanguage: "xml",
		relevance: 0
	};
	const HORIZONTAL_RULE = {
		begin: "^[-\\*]{3,}",
		end: "$"
	};
	const CODE = {
		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
			}
		]
	};
	const LIST = {
		className: "bullet",
		begin: "^[ 	]*([*+-]|(\\d+\\.))(?=\\s+)",
		end: "\\s+",
		excludeEnd: true
	};
	const LINK_REFERENCE = {
		begin: /^\[[^\n]+\]:/,
		returnBegin: true,
		contains: [{
			className: "symbol",
			begin: /\[/,
			end: /\]/,
			excludeBegin: true,
			excludeEnd: true
		}, {
			className: "link",
			begin: /:\s*/,
			end: /$/,
			excludeBegin: true
		}]
	};
	const LINK = {
		variants: [
			{
				begin: /\[.+?\]\[.*?\]/,
				relevance: 0
			},
			{
				begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
				relevance: 2
			},
			{
				begin: regex.concat(/\[.+?\]\(/, /[A-Za-z][A-Za-z0-9+.-]*/, /:\/\/.*?\)/),
				relevance: 2
			},
			{
				begin: /\[.+?\]\([./?&#].*?\)/,
				relevance: 1
			},
			{
				begin: /\[.*?\]\(.*?\)/,
				relevance: 0
			}
		],
		returnBegin: true,
		contains: [
			{ match: /\[(?=\])/ },
			{
				className: "string",
				relevance: 0,
				begin: "\\[",
				end: "\\]",
				excludeBegin: true,
				returnEnd: true
			},
			{
				className: "link",
				relevance: 0,
				begin: "\\]\\(",
				end: "\\)",
				excludeBegin: true,
				excludeEnd: true
			},
			{
				className: "symbol",
				relevance: 0,
				begin: "\\]\\[",
				end: "\\]",
				excludeBegin: true,
				excludeEnd: true
			}
		]
	};
	const BOLD = {
		className: "strong",
		contains: [],
		variants: [{
			begin: /_{2}(?!\s)/,
			end: /_{2}/
		}, {
			begin: /\*{2}(?!\s)/,
			end: /\*{2}/
		}]
	};
	const ITALIC = {
		className: "emphasis",
		contains: [],
		variants: [{
			begin: /\*(?![*\s])/,
			end: /\*/
		}, {
			begin: /_(?![_\s])/,
			end: /_/,
			relevance: 0
		}]
	};
	const BOLD_WITHOUT_ITALIC = hljs.inherit(BOLD, { contains: [] });
	const ITALIC_WITHOUT_BOLD = hljs.inherit(ITALIC, { contains: [] });
	BOLD.contains.push(ITALIC_WITHOUT_BOLD);
	ITALIC.contains.push(BOLD_WITHOUT_ITALIC);
	let CONTAINABLE = [INLINE_HTML, LINK];
	[
		BOLD,
		ITALIC,
		BOLD_WITHOUT_ITALIC,
		ITALIC_WITHOUT_BOLD
	].forEach((m) => {
		m.contains = m.contains.concat(CONTAINABLE);
	});
	CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);
	return {
		name: "Markdown",
		aliases: [
			"md",
			"mkdown",
			"mkd"
		],
		contains: [
			{
				className: "section",
				variants: [{
					begin: "^#{1,6}",
					end: "$",
					contains: CONTAINABLE
				}, {
					begin: "(?=^.+?\\n[=-]{2,}$)",
					contains: [{ begin: "^[=-]*$" }, {
						begin: "^",
						end: "\\n",
						contains: CONTAINABLE
					}]
				}]
			},
			INLINE_HTML,
			LIST,
			BOLD,
			ITALIC,
			{
				className: "quote",
				begin: "^>\\s+",
				contains: CONTAINABLE,
				end: "$"
			},
			CODE,
			HORIZONTAL_RULE,
			LINK,
			LINK_REFERENCE,
			{
				scope: "literal",
				match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/objectivec.js
function objectivec(hljs) {
	const API_CLASS = {
		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+"
	};
	const IDENTIFIER_RE = /[a-zA-Z@][a-zA-Z0-9_]*/;
	const KEYWORDS = {
		"variable.language": ["this", "super"],
		$pattern: IDENTIFIER_RE,
		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"
		]
	};
	const CLASS_KEYWORDS = {
		$pattern: IDENTIFIER_RE,
		keyword: [
			"@interface",
			"@class",
			"@protocol",
			"@implementation"
		]
	};
	return {
		name: "Objective-C",
		aliases: [
			"mm",
			"objc",
			"obj-c",
			"obj-c++",
			"objective-c++"
		],
		keywords: KEYWORDS,
		illegal: "</",
		contains: [
			API_CLASS,
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			hljs.C_NUMBER_MODE,
			hljs.QUOTE_STRING_MODE,
			hljs.APOS_STRING_MODE,
			{
				className: "string",
				variants: [{
					begin: "@\"",
					end: "\"",
					illegal: "\\n",
					contains: [hljs.BACKSLASH_ESCAPE]
				}]
			},
			{
				className: "meta",
				begin: /#\s*[a-z]+\b/,
				end: /$/,
				keywords: { keyword: "if else elif endif define undef warning error line pragma ifdef ifndef include" },
				contains: [
					{
						begin: /\\\n/,
						relevance: 0
					},
					hljs.inherit(hljs.QUOTE_STRING_MODE, { className: "string" }),
					{
						className: "string",
						begin: /<.*?>/,
						end: /$/,
						illegal: "\\n"
					},
					hljs.C_LINE_COMMENT_MODE,
					hljs.C_BLOCK_COMMENT_MODE
				]
			},
			{
				className: "class",
				begin: "(" + CLASS_KEYWORDS.keyword.join("|") + ")\\b",
				end: /(\{|$)/,
				excludeEnd: true,
				keywords: CLASS_KEYWORDS,
				contains: [hljs.UNDERSCORE_TITLE_MODE]
			},
			{
				begin: "\\." + hljs.UNDERSCORE_IDENT_RE,
				relevance: 0
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/perl.js
/** @type LanguageFn */
function perl(hljs) {
	const regex = hljs.regex;
	const KEYWORDS = [
		"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"
	];
	const REGEX_MODIFIERS = /[dualxmsipngr]{0,12}/;
	const PERL_KEYWORDS = {
		$pattern: /[\w.]+/,
		keyword: KEYWORDS.join(" ")
	};
	const SUBST = {
		className: "subst",
		begin: "[$@]\\{",
		end: "\\}",
		keywords: PERL_KEYWORDS
	};
	const METHOD = {
		begin: /->\{/,
		end: /\}/
	};
	const ATTR = {
		scope: "attr",
		match: /\s+:\s*\w+(\s*\(.*?\))?/
	};
	const VAR = {
		scope: "variable",
		variants: [
			{ begin: /\$\d/ },
			{ begin: regex.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, `(?![A-Za-z])(?![@$%])`) },
			{
				begin: /[$%@](?!")[^\s\w{=]|\$=/,
				relevance: 0
			}
		],
		contains: [ATTR]
	};
	const NUMBER = {
		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
	};
	const STRING_CONTAINS = [
		hljs.BACKSLASH_ESCAPE,
		SUBST,
		VAR
	];
	const REGEX_DELIMS = [
		/!/,
		/\//,
		/\|/,
		/\?/,
		/'/,
		/"/,
		/#/
	];
	/**
	* @param {string|RegExp} prefix
	* @param {string|RegExp} open
	* @param {string|RegExp} close
	*/
	const PAIRED_DOUBLE_RE = (prefix, open, close = "\\1") => {
		const middle = close === "\\1" ? close : regex.concat(close, open);
		return regex.concat(regex.concat("(?:", prefix, ")"), open, /(?:\\.|[^\\\/])*?/, middle, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
	};
	/**
	* @param {string|RegExp} prefix
	* @param {string|RegExp} open
	* @param {string|RegExp} close
	*/
	const PAIRED_RE = (prefix, open, close) => {
		return regex.concat(regex.concat("(?:", prefix, ")"), open, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
	};
	const PERL_DEFAULT_CONTAINS = [
		VAR,
		hljs.HASH_COMMENT_MODE,
		hljs.COMMENT(/^=\w/, /=cut/, { endsWithParent: true }),
		METHOD,
		{
			className: "string",
			contains: STRING_CONTAINS,
			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: [hljs.BACKSLASH_ESCAPE]
				},
				{
					begin: "\"",
					end: "\""
				},
				{
					begin: "`",
					end: "`",
					contains: [hljs.BACKSLASH_ESCAPE]
				},
				{
					begin: /\{\w+\}/,
					relevance: 0
				},
				{
					begin: "-?\\w+\\s*=>",
					relevance: 0
				}
			]
		},
		NUMBER,
		{
			begin: "(\\/\\/|" + hljs.RE_STARTERS_RE + "|\\b(split|return|print|reverse|grep)\\b)\\s*",
			keywords: "split return print reverse grep",
			relevance: 0,
			contains: [
				hljs.HASH_COMMENT_MODE,
				{
					className: "regexp",
					variants: [
						{ begin: PAIRED_DOUBLE_RE("s|tr|y", regex.either(...REGEX_DELIMS, { capture: true })) },
						{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\(", "\\)") },
						{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\[", "\\]") },
						{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\{", "\\}") }
					],
					relevance: 2
				},
				{
					className: "regexp",
					variants: [
						{
							begin: /(m|qr)\/\//,
							relevance: 0
						},
						{ begin: PAIRED_RE("(?:m|qr)?", /\//, /\//) },
						{ begin: PAIRED_RE("m|qr", regex.either(...REGEX_DELIMS, { capture: true }), /\1/) },
						{ begin: PAIRED_RE("m|qr", /\(/, /\)/) },
						{ begin: PAIRED_RE("m|qr", /\[/, /\]/) },
						{ begin: PAIRED_RE("m|qr", /\{/, /\}/) }
					]
				}
			]
		},
		{
			className: "function",
			beginKeywords: "sub method",
			end: "(\\s*\\(.*?\\))?[;{]",
			excludeEnd: true,
			relevance: 5,
			contains: [hljs.TITLE_MODE, ATTR]
		},
		{
			className: "class",
			beginKeywords: "class",
			end: "[;{]",
			excludeEnd: true,
			relevance: 5,
			contains: [
				hljs.TITLE_MODE,
				ATTR,
				NUMBER
			]
		},
		{
			begin: "-\\w\\b",
			relevance: 0
		},
		{
			begin: "^__DATA__$",
			end: "^__END__$",
			subLanguage: "mojolicious",
			contains: [{
				begin: "^@@.*",
				end: "$",
				className: "comment"
			}]
		}
	];
	SUBST.contains = PERL_DEFAULT_CONTAINS;
	METHOD.contains = PERL_DEFAULT_CONTAINS;
	return {
		name: "Perl",
		aliases: ["pl", "pm"],
		keywords: PERL_KEYWORDS,
		contains: PERL_DEFAULT_CONTAINS
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/php.js
/**
* @param {HLJSApi} hljs
* @returns {LanguageDetail}
* */
function php(hljs) {
	const regex = hljs.regex;
	const NOT_PERL_ETC = /(?![A-Za-z0-9])(?![$])/;
	const IDENT_RE = regex.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, NOT_PERL_ETC);
	const PASCAL_CASE_CLASS_NAME_RE = regex.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, NOT_PERL_ETC);
	const UPCASE_NAME_RE = regex.concat(/[A-Z]+/, NOT_PERL_ETC);
	const VARIABLE = {
		scope: "variable",
		match: "\\$+" + IDENT_RE
	};
	const PREPROCESSOR = {
		scope: "meta",
		variants: [
			{
				begin: /<\?php/,
				relevance: 10
			},
			{ begin: /<\?=/ },
			{
				begin: /<\?/,
				relevance: .1
			},
			{ begin: /\?>/ }
		]
	};
	const SUBST = {
		scope: "subst",
		variants: [{ begin: /\$\w+/ }, {
			begin: /\{\$/,
			end: /\}/
		}]
	};
	const SINGLE_QUOTED = hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null });
	const DOUBLE_QUOTED = hljs.inherit(hljs.QUOTE_STRING_MODE, {
		illegal: null,
		contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST)
	});
	const HEREDOC = {
		begin: /<<<[ \t]*(?:(\w+)|"(\w+)")\n/,
		end: /[ \t]*(\w+)\b/,
		contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
		"on:begin": (m, resp) => {
			resp.data._beginMatch = m[1] || m[2];
		},
		"on:end": (m, resp) => {
			if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();
		}
	};
	const NOWDOC = hljs.END_SAME_AS_BEGIN({
		begin: /<<<[ \t]*'(\w+)'\n/,
		end: /[ \t]*(\w+)\b/
	});
	const WHITESPACE = "[ 	\n]";
	const STRING = {
		scope: "string",
		variants: [
			DOUBLE_QUOTED,
			SINGLE_QUOTED,
			HEREDOC,
			NOWDOC
		]
	};
	const NUMBER = {
		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
	};
	const LITERALS = [
		"false",
		"null",
		"true"
	];
	const KWS = [
		"__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"
	];
	const BUILT_INS = [
		"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"
	];
	/** Dual-case keywords
	*
	* ["then","FILE"] =>
	*     ["then", "THEN", "FILE", "file"]
	*
	* @param {string[]} items */
	const dualCase = (items) => {
		/** @type string[] */
		const result = [];
		items.forEach((item) => {
			result.push(item);
			if (item.toLowerCase() === item) result.push(item.toUpperCase());
			else result.push(item.toLowerCase());
		});
		return result;
	};
	const KEYWORDS = {
		keyword: KWS,
		literal: dualCase(LITERALS),
		built_in: BUILT_INS
	};
	/**
	* @param {string[]} items */
	const normalizeKeywords = (items) => {
		return items.map((item) => {
			return item.replace(/\|\d+$/, "");
		});
	};
	const CONSTRUCTOR_CALL = { variants: [{
		match: [
			/new/,
			regex.concat(WHITESPACE, "+"),
			regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
			PASCAL_CASE_CLASS_NAME_RE
		],
		scope: {
			1: "keyword",
			4: "title.class"
		}
	}] };
	const CONSTANT_REFERENCE = regex.concat(IDENT_RE, "\\b(?!\\()");
	const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = { variants: [
		{
			match: [regex.concat(/::/, regex.lookahead(/(?!class\b)/)), CONSTANT_REFERENCE],
			scope: { 2: "variable.constant" }
		},
		{
			match: [/::/, /class/],
			scope: { 2: "variable.language" }
		},
		{
			match: [
				PASCAL_CASE_CLASS_NAME_RE,
				regex.concat(/::/, regex.lookahead(/(?!class\b)/)),
				CONSTANT_REFERENCE
			],
			scope: {
				1: "title.class",
				3: "variable.constant"
			}
		},
		{
			match: [PASCAL_CASE_CLASS_NAME_RE, regex.concat("::", regex.lookahead(/(?!class\b)/))],
			scope: { 1: "title.class" }
		},
		{
			match: [
				PASCAL_CASE_CLASS_NAME_RE,
				/::/,
				/class/
			],
			scope: {
				1: "title.class",
				3: "variable.language"
			}
		}
	] };
	const NAMED_ARGUMENT = {
		scope: "attr",
		match: regex.concat(IDENT_RE, regex.lookahead(":"), regex.lookahead(/(?!::)/))
	};
	const PARAMS_MODE = {
		relevance: 0,
		begin: /\(/,
		end: /\)/,
		keywords: KEYWORDS,
		contains: [
			NAMED_ARGUMENT,
			VARIABLE,
			LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
			hljs.C_BLOCK_COMMENT_MODE,
			STRING,
			NUMBER,
			CONSTRUCTOR_CALL
		]
	};
	const FUNCTION_INVOKE = {
		relevance: 0,
		match: [
			/\b/,
			regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
			IDENT_RE,
			regex.concat(WHITESPACE, "*"),
			regex.lookahead(/(?=\()/)
		],
		scope: { 3: "title.function.invoke" },
		contains: [PARAMS_MODE]
	};
	PARAMS_MODE.contains.push(FUNCTION_INVOKE);
	const ATTRIBUTE_CONTAINS = [
		NAMED_ARGUMENT,
		LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
		hljs.C_BLOCK_COMMENT_MODE,
		STRING,
		NUMBER,
		CONSTRUCTOR_CALL
	];
	const ATTRIBUTES = {
		begin: regex.concat(/#\[\s*\\?/, regex.either(PASCAL_CASE_CLASS_NAME_RE, UPCASE_NAME_RE)),
		beginScope: "meta",
		end: /]/,
		endScope: "meta",
		keywords: {
			literal: LITERALS,
			keyword: ["new", "array"]
		},
		contains: [
			{
				begin: /\[/,
				end: /]/,
				keywords: {
					literal: LITERALS,
					keyword: ["new", "array"]
				},
				contains: ["self", ...ATTRIBUTE_CONTAINS]
			},
			...ATTRIBUTE_CONTAINS,
			{
				scope: "meta",
				variants: [{ match: PASCAL_CASE_CLASS_NAME_RE }, { match: UPCASE_NAME_RE }]
			}
		]
	};
	return {
		case_insensitive: false,
		keywords: KEYWORDS,
		contains: [
			ATTRIBUTES,
			hljs.HASH_COMMENT_MODE,
			hljs.COMMENT("//", "$"),
			hljs.COMMENT("/\\*", "\\*/", { contains: [{
				scope: "doctag",
				match: "@[A-Za-z]+"
			}] }),
			{
				match: /__halt_compiler\(\);/,
				keywords: "__halt_compiler",
				starts: {
					scope: "comment",
					end: hljs.MATCH_NOTHING_RE,
					contains: [{
						match: /\?>/,
						scope: "meta",
						endsParent: true
					}]
				}
			},
			PREPROCESSOR,
			{
				scope: "variable.language",
				match: /\$this\b/
			},
			VARIABLE,
			FUNCTION_INVOKE,
			LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
			{
				match: [
					/const/,
					/\s/,
					IDENT_RE
				],
				scope: {
					1: "keyword",
					3: "variable.constant"
				}
			},
			CONSTRUCTOR_CALL,
			{
				scope: "function",
				relevance: 0,
				beginKeywords: "fn function",
				end: /[;{]/,
				excludeEnd: true,
				illegal: "[$%\\[]",
				contains: [
					{ beginKeywords: "use" },
					hljs.UNDERSCORE_TITLE_MODE,
					{
						begin: "=>",
						endsParent: true
					},
					{
						scope: "params",
						begin: "\\(",
						end: "\\)",
						excludeBegin: true,
						excludeEnd: true,
						keywords: KEYWORDS,
						contains: [
							"self",
							ATTRIBUTES,
							VARIABLE,
							LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
							hljs.C_BLOCK_COMMENT_MODE,
							STRING,
							NUMBER
						]
					}
				]
			},
			{
				scope: "class",
				variants: [{
					beginKeywords: "enum",
					illegal: /[($"]/
				}, {
					beginKeywords: "class interface trait",
					illegal: /[:($"]/
				}],
				relevance: 0,
				end: /\{/,
				excludeEnd: true,
				contains: [{ beginKeywords: "extends implements" }, hljs.UNDERSCORE_TITLE_MODE]
			},
			{
				beginKeywords: "namespace",
				relevance: 0,
				end: ";",
				illegal: /[.']/,
				contains: [hljs.inherit(hljs.UNDERSCORE_TITLE_MODE, { scope: "title.class" })]
			},
			{
				beginKeywords: "use",
				relevance: 0,
				end: ";",
				contains: [{
					match: /\b(as|const|function)\b/,
					scope: "keyword"
				}, hljs.UNDERSCORE_TITLE_MODE]
			},
			STRING,
			NUMBER
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/php-template.js
function phpTemplate(hljs) {
	return {
		name: "PHP template",
		subLanguage: "xml",
		contains: [{
			begin: /<\?(php|=)?/,
			end: /\?>/,
			subLanguage: "php",
			contains: [
				{
					begin: "/\\*",
					end: "\\*/",
					skip: true
				},
				{
					begin: "b\"",
					end: "\"",
					skip: true
				},
				{
					begin: "b'",
					end: "'",
					skip: true
				},
				hljs.inherit(hljs.APOS_STRING_MODE, {
					illegal: null,
					className: null,
					contains: null,
					skip: true
				}),
				hljs.inherit(hljs.QUOTE_STRING_MODE, {
					illegal: null,
					className: null,
					contains: null,
					skip: true
				})
			]
		}]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/plaintext.js
function plaintext(hljs) {
	return {
		name: "Plain text",
		aliases: ["text", "txt"],
		disableAutodetect: true
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/python.js
function python(hljs) {
	const regex = hljs.regex;
	const IDENT_RE = /[\p{XID_Start}_]\p{XID_Continue}*/u;
	const RESERVED_WORDS = [
		"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"
	];
	const KEYWORDS = {
		$pattern: /[A-Za-z]\w+|__\w+__/,
		keyword: RESERVED_WORDS,
		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"
		]
	};
	const PROMPT = {
		className: "meta",
		begin: /^(>>>|\.\.\.) /
	};
	const SUBST = {
		className: "subst",
		begin: /\{/,
		end: /\}/,
		keywords: KEYWORDS,
		illegal: /#/
	};
	const LITERAL_BRACKET = {
		begin: /\{\{/,
		relevance: 0
	};
	const STRING = {
		className: "string",
		contains: [hljs.BACKSLASH_ESCAPE],
		variants: [
			{
				begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,
				end: /'''/,
				contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
				relevance: 10
			},
			{
				begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,
				end: /"""/,
				contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
				relevance: 10
			},
			{
				begin: /([fF][rR]|[rR][fF]|[fF])'''/,
				end: /'''/,
				contains: [
					hljs.BACKSLASH_ESCAPE,
					PROMPT,
					LITERAL_BRACKET,
					SUBST
				]
			},
			{
				begin: /([fF][rR]|[rR][fF]|[fF])"""/,
				end: /"""/,
				contains: [
					hljs.BACKSLASH_ESCAPE,
					PROMPT,
					LITERAL_BRACKET,
					SUBST
				]
			},
			{
				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: [
					hljs.BACKSLASH_ESCAPE,
					LITERAL_BRACKET,
					SUBST
				]
			},
			{
				begin: /([fF][rR]|[rR][fF]|[fF])"/,
				end: /"/,
				contains: [
					hljs.BACKSLASH_ESCAPE,
					LITERAL_BRACKET,
					SUBST
				]
			},
			hljs.APOS_STRING_MODE,
			hljs.QUOTE_STRING_MODE
		]
	};
	const digitpart = "[0-9](_?[0-9])*";
	const pointfloat = `(\\b(${digitpart}))?\\.(${digitpart})|\\b(${digitpart})\\.`;
	const lookahead = `\\b|${RESERVED_WORDS.join("|")}`;
	const NUMBER = {
		className: "number",
		relevance: 0,
		variants: [
			{ begin: `(\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})` },
			{ begin: `(${pointfloat})[jJ]?` },
			{ begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})` },
			{ begin: `\\b0[bB](_?[01])+[lL]?(?=${lookahead})` },
			{ begin: `\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})` },
			{ begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})` },
			{ begin: `\\b(${digitpart})[jJ](?=${lookahead})` }
		]
	};
	const COMMENT_TYPE = {
		className: "comment",
		begin: regex.lookahead(/# type:/),
		end: /$/,
		keywords: KEYWORDS,
		contains: [{ begin: /# type:/ }, {
			begin: /#/,
			end: /\b\B/,
			endsWithParent: true
		}]
	};
	const PARAMS = {
		className: "params",
		variants: [{
			className: "",
			begin: /\(\s*\)/,
			skip: true
		}, {
			begin: /\(/,
			end: /\)/,
			excludeBegin: true,
			excludeEnd: true,
			keywords: KEYWORDS,
			contains: [
				"self",
				PROMPT,
				NUMBER,
				STRING,
				hljs.HASH_COMMENT_MODE
			]
		}]
	};
	SUBST.contains = [
		STRING,
		NUMBER,
		PROMPT
	];
	return {
		name: "Python",
		aliases: [
			"py",
			"gyp",
			"ipython"
		],
		unicodeRegex: true,
		keywords: KEYWORDS,
		illegal: /(<\/|\?)|=>/,
		contains: [
			PROMPT,
			NUMBER,
			{
				scope: "variable.language",
				match: /\bself\b/
			},
			{
				beginKeywords: "if",
				relevance: 0
			},
			{
				match: /\bor\b/,
				scope: "keyword"
			},
			STRING,
			COMMENT_TYPE,
			hljs.HASH_COMMENT_MODE,
			{
				match: [
					/\bdef/,
					/\s+/,
					IDENT_RE
				],
				scope: {
					1: "keyword",
					3: "title.function"
				},
				contains: [PARAMS]
			},
			{
				variants: [{ match: [
					/\bclass/,
					/\s+/,
					IDENT_RE,
					/\s*/,
					/\(\s*/,
					IDENT_RE,
					/\s*\)/
				] }, { match: [
					/\bclass/,
					/\s+/,
					IDENT_RE
				] }],
				scope: {
					1: "keyword",
					3: "title.class",
					6: "title.class.inherited"
				}
			},
			{
				className: "meta",
				begin: /^[\t ]*@/,
				end: /(?=#)|$/,
				contains: [
					NUMBER,
					PARAMS,
					STRING
				]
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/python-repl.js
function pythonRepl(hljs) {
	return {
		aliases: ["pycon"],
		contains: [{
			className: "meta.prompt",
			starts: {
				end: / |$/,
				starts: {
					end: "$",
					subLanguage: "python"
				}
			},
			variants: [{ begin: /^>>>(?=[ ]|$)/ }, { begin: /^\.\.\.(?=[ ]|$)/ }]
		}]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/r.js
/** @type LanguageFn */
function r(hljs) {
	const regex = hljs.regex;
	const IDENT_RE = /(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/;
	const NUMBER_TYPES_RE = regex.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]?/);
	const OPERATORS_RE = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/;
	const PUNCTUATION_RE = regex.either(/[()]/, /[{}]/, /\[\[/, /[[\]]/, /\\/, /,/);
	return {
		name: "R",
		keywords: {
			$pattern: IDENT_RE,
			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: [
			hljs.COMMENT(/#'/, /$/, { contains: [
				{
					scope: "doctag",
					match: /@examples/,
					starts: {
						end: regex.lookahead(regex.either(/\n^#'\s*(?=@[a-zA-Z]+)/, /\n^(?!#')/)),
						endsParent: true
					}
				},
				{
					scope: "doctag",
					begin: "@param",
					end: /$/,
					contains: [{
						scope: "variable",
						variants: [{ match: IDENT_RE }, { match: /`(?:\\.|[^`\\])+`/ }],
						endsParent: true
					}]
				},
				{
					scope: "doctag",
					match: /@[a-zA-Z]+/
				},
				{
					scope: "keyword",
					match: /\\[a-zA-Z]+/
				}
			] }),
			hljs.HASH_COMMENT_MODE,
			{
				scope: "string",
				contains: [hljs.BACKSLASH_ESCAPE],
				variants: [
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]"(-*)\(/,
						end: /\)(-*)"/
					}),
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]"(-*)\{/,
						end: /\}(-*)"/
					}),
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]"(-*)\[/,
						end: /\](-*)"/
					}),
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]'(-*)\(/,
						end: /\)(-*)'/
					}),
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]'(-*)\{/,
						end: /\}(-*)'/
					}),
					hljs.END_SAME_AS_BEGIN({
						begin: /[rR]'(-*)\[/,
						end: /\](-*)'/
					}),
					{
						begin: "\"",
						end: "\"",
						relevance: 0
					},
					{
						begin: "'",
						end: "'",
						relevance: 0
					}
				]
			},
			{
				relevance: 0,
				variants: [
					{
						scope: {
							1: "operator",
							2: "number"
						},
						match: [OPERATORS_RE, NUMBER_TYPES_RE]
					},
					{
						scope: {
							1: "operator",
							2: "number"
						},
						match: [/%[^%]*%/, NUMBER_TYPES_RE]
					},
					{
						scope: {
							1: "punctuation",
							2: "number"
						},
						match: [PUNCTUATION_RE, NUMBER_TYPES_RE]
					},
					{
						scope: { 2: "number" },
						match: [/[^a-zA-Z0-9._]|^/, NUMBER_TYPES_RE]
					}
				]
			},
			{
				scope: { 3: "operator" },
				match: [
					IDENT_RE,
					/\s+/,
					/<-/,
					/\s+/
				]
			},
			{
				scope: "operator",
				relevance: 0,
				variants: [{ match: OPERATORS_RE }, { match: /%[^%]*%/ }]
			},
			{
				scope: "punctuation",
				relevance: 0,
				match: PUNCTUATION_RE
			},
			{
				begin: "`",
				end: "`",
				contains: [{ begin: /\\./ }]
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/ruby.js
function ruby(hljs) {
	const regex = hljs.regex;
	const RUBY_METHOD_RE = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)";
	const CLASS_NAME_RE = regex.either(/\b([A-Z]+[a-z0-9]+)+/, /\b([A-Z]+[a-z0-9]+)+[A-Z]+/);
	const CLASS_NAME_WITH_NAMESPACE_RE = regex.concat(CLASS_NAME_RE, /(::\w+)*/);
	const RUBY_KEYWORDS = {
		"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"
		]
	};
	const YARDOCTAG = {
		className: "doctag",
		begin: "@[A-Za-z]+"
	};
	const IRB_OBJECT = {
		begin: "#<",
		end: ">"
	};
	const COMMENT_MODES = [
		hljs.COMMENT("#", "$", { contains: [YARDOCTAG] }),
		hljs.COMMENT("^=begin", "^=end", {
			contains: [YARDOCTAG],
			relevance: 10
		}),
		hljs.COMMENT("^__END__", hljs.MATCH_NOTHING_RE)
	];
	const SUBST = {
		className: "subst",
		begin: /#\{/,
		end: /\}/,
		keywords: RUBY_KEYWORDS
	};
	const STRING = {
		className: "string",
		contains: [hljs.BACKSLASH_ESCAPE, SUBST],
		variants: [
			{
				begin: /'/,
				end: /'/
			},
			{
				begin: /"/,
				end: /"/
			},
			{
				begin: /`/,
				end: /`/
			},
			{
				begin: /%[qQwWx]?\(/,
				end: /\)/
			},
			{
				begin: /%[qQwWx]?\[/,
				end: /\]/
			},
			{
				begin: /%[qQwWx]?\{/,
				end: /\}/
			},
			{
				begin: /%[qQwWx]?</,
				end: />/
			},
			{
				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: regex.concat(/<<[-~]?'?/, regex.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),
				contains: [hljs.END_SAME_AS_BEGIN({
					begin: /(\w+)/,
					end: /(\w+)/,
					contains: [hljs.BACKSLASH_ESCAPE, SUBST]
				})]
			}
		]
	};
	const decimal = "[1-9](_?[0-9])*|0";
	const digits = "[0-9](_?[0-9])*";
	const NUMBER = {
		className: "number",
		relevance: 0,
		variants: [
			{ begin: `\\b(${decimal})(\\.(${digits}))?([eE][+-]?(${digits})|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" }
		]
	};
	const PARAMS = { variants: [{ match: /\(\)/ }, {
		className: "params",
		begin: /\(/,
		end: /(?=\))/,
		excludeBegin: true,
		endsParent: true,
		keywords: RUBY_KEYWORDS
	}] };
	const RUBY_DEFAULT_CONTAINS = [
		STRING,
		{
			variants: [{ match: [
				/class\s+/,
				CLASS_NAME_WITH_NAMESPACE_RE,
				/\s+<\s+/,
				CLASS_NAME_WITH_NAMESPACE_RE
			] }, { match: [/\b(class|module)\s+/, CLASS_NAME_WITH_NAMESPACE_RE] }],
			scope: {
				2: "title.class",
				4: "title.class.inherited"
			},
			keywords: RUBY_KEYWORDS
		},
		{
			match: [/(include|extend)\s+/, CLASS_NAME_WITH_NAMESPACE_RE],
			scope: { 2: "title.class" },
			keywords: RUBY_KEYWORDS
		},
		{
			relevance: 0,
			match: [CLASS_NAME_WITH_NAMESPACE_RE, /\.new[. (]/],
			scope: { 1: "title.class" }
		},
		{
			relevance: 0,
			match: /\b[A-Z][A-Z_0-9]+\b/,
			className: "variable.constant"
		},
		{
			relevance: 0,
			match: CLASS_NAME_RE,
			scope: "title.class"
		},
		{
			match: [
				/def/,
				/\s+/,
				RUBY_METHOD_RE
			],
			scope: {
				1: "keyword",
				3: "title.function"
			},
			contains: [PARAMS]
		},
		{ begin: hljs.IDENT_RE + "::" },
		{
			className: "symbol",
			begin: hljs.UNDERSCORE_IDENT_RE + "(!|\\?)?:",
			relevance: 0
		},
		{
			className: "symbol",
			begin: ":(?!\\s)",
			contains: [STRING, { begin: RUBY_METHOD_RE }],
			relevance: 0
		},
		NUMBER,
		{
			className: "variable",
			begin: "(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"
		},
		{
			className: "params",
			begin: /\|(?!=)/,
			end: /\|/,
			excludeBegin: true,
			excludeEnd: true,
			relevance: 0,
			keywords: RUBY_KEYWORDS
		},
		{
			begin: "(" + hljs.RE_STARTERS_RE + "|unless)\\s*",
			keywords: "unless",
			contains: [{
				className: "regexp",
				contains: [hljs.BACKSLASH_ESCAPE, SUBST],
				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(IRB_OBJECT, COMMENT_MODES),
			relevance: 0
		}
	].concat(IRB_OBJECT, COMMENT_MODES);
	SUBST.contains = RUBY_DEFAULT_CONTAINS;
	PARAMS.contains = RUBY_DEFAULT_CONTAINS;
	const IRB_DEFAULT = [{
		begin: /^\s*=>/,
		starts: {
			end: "$",
			contains: RUBY_DEFAULT_CONTAINS
		}
	}, {
		className: "meta.prompt",
		begin: "^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",
		starts: {
			end: "$",
			keywords: RUBY_KEYWORDS,
			contains: RUBY_DEFAULT_CONTAINS
		}
	}];
	COMMENT_MODES.unshift(IRB_OBJECT);
	return {
		name: "Ruby",
		aliases: [
			"rb",
			"gemspec",
			"podspec",
			"thor",
			"irb"
		],
		keywords: RUBY_KEYWORDS,
		illegal: /\/\*/,
		contains: [hljs.SHEBANG({ binary: "ruby" })].concat(IRB_DEFAULT).concat(COMMENT_MODES).concat(RUBY_DEFAULT_CONTAINS)
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/rust.js
/** @type LanguageFn */
function rust(hljs) {
	const regex = hljs.regex;
	const RAW_IDENTIFIER = /(r#)?/;
	const UNDERSCORE_IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);
	const IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.IDENT_RE);
	const FUNCTION_INVOKE = {
		className: "title.function.invoke",
		relevance: 0,
		begin: regex.concat(/\b/, /(?!let|for|while|if|else|match\b)/, IDENT_RE, regex.lookahead(/\s*\(/))
	};
	const KEYWORDS = [
		"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"
	];
	const LITERALS = [
		"true",
		"false",
		"Some",
		"None",
		"Ok",
		"Err"
	];
	const BUILTINS = [
		"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!"
	];
	const TYPES = [
		"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: hljs.IDENT_RE + "!?",
			type: TYPES,
			keyword: KEYWORDS,
			literal: LITERALS,
			built_in: BUILTINS
		},
		illegal: "</",
		contains: [
			hljs.C_LINE_COMMENT_MODE,
			hljs.COMMENT("/\\*", "\\*/", { contains: ["self"] }),
			hljs.inherit(hljs.QUOTE_STRING_MODE, {
				begin: /b?"/,
				illegal: null
			}),
			{
				className: "symbol",
				begin: /'[a-zA-Z_][a-zA-Z0-9_]*(?!')/
			},
			{
				scope: "string",
				variants: [{ begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ }, {
					begin: /b?'/,
					end: /'/,
					contains: [{
						scope: "char.escape",
						match: /\\('|\w|x\w{2}|u\w{4}|U\w{8})/
					}]
				}]
			},
			{
				className: "number",
				variants: [
					{ begin: "\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?" },
					{ begin: "\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?" },
					{ begin: "\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?" },
					{ begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?" }
				],
				relevance: 0
			},
			{
				begin: [
					/fn/,
					/\s+/,
					UNDERSCORE_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "title.function"
				}
			},
			{
				className: "meta",
				begin: "#!?\\[",
				end: "\\]",
				contains: [{
					className: "string",
					begin: /"/,
					end: /"/,
					contains: [hljs.BACKSLASH_ESCAPE]
				}]
			},
			{
				begin: [
					/let/,
					/\s+/,
					/(?:mut\s+)?/,
					UNDERSCORE_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "keyword",
					4: "variable"
				}
			},
			{
				begin: [
					/for/,
					/\s+/,
					UNDERSCORE_IDENT_RE,
					/\s+/,
					/in/
				],
				className: {
					1: "keyword",
					3: "variable",
					5: "keyword"
				}
			},
			{
				begin: [
					/type/,
					/\s+/,
					UNDERSCORE_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "title.class"
				}
			},
			{
				begin: [
					/(?:trait|enum|struct|union|impl|for)/,
					/\s+/,
					UNDERSCORE_IDENT_RE
				],
				className: {
					1: "keyword",
					3: "title.class"
				}
			},
			{
				begin: hljs.IDENT_RE + "::",
				keywords: {
					keyword: "Self",
					built_in: BUILTINS,
					type: TYPES
				}
			},
			{
				className: "punctuation",
				begin: "->"
			},
			FUNCTION_INVOKE
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/scss.js
var MODES = (hljs) => {
	return {
		IMPORTANT: {
			scope: "meta",
			begin: "!important"
		},
		BLOCK_COMMENT: hljs.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: [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
		},
		CSS_NUMBER_MODE: {
			scope: "number",
			begin: hljs.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_-]*/
		}
	};
};
var HTML_TAGS = [
	"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"
];
var SVG_TAGS = [
	"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"
];
var TAGS = [...HTML_TAGS, ...SVG_TAGS];
var MEDIA_FEATURES = [
	"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();
var PSEUDO_CLASSES = [
	"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();
var PSEUDO_ELEMENTS = [
	"after",
	"backdrop",
	"before",
	"cue",
	"cue-region",
	"first-letter",
	"first-line",
	"grammar-error",
	"marker",
	"part",
	"placeholder",
	"selection",
	"slotted",
	"spelling-error"
].sort().reverse();
var ATTRIBUTES = [
	"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();
/** @type LanguageFn */
function scss(hljs) {
	const modes = MODES(hljs);
	const PSEUDO_ELEMENTS$1 = PSEUDO_ELEMENTS;
	const PSEUDO_CLASSES$1 = PSEUDO_CLASSES;
	const AT_IDENTIFIER = "@[a-z-]+";
	const AT_MODIFIERS = "and or not only";
	const VARIABLE = {
		className: "variable",
		begin: "(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",
		relevance: 0
	};
	return {
		name: "SCSS",
		case_insensitive: true,
		illegal: "[=/|']",
		contains: [
			hljs.C_LINE_COMMENT_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			modes.CSS_NUMBER_MODE,
			{
				className: "selector-id",
				begin: "#[A-Za-z0-9_-]+",
				relevance: 0
			},
			{
				className: "selector-class",
				begin: "\\.[A-Za-z0-9_-]+",
				relevance: 0
			},
			modes.ATTRIBUTE_SELECTOR_MODE,
			{
				className: "selector-tag",
				begin: "\\b(" + TAGS.join("|") + ")\\b",
				relevance: 0
			},
			{
				className: "selector-pseudo",
				begin: ":(" + PSEUDO_CLASSES$1.join("|") + ")"
			},
			{
				className: "selector-pseudo",
				begin: ":(:)?(" + PSEUDO_ELEMENTS$1.join("|") + ")"
			},
			VARIABLE,
			{
				begin: /\(/,
				end: /\)/,
				contains: [modes.CSS_NUMBER_MODE]
			},
			modes.CSS_VARIABLE,
			{
				className: "attribute",
				begin: "\\b(" + ATTRIBUTES.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: [
					modes.BLOCK_COMMENT,
					VARIABLE,
					modes.HEXCOLOR,
					modes.CSS_NUMBER_MODE,
					hljs.QUOTE_STRING_MODE,
					hljs.APOS_STRING_MODE,
					modes.IMPORTANT,
					modes.FUNCTION_DISPATCH
				]
			},
			{
				begin: "@(page|font-face)",
				keywords: {
					$pattern: AT_IDENTIFIER,
					keyword: "@page @font-face"
				}
			},
			{
				begin: "@",
				end: "[{;]",
				returnBegin: true,
				keywords: {
					$pattern: /[a-z-]+/,
					keyword: AT_MODIFIERS,
					attribute: MEDIA_FEATURES.join(" ")
				},
				contains: [
					{
						begin: AT_IDENTIFIER,
						className: "keyword"
					},
					{
						begin: /[a-z-]+(?=:)/,
						className: "attribute"
					},
					VARIABLE,
					hljs.QUOTE_STRING_MODE,
					hljs.APOS_STRING_MODE,
					modes.HEXCOLOR,
					modes.CSS_NUMBER_MODE
				]
			},
			modes.FUNCTION_DISPATCH
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/shell.js
/** @type LanguageFn */
function shell(hljs) {
	return {
		name: "Shell Session",
		aliases: ["console", "shellsession"],
		contains: [{
			className: "meta.prompt",
			begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
			starts: {
				end: /[^\\](?=\s*$)/,
				subLanguage: "bash"
			}
		}]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/sql.js
function sql(hljs) {
	const regex = hljs.regex;
	const COMMENT_MODE = hljs.COMMENT("--", "$");
	const STRING = {
		scope: "string",
		variants: [{
			begin: /'/,
			end: /'/,
			contains: [{ match: /''/ }]
		}]
	};
	const QUOTED_IDENTIFIER = {
		begin: /"/,
		end: /"/,
		contains: [{ match: /""/ }]
	};
	const LITERALS = [
		"true",
		"false",
		"unknown"
	];
	const MULTI_WORD_TYPES = [
		"double precision",
		"large object",
		"with timezone",
		"without timezone"
	];
	const TYPES = [
		"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"
	];
	const NON_RESERVED_WORDS = [
		"add",
		"asc",
		"collation",
		"desc",
		"final",
		"first",
		"last",
		"view"
	];
	const RESERVED_WORDS = [
		"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"
	];
	const RESERVED_FUNCTIONS = [
		"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"
	];
	const POSSIBLE_WITHOUT_PARENS = [
		"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"
	];
	const COMBOS = [
		"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"
	];
	const FUNCTIONS = RESERVED_FUNCTIONS;
	const KEYWORDS = [...RESERVED_WORDS, ...NON_RESERVED_WORDS].filter((keyword) => {
		return !RESERVED_FUNCTIONS.includes(keyword);
	});
	const VARIABLE = {
		scope: "variable",
		match: /@[a-z0-9][a-z0-9_]*/
	};
	const OPERATOR = {
		scope: "operator",
		match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
		relevance: 0
	};
	const FUNCTION_CALL = {
		match: regex.concat(/\b/, regex.either(...FUNCTIONS), /\s*\(/),
		relevance: 0,
		keywords: { built_in: FUNCTIONS }
	};
	function kws_to_regex(list) {
		return regex.concat(/\b/, regex.either(...list.map((kw) => {
			return kw.replace(/\s+/, "\\s+");
		})), /\b/);
	}
	const MULTI_WORD_KEYWORDS = {
		scope: "keyword",
		match: kws_to_regex(COMBOS),
		relevance: 0
	};
	function reduceRelevancy(list, { exceptions, when } = {}) {
		const qualifyFn = when;
		exceptions = exceptions || [];
		return list.map((item) => {
			if (item.match(/\|\d+$/) || exceptions.includes(item)) return item;
			else if (qualifyFn(item)) return `${item}|0`;
			else return item;
		});
	}
	return {
		name: "SQL",
		case_insensitive: true,
		illegal: /[{}]|<\//,
		keywords: {
			$pattern: /\b[\w\.]+/,
			keyword: reduceRelevancy(KEYWORDS, { when: (x) => x.length < 3 }),
			literal: LITERALS,
			type: TYPES,
			built_in: POSSIBLE_WITHOUT_PARENS
		},
		contains: [
			{
				scope: "type",
				match: kws_to_regex(MULTI_WORD_TYPES)
			},
			MULTI_WORD_KEYWORDS,
			FUNCTION_CALL,
			VARIABLE,
			STRING,
			QUOTED_IDENTIFIER,
			hljs.C_NUMBER_MODE,
			hljs.C_BLOCK_COMMENT_MODE,
			COMMENT_MODE,
			OPERATOR
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/swift.js
/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
	if (!re) return null;
	if (typeof re === "string") return re;
	return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
	return concat("(?=", re, ")");
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
	return args.map((x) => source(x)).join("");
}
/**
* @param { Array<string | RegExp | Object> } args
* @returns {object}
*/
function stripOptionsFromArgs(args) {
	const opts = args[args.length - 1];
	if (typeof opts === "object" && opts.constructor === Object) {
		args.splice(args.length - 1, 1);
		return opts;
	} else return {};
}
/** @typedef { {capture?: boolean} } RegexEitherOptions */
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
* @returns {string}
*/
function either(...args) {
	return "(" + (stripOptionsFromArgs(args).capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
}
var keywordWrapper = (keyword) => concat(/\b/, keyword, /\w$/.test(keyword) ? /\b/ : /\B/);
var dotKeywords = ["Protocol", "Type"].map(keywordWrapper);
var optionalDotKeywords = ["init", "self"].map(keywordWrapper);
var keywordTypes = ["Any", "Self"];
var keywords = [
	"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"
];
var literals = [
	"false",
	"nil",
	"true"
];
var precedencegroupKeywords = [
	"assignment",
	"associativity",
	"higherThan",
	"left",
	"lowerThan",
	"none",
	"right"
];
var numberSignKeywords = [
	"#colorLiteral",
	"#column",
	"#dsohandle",
	"#else",
	"#elseif",
	"#endif",
	"#error",
	"#file",
	"#fileID",
	"#fileLiteral",
	"#filePath",
	"#function",
	"#if",
	"#imageLiteral",
	"#keyPath",
	"#line",
	"#selector",
	"#sourceLocation",
	"#warning"
];
var builtIns = [
	"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"
];
var operatorHead = either(/[/=\-+!*%<>&|^~?]/, /[\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]/);
var operatorCharacter = either(operatorHead, /[\u0300-\u036F]/, /[\u1DC0-\u1DFF]/, /[\u20D0-\u20FF]/, /[\uFE00-\uFE0F]/, /[\uFE20-\uFE2F]/);
var operator = concat(operatorHead, operatorCharacter, "*");
var identifierHead = either(/[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]/);
var identifierCharacter = either(identifierHead, /\d/, /[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/);
var identifier = concat(identifierHead, identifierCharacter, "*");
var typeIdentifier = concat(/[A-Z]/, identifierCharacter, "*");
var keywordAttributes = [
	"attached",
	"autoclosure",
	concat(/convention\(/, either("swift", "block", "c"), /\)/),
	"discardableResult",
	"dynamicCallable",
	"dynamicMemberLookup",
	"escaping",
	"freestanding",
	"frozen",
	"GKInspectable",
	"IBAction",
	"IBDesignable",
	"IBInspectable",
	"IBOutlet",
	"IBSegueAction",
	"inlinable",
	"main",
	"nonobjc",
	"NSApplicationMain",
	"NSCopying",
	"NSManaged",
	concat(/objc\(/, identifier, /\)/),
	"objc",
	"objcMembers",
	"propertyWrapper",
	"requires_stored_property_inits",
	"resultBuilder",
	"Sendable",
	"testable",
	"UIApplicationMain",
	"unchecked",
	"unknown",
	"usableFromInline",
	"warn_unqualified_access"
];
var availabilityKeywords = [
	"iOS",
	"iOSApplicationExtension",
	"macOS",
	"macOSApplicationExtension",
	"macCatalyst",
	"macCatalystApplicationExtension",
	"watchOS",
	"watchOSApplicationExtension",
	"tvOS",
	"tvOSApplicationExtension",
	"swift"
];
/** @type LanguageFn */
function swift(hljs) {
	const WHITESPACE = {
		match: /\s+/,
		relevance: 0
	};
	const BLOCK_COMMENT = hljs.COMMENT("/\\*", "\\*/", { contains: ["self"] });
	const COMMENTS = [hljs.C_LINE_COMMENT_MODE, BLOCK_COMMENT];
	const DOT_KEYWORD = {
		match: [/\./, either(...dotKeywords, ...optionalDotKeywords)],
		className: { 2: "keyword" }
	};
	const KEYWORD_GUARD = {
		match: concat(/\./, either(...keywords)),
		relevance: 0
	};
	const PLAIN_KEYWORDS = keywords.filter((kw) => typeof kw === "string").concat(["_|0"]);
	const KEYWORD = { variants: [{
		className: "keyword",
		match: either(...keywords.filter((kw) => typeof kw !== "string").concat(keywordTypes).map(keywordWrapper), ...optionalDotKeywords)
	}] };
	const KEYWORDS = {
		$pattern: either(/\b\w+/, /#\w+/),
		keyword: PLAIN_KEYWORDS.concat(numberSignKeywords),
		literal: literals
	};
	const KEYWORD_MODES = [
		DOT_KEYWORD,
		KEYWORD_GUARD,
		KEYWORD
	];
	const BUILT_INS = [{
		match: concat(/\./, either(...builtIns)),
		relevance: 0
	}, {
		className: "built_in",
		match: concat(/\b/, either(...builtIns), /(?=\()/)
	}];
	const OPERATOR_GUARD = {
		match: /->/,
		relevance: 0
	};
	const OPERATORS = [OPERATOR_GUARD, {
		className: "operator",
		relevance: 0,
		variants: [{ match: operator }, { match: `\\.(\\.|${operatorCharacter})+` }]
	}];
	const decimalDigits = "([0-9]_*)+";
	const hexDigits = "([0-9a-fA-F]_*)+";
	const NUMBER = {
		className: "number",
		relevance: 0,
		variants: [
			{ match: `\\b(${decimalDigits})(\\.(${decimalDigits}))?([eE][+-]?(${decimalDigits}))?\\b` },
			{ match: `\\b0x(${hexDigits})(\\.(${hexDigits}))?([pP][+-]?(${decimalDigits}))?\\b` },
			{ match: /\b0o([0-7]_*)+\b/ },
			{ match: /\b0b([01]_*)+\b/ }
		]
	};
	const ESCAPED_CHARACTER = (rawDelimiter = "") => ({
		className: "subst",
		variants: [{ match: concat(/\\/, rawDelimiter, /[0\\tnr"']/) }, { match: concat(/\\/, rawDelimiter, /u\{[0-9a-fA-F]{1,8}\}/) }]
	});
	const ESCAPED_NEWLINE = (rawDelimiter = "") => ({
		className: "subst",
		match: concat(/\\/, rawDelimiter, /[\t ]*(?:[\r\n]|\r\n)/)
	});
	const INTERPOLATION = (rawDelimiter = "") => ({
		className: "subst",
		label: "interpol",
		begin: concat(/\\/, rawDelimiter, /\(/),
		end: /\)/
	});
	const MULTILINE_STRING = (rawDelimiter = "") => ({
		begin: concat(rawDelimiter, /"""/),
		end: concat(/"""/, rawDelimiter),
		contains: [
			ESCAPED_CHARACTER(rawDelimiter),
			ESCAPED_NEWLINE(rawDelimiter),
			INTERPOLATION(rawDelimiter)
		]
	});
	const SINGLE_LINE_STRING = (rawDelimiter = "") => ({
		begin: concat(rawDelimiter, /"/),
		end: concat(/"/, rawDelimiter),
		contains: [ESCAPED_CHARACTER(rawDelimiter), INTERPOLATION(rawDelimiter)]
	});
	const STRING = {
		className: "string",
		variants: [
			MULTILINE_STRING(),
			MULTILINE_STRING("#"),
			MULTILINE_STRING("##"),
			MULTILINE_STRING("###"),
			SINGLE_LINE_STRING(),
			SINGLE_LINE_STRING("#"),
			SINGLE_LINE_STRING("##"),
			SINGLE_LINE_STRING("###")
		]
	};
	const REGEXP_CONTENTS = [hljs.BACKSLASH_ESCAPE, {
		begin: /\[/,
		end: /\]/,
		relevance: 0,
		contains: [hljs.BACKSLASH_ESCAPE]
	}];
	const BARE_REGEXP_LITERAL = {
		begin: /\/[^\s](?=[^/\n]*\/)/,
		end: /\//,
		contains: REGEXP_CONTENTS
	};
	const EXTENDED_REGEXP_LITERAL = (rawDelimiter) => {
		const begin = concat(rawDelimiter, /\//);
		const end = concat(/\//, rawDelimiter);
		return {
			begin,
			end,
			contains: [...REGEXP_CONTENTS, {
				scope: "comment",
				begin: `#(?!.*${end})`,
				end: /$/
			}]
		};
	};
	const REGEXP = {
		scope: "regexp",
		variants: [
			EXTENDED_REGEXP_LITERAL("###"),
			EXTENDED_REGEXP_LITERAL("##"),
			EXTENDED_REGEXP_LITERAL("#"),
			BARE_REGEXP_LITERAL
		]
	};
	const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) };
	const IDENTIFIERS = [
		QUOTED_IDENTIFIER,
		{
			className: "variable",
			match: /\$\d+/
		},
		{
			className: "variable",
			match: `\\$${identifierCharacter}+`
		}
	];
	const ATTRIBUTES = [
		{
			match: /(@|#(un)?)available/,
			scope: "keyword",
			starts: { contains: [{
				begin: /\(/,
				end: /\)/,
				keywords: availabilityKeywords,
				contains: [
					...OPERATORS,
					NUMBER,
					STRING
				]
			}] }
		},
		{
			scope: "keyword",
			match: concat(/@/, either(...keywordAttributes), lookahead(either(/\(/, /\s+/)))
		},
		{
			scope: "meta",
			match: concat(/@/, identifier)
		}
	];
	const TYPE = {
		match: lookahead(/\b[A-Z]/),
		relevance: 0,
		contains: [
			{
				className: "type",
				match: concat(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, identifierCharacter, "+")
			},
			{
				className: "type",
				match: typeIdentifier,
				relevance: 0
			},
			{
				match: /[?!]+/,
				relevance: 0
			},
			{
				match: /\.\.\./,
				relevance: 0
			},
			{
				match: concat(/\s+&\s+/, lookahead(typeIdentifier)),
				relevance: 0
			}
		]
	};
	const GENERIC_ARGUMENTS = {
		begin: /</,
		end: />/,
		keywords: KEYWORDS,
		contains: [
			...COMMENTS,
			...KEYWORD_MODES,
			...ATTRIBUTES,
			OPERATOR_GUARD,
			TYPE
		]
	};
	TYPE.contains.push(GENERIC_ARGUMENTS);
	const TUPLE = {
		begin: /\(/,
		end: /\)/,
		relevance: 0,
		keywords: KEYWORDS,
		contains: [
			"self",
			{
				match: concat(identifier, /\s*:/),
				keywords: "_|0",
				relevance: 0
			},
			...COMMENTS,
			REGEXP,
			...KEYWORD_MODES,
			...BUILT_INS,
			...OPERATORS,
			NUMBER,
			STRING,
			...IDENTIFIERS,
			...ATTRIBUTES,
			TYPE
		]
	};
	const GENERIC_PARAMETERS = {
		begin: /</,
		end: />/,
		keywords: "repeat each",
		contains: [...COMMENTS, TYPE]
	};
	const FUNCTION_PARAMETERS = {
		begin: /\(/,
		end: /\)/,
		keywords: KEYWORDS,
		contains: [
			{
				begin: either(lookahead(concat(identifier, /\s*:/)), lookahead(concat(identifier, /\s+/, identifier, /\s*:/))),
				end: /:/,
				relevance: 0,
				contains: [{
					className: "keyword",
					match: /\b_\b/
				}, {
					className: "params",
					match: identifier
				}]
			},
			...COMMENTS,
			...KEYWORD_MODES,
			...OPERATORS,
			NUMBER,
			STRING,
			...ATTRIBUTES,
			TYPE,
			TUPLE
		],
		endsParent: true,
		illegal: /["']/
	};
	const FUNCTION_OR_MACRO = {
		match: [
			/(func|macro)/,
			/\s+/,
			either(QUOTED_IDENTIFIER.match, identifier, operator)
		],
		className: {
			1: "keyword",
			3: "title.function"
		},
		contains: [
			GENERIC_PARAMETERS,
			FUNCTION_PARAMETERS,
			WHITESPACE
		],
		illegal: [/\[/, /%/]
	};
	const INIT_SUBSCRIPT = {
		match: [/\b(?:subscript|init[?!]?)/, /\s*(?=[<(])/],
		className: { 1: "keyword" },
		contains: [
			GENERIC_PARAMETERS,
			FUNCTION_PARAMETERS,
			WHITESPACE
		],
		illegal: /\[|%/
	};
	const OPERATOR_DECLARATION = {
		match: [
			/operator/,
			/\s+/,
			operator
		],
		className: {
			1: "keyword",
			3: "title"
		}
	};
	const PRECEDENCEGROUP = {
		begin: [
			/precedencegroup/,
			/\s+/,
			typeIdentifier
		],
		className: {
			1: "keyword",
			3: "title"
		},
		contains: [TYPE],
		keywords: [...precedencegroupKeywords, ...literals],
		end: /}/
	};
	const CLASS_FUNC_DECLARATION = {
		match: [
			/class\b/,
			/\s+/,
			/func\b/,
			/\s+/,
			/\b[A-Za-z_][A-Za-z0-9_]*\b/
		],
		scope: {
			1: "keyword",
			3: "keyword",
			5: "title.function"
		}
	};
	const CLASS_VAR_DECLARATION = {
		match: [
			/class\b/,
			/\s+/,
			/var\b/
		],
		scope: {
			1: "keyword",
			3: "keyword"
		}
	};
	const TYPE_DECLARATION = {
		begin: [
			/(struct|protocol|class|extension|enum|actor)/,
			/\s+/,
			identifier,
			/\s*/
		],
		beginScope: {
			1: "keyword",
			3: "title.class"
		},
		keywords: KEYWORDS,
		contains: [
			GENERIC_PARAMETERS,
			...KEYWORD_MODES,
			{
				begin: /:/,
				end: /\{/,
				keywords: KEYWORDS,
				contains: [{
					scope: "title.class.inherited",
					match: typeIdentifier
				}, ...KEYWORD_MODES],
				relevance: 0
			}
		]
	};
	for (const variant of STRING.variants) {
		const interpolation = variant.contains.find((mode) => mode.label === "interpol");
		interpolation.keywords = KEYWORDS;
		const submodes = [
			...KEYWORD_MODES,
			...BUILT_INS,
			...OPERATORS,
			NUMBER,
			STRING,
			...IDENTIFIERS
		];
		interpolation.contains = [...submodes, {
			begin: /\(/,
			end: /\)/,
			contains: ["self", ...submodes]
		}];
	}
	return {
		name: "Swift",
		keywords: KEYWORDS,
		contains: [
			...COMMENTS,
			FUNCTION_OR_MACRO,
			INIT_SUBSCRIPT,
			CLASS_FUNC_DECLARATION,
			CLASS_VAR_DECLARATION,
			TYPE_DECLARATION,
			OPERATOR_DECLARATION,
			PRECEDENCEGROUP,
			{
				beginKeywords: "import",
				end: /$/,
				contains: [...COMMENTS],
				relevance: 0
			},
			REGEXP,
			...KEYWORD_MODES,
			...BUILT_INS,
			...OPERATORS,
			NUMBER,
			STRING,
			...IDENTIFIERS,
			...ATTRIBUTES,
			TYPE,
			TUPLE
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/typescript.js
var IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*";
var KEYWORDS = [
	"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"
];
var LITERALS = [
	"true",
	"false",
	"null",
	"undefined",
	"NaN",
	"Infinity"
];
var TYPES = [
	"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"
];
var ERROR_TYPES = [
	"Error",
	"EvalError",
	"InternalError",
	"RangeError",
	"ReferenceError",
	"SyntaxError",
	"TypeError",
	"URIError"
];
var BUILT_IN_GLOBALS = [
	"setInterval",
	"setTimeout",
	"clearInterval",
	"clearTimeout",
	"require",
	"exports",
	"eval",
	"isFinite",
	"isNaN",
	"parseFloat",
	"parseInt",
	"decodeURI",
	"decodeURIComponent",
	"encodeURI",
	"encodeURIComponent",
	"escape",
	"unescape"
];
var BUILT_IN_VARIABLES = [
	"arguments",
	"this",
	"super",
	"console",
	"window",
	"document",
	"localStorage",
	"sessionStorage",
	"module",
	"global"
];
var BUILT_INS = [].concat(BUILT_IN_GLOBALS, TYPES, ERROR_TYPES);
/** @type LanguageFn */
function javascript(hljs) {
	const regex = hljs.regex;
	/**
	* Takes a string like "<Booger" and checks to see
	* if we can find a matching "</Booger" later in the
	* content.
	* @param {RegExpMatchArray} match
	* @param {{after:number}} param1
	*/
	const hasClosingTag = (match, { after }) => {
		const tag = "</" + match[0].slice(1);
		return match.input.indexOf(tag, after) !== -1;
	};
	const IDENT_RE$1 = IDENT_RE;
	const FRAGMENT = {
		begin: "<>",
		end: "</>"
	};
	const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
	const XML_TAG = {
		begin: /<[A-Za-z0-9\\._:-]+/,
		end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
		/**
		* @param {RegExpMatchArray} match
		* @param {CallbackResponse} response
		*/
		isTrulyOpeningTag: (match, response) => {
			const afterMatchIndex = match[0].length + match.index;
			const nextChar = match.input[afterMatchIndex];
			if (nextChar === "<" || nextChar === ",") {
				response.ignoreMatch();
				return;
			}
			if (nextChar === ">") {
				if (!hasClosingTag(match, { after: afterMatchIndex })) response.ignoreMatch();
			}
			let m;
			const afterMatch = match.input.substring(afterMatchIndex);
			if (m = afterMatch.match(/^\s*=/)) {
				response.ignoreMatch();
				return;
			}
			if (m = afterMatch.match(/^\s+extends\s+/)) {
				if (m.index === 0) {
					response.ignoreMatch();
					return;
				}
			}
		}
	};
	const KEYWORDS$1 = {
		$pattern: IDENT_RE,
		keyword: KEYWORDS,
		literal: LITERALS,
		built_in: BUILT_INS,
		"variable.language": BUILT_IN_VARIABLES
	};
	const decimalDigits = "[0-9](_?[0-9])*";
	const frac = `\\.(${decimalDigits})`;
	const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
	const NUMBER = {
		className: "number",
		variants: [
			{ begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
			{ begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\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
	};
	const SUBST = {
		className: "subst",
		begin: "\\$\\{",
		end: "\\}",
		keywords: KEYWORDS$1,
		contains: []
	};
	const HTML_TEMPLATE = {
		begin: ".?html`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "xml"
		}
	};
	const CSS_TEMPLATE = {
		begin: ".?css`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "css"
		}
	};
	const GRAPHQL_TEMPLATE = {
		begin: ".?gql`",
		end: "",
		starts: {
			end: "`",
			returnEnd: false,
			contains: [hljs.BACKSLASH_ESCAPE, SUBST],
			subLanguage: "graphql"
		}
	};
	const TEMPLATE_STRING = {
		className: "string",
		begin: "`",
		end: "`",
		contains: [hljs.BACKSLASH_ESCAPE, SUBST]
	};
	const COMMENT = {
		className: "comment",
		variants: [
			hljs.COMMENT(/\/\*\*(?!\/)/, "\\*/", {
				relevance: 0,
				contains: [{
					begin: "(?=@[A-Za-z]+)",
					relevance: 0,
					contains: [
						{
							className: "doctag",
							begin: "@[A-Za-z]+"
						},
						{
							className: "type",
							begin: "\\{",
							end: "\\}",
							excludeEnd: true,
							excludeBegin: true,
							relevance: 0
						},
						{
							className: "variable",
							begin: "[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)",
							endsParent: true,
							relevance: 0
						},
						{
							begin: /(?=[^\n])\s/,
							relevance: 0
						}
					]
				}]
			}),
			hljs.C_BLOCK_COMMENT_MODE,
			hljs.C_LINE_COMMENT_MODE
		]
	};
	const SUBST_INTERNALS = [
		hljs.APOS_STRING_MODE,
		hljs.QUOTE_STRING_MODE,
		HTML_TEMPLATE,
		CSS_TEMPLATE,
		GRAPHQL_TEMPLATE,
		TEMPLATE_STRING,
		{ match: /\$\d+/ },
		NUMBER
	];
	SUBST.contains = SUBST_INTERNALS.concat({
		begin: /\{/,
		end: /\}/,
		keywords: KEYWORDS$1,
		contains: ["self"].concat(SUBST_INTERNALS)
	});
	const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
	const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([{
		begin: /(\s*)\(/,
		end: /\)/,
		keywords: KEYWORDS$1,
		contains: ["self"].concat(SUBST_AND_COMMENTS)
	}]);
	const PARAMS = {
		className: "params",
		begin: /(\s*)\(/,
		end: /\)/,
		excludeBegin: true,
		excludeEnd: true,
		keywords: KEYWORDS$1,
		contains: PARAMS_CONTAINS
	};
	const CLASS_OR_EXTENDS = { variants: [{
		match: [
			/class/,
			/\s+/,
			IDENT_RE$1,
			/\s+/,
			/extends/,
			/\s+/,
			regex.concat(IDENT_RE$1, "(", regex.concat(/\./, IDENT_RE$1), ")*")
		],
		scope: {
			1: "keyword",
			3: "title.class",
			5: "keyword",
			7: "title.class.inherited"
		}
	}, {
		match: [
			/class/,
			/\s+/,
			IDENT_RE$1
		],
		scope: {
			1: "keyword",
			3: "title.class"
		}
	}] };
	const CLASS_REFERENCE = {
		relevance: 0,
		match: regex.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: { _: [...TYPES, ...ERROR_TYPES] }
	};
	const USE_STRICT = {
		label: "use_strict",
		className: "meta",
		relevance: 10,
		begin: /^\s*['"]use (strict|asm)['"]/
	};
	const FUNCTION_DEFINITION = {
		variants: [{ match: [
			/function/,
			/\s+/,
			IDENT_RE$1,
			/(?=\s*\()/
		] }, { match: [/function/, /\s*(?=\()/] }],
		className: {
			1: "keyword",
			3: "title.function"
		},
		label: "func.def",
		contains: [PARAMS],
		illegal: /%/
	};
	const UPPER_CASE_CONSTANT = {
		relevance: 0,
		match: /\b[A-Z][A-Z_0-9]+\b/,
		className: "variable.constant"
	};
	function noneOf(list) {
		return regex.concat("(?!", list.join("|"), ")");
	}
	const FUNCTION_CALL = {
		match: regex.concat(/\b/, noneOf([
			...BUILT_IN_GLOBALS,
			"super",
			"import"
		].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex.lookahead(/\s*\(/)),
		className: "title.function",
		relevance: 0
	};
	const PROPERTY_ACCESS = {
		begin: regex.concat(/\./, regex.lookahead(regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
		end: IDENT_RE$1,
		excludeBegin: true,
		keywords: "prototype",
		className: "property",
		relevance: 0
	};
	const GETTER_OR_SETTER = {
		match: [
			/get|set/,
			/\s+/,
			IDENT_RE$1,
			/(?=\()/
		],
		className: {
			1: "keyword",
			3: "title.function"
		},
		contains: [{ begin: /\(\)/ }, PARAMS]
	};
	const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
	const FUNCTION_VARIABLE = {
		match: [
			/const|var|let/,
			/\s+/,
			IDENT_RE$1,
			/\s*/,
			/=\s*/,
			/(async\s*)?/,
			regex.lookahead(FUNC_LEAD_IN_RE)
		],
		keywords: "async",
		className: {
			1: "keyword",
			3: "title.function"
		},
		contains: [PARAMS]
	};
	return {
		name: "JavaScript",
		aliases: [
			"js",
			"jsx",
			"mjs",
			"cjs"
		],
		keywords: KEYWORDS$1,
		exports: {
			PARAMS_CONTAINS,
			CLASS_REFERENCE
		},
		illegal: /#(?![$_A-z])/,
		contains: [
			hljs.SHEBANG({
				label: "shebang",
				binary: "node",
				relevance: 5
			}),
			USE_STRICT,
			hljs.APOS_STRING_MODE,
			hljs.QUOTE_STRING_MODE,
			HTML_TEMPLATE,
			CSS_TEMPLATE,
			GRAPHQL_TEMPLATE,
			TEMPLATE_STRING,
			COMMENT,
			{ match: /\$\d+/ },
			NUMBER,
			CLASS_REFERENCE,
			{
				scope: "attr",
				match: IDENT_RE$1 + regex.lookahead(":"),
				relevance: 0
			},
			FUNCTION_VARIABLE,
			{
				begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
				keywords: "return throw case",
				relevance: 0,
				contains: [
					COMMENT,
					hljs.REGEXP_MODE,
					{
						className: "function",
						begin: FUNC_LEAD_IN_RE,
						returnBegin: true,
						end: "\\s*=>",
						contains: [{
							className: "params",
							variants: [
								{
									begin: hljs.UNDERSCORE_IDENT_RE,
									relevance: 0
								},
								{
									className: null,
									begin: /\(\s*\)/,
									skip: true
								},
								{
									begin: /(\s*)\(/,
									end: /\)/,
									excludeBegin: true,
									excludeEnd: true,
									keywords: KEYWORDS$1,
									contains: PARAMS_CONTAINS
								}
							]
						}]
					},
					{
						begin: /,/,
						relevance: 0
					},
					{
						match: /\s+/,
						relevance: 0
					},
					{
						variants: [
							{
								begin: FRAGMENT.begin,
								end: FRAGMENT.end
							},
							{ match: XML_SELF_CLOSING },
							{
								begin: XML_TAG.begin,
								"on:begin": XML_TAG.isTrulyOpeningTag,
								end: XML_TAG.end
							}
						],
						subLanguage: "xml",
						contains: [{
							begin: XML_TAG.begin,
							end: XML_TAG.end,
							skip: true,
							contains: ["self"]
						}]
					}
				]
			},
			FUNCTION_DEFINITION,
			{ beginKeywords: "while if switch catch for" },
			{
				begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
				returnBegin: true,
				label: "func.def",
				contains: [PARAMS, hljs.inherit(hljs.TITLE_MODE, {
					begin: IDENT_RE$1,
					className: "title.function"
				})]
			},
			{
				match: /\.\.\./,
				relevance: 0
			},
			PROPERTY_ACCESS,
			{
				match: "\\$[A-Za-z$_][0-9A-Za-z$_]*",
				relevance: 0
			},
			{
				match: [/\bconstructor(?=\s*\()/],
				className: { 1: "title.function" },
				contains: [PARAMS]
			},
			FUNCTION_CALL,
			UPPER_CASE_CONSTANT,
			CLASS_OR_EXTENDS,
			GETTER_OR_SETTER,
			{ match: /\$[(.]/ }
		]
	};
}
/** @type LanguageFn */
function typescript(hljs) {
	const regex = hljs.regex;
	const tsLanguage = javascript(hljs);
	const IDENT_RE$1 = IDENT_RE;
	const TYPES = [
		"any",
		"void",
		"number",
		"boolean",
		"string",
		"object",
		"never",
		"symbol",
		"bigint",
		"unknown"
	];
	const NAMESPACE = {
		begin: [
			/namespace/,
			/\s+/,
			hljs.IDENT_RE
		],
		beginScope: {
			1: "keyword",
			3: "title.class"
		}
	};
	const INTERFACE = {
		beginKeywords: "interface",
		end: /\{/,
		excludeEnd: true,
		keywords: {
			keyword: "interface extends",
			built_in: TYPES
		},
		contains: [tsLanguage.exports.CLASS_REFERENCE]
	};
	const USE_STRICT = {
		className: "meta",
		relevance: 10,
		begin: /^\s*['"]use strict['"]/
	};
	const KEYWORDS$1 = {
		$pattern: IDENT_RE,
		keyword: KEYWORDS.concat([
			"type",
			"interface",
			"public",
			"private",
			"protected",
			"implements",
			"declare",
			"abstract",
			"readonly",
			"enum",
			"override",
			"satisfies"
		]),
		literal: LITERALS,
		built_in: BUILT_INS.concat(TYPES),
		"variable.language": BUILT_IN_VARIABLES
	};
	const DECORATOR = {
		className: "meta",
		begin: "@[A-Za-z$_][0-9A-Za-z$_]*"
	};
	const swapMode = (mode, label, replacement) => {
		const indx = mode.contains.findIndex((m) => m.label === label);
		if (indx === -1) throw new Error("can not find mode to replace");
		mode.contains.splice(indx, 1, replacement);
	};
	Object.assign(tsLanguage.keywords, KEYWORDS$1);
	tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
	const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find((c) => c.scope === "attr");
	const OPTIONAL_KEY_OR_ARGUMENT = Object.assign({}, ATTRIBUTE_HIGHLIGHT, { match: regex.concat(IDENT_RE$1, regex.lookahead(/\s*\?:/)) });
	tsLanguage.exports.PARAMS_CONTAINS.push([
		tsLanguage.exports.CLASS_REFERENCE,
		ATTRIBUTE_HIGHLIGHT,
		OPTIONAL_KEY_OR_ARGUMENT
	]);
	tsLanguage.contains = tsLanguage.contains.concat([
		DECORATOR,
		NAMESPACE,
		INTERFACE,
		OPTIONAL_KEY_OR_ARGUMENT
	]);
	swapMode(tsLanguage, "shebang", hljs.SHEBANG());
	swapMode(tsLanguage, "use_strict", USE_STRICT);
	const functionDeclaration = tsLanguage.contains.find((m) => m.label === "func.def");
	functionDeclaration.relevance = 0;
	Object.assign(tsLanguage, {
		name: "TypeScript",
		aliases: [
			"ts",
			"tsx",
			"mts",
			"cts"
		]
	});
	return tsLanguage;
}
//#endregion
//#region node_modules/highlight.js/es/languages/vbnet.js
/** @type LanguageFn */
function vbnet(hljs) {
	const regex = hljs.regex;
	/**
	* Character Literal
	* Either a single character ("a"C) or an escaped double quote (""""C).
	*/
	const CHARACTER = {
		className: "string",
		begin: /"(""|[^/n])"C\b/
	};
	const STRING = {
		className: "string",
		begin: /"/,
		end: /"/,
		illegal: /\n/,
		contains: [{ begin: /""/ }]
	};
	/** Date Literals consist of a date, a time, or both separated by whitespace, surrounded by # */
	const MM_DD_YYYY = /\d{1,2}\/\d{1,2}\/\d{4}/;
	const YYYY_MM_DD = /\d{4}-\d{1,2}-\d{1,2}/;
	const TIME_12H = /(\d|1[012])(:\d+){0,2} *(AM|PM)/;
	const TIME_24H = /\d{1,2}(:\d{1,2}){1,2}/;
	const DATE = {
		className: "literal",
		variants: [
			{ begin: regex.concat(/# */, regex.either(YYYY_MM_DD, MM_DD_YYYY), / *#/) },
			{ begin: regex.concat(/# */, TIME_24H, / *#/) },
			{ begin: regex.concat(/# */, TIME_12H, / *#/) },
			{ begin: regex.concat(/# */, regex.either(YYYY_MM_DD, MM_DD_YYYY), / +/, regex.either(TIME_12H, TIME_24H), / *#/) }
		]
	};
	const NUMBER = {
		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])|[%&])?/ }
		]
	};
	const LABEL = {
		className: "label",
		begin: /^\w+:/
	};
	const DOC_COMMENT = hljs.COMMENT(/'''/, /$/, { contains: [{
		className: "doctag",
		begin: /<\/?/,
		end: />/
	}] });
	const COMMENT = hljs.COMMENT(null, /$/, { variants: [{ begin: /'/ }, { begin: /([\t ]|^)REM(?=\s)/ }] });
	return {
		name: "Visual Basic .NET",
		aliases: ["vb"],
		case_insensitive: true,
		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: [
			CHARACTER,
			STRING,
			DATE,
			NUMBER,
			LABEL,
			DOC_COMMENT,
			COMMENT,
			{
				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: [COMMENT]
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/wasm.js
/** @type LanguageFn */
function wasm(hljs) {
	hljs.regex;
	const BLOCK_COMMENT = hljs.COMMENT(/\(;/, /;\)/);
	BLOCK_COMMENT.contains.push("self");
	return {
		name: "WebAssembly",
		keywords: {
			$pattern: /[\w.]+/,
			keyword: [
				"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"
			]
		},
		contains: [
			hljs.COMMENT(/;;/, /$/),
			BLOCK_COMMENT,
			{
				match: [
					/(?:offset|align)/,
					/\s*/,
					/=/
				],
				className: {
					1: "keyword",
					3: "operator"
				}
			},
			{
				className: "variable",
				begin: /\$[\w_]+/
			},
			{
				match: /(\((?!;)|\))+/,
				className: "punctuation",
				relevance: 0
			},
			{
				begin: [
					/(?:func|call|call_indirect)/,
					/\s+/,
					/\$[^\s)]+/
				],
				className: {
					1: "keyword",
					3: "title.function"
				}
			},
			hljs.QUOTE_STRING_MODE,
			{
				match: /(i32|i64|f32|f64)(?!\.)/,
				className: "type"
			},
			{
				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/
			},
			{
				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/
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/xml.js
/** @type LanguageFn */
function xml(hljs) {
	const regex = hljs.regex;
	const TAG_NAME_RE = regex.concat(/[\p{L}_]/u, regex.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u);
	const XML_IDENT_RE = /[\p{L}0-9._:-]+/u;
	const XML_ENTITIES = {
		className: "symbol",
		begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
	};
	const XML_META_KEYWORDS = {
		begin: /\s/,
		contains: [{
			className: "keyword",
			begin: /#?[a-z_][a-z1-9_-]+/,
			illegal: /\n/
		}]
	};
	const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {
		begin: /\(/,
		end: /\)/
	});
	const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: "string" });
	const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: "string" });
	const TAG_INTERNALS = {
		endsWithParent: true,
		illegal: /</,
		relevance: 0,
		contains: [{
			className: "attr",
			begin: XML_IDENT_RE,
			relevance: 0
		}, {
			begin: /=\s*/,
			relevance: 0,
			contains: [{
				className: "string",
				endsParent: true,
				variants: [
					{
						begin: /"/,
						end: /"/,
						contains: [XML_ENTITIES]
					},
					{
						begin: /'/,
						end: /'/,
						contains: [XML_ENTITIES]
					},
					{ begin: /[^\s"'=<>`]+/ }
				]
			}]
		}]
	};
	return {
		name: "HTML, XML",
		aliases: [
			"html",
			"xhtml",
			"rss",
			"atom",
			"xjb",
			"xsd",
			"xsl",
			"plist",
			"wsf",
			"svg"
		],
		case_insensitive: true,
		unicodeRegex: true,
		contains: [
			{
				className: "meta",
				begin: /<![a-z]/,
				end: />/,
				relevance: 10,
				contains: [
					XML_META_KEYWORDS,
					QUOTE_META_STRING_MODE,
					APOS_META_STRING_MODE,
					XML_META_PAR_KEYWORDS,
					{
						begin: /\[/,
						end: /\]/,
						contains: [{
							className: "meta",
							begin: /<![a-z]/,
							end: />/,
							contains: [
								XML_META_KEYWORDS,
								XML_META_PAR_KEYWORDS,
								QUOTE_META_STRING_MODE,
								APOS_META_STRING_MODE
							]
						}]
					}
				]
			},
			hljs.COMMENT(/<!--/, /-->/, { relevance: 10 }),
			{
				begin: /<!\[CDATA\[/,
				end: /\]\]>/,
				relevance: 10
			},
			XML_ENTITIES,
			{
				className: "meta",
				end: /\?>/,
				variants: [{
					begin: /<\?xml/,
					relevance: 10,
					contains: [QUOTE_META_STRING_MODE]
				}, { begin: /<\?[a-z][a-z0-9]+/ }]
			},
			{
				className: "tag",
				begin: /<style(?=\s|>)/,
				end: />/,
				keywords: { name: "style" },
				contains: [TAG_INTERNALS],
				starts: {
					end: /<\/style>/,
					returnEnd: true,
					subLanguage: ["css", "xml"]
				}
			},
			{
				className: "tag",
				begin: /<script(?=\s|>)/,
				end: />/,
				keywords: { name: "script" },
				contains: [TAG_INTERNALS],
				starts: {
					end: /<\/script>/,
					returnEnd: true,
					subLanguage: [
						"javascript",
						"handlebars",
						"xml"
					]
				}
			},
			{
				className: "tag",
				begin: /<>|<\/>/
			},
			{
				className: "tag",
				begin: regex.concat(/</, regex.lookahead(regex.concat(TAG_NAME_RE, regex.either(/\/>/, />/, /\s/)))),
				end: /\/?>/,
				contains: [{
					className: "name",
					begin: TAG_NAME_RE,
					relevance: 0,
					starts: TAG_INTERNALS
				}]
			},
			{
				className: "tag",
				begin: regex.concat(/<\//, regex.lookahead(regex.concat(TAG_NAME_RE, />/))),
				contains: [{
					className: "name",
					begin: TAG_NAME_RE,
					relevance: 0
				}, {
					begin: />/,
					relevance: 0,
					endsParent: true
				}]
			}
		]
	};
}
//#endregion
//#region node_modules/highlight.js/es/languages/yaml.js
function yaml(hljs) {
	const LITERALS = "true false yes no null";
	const KEY = {
		className: "attr",
		variants: [
			{ begin: /[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/ },
			{ begin: /"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/ },
			{ begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/ }
		]
	};
	const TEMPLATE_VARIABLES = {
		className: "template-variable",
		variants: [{
			begin: /\{\{/,
			end: /\}\}/
		}, {
			begin: /%\{/,
			end: /\}/
		}]
	};
	const SINGLE_QUOTE_STRING = {
		className: "string",
		relevance: 0,
		begin: /'/,
		end: /'/,
		contains: [{
			match: /''/,
			scope: "char.escape",
			relevance: 0
		}]
	};
	const STRING = {
		className: "string",
		relevance: 0,
		variants: [{
			begin: /"/,
			end: /"/
		}, { begin: /\S+/ }],
		contains: [hljs.BACKSLASH_ESCAPE, TEMPLATE_VARIABLES]
	};
	const CONTAINER_STRING = hljs.inherit(STRING, { variants: [
		{
			begin: /'/,
			end: /'/,
			contains: [{
				begin: /''/,
				relevance: 0
			}]
		},
		{
			begin: /"/,
			end: /"/
		},
		{ begin: /[^\s,{}[\]]+/ }
	] });
	const TIMESTAMP = {
		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"
	};
	const VALUE_CONTAINER = {
		end: ",",
		endsWithParent: true,
		excludeEnd: true,
		keywords: LITERALS,
		relevance: 0
	};
	const OBJECT = {
		begin: /\{/,
		end: /\}/,
		contains: [VALUE_CONTAINER],
		illegal: "\\n",
		relevance: 0
	};
	const ARRAY = {
		begin: "\\[",
		end: "\\]",
		contains: [VALUE_CONTAINER],
		illegal: "\\n",
		relevance: 0
	};
	const MODES = [
		KEY,
		{
			className: "meta",
			begin: "^---\\s*$",
			relevance: 10
		},
		{
			className: "string",
			begin: "[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"
		},
		{
			begin: "<%[%=-]?",
			end: "[%-]?%>",
			subLanguage: "ruby",
			excludeBegin: true,
			excludeEnd: true,
			relevance: 0
		},
		{
			className: "type",
			begin: "!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+"
		},
		{
			className: "type",
			begin: "!<[\\w#;/?:@&=+$,.~*'()[\\]]+>"
		},
		{
			className: "type",
			begin: "![\\w#;/?:@&=+$,.~*'()[\\]]+"
		},
		{
			className: "type",
			begin: "!![\\w#;/?:@&=+$,.~*'()[\\]]+"
		},
		{
			className: "meta",
			begin: "&" + hljs.UNDERSCORE_IDENT_RE + "$"
		},
		{
			className: "meta",
			begin: "\\*" + hljs.UNDERSCORE_IDENT_RE + "$"
		},
		{
			className: "bullet",
			begin: "-(?=[ ]|$)",
			relevance: 0
		},
		hljs.HASH_COMMENT_MODE,
		{
			beginKeywords: LITERALS,
			keywords: { literal: LITERALS }
		},
		TIMESTAMP,
		{
			className: "number",
			begin: hljs.C_NUMBER_RE + "\\b",
			relevance: 0
		},
		OBJECT,
		ARRAY,
		SINGLE_QUOTE_STRING,
		STRING
	];
	const VALUE_MODES = [...MODES];
	VALUE_MODES.pop();
	VALUE_MODES.push(CONTAINER_STRING);
	VALUE_CONTAINER.contains = VALUE_MODES;
	return {
		name: "YAML",
		case_insensitive: true,
		aliases: ["yml"],
		contains: MODES
	};
}
//#endregion
//#region node_modules/lowlight/lib/common.js
/**
* @import {LanguageFn} from 'highlight.js'
*/
/**
* Map of grammars.
*
* @type {Record<string, LanguageFn>}
*/
var grammars = {
	arduino,
	bash,
	c,
	cpp,
	csharp,
	css,
	diff,
	go,
	graphql,
	ini,
	java,
	javascript: javascript$1,
	json,
	kotlin,
	less,
	lua,
	makefile,
	markdown,
	objectivec,
	perl,
	php,
	"php-template": phpTemplate,
	plaintext,
	python,
	"python-repl": pythonRepl,
	r,
	ruby,
	rust,
	scss,
	shell,
	sql,
	swift,
	typescript,
	vbnet,
	wasm,
	xml,
	yaml
};
//#endregion
//#region node_modules/lowlight/lib/index.js
/**
* @import {ElementContent, Element, RootData, Root} from 'hast'
* @import {Emitter, HLJSOptions as HljsOptions, HighlightResult, LanguageFn} from 'highlight.js'
*/
/**
* @typedef {Object} ExtraOptions
*   Extra fields.
* @property {ReadonlyArray<string> | null | undefined} [subset]
*   List of allowed languages (default: all registered languages).
*
* @typedef Options
*   Configuration for `highlight`.
* @property {string | null | undefined} [prefix='hljs-']
*   Class prefix (default: `'hljs-'`).
*
* @typedef {Options & ExtraOptions} AutoOptions
*   Configuration for `highlightAuto`.
*/
/** @type {AutoOptions} */
var emptyOptions = {};
var defaultPrefix = "hljs-";
/**
* Create a `lowlight` instance.
*
* @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]
*   Grammars to add (optional).
* @returns
*   Lowlight.
*/
function createLowlight(grammars) {
	const high = core_default.newInstance();
	if (grammars) register(grammars);
	return {
		highlight,
		highlightAuto,
		listLanguages,
		register,
		registerAlias,
		registered
	};
	/**
	* Highlight `value` (code) as `language` (name).
	*
	* @example
	*   ```js
	*   import {common, createLowlight} from 'lowlight'
	*
	*   const lowlight = createLowlight(common)
	*
	*   console.log(lowlight.highlight('css', 'em { color: red }'))
	*   ```
	*
	*   Yields:
	*
	*   ```js
	*   {type: 'root', children: [Array], data: {language: 'css', relevance: 3}}
	*   ```
	*
	* @param {string} language
	*   Programming language name.
	* @param {string} value
	*   Code to highlight.
	* @param {Readonly<Options> | null | undefined} [options={}]
	*   Configuration (optional).
	* @returns {Root}
	*   Tree; with the following `data` fields: `language` (`string`), detected
	*   programming language name; `relevance` (`number`), how sure lowlight is
	*   that the given code is in the language.
	*/
	function highlight(language, value, options) {
		const settings = options || emptyOptions;
		const prefix = typeof settings.prefix === "string" ? settings.prefix : defaultPrefix;
		if (!high.getLanguage(language)) throw new Error("Unknown language: `" + language + "` is not registered");
		high.configure({
			__emitter: HastEmitter,
			classPrefix: prefix
		});
		const result = high.highlight(value, {
			ignoreIllegals: true,
			language
		});
		/* c8 ignore next 5 */
		if (result.errorRaised) throw new Error("Could not highlight with `Highlight.js`", { cause: result.errorRaised });
		const root = result._emitter.root;
		const data = root.data;
		data.language = result.language;
		data.relevance = result.relevance;
		return root;
	}
	/**
	* Highlight `value` (code) and guess its programming language.
	*
	* @example
	*   ```js
	*   import {common, createLowlight} from 'lowlight'
	*
	*   const lowlight = createLowlight(common)
	*
	*   console.log(lowlight.highlightAuto('"hello, " + name + "!"'))
	*   ```
	*
	*   Yields:
	*
	*   ```js
	*   {type: 'root', children: [Array], data: {language: 'arduino', relevance: 2}}
	*   ```
	*
	* @param {string} value
	*   Code to highlight.
	* @param {Readonly<AutoOptions> | null | undefined} [options={}]
	*   Configuration (optional).
	* @returns {Root}
	*   Tree; with the following `data` fields: `language` (`string`), detected
	*   programming language name; `relevance` (`number`), how sure lowlight is
	*   that the given code is in the language.
	*/
	function highlightAuto(value, options) {
		const subset = (options || emptyOptions).subset || listLanguages();
		let index = -1;
		let relevance = 0;
		/** @type {Root | undefined} */
		let result;
		while (++index < subset.length) {
			const name = subset[index];
			if (!high.getLanguage(name)) continue;
			const current = highlight(name, value, options);
			if (current.data && current.data.relevance !== void 0 && current.data.relevance > relevance) {
				relevance = current.data.relevance;
				result = current;
			}
		}
		return result || {
			type: "root",
			children: [],
			data: {
				language: void 0,
				relevance
			}
		};
	}
	/**
	* List registered languages.
	*
	* @example
	*   ```js
	*   import {createLowlight} from 'lowlight'
	*   import markdown from 'highlight.js/lib/languages/markdown'
	*
	*   const lowlight = createLowlight()
	*
	*   console.log(lowlight.listLanguages()) // => []
	*
	*   lowlight.register({markdown})
	*
	*   console.log(lowlight.listLanguages()) // => ['markdown']
	*   ```
	*
	* @returns {Array<string>}
	*   Names of registered language.
	*/
	function listLanguages() {
		return high.listLanguages();
	}
	/**
	* Register languages.
	*
	* @example
	*   ```js
	*   import {createLowlight} from 'lowlight'
	*   import xml from 'highlight.js/lib/languages/xml'
	*
	*   const lowlight = createLowlight()
	*
	*   lowlight.register({xml})
	*
	*   // Note: `html` is an alias for `xml`.
	*   console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
	*   ```
	*
	*   Yields:
	*
	*   ```js
	*   {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
	*   ```
	*
	* @overload
	* @param {Readonly<Record<string, LanguageFn>>} grammars
	* @returns {undefined}
	*
	* @overload
	* @param {string} name
	* @param {LanguageFn} grammar
	* @returns {undefined}
	*
	* @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
	*   Grammars or programming language name.
	* @param {LanguageFn | undefined} [grammar]
	*   Grammar, if with name.
	* @returns {undefined}
	*   Nothing.
	*/
	function register(grammarsOrName, grammar) {
		if (typeof grammarsOrName === "string") high.registerLanguage(grammarsOrName, grammar);
		else {
			/** @type {string} */
			let name;
			for (name in grammarsOrName) if (Object.hasOwn(grammarsOrName, name)) high.registerLanguage(name, grammarsOrName[name]);
		}
	}
	/**
	* Register aliases.
	*
	* @example
	*   ```js
	*   import {createLowlight} from 'lowlight'
	*   import markdown from 'highlight.js/lib/languages/markdown'
	*
	*   const lowlight = createLowlight()
	*
	*   lowlight.register({markdown})
	*
	*   // lowlight.highlight('mdown', '<em>Emphasis</em>')
	*   // ^ would throw: Error: Unknown language: `mdown` is not registered
	*
	*   lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
	*   lowlight.highlight('mdown', '<em>Emphasis</em>')
	*   // ^ Works!
	*   ```
	*
	* @overload
	* @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
	* @returns {undefined}
	*
	* @overload
	* @param {string} language
	* @param {ReadonlyArray<string> | string} alias
	* @returns {undefined}
	*
	* @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
	*   Map of programming language names to one or more aliases, or programming
	*   language name.
	* @param {ReadonlyArray<string> | string | undefined} [alias]
	*   One or more aliases for the programming language, if with `name`.
	* @returns {undefined}
	*   Nothing.
	*/
	function registerAlias(aliasesOrName, alias) {
		if (typeof aliasesOrName === "string") high.registerAliases(typeof alias === "string" ? alias : [...alias], { languageName: aliasesOrName });
		else {
			/** @type {string} */
			let key;
			for (key in aliasesOrName) if (Object.hasOwn(aliasesOrName, key)) {
				const aliases = aliasesOrName[key];
				high.registerAliases(typeof aliases === "string" ? aliases : [...aliases], { languageName: key });
			}
		}
	}
	/**
	* Check whether an alias or name is registered.
	*
	* @example
	*   ```js
	*   import {createLowlight} from 'lowlight'
	*   import javascript from 'highlight.js/lib/languages/javascript'
	*
	*   const lowlight = createLowlight({javascript})
	*
	*   console.log(lowlight.registered('funkyscript')) // => `false`
	*
	*   lowlight.registerAlias({javascript: 'funkyscript'})
	*   console.log(lowlight.registered('funkyscript')) // => `true`
	*   ```
	*
	* @param {string} aliasOrName
	*   Name of a language or alias for one.
	* @returns {boolean}
	*   Whether `aliasOrName` is registered.
	*/
	function registered(aliasOrName) {
		return Boolean(high.getLanguage(aliasOrName));
	}
}
/** @type {Emitter} */
var HastEmitter = class {
	/**
	* @param {Readonly<HljsOptions>} options
	*   Configuration.
	* @returns
	*   Instance.
	*/
	constructor(options) {
		/** @type {HljsOptions} */
		this.options = options;
		/** @type {Root} */
		this.root = {
			type: "root",
			children: [],
			data: {
				language: void 0,
				relevance: 0
			}
		};
		/** @type {[Root, ...Array<Element>]} */
		this.stack = [this.root];
	}
	/**
	* @param {string} value
	*   Text to add.
	* @returns {undefined}
	*   Nothing.
	*
	*/
	addText(value) {
		if (value === "") return;
		const current = this.stack[this.stack.length - 1];
		const tail = current.children[current.children.length - 1];
		if (tail && tail.type === "text") tail.value += value;
		else current.children.push({
			type: "text",
			value
		});
	}
	/**
	*
	* @param {unknown} rawName
	*   Name to add.
	* @returns {undefined}
	*   Nothing.
	*/
	startScope(rawName) {
		this.openNode(String(rawName));
	}
	/**
	* @returns {undefined}
	*   Nothing.
	*/
	endScope() {
		this.closeNode();
	}
	/**
	* @param {HastEmitter} other
	*   Other emitter.
	* @param {string} name
	*   Name of the sublanguage.
	* @returns {undefined}
	*   Nothing.
	*/
	__addSublanguage(other, name) {
		const current = this.stack[this.stack.length - 1];
		const results = other.root.children;
		if (name) current.children.push({
			type: "element",
			tagName: "span",
			properties: { className: [name] },
			children: results
		});
		else current.children.push(...results);
	}
	/**
	* @param {string} name
	*   Name to add.
	* @returns {undefined}
	*   Nothing.
	*/
	openNode(name) {
		const self = this;
		const className = name.split(".").map(function(d, i) {
			return i ? d + "_".repeat(i) : self.options.classPrefix + d;
		});
		const current = this.stack[this.stack.length - 1];
		/** @type {Element} */
		const child = {
			type: "element",
			tagName: "span",
			properties: { className },
			children: []
		};
		current.children.push(child);
		this.stack.push(child);
	}
	/**
	* @returns {undefined}
	*   Nothing.
	*/
	closeNode() {
		this.stack.pop();
	}
	/**
	* @returns {undefined}
	*   Nothing.
	*/
	finalize() {}
	/**
	* @returns {string}
	*   Nothing.
	*/
	toHTML() {
		return "";
	}
};
//#endregion
//#region resources/js/lib/highlight.ts
/**
* Shared syntax-highlighting helpers.
*
* The composer (CodeBlockLowlight) highlights live while you type using this
* lowlight instance. Rendered posts store raw code (`<pre><code
* class="language-x">…</code></pre>`) and are colorised on display by
* highlightWithin(), which lazy-loads highlight.js only when a post actually
* contains a code block.
*/
var lowlight = createLowlight(grammars);
/** The languages we expose in the composer's language picker. */
var CODE_LANGUAGES = [
	{
		value: "plaintext",
		label: "Plain text"
	},
	{
		value: "bash",
		label: "Bash / Shell"
	},
	{
		value: "c",
		label: "C"
	},
	{
		value: "cpp",
		label: "C++"
	},
	{
		value: "csharp",
		label: "C#"
	},
	{
		value: "css",
		label: "CSS"
	},
	{
		value: "diff",
		label: "Diff"
	},
	{
		value: "go",
		label: "Go"
	},
	{
		value: "html",
		label: "HTML / XML"
	},
	{
		value: "java",
		label: "Java"
	},
	{
		value: "javascript",
		label: "JavaScript"
	},
	{
		value: "json",
		label: "JSON"
	},
	{
		value: "kotlin",
		label: "Kotlin"
	},
	{
		value: "markdown",
		label: "Markdown"
	},
	{
		value: "php",
		label: "PHP"
	},
	{
		value: "python",
		label: "Python"
	},
	{
		value: "ruby",
		label: "Ruby"
	},
	{
		value: "rust",
		label: "Rust"
	},
	{
		value: "sql",
		label: "SQL"
	},
	{
		value: "swift",
		label: "Swift"
	},
	{
		value: "typescript",
		label: "TypeScript"
	},
	{
		value: "yaml",
		label: "YAML"
	}
];
var hljs = null;
/** Colorise every `pre code` inside `root` (no-op if none). */
async function highlightWithin(root) {
	if (!root) return;
	const blocks = Array.from(root.querySelectorAll("pre code"));
	if (!blocks.length) return;
	if (!hljs) hljs = (await import("./common-Da7rj3UU.js")).default;
	for (const el of blocks) {
		if (el.dataset.highlighted) continue;
		try {
			hljs.highlightElement(el);
		} catch {}
	}
}
//#endregion
//#region resources/js/Components/Editor.vue?vue&type=script&setup=true&lang.ts
var Editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue_exports.defineComponent)({
	__name: "Editor",
	__ssrInlineRender: true,
	props: {
		placeholder: { default: "Write a reply…" },
		content: { default: "" }
	},
	emits: ["typing"],
	setup(__props, { expose: __expose, emit: __emit }) {
		const props = __props;
		const emit = __emit;
		const uploading = (0, vue_exports.ref)(false);
		(0, vue_exports.ref)(null);
		async function doUpload(file) {
			if (!isImageFile(file)) return;
			uploading.value = true;
			try {
				const { url } = await uploadImage(file);
				editor.value?.chain().focus().setImage({ src: url }).run();
			} catch (e) {
				window.alert(t("Image upload failed."));
			} finally {
				uploading.value = false;
			}
		}
		const editor = useEditor({
			extensions: [
				index_default$4.configure({ codeBlock: false }),
				index_default$1.configure({
					lowlight,
					defaultLanguage: "plaintext"
				}),
				Spoiler,
				index_default$5,
				index_default$6.configure({
					openOnClick: false,
					autolink: true,
					HTMLAttributes: {
						rel: "noopener noreferrer nofollow",
						target: "_blank"
					}
				}),
				index_default$3,
				index_default$2.configure({ placeholder: t(props.placeholder) }),
				MentionText
			],
			content: props.content,
			onUpdate: () => emit("typing"),
			editorProps: {
				attributes: { class: "prose-q focus:outline-none" },
				handlePaste: (_view, event) => {
					const files = Array.from(event.clipboardData?.files ?? []).filter(isImageFile);
					if (!files.length) return false;
					files.forEach(doUpload);
					return true;
				},
				handleDrop: (_view, event) => {
					const files = Array.from(event.dataTransfer?.files ?? []).filter(isImageFile);
					if (!files.length) return false;
					event.preventDefault();
					files.forEach(doUpload);
					return true;
				}
			}
		});
		(0, vue_exports.onBeforeUnmount)(() => editor.value?.destroy());
		__expose({
			getHTML: () => editor.value?.getHTML() ?? "",
			getJSON: () => JSON.stringify(editor.value?.getJSON() ?? {}),
			isEmpty: () => editor.value?.isEmpty ?? true,
			clear: () => editor.value?.commands.clearContent(true),
			focus: () => editor.value?.commands.focus("end"),
			insertContent: (html) => editor.value?.chain().focus().insertContent(html).run(),
			setHTML: (html) => editor.value?.commands.setContent(html || "")
		});
		const page = usePage();
		const aiEnabled = (0, vue_exports.computed)(() => !!page.props.ask?.enabled && !!page.props.auth?.user);
		const aiMenuOpen = (0, vue_exports.ref)(false);
		const aiBusy = (0, vue_exports.ref)(false);
		const AI_ACTIONS = [
			{
				action: "improve",
				label: t("Improve writing")
			},
			{
				action: "grammar",
				label: t("Fix spelling & grammar")
			},
			{
				action: "shorten",
				label: t("Make shorter")
			},
			{
				action: "expand",
				label: t("Make longer")
			},
			{
				action: "simplify",
				label: t("Simplify")
			},
			{
				action: "professional",
				label: t("Professional tone")
			},
			{
				action: "friendly",
				label: t("Friendly tone")
			}
		];
		const composeOpen = (0, vue_exports.ref)(false);
		const brief = (0, vue_exports.ref)("");
		const composing = (0, vue_exports.ref)(false);
		const isActive = (name, attrs) => editor.value?.isActive(name, attrs) ?? false;
		const codeLanguages = CODE_LANGUAGES;
		const codeLang = (0, vue_exports.computed)({
			get: () => editor.value?.getAttributes("codeBlock")?.language || "plaintext",
			set: (lang) => editor.value?.chain().focus().updateAttributes("codeBlock", { language: lang }).run()
		});
		const gifsEnabled = (0, vue_exports.computed)(() => !!page.props.composer?.gifs);
		const gifOpen = (0, vue_exports.ref)(false);
		const gifQuery = (0, vue_exports.ref)("");
		const gifBusy = (0, vue_exports.ref)(false);
		const gifResults = (0, vue_exports.ref)([]);
		function insertText(text) {
			editor.value?.chain().focus().insertContent(text).run();
		}
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<div${(0, server_renderer_exports.ssrRenderAttrs)((0, vue_exports.mergeProps)({ class: "relative overflow-hidden rounded-c border border-line bg-surface" }, _attrs))} data-v-03672a25>`);
			if ((0, vue_exports.unref)(editor)) {
				_push(`<div class="flex flex-wrap items-center gap-0.5 border-b border-line bg-surface-2 px-2.5 py-2" data-v-03672a25><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("bold") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Bold"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Bold"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Bold (Ctrl+B)"))} data-v-03672a25><b data-v-03672a25>B</b></button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("italic") }, "tb italic"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Italic"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Italic"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Italic (Ctrl+I)"))} data-v-03672a25>I</button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("underline") }, "tb underline"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Underline"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Underline"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Underline (Ctrl+U)"))} data-v-03672a25>U</button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("strike") }, "tb line-through"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Strikethrough"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Strikethrough"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Strikethrough"))} data-v-03672a25>S</button><span class="mx-1.5 h-5 w-px bg-line" data-v-03672a25></span><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("heading", { level: 2 }) }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Heading"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Heading"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Heading"))} data-v-03672a25><b data-v-03672a25>H</b></button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("blockquote") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Quote"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Quote"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Quote"))} data-v-03672a25>”</button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("codeBlock") }, "tb font-mono text-xs"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Code block"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Code block"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Code block"))} data-v-03672a25>{}</button>`);
				if (isActive("codeBlock")) {
					_push(`<select class="h-[30px] rounded-md border border-line bg-surface py-0 pl-2 pr-6 text-xs font-medium text-ink focus:border-primary focus:ring-0"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Code language"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Code language"))} data-v-03672a25><!--[-->`);
					(0, server_renderer_exports.ssrRenderList)((0, vue_exports.unref)(codeLanguages), (l) => {
						_push(`<option${(0, server_renderer_exports.ssrRenderAttr)("value", l.value)} data-v-03672a25${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray(codeLang.value) ? (0, server_renderer_exports.ssrLooseContain)(codeLang.value, l.value) : (0, server_renderer_exports.ssrLooseEqual)(codeLang.value, l.value)) ? " selected" : ""}>${(0, server_renderer_exports.ssrInterpolate)(l.label)}</option>`);
					});
					_push(`<!--]--></select>`);
				} else _push(`<!---->`);
				_push(`<button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("spoiler") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Spoiler"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Spoiler"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Spoiler (hidden until clicked)"))} data-v-03672a25><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-03672a25><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" data-v-03672a25></path><circle cx="12" cy="12" r="3" data-v-03672a25></circle><path d="m3 3 18 18" data-v-03672a25></path></svg></button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("bulletList") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Bullet list"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Bullet list"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Bullet list"))} data-v-03672a25>•</button><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("orderedList") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Numbered list"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Numbered list"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Numbered list"))} data-v-03672a25>1.</button><span class="mx-1.5 h-5 w-px bg-line" data-v-03672a25></span><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: isActive("link") }, "tb"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Insert link"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Insert link"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Insert link"))} data-v-03672a25>🔗</button><button type="button" class="tb"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Insert image"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Insert image"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Insert image"))} data-v-03672a25><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-03672a25><rect x="3" y="3" width="18" height="18" rx="2" data-v-03672a25></rect><circle cx="9" cy="9" r="2" data-v-03672a25></circle><path d="m21 15-5-5L5 21" data-v-03672a25></path></svg></button>`);
				if (gifsEnabled.value) _push(`<button type="button" class="tb w-auto px-1.5 text-[11px] font-bold"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Insert GIF"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Insert GIF"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Insert GIF"))} data-v-03672a25>GIF</button>`);
				else _push(`<!---->`);
				if (aiEnabled.value) {
					_push(`<!--[--><span class="mx-1.5 h-5 w-px bg-line" data-v-03672a25></span><div class="relative" data-v-03672a25><button type="button" class="${(0, server_renderer_exports.ssrRenderClass)([{ on: aiMenuOpen.value }, "tb w-auto gap-1 px-2 font-semibold text-primary"])}"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("AI writing assistant"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("AI writing assistant"))}${(0, server_renderer_exports.ssrIncludeBooleanAttr)(aiBusy.value) ? " disabled" : ""} data-v-03672a25><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-03672a25><path d="M12 3v3M12 18v3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M3 12h3M18 12h3M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" data-v-03672a25></path><circle cx="12" cy="12" r="3" data-v-03672a25></circle></svg><span class="text-xs" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)(aiBusy.value ? (0, vue_exports.unref)(t)("Thinking…") : "AI")}</span></button>`);
					if (aiMenuOpen.value) {
						_push(`<div class="absolute left-0 top-full z-30 mt-1 w-52 overflow-hidden rounded-xl border border-line bg-surface py-1 shadow-xl" data-v-03672a25><button type="button" class="block w-full px-3 py-1.5 text-left text-sm font-semibold text-primary hover:bg-surface-2" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Write from a brief…"))}</button><div class="my-1 border-t border-line" data-v-03672a25></div><!--[-->`);
						(0, server_renderer_exports.ssrRenderList)(AI_ACTIONS, (a) => {
							_push(`<button type="button" class="block w-full px-3 py-1.5 text-left text-sm text-ink hover:bg-surface-2" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)(a.label)}</button>`);
						});
						_push(`<!--]--></div>`);
					} else _push(`<!---->`);
					_push(`</div><!--]-->`);
				} else _push(`<!---->`);
				_push(`<span class="mx-1.5 h-5 w-px bg-line" data-v-03672a25></span><button type="button" class="tb"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Undo"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Undo"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Undo (Ctrl+Z)"))} data-v-03672a25>↶</button><button type="button" class="tb"${(0, server_renderer_exports.ssrRenderAttr)("title", (0, vue_exports.unref)(t)("Redo"))}${(0, server_renderer_exports.ssrRenderAttr)("aria-label", (0, vue_exports.unref)(t)("Redo"))}${(0, server_renderer_exports.ssrRenderAttr)("data-tip", (0, vue_exports.unref)(t)("Redo (Ctrl+Y)"))} data-v-03672a25>↷</button>`);
				_push((0, server_renderer_exports.ssrRenderComponent)(Slot_default, {
					name: "composer:toolbar",
					ctx: { insertText }
				}, null, _parent));
				_push(`<input type="file" accept="image/*" class="hidden" data-v-03672a25></div>`);
			} else _push(`<!---->`);
			_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(EditorContent), {
				editor: (0, vue_exports.unref)(editor),
				class: "min-h-[110px] px-4 py-3 text-ink"
			}, null, _parent));
			if (uploading.value) _push(`<div class="pointer-events-none absolute bottom-2 left-3 inline-flex items-center gap-2 rounded-full bg-slate-900/80 px-3 py-1 text-xs font-semibold text-white" data-v-03672a25><span class="h-2 w-2 animate-pulse rounded-full bg-white" data-v-03672a25></span> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Uploading & converting to WebP…"))}</div>`);
			else _push(`<!---->`);
			(0, server_renderer_exports.ssrRenderTeleport)(_push, (_push) => {
				if (composeOpen.value) _push(`<div class="fixed inset-0 z-[80] flex items-center justify-center bg-black/40 p-4" data-v-03672a25><div class="w-full max-w-md rounded-c border border-line bg-surface p-5 shadow-2xl" data-v-03672a25><h3 class="text-base font-bold text-ink" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Write with AI"))}</h3><p class="mt-1 text-sm text-ink-muted" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Describe what you want to say — I’ll draft the post for you."))}</p><textarea rows="4"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", (0, vue_exports.unref)(t)("e.g. Ask if anyone has tips for migrating ~5k posts from another forum"))} class="mt-3 w-full rounded-lg border-line bg-surface-2 text-sm text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)(brief.value)}</textarea><div class="mt-3 flex items-center justify-end gap-2" data-v-03672a25><button type="button" class="rounded-lg px-3 py-2 text-sm font-semibold text-ink-2 hover:bg-surface-2" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Cancel"))}</button><button type="button"${(0, server_renderer_exports.ssrIncludeBooleanAttr)(composing.value || !brief.value.trim()) ? " disabled" : ""} class="rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white hover:bg-primary-600 disabled:opacity-60" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)(composing.value ? (0, vue_exports.unref)(t)("Writing…") : (0, vue_exports.unref)(t)("Generate"))}</button></div></div></div>`);
				else _push(`<!---->`);
			}, "body", false, _parent);
			(0, server_renderer_exports.ssrRenderTeleport)(_push, (_push) => {
				if (gifOpen.value) {
					_push(`<div class="fixed inset-0 z-[80] flex items-start justify-center bg-black/40 p-4 pt-[8vh]" data-v-03672a25><div class="flex max-h-[78vh] w-full max-w-lg flex-col rounded-c border border-line bg-surface shadow-2xl" data-v-03672a25><div class="flex items-center gap-2 border-b border-line p-3" data-v-03672a25><input${(0, server_renderer_exports.ssrRenderAttr)("value", gifQuery.value)} type="text"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", (0, vue_exports.unref)(t)("Search GIFs…"))} autofocus class="flex-1 rounded-lg border-line bg-surface-2 text-sm text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary" data-v-03672a25><button type="button" class="rounded-lg px-3 py-2 text-sm font-semibold text-ink-2 hover:bg-surface-2" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Close"))}</button></div><div class="min-h-[160px] flex-1 overflow-y-auto p-3" data-v-03672a25>`);
					if (gifBusy.value && !gifResults.value.length) _push(`<div class="py-10 text-center text-sm text-ink-muted" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Loading…"))}</div>`);
					else if (!gifResults.value.length) _push(`<div class="py-10 text-center text-sm text-ink-muted" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("No GIFs found."))}</div>`);
					else {
						_push(`<div class="columns-2 gap-2 sm:columns-3" data-v-03672a25><!--[-->`);
						(0, server_renderer_exports.ssrRenderList)(gifResults.value, (g, i) => {
							_push(`<button type="button" class="mb-2 block w-full overflow-hidden rounded-lg border border-line hover:border-primary" data-v-03672a25><img${(0, server_renderer_exports.ssrRenderAttr)("src", g.preview)}${(0, server_renderer_exports.ssrRenderAttr)("alt", g.alt)} loading="lazy" class="w-full" data-v-03672a25></button>`);
						});
						_push(`<!--]--></div>`);
					}
					_push(`</div><div class="border-t border-line px-3 py-1.5 text-right text-[11px] text-ink-muted" data-v-03672a25>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Powered by GIF search"))}</div></div></div>`);
				} else _push(`<!---->`);
			}, "body", false, _parent);
			_push(`</div>`);
		};
	}
});
//#endregion
//#region resources/js/Components/Editor.vue
var _sfc_setup = Editor_vue_vue_type_script_setup_true_lang_default.setup;
Editor_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
	const ssrContext = (0, vue_exports.useSSRContext)();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Components/Editor.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(Editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-03672a25"]]);
//#endregion
export { highlightWithin as n, require_core as r, Editor_default as t };
