import { E as e, H as t, L as n, M as r, R as i, T as a, ct as o, d as s, g as c, h as l, it as u, l as d, m as f, o as p, p as m, st as h, v as g, x as _, y as v } from "./draggable-BwWMFq33.js";
import { Ft as y, a as b, at as x, en as S, tn as C } from "./features-CUYy5kZQ.js";
//#region src/components/blocks/RichTextLinkDialog.vue?vue&type=script&setup=true&lang.ts
var w = ["data-tpl-theme"], T = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-b tpl:border-[var(--tpl-border)] tpl:px-5 tpl:py-4" }, E = {
	id: "tpl-link-dialog-title",
	class: "tpl:m-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
}, D = ["aria-label"], O = { class: "tpl:p-5" }, k = { class: "tpl:mb-4 tpl:last:mb-0" }, A = {
	for: "tpl-link-dialog-url",
	class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium tpl:tracking-wide tpl:text-[var(--tpl-text-muted)] tpl:uppercase"
}, j = ["placeholder"], M = { class: "tpl:flex tpl:items-center tpl:justify-between tpl:border-t tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:px-5 tpl:py-4" }, N = { class: "tpl:ml-auto tpl:flex tpl:gap-2" }, P = /* @__PURE__ */ _({
	__name: "RichTextLinkDialog",
	props: /* @__PURE__ */ e({
		visible: { type: Boolean },
		isEditingLink: { type: Boolean }
	}, {
		linkUrl: { required: !0 },
		linkUrlModifiers: {},
		dialogRef: { required: !0 },
		dialogRefModifiers: {}
	}),
	emits: /* @__PURE__ */ e([
		"close",
		"insert",
		"remove",
		"keydown"
	], ["update:linkUrl", "update:dialogRef"]),
	setup(e, { emit: n }) {
		let g = i(e, "linkUrl"), _ = i(e, "dialogRef"), P = n, F = a(S, null), I = a(C, null), L = b(), { t: R } = y();
		return (n, i) => u(L) ? (r(), f(s, {
			key: 0,
			to: u(L)
		}, [e.visible ? (r(), c("div", {
			key: 0,
			"data-tpl-theme": u(I),
			class: "tpl tpl-link-dialog tpl:fixed tpl:inset-0 tpl:z-modal tpl:flex tpl:items-center tpl:justify-center",
			style: h(u(F)),
			onClick: i[6] ||= d((e) => P("close"), ["self"])
		}, [m("div", {
			ref: (e) => _.value = e,
			role: "dialog",
			"aria-modal": "true",
			"aria-labelledby": "tpl-link-dialog-title",
			class: "tpl:w-[400px] tpl:overflow-hidden tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:shadow-lg"
		}, [
			m("div", T, [m("h4", E, o(e.isEditingLink ? u(R).linkDialog.editLink : u(R).linkDialog.insertLink), 1), m("button", {
				type: "button",
				"aria-label": u(R).linkDialog.cancel,
				class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:border-none tpl:bg-transparent tpl:p-0 tpl:text-[var(--tpl-text-muted)] tpl:hover:bg-[var(--tpl-bg-hover)] tpl:hover:text-[var(--tpl-text)]",
				onClick: i[0] ||= (e) => P("close")
			}, [v(u(x), {
				size: 16,
				"stroke-width": 2
			})], 8, D)]),
			m("div", O, [m("div", k, [m("label", A, o(u(R).linkDialog.urlLabel), 1), t(m("input", {
				id: "tpl-link-dialog-url",
				"onUpdate:modelValue": i[1] ||= (e) => g.value = e,
				type: "url",
				class: "tpl:w-full tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-2.5 tpl:text-sm tpl:text-[var(--tpl-text)] tpl:transition-all tpl:duration-150 tpl:outline-none tpl:placeholder:text-[var(--tpl-text-dim)] tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[0_0_0_3px_var(--tpl-primary-light)]",
				placeholder: u(R).linkDialog.urlPlaceholder,
				autofocus: "",
				onKeydown: i[2] ||= (e) => P("keydown", e)
			}, null, 40, j), [[p, g.value]])])]),
			m("div", M, [e.isEditingLink ? (r(), c("button", {
				key: 0,
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-danger)] tpl:bg-transparent tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:text-[var(--tpl-danger)] tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-danger-light)]",
				onClick: i[3] ||= (e) => P("remove")
			}, o(u(R).linkDialog.removeLink), 1)) : l("", !0), m("div", N, [m("button", {
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-transparent tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-bg-hover)] tpl:hover:text-[var(--tpl-text)]",
				onClick: i[4] ||= (e) => P("close")
			}, o(u(R).linkDialog.cancel), 1), m("button", {
				type: "button",
				class: "tpl:inline-flex tpl:cursor-pointer tpl:items-center tpl:rounded-md tpl:border-none tpl:bg-[var(--tpl-primary)] tpl:px-4 tpl:py-2 tpl:text-[13px] tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:bg-[var(--tpl-primary-hover)] tpl:text-[var(--tpl-bg)]",
				onClick: i[5] ||= (e) => P("insert")
			}, o(e.isEditingLink ? u(R).linkDialog.updateLink : u(R).linkDialog.insertLink), 1)])])
		], 512)], 12, w)) : l("", !0)], 8, ["to"])) : l("", !0);
	}
}), F = {
	key: 0,
	class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:border-[var(--tpl-primary)] tpl:p-2"
}, I = { class: "tpl:animate-pulse tpl:text-[var(--tpl-text-dim)]" }, L = {
	key: 1,
	class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:p-2 tpl:text-center tpl:text-xs tpl:border-[var(--tpl-danger)] tpl:text-[var(--tpl-text-muted)]"
}, R = /* @__PURE__ */ _({
	__name: "RichTextEditorContent",
	props: {
		editor: {},
		editorContent: {},
		isLoading: { type: Boolean },
		initError: {}
	},
	emits: ["retry"],
	setup(e, { emit: t }) {
		let i = t, { t: a } = y();
		return (t, s) => e.isLoading ? (r(), c("div", F, [m("div", I, o(u(a).errors.editorLoading), 1)])) : e.initError ? (r(), c("div", L, [g(o(u(a).errors.editorLoadFailed) + " ", 1), m("button", {
			class: "tpl:ml-1 tpl:cursor-pointer tpl:border-none tpl:bg-transparent tpl:p-0 tpl:underline tpl:text-[var(--tpl-primary)]",
			onClick: s[0] ||= (e) => i("retry")
		}, o(u(a).errors.retry), 1)])) : e.editorContent && e.editor ? (r(), f(n(e.editorContent), {
			key: 2,
			editor: e.editor,
			class: "tpl-text-editable tpl:min-h-[1.5em] tpl:rounded tpl:border tpl:border-dashed tpl:border-[var(--tpl-primary)] tpl:p-2"
		}, null, 8, ["editor"])) : l("", !0);
	}
});
//#endregion
export { P as n, R as t };

//# sourceMappingURL=RichTextEditorContent-DU0gc4bi.js.map