import { $ as e, A as t, H as n, J as r, M as i, N as a, P as o, V as s, Z as c, _ as l, b as u, ct as d, f, g as p, h as m, it as h, j as g, l as _, m as v, n as y, ot as b, p as x, s as S, st as C, u as w, v as T, x as E, y as D, z as ee } from "./draggable-BwWMFq33.js";
import { A as O, At as k, C as A, Dt as j, Et as M, Ft as N, Ht as P, It as F, Ln as I, Nt as L, O as te, Qt as R, Rt as ne, S as re, Ut as z, Vt as B, Xt as ie, Z as V, Zt as H, _ as U, _t as W, b as ae, d as oe, dn as G, f as K, g as q, h as J, l as se, m as Y, p as ce, pt as X, rn as Z, rt as le, st as ue, tt as Q, u as de, ut as fe, v as pe, vt as me, w as he, wn as ge, x as _e, y as ve, yn as ye } from "./features-CUYy5kZQ.js";
import { C as be, S as xe } from "./icons-C4zY5-I3.js";
import { a as Se, c as Ce, i as we, n as Te, o as Ee, r as De, s as Oe, t as ke } from "./styles-DtgjgsBH.js";
import { d as $ } from "./styleConstants-lGobwiLH.js";
//#region src/cloud/composables/useSnapshotPreview.ts
function Ae(t) {
	let { authManager: n, editor: i, history: a, conditionPreview: o, autoSave: s, onError: l } = t, u = e(null), d = c(null), p = c(null), m = !1;
	r(() => {
		m = !0;
	});
	let h = f(() => d.value !== null), g = f(() => u.value?.snapshots.value ?? []), _ = f(() => u.value?.isLoading.value ?? !1), v = f(() => u.value?.isRestoring.value ?? !1);
	function y() {
		i.state.template?.id && !u.value && (u.value = Y({
			authManager: n,
			templateId: i.state.template.id,
			onRestore: b,
			onError: l
		}), u.value.loadSnapshots());
	}
	function b(e) {
		i.setContent(e.content, !1), a.clear(), o.reset();
	}
	async function x(e) {
		if (!m) {
			if (d.value) {
				d.value = e, i.setContent(e.content, !1);
				return;
			}
			i.state.isDirty && i.hasTemplate() && (await i.createSnapshot(), m) || (p.value = structuredClone(i.content.value), s?.pause(), d.value = e, i.setContent(e.content, !1));
		}
	}
	async function S() {
		if (!(!d.value || !u.value)) try {
			if (await u.value.restoreSnapshot(d.value.id), m || (await u.value.loadSnapshots(), m)) return;
		} finally {
			m || (d.value = null, p.value = null, s?.resume());
		}
	}
	function C() {
		!d.value || !p.value || (i.setContent(p.value, !1), d.value = null, p.value = null, s?.resume());
	}
	async function w() {
		m || u.value && await u.value.loadSnapshots();
	}
	return {
		snapshotHistoryInstance: u,
		previewingSnapshot: d,
		contentBeforePreview: p,
		isPreviewingSnapshot: h,
		snapshotHistorySnapshots: g,
		snapshotHistoryIsLoading: _,
		snapshotHistoryIsRestoring: v,
		initSnapshotHistory: y,
		handleRestore: b,
		handleSnapshotNavigate: x,
		confirmRestoreSnapshot: S,
		cancelPreview: C,
		loadSnapshotHistory: w
	};
}
//#endregion
//#region src/cloud/composables/useCloudPanelState.ts
function je() {
	let e = c(null), t = f({
		get: () => e.value === "ai-chat",
		set: (t) => e.value = t ? "ai-chat" : null
	}), n = f({
		get: () => e.value === "scoring",
		set: (t) => e.value = t ? "scoring" : null
	}), r = f({
		get: () => e.value === "design-reference",
		set: (t) => e.value = t ? "design-reference" : null
	}), i = f({
		get: () => e.value === "comments",
		set: (t) => e.value = t ? "comments" : null
	}), a = c(!1), o = c(!1), s = c(void 0), l = c(!1), u = c(null), d = f(() => e.value !== null), p = f(() => {
		let t = e.value;
		return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
	}), m = f(() => l.value || e.value === "ai-chat" || e.value === "design-reference" || e.value === "scoring");
	function h() {
		l.value = !l.value;
	}
	function g(t) {
		l.value = !1, e.value = e.value === t ? null : t;
	}
	return Z(u, () => {
		l.value = !1;
	}), {
		activePanel: e,
		aiChatOpen: t,
		scoringPanelOpen: n,
		designReferenceOpen: r,
		commentsOpen: i,
		testEmailModalOpen: a,
		mediaLibraryOpen: o,
		mediaLibraryAccept: s,
		aiMenuOpen: l,
		aiMenuRef: u,
		rightPanelOpen: d,
		activeAiFeature: p,
		aiButtonActive: m,
		toggleAiMenu: h,
		handleAiFeatureSelect: g
	};
}
//#endregion
//#region src/cloud/composables/useCollabUndoWarning.ts
function Me(e) {
	let { isCollaborationEnabled: t, getCollaboratorCount: n, canUndo: r } = e, i = c(!1), a = c(!1), { start: o } = G(() => {
		a.value = !1;
	}, I, { immediate: !1 });
	function s() {
		i.value || !t.value || n() === 0 || !r.value || (i.value = !0, a.value = !0, o());
	}
	return {
		collabUndoWarningVisible: a,
		showCollabUndoWarning: s
	};
}
//#endregion
//#region src/cloud/composables/useCloudFeatureFlags.ts
function Ne(e) {
	let { planConfigInstance: t, aiConfig: n, editor: r } = e, i = f(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), a = f(() => t.hasFeature("test_email")), o = f(() => !!r.state.template?.id), s = f(() => t.hasFeature("white_label")), l = f(() => t.config.value?.limits.max_templates ?? null), u = f(() => t.config.value?.template_count ?? 0), d = c(!1), p = c("idle"), m = c(""), { start: h } = G(() => {
		p.value = "idle";
	}, 3e3, { immediate: !1 });
	return {
		canUseAiGeneration: i,
		canSendTestEmail: a,
		hasTemplateSaved: o,
		isWhiteLabeled: s,
		templateLimit: l,
		templateCount: u,
		isSaveExporting: d,
		saveStatus: p,
		saveErrorMessage: m,
		startSaveStatusClear: h
	};
}
//#endregion
//#region src/cloud/composables/useCloudMediaLibrary.ts
function Pe(e) {
	let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: i } = e, a = null;
	async function o() {
		if (t) {
			let e = await t({ accept: ["images"] });
			return e ? {
				url: e.url,
				alt: e.alt_text || void 0
			} : null;
		}
		return a &&= (a(null), null), i.value = ["images"], n.value = !0, new Promise((e) => {
			a = (t) => {
				e(t);
			};
		});
	}
	function s(e) {
		n.value = !1, a?.({
			url: e.url,
			alt: e.alt_text || void 0
		}), a = null;
	}
	function c() {
		n.value = !1, a?.(null), a = null;
	}
	return r(() => {
		a &&= (a(null), null);
	}), {
		handleRequestMedia: o,
		handleMediaSelect: s,
		handleMediaLibraryClose: c
	};
}
//#endregion
//#region src/cloud/composables/useCloudInitialization.ts
function Fe(e) {
	let { config: t, translations: n, fontsManager: r, emit: i, getCommentsSidebar: o } = e, s = c(!0), l = c(!1), u = c(null), d = !1, p = { value: null }, m = null, h = null, g = new te({
		...t.auth,
		onError: t.onError
	}), _ = oe({
		authManager: g,
		onError: t.onError
	}), v = c(/* @__PURE__ */ new Map()), y = A({
		authManager: g,
		defaultFontFamily: t.fonts?.defaultFont,
		templateDefaults: t.templateDefaults,
		onError: t.onError,
		lockedBlocks: v
	}), b = q({
		authManager: g,
		onError: t.onError
	});
	t.mcp?.enabled && se({
		editor: y,
		channel: b.channel,
		onOperation: t.mcp.onOperation
	});
	let x = null;
	t.collaboration?.enabled && (x = pe({
		authManager: g,
		editor: y,
		channel: b.channel,
		onError: t.onError,
		onCollaboratorJoined: t.collaboration.onCollaboratorJoined,
		onCollaboratorLeft: t.collaboration.onCollaboratorLeft,
		onBlockLocked: t.collaboration.onBlockLocked,
		onBlockUnlocked: t.collaboration.onBlockUnlocked
	}), ee(() => x.lockedBlocks.value, (e) => {
		v.value = e;
	}, { immediate: !0 }), U(y, x));
	let S = f(() => !!t.collaboration?.enabled && _.hasFeature("collaboration")), C = O({
		editor: y,
		config: {
			uiTheme: t.uiTheme,
			theme: void 0,
			blockDefaults: t.blockDefaults,
			customBlocks: [],
			mergeTags: t.mergeTags,
			displayConditions: t.displayConditions,
			onRequestMedia: null,
			lint: Ce(t),
			onSave: () => {
				p.value?.().catch((e) => {
					t.onError?.(e);
				});
			}
		},
		translations: n,
		fontsManager: r,
		historyOptions: x ? { isRemoteOperation: () => x._isProcessingRemoteOperation() } : void 0,
		autoSaveOptions: {
			onChange: async () => {
				y.hasTemplate() && (await y.createSnapshot(), m?.snapshotHistoryInstance.value?.loadSnapshots());
			},
			debounce: t.autoSaveDebounce ?? 5e3,
			enabled: () => t.autoSave !== !1 && _.hasFeature("auto_save")
		},
		themeExtraStyles: () => ({ "--tpl-drop-text": `"${n.canvas.dropHere}"` }),
		keyboardOptions: { onBeforeUndo: () => h?.showCollabUndoWarning() },
		editorRoot: e.editorRoot,
		containerEl: e.containerEl
	}), w = Me({
		isCollaborationEnabled: S,
		getCollaboratorCount: () => x?.collaborators.value.length ?? 0,
		canUndo: C.history.canUndo
	});
	h = w;
	let T = Ae({
		authManager: g,
		editor: y,
		history: C.history,
		conditionPreview: C.conditionPreview,
		autoSave: C.autoSave,
		onError: t.onError
	});
	m = T;
	let E = je(), D = re(t.ai), k = Ne({
		planConfigInstance: _,
		aiConfig: D,
		editor: y
	}), j = Pe({
		onRequestMedia: t.onRequestMedia,
		mediaLibraryOpen: E.mediaLibraryOpen,
		mediaLibraryAccept: E.mediaLibraryAccept
	});
	V({
		onBlockMove: y.moveBlock,
		onBlockAdd: y.addBlock
	});
	let M = K({
		authManager: g,
		getFontsConfig: () => t.fonts,
		canUseCustomFonts: () => _.hasFeature("custom_fonts")
	}), N = ce({
		authManager: g,
		getTemplateId: () => y.state.template?.id ?? null,
		save: () => y.save(),
		exportHtml: (e) => M.exportHtml(e),
		onError: t.onError,
		isAuthReady: l,
		onBeforeTestEmail: t.onBeforeTestEmail
	}), P = ae({
		authManager: g,
		getTemplateId: () => y.state.template?.id ?? null,
		getSocketId: () => b.getSocketId(),
		onComment: t.onComment,
		onError: t.onError,
		isAuthReady: l,
		hasCommentingFeature: () => t.commenting !== !1 && _.hasFeature("commenting")
	});
	ve({
		comments: P,
		channel: b.channel
	});
	let I = J({
		authManager: g,
		onError: t.onError
	}), W = c(!1), G = c(null), Y = c(!1), X = _e({
		authManager: g,
		getTemplateId: () => y.state.template?.id ?? null
	});
	function Z(e) {
		E.commentsOpen.value = !0, queueMicrotask(() => {
			o()?.filterByBlock(e);
		});
	}
	a(ie, j.handleRequestMedia), a(ne, g), a(F, D), a(z, P), a(H, I), a(R, X), a(B, {
		plan: _,
		ai: D,
		comments: {
			getBlockCount: (e) => P.commentCountByBlock.value.get(e) ?? 0,
			openForBlock: Z
		},
		savedModules: {
			openSaveDialog: (e) => {
				G.value = e ?? null, W.value = !0;
			},
			openBrowser: () => {
				Y.value = !0;
			},
			moduleCount: f(() => I.modules.value.length)
		}
	});
	function le(e) {
		_.hasFeature("theme_customization") && (C.themeOverrides.value = e);
	}
	function ue(e) {
		y.setUiTheme(e);
	}
	async function Q() {
		s.value = !0, u.value = null;
		try {
			if (await g.initialize(), d) return;
			l.value = !0;
			let e = await de({ authManager: g });
			if (d) return;
			if (!e.api.ok) throw Error("Health check failed: API is not reachable");
			if (!e.auth.ok) throw Error(`Health check failed: authentication error${e.auth.error ? ` - ${e.auth.error}` : ""}`);
			if (e.websocket.ok || L.warn("WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await _.fetchConfig(), d) return;
			r.setCustomFontsEnabled(_.hasFeature("custom_fonts")), t.customBlocks?.length && _.hasFeature("custom_blocks") && C.registerCustomBlocks(t.customBlocks), t.theme && _.hasFeature("theme_customization") && (C.themeOverrides.value = t.theme), t.modules !== !1 && _.hasFeature("saved_modules") && I.loadModules(), i("ready");
		} catch (e) {
			if (d) return;
			let n = e instanceof Error ? e : Error("Initialization failed", { cause: e });
			u.value = n, t.onError?.(n);
		} finally {
			d || (s.value = !1);
		}
	}
	function fe() {
		d = !0, r.cleanupFontLinks(), b.disconnect(), C.destroy(), t.onUnmount?.();
	}
	return {
		isInitializing: s,
		isAuthReady: l,
		initError: u,
		isDestroyed: () => d,
		authManager: g,
		planConfigInstance: _,
		websocket: b,
		collaboration: x,
		isCollaborationEnabled: S,
		editor: y,
		core: C,
		aiConfig: D,
		featureFlags: k,
		mediaLib: j,
		exporter: M,
		testEmail: N,
		commentsInstance: P,
		savedModulesHeadless: I,
		scoringInstance: X,
		panelState: E,
		snapshotPreview: T,
		collabWarning: w,
		showSaveModuleDialog: W,
		showModuleBrowserModal: Y,
		saveModulePreSelectedBlockId: G,
		onSaveHook: p,
		initialize: Q,
		destroy: fe,
		setThemeOverrides: le,
		setUiTheme: ue,
		openCommentsForBlock: Z
	};
}
//#endregion
//#region src/utils/preRenderCustomBlocks.ts
async function Ie(e, t) {
	let n = async (e) => {
		if (ge(e)) {
			let n = e;
			try {
				n.renderedHtml = await t.renderCustomBlock(n);
			} catch {
				n.renderedHtml = `<!-- Custom block render error: ${n.customType} -->`;
			}
		}
		if (e.type === "section" && "children" in e) {
			let t = e;
			for (let e of t.children) for (let t of e) await n(t);
		}
	};
	for (let t of e.blocks) await n(t);
}
//#endregion
//#region src/cloud/composables/useCloudLifecycle.ts
function Le(e) {
	let { config: t, editor: n, websocket: r, planConfigInstance: i, snapshotPreview: a, core: o, exporter: s, featureFlags: c, isDestroyed: l } = e;
	function u() {
		return he(i.config.value.websocket);
	}
	async function d(e) {
		let i = await n.create(e);
		return l() ? i : (t.onCreate?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
	}
	async function f(e) {
		let i = await n.load(e);
		return l() ? i : (t.onLoad?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
	}
	async function p() {
		c.isSaveExporting.value = !0, c.saveStatus.value = "idle";
		try {
			if (await Ie(n.content.value, o.registry), l()) throw Error("Component unmounted during save");
			let e = await n.save();
			if (l()) throw Error("Component unmounted during save");
			a.initSnapshotHistory(), a.snapshotHistoryInstance.value?.loadSnapshots();
			let r = await s.exportHtml(e.id);
			if (l()) throw Error("Component unmounted during save");
			let i = {
				templateId: e.id,
				html: r.html,
				mjml: r.mjml,
				content: e.content
			};
			return t.onSave?.(i), c.saveStatus.value = "saved", c.startSaveStatusClear(), i;
		} catch (e) {
			throw l() || (c.saveStatus.value = "error", c.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
		} finally {
			l() || (c.isSaveExporting.value = !1);
		}
	}
	return {
		createTemplate: d,
		loadTemplate: f,
		saveTemplate: p
	};
}
//#endregion
//#region src/cloud/composables/useCloudSaveGate.ts
function Re(e) {
	let t = c(!1), n = null, r = f(() => e.planConfig.value?.accessibility?.blockOnError === !0), i = f(() => r.value ? e.issues.value.filter((e) => e.severity === "error") : []), a = f(() => i.value.length > 0);
	async function o(e) {
		return a.value ? (n = e, t.value = !0, !1) : (await e(), !0);
	}
	async function s() {
		let e = n;
		n = null, t.value = !1, e && await e();
	}
	function l() {
		n = null, t.value = !1;
	}
	return {
		shouldBlock: a,
		blockingIssues: i,
		modalOpen: t,
		tryRunSave: o,
		confirmAndSave: s,
		cancel: l
	};
}
//#endregion
//#region src/cloud/components/CloudSaveGateModal.vue?vue&type=script&setup=true&lang.ts
var ze = ["aria-label"], Be = { class: "tpl:flex tpl:max-h-[80vh] tpl:w-full tpl:max-w-md tpl:flex-col tpl:gap-4 tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-5 tpl:shadow-[var(--tpl-shadow-md)]" }, Ve = { class: "tpl:flex tpl:items-center tpl:gap-2" }, He = { class: "tpl:m-0 tpl:text-base tpl:font-semibold tpl:text-[var(--tpl-text)]" }, Ue = { class: "tpl:m-0 tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, We = { class: "tpl:m-0 tpl:flex tpl:max-h-64 tpl:list-none tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-2" }, Ge = { class: "tpl:text-xs tpl:text-[var(--tpl-text)]" }, Ke = { class: "tpl:font-mono tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]" }, qe = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Je = /* @__PURE__ */ E({
	__name: "CloudSaveGateModal",
	props: {
		open: { type: Boolean },
		issues: {}
	},
	emits: ["cancel", "confirm"],
	setup(e, { emit: t }) {
		let n = t, { t: r } = Q();
		return (t, a) => (i(), v(y, {
			"enter-active-class": "tpl:transition-opacity tpl:duration-150",
			"leave-active-class": "tpl:transition-opacity tpl:duration-150",
			"enter-from-class": "tpl:opacity-0",
			"leave-to-class": "tpl:opacity-0"
		}, {
			default: s(() => [e.open ? (i(), p("div", {
				key: 0,
				role: "dialog",
				"aria-modal": "true",
				"aria-label": h(r).saveGate.title,
				class: "tpl:fixed tpl:inset-0 tpl:z-50 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/40 tpl:p-6",
				onClick: a[2] ||= _((e) => n("cancel"), ["self"])
			}, [x("div", Be, [
				x("header", Ve, [D(h(ue), {
					size: 18,
					"stroke-width": 2,
					class: "tpl:text-[var(--tpl-warning)]"
				}), x("h2", He, d(h(r).saveGate.title), 1)]),
				x("p", Ue, d(h(r).saveGate.body), 1),
				x("ul", We, [(i(!0), p(w, null, o(e.issues, (e) => (i(), p("li", {
					key: `${e.ruleId}-${e.blockId ?? "template"}`,
					class: "tpl:flex tpl:flex-col tpl:gap-0.5 tpl:rounded tpl:px-2 tpl:py-1.5"
				}, [x("span", Ge, d(e.message), 1), x("span", Ke, d(e.ruleId), 1)]))), 128))]),
				x("footer", qe, [x("button", {
					type: "button",
					class: "tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text)]",
					onClick: a[0] ||= (e) => n("cancel")
				}, d(h(r).saveGate.cancel), 1), x("button", {
					type: "button",
					class: "tpl:rounded-md tpl:bg-[var(--tpl-danger)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white",
					onClick: a[1] ||= (e) => n("confirm")
				}, d(h(r).saveGate.confirm), 1)])
			])], 8, ze)) : m("", !0)]),
			_: 1
		}));
	}
}), Ye = {
	class: "tpl-header tpl:absolute tpl:top-0 tpl:right-0 tpl:left-0 tpl:z-50 tpl:grid tpl:h-14 tpl:grid-cols-[1fr_auto_1fr] tpl:items-center tpl:px-4",
	style: {
		"background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)",
		"backdrop-filter": "blur(12px)",
		"-webkit-backdrop-filter": "blur(12px)",
		"box-shadow": "var(--tpl-shadow-md)",
		"border-bottom": "1px solid var(--tpl-border)"
	}
}, Xe = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, Ze = {
	key: 0,
	class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
}, Qe = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, $e = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, et = ["data-tooltip"], tt = {
	key: 1,
	"aria-live": "polite",
	class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]"
}, nt = {
	key: 2,
	"aria-live": "polite",
	class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
}, rt = ["aria-label", "aria-expanded"], it = {
	key: 0,
	class: "tpl:inline-flex tpl:size-4.5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-[10px] tpl:font-semibold tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]"
}, at = ["aria-expanded"], ot = {
	key: 0,
	class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
}, st = ["disabled"], ct = ["disabled"], lt = /* @__PURE__ */ E({
	__name: "CloudHeader",
	props: {
		editor: {},
		core: {},
		featureFlags: {},
		panelState: {},
		snapshotPreview: {},
		commentsInstance: {},
		testEmail: {},
		websocket: {},
		collaboration: {},
		isCollaborationEnabled: { type: Boolean },
		isSaveDisabled: { type: Boolean },
		isSaving: { type: Boolean }
	},
	emits: ["save"],
	setup(e) {
		let t = u(() => import("./CollaboratorBar-C0zeecvl.js")), n = u(() => import("./features-CUYy5kZQ.js").then((e) => e.r)), r = u(() => import("./AiFeatureMenu-CcuKnisc.js")), { t: a, format: o } = Q();
		return (c, l) => (i(), p("header", Ye, [
			x("div", Xe, [e.featureFlags.templateLimit.value === null ? m("", !0) : (i(), p("span", Ze, d(h(o)(h(a).header.templatesUsed, {
				used: e.featureFlags.templateCount.value,
				max: e.featureFlags.templateLimit.value
			})), 1))]),
			x("div", Qe, [
				D(we, {
					viewport: e.editor.state.viewport,
					onChange: e.editor.setViewport
				}, null, 8, ["viewport", "onChange"]),
				D(Te, {
					"dark-mode": e.editor.state.darkMode,
					onChange: e.editor.setDarkMode
				}, null, 8, ["dark-mode", "onChange"]),
				D(De, {
					"preview-mode": e.editor.state.previewMode,
					onChange: e.editor.setPreviewMode
				}, null, 8, ["preview-mode", "onChange"]),
				e.collaboration && e.isCollaborationEnabled ? (i(), v(h(t), {
					key: 0,
					collaborators: e.collaboration.collaborators.value,
					"is-connected": e.websocket.isConnected.value
				}, null, 8, ["collaborators", "is-connected"])) : m("", !0),
				e.snapshotPreview.snapshotHistoryInstance.value ? (i(), v(h(n), {
					key: 1,
					snapshots: e.snapshotPreview.snapshotHistorySnapshots.value,
					"is-loading": e.snapshotPreview.snapshotHistoryIsLoading.value,
					"is-restoring": e.snapshotPreview.snapshotHistoryIsRestoring.value,
					onLoad: e.snapshotPreview.loadSnapshotHistory,
					onNavigate: e.snapshotPreview.handleSnapshotNavigate
				}, null, 8, [
					"snapshots",
					"is-loading",
					"is-restoring",
					"onLoad",
					"onNavigate"
				])) : m("", !0)
			]),
			x("div", $e, [
				e.featureFlags.saveStatus.value === "error" ? (i(), p("div", {
					key: 0,
					"aria-live": "assertive",
					class: "tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]",
					"data-tooltip": e.featureFlags.saveErrorMessage.value
				}, [D(h(j), {
					size: 12,
					"stroke-width": 2.5
				}), T(" " + d(h(a).header.saveFailed), 1)], 8, et)) : e.featureFlags.saveStatus.value === "saved" ? (i(), p("div", tt, [D(h(k), {
					size: 12,
					"stroke-width": 2.5
				}), T(" " + d(h(a).header.saved), 1)])) : e.editor.state.isDirty ? (i(), p("div", nt, [l[4] ||= x("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), T(" " + d(h(a).header.unsaved), 1)])) : m("", !0),
				e.commentsInstance.isEnabled.value && e.featureFlags.hasTemplateSaved.value ? (i(), p("button", {
					key: 3,
					"aria-label": e.commentsInstance.unresolvedCount.value > 0 ? `${h(a).comments.button} (${e.commentsInstance.unresolvedCount.value})` : h(a).comments.button,
					"aria-expanded": e.panelState.commentsOpen.value,
					class: b(h($)),
					style: C({
						backgroundColor: e.panelState.commentsOpen.value ? "var(--tpl-primary)" : "transparent",
						color: e.panelState.commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
						borderColor: "var(--tpl-primary)"
					}),
					onClick: l[0] ||= (t) => e.panelState.commentsOpen.value = !e.panelState.commentsOpen.value
				}, [
					D(h(W), {
						size: 16,
						"stroke-width": 2
					}),
					T(" " + d(h(a).comments.button) + " ", 1),
					e.commentsInstance.unresolvedCount.value > 0 && !e.panelState.commentsOpen.value ? (i(), p("span", it, d(e.commentsInstance.unresolvedCount.value), 1)) : m("", !0)
				], 14, rt)) : m("", !0),
				e.featureFlags.canUseAiGeneration.value && e.featureFlags.hasTemplateSaved.value ? (i(), p("div", {
					key: 4,
					ref: (t) => e.panelState.aiMenuRef.value = t,
					class: "tpl:relative"
				}, [x("button", {
					"aria-expanded": e.panelState.aiMenuOpen.value,
					class: b(["tpl-ai-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:whitespace-nowrap tpl:transition-all tpl:duration-200", e.panelState.aiButtonActive.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
					onClick: l[1] ||= _((...t) => e.panelState.toggleAiMenu && e.panelState.toggleAiMenu(...t), ["stop"])
				}, [D(h(fe), {
					size: 16,
					"stroke-width": 2,
					class: "tpl-ai-btn-icon"
				}), T(" " + d(h(a).aiChat.button), 1)], 10, at), D(y, {
					"enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
					"enter-from-class": "tpl:scale-95 tpl:opacity-0",
					"enter-to-class": "tpl:scale-100 tpl:opacity-100",
					"leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
					"leave-from-class": "tpl:scale-100 tpl:opacity-100",
					"leave-to-class": "tpl:scale-95 tpl:opacity-0"
				}, {
					default: s(() => [e.panelState.aiMenuOpen.value ? (i(), p("div", ot, [D(h(r), {
						"active-feature": e.panelState.activeAiFeature.value,
						onSelect: e.panelState.handleAiFeatureSelect
					}, null, 8, ["active-feature", "onSelect"])])) : m("", !0)]),
					_: 1
				})], 512)) : m("", !0),
				e.testEmail.isEnabled.value && e.featureFlags.canSendTestEmail.value ? (i(), p("button", {
					key: 5,
					class: b(h($)),
					style: {
						"background-color": "transparent",
						color: "var(--tpl-primary)",
						"border-color": "var(--tpl-primary)"
					},
					disabled: e.testEmail.isSending.value || !e.featureFlags.hasTemplateSaved.value,
					onClick: l[2] ||= (t) => e.panelState.testEmailModalOpen.value = !0
				}, [e.testEmail.isSending.value ? (i(), v(h(me), {
					key: 1,
					class: "tpl-spinner",
					size: 16,
					"stroke-width": 2
				})) : (i(), v(h(X), {
					key: 0,
					size: 16,
					"stroke-width": 2
				})), T(" " + d(h(a).testEmail.button), 1)], 10, st)) : m("", !0),
				x("button", {
					class: b(h($)),
					style: {
						"background-color": "transparent",
						color: "var(--tpl-primary)",
						"border-color": "var(--tpl-primary)"
					},
					disabled: e.isSaveDisabled,
					onClick: l[3] ||= (e) => c.$emit("save")
				}, [e.isSaving ? (i(), v(h(me), {
					key: 1,
					class: "tpl-spinner",
					size: 16,
					"stroke-width": 2
				})) : (i(), v(h(xe), {
					key: 0,
					size: 16,
					"stroke-width": 2
				})), T(" " + d(e.isSaving ? h(a).header.saving : h(a).header.save), 1)], 10, ct)
			])
		]));
	}
}), ut = /* @__PURE__ */ E({
	__name: "CloudPanels",
	props: {
		config: {},
		editor: {},
		core: {},
		panelState: {},
		planConfigInstance: {},
		testEmail: {},
		mediaLib: {},
		savedModulesHeadless: {},
		showSaveModuleDialog: { type: Boolean },
		saveModulePreSelectedBlockId: {},
		showModuleBrowserModal: { type: Boolean }
	},
	emits: [
		"update:showSaveModuleDialog",
		"update:saveModulePreSelectedBlockId",
		"update:showModuleBrowserModal",
		"send-test-email",
		"module-insert"
	],
	setup(e, { expose: t, emit: n }) {
		let r = u(() => import("./features-CUYy5kZQ.js").then((e) => e.c)), a = u(() => import("./features-CUYy5kZQ.js").then((e) => e.s)), o = u(() => import("./features-CUYy5kZQ.js").then((e) => e.o)), s = u(() => import("./features-CUYy5kZQ.js").then((e) => e.n)), l = u(() => import("./features-CUYy5kZQ.js").then((e) => e.t)), d = u(() => import("./SaveModuleDialog-DR9EZlWe.js")), f = u(() => import("./ModuleBrowserModal-CFMd6M7E.js")), g = u(async () => {
			try {
				return (await import("./src-Dp0ZFQ4-.js")).MediaLibraryModal;
			} catch {
				throw Error("[Templatical] Cloud media library requires the optional peer dependency '@templatical/media-library'. Please install it.");
			}
		}), _ = n;
		function y(e, t, n) {
			t.history.record(), n.setContent(e), t.conditionPreview.reset();
		}
		function b(e, t) {
			_("module-insert", e, t);
		}
		let x = c(null);
		function S(e) {
			x.value?.filterByBlock(e);
		}
		return t({ filterCommentsByBlock: S }), (t, n) => (i(), p(w, null, [
			D(h(r), {
				visible: e.panelState.aiChatOpen.value,
				"on-apply": (t) => y(t, e.core, e.editor),
				onClose: n[0] ||= (t) => e.panelState.aiChatOpen.value = !1
			}, null, 8, ["visible", "on-apply"]),
			D(h(s), {
				visible: e.panelState.scoringPanelOpen.value,
				onClose: n[1] ||= (t) => e.panelState.scoringPanelOpen.value = !1
			}, null, 8, ["visible"]),
			D(h(o), {
				visible: e.panelState.designReferenceOpen.value,
				"has-existing-blocks": e.editor.content.value.blocks.length > 0,
				onClose: n[2] ||= (t) => e.panelState.designReferenceOpen.value = !1,
				onApply: n[3] ||= (t) => y(t, e.core, e.editor)
			}, null, 8, ["visible", "has-existing-blocks"]),
			D(h(a), {
				ref_key: "commentsSidebar",
				ref: x,
				visible: e.panelState.commentsOpen.value,
				onClose: n[4] ||= (t) => e.panelState.commentsOpen.value = !1
			}, null, 8, ["visible"]),
			D(h(l), {
				visible: e.panelState.testEmailModalOpen.value,
				"allowed-emails": e.testEmail.allowedEmails.value,
				"is-sending": e.testEmail.isSending.value,
				error: e.testEmail.error.value,
				onSend: n[5] ||= (e) => _("send-test-email", e),
				onClose: n[6] ||= (t) => e.panelState.testEmailModalOpen.value = !1
			}, null, 8, [
				"visible",
				"allowed-emails",
				"is-sending",
				"error"
			]),
			e.planConfigInstance.hasFeature("saved_modules") && e.config.modules !== !1 ? (i(), v(h(d), {
				key: 0,
				visible: e.showSaveModuleDialog,
				"pre-selected-block-id": e.saveModulePreSelectedBlockId,
				onClose: n[7] ||= (e) => {
					_("update:showSaveModuleDialog", !1), _("update:saveModulePreSelectedBlockId", null);
				},
				onSaved: n[8] ||= (t) => e.savedModulesHeadless.loadModules()
			}, null, 8, ["visible", "pre-selected-block-id"])) : m("", !0),
			e.planConfigInstance.hasFeature("saved_modules") && e.config.modules !== !1 ? (i(), v(h(f), {
				key: 1,
				visible: e.showModuleBrowserModal,
				onClose: n[9] ||= (e) => _("update:showModuleBrowserModal", !1),
				onInsert: b
			}, null, 8, ["visible"])) : m("", !0),
			D(h(g), {
				visible: e.panelState.mediaLibraryOpen.value,
				accept: e.panelState.mediaLibraryAccept.value,
				"popover-target": e.core.popoverRoot.value,
				onSelect: e.mediaLib.handleMediaSelect,
				onClose: e.mediaLib.handleMediaLibraryClose
			}, null, 8, [
				"visible",
				"accept",
				"popover-target",
				"onSelect",
				"onClose"
			])
		], 64));
	}
}), dt = {
	key: 0,
	class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
}, ft = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, pt = { class: "tpl:flex tpl:w-12 tpl:shrink-0 tpl:flex-col tpl:items-center tpl:gap-4 tpl:py-5 tpl:border-r tpl:border-[var(--tpl-border)]" }, mt = /* @__PURE__ */ E({
	__name: "CloudLoadingOverlay",
	props: { visible: { type: Boolean } },
	setup(e) {
		return (t, n) => e.visible ? (i(), p("div", dt, [n[1] ||= l("<div class=\"tpl:flex tpl:h-14 tpl:shrink-0 tpl:items-center tpl:justify-between tpl:px-4 tpl:border-b tpl:border-[var(--tpl-border)]\"><div class=\"tpl-shimmer tpl:h-5 tpl:w-28 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl:flex tpl:gap-3\"><div class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"></div></div></div>", 1), x("div", ft, [x("div", pt, [(i(), p(w, null, o(5, (e) => x("div", {
			key: e,
			class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
		})), 64))]), n[0] ||= l("<div class=\"tpl:flex tpl:flex-1 tpl:items-start tpl:justify-center tpl:overflow-auto tpl:p-8 tpl:bg-[var(--tpl-canvas-bg)]\"><div class=\"tpl:w-full tpl:max-w-[600px] tpl:rounded-[var(--tpl-radius)] tpl:p-6 tpl:bg-[var(--tpl-bg)] tpl:shadow-[var(--tpl-shadow-sm)]\"><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:h-3 tpl:w-3/4 tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-5/6 tpl:rounded\"></div></div><div class=\"tpl:py-4\"><div class=\"tpl-shimmer tpl:h-44 tpl:w-full tpl:rounded-[var(--tpl-radius-sm)]\"></div></div><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-2/3 tpl:rounded\"></div></div><div class=\"tpl:flex tpl:justify-center tpl:py-4\"><div class=\"tpl-shimmer tpl:h-10 tpl:w-36 tpl:rounded-[var(--tpl-radius-sm)]\"></div></div><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/2 tpl:rounded\"></div><div class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/3 tpl:rounded\"></div></div></div></div><div class=\"tpl:flex tpl:w-[320px] tpl:shrink-0 tpl:flex-col tpl:gap-4 tpl:p-4 tpl:border-l tpl:border-[var(--tpl-border)]\"><div class=\"tpl-shimmer tpl:h-8 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div><div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div></div>", 2)])])) : m("", !0);
	}
}), ht = {
	key: 0,
	role: "alert",
	class: "tpl-error tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-6 tpl:px-8 tpl:bg-[var(--tpl-bg)]"
}, gt = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, _t = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, vt = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, yt = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, bt = /* @__PURE__ */ E({
	__name: "CloudErrorOverlay",
	props: {
		error: {},
		visible: { type: Boolean }
	},
	emits: ["retry"],
	setup(e, { emit: t }) {
		let n = t, { t: r } = Q();
		function a(e) {
			return "isUnauthorized" in e && e.isUnauthorized ? r.error.authFailed : "isNotFound" in e && e.isNotFound ? r.error.templateNotFound : r.error.defaultMessage;
		}
		function o(e) {
			return "isNotFound" in e && !!e.isNotFound;
		}
		return (t, s) => e.visible && e.error ? (i(), p("div", ht, [
			x("div", gt, [D(h(j), {
				size: 32,
				"stroke-width": 1.5,
				class: "tpl:text-[var(--tpl-danger)]"
			})]),
			x("div", _t, [x("h2", vt, d(h(r).error.title), 1), x("p", yt, d(a(e.error)), 1)]),
			o(e.error) ? m("", !0) : (i(), p("button", {
				key: 0,
				class: "tpl-btn tpl-btn-primary tpl:inline-flex tpl:items-center tpl:gap-2 tpl:rounded-md tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
				onClick: s[0] ||= (e) => n("retry")
			}, d(h(r).error.retry), 1))
		])) : m("", !0);
	}
}), xt = {
	key: 0,
	class: "tpl-preview-banner tpl:absolute tpl:top-14 tpl:right-0 tpl:left-0 tpl:z-40 tpl:flex tpl:items-center tpl:justify-center tpl:gap-4 tpl:px-4 tpl:py-3 tpl:bg-[var(--tpl-primary-light)] tpl:border-b tpl:border-[var(--tpl-primary)]"
}, St = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, Ct = { class: "tpl:flex tpl:items-center tpl:gap-2" }, wt = /* @__PURE__ */ E({
	__name: "SnapshotPreviewBanner",
	props: { visible: { type: Boolean } },
	emits: ["cancel", "confirm"],
	setup(e, { emit: t }) {
		let n = t, { t: r } = Q();
		return (t, a) => e.visible ? (i(), p("div", xt, [x("div", St, [D(h(M), {
			size: 18,
			"stroke-width": 2,
			class: "tpl:text-[var(--tpl-primary)]"
		}), x("span", null, d(h(r).snapshotPreview.message), 1)]), x("div", Ct, [x("button", {
			class: "tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:text-[var(--tpl-text-muted)] tpl:border tpl:border-[var(--tpl-border)]",
			style: { "background-color": "transparent" },
			onClick: a[0] ||= (e) => n("cancel")
		}, d(h(r).snapshotPreview.cancel), 1), x("button", {
			class: "tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
			onClick: a[1] ||= (e) => n("confirm")
		}, d(h(r).snapshotPreview.restore), 1)])])) : m("", !0);
	}
}), Tt = {
	key: 0,
	role: "status",
	"aria-live": "polite",
	class: "tpl:absolute tpl:top-16 tpl:left-1/2 tpl:z-toast tpl:-translate-x-1/2 tpl:rounded-[var(--tpl-radius)] tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:shadow-lg",
	style: {
		"background-color": "var(--tpl-warning-light)",
		color: "var(--tpl-text)",
		border: "1px solid var(--tpl-warning)"
	}
}, Et = /* @__PURE__ */ E({
	__name: "CollabUndoToast",
	props: { visible: { type: Boolean } },
	setup(e) {
		let { t } = N();
		return (n, r) => e.visible ? (i(), p("div", Tt, d(h(t).history.collabWarning), 1)) : m("", !0);
	}
}), Dt = ["data-tpl-theme"], Ot = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, kt = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, At = ["aria-label"], jt = /* @__PURE__ */ le(/* @__PURE__ */ E({
	__name: "CloudEditor",
	props: {
		config: {},
		translations: {},
		cloudTranslations: {},
		fontsManager: {},
		shadowRoot: {}
	},
	emits: ["ready"],
	setup(e, { expose: r, emit: o }) {
		let l = e;
		a(P, l.cloudTranslations);
		let u = o, f = c(null), _ = c(null), w = Fe({
			config: l.config,
			translations: l.translations,
			fontsManager: l.fontsManager,
			emit: u,
			getCommentsSidebar: () => f.value ? { filterByBlock: f.value.filterCommentsByBlock } : null,
			editorRoot: l.shadowRoot,
			containerEl: _
		}), { isInitializing: E, isAuthReady: ee, initError: O, planConfigInstance: k, websocket: A, collaboration: j, isCollaborationEnabled: M, editor: N, core: F, featureFlags: I, mediaLib: L, exporter: te, testEmail: R, commentsInstance: ne, savedModulesHeadless: re, panelState: z, snapshotPreview: B, collabWarning: ie, showSaveModuleDialog: V, showModuleBrowserModal: H, saveModulePreSelectedBlockId: U, setThemeOverrides: W, setUiTheme: ae } = w;
		async function oe(e) {
			try {
				await R.sendTestEmail(e), z.testEmailModalOpen.value = !1;
			} catch {}
		}
		function G(e, t) {
			for (let n = 0; n < e.content.length; n++) {
				let r = ye(e.content[n]), i = t === void 0 ? void 0 : t + n;
				N.addBlock(r, void 0, void 0, i);
			}
			H.value = !1;
		}
		let K = Le({
			config: l.config,
			editor: N,
			websocket: A,
			planConfigInstance: k,
			snapshotPreview: B,
			core: F,
			exporter: te,
			featureFlags: I,
			isDestroyed: w.isDestroyed
		}), q = Re({
			issues: F.templateLint ? F.templateLint.issues : c([]),
			planConfig: k.config
		});
		async function J() {
			await q.tryRunSave(() => K.saveTemplate().catch((e) => l.config.onError?.(e)));
		}
		return w.onSaveHook.value = J, t(() => {
			w.initialize();
		}), g(() => {
			w.destroy();
		}), r({
			getContent: () => N.content.value,
			setContent: (e) => N.setContent(e),
			setTheme: ae,
			setThemeOverrides: W,
			create: K.createTemplate,
			load: K.loadTemplate,
			save: K.saveTemplate,
			sendTestEmail: R.sendTestEmail
		}), (t, r) => (i(), p("div", {
			ref_key: "rootEl",
			ref: _,
			class: b(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": h(N).state.darkMode }]),
			"data-tpl-theme": h(F).resolvedTheme.value,
			style: C(h(F).themeStyles.value)
		}, [
			D(y, {
				"enter-active-class": "tpl:transition-opacity tpl:duration-200",
				"enter-from-class": "tpl:opacity-100",
				"enter-to-class": "tpl:opacity-100",
				"leave-active-class": "tpl:transition-opacity tpl:duration-300",
				"leave-from-class": "tpl:opacity-100",
				"leave-to-class": "tpl:opacity-0"
			}, {
				default: s(() => [D(mt, { visible: h(E) || h(N).state.isLoading }, null, 8, ["visible"])]),
				_: 1
			}),
			D(y, {
				"enter-active-class": "tpl:transition-opacity tpl:duration-200",
				"enter-from-class": "tpl:opacity-0",
				"enter-to-class": "tpl:opacity-100",
				"leave-active-class": "tpl:transition-opacity tpl:duration-300",
				"leave-from-class": "tpl:opacity-100",
				"leave-to-class": "tpl:opacity-0"
			}, {
				default: s(() => [D(bt, {
					error: h(O),
					visible: !!h(O) && !h(E),
					onRetry: h(w).initialize
				}, null, 8, [
					"error",
					"visible",
					"onRetry"
				])]),
				_: 1
			}),
			D(lt, {
				editor: h(N),
				core: h(F),
				"feature-flags": h(I),
				"panel-state": h(z),
				"snapshot-preview": h(B),
				"comments-instance": h(ne),
				"test-email": h(R),
				websocket: h(A),
				collaboration: h(j),
				"is-collaboration-enabled": h(M),
				"is-saving": h(N).state.isSaving || h(I).isSaveExporting.value,
				"is-save-disabled": h(N).state.isSaving || h(I).isSaveExporting.value || !h(N).state.isDirty,
				onSave: J
			}, null, 8, [
				"editor",
				"core",
				"feature-flags",
				"panel-state",
				"snapshot-preview",
				"comments-instance",
				"test-email",
				"websocket",
				"collaboration",
				"is-collaboration-enabled",
				"is-saving",
				"is-save-disabled"
			]),
			D(Je, {
				open: h(q).modalOpen.value,
				issues: h(q).blockingIssues.value,
				onCancel: h(q).cancel,
				onConfirm: h(q).confirmAndSave
			}, null, 8, [
				"open",
				"issues",
				"onCancel",
				"onConfirm"
			]),
			D(wt, {
				visible: h(B).isPreviewingSnapshot.value,
				onCancel: h(B).cancelPreview,
				onConfirm: h(B).confirmRestoreSnapshot
			}, null, 8, [
				"visible",
				"onCancel",
				"onConfirm"
			]),
			D(y, {
				"enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
				"enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
				"enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
				"leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
				"leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
				"leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
			}, {
				default: s(() => [D(Et, { visible: h(ie).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
				_: 1
			}),
			n(D(Ee, null, null, 512), [[S, !h(N).state.previewMode]]),
			x("div", {
				class: b(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto", [h(N).state.previewMode ? "tpl:left-0 tpl:right-0" : h(z).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", h(B).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
				style: {
					transition: "all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)",
					"background-color": "var(--tpl-canvas-bg)"
				}
			}, [x("div", Ot, [D(y, { name: "tpl-restore-btn" }, {
				default: s(() => [h(F).conditionPreview.hasHiddenBlocks.value ? (i(), p("button", {
					key: 0,
					class: "tpl:absolute tpl:left-1/2 tpl:top-2 tpl:-translate-x-1/2 tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-full tpl:border tpl:px-3.5 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:whitespace-nowrap tpl:shadow-md tpl:hover:opacity-80",
					style: {
						"background-color": "var(--tpl-warning-light)",
						color: "var(--tpl-warning)",
						"border-color": "var(--tpl-warning)",
						"backdrop-filter": "blur(8px)"
					},
					onClick: r[0] ||= (e) => h(F).conditionPreview.reset()
				}, [D(h(be), {
					size: 13,
					"stroke-width": 2
				}), T(" " + d(h(F).t.blockSettings.restoreHiddenBlocks), 1)])) : m("", !0)]),
				_: 1
			})]), x("main", kt, [D(Oe, {
				viewport: h(N).state.viewport,
				content: h(N).content.value,
				"selected-block-id": h(N).state.selectedBlockId,
				"dark-mode": h(N).state.darkMode,
				"preview-mode": h(N).state.previewMode,
				"locked-blocks": h(j)?.lockedBlocks.value ?? void 0,
				onSelectBlock: h(N).selectBlock,
				onOpenAiChat: r[1] ||= (e) => h(z).aiChatOpen.value = !0,
				onOpenDesignReference: r[2] ||= (e) => h(z).designReferenceOpen.value = !0
			}, null, 8, [
				"viewport",
				"content",
				"selected-block-id",
				"dark-mode",
				"preview-mode",
				"locked-blocks",
				"onSelectBlock"
			])])], 2),
			e.config.branding !== !1 && !h(I).isWhiteLabeled.value ? (i(), v(ke, {
				key: 0,
				"position-class": [h(N).state.previewMode ? "tpl:left-0 tpl:right-0" : h(z).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]
			}, null, 8, ["position-class"])) : m("", !0),
			x("div", {
				class: "tpl-sr-only",
				role: "status",
				"aria-live": "polite",
				"aria-atomic": "true",
				"aria-label": h(F).t.landmarks.reorderAnnouncements
			}, d(h(F).keyboardReorder.announcement.value), 9, At),
			n(D(Se, {
				"selected-block": h(N).selectedBlock.value,
				settings: h(N).content.value.settings,
				"shifted-left": h(z).rightPanelOpen.value,
				onUpdateBlock: r[3] ||= (e) => h(N).updateBlock(h(N).selectedBlock.value.id, e),
				onDeleteBlock: r[4] ||= (e) => h(F).blockActions.deleteBlock(h(N).selectedBlock.value.id),
				onDuplicateBlock: r[5] ||= (e) => h(F).blockActions.duplicateBlock(h(N).selectedBlock.value),
				onUpdateSettings: h(N).updateSettings
			}, null, 8, [
				"selected-block",
				"settings",
				"shifted-left",
				"onUpdateSettings"
			]), [[S, !h(N).state.previewMode]]),
			!h(E) && h(ee) ? (i(), v(ut, {
				key: 1,
				ref_key: "cloudPanelsRef",
				ref: f,
				config: l.config,
				editor: h(N),
				core: h(F),
				"panel-state": h(z),
				"plan-config-instance": h(k),
				"test-email": h(R),
				"media-lib": h(L),
				"saved-modules-headless": h(re),
				"show-save-module-dialog": h(V),
				"save-module-pre-selected-block-id": h(U),
				"show-module-browser-modal": h(H),
				"onUpdate:showSaveModuleDialog": r[6] ||= (e) => V.value = e,
				"onUpdate:saveModulePreSelectedBlockId": r[7] ||= (e) => U.value = e,
				"onUpdate:showModuleBrowserModal": r[8] ||= (e) => H.value = e,
				onSendTestEmail: oe,
				onModuleInsert: G
			}, null, 8, [
				"config",
				"editor",
				"core",
				"panel-state",
				"plan-config-instance",
				"test-email",
				"media-lib",
				"saved-modules-headless",
				"show-save-module-dialog",
				"save-module-pre-selected-block-id",
				"show-module-browser-modal"
			])) : m("", !0),
			x("div", {
				ref: (e) => h(F).popoverRoot.value = e,
				class: "tpl-popover-root"
			}, null, 512)
		], 14, Dt));
	}
}), [["__scopeId", "data-v-05f1a843"]]);
//#endregion
export { jt as default };

//# sourceMappingURL=CloudEditor-Bi10d2Gq.js.map