@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
@@ -1,1132 +0,0 @@
1
- import { ref as p, defineComponent as Ht, defineAsyncComponent as D, provide as i, computed as y, watch as X, shallowRef as At, nextTick as Ut, onMounted as jt, onUnmounted as Pt, openBlock as c, createElementBlock as g, normalizeStyle as Ke, createVNode as d, Transition as re, withCtx as ie, unref as t, createElementVNode as n, Fragment as Ge, renderList as Nt, createCommentVNode as f, toDisplayString as k, createBlock as U, createTextVNode as Y, withModifiers as Vt, normalizeClass as Qe, withDirectives as Xe, vShow as Ye } from "vue";
2
- import { createSectionBlock as Wt, createTextBlock as qt, createImageBlock as Jt, createButtonBlock as Kt, createDividerBlock as Gt, createVideoBlock as Qt, createSocialIconsBlock as Xt, createMenuBlock as Yt, createTableBlock as Zt, createSpacerBlock as el, createHtmlBlock as tl, resolveSyntax as ll, cloneBlock as ol, isCustomBlock as al } from "@templatical/types";
3
- import { useConditionPreview as sl, useBlockActions as nl, useHistory as rl, useAutoSave as il } from "@templatical/core";
4
- import { AuthManager as pl, usePlanConfig as cl, useEditor as dl, useWebSocket as ul, useMcpListener as vl, useCollaboration as ml, useExport as fl, useTestEmail as gl, useAiConfig as bl, useComments as hl, useCommentListener as yl, useSavedModules as kl, performHealthCheck as wl, useSnapshotHistory as xl, resolveWebSocketConfig as Bl } from "@templatical/core/cloud";
5
- import { c as xe, u as Cl, a as _l, _ as Sl, b as Ml, d as El, e as Il, f as Dl, g as Tl, h as zl, i as Fl, T as $l, j as Ol, k as Ll, o as Rl, l as Hl, C as Al, m as Ul, D as jl, P as Pl, M as Nl, S as Vl, n as Wl, R as ql, p as Jl, q as Kl, r as Gl, s as Ql, t as Xl } from "./index-D-iD-7lO.js";
6
- import { L as Ze } from "./loader-circle-tM9j2mRh.js";
7
- /**
8
- * @license lucide-vue-next v0.475.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */
13
- const Yl = xe("ClockIcon", [
14
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
15
- ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
16
- ]);
17
- /**
18
- * @license lucide-vue-next v0.475.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */
23
- const Zl = xe("SaveIcon", [
24
- [
25
- "path",
26
- {
27
- 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",
28
- key: "1c8476"
29
- }
30
- ],
31
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
32
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
33
- ]);
34
- /**
35
- * @license lucide-vue-next v0.475.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */
40
- const eo = xe("SendIcon", [
41
- [
42
- "path",
43
- {
44
- d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
45
- key: "1ffxy3"
46
- }
47
- ],
48
- ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
49
- ]);
50
- function to(Z) {
51
- const { onBlockMove: F, onBlockAdd: j } = Z, T = p(!1), E = p(null), P = p(null);
52
- function ee($) {
53
- T.value = !0, E.value = $;
54
- }
55
- function N() {
56
- T.value = !1, E.value = null, P.value = null;
57
- }
58
- function te($) {
59
- P.value = $;
60
- }
61
- function ve($, K, V, a) {
62
- if (!E.value) return;
63
- $.findIndex(
64
- (u) => u.id === E.value.id
65
- ) === -1 ? j(E.value, V, a) : F(
66
- E.value.id,
67
- K,
68
- V,
69
- a
70
- ), N();
71
- }
72
- function me($, K, V) {
73
- return {
74
- group: $,
75
- animation: 150,
76
- ghostClass: "tpl-ghost",
77
- dragClass: "tpl-drag",
78
- handle: ".tpl-drag-handle",
79
- onStart: (a) => {
80
- a.item.dataset.blockId && (T.value = !0);
81
- },
82
- onEnd: () => {
83
- N();
84
- },
85
- onAdd: (a) => {
86
- const O = a.item.dataset.blockId;
87
- O && F(O, a.newIndex, K, V);
88
- },
89
- onUpdate: (a) => {
90
- const O = a.item.dataset.blockId;
91
- O && F(O, a.newIndex, K, V);
92
- }
93
- };
94
- }
95
- return {
96
- isDragging: T,
97
- draggedBlock: E,
98
- dropTargetId: P,
99
- startDrag: ee,
100
- endDrag: N,
101
- setDropTarget: te,
102
- handleDrop: ve,
103
- getSortableOptions: me
104
- };
105
- }
106
- function lo(Z) {
107
- const F = p(!1), j = p(null), T = p(!1);
108
- function E(te) {
109
- j.value = te ?? null, F.value = !0;
110
- }
111
- function P() {
112
- F.value = !1, j.value = null;
113
- }
114
- function ee() {
115
- T.value = !0;
116
- }
117
- function N() {
118
- T.value = !1;
119
- }
120
- return {
121
- headless: Z,
122
- showSaveDialog: F,
123
- preSelectedBlockId: j,
124
- openSaveDialog: E,
125
- closeSaveDialog: P,
126
- showBrowserModal: T,
127
- openBrowserModal: ee,
128
- closeBrowserModal: N
129
- };
130
- }
131
- const oo = {
132
- key: 0,
133
- class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-[100] tpl:flex tpl:flex-col",
134
- style: { "background-color": "var(--tpl-bg)" }
135
- }, ao = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, so = {
136
- class: "tpl:flex tpl:w-12 tpl:shrink-0 tpl:flex-col tpl:items-center tpl:gap-4 tpl:py-5",
137
- style: { "border-right": "1px solid var(--tpl-border)" }
138
- }, no = {
139
- key: 0,
140
- role: "alert",
141
- class: "tpl-error tpl:absolute tpl:inset-0 tpl:z-[100] tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-6 tpl:px-8",
142
- style: { "background-color": "var(--tpl-bg)" }
143
- }, ro = {
144
- class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full",
145
- style: { "background-color": "var(--tpl-danger-light)" }
146
- }, io = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, po = {
147
- class: "tpl:text-lg tpl:font-semibold",
148
- style: { color: "var(--tpl-text)" }
149
- }, co = {
150
- class: "tpl:max-w-md tpl:text-sm",
151
- style: { color: "var(--tpl-text-muted)" }
152
- }, uo = {
153
- class: "tpl-header tpl:absolute tpl:top-0 tpl:right-0 tpl:left-0 tpl:z-50 tpl:flex tpl:h-14 tpl:items-center tpl:justify-between tpl:px-4",
154
- 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)" }
155
- }, vo = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, mo = {
156
- key: 0,
157
- class: "tpl-logo tpl:flex tpl:items-center tpl:gap-2.5 tpl:text-sm tpl:font-semibold",
158
- style: { color: "var(--tpl-text)" }
159
- }, fo = ["src"], go = { style: { "letter-spacing": "-0.01em" } }, bo = {
160
- key: 1,
161
- class: "tpl:text-xs tpl:opacity-60",
162
- style: { color: "var(--tpl-text-muted)" }
163
- }, ho = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, yo = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, ko = {
164
- key: 0,
165
- "aria-live": "polite",
166
- class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs",
167
- style: { color: "var(--tpl-text-muted)" }
168
- }, wo = ["aria-label", "aria-expanded"], xo = {
169
- key: 0,
170
- class: "tpl:inline-flex tpl:size-4.5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-[10px] tpl:font-semibold",
171
- style: { "background-color": "var(--tpl-primary)", color: "var(--tpl-bg)" }
172
- }, Bo = ["aria-expanded"], Co = {
173
- key: 0,
174
- class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
175
- }, _o = ["disabled"], So = ["disabled"], Mo = {
176
- key: 0,
177
- 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",
178
- style: { "background-color": "var(--tpl-primary-light)", "border-bottom": "1px solid var(--tpl-primary)" }
179
- }, Eo = {
180
- class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm",
181
- style: { color: "var(--tpl-text)" }
182
- }, Io = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Do = {
183
- key: 0,
184
- role: "status",
185
- "aria-live": "polite",
186
- class: "tpl:absolute tpl:top-16 tpl:left-1/2 tpl:z-[60] tpl:-translate-x-1/2 tpl:rounded-[var(--tpl-radius)] tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:shadow-lg",
187
- style: { "background-color": "var(--tpl-warning-light)", color: "var(--tpl-text)", border: "1px solid var(--tpl-warning)" }
188
- }, To = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, zo = { class: "tpl-main tpl:flex tpl:min-h-full tpl:justify-center tpl:p-8" }, Fo = /* @__PURE__ */ Ht({
189
- __name: "CloudEditor",
190
- props: {
191
- config: {},
192
- translations: {},
193
- fontsManager: {}
194
- },
195
- emits: ["ready"],
196
- setup(Z, { expose: F, emit: j }) {
197
- var Ae, Ue, je, Pe, Ne, Ve, We, qe;
198
- const T = D(
199
- () => import("./AiChatSidebar-0vx9TP5B.js")
200
- ), E = D(
201
- () => import("./CommentsSidebar-PVUlloyB.js")
202
- ), P = D(
203
- () => import("./DesignReferenceSidebar-DAlAWrxU.js")
204
- ), ee = D(
205
- () => import("./TemplateScoringPanel-DSZPo15C.js")
206
- ), N = D(
207
- () => import("./TestEmailModal-Cwre5elw.js")
208
- ), te = D(
209
- () => import("./SaveModuleDialog-eNyr3XKn.js")
210
- ), ve = D(
211
- () => import("./ModuleBrowserModal-1JEcChd8.js")
212
- ), me = D(
213
- () => import("./SnapshotHistory-D-ZiIj1v.js")
214
- ), $ = D(
215
- () => import("./CollaboratorBar-B3uV4Wtw.js")
216
- ), K = D(
217
- () => import("./AiFeatureMenu-CI-v74ND.js")
218
- ), V = D(async () => (await import("@templatical/media-library")).MediaLibraryModal), a = Z, O = j;
219
- i("translations", a.translations);
220
- const { t: u, format: et } = Cl(a.translations), fe = p({}), tt = {
221
- bg: "--tpl-bg",
222
- bgElevated: "--tpl-bg-elevated",
223
- bgHover: "--tpl-bg-hover",
224
- bgActive: "--tpl-bg-active",
225
- border: "--tpl-border",
226
- borderLight: "--tpl-border-light",
227
- text: "--tpl-text",
228
- textMuted: "--tpl-text-muted",
229
- textDim: "--tpl-text-dim",
230
- primary: "--tpl-primary",
231
- primaryHover: "--tpl-primary-hover",
232
- primaryLight: "--tpl-primary-light",
233
- secondary: "--tpl-secondary",
234
- secondaryHover: "--tpl-secondary-hover",
235
- secondaryLight: "--tpl-secondary-light",
236
- success: "--tpl-success",
237
- successLight: "--tpl-success-light",
238
- warning: "--tpl-warning",
239
- warningLight: "--tpl-warning-light",
240
- danger: "--tpl-danger",
241
- dangerLight: "--tpl-danger-light",
242
- canvasBg: "--tpl-canvas-bg"
243
- }, Be = y(() => {
244
- const e = {};
245
- for (const [o, r] of Object.entries(tt)) {
246
- const s = fe.value[o];
247
- s && (e[r] = s);
248
- }
249
- return e["--tpl-drop-text"] = `"${a.translations.canvas.dropHere}"`, e;
250
- });
251
- function lt(e) {
252
- v.hasFeature("theme_customization") && (fe.value = e);
253
- }
254
- const le = p(!0), pe = p(!1), oe = p(null), x = new pl({
255
- ...a.config.auth,
256
- onError: a.config.onError
257
- }), v = cl({
258
- authManager: x,
259
- onError: a.config.onError
260
- }), Ce = p(/* @__PURE__ */ new Map()), l = dl({
261
- authManager: x,
262
- defaultFontFamily: (Ae = a.config.fonts) == null ? void 0 : Ae.defaultFont,
263
- templateDefaults: a.config.templateDefaults,
264
- onError: a.config.onError,
265
- lockedBlocks: Ce
266
- });
267
- let w = null;
268
- const H = ul({
269
- authManager: x,
270
- onError: a.config.onError
271
- });
272
- if ((Ue = a.config.mcp) != null && Ue.enabled && vl({
273
- editor: l,
274
- channel: H.channel,
275
- onOperation: a.config.mcp.onOperation
276
- }), (je = a.config.collaboration) != null && je.enabled) {
277
- w = ml({
278
- authManager: x,
279
- editor: l,
280
- channel: H.channel,
281
- onError: a.config.onError,
282
- onCollaboratorJoined: a.config.collaboration.onCollaboratorJoined,
283
- onCollaboratorLeft: a.config.collaboration.onCollaboratorLeft,
284
- onBlockLocked: a.config.collaboration.onBlockLocked,
285
- onBlockUnlocked: a.config.collaboration.onBlockUnlocked
286
- }), X(
287
- () => w.lockedBlocks.value,
288
- (m) => {
289
- Ce.value = m;
290
- },
291
- { immediate: !0 }
292
- );
293
- const e = l.addBlock, o = l.updateBlock, r = l.removeBlock, s = l.moveBlock, h = l.updateSettings, we = l.setContent;
294
- l.addBlock = (m, z, ne) => {
295
- e(m, z, ne), w._broadcastOperation({
296
- operation: "add_block",
297
- data: {
298
- block: m,
299
- section_id: z,
300
- column_index: ne
301
- },
302
- timestamp: Date.now()
303
- });
304
- }, l.updateBlock = (m, z) => {
305
- o(m, z), w._broadcastOperation({
306
- operation: "update_block",
307
- data: { block_id: m, updates: z },
308
- timestamp: Date.now()
309
- });
310
- }, l.removeBlock = (m) => {
311
- r(m), w._broadcastOperation({
312
- operation: "delete_block",
313
- data: { block_id: m },
314
- timestamp: Date.now()
315
- });
316
- }, l.moveBlock = (m, z, ne, Je) => {
317
- s(m, z, ne, Je), w._broadcastOperation({
318
- operation: "move_block",
319
- data: {
320
- block_id: m,
321
- index: z,
322
- section_id: ne,
323
- column_index: Je
324
- },
325
- timestamp: Date.now()
326
- });
327
- }, l.updateSettings = (m) => {
328
- h(m), w._broadcastOperation({
329
- operation: "update_settings",
330
- data: { updates: m },
331
- timestamp: Date.now()
332
- });
333
- }, l.setContent = (m, z) => {
334
- we(m, z), w._broadcastOperation({
335
- operation: "set_content",
336
- data: { content: m },
337
- timestamp: Date.now()
338
- });
339
- };
340
- }
341
- const _e = y(
342
- () => {
343
- var e;
344
- return !!((e = a.config.collaboration) != null && e.enabled) && v.hasFeature("collaboration");
345
- }
346
- ), G = sl(l), ge = nl({
347
- addBlock: l.addBlock,
348
- removeBlock: l.removeBlock,
349
- updateBlock: l.updateBlock,
350
- selectBlock: l.selectBlock,
351
- blockDefaults: a.config.blockDefaults
352
- }), ot = to({
353
- onBlockMove: l.moveBlock,
354
- onBlockAdd: l.addBlock
355
- }), Se = fl({
356
- authManager: x,
357
- getFontsConfig: () => a.config.fonts,
358
- canUseCustomFonts: () => v.hasFeature("custom_fonts")
359
- }), A = gl({
360
- authManager: x,
361
- getTemplateId: () => {
362
- var e;
363
- return ((e = l.state.template) == null ? void 0 : e.id) ?? null;
364
- },
365
- save: () => l.save(),
366
- exportHtml: (e) => Se.exportHtml(e),
367
- onError: a.config.onError,
368
- isAuthReady: pe,
369
- onBeforeTestEmail: a.config.onBeforeTestEmail
370
- }), B = rl({
371
- content: l.content,
372
- setContent: (e, o) => l.setContent(e, o),
373
- isRemoteOperation: w ? () => w._isProcessingRemoteOperation() : void 0
374
- }), at = l.addBlock, st = l.removeBlock, nt = l.moveBlock, rt = l.updateBlock, it = l.updateSettings;
375
- l.addBlock = (e, o, r, s) => {
376
- B.record(), at(e, o, r, s);
377
- }, l.removeBlock = (e) => {
378
- B.record(), st(e);
379
- }, l.moveBlock = (e, o, r, s) => {
380
- B.record(), nt(e, o, r, s);
381
- }, l.updateBlock = (e, o) => {
382
- B.recordDebounced(e), rt(e, o);
383
- }, l.updateSettings = (e) => {
384
- B.record(), it(e);
385
- };
386
- let Me = !1;
387
- const be = p(!1);
388
- function pt() {
389
- Me || !w || !_e.value || w.collaborators.value.length === 0 || !B.canUndo.value || (Me = !0, be.value = !0, Ql(() => {
390
- be.value = !1;
391
- }, 4e3));
392
- }
393
- const Q = il({
394
- content: l.content,
395
- isDirty: () => l.state.isDirty,
396
- onChange: async () => {
397
- l.hasTemplate() && (await l.createSnapshot(), b.value && b.value.loadSnapshots());
398
- },
399
- debounce: a.config.autoSaveDebounce ?? 5e3,
400
- enabled: () => a.config.autoSave !== !1 && v.hasFeature("auto_save")
401
- });
402
- X(B.isNavigating, (e) => {
403
- e ? Q.pause() : Q.resume();
404
- });
405
- const Ee = bl(a.config.ai), W = hl({
406
- authManager: x,
407
- getTemplateId: () => {
408
- var e;
409
- return ((e = l.state.template) == null ? void 0 : e.id) ?? null;
410
- },
411
- getSocketId: () => H.getSocketId(),
412
- onComment: a.config.onComment,
413
- onError: a.config.onError,
414
- isAuthReady: pe,
415
- hasCommentingFeature: () => a.config.commenting !== !1 && v.hasFeature("commenting")
416
- });
417
- yl({
418
- comments: W,
419
- channel: H.channel
420
- });
421
- const ce = kl({
422
- authManager: x,
423
- onError: a.config.onError
424
- }), q = lo(ce), C = _l();
425
- C.registerBuiltIn("section", {
426
- component: Sl,
427
- createBlock: () => Wt(),
428
- sidebarItem: { type: "section", label: "Section", isCustom: !1 }
429
- }), C.registerBuiltIn("text", {
430
- component: Ml,
431
- createBlock: () => qt(),
432
- sidebarItem: { type: "text", label: "Text", isCustom: !1 }
433
- }), C.registerBuiltIn("image", {
434
- component: El,
435
- createBlock: () => Jt(),
436
- sidebarItem: { type: "image", label: "Image", isCustom: !1 }
437
- }), C.registerBuiltIn("button", {
438
- component: Il,
439
- createBlock: () => Kt(),
440
- sidebarItem: { type: "button", label: "Button", isCustom: !1 }
441
- }), C.registerBuiltIn("divider", {
442
- component: Dl,
443
- createBlock: () => Gt(),
444
- sidebarItem: { type: "divider", label: "Divider", isCustom: !1 }
445
- }), C.registerBuiltIn("video", {
446
- component: Tl,
447
- createBlock: () => Qt(),
448
- sidebarItem: { type: "video", label: "Video", isCustom: !1 }
449
- }), C.registerBuiltIn("social", {
450
- component: zl,
451
- createBlock: () => Xt(),
452
- sidebarItem: { type: "social", label: "Social", isCustom: !1 }
453
- }), C.registerBuiltIn("menu", {
454
- component: Fl,
455
- createBlock: () => Yt(),
456
- sidebarItem: { type: "menu", label: "Menu", isCustom: !1 }
457
- }), C.registerBuiltIn("table", {
458
- component: $l,
459
- createBlock: () => Zt(),
460
- sidebarItem: { type: "table", label: "Table", isCustom: !1 }
461
- }), C.registerBuiltIn("spacer", {
462
- component: Ol,
463
- createBlock: () => el(),
464
- sidebarItem: { type: "spacer", label: "Spacer", isCustom: !1 }
465
- }), C.registerBuiltIn("html", {
466
- component: Ll,
467
- createBlock: () => tl(),
468
- sidebarItem: { type: "html", label: "HTML", isCustom: !1 }
469
- }), i("editor", l), i("history", B), i("blockActions", ge), i("dragDrop", ot), i("conditionPreview", G), i("fontsManager", a.fontsManager), i("themeStyles", Be), i("blockDefaults", a.config.blockDefaults), i("blockRegistry", C), i("customBlockDefinitions", a.config.customBlocks ?? []);
470
- const ct = ll((Pe = a.config.mergeTags) == null ? void 0 : Pe.syntax);
471
- i("mergeTags", ((Ne = a.config.mergeTags) == null ? void 0 : Ne.tags) ?? []), i("mergeTagSyntax", ct), i("onRequestMergeTag", ((Ve = a.config.mergeTags) == null ? void 0 : Ve.onRequest) ?? null), i("displayConditions", ((We = a.config.displayConditions) == null ? void 0 : We.conditions) ?? []), i(
472
- "allowCustomConditions",
473
- ((qe = a.config.displayConditions) == null ? void 0 : qe.allowCustom) ?? !1
474
- ), i("onRequestMedia", Le), i("config", { onRequestMedia: Le }), i("authManager", x), i(
475
- "projectId",
476
- y(() => x.projectId)
477
- ), i("planConfig", v), i("aiConfig", Ee), i("comments", W), i("openCommentsForBlock", It), i("savedModules", q), i("savedModulesHeadless", ce);
478
- const b = At(
479
- null
480
- ), L = p(null), ae = p(null), Ie = y(() => L.value !== null), dt = y(
481
- () => {
482
- var e;
483
- return ((e = b.value) == null ? void 0 : e.snapshots.value) ?? [];
484
- }
485
- ), ut = y(
486
- () => {
487
- var e;
488
- return ((e = b.value) == null ? void 0 : e.isLoading.value) ?? !1;
489
- }
490
- ), vt = y(
491
- () => {
492
- var e;
493
- return ((e = b.value) == null ? void 0 : e.isRestoring.value) ?? !1;
494
- }
495
- );
496
- function he() {
497
- var e;
498
- (e = l.state.template) != null && e.id && !b.value && (b.value = xl({
499
- authManager: x,
500
- templateId: l.state.template.id,
501
- onRestore: mt,
502
- onError: a.config.onError
503
- }), b.value.loadSnapshots());
504
- }
505
- function mt(e) {
506
- l.setContent(e.content, !1), B.clear(), G.reset();
507
- }
508
- async function ft(e) {
509
- if (L.value) {
510
- L.value = e, l.setContent(e.content, !1);
511
- return;
512
- }
513
- l.state.isDirty && l.hasTemplate() && await l.createSnapshot(), ae.value = JSON.parse(JSON.stringify(l.content.value)), Q.pause(), L.value = e, l.setContent(e.content, !1);
514
- }
515
- async function gt() {
516
- !L.value || !b.value || (await b.value.restoreSnapshot(
517
- L.value.id
518
- ), await b.value.loadSnapshots(), L.value = null, ae.value = null, Q.resume());
519
- }
520
- function bt() {
521
- !L.value || !ae.value || (l.setContent(ae.value, !1), L.value = null, ae.value = null, Q.resume());
522
- }
523
- async function ht() {
524
- b.value && await b.value.loadSnapshots();
525
- }
526
- const yt = y(
527
- () => v.hasFeature("ai_generation") && Ee.hasAnyMenuFeature.value
528
- ), kt = y(
529
- () => v.hasFeature("test_email")
530
- ), ye = y(() => {
531
- var e;
532
- return !!((e = l.state.template) != null && e.id);
533
- }), wt = y(
534
- () => v.hasFeature("white_label")
535
- ), De = y(
536
- () => {
537
- var e;
538
- return ((e = v.config.value) == null ? void 0 : e.limits.max_templates) ?? null;
539
- }
540
- ), xt = y(
541
- () => {
542
- var e;
543
- return ((e = v.config.value) == null ? void 0 : e.template_count) ?? 0;
544
- }
545
- ), se = p(!1), S = p(!1), I = p(!1), M = p(!1), _ = p(!1), de = p(!1), ue = p(!1), Te = p(void 0), J = p(!1), ze = p(null), Fe = y(
546
- () => S.value || I.value || M.value || _.value
547
- );
548
- X(I, (e) => {
549
- e && (S.value = !1, M.value = !1, _.value = !1);
550
- }), X(S, (e) => {
551
- e && (I.value = !1, M.value = !1, _.value = !1);
552
- }), X(M, (e) => {
553
- e && (S.value = !1, I.value = !1, _.value = !1);
554
- }), X(_, (e) => {
555
- e && (S.value = !1, I.value = !1, M.value = !1);
556
- });
557
- const Bt = y(() => S.value ? "ai-chat" : M.value ? "design-reference" : I.value ? "scoring" : null), Ct = y(
558
- () => J.value || S.value || M.value || I.value
559
- );
560
- function _t() {
561
- J.value = !J.value;
562
- }
563
- function St(e) {
564
- J.value = !1, e === "ai-chat" ? S.value = !S.value : e === "design-reference" ? M.value = !M.value : e === "scoring" && (I.value = !I.value);
565
- }
566
- Rl(ze, () => {
567
- J.value = !1;
568
- });
569
- async function Mt(e) {
570
- try {
571
- await A.sendTestEmail(e), de.value = !1;
572
- } catch {
573
- }
574
- }
575
- function Et(e, o) {
576
- for (let r = 0; r < e.content.length; r++) {
577
- const s = ol(e.content[r]), h = o !== void 0 ? o + r : void 0;
578
- l.addBlock(s, void 0, void 0, h);
579
- }
580
- q.closeBrowserModal();
581
- }
582
- const $e = p(
583
- null
584
- );
585
- function It(e) {
586
- _.value = !0, Ut(() => {
587
- var o;
588
- (o = $e.value) == null || o.filterByBlock(e);
589
- });
590
- }
591
- const Oe = p(!1);
592
- function Dt(e) {
593
- if (Oe.value ? e.metaKey : e.ctrlKey) {
594
- if (e.key === "s") {
595
- e.preventDefault(), ke().catch((r) => {
596
- var s, h;
597
- return (h = (s = a.config).onError) == null ? void 0 : h.call(s, r);
598
- });
599
- return;
600
- }
601
- if (e.key.toLowerCase() === "z") {
602
- if (e.target.closest(".tpl-text-editable"))
603
- return;
604
- e.preventDefault(), e.shiftKey ? B.redo() : (pt(), B.undo());
605
- }
606
- }
607
- }
608
- let R = null;
609
- async function Le() {
610
- if (a.config.onRequestMedia) {
611
- const e = await a.config.onRequestMedia({ accept: ["images"] });
612
- return e ? { url: e.url, alt: e.alt_text || void 0 } : null;
613
- }
614
- return Te.value = ["images"], ue.value = !0, new Promise((e) => {
615
- R = (o) => {
616
- e(o);
617
- };
618
- });
619
- }
620
- function Tt(e) {
621
- ue.value = !1, R == null || R({ url: e.url, alt: e.alt_text || void 0 }), R = null;
622
- }
623
- function zt() {
624
- ue.value = !1, R == null || R(null), R = null;
625
- }
626
- async function Re() {
627
- var e, o, r;
628
- le.value = !0, oe.value = null;
629
- try {
630
- await x.initialize(), pe.value = !0;
631
- const s = await wl({ authManager: x });
632
- if (!s.api.ok)
633
- throw new Error("Health check failed: API is not reachable");
634
- if (!s.auth.ok)
635
- throw new Error(
636
- `Health check failed: authentication error${s.auth.error ? ` - ${s.auth.error}` : ""}`
637
- );
638
- if (s.websocket.ok || console.warn(
639
- "[Templatical] WebSocket health check failed:",
640
- s.websocket.error ?? "unknown error",
641
- "— real-time features will be disabled."
642
- ), await v.fetchConfig(), a.fontsManager.setCustomFontsEnabled(
643
- v.hasFeature("custom_fonts")
644
- ), (e = a.config.customBlocks) != null && e.length && v.hasFeature("custom_blocks"))
645
- for (const h of a.config.customBlocks)
646
- C.registerCustom(h, Gl);
647
- a.config.theme && v.hasFeature("theme_customization") && (fe.value = a.config.theme), a.config.modules !== !1 && v.hasFeature("saved_modules") && ce.loadModules(), O("ready");
648
- } catch (s) {
649
- const h = s instanceof Error ? s : new Error("Initialization failed");
650
- oe.value = h, (r = (o = a.config).onError) == null || r.call(o, h);
651
- } finally {
652
- le.value = !1;
653
- }
654
- }
655
- function Ft(e) {
656
- return "isUnauthorized" in e && e.isUnauthorized ? u.error.authFailed : "isNotFound" in e && e.isNotFound ? u.error.templateNotFound : u.error.defaultMessage;
657
- }
658
- function $t(e) {
659
- return "isNotFound" in e && !!e.isNotFound;
660
- }
661
- function He() {
662
- return Bl(v.config.value.websocket);
663
- }
664
- async function Ot(e) {
665
- var r, s;
666
- const o = await l.create(e);
667
- return (s = (r = a.config).onCreate) == null || s.call(r, o), he(), H.connect(o.id, He()), o;
668
- }
669
- async function Lt(e) {
670
- var r, s;
671
- const o = await l.load(e);
672
- return (s = (r = a.config).onLoad) == null || s.call(r, o), he(), H.connect(o.id, He()), o;
673
- }
674
- async function Rt(e) {
675
- const o = async (r) => {
676
- if (al(r)) {
677
- const s = r;
678
- try {
679
- s.renderedHtml = await C.renderCustomBlock(s);
680
- } catch {
681
- s.renderedHtml = `<!-- Custom block render error: ${s.customType} -->`;
682
- }
683
- }
684
- if (r.type === "section" && "children" in r) {
685
- const s = r;
686
- for (const h of s.children)
687
- for (const we of h)
688
- await o(we);
689
- }
690
- };
691
- for (const r of e.blocks)
692
- await o(r);
693
- }
694
- async function ke() {
695
- var e, o;
696
- se.value = !0;
697
- try {
698
- await Rt(l.content.value);
699
- const r = await l.save();
700
- he(), b.value && b.value.loadSnapshots();
701
- const s = await Se.exportHtml(r.id), h = {
702
- templateId: r.id,
703
- html: s.html,
704
- mjml: s.mjml,
705
- content: r.content
706
- };
707
- return (o = (e = a.config).onSave) == null || o.call(e, h), h;
708
- } finally {
709
- se.value = !1;
710
- }
711
- }
712
- return Hl(document, "keydown", Dt), jt(() => {
713
- Oe.value = navigator.platform.toUpperCase().includes("MAC"), Re();
714
- }), Pt(() => {
715
- var e, o;
716
- H.disconnect(), B.destroy(), Q.destroy(), (o = (e = a.config).onUnmount) == null || o.call(e);
717
- }), F({
718
- getContent: () => l.content.value,
719
- setContent: (e) => l.setContent(e),
720
- setTheme: lt,
721
- create: Ot,
722
- load: Lt,
723
- save: ke,
724
- sendTestEmail: A.sendTestEmail
725
- }), (e, o) => {
726
- var r;
727
- return c(), g("div", {
728
- class: "tpl tpl:relative tpl:h-full tpl:overflow-hidden",
729
- style: Ke(Be.value)
730
- }, [
731
- d(re, {
732
- "enter-active-class": "tpl:transition-opacity tpl:duration-200",
733
- "enter-from-class": "tpl:opacity-100",
734
- "enter-to-class": "tpl:opacity-100",
735
- "leave-active-class": "tpl:transition-opacity tpl:duration-300",
736
- "leave-from-class": "tpl:opacity-100",
737
- "leave-to-class": "tpl:opacity-0"
738
- }, {
739
- default: ie(() => [
740
- le.value || t(l).state.isLoading ? (c(), g("div", oo, [
741
- o[20] || (o[20] = n("div", {
742
- class: "tpl:flex tpl:h-14 tpl:shrink-0 tpl:items-center tpl:justify-between tpl:px-4",
743
- style: { "border-bottom": "1px solid var(--tpl-border)" }
744
- }, [
745
- n("div", { class: "tpl-shimmer tpl:h-5 tpl:w-28 tpl:rounded-[var(--tpl-radius-sm)]" }),
746
- n("div", { class: "tpl:flex tpl:gap-3" }, [
747
- n("div", { class: "tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]" }),
748
- n("div", { class: "tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]" })
749
- ])
750
- ], -1)),
751
- n("div", ao, [
752
- n("div", so, [
753
- (c(), g(Ge, null, Nt(5, (s) => n("div", {
754
- key: s,
755
- class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
756
- })), 64))
757
- ]),
758
- o[18] || (o[18] = n("div", {
759
- class: "tpl:flex tpl:flex-1 tpl:items-start tpl:justify-center tpl:overflow-auto tpl:p-8",
760
- style: { "background-color": "var(--tpl-canvas-bg)" }
761
- }, [
762
- n("div", {
763
- class: "tpl:w-full tpl:max-w-[600px] tpl:rounded-[var(--tpl-radius)] tpl:p-6",
764
- style: { "background-color": "var(--tpl-bg)", "box-shadow": "var(--tpl-shadow-sm)" }
765
- }, [
766
- n("div", { class: "tpl:space-y-2 tpl:py-4" }, [
767
- n("div", { class: "tpl-shimmer tpl:h-3 tpl:w-3/4 tpl:rounded" }),
768
- n("div", { class: "tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded" }),
769
- n("div", { class: "tpl-shimmer tpl:h-3 tpl:w-5/6 tpl:rounded" })
770
- ]),
771
- n("div", { class: "tpl:py-4" }, [
772
- n("div", { class: "tpl-shimmer tpl:h-44 tpl:w-full tpl:rounded-[var(--tpl-radius-sm)]" })
773
- ]),
774
- n("div", { class: "tpl:space-y-2 tpl:py-4" }, [
775
- n("div", { class: "tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded" }),
776
- n("div", { class: "tpl-shimmer tpl:h-3 tpl:w-2/3 tpl:rounded" })
777
- ]),
778
- n("div", { class: "tpl:flex tpl:justify-center tpl:py-4" }, [
779
- n("div", { class: "tpl-shimmer tpl:h-10 tpl:w-36 tpl:rounded-[var(--tpl-radius-sm)]" })
780
- ]),
781
- n("div", { class: "tpl:space-y-2 tpl:py-4" }, [
782
- n("div", { class: "tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/2 tpl:rounded" }),
783
- n("div", { class: "tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/3 tpl:rounded" })
784
- ])
785
- ])
786
- ], -1)),
787
- o[19] || (o[19] = n("div", {
788
- class: "tpl:flex tpl:w-[320px] tpl:shrink-0 tpl:flex-col tpl:gap-4 tpl:p-4",
789
- style: { "border-left": "1px solid var(--tpl-border)" }
790
- }, [
791
- n("div", { class: "tpl-shimmer tpl:h-8 tpl:rounded-[var(--tpl-radius-sm)]" }),
792
- n("div", { class: "tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]" }),
793
- n("div", { class: "tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]" })
794
- ], -1))
795
- ])
796
- ])) : f("", !0)
797
- ]),
798
- _: 1
799
- }),
800
- d(re, {
801
- "enter-active-class": "tpl:transition-opacity tpl:duration-200",
802
- "enter-from-class": "tpl:opacity-0",
803
- "enter-to-class": "tpl:opacity-100",
804
- "leave-active-class": "tpl:transition-opacity tpl:duration-300",
805
- "leave-from-class": "tpl:opacity-100",
806
- "leave-to-class": "tpl:opacity-0"
807
- }, {
808
- default: ie(() => [
809
- oe.value && !le.value ? (c(), g("div", no, [
810
- n("div", ro, [
811
- d(t(Al), {
812
- size: 32,
813
- "stroke-width": 1.5,
814
- style: { color: "var(--tpl-danger)" }
815
- })
816
- ]),
817
- n("div", io, [
818
- n("h2", po, k(t(u).error.title), 1),
819
- n("p", co, k(Ft(oe.value)), 1)
820
- ]),
821
- $t(oe.value) ? f("", !0) : (c(), g("button", {
822
- key: 0,
823
- 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",
824
- style: { "background-color": "var(--tpl-primary)", color: "var(--tpl-bg)" },
825
- onClick: Re
826
- }, k(t(u).error.retry), 1))
827
- ])) : f("", !0)
828
- ]),
829
- _: 1
830
- }),
831
- n("header", uo, [
832
- n("div", vo, [
833
- wt.value ? f("", !0) : (c(), g("div", mo, [
834
- n("img", {
835
- src: t(x).resolveUrl("/logo.svg"),
836
- alt: "Templatical",
837
- width: "24",
838
- height: "24",
839
- class: "tpl:shrink-0"
840
- }, null, 8, fo),
841
- n("span", go, k(t(u).header.title), 1)
842
- ])),
843
- De.value !== null ? (c(), g("span", bo, k(t(et)(t(u).header.templatesUsed, {
844
- used: xt.value,
845
- max: De.value
846
- })), 1)) : f("", !0)
847
- ]),
848
- n("div", ho, [
849
- d(Ul, {
850
- viewport: t(l).state.viewport,
851
- onChange: t(l).setViewport
852
- }, null, 8, ["viewport", "onChange"]),
853
- d(jl, {
854
- "dark-mode": t(l).state.darkMode,
855
- onChange: t(l).setDarkMode
856
- }, null, 8, ["dark-mode", "onChange"]),
857
- d(Pl, {
858
- "preview-mode": t(l).state.previewMode,
859
- onChange: t(l).setPreviewMode
860
- }, null, 8, ["preview-mode", "onChange"]),
861
- t(w) && _e.value ? (c(), U(t($), {
862
- key: 0,
863
- collaborators: t(w).collaborators.value,
864
- "is-connected": t(H).isConnected.value
865
- }, null, 8, ["collaborators", "is-connected"])) : f("", !0),
866
- b.value ? (c(), U(t(me), {
867
- key: 1,
868
- snapshots: dt.value,
869
- "is-loading": ut.value,
870
- "is-restoring": vt.value,
871
- onLoad: ht,
872
- onNavigate: ft
873
- }, null, 8, ["snapshots", "is-loading", "is-restoring"])) : f("", !0)
874
- ]),
875
- n("div", yo, [
876
- t(l).state.isDirty ? (c(), g("div", ko, [
877
- o[21] || (o[21] = n("span", {
878
- class: "tpl-pulse tpl:size-1.5 tpl:rounded-full",
879
- style: { "background-color": "var(--tpl-primary)" }
880
- }, null, -1)),
881
- Y(" " + k(t(u).header.unsaved), 1)
882
- ])) : f("", !0),
883
- t(W).isEnabled.value && ye.value ? (c(), g("button", {
884
- key: 1,
885
- "aria-label": t(W).unresolvedCount.value > 0 ? `${t(u).comments.button} (${t(W).unresolvedCount.value})` : t(u).comments.button,
886
- "aria-expanded": _.value,
887
- class: "tpl-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3.5 tpl:py-2 tpl:text-sm tpl:font-medium tpl:whitespace-nowrap tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-white tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
888
- style: Ke({
889
- backgroundColor: _.value ? "var(--tpl-primary)" : "transparent",
890
- color: _.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
891
- borderColor: "var(--tpl-primary)"
892
- }),
893
- onClick: o[0] || (o[0] = (s) => _.value = !_.value)
894
- }, [
895
- d(t(Nl), {
896
- size: 16,
897
- "stroke-width": 2
898
- }),
899
- Y(" " + k(t(u).comments.button) + " ", 1),
900
- t(W).unresolvedCount.value > 0 && !_.value ? (c(), g("span", xo, k(t(W).unresolvedCount.value), 1)) : f("", !0)
901
- ], 12, wo)) : f("", !0),
902
- yt.value && ye.value ? (c(), g("div", {
903
- key: 2,
904
- ref_key: "aiMenuRef",
905
- ref: ze,
906
- class: "tpl:relative"
907
- }, [
908
- n("button", {
909
- "aria-expanded": J.value,
910
- class: Qe(["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", Ct.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
911
- onClick: Vt(_t, ["stop"])
912
- }, [
913
- d(t(Vl), {
914
- size: 16,
915
- "stroke-width": 2,
916
- class: "tpl-ai-btn-icon"
917
- }),
918
- Y(" " + k(t(u).aiChat.button), 1)
919
- ], 10, Bo),
920
- d(re, {
921
- "enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
922
- "enter-from-class": "tpl:scale-95 tpl:opacity-0",
923
- "enter-to-class": "tpl:scale-100 tpl:opacity-100",
924
- "leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
925
- "leave-from-class": "tpl:scale-100 tpl:opacity-100",
926
- "leave-to-class": "tpl:scale-95 tpl:opacity-0"
927
- }, {
928
- default: ie(() => [
929
- J.value ? (c(), g("div", Co, [
930
- d(t(K), {
931
- "active-feature": Bt.value,
932
- onSelect: St
933
- }, null, 8, ["active-feature"])
934
- ])) : f("", !0)
935
- ]),
936
- _: 1
937
- })
938
- ], 512)) : f("", !0),
939
- t(A).isEnabled.value && kt.value ? (c(), g("button", {
940
- key: 3,
941
- class: "tpl-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3.5 tpl:py-2 tpl:text-sm tpl:font-medium tpl:whitespace-nowrap tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-white tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
942
- style: { "background-color": "transparent", color: "var(--tpl-primary)", "border-color": "var(--tpl-primary)" },
943
- disabled: t(A).isSending.value || !ye.value,
944
- onClick: o[1] || (o[1] = (s) => de.value = !0)
945
- }, [
946
- t(A).isSending.value ? (c(), U(t(Ze), {
947
- key: 1,
948
- class: "tpl-spinner",
949
- size: 16,
950
- "stroke-width": 2
951
- })) : (c(), U(t(eo), {
952
- key: 0,
953
- size: 16,
954
- "stroke-width": 2
955
- })),
956
- Y(" " + k(t(u).testEmail.button), 1)
957
- ], 8, _o)) : f("", !0),
958
- n("button", {
959
- class: "tpl-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3.5 tpl:py-2 tpl:text-sm tpl:font-medium tpl:whitespace-nowrap tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-white tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
960
- style: { "background-color": "transparent", color: "var(--tpl-primary)", "border-color": "var(--tpl-primary)" },
961
- disabled: t(l).state.isSaving || se.value || !t(l).state.isDirty,
962
- onClick: o[2] || (o[2] = (s) => ke())
963
- }, [
964
- !t(l).state.isSaving && !se.value ? (c(), U(t(Zl), {
965
- key: 0,
966
- size: 16,
967
- "stroke-width": 2
968
- })) : (c(), U(t(Ze), {
969
- key: 1,
970
- class: "tpl-spinner",
971
- size: 16,
972
- "stroke-width": 2
973
- })),
974
- Y(" " + k(t(l).state.isSaving || se.value ? t(u).header.saving : t(u).header.save), 1)
975
- ], 8, So)
976
- ])
977
- ]),
978
- Ie.value ? (c(), g("div", Mo, [
979
- n("div", Eo, [
980
- d(t(Yl), {
981
- size: 18,
982
- "stroke-width": 2,
983
- style: { color: "var(--tpl-primary)" }
984
- }),
985
- n("span", null, k(t(u).snapshotPreview.message), 1)
986
- ]),
987
- n("div", Io, [
988
- n("button", {
989
- class: "tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150",
990
- style: { "background-color": "transparent", color: "var(--tpl-text-muted)", border: "1px solid var(--tpl-border)" },
991
- onClick: bt
992
- }, k(t(u).snapshotPreview.cancel), 1),
993
- n("button", {
994
- 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",
995
- style: { "background-color": "var(--tpl-primary)", color: "var(--tpl-bg)" },
996
- onClick: gt
997
- }, k(t(u).snapshotPreview.restore), 1)
998
- ])
999
- ])) : f("", !0),
1000
- d(re, {
1001
- "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
1002
- "enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
1003
- "enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
1004
- "leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
1005
- "leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
1006
- "leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
1007
- }, {
1008
- default: ie(() => [
1009
- be.value ? (c(), g("div", Do, k(t(u).history.collabWarning), 1)) : f("", !0)
1010
- ]),
1011
- _: 1
1012
- }),
1013
- Xe(d(Wl, null, null, 512), [
1014
- [Ye, !t(l).state.previewMode]
1015
- ]),
1016
- n("div", {
1017
- class: Qe(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto tpl:transition-all tpl:duration-300", [
1018
- t(l).state.previewMode ? "tpl:left-0 tpl:right-0" : Fe.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]",
1019
- Ie.value ? "tpl:top-[104px]" : "tpl:top-14"
1020
- ]]),
1021
- style: { "transition-timing-function": "cubic-bezier(0.34, 1.56, 0.64, 1)", "background-color": "var(--tpl-canvas-bg)" }
1022
- }, [
1023
- n("div", To, [
1024
- d(re, { name: "tpl-restore-btn" }, {
1025
- default: ie(() => [
1026
- t(G).hasHiddenBlocks.value ? (c(), g("button", {
1027
- key: 0,
1028
- 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",
1029
- style: { "background-color": "var(--tpl-warning-light)", color: "var(--tpl-warning)", "border-color": "var(--tpl-warning)", "backdrop-filter": "blur(8px)" },
1030
- onClick: o[3] || (o[3] = (s) => t(G).reset())
1031
- }, [
1032
- d(t(ql), {
1033
- size: 13,
1034
- "stroke-width": 2
1035
- }),
1036
- Y(" " + k(t(u).blockSettings.restoreHiddenBlocks), 1)
1037
- ])) : f("", !0)
1038
- ]),
1039
- _: 1
1040
- })
1041
- ]),
1042
- n("main", zo, [
1043
- d(Jl, {
1044
- viewport: t(l).state.viewport,
1045
- content: t(l).content.value,
1046
- "selected-block-id": t(l).state.selectedBlockId,
1047
- "dark-mode": t(l).state.darkMode,
1048
- "preview-mode": t(l).state.previewMode,
1049
- "locked-blocks": ((r = t(w)) == null ? void 0 : r.lockedBlocks.value) ?? void 0,
1050
- onSelectBlock: t(l).selectBlock,
1051
- onOpenAiChat: o[4] || (o[4] = (s) => S.value = !0),
1052
- onOpenDesignReference: o[5] || (o[5] = (s) => M.value = !0)
1053
- }, null, 8, ["viewport", "content", "selected-block-id", "dark-mode", "preview-mode", "locked-blocks", "onSelectBlock"])
1054
- ])
1055
- ], 2),
1056
- Xe(d(Kl, {
1057
- "selected-block": t(l).selectedBlock.value,
1058
- settings: t(l).content.value.settings,
1059
- "shifted-left": Fe.value,
1060
- onUpdateBlock: o[6] || (o[6] = (s) => t(l).updateBlock(t(l).selectedBlock.value.id, s)),
1061
- onDeleteBlock: o[7] || (o[7] = (s) => t(ge).deleteBlock(t(l).selectedBlock.value.id)),
1062
- onDuplicateBlock: o[8] || (o[8] = (s) => t(ge).duplicateBlock(t(l).selectedBlock.value)),
1063
- onUpdateSettings: t(l).updateSettings
1064
- }, null, 8, ["selected-block", "settings", "shifted-left", "onUpdateSettings"]), [
1065
- [Ye, !t(l).state.previewMode]
1066
- ]),
1067
- !le.value && pe.value ? (c(), g(Ge, { key: 1 }, [
1068
- d(t(T), {
1069
- visible: S.value,
1070
- "on-apply": (s) => {
1071
- t(B).record(), t(l).setContent(s), t(G).reset();
1072
- },
1073
- onClose: o[9] || (o[9] = (s) => S.value = !1)
1074
- }, null, 8, ["visible", "on-apply"]),
1075
- d(t(ee), {
1076
- visible: I.value,
1077
- onClose: o[10] || (o[10] = (s) => I.value = !1)
1078
- }, null, 8, ["visible"]),
1079
- d(t(P), {
1080
- visible: M.value,
1081
- "has-existing-blocks": t(l).content.value.blocks.length > 0,
1082
- onClose: o[11] || (o[11] = (s) => M.value = !1),
1083
- onApply: o[12] || (o[12] = (s) => {
1084
- t(B).record(), t(l).setContent(s), t(G).reset();
1085
- })
1086
- }, null, 8, ["visible", "has-existing-blocks"]),
1087
- d(t(E), {
1088
- ref_key: "commentsSidebarRef",
1089
- ref: $e,
1090
- visible: _.value,
1091
- onClose: o[13] || (o[13] = (s) => _.value = !1)
1092
- }, null, 8, ["visible"]),
1093
- d(t(N), {
1094
- visible: de.value,
1095
- "allowed-emails": t(A).allowedEmails.value,
1096
- "is-sending": t(A).isSending.value,
1097
- error: t(A).error.value,
1098
- onSend: Mt,
1099
- onClose: o[14] || (o[14] = (s) => de.value = !1)
1100
- }, null, 8, ["visible", "allowed-emails", "is-sending", "error"]),
1101
- t(v).hasFeature("saved_modules") && a.config.modules !== !1 ? (c(), U(t(te), {
1102
- key: 0,
1103
- visible: t(q).showSaveDialog.value ?? !1,
1104
- "pre-selected-block-id": t(q).preSelectedBlockId.value ?? null,
1105
- onClose: o[15] || (o[15] = (s) => t(q).closeSaveDialog()),
1106
- onSaved: o[16] || (o[16] = (s) => t(ce).loadModules())
1107
- }, null, 8, ["visible", "pre-selected-block-id"])) : f("", !0),
1108
- t(v).hasFeature("saved_modules") && a.config.modules !== !1 ? (c(), U(t(ve), {
1109
- key: 1,
1110
- visible: t(q).showBrowserModal.value ?? !1,
1111
- onClose: o[17] || (o[17] = (s) => t(q).closeBrowserModal()),
1112
- onInsert: Et
1113
- }, null, 8, ["visible"])) : f("", !0),
1114
- d(t(V), {
1115
- visible: ue.value,
1116
- accept: Te.value,
1117
- onSelect: Tt,
1118
- onClose: zt
1119
- }, null, 8, ["visible", "accept"])
1120
- ], 64)) : f("", !0)
1121
- ], 4);
1122
- };
1123
- }
1124
- }), $o = /* @__PURE__ */ Xl(Fo, [["__scopeId", "data-v-c9ad0762"]]), jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1125
- __proto__: null,
1126
- default: $o
1127
- }, Symbol.toStringTag, { value: "Module" }));
1128
- export {
1129
- Yl as C,
1130
- eo as S,
1131
- jo as a
1132
- };