import { Gt as e, Ht as t, Ut as n, c as r } from "./dist-CQQS9SRN.js";
//#region ../../node_modules/.pnpm/@tiptap+extension-highlight@3.22.5_@tiptap+core@3.22.5_@tiptap+pm@3.22.5_/node_modules/@tiptap/extension-highlight/dist/index.js
var i = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, a = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, o = r.create({
	name: "highlight",
	addOptions() {
		return {
			multicolor: !1,
			HTMLAttributes: {}
		};
	},
	addAttributes() {
		return this.options.multicolor ? { color: {
			default: null,
			parseHTML: (e) => e.getAttribute("data-color") || e.style.backgroundColor,
			renderHTML: (e) => e.color ? {
				"data-color": e.color,
				style: `background-color: ${e.color}; color: inherit`
			} : {}
		} } : {};
	},
	parseHTML() {
		return [{ tag: "mark" }];
	},
	renderHTML({ HTMLAttributes: t }) {
		return [
			"mark",
			e(this.options.HTMLAttributes, t),
			0
		];
	},
	renderMarkdown: (e, t) => `==${t.renderChildren(e)}==`,
	parseMarkdown: (e, t) => t.applyMark("highlight", t.parseInline(e.tokens || [])),
	markdownTokenizer: {
		name: "highlight",
		level: "inline",
		start: (e) => e.indexOf("=="),
		tokenize(e, t, n) {
			let r = /^(==)([^=]+)(==)/.exec(e);
			if (r) {
				let e = r[2].trim(), t = n.inlineTokens(e);
				return {
					type: "highlight",
					raw: r[0],
					text: e,
					tokens: t
				};
			}
		}
	},
	addCommands() {
		return {
			setHighlight: (e) => ({ commands: t }) => t.setMark(this.name, e),
			toggleHighlight: (e) => ({ commands: t }) => t.toggleMark(this.name, e),
			unsetHighlight: () => ({ commands: e }) => e.unsetMark(this.name)
		};
	},
	addKeyboardShortcuts() {
		return { "Mod-Shift-h": () => this.editor.commands.toggleHighlight() };
	},
	addInputRules() {
		return [t({
			find: i,
			type: this.type
		})];
	},
	addPasteRules() {
		return [n({
			find: a,
			type: this.type
		})];
	}
}), s = o;
//#endregion
export { o as Highlight, s as default, i as inputRegex, a as pasteRegex };
