@templatical/editor 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/AiChatSidebar-XBj5Rw2l.js +214 -0
  2. package/dist/AiFeatureMenu-my1mZ9DL.js +63 -0
  3. package/dist/CloudEditor-BVjgKwq3.js +940 -0
  4. package/dist/CollaboratorBar-BZq_Gv38.js +91 -0
  5. package/dist/CommentsSidebar-D9oxqO6l.js +439 -0
  6. package/dist/DesignReferenceSidebar-CyHq4SWt.js +272 -0
  7. package/dist/LoadingTrack-vK8W2PJf.js +10 -0
  8. package/dist/ModuleBrowserModal-Cus2Hdwl.js +205 -0
  9. package/dist/ModulePreviewCanvas-DaByXKY_.js +106 -0
  10. package/dist/ParagraphEditor-BSyk5B6S.js +670 -0
  11. package/dist/RichTextEditorContent-BRpjJ6SV.js +133 -0
  12. package/dist/SaveModuleDialog-BIZBQrd8.js +122 -0
  13. package/dist/SnapshotHistory-Ds1-QNbx.js +126 -0
  14. package/dist/TemplateScoringPanel-C8XSk_Ys.js +249 -0
  15. package/dist/TestEmailModal-CCVfaFgV.js +94 -0
  16. package/dist/TitleEditor-V4qaEULF.js +167 -0
  17. package/dist/TplModal-LT3FXlgs.js +44 -0
  18. package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
  19. package/dist/blockTypeIcons-BujoY5Dl.js +126 -0
  20. package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js +3 -0
  21. package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js.map +1 -0
  22. package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js +2 -0
  23. package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js.map +1 -0
  24. package/dist/cdn/chunks/TitleEditor-CC3Adjai.js +3 -0
  25. package/dist/cdn/chunks/TitleEditor-CC3Adjai.js.map +1 -0
  26. package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
  27. package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
  28. package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
  29. package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
  30. package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
  31. package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
  32. package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
  33. package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
  34. package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
  35. package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
  36. package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
  37. package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
  38. package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
  39. package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
  40. package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
  41. package/dist/cdn/chunks/extensions-BfjbWqOx.js +2 -0
  42. package/dist/cdn/chunks/extensions-BfjbWqOx.js.map +1 -0
  43. package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
  44. package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
  45. package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
  46. package/dist/cdn/chunks/styleConstants-UTJ94gco.js +2 -0
  47. package/dist/cdn/chunks/styleConstants-UTJ94gco.js.map +1 -0
  48. package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
  49. package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
  50. package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js +2 -0
  51. package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js.map +1 -0
  52. package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js +2 -0
  53. package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js.map +1 -0
  54. package/dist/cdn/editor.css +1 -0
  55. package/dist/cdn/editor.js +2 -0
  56. package/dist/cdn/editor.js.map +1 -0
  57. package/dist/check-B7kDuZmP.js +7 -0
  58. package/dist/chevron-down-DJLW2Q9Z.js +7 -0
  59. package/dist/circle-alert-E2vYPs5r.js +25 -0
  60. package/dist/clock-lWIIQA3C.js +12 -0
  61. package/dist/de-B4Ob4vCo.js +682 -0
  62. package/dist/dist-4LiM9FDd.js +35 -0
  63. package/dist/dist-Bu7veieH.js +776 -0
  64. package/dist/dist-C1BIRHCQ.js +61 -0
  65. package/dist/dist-CG-vEqSU.js +314 -0
  66. package/dist/dist-C_ymrGFi.js +10625 -0
  67. package/dist/dist-ChAGLpWo.js +35 -0
  68. package/dist/dist-DNjZKe2Z.js +513 -0
  69. package/dist/dist-D_HQYSY-.js +189 -0
  70. package/dist/dist-DkypH7qG.js +5 -0
  71. package/dist/dist-DmOE-Ubp.js +74 -0
  72. package/dist/dist-DrvKRSU6.js +47 -0
  73. package/dist/dist-Dxnd0GRf.js +5 -0
  74. package/dist/dist-DysAFIPy.js +2054 -0
  75. package/dist/emojiData-BfWQS72m.js +17 -0
  76. package/dist/en-YXsspZJG.js +682 -0
  77. package/dist/extensions-BA4NshZQ.js +420 -0
  78. package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
  79. package/dist/i18n-ikyi28RU.js +23 -0
  80. package/dist/image-up-X4xIq4ea.js +23 -0
  81. package/dist/keys-8B5MFafK.js +4 -0
  82. package/dist/liquid.browser-BemTg3sZ.js +3272 -0
  83. package/dist/loader-circle-BTQQxC3l.js +7 -0
  84. package/dist/message-circle-Blgm6V_h.js +7 -0
  85. package/dist/refresh-cw-Bb4PEeW1.js +44 -0
  86. package/dist/scan-line-7lZPfOdm.js +25 -0
  87. package/dist/send-C0ltAQrv.js +10 -0
  88. package/dist/shield-check-f-qv4RKs.js +10 -0
  89. package/dist/sparkles-KhBCGlqB.js +23 -0
  90. package/dist/styleConstants-CgtFM9hQ.js +43 -0
  91. package/dist/styles-hQgJKM4i.js +3406 -0
  92. package/dist/templatical-editor.css +2 -1
  93. package/dist/templatical-editor.js +242 -9
  94. package/dist/templatical-editor.umd.cjs +112 -524
  95. package/dist/timeouts-CmBrLeZA.js +4 -0
  96. package/dist/trash-2-OwjZ-guZ.js +25 -0
  97. package/dist/triangle-alert-DOSRIUYZ.js +17 -0
  98. package/dist/useEditorCore-DVp5qmtC.js +5552 -0
  99. package/dist/useI18n-DzH4KXDk.js +17 -0
  100. package/dist/useMergeTag-D9zQVE-e.js +33 -0
  101. package/dist/x-CGlq2XQe.js +10 -0
  102. package/package.json +30 -20
  103. package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
  104. package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
  105. package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
  106. package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
  107. package/dist/CommentsSidebar-PVUlloyB.js +0 -655
  108. package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
  109. package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
  110. package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
  111. package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
  112. package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
  113. package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
  114. package/dist/TestEmailModal-Cwre5elw.js +0 -128
  115. package/dist/TextEditor-BuUOIByX.js +0 -780
  116. package/dist/de-BWIAblxs.js +0 -685
  117. package/dist/en-cYyUzNV1.js +0 -685
  118. package/dist/index-0tWUczNu.js +0 -47
  119. package/dist/index-4okvXjqk.js +0 -41
  120. package/dist/index-BSc6h5zo.js +0 -967
  121. package/dist/index-CrvwWlhN.js +0 -41
  122. package/dist/index-D-iD-7lO.js +0 -10961
  123. package/dist/index-D-ygXbc8.js +0 -2452
  124. package/dist/index-DbrWKz-e.js +0 -1415
  125. package/dist/index-DeUeHy6g.js +0 -422
  126. package/dist/index-Ude6e9RU.js +0 -41
  127. package/dist/index-ZQzHBwkr.js +0 -12767
  128. package/dist/liquid.browser-CeNxS2GL.js +0 -3493
  129. package/dist/loader-circle-tM9j2mRh.js +0 -13
  130. package/dist/shield-check-Ngi9jAQc.js +0 -20
@@ -0,0 +1,940 @@
1
+ import { S as e, t } from "./useEditorCore-DVp5qmtC.js";
2
+ import { t as n } from "./timeouts-CmBrLeZA.js";
3
+ import { s as r, t as i } from "./dist-CG-vEqSU.js";
4
+ import { _ as a, b as o, c as s, r as c, s as l, t as u, y as d } from "./keys-8B5MFafK.js";
5
+ import { t as f } from "./useI18n-DzH4KXDk.js";
6
+ import { n as p, t as m } from "./_plugin-vue_export-helper-B1-bu7yR.js";
7
+ import { t as h } from "./check-B7kDuZmP.js";
8
+ import { t as ee } from "./circle-alert-E2vYPs5r.js";
9
+ import { a as te, i as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./styles-hQgJKM4i.js";
10
+ import { t as ce } from "./clock-lWIIQA3C.js";
11
+ import { t as le } from "./loader-circle-BTQQxC3l.js";
12
+ import { t as ue } from "./message-circle-Blgm6V_h.js";
13
+ import { t as de } from "./send-C0ltAQrv.js";
14
+ import { t as fe } from "./sparkles-KhBCGlqB.js";
15
+ import { s as pe } from "./styleConstants-CgtFM9hQ.js";
16
+ import { Fragment as me, Transition as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createStaticVNode as S, createTextVNode as C, createVNode as w, defineAsyncComponent as T, defineComponent as E, nextTick as he, normalizeClass as D, normalizeStyle as ge, onMounted as _e, onScopeDispose as ve, onUnmounted as ye, openBlock as O, provide as k, ref as A, renderList as be, shallowRef as xe, toDisplayString as j, unref as M, vShow as Se, watch as Ce, withCtx as N, withDirectives as we, withModifiers as Te } from "vue";
17
+ import { cloneBlock as Ee, isCustomBlock as De } from "@templatical/types";
18
+ import { AuthManager as Oe, performHealthCheck as ke, resolveWebSocketConfig as Ae, useAiConfig as je, useCollaboration as Me, useCollaborationBroadcast as Ne, useCommentListener as Pe, useComments as Fe, useEditor as Ie, useExport as Le, useMcpListener as Re, usePlanConfig as ze, useSavedModules as Be, useSnapshotHistory as Ve, useTemplateScoring as He, useTestEmail as Ue, useWebSocket as We } from "@templatical/core/cloud";
19
+ var Ge = p("save", [
20
+ ["path", {
21
+ 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",
22
+ key: "1c8476"
23
+ }],
24
+ ["path", {
25
+ d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",
26
+ key: "1ydtos"
27
+ }],
28
+ ["path", {
29
+ d: "M7 3v4a1 1 0 0 0 1 1h7",
30
+ key: "t51u73"
31
+ }]
32
+ ]);
33
+ //#endregion
34
+ //#region src/cloud/composables/useSnapshotPreview.ts
35
+ function Ke(e) {
36
+ let { authManager: t, editor: n, history: r, conditionPreview: i, autoSave: a, onError: o } = e, s = xe(null), c = A(null), l = A(null), u = _(() => c.value !== null), d = _(() => s.value?.snapshots.value ?? []), f = _(() => s.value?.isLoading.value ?? !1), p = _(() => s.value?.isRestoring.value ?? !1);
37
+ function m() {
38
+ n.state.template?.id && !s.value && (s.value = Ve({
39
+ authManager: t,
40
+ templateId: n.state.template.id,
41
+ onRestore: h,
42
+ onError: o
43
+ }), s.value.loadSnapshots());
44
+ }
45
+ function h(e) {
46
+ n.setContent(e.content, !1), r.clear(), i.reset();
47
+ }
48
+ async function ee(e) {
49
+ if (c.value) {
50
+ c.value = e, n.setContent(e.content, !1);
51
+ return;
52
+ }
53
+ n.state.isDirty && n.hasTemplate() && await n.createSnapshot(), l.value = structuredClone(n.content.value), a?.pause(), c.value = e, n.setContent(e.content, !1);
54
+ }
55
+ async function te() {
56
+ if (!(!c.value || !s.value)) try {
57
+ await s.value.restoreSnapshot(c.value.id), await s.value.loadSnapshots();
58
+ } finally {
59
+ c.value = null, l.value = null, a?.resume();
60
+ }
61
+ }
62
+ function ne() {
63
+ !c.value || !l.value || (n.setContent(l.value, !1), c.value = null, l.value = null, a?.resume());
64
+ }
65
+ async function re() {
66
+ s.value && await s.value.loadSnapshots();
67
+ }
68
+ return {
69
+ snapshotHistoryInstance: s,
70
+ previewingSnapshot: c,
71
+ contentBeforePreview: l,
72
+ isPreviewingSnapshot: u,
73
+ snapshotHistorySnapshots: d,
74
+ snapshotHistoryIsLoading: f,
75
+ snapshotHistoryIsRestoring: p,
76
+ initSnapshotHistory: m,
77
+ handleRestore: h,
78
+ handleSnapshotNavigate: ee,
79
+ confirmRestoreSnapshot: te,
80
+ cancelPreview: ne,
81
+ loadSnapshotHistory: re
82
+ };
83
+ }
84
+ //#endregion
85
+ //#region src/cloud/composables/useCloudPanelState.ts
86
+ function qe() {
87
+ let e = A(null), t = _({
88
+ get: () => e.value === "ai-chat",
89
+ set: (t) => e.value = t ? "ai-chat" : null
90
+ }), n = _({
91
+ get: () => e.value === "scoring",
92
+ set: (t) => e.value = t ? "scoring" : null
93
+ }), r = _({
94
+ get: () => e.value === "design-reference",
95
+ set: (t) => e.value = t ? "design-reference" : null
96
+ }), a = _({
97
+ get: () => e.value === "comments",
98
+ set: (t) => e.value = t ? "comments" : null
99
+ }), o = A(!1), s = A(!1), c = A(void 0), l = A(!1), u = A(null), d = _(() => e.value !== null), f = _(() => {
100
+ let t = e.value;
101
+ return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
102
+ }), p = _(() => l.value || e.value === "ai-chat" || e.value === "design-reference" || e.value === "scoring");
103
+ function m() {
104
+ l.value = !l.value;
105
+ }
106
+ function h(t) {
107
+ l.value = !1, e.value = e.value === t ? null : t;
108
+ }
109
+ return i(u, () => {
110
+ l.value = !1;
111
+ }), {
112
+ activePanel: e,
113
+ aiChatOpen: t,
114
+ scoringPanelOpen: n,
115
+ designReferenceOpen: r,
116
+ commentsOpen: a,
117
+ testEmailModalOpen: o,
118
+ mediaLibraryOpen: s,
119
+ mediaLibraryAccept: c,
120
+ aiMenuOpen: l,
121
+ aiMenuRef: u,
122
+ rightPanelOpen: d,
123
+ activeAiFeature: f,
124
+ aiButtonActive: p,
125
+ toggleAiMenu: m,
126
+ handleAiFeatureSelect: h
127
+ };
128
+ }
129
+ //#endregion
130
+ //#region src/cloud/composables/useCollabUndoWarning.ts
131
+ function Je(e) {
132
+ let { isCollaborationEnabled: t, getCollaboratorCount: i, canUndo: a } = e, o = A(!1), s = A(!1), { start: c } = r(() => {
133
+ s.value = !1;
134
+ }, n, { immediate: !1 });
135
+ function l() {
136
+ o.value || !t.value || i() === 0 || !a.value || (o.value = !0, s.value = !0, c());
137
+ }
138
+ return {
139
+ collabUndoWarningVisible: s,
140
+ showCollabUndoWarning: l
141
+ };
142
+ }
143
+ //#endregion
144
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
145
+ function Ye(e) {
146
+ let { planConfigInstance: t, aiConfig: n, editor: i } = e, a = _(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), o = _(() => t.hasFeature("test_email")), s = _(() => !!i.state.template?.id), c = _(() => t.hasFeature("white_label")), l = _(() => t.config.value?.limits.max_templates ?? null), u = _(() => t.config.value?.template_count ?? 0), d = A(!1), f = A("idle"), p = A(""), { start: m } = r(() => {
147
+ f.value = "idle";
148
+ }, 3e3, { immediate: !1 });
149
+ return {
150
+ canUseAiGeneration: a,
151
+ canSendTestEmail: o,
152
+ hasTemplateSaved: s,
153
+ isWhiteLabeled: c,
154
+ templateLimit: l,
155
+ templateCount: u,
156
+ isSaveExporting: d,
157
+ saveStatus: f,
158
+ saveErrorMessage: p,
159
+ startSaveStatusClear: m
160
+ };
161
+ }
162
+ //#endregion
163
+ //#region src/cloud/composables/useCloudMediaLibrary.ts
164
+ function Xe(e) {
165
+ let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: r } = e, i = null;
166
+ async function a() {
167
+ if (t) {
168
+ let e = await t({ accept: ["images"] });
169
+ return e ? {
170
+ url: e.url,
171
+ alt: e.alt_text || void 0
172
+ } : null;
173
+ }
174
+ return r.value = ["images"], n.value = !0, new Promise((e) => {
175
+ i = (t) => {
176
+ e(t);
177
+ };
178
+ });
179
+ }
180
+ function o(e) {
181
+ n.value = !1, i?.({
182
+ url: e.url,
183
+ alt: e.alt_text || void 0
184
+ }), i = null;
185
+ }
186
+ function s() {
187
+ n.value = !1, i?.(null), i = null;
188
+ }
189
+ return ve(() => {
190
+ i &&= (i(null), null);
191
+ }), {
192
+ handleRequestMedia: a,
193
+ handleMediaSelect: o,
194
+ handleMediaLibraryClose: s
195
+ };
196
+ }
197
+ //#endregion
198
+ //#region src/cloud/composables/useSavedModules.ts
199
+ function Ze(e) {
200
+ let t = A(!1), n = A(null), r = A(!1);
201
+ function i(e) {
202
+ n.value = e ?? null, t.value = !0;
203
+ }
204
+ function a() {
205
+ t.value = !1, n.value = null;
206
+ }
207
+ function o() {
208
+ r.value = !0;
209
+ }
210
+ function s() {
211
+ r.value = !1;
212
+ }
213
+ return {
214
+ headless: e,
215
+ showSaveDialog: t,
216
+ preSelectedBlockId: n,
217
+ openSaveDialog: i,
218
+ closeSaveDialog: a,
219
+ showBrowserModal: r,
220
+ openBrowserModal: o,
221
+ closeBrowserModal: s
222
+ };
223
+ }
224
+ //#endregion
225
+ //#region src/cloud/components/CloudLoadingOverlay.vue?vue&type=script&setup=true&lang.ts
226
+ var Qe = {
227
+ key: 0,
228
+ class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
229
+ }, P = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, $e = { 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)]" }, et = /* @__PURE__ */ E({
230
+ __name: "CloudLoadingOverlay",
231
+ props: { visible: { type: Boolean } },
232
+ setup(e) {
233
+ return (t, n) => e.visible ? (O(), b("div", Qe, [n[1] ||= S("<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", P, [x("div", $e, [(O(), b(me, null, be(5, (e) => x("div", {
234
+ key: e,
235
+ class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
236
+ })), 64))]), n[0] ||= S("<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)])])) : y("", !0);
237
+ }
238
+ }), F = {
239
+ key: 0,
240
+ role: "alert",
241
+ 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)]"
242
+ }, I = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, L = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, R = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, z = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, tt = /* @__PURE__ */ E({
243
+ __name: "CloudErrorOverlay",
244
+ props: {
245
+ error: {},
246
+ visible: { type: Boolean }
247
+ },
248
+ emits: ["retry"],
249
+ setup(e, { emit: t }) {
250
+ let n = t, { t: r } = f();
251
+ function i(e) {
252
+ return "isUnauthorized" in e && e.isUnauthorized ? r.error.authFailed : "isNotFound" in e && e.isNotFound ? r.error.templateNotFound : r.error.defaultMessage;
253
+ }
254
+ function a(e) {
255
+ return "isNotFound" in e && !!e.isNotFound;
256
+ }
257
+ return (t, o) => e.visible && e.error ? (O(), b("div", F, [
258
+ x("div", I, [w(M(ee), {
259
+ size: 32,
260
+ "stroke-width": 1.5,
261
+ class: "tpl:text-[var(--tpl-danger)]"
262
+ })]),
263
+ x("div", L, [x("h2", R, j(M(r).error.title), 1), x("p", z, j(i(e.error)), 1)]),
264
+ a(e.error) ? y("", !0) : (O(), b("button", {
265
+ key: 0,
266
+ 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)]",
267
+ onClick: o[0] ||= (e) => n("retry")
268
+ }, j(M(r).error.retry), 1))
269
+ ])) : y("", !0);
270
+ }
271
+ }), B = {
272
+ key: 0,
273
+ 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)]"
274
+ }, V = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, H = { class: "tpl:flex tpl:items-center tpl:gap-2" }, nt = /* @__PURE__ */ E({
275
+ __name: "SnapshotPreviewBanner",
276
+ props: { visible: { type: Boolean } },
277
+ emits: ["cancel", "confirm"],
278
+ setup(e, { emit: t }) {
279
+ let n = t, { t: r } = f();
280
+ return (t, i) => e.visible ? (O(), b("div", B, [x("div", V, [w(M(ce), {
281
+ size: 18,
282
+ "stroke-width": 2,
283
+ class: "tpl:text-[var(--tpl-primary)]"
284
+ }), x("span", null, j(M(r).snapshotPreview.message), 1)]), x("div", H, [x("button", {
285
+ 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)]",
286
+ style: { "background-color": "transparent" },
287
+ onClick: i[0] ||= (e) => n("cancel")
288
+ }, j(M(r).snapshotPreview.cancel), 1), x("button", {
289
+ 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)]",
290
+ onClick: i[1] ||= (e) => n("confirm")
291
+ }, j(M(r).snapshotPreview.restore), 1)])])) : y("", !0);
292
+ }
293
+ }), U = {
294
+ key: 0,
295
+ role: "status",
296
+ "aria-live": "polite",
297
+ 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",
298
+ style: {
299
+ "background-color": "var(--tpl-warning-light)",
300
+ color: "var(--tpl-text)",
301
+ border: "1px solid var(--tpl-warning)"
302
+ }
303
+ }, rt = /* @__PURE__ */ E({
304
+ __name: "CollabUndoToast",
305
+ props: { visible: { type: Boolean } },
306
+ setup(e) {
307
+ let { t } = f();
308
+ return (n, r) => e.visible ? (O(), b("div", U, j(M(t).history.collabWarning), 1)) : y("", !0);
309
+ }
310
+ }), it = ["data-tpl-theme"], at = {
311
+ 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",
312
+ style: {
313
+ "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)",
314
+ "backdrop-filter": "blur(12px)",
315
+ "-webkit-backdrop-filter": "blur(12px)",
316
+ "box-shadow": "var(--tpl-shadow-md)",
317
+ "border-bottom": "1px solid var(--tpl-border)"
318
+ }
319
+ }, ot = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, st = {
320
+ key: 0,
321
+ class: "tpl-logo tpl:flex tpl:items-center tpl:gap-2.5 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
322
+ }, ct = ["src"], lt = { style: { "letter-spacing": "-0.01em" } }, ut = {
323
+ key: 1,
324
+ class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
325
+ }, dt = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, ft = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, pt = ["data-tooltip"], mt = {
326
+ key: 1,
327
+ "aria-live": "polite",
328
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]"
329
+ }, ht = {
330
+ key: 2,
331
+ "aria-live": "polite",
332
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
333
+ }, gt = ["aria-label", "aria-expanded"], _t = {
334
+ key: 0,
335
+ 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)]"
336
+ }, vt = ["aria-expanded"], yt = {
337
+ key: 0,
338
+ class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
339
+ }, bt = ["disabled"], xt = ["disabled"], St = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, Ct = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, wt = {
340
+ class: "tpl:pointer-events-auto tpl:flex tpl:items-center tpl:gap-1.5 tpl:rounded-tl-lg tpl:p-1",
341
+ style: {
342
+ "background-color": "color-mix(\n in srgb,\n var(--tpl-canvas-bg) 85%,\n transparent\n )",
343
+ "backdrop-filter": "blur(8px)",
344
+ "-webkit-backdrop-filter": "blur(8px)"
345
+ }
346
+ }, Tt = {
347
+ href: "https://github.com/templatical/sdk",
348
+ target: "_blank",
349
+ rel: "noopener noreferrer",
350
+ class: "tpl:transition-colors tpl:duration-150 hover:tpl:opacity-80 tpl:text-[var(--tpl-text-dim)]",
351
+ style: { "text-decoration": "none" }
352
+ }, W = /* @__PURE__ */ m(/* @__PURE__ */ E({
353
+ __name: "CloudEditor",
354
+ props: {
355
+ config: {},
356
+ translations: {},
357
+ fontsManager: {}
358
+ },
359
+ emits: ["ready"],
360
+ setup(n, { expose: r, emit: i }) {
361
+ let f = T(() => import("./AiChatSidebar-XBj5Rw2l.js")), p = T(() => import("./CommentsSidebar-D9oxqO6l.js")), m = T(() => import("./DesignReferenceSidebar-CyHq4SWt.js")), ce = T(() => import("./TemplateScoringPanel-C8XSk_Ys.js")), S = T(() => import("./TestEmailModal-CCVfaFgV.js")), E = T(() => import("./SaveModuleDialog-BIZBQrd8.js")), ve = T(() => import("./ModuleBrowserModal-Cus2Hdwl.js")), be = T(() => import("./SnapshotHistory-Ds1-QNbx.js")), xe = T(() => import("./CollaboratorBar-BZq_Gv38.js")), Ve = T(() => import("./AiFeatureMenu-my1mZ9DL.js")), Qe = T(async () => (await import("@templatical/media-library")).MediaLibraryModal), P = n, $e = i, F = A(!0), I = A(!1), L = A(null), R = !1, z = new Oe({
362
+ ...P.config.auth,
363
+ onError: P.config.onError
364
+ }), B = ze({
365
+ authManager: z,
366
+ onError: P.config.onError
367
+ }), V = A(/* @__PURE__ */ new Map()), H = Ie({
368
+ authManager: z,
369
+ defaultFontFamily: P.config.fonts?.defaultFont,
370
+ templateDefaults: P.config.templateDefaults,
371
+ onError: P.config.onError,
372
+ lockedBlocks: V
373
+ }), U = We({
374
+ authManager: z,
375
+ onError: P.config.onError
376
+ });
377
+ P.config.mcp?.enabled && Re({
378
+ editor: H,
379
+ channel: U.channel,
380
+ onOperation: P.config.mcp.onOperation
381
+ });
382
+ let W = null;
383
+ P.config.collaboration?.enabled && (W = Me({
384
+ authManager: z,
385
+ editor: H,
386
+ channel: U.channel,
387
+ onError: P.config.onError,
388
+ onCollaboratorJoined: P.config.collaboration.onCollaboratorJoined,
389
+ onCollaboratorLeft: P.config.collaboration.onCollaboratorLeft,
390
+ onBlockLocked: P.config.collaboration.onBlockLocked,
391
+ onBlockUnlocked: P.config.collaboration.onBlockUnlocked
392
+ }), Ce(() => W.lockedBlocks.value, (e) => {
393
+ V.value = e;
394
+ }, { immediate: !0 }), Ne(H, W));
395
+ let Et = _(() => !!P.config.collaboration?.enabled && B.hasFeature("collaboration")), Dt = null, Ot = null, G = t({
396
+ editor: H,
397
+ config: {
398
+ uiTheme: P.config.uiTheme,
399
+ theme: void 0,
400
+ blockDefaults: P.config.blockDefaults,
401
+ customBlocks: [],
402
+ mergeTags: P.config.mergeTags,
403
+ displayConditions: P.config.displayConditions,
404
+ onRequestMedia: null,
405
+ onSave: () => {
406
+ Wt().catch((e) => {
407
+ P.config.onError?.(e);
408
+ });
409
+ }
410
+ },
411
+ translations: P.translations,
412
+ fontsManager: P.fontsManager,
413
+ historyOptions: W ? { isRemoteOperation: () => W._isProcessingRemoteOperation() } : void 0,
414
+ autoSaveOptions: {
415
+ onChange: async () => {
416
+ H.hasTemplate() && (await H.createSnapshot(), Dt?.snapshotHistoryInstance.value?.loadSnapshots());
417
+ },
418
+ debounce: P.config.autoSaveDebounce ?? 5e3,
419
+ enabled: () => P.config.autoSave !== !1 && B.hasFeature("auto_save")
420
+ },
421
+ themeExtraStyles: () => ({ "--tpl-drop-text": `"${P.translations.canvas.dropHere}"` }),
422
+ keyboardOptions: { onBeforeUndo: () => Ot?.showCollabUndoWarning() }
423
+ }), kt = Je({
424
+ isCollaborationEnabled: Et,
425
+ getCollaboratorCount: () => W?.collaborators.value.length ?? 0,
426
+ canUndo: G.history.canUndo
427
+ });
428
+ Ot = kt;
429
+ let K = Ke({
430
+ authManager: z,
431
+ editor: H,
432
+ history: G.history,
433
+ conditionPreview: G.conditionPreview,
434
+ autoSave: G.autoSave,
435
+ onError: P.config.onError
436
+ });
437
+ Dt = K;
438
+ let q = qe(), At = je(P.config.ai), J = Ye({
439
+ planConfigInstance: B,
440
+ aiConfig: At,
441
+ editor: H
442
+ }), Y = Xe({
443
+ onRequestMedia: P.config.onRequestMedia,
444
+ mediaLibraryOpen: q.mediaLibraryOpen,
445
+ mediaLibraryAccept: q.mediaLibraryAccept
446
+ });
447
+ e({
448
+ onBlockMove: H.moveBlock,
449
+ onBlockAdd: H.addBlock
450
+ });
451
+ let jt = Le({
452
+ authManager: z,
453
+ getFontsConfig: () => P.config.fonts,
454
+ canUseCustomFonts: () => B.hasFeature("custom_fonts")
455
+ }), X = Ue({
456
+ authManager: z,
457
+ getTemplateId: () => H.state.template?.id ?? null,
458
+ save: () => H.save(),
459
+ exportHtml: (e) => jt.exportHtml(e),
460
+ onError: P.config.onError,
461
+ isAuthReady: I,
462
+ onBeforeTestEmail: P.config.onBeforeTestEmail
463
+ }), Z = Fe({
464
+ authManager: z,
465
+ getTemplateId: () => H.state.template?.id ?? null,
466
+ getSocketId: () => U.getSocketId(),
467
+ onComment: P.config.onComment,
468
+ onError: P.config.onError,
469
+ isAuthReady: I,
470
+ hasCommentingFeature: () => P.config.commenting !== !1 && B.hasFeature("commenting")
471
+ });
472
+ Pe({
473
+ comments: Z,
474
+ channel: U.channel
475
+ });
476
+ let Q = Be({
477
+ authManager: z,
478
+ onError: P.config.onError
479
+ }), $ = Ze(Q), Mt = He({
480
+ authManager: z,
481
+ getTemplateId: () => H.state.template?.id ?? null
482
+ });
483
+ k(a, Y.handleRequestMedia), k(c, z), k(u, At), k(s, Z), k(d, Q), k(o, Mt), k(l, {
484
+ plan: B,
485
+ ai: At,
486
+ comments: {
487
+ getBlockCount: (e) => Z.commentCountByBlock.value.get(e) ?? 0,
488
+ openForBlock: It
489
+ },
490
+ savedModules: {
491
+ openSaveDialog: (e) => $.openSaveDialog(e),
492
+ openBrowser: () => $.openBrowserModal(),
493
+ moduleCount: _(() => Q.modules.value.length)
494
+ }
495
+ });
496
+ function Nt(e) {
497
+ B.hasFeature("theme_customization") && (G.themeOverrides.value = e);
498
+ }
499
+ function Pt(e) {
500
+ H.setUiTheme(e);
501
+ }
502
+ let Ft = A(null);
503
+ function It(e) {
504
+ q.commentsOpen.value = !0, he(() => {
505
+ Ft.value?.filterByBlock(e);
506
+ });
507
+ }
508
+ async function Lt(e) {
509
+ try {
510
+ await X.sendTestEmail(e), q.testEmailModalOpen.value = !1;
511
+ } catch {}
512
+ }
513
+ function Rt(e, t) {
514
+ for (let n = 0; n < e.content.length; n++) {
515
+ let r = Ee(e.content[n]), i = t === void 0 ? void 0 : t + n;
516
+ H.addBlock(r, void 0, void 0, i);
517
+ }
518
+ $.closeBrowserModal();
519
+ }
520
+ async function zt(e) {
521
+ let t = async (e) => {
522
+ if (De(e)) {
523
+ let t = e;
524
+ try {
525
+ t.renderedHtml = await G.registry.renderCustomBlock(t);
526
+ } catch {
527
+ t.renderedHtml = `<!-- Custom block render error: ${t.customType} -->`;
528
+ }
529
+ }
530
+ if (e.type === "section" && "children" in e) {
531
+ let n = e;
532
+ for (let e of n.children) for (let n of e) await t(n);
533
+ }
534
+ };
535
+ for (let n of e.blocks) await t(n);
536
+ }
537
+ async function Bt() {
538
+ F.value = !0, L.value = null;
539
+ try {
540
+ if (await z.initialize(), R) return;
541
+ I.value = !0;
542
+ let e = await ke({ authManager: z });
543
+ if (R) return;
544
+ if (!e.api.ok) throw Error("Health check failed: API is not reachable");
545
+ if (!e.auth.ok) throw Error(`Health check failed: authentication error${e.auth.error ? ` - ${e.auth.error}` : ""}`);
546
+ if (e.websocket.ok || console.warn("[Templatical] WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await B.fetchConfig(), R) return;
547
+ P.fontsManager.setCustomFontsEnabled(B.hasFeature("custom_fonts")), P.config.customBlocks?.length && B.hasFeature("custom_blocks") && G.registerCustomBlocks(P.config.customBlocks), P.config.theme && B.hasFeature("theme_customization") && (G.themeOverrides.value = P.config.theme), P.config.modules !== !1 && B.hasFeature("saved_modules") && Q.loadModules(), $e("ready");
548
+ } catch (e) {
549
+ if (R) return;
550
+ let t = e instanceof Error ? e : Error("Initialization failed", { cause: e });
551
+ L.value = t, P.config.onError?.(t);
552
+ } finally {
553
+ R || (F.value = !1);
554
+ }
555
+ }
556
+ function Vt() {
557
+ return Ae(B.config.value.websocket);
558
+ }
559
+ async function Ht(e) {
560
+ let t = await H.create(e);
561
+ return R ? t : (P.config.onCreate?.(t), K.initSnapshotHistory(), U.connect(t.id, Vt()), t);
562
+ }
563
+ async function Ut(e) {
564
+ let t = await H.load(e);
565
+ return R ? t : (P.config.onLoad?.(t), K.initSnapshotHistory(), U.connect(t.id, Vt()), t);
566
+ }
567
+ async function Wt() {
568
+ J.isSaveExporting.value = !0, J.saveStatus.value = "idle";
569
+ try {
570
+ if (await zt(H.content.value), R) throw Error("Component unmounted during save");
571
+ let e = await H.save();
572
+ if (R) throw Error("Component unmounted during save");
573
+ K.initSnapshotHistory(), K.snapshotHistoryInstance.value && K.snapshotHistoryInstance.value.loadSnapshots();
574
+ let t = await jt.exportHtml(e.id);
575
+ if (R) throw Error("Component unmounted during save");
576
+ let n = {
577
+ templateId: e.id,
578
+ html: t.html,
579
+ mjml: t.mjml,
580
+ content: e.content
581
+ };
582
+ return P.config.onSave?.(n), J.saveStatus.value = "saved", J.startSaveStatusClear(), n;
583
+ } catch (e) {
584
+ throw R || (J.saveStatus.value = "error", J.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
585
+ } finally {
586
+ R || (J.isSaveExporting.value = !1);
587
+ }
588
+ }
589
+ return _e(() => {
590
+ Bt();
591
+ }), ye(() => {
592
+ R = !0, P.fontsManager.cleanupFontLinks(), U.disconnect(), G.destroy(), P.config.onUnmount?.();
593
+ }), r({
594
+ getContent: () => H.content.value,
595
+ setContent: (e) => H.setContent(e),
596
+ setTheme: Pt,
597
+ setThemeOverrides: Nt,
598
+ create: Ht,
599
+ load: Ut,
600
+ save: Wt,
601
+ sendTestEmail: X.sendTestEmail
602
+ }), (e, t) => (O(), b("div", {
603
+ class: D(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": M(H).state.darkMode }]),
604
+ "data-tpl-theme": M(G).resolvedTheme.value,
605
+ style: ge(M(G).themeStyles.value)
606
+ }, [
607
+ w(g, {
608
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
609
+ "enter-from-class": "tpl:opacity-100",
610
+ "enter-to-class": "tpl:opacity-100",
611
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
612
+ "leave-from-class": "tpl:opacity-100",
613
+ "leave-to-class": "tpl:opacity-0"
614
+ }, {
615
+ default: N(() => [w(et, { visible: F.value || M(H).state.isLoading }, null, 8, ["visible"])]),
616
+ _: 1
617
+ }),
618
+ w(g, {
619
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
620
+ "enter-from-class": "tpl:opacity-0",
621
+ "enter-to-class": "tpl:opacity-100",
622
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
623
+ "leave-from-class": "tpl:opacity-100",
624
+ "leave-to-class": "tpl:opacity-0"
625
+ }, {
626
+ default: N(() => [w(tt, {
627
+ error: L.value,
628
+ visible: !!L.value && !F.value,
629
+ onRetry: Bt
630
+ }, null, 8, ["error", "visible"])]),
631
+ _: 1
632
+ }),
633
+ x("header", at, [
634
+ x("div", ot, [M(J).isWhiteLabeled.value ? y("", !0) : (O(), b("div", st, [x("img", {
635
+ src: M(z).resolveUrl("/logo.svg"),
636
+ alt: "Templatical",
637
+ width: "24",
638
+ height: "24",
639
+ class: "tpl:shrink-0"
640
+ }, null, 8, ct), x("span", lt, j(M(G).t.header.title), 1)])), M(J).templateLimit.value === null ? y("", !0) : (O(), b("span", ut, j(M(G).format(M(G).t.header.templatesUsed, {
641
+ used: M(J).templateCount.value,
642
+ max: M(J).templateLimit.value
643
+ })), 1))]),
644
+ x("div", dt, [
645
+ w(ae, {
646
+ viewport: M(H).state.viewport,
647
+ onChange: M(H).setViewport
648
+ }, null, 8, ["viewport", "onChange"]),
649
+ w(se, {
650
+ "dark-mode": M(H).state.darkMode,
651
+ onChange: M(H).setDarkMode
652
+ }, null, 8, ["dark-mode", "onChange"]),
653
+ w(re, {
654
+ "preview-mode": M(H).state.previewMode,
655
+ onChange: M(H).setPreviewMode
656
+ }, null, 8, ["preview-mode", "onChange"]),
657
+ M(W) && Et.value ? (O(), v(M(xe), {
658
+ key: 0,
659
+ collaborators: M(W).collaborators.value,
660
+ "is-connected": M(U).isConnected.value
661
+ }, null, 8, ["collaborators", "is-connected"])) : y("", !0),
662
+ M(K).snapshotHistoryInstance.value ? (O(), v(M(be), {
663
+ key: 1,
664
+ snapshots: M(K).snapshotHistorySnapshots.value,
665
+ "is-loading": M(K).snapshotHistoryIsLoading.value,
666
+ "is-restoring": M(K).snapshotHistoryIsRestoring.value,
667
+ onLoad: M(K).loadSnapshotHistory,
668
+ onNavigate: M(K).handleSnapshotNavigate
669
+ }, null, 8, [
670
+ "snapshots",
671
+ "is-loading",
672
+ "is-restoring",
673
+ "onLoad",
674
+ "onNavigate"
675
+ ])) : y("", !0)
676
+ ]),
677
+ x("div", ft, [
678
+ M(J).saveStatus.value === "error" ? (O(), b("div", {
679
+ key: 0,
680
+ "aria-live": "assertive",
681
+ class: "tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]",
682
+ "data-tooltip": M(J).saveErrorMessage.value
683
+ }, [w(M(ee), {
684
+ size: 12,
685
+ "stroke-width": 2.5
686
+ }), C(" " + j(M(G).t.header.saveFailed), 1)], 8, pt)) : M(J).saveStatus.value === "saved" ? (O(), b("div", mt, [w(M(h), {
687
+ size: 12,
688
+ "stroke-width": 2.5
689
+ }), C(" " + j(M(G).t.header.saved), 1)])) : M(H).state.isDirty ? (O(), b("div", ht, [t[19] ||= x("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), C(" " + j(M(G).t.header.unsaved), 1)])) : y("", !0),
690
+ M(Z).isEnabled.value && M(J).hasTemplateSaved.value ? (O(), b("button", {
691
+ key: 3,
692
+ "aria-label": M(Z).unresolvedCount.value > 0 ? `${M(G).t.comments.button} (${M(Z).unresolvedCount.value})` : M(G).t.comments.button,
693
+ "aria-expanded": M(q).commentsOpen.value,
694
+ class: D(M(pe)),
695
+ style: ge({
696
+ backgroundColor: M(q).commentsOpen.value ? "var(--tpl-primary)" : "transparent",
697
+ color: M(q).commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
698
+ borderColor: "var(--tpl-primary)"
699
+ }),
700
+ onClick: t[0] ||= (e) => M(q).commentsOpen.value = !M(q).commentsOpen.value
701
+ }, [
702
+ w(M(ue), {
703
+ size: 16,
704
+ "stroke-width": 2
705
+ }),
706
+ C(" " + j(M(G).t.comments.button) + " ", 1),
707
+ M(Z).unresolvedCount.value > 0 && !M(q).commentsOpen.value ? (O(), b("span", _t, j(M(Z).unresolvedCount.value), 1)) : y("", !0)
708
+ ], 14, gt)) : y("", !0),
709
+ M(J).canUseAiGeneration.value && M(J).hasTemplateSaved.value ? (O(), b("div", {
710
+ key: 4,
711
+ ref: (e) => M(q).aiMenuRef.value = e,
712
+ class: "tpl:relative"
713
+ }, [x("button", {
714
+ "aria-expanded": M(q).aiMenuOpen.value,
715
+ class: D(["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", M(q).aiButtonActive.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
716
+ onClick: t[1] ||= Te((...e) => M(q).toggleAiMenu && M(q).toggleAiMenu(...e), ["stop"])
717
+ }, [w(M(fe), {
718
+ size: 16,
719
+ "stroke-width": 2,
720
+ class: "tpl-ai-btn-icon"
721
+ }), C(" " + j(M(G).t.aiChat.button), 1)], 10, vt), w(g, {
722
+ "enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
723
+ "enter-from-class": "tpl:scale-95 tpl:opacity-0",
724
+ "enter-to-class": "tpl:scale-100 tpl:opacity-100",
725
+ "leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
726
+ "leave-from-class": "tpl:scale-100 tpl:opacity-100",
727
+ "leave-to-class": "tpl:scale-95 tpl:opacity-0"
728
+ }, {
729
+ default: N(() => [M(q).aiMenuOpen.value ? (O(), b("div", yt, [w(M(Ve), {
730
+ "active-feature": M(q).activeAiFeature.value,
731
+ onSelect: M(q).handleAiFeatureSelect
732
+ }, null, 8, ["active-feature", "onSelect"])])) : y("", !0)]),
733
+ _: 1
734
+ })], 512)) : y("", !0),
735
+ M(X).isEnabled.value && M(J).canSendTestEmail.value ? (O(), b("button", {
736
+ key: 5,
737
+ class: D(M(pe)),
738
+ style: {
739
+ "background-color": "transparent",
740
+ color: "var(--tpl-primary)",
741
+ "border-color": "var(--tpl-primary)"
742
+ },
743
+ disabled: M(X).isSending.value || !M(J).hasTemplateSaved.value,
744
+ onClick: t[2] ||= (e) => M(q).testEmailModalOpen.value = !0
745
+ }, [M(X).isSending.value ? (O(), v(M(le), {
746
+ key: 1,
747
+ class: "tpl-spinner",
748
+ size: 16,
749
+ "stroke-width": 2
750
+ })) : (O(), v(M(de), {
751
+ key: 0,
752
+ size: 16,
753
+ "stroke-width": 2
754
+ })), C(" " + j(M(G).t.testEmail.button), 1)], 10, bt)) : y("", !0),
755
+ x("button", {
756
+ class: D(M(pe)),
757
+ style: {
758
+ "background-color": "transparent",
759
+ color: "var(--tpl-primary)",
760
+ "border-color": "var(--tpl-primary)"
761
+ },
762
+ disabled: M(H).state.isSaving || M(J).isSaveExporting.value || !M(H).state.isDirty,
763
+ onClick: t[3] ||= (e) => Wt().catch((e) => P.config.onError?.(e))
764
+ }, [!M(H).state.isSaving && !M(J).isSaveExporting.value ? (O(), v(M(Ge), {
765
+ key: 0,
766
+ size: 16,
767
+ "stroke-width": 2
768
+ })) : (O(), v(M(le), {
769
+ key: 1,
770
+ class: "tpl-spinner",
771
+ size: 16,
772
+ "stroke-width": 2
773
+ })), C(" " + j(M(H).state.isSaving || M(J).isSaveExporting.value ? M(G).t.header.saving : M(G).t.header.save), 1)], 10, xt)
774
+ ])
775
+ ]),
776
+ w(nt, {
777
+ visible: M(K).isPreviewingSnapshot.value,
778
+ onCancel: M(K).cancelPreview,
779
+ onConfirm: M(K).confirmRestoreSnapshot
780
+ }, null, 8, [
781
+ "visible",
782
+ "onCancel",
783
+ "onConfirm"
784
+ ]),
785
+ w(g, {
786
+ "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
787
+ "enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
788
+ "enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
789
+ "leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
790
+ "leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
791
+ "leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
792
+ }, {
793
+ default: N(() => [w(rt, { visible: M(kt).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
794
+ _: 1
795
+ }),
796
+ we(w(te, null, null, 512), [[Se, !M(H).state.previewMode]]),
797
+ x("div", {
798
+ class: D(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto tpl:transition-all tpl:duration-300", [M(H).state.previewMode ? "tpl:left-0 tpl:right-0" : M(q).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", M(K).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
799
+ style: {
800
+ "transition-timing-function": "cubic-bezier(0.34, 1.56, 0.64, 1)",
801
+ "background-color": "var(--tpl-canvas-bg)"
802
+ }
803
+ }, [x("div", St, [w(g, { name: "tpl-restore-btn" }, {
804
+ default: N(() => [M(G).conditionPreview.hasHiddenBlocks.value ? (O(), b("button", {
805
+ key: 0,
806
+ 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",
807
+ style: {
808
+ "background-color": "var(--tpl-warning-light)",
809
+ color: "var(--tpl-warning)",
810
+ "border-color": "var(--tpl-warning)",
811
+ "backdrop-filter": "blur(8px)"
812
+ },
813
+ onClick: t[4] ||= (e) => M(G).conditionPreview.reset()
814
+ }, [w(M(oe), {
815
+ size: 13,
816
+ "stroke-width": 2
817
+ }), C(" " + j(M(G).t.blockSettings.restoreHiddenBlocks), 1)])) : y("", !0)]),
818
+ _: 1
819
+ })]), x("main", Ct, [w(ie, {
820
+ viewport: M(H).state.viewport,
821
+ content: M(H).content.value,
822
+ "selected-block-id": M(H).state.selectedBlockId,
823
+ "dark-mode": M(H).state.darkMode,
824
+ "preview-mode": M(H).state.previewMode,
825
+ "locked-blocks": M(W)?.lockedBlocks.value ?? void 0,
826
+ onSelectBlock: M(H).selectBlock,
827
+ onOpenAiChat: t[5] ||= (e) => M(q).aiChatOpen.value = !0,
828
+ onOpenDesignReference: t[6] ||= (e) => M(q).designReferenceOpen.value = !0
829
+ }, null, 8, [
830
+ "viewport",
831
+ "content",
832
+ "selected-block-id",
833
+ "dark-mode",
834
+ "preview-mode",
835
+ "locked-blocks",
836
+ "onSelectBlock"
837
+ ])])], 2),
838
+ M(J).isWhiteLabeled.value ? y("", !0) : (O(), b("footer", {
839
+ key: 0,
840
+ class: D(["tpl:pointer-events-none tpl:absolute tpl:bottom-0 tpl:z-50 tpl:flex tpl:h-8 tpl:items-center tpl:justify-end tpl:pr-4 tpl:text-[9px] tpl:opacity-90 tpl:transition-all tpl:duration-300 tpl:text-[var(--tpl-text-dim)]", [M(H).state.previewMode ? "tpl:left-0 tpl:right-0" : M(q).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]])
841
+ }, [x("div", wt, [
842
+ x("span", null, j(M(G).t.footer.poweredBy), 1),
843
+ t[20] ||= x("a", {
844
+ href: "https://templatical.com",
845
+ target: "_blank",
846
+ rel: "noopener noreferrer",
847
+ class: "tpl:inline-flex tpl:items-center tpl:gap-1 tpl:font-medium tpl:transition-colors tpl:duration-150 hover:tpl:opacity-80 tpl:text-[var(--tpl-text-muted)]",
848
+ style: { "text-decoration": "none" }
849
+ }, [x("img", {
850
+ width: "14",
851
+ height: "14",
852
+ src: "https://templatical.com/logo.svg",
853
+ alt: ""
854
+ }), C(" Templatical ")], -1),
855
+ t[21] ||= x("span", { class: "tpl:text-[var(--tpl-border)]" }, "·", -1),
856
+ x("a", Tt, j(M(G).t.footer.openSource), 1)
857
+ ])], 2)),
858
+ we(w(ne, {
859
+ "selected-block": M(H).selectedBlock.value,
860
+ settings: M(H).content.value.settings,
861
+ "shifted-left": M(q).rightPanelOpen.value,
862
+ onUpdateBlock: t[7] ||= (e) => M(H).updateBlock(M(H).selectedBlock.value.id, e),
863
+ onDeleteBlock: t[8] ||= (e) => M(G).blockActions.deleteBlock(M(H).selectedBlock.value.id),
864
+ onDuplicateBlock: t[9] ||= (e) => M(G).blockActions.duplicateBlock(M(H).selectedBlock.value),
865
+ onUpdateSettings: M(H).updateSettings
866
+ }, null, 8, [
867
+ "selected-block",
868
+ "settings",
869
+ "shifted-left",
870
+ "onUpdateSettings"
871
+ ]), [[Se, !M(H).state.previewMode]]),
872
+ !F.value && I.value ? (O(), b(me, { key: 1 }, [
873
+ w(M(f), {
874
+ visible: M(q).aiChatOpen.value,
875
+ "on-apply": (e) => {
876
+ M(G).history.record(), M(H).setContent(e), M(G).conditionPreview.reset();
877
+ },
878
+ onClose: t[10] ||= (e) => M(q).aiChatOpen.value = !1
879
+ }, null, 8, ["visible", "on-apply"]),
880
+ w(M(ce), {
881
+ visible: M(q).scoringPanelOpen.value,
882
+ onClose: t[11] ||= (e) => M(q).scoringPanelOpen.value = !1
883
+ }, null, 8, ["visible"]),
884
+ w(M(m), {
885
+ visible: M(q).designReferenceOpen.value,
886
+ "has-existing-blocks": M(H).content.value.blocks.length > 0,
887
+ onClose: t[12] ||= (e) => M(q).designReferenceOpen.value = !1,
888
+ onApply: t[13] ||= (e) => {
889
+ M(G).history.record(), M(H).setContent(e), M(G).conditionPreview.reset();
890
+ }
891
+ }, null, 8, ["visible", "has-existing-blocks"]),
892
+ w(M(p), {
893
+ ref_key: "commentsSidebarRef",
894
+ ref: Ft,
895
+ visible: M(q).commentsOpen.value,
896
+ onClose: t[14] ||= (e) => M(q).commentsOpen.value = !1
897
+ }, null, 8, ["visible"]),
898
+ w(M(S), {
899
+ visible: M(q).testEmailModalOpen.value,
900
+ "allowed-emails": M(X).allowedEmails.value,
901
+ "is-sending": M(X).isSending.value,
902
+ error: M(X).error.value,
903
+ onSend: Lt,
904
+ onClose: t[15] ||= (e) => M(q).testEmailModalOpen.value = !1
905
+ }, null, 8, [
906
+ "visible",
907
+ "allowed-emails",
908
+ "is-sending",
909
+ "error"
910
+ ]),
911
+ M(B).hasFeature("saved_modules") && P.config.modules !== !1 ? (O(), v(M(E), {
912
+ key: 0,
913
+ visible: M($).showSaveDialog.value ?? !1,
914
+ "pre-selected-block-id": M($).preSelectedBlockId.value ?? null,
915
+ onClose: t[16] ||= (e) => M($).closeSaveDialog(),
916
+ onSaved: t[17] ||= (e) => M(Q).loadModules()
917
+ }, null, 8, ["visible", "pre-selected-block-id"])) : y("", !0),
918
+ M(B).hasFeature("saved_modules") && P.config.modules !== !1 ? (O(), v(M(ve), {
919
+ key: 1,
920
+ visible: M($).showBrowserModal.value ?? !1,
921
+ onClose: t[18] ||= (e) => M($).closeBrowserModal(),
922
+ onInsert: Rt
923
+ }, null, 8, ["visible"])) : y("", !0),
924
+ w(M(Qe), {
925
+ visible: M(q).mediaLibraryOpen.value,
926
+ accept: M(q).mediaLibraryAccept.value,
927
+ onSelect: M(Y).handleMediaSelect,
928
+ onClose: M(Y).handleMediaLibraryClose
929
+ }, null, 8, [
930
+ "visible",
931
+ "accept",
932
+ "onSelect",
933
+ "onClose"
934
+ ])
935
+ ], 64)) : y("", !0)
936
+ ], 14, it));
937
+ }
938
+ }), [["__scopeId", "data-v-59c9499b"]]);
939
+ //#endregion
940
+ export { W as default };