import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
import { $ as t, D as n, E as r, H as i, J as a, K as o, O as ee, Q as te, R as s, S as c, X as l, b as u, j as d, r as f, rt as ne, x as re } from "./vue.runtime.esm-bundler-BDSGA5hA.js";
import { $ as ie, $t as ae, A as oe, At as se, B as ce, Bt as le, C as ue, Ct as de, D as fe, Dt as p, E as m, Et as h, F as g, Ft as _, G as v, Gt as y, H as b, Ht as x, I as S, It as C, J as w, Jt as T, K as E, Kt as D, L as O, Lt as k, M as A, Mt as j, N as M, Nt as N, O as P, Ot as F, P as I, Pt as L, Q as R, Qt as z, R as B, Rt as V, S as pe, St as me, T as he, Tt as ge, U as _e, Ut as ve, V as ye, Vt as be, W as xe, Wt as Se, X as Ce, Xt as we, Y as Te, Yt as Ee, Z as De, Zt as Oe, _ as ke, _t as Ae, a as je, an as Me, at as Ne, b as Pe, bt as Fe, c as Ie, cn as Le, ct as Re, d as ze, dn as Be, dt as Ve, en as He, et as Ue, f as H, fn as We, ft as Ge, g as Ke, gn as qe, gt as Je, h as Ye, hn as Xe, ht as Ze, i as Qe, in as $e, it as et, j as tt, jt as nt, k as rt, kt as it, l as U, ln as at, lt as ot, m as st, mn as ct, mt as lt, n as ut, nn as dt, nt as ft, o as pt, on as mt, ot as ht, p as gt, pn as _t, pt as vt, q as yt, qt as bt, r as xt, rn as St, rt as Ct, s as wt, sn as W, st as Tt, t as Et, tn as Dt, tt as Ot, u as kt, un as At, ut as jt, v as Mt, vt as G, w as Nt, wt as Pt, x as Ft, xt as It, y as K, yt as Lt, z as Rt, zt } from "./dist-DWhP3Dp2.js";
//#region ../../node_modules/.pnpm/@tiptap+vue-3@3.23.4_@floating-ui+dom@1.7.6_@tiptap+core@3.23.4_@tiptap+pm@3.23.4__@tip_f27b5980fcbc79288d7d128a126b5167/node_modules/@tiptap/vue-3/dist/index.js
var q = /* @__PURE__ */ e({
	CommandManager: () => Et,
	Editor: () => Y,
	EditorContent: () => Bt,
	Extendable: () => xt,
	Extension: () => Qe,
	Fragment: () => je,
	InputRule: () => pt,
	MappablePosition: () => wt,
	Mark: () => Ie,
	MarkView: () => U,
	MarkViewContent: () => Wt,
	Node: () => kt,
	NodePos: () => ze,
	NodeView: () => H,
	NodeViewContent: () => Vt,
	NodeViewWrapper: () => X,
	PasteRule: () => gt,
	ResizableNodeView: () => st,
	ResizableNodeview: () => Ye,
	Tracker: () => Ke,
	VueMarkView: () => Q,
	VueMarkViewRenderer: () => Gt,
	VueNodeViewRenderer: () => $,
	VueRenderer: () => Z,
	callOrReturn: () => ke,
	canInsertNode: () => Mt,
	cancelPositionCheck: () => K,
	combineTransactionSteps: () => Pe,
	commands: () => Ft,
	createAtomBlockMarkdownSpec: () => pe,
	createBlockMarkdownSpec: () => ue,
	createChainableState: () => Nt,
	createDocument: () => he,
	createElement: () => G,
	createInlineMarkdownSpec: () => m,
	createMappablePosition: () => fe,
	createNodeFromContent: () => P,
	createStyleTag: () => rt,
	decodeHtmlEntities: () => oe,
	defaultBlockAt: () => tt,
	deleteProps: () => A,
	elementFromString: () => M,
	encodeHtmlEntities: () => I,
	escapeForRegEx: () => g,
	extensions: () => S,
	findChildren: () => O,
	findChildrenInRange: () => B,
	findDuplicates: () => Rt,
	findParentNode: () => ce,
	findParentNodeClosestToPos: () => ye,
	flattenExtensions: () => b,
	fromString: () => _e,
	generateHTML: () => xe,
	generateJSON: () => v,
	generateText: () => E,
	getAttributes: () => yt,
	getAttributesFromExtensions: () => w,
	getChangedRanges: () => Te,
	getDebugJSON: () => Ce,
	getExtensionField: () => De,
	getHTMLFromFragment: () => R,
	getMarkAttributes: () => ie,
	getMarkRange: () => Ue,
	getMarkType: () => Ot,
	getMarksBetween: () => ft,
	getNodeAtPosition: () => Ct,
	getNodeAttributes: () => et,
	getNodeType: () => Ne,
	getRenderedAttributes: () => ht,
	getSchema: () => Tt,
	getSchemaByResolvedExtensions: () => Re,
	getSchemaTypeByName: () => ot,
	getSchemaTypeNameByName: () => jt,
	getSplittedAttributes: () => Ve,
	getStyleProperty: () => Ge,
	getText: () => vt,
	getTextBetween: () => lt,
	getTextContentFromNodes: () => Ze,
	getTextSerializersFromSchema: () => Je,
	getUpdatedPosition: () => Ae,
	h: () => G,
	injectExtensionAttributesToParseRule: () => Lt,
	inputRulesPlugin: () => Fe,
	isActive: () => It,
	isAndroid: () => me,
	isAtEndOfNode: () => de,
	isAtStartOfNode: () => Pt,
	isEmptyObject: () => ge,
	isExtensionRulesEnabled: () => h,
	isFirefox: () => p,
	isFunction: () => F,
	isList: () => it,
	isMacOS: () => se,
	isMarkActive: () => nt,
	isNodeActive: () => j,
	isNodeEmpty: () => N,
	isNodeSelection: () => L,
	isNodeViewSelected: () => _,
	isNumber: () => C,
	isPlainObject: () => k,
	isRegExp: () => V,
	isSafari: () => zt,
	isString: () => le,
	isTextSelection: () => be,
	isiOS: () => x,
	markInputRule: () => ve,
	markPasteRule: () => Se,
	markViewProps: () => Ut,
	markdown: () => y,
	mergeAttributes: () => D,
	mergeDeep: () => bt,
	minMax: () => T,
	nodeInputRule: () => Ee,
	nodePasteRule: () => we,
	nodeViewProps: () => Kt,
	objectIncludes: () => Oe,
	parseAttributes: () => z,
	parseIndentedBlocks: () => ae,
	pasteRulesPlugin: () => He,
	posToDOMRect: () => Dt,
	removeDuplicates: () => dt,
	renderNestedMarkdownContent: () => St,
	resolveExtensions: () => $e,
	resolveFocusPosition: () => Me,
	rewriteUnknownContent: () => mt,
	schedulePositionCheck: () => W,
	selectionToInsertionEnd: () => Le,
	serializeAttributes: () => at,
	sortExtensions: () => At,
	splitExtensions: () => Be,
	textInputRule: () => We,
	textPasteRule: () => _t,
	textblockTypeInputRule: () => ct,
	updateMarkViewAttributes: () => Xe,
	useEditor: () => Ht,
	wrappingInputRule: () => qe
});
function J(e) {
	return i((t, n) => ({
		get() {
			return t(), e;
		},
		set(t) {
			e = t, requestAnimationFrame(() => {
				requestAnimationFrame(() => {
					n();
				});
			});
		}
	}));
}
var Y = class extends ut {
	constructor(e = {}) {
		return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = J(this.view.state), this.reactiveExtensionStorage = J(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
			this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
		}), o(this);
	}
	get state() {
		return this.reactiveState ? this.reactiveState.value : this.view.state;
	}
	get storage() {
		return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
	}
	registerPlugin(e, t) {
		let n = super.registerPlugin(e, t);
		return this.reactiveState && (this.reactiveState.value = n), n;
	}
	unregisterPlugin(e) {
		let t = super.unregisterPlugin(e);
		return this.reactiveState && t && (this.reactiveState.value = t), t;
	}
}, Bt = u({
	name: "EditorContent",
	props: { editor: {
		default: null,
		type: Object
	} },
	setup(e) {
		let t = l(), i = re();
		return s(() => {
			let n = e.editor;
			n && n.options.element && t.value && r(() => {
				if (!t.value || !n.view.dom?.parentNode) return;
				let e = ne(t.value);
				t.value.append(...n.view.dom.parentNode.childNodes), n.contentComponent = i.ctx._, i && (n.appContext = {
					...i.appContext,
					provides: i.provides
				}), n.setOptions({ element: e }), n.createNodeViews();
			});
		}), n(() => {
			let t = e.editor;
			t && (t.contentComponent = null, t.appContext = null);
		}), { rootEl: t };
	},
	render() {
		return c("div", { ref: (e) => {
			this.rootEl = e;
		} });
	}
}), Vt = u({
	name: "NodeViewContent",
	props: { as: {
		type: String,
		default: "div"
	} },
	render() {
		return c(this.as, {
			style: { whiteSpace: "pre-wrap" },
			"data-node-view-content": ""
		});
	}
}), X = u({
	name: "NodeViewWrapper",
	props: { as: {
		type: String,
		default: "div"
	} },
	inject: ["onDragStart", "decorationClasses"],
	render() {
		var e;
		return c(this.as, {
			class: this.decorationClasses,
			style: { whiteSpace: "normal" },
			"data-node-view-wrapper": "",
			onDragstart: this.onDragStart
		}, (e = this.$slots).default?.call(e));
	}
}), Ht = (e = {}) => {
	let t = te();
	return ee(() => {
		t.value = new Y(e);
	}), n(() => {
		var e;
		(e = t.value) == null || e.destroy();
	}), t;
}, Z = class {
	constructor(e, { props: t = {}, editor: n }) {
		this.destroyed = !1, this.editor = n, this.component = o(e), this.el = document.createElement("div"), this.props = a(t), this.renderedComponent = this.renderComponent();
	}
	get element() {
		return this.renderedComponent.el;
	}
	get ref() {
		return this.renderedComponent.vNode?.component?.exposed ? this.renderedComponent.vNode.component.exposed : this.renderedComponent.vNode?.component?.proxy;
	}
	renderComponent() {
		if (this.destroyed) return this.renderedComponent;
		let e = c(this.component, this.props);
		return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && f(e, this.el), {
			vNode: e,
			destroy: () => {
				this.el && f(null, this.el), this.el = null, e = null;
			},
			el: this.el ? this.el.firstElementChild : null
		};
	}
	updateProps(e = {}) {
		this.destroyed || (Object.entries(e).forEach(([e, t]) => {
			this.props[e] = t;
		}), this.renderComponent());
	}
	destroy() {
		this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
	}
}, Ut = {
	editor: {
		type: Object,
		required: !0
	},
	mark: {
		type: Object,
		required: !0
	},
	extension: {
		type: Object,
		required: !0
	},
	inline: {
		type: Boolean,
		required: !0
	},
	view: {
		type: Object,
		required: !0
	},
	updateAttributes: {
		type: Function,
		required: !0
	},
	HTMLAttributes: {
		type: Object,
		required: !0
	}
}, Wt = u({
	name: "MarkViewContent",
	props: { as: {
		type: String,
		default: "span"
	} },
	render() {
		return c(this.as, {
			style: { whiteSpace: "inherit" },
			"data-mark-view-content": ""
		});
	}
}), Q = class extends U {
	constructor(e, t, n) {
		super(e, t, n);
		let r = {
			...t,
			updateAttributes: this.updateAttributes.bind(this)
		}, i = u({
			extends: { ...e },
			props: Object.keys(r),
			template: this.component.template,
			setup: (t) => e.setup?.call(e, t, { expose: () => void 0 }),
			__scopeId: e.__scopeId,
			__cssModules: e.__cssModules,
			__name: e.__name,
			__file: e.__file
		});
		this.renderer = new Z(i, {
			editor: this.editor,
			props: r
		});
	}
	get dom() {
		return this.renderer.element;
	}
	get contentDOM() {
		return this.dom.querySelector("[data-mark-view-content]");
	}
	updateAttributes(e) {
		let n = t(this.mark);
		super.updateAttributes(e, n);
	}
	destroy() {
		this.renderer.destroy();
	}
};
function Gt(e, t = {}) {
	return (n) => n.editor.contentComponent ? new Q(e, n, t) : {};
}
var Kt = {
	editor: {
		type: Object,
		required: !0
	},
	node: {
		type: Object,
		required: !0
	},
	decorations: {
		type: Object,
		required: !0
	},
	selected: {
		type: Boolean,
		required: !0
	},
	extension: {
		type: Object,
		required: !0
	},
	getPos: {
		type: Function,
		required: !0
	},
	updateAttributes: {
		type: Function,
		required: !0
	},
	deleteNode: {
		type: Function,
		required: !0
	},
	view: {
		type: Object,
		required: !0
	},
	innerDecorations: {
		type: Object,
		required: !0
	},
	HTMLAttributes: {
		type: Object,
		required: !0
	}
}, qt = class extends H {
	constructor() {
		super(...arguments), this.positionCheckCallback = null, this.cachedExtensionWithSyncedStorage = null;
	}
	get extensionWithSyncedStorage() {
		if (!this.cachedExtensionWithSyncedStorage) {
			let e = this.editor, t = this.extension;
			this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) {
				return r === "storage" ? e.storage[t.name] ?? {} : Reflect.get(n, r, i);
			} });
		}
		return this.cachedExtensionWithSyncedStorage;
	}
	mount() {
		let e = {
			editor: this.editor,
			node: this.node,
			decorations: this.decorations,
			innerDecorations: this.innerDecorations,
			view: this.view,
			selected: !1,
			extension: this.extensionWithSyncedStorage,
			HTMLAttributes: this.HTMLAttributes,
			getPos: () => this.getPos(),
			updateAttributes: (e = {}) => this.updateAttributes(e),
			deleteNode: () => this.deleteNode()
		}, t = this.onDragStart.bind(this);
		this.decorationClasses = l(this.getDecorationClasses());
		let n = u({
			extends: { ...this.component },
			props: Object.keys(e),
			template: this.component.template,
			setup: (e) => {
				var n;
				return d("onDragStart", t), d("decorationClasses", this.decorationClasses), (n = this.component).setup?.call(n, e, { expose: () => void 0 });
			},
			__scopeId: this.component.__scopeId,
			__cssModules: this.component.__cssModules,
			__name: this.component.__name,
			__file: this.component.__file
		});
		this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.currentPos = this.getPos(), this.positionCheckCallback = () => {
			if (!this.renderer) return;
			let e = this.getPos();
			typeof e != "number" || e === this.currentPos || (this.currentPos = e, this.renderer.updateProps({ getPos: () => this.getPos() }));
		}, W(this.editor, this.positionCheckCallback), this.renderer = new Z(n, {
			editor: this.editor,
			props: e
		});
	}
	get dom() {
		if (!this.renderer.element || !this.renderer.element.hasAttribute("data-node-view-wrapper")) throw Error("Please use the NodeViewWrapper component for your node view.");
		return this.renderer.element;
	}
	get contentDOM() {
		return this.node.isLeaf ? null : this.dom.querySelector("[data-node-view-content]");
	}
	handleSelectionUpdate() {
		let e = this.getPos();
		if (typeof e == "number") if (_({
			selection: this.editor.state.selection,
			pos: e,
			nodeSize: this.node.nodeSize,
			selectedOnTextSelection: this.options.selectedOnTextSelection
		})) {
			if (this.renderer.props.selected) return;
			this.selectNode();
		} else {
			if (!this.renderer.props.selected) return;
			this.deselectNode();
		}
	}
	update(e, t, n) {
		let r = (e) => {
			this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(e);
		};
		if (typeof this.options.update == "function") {
			let i = this.node, a = this.decorations, o = this.innerDecorations;
			return this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = this.getPos(), this.options.update({
				oldNode: i,
				oldDecorations: a,
				newNode: e,
				newDecorations: t,
				oldInnerDecorations: o,
				innerDecorations: n,
				updateProps: () => r({
					node: e,
					decorations: t,
					innerDecorations: n,
					extension: this.extensionWithSyncedStorage
				})
			});
		}
		if (e.type !== this.node.type) return !1;
		let i = this.getPos();
		return e === this.node && this.decorations === t && this.innerDecorations === n ? i === this.currentPos ? !0 : (this.currentPos = i, r({
			node: e,
			decorations: t,
			innerDecorations: n,
			extension: this.extensionWithSyncedStorage,
			getPos: () => this.getPos()
		}), !0) : (this.node = e, this.decorations = t, this.innerDecorations = n, this.currentPos = i, r({
			node: e,
			decorations: t,
			innerDecorations: n,
			extension: this.extensionWithSyncedStorage
		}), !0);
	}
	selectNode() {
		this.renderer.updateProps({ selected: !0 }), this.renderer.element && this.renderer.element.classList.add("ProseMirror-selectednode");
	}
	deselectNode() {
		this.renderer.updateProps({ selected: !1 }), this.renderer.element && this.renderer.element.classList.remove("ProseMirror-selectednode");
	}
	getDecorationClasses() {
		return this.decorations.flatMap((e) => e.type.attrs.class).join(" ");
	}
	destroy() {
		this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.positionCheckCallback &&= (K(this.editor, this.positionCheckCallback), null);
	}
};
function $(e, t) {
	return (n) => n.editor.contentComponent ? new qt(typeof e == "function" && "__vccOpts" in e ? e.__vccOpts : e, n, t) : {};
}
//#endregion
export { $ as n, q as r, X as t };
