import { A as e, Dt as t, H as n, M as r, Mt as i, N as a, Ot as o, P as s, Q as c, S as l, V as u, Y as d, _ as f, b as p, c as m, d as h, et as g, g as _, h as v, it as y, j as b, m as x, p as S, t as C, u as w, v as T, x as E, y as D, z as O } from "./vue.runtime.esm-bundler-DpvJL-nX.js";
import { t as k } from "./timeouts-BSGxjuUF.js";
import { E as A, i as j } from "./dist-e0ylhlSV.js";
import { P as M, S as N, t as P } from "./useEditorCore-D0uZbPKG.js";
import { s as F, t as I } from "./dist-CuyhAnuE.js";
import { C as L, S as R, b as z, c as B, l as ee, r as te, s as V, t as H } from "./keys-BeW4IrXP.js";
import { t as U } from "./useI18n-Jp3X6Q0t.js";
import { n as W, t as G } from "./_plugin-vue_export-helper-GRmvIR5A.js";
import { t as K } from "./check-Om8IxvJb.js";
import { t as q } from "./circle-alert-De74azaX.js";
import { a as J, c as ne, i as Y, n as X, o as re, r as ie, s as ae, t as oe } from "./styles-C-FrkTA9.js";
import { t as Z } from "./clock-Dr7rX_PG.js";
import { t as se } from "./loader-circle-IS16T05j.js";
import { t as ce } from "./message-circle-3R472hDc.js";
import { t as le } from "./send-DRkFf4hP.js";
import { t as ue } from "./sparkles-CD7TiNiC.js";
import { n as Q } from "./useCloudI18n-D0Fi0hBU.js";
import { d as $ } from "./styleConstants-Beu6EmBc.js";
import { _ as de, a as fe, c as pe, d as me, f as he, g as ge, h as _e, l as ve, m as ye, n as be, o as xe, p as Se, r as Ce, s as we, t as Te, v as Ee, y as De } from "./cloud-B1NAFg44.js";
var Oe = W("save", [
	["path", {
		d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
		key: "1c8476"
	}],
	["path", {
		d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",
		key: "1ydtos"
	}],
	["path", {
		d: "M7 3v4a1 1 0 0 0 1 1h7",
		key: "t51u73"
	}]
]);
//#endregion
//#region src/cloud/composables/useSnapshotPreview.ts
function ke(e) {
	let { authManager: t, editor: n, history: r, conditionPreview: i, autoSave: a, onError: o } = e, s = g(null), l = c(null), u = c(null), d = S(() => l.value !== null), f = S(() => s.value?.snapshots.value ?? []), p = S(() => s.value?.isLoading.value ?? !1), m = S(() => s.value?.isRestoring.value ?? !1);
	function h() {
		n.state.template?.id && !s.value && (s.value = ge({
			authManager: t,
			templateId: n.state.template.id,
			onRestore: _,
			onError: o
		}), s.value.loadSnapshots());
	}
	function _(e) {
		n.setContent(e.content, !1), r.clear(), i.reset();
	}
	async function v(e) {
		if (l.value) {
			l.value = e, n.setContent(e.content, !1);
			return;
		}
		n.state.isDirty && n.hasTemplate() && await n.createSnapshot(), u.value = structuredClone(n.content.value), a?.pause(), l.value = e, n.setContent(e.content, !1);
	}
	async function y() {
		if (!(!l.value || !s.value)) try {
			await s.value.restoreSnapshot(l.value.id), await s.value.loadSnapshots();
		} finally {
			l.value = null, u.value = null, a?.resume();
		}
	}
	function b() {
		!l.value || !u.value || (n.setContent(u.value, !1), l.value = null, u.value = null, a?.resume());
	}
	async function x() {
		s.value && await s.value.loadSnapshots();
	}
	return {
		snapshotHistoryInstance: s,
		previewingSnapshot: l,
		contentBeforePreview: u,
		isPreviewingSnapshot: d,
		snapshotHistorySnapshots: f,
		snapshotHistoryIsLoading: p,
		snapshotHistoryIsRestoring: m,
		initSnapshotHistory: h,
		handleRestore: _,
		handleSnapshotNavigate: v,
		confirmRestoreSnapshot: y,
		cancelPreview: b,
		loadSnapshotHistory: x
	};
}
//#endregion
//#region src/cloud/composables/useCloudPanelState.ts
function Ae() {
	let e = c(null), t = S({
		get: () => e.value === "ai-chat",
		set: (t) => e.value = t ? "ai-chat" : null
	}), n = S({
		get: () => e.value === "scoring",
		set: (t) => e.value = t ? "scoring" : null
	}), r = S({
		get: () => e.value === "design-reference",
		set: (t) => e.value = t ? "design-reference" : null
	}), i = S({
		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 = S(() => e.value !== null), f = S(() => {
		let t = e.value;
		return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
	}), p = S(() => l.value || e.value === "ai-chat" || e.value === "design-reference" || e.value === "scoring");
	function m() {
		l.value = !l.value;
	}
	function h(t) {
		l.value = !1, e.value = e.value === t ? null : t;
	}
	return I(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: f,
		aiButtonActive: p,
		toggleAiMenu: m,
		handleAiFeatureSelect: h
	};
}
//#endregion
//#region src/cloud/composables/useCollabUndoWarning.ts
function je(e) {
	let { isCollaborationEnabled: t, getCollaboratorCount: n, canUndo: r } = e, i = c(!1), a = c(!1), { start: o } = F(() => {
		a.value = !1;
	}, k, { 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 Me(e) {
	let { planConfigInstance: t, aiConfig: n, editor: r } = e, i = S(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), a = S(() => t.hasFeature("test_email")), o = S(() => !!r.state.template?.id), s = S(() => t.hasFeature("white_label")), l = S(() => t.config.value?.limits.max_templates ?? null), u = S(() => t.config.value?.template_count ?? 0), d = c(!1), f = c("idle"), p = c(""), { start: m } = F(() => {
		f.value = "idle";
	}, 3e3, { immediate: !1 });
	return {
		canUseAiGeneration: i,
		canSendTestEmail: a,
		hasTemplateSaved: o,
		isWhiteLabeled: s,
		templateLimit: l,
		templateCount: u,
		isSaveExporting: d,
		saveStatus: f,
		saveErrorMessage: p,
		startSaveStatusClear: m
	};
}
//#endregion
//#region src/cloud/composables/useCloudMediaLibrary.ts
function Ne(e) {
	let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: r } = e, i = null;
	async function a() {
		if (t) {
			let e = await t({ accept: ["images"] });
			return e ? {
				url: e.url,
				alt: e.alt_text || void 0
			} : null;
		}
		return i &&= (i(null), null), r.value = ["images"], n.value = !0, new Promise((e) => {
			i = (t) => {
				e(t);
			};
		});
	}
	function o(e) {
		n.value = !1, i?.({
			url: e.url,
			alt: e.alt_text || void 0
		}), i = null;
	}
	function s() {
		n.value = !1, i?.(null), i = null;
	}
	return d(() => {
		i &&= (i(null), null);
	}), {
		handleRequestMedia: a,
		handleMediaSelect: o,
		handleMediaLibraryClose: s
	};
}
//#endregion
//#region src/cloud/composables/useCloudInitialization.ts
function Pe(e) {
	let { config: t, translations: n, fontsManager: r, emit: i, getCommentsSidebar: o } = e, s = c(!0), l = c(!1), u = c(null), d = !1, f = { value: null }, p = null, m = null, h = new Te({
		...t.auth,
		onError: t.onError
	}), g = ye({
		authManager: h,
		onError: t.onError
	}), _ = c(/* @__PURE__ */ new Map()), v = me({
		authManager: h,
		defaultFontFamily: t.fonts?.defaultFont,
		templateDefaults: t.templateDefaults,
		onError: t.onError,
		lockedBlocks: _
	}), y = De({
		authManager: h,
		onError: t.onError
	});
	t.mcp?.enabled && Se({
		editor: v,
		channel: y.channel,
		onOperation: t.mcp.onOperation
	});
	let b = null;
	t.collaboration?.enabled && (b = xe({
		authManager: h,
		editor: v,
		channel: y.channel,
		onError: t.onError,
		onCollaboratorJoined: t.collaboration.onCollaboratorJoined,
		onCollaboratorLeft: t.collaboration.onCollaboratorLeft,
		onBlockLocked: t.collaboration.onBlockLocked,
		onBlockUnlocked: t.collaboration.onBlockUnlocked
	}), O(() => b.lockedBlocks.value, (e) => {
		_.value = e;
	}, { immediate: !0 }), we(v, b));
	let x = S(() => !!t.collaboration?.enabled && g.hasFeature("collaboration")), C = P({
		editor: v,
		config: {
			uiTheme: t.uiTheme,
			theme: void 0,
			blockDefaults: t.blockDefaults,
			customBlocks: [],
			mergeTags: t.mergeTags,
			displayConditions: t.displayConditions,
			onRequestMedia: null,
			onSave: () => {
				f.value?.().catch((e) => {
					t.onError?.(e);
				});
			}
		},
		translations: n,
		fontsManager: r,
		historyOptions: b ? { isRemoteOperation: () => b._isProcessingRemoteOperation() } : void 0,
		autoSaveOptions: {
			onChange: async () => {
				v.hasTemplate() && (await v.createSnapshot(), p?.snapshotHistoryInstance.value?.loadSnapshots());
			},
			debounce: t.autoSaveDebounce ?? 5e3,
			enabled: () => t.autoSave !== !1 && g.hasFeature("auto_save")
		},
		themeExtraStyles: () => ({ "--tpl-drop-text": `"${n.canvas.dropHere}"` }),
		keyboardOptions: { onBeforeUndo: () => m?.showCollabUndoWarning() }
	}), w = je({
		isCollaborationEnabled: x,
		getCollaboratorCount: () => b?.collaborators.value.length ?? 0,
		canUndo: C.history.canUndo
	});
	m = w;
	let T = ke({
		authManager: h,
		editor: v,
		history: C.history,
		conditionPreview: C.conditionPreview,
		autoSave: C.autoSave,
		onError: t.onError
	});
	p = T;
	let E = Ae(), D = fe(t.ai), k = Me({
		planConfigInstance: g,
		aiConfig: D,
		editor: v
	}), A = Ne({
		onRequestMedia: t.onRequestMedia,
		mediaLibraryOpen: E.mediaLibraryOpen,
		mediaLibraryAccept: E.mediaLibraryAccept
	});
	N({
		onBlockMove: v.moveBlock,
		onBlockAdd: v.addBlock
	});
	let j = he({
		authManager: h,
		getFontsConfig: () => t.fonts,
		canUseCustomFonts: () => g.hasFeature("custom_fonts")
	}), F = Ee({
		authManager: h,
		getTemplateId: () => v.state.template?.id ?? null,
		save: () => v.save(),
		exportHtml: (e) => j.exportHtml(e),
		onError: t.onError,
		isAuthReady: l,
		onBeforeTestEmail: t.onBeforeTestEmail
	}), I = ve({
		authManager: h,
		getTemplateId: () => v.state.template?.id ?? null,
		getSocketId: () => y.getSocketId(),
		onComment: t.onComment,
		onError: t.onError,
		isAuthReady: l,
		hasCommentingFeature: () => t.commenting !== !1 && g.hasFeature("commenting")
	});
	pe({
		comments: I,
		channel: y.channel
	});
	let B = _e({
		authManager: h,
		onError: t.onError
	}), U = c(!1), W = c(null), G = c(!1), K = de({
		authManager: h,
		getTemplateId: () => v.state.template?.id ?? null
	});
	function q(e) {
		E.commentsOpen.value = !0, queueMicrotask(() => {
			o()?.filterByBlock(e);
		});
	}
	a(z, A.handleRequestMedia), a(te, h), a(H, D), a(ee, I), a(R, B), a(L, K), a(V, {
		plan: g,
		ai: D,
		comments: {
			getBlockCount: (e) => I.commentCountByBlock.value.get(e) ?? 0,
			openForBlock: q
		},
		savedModules: {
			openSaveDialog: (e) => {
				W.value = e ?? null, U.value = !0;
			},
			openBrowser: () => {
				G.value = !0;
			},
			moduleCount: S(() => B.modules.value.length)
		}
	});
	function J(e) {
		g.hasFeature("theme_customization") && (C.themeOverrides.value = e);
	}
	function ne(e) {
		v.setUiTheme(e);
	}
	async function Y() {
		s.value = !0, u.value = null;
		try {
			if (await h.initialize(), d) return;
			l.value = !0;
			let e = await be({ authManager: h });
			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 || M.warn("WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await g.fetchConfig(), d) return;
			r.setCustomFontsEnabled(g.hasFeature("custom_fonts")), t.customBlocks?.length && g.hasFeature("custom_blocks") && C.registerCustomBlocks(t.customBlocks), t.theme && g.hasFeature("theme_customization") && (C.themeOverrides.value = t.theme), t.modules !== !1 && g.hasFeature("saved_modules") && B.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 X() {
		d = !0, r.cleanupFontLinks(), y.disconnect(), C.destroy(), t.onUnmount?.();
	}
	return {
		isInitializing: s,
		isAuthReady: l,
		initError: u,
		isDestroyed: () => d,
		authManager: h,
		planConfigInstance: g,
		websocket: y,
		collaboration: b,
		isCollaborationEnabled: x,
		editor: v,
		core: C,
		aiConfig: D,
		featureFlags: k,
		mediaLib: A,
		exporter: j,
		testEmail: F,
		commentsInstance: I,
		savedModulesHeadless: B,
		scoringInstance: K,
		panelState: E,
		snapshotPreview: T,
		collabWarning: w,
		showSaveModuleDialog: U,
		showModuleBrowserModal: G,
		saveModulePreSelectedBlockId: W,
		onSaveHook: f,
		initialize: Y,
		destroy: X,
		setThemeOverrides: J,
		setUiTheme: ne,
		openCommentsForBlock: q
	};
}
//#endregion
//#region src/utils/preRenderCustomBlocks.ts
async function Fe(e, t) {
	let n = async (e) => {
		if (A(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 Ie(e) {
	let { config: t, editor: n, websocket: r, planConfigInstance: i, snapshotPreview: a, core: o, exporter: s, featureFlags: c, isDestroyed: l } = e;
	function u() {
		return Ce(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 Fe(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/components/CloudHeader.vue?vue&type=script&setup=true&lang.ts
var Le = {
	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)"
	}
}, Re = { 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)]"
}, Be = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, Ve = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, He = ["data-tooltip"], Ue = {
	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)]"
}, We = {
	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)]"
}, Ge = ["aria-label", "aria-expanded"], Ke = {
	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)]"
}, qe = ["aria-expanded"], Je = {
	key: 0,
	class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
}, Ye = ["disabled"], Xe = ["disabled"], Ze = /* @__PURE__ */ l({
	__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 n = E(() => import("./CollaboratorBar-BdXfCYAr.js")), a = E(() => import("./SnapshotHistory-4aWE_-GM.js")), s = E(() => import("./AiFeatureMenu-D7Od4cI2.js")), { t: c, format: l } = Q();
		return (d, m) => (r(), f("header", Le, [
			x("div", Re, [e.featureFlags.templateLimit.value === null ? _("", !0) : (r(), f("span", ze, i(y(l)(y(c).header.templatesUsed, {
				used: e.featureFlags.templateCount.value,
				max: e.featureFlags.templateLimit.value
			})), 1))]),
			x("div", Be, [
				p(Y, {
					viewport: e.editor.state.viewport,
					onChange: e.editor.setViewport
				}, null, 8, ["viewport", "onChange"]),
				p(X, {
					"dark-mode": e.editor.state.darkMode,
					onChange: e.editor.setDarkMode
				}, null, 8, ["dark-mode", "onChange"]),
				p(ie, {
					"preview-mode": e.editor.state.previewMode,
					onChange: e.editor.setPreviewMode
				}, null, 8, ["preview-mode", "onChange"]),
				e.collaboration && e.isCollaborationEnabled ? (r(), v(y(n), {
					key: 0,
					collaborators: e.collaboration.collaborators.value,
					"is-connected": e.websocket.isConnected.value
				}, null, 8, ["collaborators", "is-connected"])) : _("", !0),
				e.snapshotPreview.snapshotHistoryInstance.value ? (r(), v(y(a), {
					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"
				])) : _("", !0)
			]),
			x("div", Ve, [
				e.featureFlags.saveStatus.value === "error" ? (r(), f("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
				}, [p(y(q), {
					size: 12,
					"stroke-width": 2.5
				}), D(" " + i(y(c).header.saveFailed), 1)], 8, He)) : e.featureFlags.saveStatus.value === "saved" ? (r(), f("div", Ue, [p(y(K), {
					size: 12,
					"stroke-width": 2.5
				}), D(" " + i(y(c).header.saved), 1)])) : e.editor.state.isDirty ? (r(), f("div", We, [m[4] ||= x("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), D(" " + i(y(c).header.unsaved), 1)])) : _("", !0),
				e.commentsInstance.isEnabled.value && e.featureFlags.hasTemplateSaved.value ? (r(), f("button", {
					key: 3,
					"aria-label": e.commentsInstance.unresolvedCount.value > 0 ? `${y(c).comments.button} (${e.commentsInstance.unresolvedCount.value})` : y(c).comments.button,
					"aria-expanded": e.panelState.commentsOpen.value,
					class: t(y($)),
					style: o({
						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: m[0] ||= (t) => e.panelState.commentsOpen.value = !e.panelState.commentsOpen.value
				}, [
					p(y(ce), {
						size: 16,
						"stroke-width": 2
					}),
					D(" " + i(y(c).comments.button) + " ", 1),
					e.commentsInstance.unresolvedCount.value > 0 && !e.panelState.commentsOpen.value ? (r(), f("span", Ke, i(e.commentsInstance.unresolvedCount.value), 1)) : _("", !0)
				], 14, Ge)) : _("", !0),
				e.featureFlags.canUseAiGeneration.value && e.featureFlags.hasTemplateSaved.value ? (r(), f("div", {
					key: 4,
					ref: (t) => e.panelState.aiMenuRef.value = t,
					class: "tpl:relative"
				}, [x("button", {
					"aria-expanded": e.panelState.aiMenuOpen.value,
					class: t(["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: m[1] ||= w((...t) => e.panelState.toggleAiMenu && e.panelState.toggleAiMenu(...t), ["stop"])
				}, [p(y(ue), {
					size: 16,
					"stroke-width": 2,
					class: "tpl-ai-btn-icon"
				}), D(" " + i(y(c).aiChat.button), 1)], 10, qe), p(C, {
					"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: u(() => [e.panelState.aiMenuOpen.value ? (r(), f("div", Je, [p(y(s), {
						"active-feature": e.panelState.activeAiFeature.value,
						onSelect: e.panelState.handleAiFeatureSelect
					}, null, 8, ["active-feature", "onSelect"])])) : _("", !0)]),
					_: 1
				})], 512)) : _("", !0),
				e.testEmail.isEnabled.value && e.featureFlags.canSendTestEmail.value ? (r(), f("button", {
					key: 5,
					class: t(y($)),
					style: {
						"background-color": "transparent",
						color: "var(--tpl-primary)",
						"border-color": "var(--tpl-primary)"
					},
					disabled: e.testEmail.isSending.value || !e.featureFlags.hasTemplateSaved.value,
					onClick: m[2] ||= (t) => e.panelState.testEmailModalOpen.value = !0
				}, [e.testEmail.isSending.value ? (r(), v(y(se), {
					key: 1,
					class: "tpl-spinner",
					size: 16,
					"stroke-width": 2
				})) : (r(), v(y(le), {
					key: 0,
					size: 16,
					"stroke-width": 2
				})), D(" " + i(y(c).testEmail.button), 1)], 10, Ye)) : _("", !0),
				x("button", {
					class: t(y($)),
					style: {
						"background-color": "transparent",
						color: "var(--tpl-primary)",
						"border-color": "var(--tpl-primary)"
					},
					disabled: e.isSaveDisabled,
					onClick: m[3] ||= (e) => d.$emit("save")
				}, [e.isSaving ? (r(), v(y(se), {
					key: 1,
					class: "tpl-spinner",
					size: 16,
					"stroke-width": 2
				})) : (r(), v(y(Oe), {
					key: 0,
					size: 16,
					"stroke-width": 2
				})), D(" " + i(e.isSaving ? y(c).header.saving : y(c).header.save), 1)], 10, Xe)
			])
		]));
	}
}), Qe = /* @__PURE__ */ l({
	__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 i = E(() => import("./AiChatSidebar-Cg206ewI.js")), a = E(() => import("./CommentsSidebar-BAma2apG.js")), o = E(() => import("./DesignReferenceSidebar-B8DDnLHQ.js")), s = E(() => import("./TemplateScoringPanel-BmAHdgLF.js")), l = E(() => import("./TestEmailModal-p-iH28wl.js")), u = E(() => import("./SaveModuleDialog-BGFYMJby.js")), d = E(() => import("./ModuleBrowserModal-DpMInJoP.js")), m = E(async () => (await import("@templatical/media-library")).MediaLibraryModal), g = n;
		function b(e, t, n) {
			t.history.record(), n.setContent(e), t.conditionPreview.reset();
		}
		function x(e, t) {
			g("module-insert", e, t);
		}
		let S = c(null);
		function C(e) {
			S.value?.filterByBlock(e);
		}
		return t({ filterCommentsByBlock: C }), (t, n) => (r(), f(h, null, [
			p(y(i), {
				visible: e.panelState.aiChatOpen.value,
				"on-apply": (t) => b(t, e.core, e.editor),
				onClose: n[0] ||= (t) => e.panelState.aiChatOpen.value = !1
			}, null, 8, ["visible", "on-apply"]),
			p(y(s), {
				visible: e.panelState.scoringPanelOpen.value,
				onClose: n[1] ||= (t) => e.panelState.scoringPanelOpen.value = !1
			}, null, 8, ["visible"]),
			p(y(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) => b(t, e.core, e.editor)
			}, null, 8, ["visible", "has-existing-blocks"]),
			p(y(a), {
				ref_key: "commentsSidebar",
				ref: S,
				visible: e.panelState.commentsOpen.value,
				onClose: n[4] ||= (t) => e.panelState.commentsOpen.value = !1
			}, null, 8, ["visible"]),
			p(y(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) => g("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 ? (r(), v(y(u), {
				key: 0,
				visible: e.showSaveModuleDialog,
				"pre-selected-block-id": e.saveModulePreSelectedBlockId,
				onClose: n[7] ||= (e) => {
					g("update:showSaveModuleDialog", !1), g("update:saveModulePreSelectedBlockId", null);
				},
				onSaved: n[8] ||= (t) => e.savedModulesHeadless.loadModules()
			}, null, 8, ["visible", "pre-selected-block-id"])) : _("", !0),
			e.planConfigInstance.hasFeature("saved_modules") && e.config.modules !== !1 ? (r(), v(y(d), {
				key: 1,
				visible: e.showModuleBrowserModal,
				onClose: n[9] ||= (e) => g("update:showModuleBrowserModal", !1),
				onInsert: x
			}, null, 8, ["visible"])) : _("", !0),
			p(y(m), {
				visible: e.panelState.mediaLibraryOpen.value,
				accept: e.panelState.mediaLibraryAccept.value,
				onSelect: e.mediaLib.handleMediaSelect,
				onClose: e.mediaLib.handleMediaLibraryClose
			}, null, 8, [
				"visible",
				"accept",
				"onSelect",
				"onClose"
			])
		], 64));
	}
}), $e = {
	key: 0,
	class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
}, et = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, tt = { 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)]" }, nt = /* @__PURE__ */ l({
	__name: "CloudLoadingOverlay",
	props: { visible: { type: Boolean } },
	setup(e) {
		return (t, n) => e.visible ? (r(), f("div", $e, [n[1] ||= T("<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", et, [x("div", tt, [(r(), f(h, null, s(5, (e) => x("div", {
			key: e,
			class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
		})), 64))]), n[0] ||= T("<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)])])) : _("", !0);
	}
}), rt = {
	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)]"
}, it = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, at = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, ot = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, st = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, ct = /* @__PURE__ */ l({
	__name: "CloudErrorOverlay",
	props: {
		error: {},
		visible: { type: Boolean }
	},
	emits: ["retry"],
	setup(e, { emit: t }) {
		let n = t, { t: a } = Q();
		function o(e) {
			return "isUnauthorized" in e && e.isUnauthorized ? a.error.authFailed : "isNotFound" in e && e.isNotFound ? a.error.templateNotFound : a.error.defaultMessage;
		}
		function s(e) {
			return "isNotFound" in e && !!e.isNotFound;
		}
		return (t, c) => e.visible && e.error ? (r(), f("div", rt, [
			x("div", it, [p(y(q), {
				size: 32,
				"stroke-width": 1.5,
				class: "tpl:text-[var(--tpl-danger)]"
			})]),
			x("div", at, [x("h2", ot, i(y(a).error.title), 1), x("p", st, i(o(e.error)), 1)]),
			s(e.error) ? _("", !0) : (r(), f("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: c[0] ||= (e) => n("retry")
			}, i(y(a).error.retry), 1))
		])) : _("", !0);
	}
}), lt = {
	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)]"
}, ut = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, dt = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ft = /* @__PURE__ */ l({
	__name: "SnapshotPreviewBanner",
	props: { visible: { type: Boolean } },
	emits: ["cancel", "confirm"],
	setup(e, { emit: t }) {
		let n = t, { t: a } = Q();
		return (t, o) => e.visible ? (r(), f("div", lt, [x("div", ut, [p(y(Z), {
			size: 18,
			"stroke-width": 2,
			class: "tpl:text-[var(--tpl-primary)]"
		}), x("span", null, i(y(a).snapshotPreview.message), 1)]), x("div", dt, [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: o[0] ||= (e) => n("cancel")
		}, i(y(a).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: o[1] ||= (e) => n("confirm")
		}, i(y(a).snapshotPreview.restore), 1)])])) : _("", !0);
	}
}), pt = {
	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)"
	}
}, mt = /* @__PURE__ */ l({
	__name: "CollabUndoToast",
	props: { visible: { type: Boolean } },
	setup(e) {
		let { t } = U();
		return (n, a) => e.visible ? (r(), f("div", pt, i(y(t).history.collabWarning), 1)) : _("", !0);
	}
}), ht = ["data-tpl-theme"], gt = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, _t = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, vt = ["aria-label"], yt = /* @__PURE__ */ G(/* @__PURE__ */ l({
	__name: "CloudEditor",
	props: {
		config: {},
		translations: {},
		cloudTranslations: {},
		fontsManager: {}
	},
	emits: ["ready"],
	setup(s, { expose: l, emit: d }) {
		let h = s;
		a(B, h.cloudTranslations);
		let g = d, S = c(null), w = Pe({
			config: h.config,
			translations: h.translations,
			fontsManager: h.fontsManager,
			emit: g,
			getCommentsSidebar: () => S.value ? { filterByBlock: S.value.filterCommentsByBlock } : null
		}), { isInitializing: T, isAuthReady: E, initError: O, planConfigInstance: k, websocket: A, collaboration: M, isCollaborationEnabled: N, editor: P, core: F, featureFlags: I, mediaLib: L, exporter: R, testEmail: z, commentsInstance: ee, savedModulesHeadless: te, panelState: V, snapshotPreview: H, collabWarning: U, showSaveModuleDialog: W, showModuleBrowserModal: G, saveModulePreSelectedBlockId: K, setThemeOverrides: q, setUiTheme: Y } = w;
		async function X(e) {
			try {
				await z.sendTestEmail(e), V.testEmailModalOpen.value = !1;
			} catch {}
		}
		function ie(e, t) {
			for (let n = 0; n < e.content.length; n++) {
				let r = j(e.content[n]), i = t === void 0 ? void 0 : t + n;
				P.addBlock(r, void 0, void 0, i);
			}
			G.value = !1;
		}
		let Z = Ie({
			config: h.config,
			editor: P,
			websocket: A,
			planConfigInstance: k,
			snapshotPreview: H,
			core: F,
			exporter: R,
			featureFlags: I,
			isDestroyed: w.isDestroyed
		});
		return w.onSaveHook.value = Z.saveTemplate, e(() => {
			w.initialize();
		}), b(() => {
			w.destroy();
		}), l({
			getContent: () => P.content.value,
			setContent: (e) => P.setContent(e),
			setTheme: Y,
			setThemeOverrides: q,
			create: Z.createTemplate,
			load: Z.loadTemplate,
			save: Z.saveTemplate,
			sendTestEmail: z.sendTestEmail
		}), (e, a) => (r(), f("div", {
			class: t(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": y(P).state.darkMode }]),
			"data-tpl-theme": y(F).resolvedTheme.value,
			style: o(y(F).themeStyles.value)
		}, [
			p(C, {
				"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: u(() => [p(nt, { visible: y(T) || y(P).state.isLoading }, null, 8, ["visible"])]),
				_: 1
			}),
			p(C, {
				"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: u(() => [p(ct, {
					error: y(O),
					visible: !!y(O) && !y(T),
					onRetry: y(w).initialize
				}, null, 8, [
					"error",
					"visible",
					"onRetry"
				])]),
				_: 1
			}),
			p(Ze, {
				editor: y(P),
				core: y(F),
				"feature-flags": y(I),
				"panel-state": y(V),
				"snapshot-preview": y(H),
				"comments-instance": y(ee),
				"test-email": y(z),
				websocket: y(A),
				collaboration: y(M),
				"is-collaboration-enabled": y(N),
				"is-saving": y(P).state.isSaving || y(I).isSaveExporting.value,
				"is-save-disabled": y(P).state.isSaving || y(I).isSaveExporting.value || !y(P).state.isDirty,
				onSave: a[0] ||= (e) => y(Z).saveTemplate().catch((e) => h.config.onError?.(e))
			}, null, 8, [
				"editor",
				"core",
				"feature-flags",
				"panel-state",
				"snapshot-preview",
				"comments-instance",
				"test-email",
				"websocket",
				"collaboration",
				"is-collaboration-enabled",
				"is-saving",
				"is-save-disabled"
			]),
			p(ft, {
				visible: y(H).isPreviewingSnapshot.value,
				onCancel: y(H).cancelPreview,
				onConfirm: y(H).confirmRestoreSnapshot
			}, null, 8, [
				"visible",
				"onCancel",
				"onConfirm"
			]),
			p(C, {
				"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: u(() => [p(mt, { visible: y(U).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
				_: 1
			}),
			n(p(re, null, null, 512), [[m, !y(P).state.previewMode]]),
			x("div", {
				class: t(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto", [y(P).state.previewMode ? "tpl:left-0 tpl:right-0" : y(V).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", y(H).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", gt, [p(C, { name: "tpl-restore-btn" }, {
				default: u(() => [y(F).conditionPreview.hasHiddenBlocks.value ? (r(), f("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: a[1] ||= (e) => y(F).conditionPreview.reset()
				}, [p(y(ne), {
					size: 13,
					"stroke-width": 2
				}), D(" " + i(y(F).t.blockSettings.restoreHiddenBlocks), 1)])) : _("", !0)]),
				_: 1
			})]), x("main", _t, [p(ae, {
				viewport: y(P).state.viewport,
				content: y(P).content.value,
				"selected-block-id": y(P).state.selectedBlockId,
				"dark-mode": y(P).state.darkMode,
				"preview-mode": y(P).state.previewMode,
				"locked-blocks": y(M)?.lockedBlocks.value ?? void 0,
				onSelectBlock: y(P).selectBlock,
				onOpenAiChat: a[2] ||= (e) => y(V).aiChatOpen.value = !0,
				onOpenDesignReference: a[3] ||= (e) => y(V).designReferenceOpen.value = !0
			}, null, 8, [
				"viewport",
				"content",
				"selected-block-id",
				"dark-mode",
				"preview-mode",
				"locked-blocks",
				"onSelectBlock"
			])])], 2),
			s.config.branding !== !1 && !y(I).isWhiteLabeled.value ? (r(), v(oe, {
				key: 0,
				"position-class": [y(P).state.previewMode ? "tpl:left-0 tpl:right-0" : y(V).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]
			}, null, 8, ["position-class"])) : _("", !0),
			x("div", {
				class: "tpl-sr-only",
				role: "status",
				"aria-live": "polite",
				"aria-atomic": "true",
				"aria-label": y(F).t.landmarks.reorderAnnouncements
			}, i(y(F).keyboardReorder.announcement.value), 9, vt),
			n(p(J, {
				"selected-block": y(P).selectedBlock.value,
				settings: y(P).content.value.settings,
				"shifted-left": y(V).rightPanelOpen.value,
				onUpdateBlock: a[4] ||= (e) => y(P).updateBlock(y(P).selectedBlock.value.id, e),
				onDeleteBlock: a[5] ||= (e) => y(F).blockActions.deleteBlock(y(P).selectedBlock.value.id),
				onDuplicateBlock: a[6] ||= (e) => y(F).blockActions.duplicateBlock(y(P).selectedBlock.value),
				onUpdateSettings: y(P).updateSettings
			}, null, 8, [
				"selected-block",
				"settings",
				"shifted-left",
				"onUpdateSettings"
			]), [[m, !y(P).state.previewMode]]),
			!y(T) && y(E) ? (r(), v(Qe, {
				key: 1,
				ref_key: "cloudPanelsRef",
				ref: S,
				config: h.config,
				editor: y(P),
				core: y(F),
				"panel-state": y(V),
				"plan-config-instance": y(k),
				"test-email": y(z),
				"media-lib": y(L),
				"saved-modules-headless": y(te),
				"show-save-module-dialog": y(W),
				"save-module-pre-selected-block-id": y(K),
				"show-module-browser-modal": y(G),
				"onUpdate:showSaveModuleDialog": a[7] ||= (e) => W.value = e,
				"onUpdate:saveModulePreSelectedBlockId": a[8] ||= (e) => K.value = e,
				"onUpdate:showModuleBrowserModal": a[9] ||= (e) => G.value = e,
				onSendTestEmail: X,
				onModuleInsert: ie
			}, 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"
			])) : _("", !0)
		], 14, ht));
	}
}), [["__scopeId", "data-v-4a2ee70b"]]);
//#endregion
export { yt as default };
