@boxcc/maildeno-editor 0.0.0-stage → 0.4.13

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 (57) hide show
  1. package/CHANGELOG.md +479 -0
  2. package/README.md +441 -2
  3. package/dist/DatePicker-AdfGW0Tw.js +5347 -0
  4. package/dist/DatePicker-aNFlsoOb.js +5347 -0
  5. package/dist/Dialog-By0JLN8s.js +6294 -0
  6. package/dist/HealthIndicator-4Iw6N-g_.js +1216 -0
  7. package/dist/HealthIndicator-ZohgzF2_.js +1217 -0
  8. package/dist/PopperContent-N2nAEFeH.js +2538 -0
  9. package/dist/PopperContent-eLmz1Gjd.js +2578 -0
  10. package/dist/PreviewCanvas-DzpLghCo.js +534 -0
  11. package/dist/PreviewCanvas-QN4C68KA.js +534 -0
  12. package/dist/RichTextEditor-CmM4XRFC.js +12218 -0
  13. package/dist/RichTextEditor-Cz1-_ZtA.js +12217 -0
  14. package/dist/RowPreviewChildren-BYaMZID3.js +4 -0
  15. package/dist/RowPreviewChildren-_A9gPQCs.js +4 -0
  16. package/dist/RowPreviewLegacyComponent-Df_1HTly.js +403 -0
  17. package/dist/RowPreviewLegacyComponent-NECG3wpn.js +403 -0
  18. package/dist/RowPreviewRow-DPaSbxmB.js +81 -0
  19. package/dist/RowPreviewRow-Dx4ExtSN.js +81 -0
  20. package/dist/SavedRowsPanel-DqSHB6Jk.js +492 -0
  21. package/dist/SavedRowsPanel-DyXjSOEt.js +493 -0
  22. package/dist/_plugin-vue_export-helper-Dj7HTbfw.js +8 -0
  23. package/dist/adapters/errors.d.ts +59 -0
  24. package/dist/adapters/localStorageAdapter.d.ts +6 -0
  25. package/dist/adapters/types.d.ts +151 -0
  26. package/dist/babel-DV7WPQI0.js +10043 -0
  27. package/dist/blocks/registry.d.ts +23 -0
  28. package/dist/blocks/types.d.ts +73 -0
  29. package/dist/borderRadius-CkSa1lQ9.js +75 -0
  30. package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +182 -0
  31. package/dist/composables/emailBuilder/export/logic/espLogicWrapper.d.ts +76 -0
  32. package/dist/composables/emailBuilder/persistence/useEmailBuilderPersistence.d.ts +38 -0
  33. package/dist/composables/emailBuilder/transform/pipeline/optimize.d.ts +100 -0
  34. package/dist/composables/system/useColorScheme.d.ts +16 -0
  35. package/dist/element-B3gq8Xvd.js +21500 -0
  36. package/dist/element.d.ts +6 -0
  37. package/dist/element.js +5 -0
  38. package/dist/esp/registry.d.ts +33 -0
  39. package/dist/estree-DY9POgc0.js +8195 -0
  40. package/dist/html-wb0gSX1o.js +7273 -0
  41. package/dist/index.d.ts +17 -0
  42. package/dist/index.js +14992 -0
  43. package/dist/init.d.ts +178 -0
  44. package/dist/init.js +137 -0
  45. package/dist/maildeno-editor.css +2 -0
  46. package/dist/merge-tags/registry.d.ts +33 -0
  47. package/dist/mergeTagDefinitions-Cler19nv.js +27 -0
  48. package/dist/standalone-DHvJ30Td.js +3554 -0
  49. package/dist/theme.d.ts +206 -0
  50. package/dist/types/assistant.d.ts +56 -0
  51. package/dist/useEmailBuilder-B19p-2yp.js +4924 -0
  52. package/dist/useEmailBuilder-BR4wfai1.js +4924 -0
  53. package/dist/useToast-DD11IxqP.js +194 -0
  54. package/dist/utils/border.d.ts +15 -0
  55. package/dist/utils/borderRadius.d.ts +10 -0
  56. package/dist/vue.runtime.esm-bundler-D2AjRP90.js +6117 -0
  57. package/package.json +100 -4
@@ -0,0 +1,4924 @@
1
+ import { c as de, o as At, r as Y, s as ue, t as ee } from "./borderRadius-CkSa1lQ9.js";
2
+ import { computed as Ce, inject as Oe, nextTick as ye, onUnmounted as dr, provide as Ie, ref as P, shallowRef as pr, watch as hn, watchEffect as mr } from "vue";
3
+ var ot = (e) => e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "untitled_template";
4
+ function vn(e) {
5
+ if (!e || typeof e != "object") throw new Error("Unrecognized template file format");
6
+ if (e.template_id && e.template_name && e.canvas && e.rows && e.schema_version) {
7
+ if (e.schema_version !== "1.0") {
8
+ const [t] = String(e.schema_version).split(".").map(Number), [r] = "1.0".split(".").map(Number);
9
+ if (t > r) throw new Error(`Template schema version ${e.schema_version} is newer than supported version 1.0`);
10
+ e.schema_version = "1.0";
11
+ }
12
+ return e;
13
+ }
14
+ if (e.meta && e.canvas && e.content?.rows) {
15
+ const t = e.meta.name || "Untitled Template";
16
+ return {
17
+ template_id: ot(t),
18
+ template_name: t,
19
+ canvas: e.canvas,
20
+ rows: e.content.rows,
21
+ schema_version: "1.0"
22
+ };
23
+ }
24
+ if (e.canvas && e.content?.rows) return {
25
+ template_id: ot("Untitled Template"),
26
+ template_name: "Untitled Template",
27
+ canvas: e.canvas,
28
+ rows: e.content.rows,
29
+ schema_version: "1.0"
30
+ };
31
+ if (!e.meta && e.canvasStyles && e.rows) {
32
+ const t = "Untitled Template";
33
+ return {
34
+ template_id: ot(t),
35
+ template_name: t,
36
+ canvas: e.canvasStyles,
37
+ rows: e.rows,
38
+ schema_version: "1.0"
39
+ };
40
+ }
41
+ throw new Error("Unrecognized template file format");
42
+ }
43
+ var K = () => crypto.randomUUID().replace(/-/g, "").slice(0, 16), Se = "maildeno:product-rows", Le = "maildeno:template:", kt = "maildeno:versions:", en = 20;
44
+ function bn(e) {
45
+ const t = JSON.parse(JSON.stringify(e));
46
+ return t.id = K(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
47
+ const n = r.children ?? r.components ?? [], a = {
48
+ ...r,
49
+ id: K(),
50
+ children: n.map((i) => bn(i))
51
+ };
52
+ return delete a.components, a;
53
+ })), t;
54
+ }
55
+ function fe(e) {
56
+ try {
57
+ const t = localStorage.getItem(e);
58
+ return t ? JSON.parse(t) : null;
59
+ } catch {
60
+ return null;
61
+ }
62
+ }
63
+ function De(e, t) {
64
+ localStorage.setItem(e, JSON.stringify(t));
65
+ }
66
+ function $n() {
67
+ async function e(s) {
68
+ return s ? fe(Le + s) : null;
69
+ }
70
+ async function t(s, S) {
71
+ const C = S || K();
72
+ try {
73
+ const _ = fe(Le + C);
74
+ _ && b(C, _);
75
+ } catch (_) {
76
+ console.warn("[maildeno-editor] couldn't record a template version:", _);
77
+ }
78
+ return De(Le + C, {
79
+ ...s,
80
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
81
+ }), { templateId: C };
82
+ }
83
+ async function r() {
84
+ const s = [];
85
+ for (let S = 0; S < localStorage.length; S++) {
86
+ const C = localStorage.key(S);
87
+ if (!C?.startsWith(Le)) continue;
88
+ const _ = fe(C);
89
+ s.push({
90
+ templateId: C.slice(18),
91
+ name: _?.name,
92
+ updatedAt: _?.updatedAt
93
+ });
94
+ }
95
+ return s.sort((S, C) => (C.updatedAt ?? "").localeCompare(S.updatedAt ?? ""));
96
+ }
97
+ async function n(s) {
98
+ localStorage.removeItem(Le + s), localStorage.removeItem(kt + s);
99
+ }
100
+ function a(s) {
101
+ return fe(kt + s) ?? [];
102
+ }
103
+ function i(s, S) {
104
+ De(kt + s, S);
105
+ }
106
+ async function o(s) {
107
+ return a(s).map(({ snapshot: S, ...C }) => C);
108
+ }
109
+ async function l(s, S) {
110
+ return a(s).find((C) => C.versionId === S)?.snapshot ?? null;
111
+ }
112
+ async function c(s, S) {
113
+ i(s, a(s).filter((C) => C.versionId !== S));
114
+ }
115
+ async function d(s) {
116
+ i(s, a(s).filter((S) => S.kept));
117
+ }
118
+ async function v(s, S, C) {
119
+ i(s, a(s).map((_) => _.versionId === S ? {
120
+ ..._,
121
+ kept: C
122
+ } : _));
123
+ }
124
+ function b(s, S) {
125
+ const C = a(s);
126
+ C.unshift({
127
+ versionId: K(),
128
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
129
+ kept: !1,
130
+ snapshot: S
131
+ });
132
+ const _ = C.filter((g) => !g.kept);
133
+ if (_.length > en) {
134
+ const g = new Set(_.slice(en).map((m) => m.versionId));
135
+ i(s, C.filter((m) => !g.has(m.versionId)));
136
+ return;
137
+ }
138
+ i(s, C);
139
+ }
140
+ async function E() {
141
+ return fe(Se) ?? [];
142
+ }
143
+ async function w() {
144
+ return [];
145
+ }
146
+ async function R(s, S) {
147
+ const C = fe(Se) ?? [], _ = {
148
+ id: K(),
149
+ name: S.trim() || `Row ${C.length + 1}`,
150
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
151
+ row: JSON.parse(JSON.stringify(s))
152
+ };
153
+ return De(Se, [_, ...C]), _;
154
+ }
155
+ async function M(s) {
156
+ const S = fe(Se) ?? [];
157
+ De(Se, S.filter((C) => C.id !== s));
158
+ }
159
+ async function O(s, S) {
160
+ const C = fe(Se) ?? [];
161
+ De(Se, C.map((_) => _.id === s ? {
162
+ ..._,
163
+ name: S.trim() || _.name
164
+ } : _));
165
+ }
166
+ function p(s) {
167
+ const S = (fe(Se) ?? []).find((C) => C.id === s);
168
+ return S ? bn(S.row) : null;
169
+ }
170
+ async function u(s) {
171
+ return new Promise((S, C) => {
172
+ const _ = new FileReader();
173
+ _.onload = () => S(_.result), _.onerror = () => C(_.error), _.readAsDataURL(s);
174
+ });
175
+ }
176
+ return {
177
+ loadTemplate: e,
178
+ saveTemplate: t,
179
+ listTemplates: r,
180
+ deleteTemplate: n,
181
+ listTemplateVersions: o,
182
+ getTemplateVersion: l,
183
+ deleteTemplateVersion: c,
184
+ deleteAllTemplateVersions: d,
185
+ setTemplateVersionKept: v,
186
+ listSavedRows: E,
187
+ listSystemSavedRows: w,
188
+ saveSavedRow: R,
189
+ deleteSavedRow: M,
190
+ renameSavedRow: O,
191
+ cloneSavedRowForCanvas: p,
192
+ uploadImage: u
193
+ };
194
+ }
195
+ var yn = /* @__PURE__ */ Symbol("maildeno-editor:storage-adapter");
196
+ function fr(e) {
197
+ const t = $n();
198
+ if (!e) return t;
199
+ const r = { ...t };
200
+ for (const [n, a] of Object.entries(e)) typeof a == "function" && (r[n] = a);
201
+ return r;
202
+ }
203
+ var Sn = /* @__PURE__ */ Symbol("maildeno-editor:can-save");
204
+ function gr() {
205
+ return Oe(Sn, Ce(() => !0));
206
+ }
207
+ function Wa(e) {
208
+ Ie(Sn, e);
209
+ }
210
+ var kn = /* @__PURE__ */ Symbol("maildeno-editor:has-template-library");
211
+ function Va() {
212
+ return Oe(kn, !0);
213
+ }
214
+ function Ka(e) {
215
+ const t = fr(e);
216
+ return Ie(yn, t), Ie(kn, !e || typeof e.listTemplates == "function"), t;
217
+ }
218
+ var hr = () => {
219
+ const e = Oe(yn);
220
+ return e || (console.warn("[maildeno-editor] useStorageAdapter() couldn't find a provided adapter — falling back to the default localStorage adapter. If you passed a custom storageAdapter, it wasn't picked up; please report this."), $n());
221
+ }, wn = /* @__PURE__ */ Symbol("maildeno-editor:saved-row-capabilities");
222
+ function Ya(e) {
223
+ Ie(wn, e);
224
+ }
225
+ function Xa() {
226
+ return Oe(wn, Ce(() => ({})));
227
+ }
228
+ var dt = pr(null), Rt = P(!1);
229
+ function Ot() {
230
+ Rt.value = !1, setTimeout(() => {
231
+ Rt.value || (dt.value = null);
232
+ }, 200);
233
+ }
234
+ function Qa() {
235
+ const e = dt.value;
236
+ Ot(), e?.accept?.();
237
+ }
238
+ function Za() {
239
+ const e = dt.value;
240
+ Ot(), e?.reject?.();
241
+ }
242
+ function vr() {
243
+ return {
244
+ require(e) {
245
+ dt.value = e, Rt.value = !0;
246
+ },
247
+ close: Ot
248
+ };
249
+ }
250
+ var _e = () => ({
251
+ enabled: !1,
252
+ match: "all",
253
+ rules: []
254
+ }), Et = () => ({
255
+ desktopHide: !1,
256
+ mobileHide: !1
257
+ }), ae = () => ({
258
+ visibility: _e(),
259
+ ...Et()
260
+ }), br = Object.freeze({
261
+ enabled: !1,
262
+ match: "all",
263
+ rules: []
264
+ }), $r = Object.freeze({
265
+ desktopHide: !1,
266
+ mobileHide: !1
267
+ }), eo = Object.freeze({
268
+ visibility: br,
269
+ ...$r
270
+ }), wt = (e) => ({
271
+ useGradient: !1,
272
+ solid: e,
273
+ gradient: {
274
+ type: "linear",
275
+ direction: "to right",
276
+ colors: [{
277
+ color: e,
278
+ position: 0
279
+ }, {
280
+ color: "#00ff88",
281
+ position: 100
282
+ }]
283
+ }
284
+ }), Ye = () => ({
285
+ useGradient: !1,
286
+ solid: "transparent",
287
+ gradient: {
288
+ type: "linear",
289
+ direction: "to right",
290
+ colors: [{
291
+ color: "#ffffff",
292
+ position: 0
293
+ }, {
294
+ color: "#eeeeee",
295
+ position: 100
296
+ }]
297
+ }
298
+ }), jt = () => ({ defaultProps: {
299
+ paragraph: {
300
+ content: "Enter your paragraph text here",
301
+ fontSize: 16,
302
+ lineHeight: 1.5,
303
+ color: "#111111",
304
+ fontWeight: "normal",
305
+ fontFamily: "Arial",
306
+ fontStyle: "normal",
307
+ letterSpacing: 0,
308
+ backgroundColor: "transparent",
309
+ backgroundGradient: Ye(),
310
+ margin: {
311
+ top: 0,
312
+ right: 0,
313
+ bottom: 0,
314
+ left: 0
315
+ },
316
+ padding: {
317
+ top: 0,
318
+ right: 0,
319
+ bottom: 0,
320
+ left: 0
321
+ },
322
+ textTransform: "none",
323
+ textDecoration: "none",
324
+ align: "left",
325
+ mobile: {
326
+ fontSize: null,
327
+ lineHeight: null,
328
+ color: null,
329
+ fontWeight: null,
330
+ fontFamily: null,
331
+ fontStyle: null,
332
+ letterSpacing: null,
333
+ backgroundColor: null,
334
+ backgroundGradient: null,
335
+ textTransform: null,
336
+ textDecoration: null,
337
+ align: null,
338
+ margin: null,
339
+ padding: null
340
+ },
341
+ ...ae()
342
+ },
343
+ heading: {
344
+ content: "Heading Text",
345
+ level: "h2",
346
+ fontSize: 32,
347
+ lineHeight: 1.2,
348
+ color: "#111111",
349
+ fontWeight: "bold",
350
+ fontFamily: "Arial",
351
+ letterSpacing: 0,
352
+ backgroundColor: "transparent",
353
+ backgroundGradient: Ye(),
354
+ margin: {
355
+ top: 0,
356
+ right: 0,
357
+ bottom: 0,
358
+ left: 0
359
+ },
360
+ padding: {
361
+ top: 0,
362
+ right: 0,
363
+ bottom: 0,
364
+ left: 0
365
+ },
366
+ textTransform: "none",
367
+ textDecoration: "none",
368
+ align: "left",
369
+ mobile: {
370
+ fontSize: null,
371
+ lineHeight: null,
372
+ color: null,
373
+ fontWeight: null,
374
+ fontFamily: null,
375
+ letterSpacing: null,
376
+ backgroundColor: null,
377
+ backgroundGradient: null,
378
+ textTransform: null,
379
+ textDecoration: null,
380
+ align: null,
381
+ margin: null,
382
+ padding: null
383
+ },
384
+ ...ae()
385
+ },
386
+ image: {
387
+ src: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/5bffeaf2.jpeg",
388
+ alt: "Image",
389
+ width: 100,
390
+ height: "auto",
391
+ align: "center",
392
+ link: "https://example.com",
393
+ enabled: !1,
394
+ margin: {
395
+ top: 0,
396
+ right: 0,
397
+ bottom: 0,
398
+ left: 0
399
+ },
400
+ padding: {
401
+ top: 0,
402
+ right: 0,
403
+ bottom: 0,
404
+ left: 0
405
+ },
406
+ borderRadius: 0,
407
+ border: {
408
+ width: 0,
409
+ color: "transparent",
410
+ style: "solid"
411
+ },
412
+ mobile: {
413
+ width: null,
414
+ height: null,
415
+ align: null,
416
+ margin: null,
417
+ padding: null,
418
+ borderRadius: null,
419
+ border: null
420
+ },
421
+ ...ae()
422
+ },
423
+ video: {
424
+ fallbackLink: "https://example.com",
425
+ src: "",
426
+ coverImage: "",
427
+ alt: "Watch video",
428
+ width: 100,
429
+ height: "auto",
430
+ align: "center",
431
+ margin: {
432
+ top: 0,
433
+ right: 0,
434
+ bottom: 0,
435
+ left: 0
436
+ },
437
+ padding: {
438
+ top: 0,
439
+ right: 0,
440
+ bottom: 0,
441
+ left: 0
442
+ },
443
+ borderRadius: 0,
444
+ border: {
445
+ width: 0,
446
+ color: "transparent",
447
+ style: "solid"
448
+ },
449
+ mobile: {
450
+ width: null,
451
+ height: null,
452
+ align: null,
453
+ margin: null,
454
+ padding: null,
455
+ borderRadius: null,
456
+ border: null
457
+ },
458
+ ...ae()
459
+ },
460
+ list: {
461
+ content: "<ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul>",
462
+ fontSize: 16,
463
+ lineHeight: 1.5,
464
+ fontFamily: "Arial",
465
+ letterSpacing: 0,
466
+ color: "#111111",
467
+ backgroundColor: "transparent",
468
+ backgroundGradient: Ye(),
469
+ margin: {
470
+ top: 0,
471
+ right: 0,
472
+ bottom: 0,
473
+ left: 0
474
+ },
475
+ padding: {
476
+ top: 0,
477
+ right: 0,
478
+ bottom: 0,
479
+ left: 20
480
+ },
481
+ itemSpacing: 8,
482
+ mobile: {
483
+ fontSize: null,
484
+ lineHeight: null,
485
+ fontFamily: null,
486
+ letterSpacing: null,
487
+ color: null,
488
+ backgroundColor: null,
489
+ backgroundGradient: null,
490
+ margin: null,
491
+ padding: null,
492
+ itemSpacing: null
493
+ },
494
+ ...ae()
495
+ },
496
+ button: {
497
+ text: "Click Me",
498
+ link: "https://example.com",
499
+ width: "auto",
500
+ height: "auto",
501
+ backgroundColor: "#007bff",
502
+ backgroundGradient: wt("#007bff"),
503
+ color: "#fafafa",
504
+ fontSize: 16,
505
+ fontWeight: "medium",
506
+ fontFamily: "Arial",
507
+ letterSpacing: 0,
508
+ margin: {
509
+ top: 0,
510
+ right: 0,
511
+ bottom: 0,
512
+ left: 0
513
+ },
514
+ padding: {
515
+ top: 12,
516
+ right: 24,
517
+ bottom: 12,
518
+ left: 24
519
+ },
520
+ borderRadius: 4,
521
+ border: {
522
+ width: 0,
523
+ color: "transparent",
524
+ style: "solid"
525
+ },
526
+ align: "center",
527
+ icon: "",
528
+ iconAlt: "",
529
+ iconPosition: "before",
530
+ iconSize: 20,
531
+ iconGap: 8,
532
+ mobile: {
533
+ width: null,
534
+ height: null,
535
+ fontSize: null,
536
+ fontWeight: null,
537
+ fontFamily: null,
538
+ letterSpacing: null,
539
+ backgroundColor: null,
540
+ backgroundGradient: null,
541
+ color: null,
542
+ padding: null,
543
+ margin: null,
544
+ borderRadius: null,
545
+ border: null,
546
+ align: null
547
+ },
548
+ ...ae()
549
+ },
550
+ anchor: {
551
+ text: "Click here",
552
+ link: "https://example.com",
553
+ color: "#007bff",
554
+ fontSize: 16,
555
+ fontWeight: "normal",
556
+ fontFamily: "Arial",
557
+ letterSpacing: 0,
558
+ textDecoration: "underline",
559
+ margin: {
560
+ top: 0,
561
+ right: 0,
562
+ bottom: 0,
563
+ left: 0
564
+ },
565
+ padding: {
566
+ top: 0,
567
+ right: 0,
568
+ bottom: 0,
569
+ left: 0
570
+ },
571
+ align: "left",
572
+ mobile: {
573
+ fontSize: null,
574
+ fontWeight: null,
575
+ fontFamily: null,
576
+ letterSpacing: null,
577
+ color: null,
578
+ textDecoration: null,
579
+ margin: null,
580
+ padding: null,
581
+ align: null
582
+ },
583
+ ...ae()
584
+ },
585
+ divider: {
586
+ backgroundColor: "#cccccc",
587
+ backgroundGradient: wt("#cccccc"),
588
+ height: 1,
589
+ width: 100,
590
+ margin: {
591
+ top: 20,
592
+ right: 0,
593
+ bottom: 20,
594
+ left: 0
595
+ },
596
+ padding: {
597
+ top: 5,
598
+ right: 0,
599
+ bottom: 5,
600
+ left: 0
601
+ },
602
+ align: "center",
603
+ mobile: {
604
+ backgroundColor: null,
605
+ backgroundGradient: null,
606
+ height: null,
607
+ width: null,
608
+ margin: null,
609
+ padding: null,
610
+ align: null
611
+ },
612
+ ...ae()
613
+ },
614
+ spacer: {
615
+ height: 20,
616
+ backgroundColor: "transparent",
617
+ backgroundGradient: wt("transparent"),
618
+ mobile: {
619
+ height: null,
620
+ backgroundColor: null,
621
+ backgroundGradient: null
622
+ },
623
+ ...ae()
624
+ },
625
+ menu: {
626
+ items: [
627
+ {
628
+ label: "Home",
629
+ link: "https://example.com",
630
+ enabled: !0
631
+ },
632
+ {
633
+ label: "About",
634
+ link: "https://example.com",
635
+ enabled: !0
636
+ },
637
+ {
638
+ label: "Contact",
639
+ link: "https://example.com",
640
+ enabled: !0
641
+ }
642
+ ],
643
+ fontSize: 16,
644
+ lineHeight: 1.5,
645
+ fontWeight: "normal",
646
+ fontFamily: "Arial",
647
+ fontStyle: "normal",
648
+ letterSpacing: 0,
649
+ color: "#111111",
650
+ textTransform: "none",
651
+ textDecoration: "none",
652
+ backgroundColor: "transparent",
653
+ backgroundGradient: Ye(),
654
+ spacing: 16,
655
+ align: "center",
656
+ margin: {
657
+ top: 0,
658
+ right: 0,
659
+ bottom: 0,
660
+ left: 0
661
+ },
662
+ padding: {
663
+ top: 0,
664
+ right: 0,
665
+ bottom: 0,
666
+ left: 0
667
+ },
668
+ mobileStack: !1,
669
+ mobile: {
670
+ fontSize: null,
671
+ lineHeight: null,
672
+ fontWeight: null,
673
+ fontFamily: null,
674
+ fontStyle: null,
675
+ letterSpacing: null,
676
+ color: null,
677
+ textTransform: null,
678
+ textDecoration: null,
679
+ backgroundColor: null,
680
+ backgroundGradient: null,
681
+ spacing: null,
682
+ align: null,
683
+ margin: null,
684
+ padding: null
685
+ },
686
+ ...ae()
687
+ },
688
+ socials: {
689
+ platforms: [
690
+ {
691
+ name: "Youtube",
692
+ link: "",
693
+ enabled: !0,
694
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/187d70ab.png"
695
+ },
696
+ {
697
+ name: "Linkedin",
698
+ link: "",
699
+ enabled: !0,
700
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/23e45ac0.png"
701
+ },
702
+ {
703
+ name: "Instagram",
704
+ link: "",
705
+ enabled: !0,
706
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/4e9832e6.png"
707
+ }
708
+ ],
709
+ iconSize: 28,
710
+ spacing: 10,
711
+ align: "center",
712
+ margin: {
713
+ top: 0,
714
+ right: 0,
715
+ bottom: 0,
716
+ left: 0
717
+ },
718
+ padding: {
719
+ top: 0,
720
+ right: 0,
721
+ bottom: 0,
722
+ left: 0
723
+ },
724
+ mobile: {
725
+ iconSize: null,
726
+ spacing: null,
727
+ align: null,
728
+ margin: null,
729
+ padding: null
730
+ },
731
+ ...ae()
732
+ }
733
+ } }), to = (e) => e.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""), no = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), xn = () => `row_${K().slice(0, 4)}`, Fe = (e) => ({
734
+ useGradient: !1,
735
+ solid: e,
736
+ gradient: {
737
+ type: "linear",
738
+ direction: "to right",
739
+ colors: [{
740
+ color: "#ffffff",
741
+ position: 0
742
+ }, {
743
+ color: "#eeeeee",
744
+ position: 100
745
+ }]
746
+ }
747
+ }), he = (e) => e.children ?? e.components ?? [], He = (e) => (e.children || (e.children = e.components ?? []), e.children), zt = (e) => {
748
+ const t = JSON.parse(JSON.stringify(e));
749
+ return t.id = K(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
750
+ const n = r.children ?? r.components ?? [], a = {
751
+ ...r,
752
+ id: K(),
753
+ children: n.map((i) => zt(i))
754
+ };
755
+ return delete a.components, a;
756
+ })), t;
757
+ }, Xe = (e, t) => {
758
+ const r = zt(e);
759
+ if (r.type === "row-spacer") return r;
760
+ const n = e.name ?? xn(), a = new Set(t.map((l) => l.name));
761
+ let i = `${n}_copy`, o = 2;
762
+ for (; a.has(i); )
763
+ i = `${n}_copy_${o}`, o++;
764
+ return r.name = i, r;
765
+ }, yr = (e) => zt(e), ve = (e, t) => {
766
+ for (let r = 0; r < e.length; r++) {
767
+ const n = e[r];
768
+ if (n.id === t) return {
769
+ parentChildren: e,
770
+ index: r,
771
+ element: n
772
+ };
773
+ if (n.type === "row") for (const a of n.columns ?? []) {
774
+ const i = ve(a.children ?? a.components ?? [], t);
775
+ if (i) return i;
776
+ }
777
+ }
778
+ return null;
779
+ }, xe = (e, t) => {
780
+ for (const r of e) {
781
+ if (r.id === t) return r;
782
+ if (r.type === "row" && r.columns) for (const n of r.columns) {
783
+ const a = he(n);
784
+ for (const i of a) {
785
+ if (i.id === t && i.type === "row") return i;
786
+ if (i.type === "row" && i.columns) {
787
+ const o = xe([i], t);
788
+ if (o) return o;
789
+ }
790
+ }
791
+ }
792
+ }
793
+ return null;
794
+ }, re = /* @__PURE__ */ new Map(), tn = (e) => {
795
+ re.clear();
796
+ const t = (r) => {
797
+ for (const n of r)
798
+ if (n?.id && (re.set(n.id, n), n.type === "row" && Array.isArray(n.columns)))
799
+ for (const a of n.columns)
800
+ a?.id && re.set(a.id, a), t(a.children ?? a.components ?? []);
801
+ };
802
+ t(e);
803
+ }, ie = (e) => {
804
+ if (e?.id && (re.set(e.id, e), e.type === "row" && Array.isArray(e.columns)))
805
+ for (const t of e.columns) {
806
+ t?.id && re.set(t.id, t);
807
+ const r = t.children ?? t.components ?? [];
808
+ for (const n of r) ie(n);
809
+ }
810
+ }, it = (e) => {
811
+ if (e?.id && (re.delete(e.id), e.type === "row" && Array.isArray(e.columns)))
812
+ for (const t of e.columns) {
813
+ t?.id && re.delete(t.id);
814
+ const r = t.children ?? t.components ?? [];
815
+ for (const n of r) it(n);
816
+ }
817
+ }, Sr = (e, t, r, n, a = n) => {
818
+ re.size === 0 && Array.isArray(e.value) && e.value.length && tn(e.value);
819
+ const i = (g, m = !1) => {
820
+ let h;
821
+ if (Array.isArray(g)) {
822
+ if (g.reduce((k, A) => k + A, 0) !== 100) {
823
+ console.warn("Column widths must sum to 100%");
824
+ return;
825
+ }
826
+ h = g;
827
+ } else {
828
+ const k = Math.floor(100 / g);
829
+ h = Array(g).fill(k), h[0] += 100 - h.reduce((A, f) => A + f, 0);
830
+ }
831
+ const x = xn(), y = {
832
+ id: `${K()}`,
833
+ type: "row",
834
+ name: x,
835
+ columns: h.map((k, A) => ({
836
+ id: `${K()}-${A}`,
837
+ width: k,
838
+ children: [],
839
+ backgroundColor: "transparent",
840
+ backgroundGradient: Fe("transparent"),
841
+ backgroundImage: "",
842
+ backgroundSize: "cover",
843
+ backgroundPosition: "center center",
844
+ backgroundRepeat: "no-repeat",
845
+ padding: {
846
+ top: 10,
847
+ right: 10,
848
+ bottom: 10,
849
+ left: 10
850
+ },
851
+ border: {
852
+ width: 0,
853
+ style: "solid",
854
+ color: "#000000",
855
+ radius: 0
856
+ },
857
+ verticalAlign: "top"
858
+ })),
859
+ backgroundColor: "#ffffff",
860
+ backgroundGradient: Fe("#ffffff"),
861
+ backgroundImage: "",
862
+ backgroundSize: "cover",
863
+ backgroundPosition: "center center",
864
+ backgroundRepeat: "no-repeat",
865
+ padding: {
866
+ top: 0,
867
+ right: 0,
868
+ bottom: 0,
869
+ left: 0
870
+ },
871
+ border: {
872
+ width: 0,
873
+ style: "solid",
874
+ color: "#000000",
875
+ radius: 0
876
+ },
877
+ minHeight: 0,
878
+ gap: 12,
879
+ mobileStack: !0,
880
+ visibility: _e()
881
+ };
882
+ e.value.push(y);
883
+ const $ = e.value[e.value.length - 1];
884
+ ie($), m || n("add-row");
885
+ }, o = (g, m, h, x) => {
886
+ const y = xe(e.value, g);
887
+ if (!y?.columns) return;
888
+ const $ = y.columns.find((N) => N.id === m);
889
+ if (!$) return;
890
+ let k;
891
+ if (Array.isArray(h)) {
892
+ if (h.reduce((N, F) => N + F, 0) !== 100) {
893
+ console.warn("[addNestedRow] Widths must sum to 100%");
894
+ return;
895
+ }
896
+ k = h;
897
+ } else {
898
+ const N = Math.floor(100 / h);
899
+ k = Array(h).fill(N), k[0] += 100 - k.reduce((F, I) => F + I, 0);
900
+ }
901
+ const A = {
902
+ id: `${K()}`,
903
+ type: "row",
904
+ name: `nested_row_${K().slice(0, 4)}`,
905
+ columns: k.map((N, F) => ({
906
+ id: `${K()}-${F}`,
907
+ width: N,
908
+ children: [],
909
+ backgroundColor: "transparent",
910
+ backgroundGradient: Fe("transparent"),
911
+ backgroundImage: "",
912
+ backgroundSize: "cover",
913
+ backgroundPosition: "center center",
914
+ backgroundRepeat: "no-repeat",
915
+ padding: {
916
+ top: 0,
917
+ right: 0,
918
+ bottom: 0,
919
+ left: 0
920
+ },
921
+ border: {
922
+ width: 0,
923
+ style: "solid",
924
+ color: "#000000",
925
+ radius: 0
926
+ },
927
+ verticalAlign: "top"
928
+ })),
929
+ backgroundColor: "transparent",
930
+ backgroundGradient: Fe("transparent"),
931
+ backgroundImage: "",
932
+ backgroundSize: "cover",
933
+ backgroundPosition: "center center",
934
+ backgroundRepeat: "no-repeat",
935
+ padding: {
936
+ top: 0,
937
+ right: 0,
938
+ bottom: 0,
939
+ left: 0
940
+ },
941
+ border: {
942
+ width: 0,
943
+ style: "solid",
944
+ color: "#000000",
945
+ radius: 0
946
+ },
947
+ minHeight: 0,
948
+ gap: 0,
949
+ mobileStack: !0,
950
+ visibility: _e()
951
+ }, f = He($), B = x !== void 0 && x >= 0 && x <= f.length ? x : f.length;
952
+ f.splice(B, 0, A);
953
+ const z = f[B];
954
+ ie(z), n("add-nested-row");
955
+ }, l = (g) => {
956
+ if (g == null) return null;
957
+ const m = String(g), h = re.get(m);
958
+ if (h && (h.type === "row" || h.type === "row-spacer")) return h;
959
+ const x = xe(e.value, g);
960
+ return x && re.set(m, x), x;
961
+ }, c = (g) => {
962
+ const m = e.value.findIndex((h) => h.id === g);
963
+ if (m !== -1) {
964
+ const [h] = e.value.splice(m, 1);
965
+ it(h), n("delete-row");
966
+ return;
967
+ }
968
+ for (const h of e.value)
969
+ if (h.columns)
970
+ for (const x of h.columns) {
971
+ const y = he(x), $ = ve(y, g);
972
+ if ($) {
973
+ const [k] = $.parentChildren.splice($.index, 1);
974
+ it(k), n("delete-row");
975
+ return;
976
+ }
977
+ }
978
+ }, d = (g, m) => {
979
+ const h = e.value.findIndex((y) => y.id === g);
980
+ if (h !== -1) {
981
+ const y = m === "up" ? h - 1 : h + 1;
982
+ if (y < 0 || y >= e.value.length) return;
983
+ const [$] = e.value.splice(h, 1);
984
+ e.value.splice(y, 0, $), n("move-row");
985
+ return;
986
+ }
987
+ const x = (y) => {
988
+ const $ = y.findIndex((k) => k.id === g);
989
+ if ($ !== -1) {
990
+ const k = m === "up" ? $ - 1 : $ + 1;
991
+ if (k < 0 || k >= y.length) return !0;
992
+ const [A] = y.splice($, 1);
993
+ return y.splice(k, 0, A), n("move-row"), !0;
994
+ }
995
+ for (const k of y) if (k.type === "row" && k.columns) {
996
+ for (const A of k.columns) if (x(A.children ?? A.components ?? [])) return !0;
997
+ }
998
+ return !1;
999
+ };
1000
+ for (const y of e.value)
1001
+ if (y.columns) {
1002
+ for (const $ of y.columns) if (x($.children ?? $.components ?? [])) return;
1003
+ }
1004
+ }, v = (g, m, h, x) => {
1005
+ let y = null;
1006
+ const $ = e.value.findIndex((k) => k.id === g);
1007
+ if ($ !== -1 && (y = e.value.splice($, 1)[0]), !y) {
1008
+ const k = (A) => {
1009
+ const f = A.findIndex((B) => B.id === g);
1010
+ if (f !== -1)
1011
+ return y = A.splice(f, 1)[0], !0;
1012
+ for (const B of A) if (B.type === "row" && B.columns) {
1013
+ for (const z of B.columns) if (k(z.children ?? z.components ?? [])) return !0;
1014
+ }
1015
+ return !1;
1016
+ };
1017
+ for (const A of e.value)
1018
+ if (A.columns) {
1019
+ for (const f of A.columns) if (k(f.children ?? f.components ?? [])) break;
1020
+ if (y) break;
1021
+ }
1022
+ }
1023
+ if (y) {
1024
+ if (h === null) {
1025
+ const k = Math.min(x, e.value.length);
1026
+ e.value.splice(k, 0, y);
1027
+ } else {
1028
+ const k = xe(e.value, m);
1029
+ if (!k?.columns) {
1030
+ e.value.push(y);
1031
+ return;
1032
+ }
1033
+ const A = k.columns.find((z) => z.id === h);
1034
+ if (!A) {
1035
+ e.value.push(y);
1036
+ return;
1037
+ }
1038
+ const f = He(A), B = Math.min(x, f.length);
1039
+ f.splice(B, 0, y);
1040
+ }
1041
+ n("move-nested-row");
1042
+ }
1043
+ }, b = (g, m, h = !1) => {
1044
+ if (g === m) return;
1045
+ const x = e.value[g];
1046
+ e.value.splice(g, 1), e.value.splice(m, 0, x), h || n("reorder-rows");
1047
+ }, E = (g = !1) => {
1048
+ const m = `spacer_${K().slice(0, 4)}`, h = {
1049
+ id: `${K()}`,
1050
+ type: "row-spacer",
1051
+ name: m,
1052
+ height: 20,
1053
+ backgroundColor: "transparent",
1054
+ backgroundGradient: Fe("transparent"),
1055
+ visibility: _e()
1056
+ };
1057
+ e.value.push(h);
1058
+ const x = e.value[e.value.length - 1];
1059
+ ie(x), g || n("add-row-spacer");
1060
+ }, w = (g) => {
1061
+ const m = e.value.findIndex((h) => h.id === g);
1062
+ if (m !== -1) {
1063
+ const h = Xe(e.value[m], e.value);
1064
+ e.value.splice(m + 1, 0, h);
1065
+ const x = e.value[m + 1];
1066
+ ie(x), n("duplicate-row");
1067
+ return;
1068
+ }
1069
+ for (const h of e.value)
1070
+ if (h.columns)
1071
+ for (const x of h.columns) {
1072
+ const y = he(x), $ = ve(y, g);
1073
+ if ($) {
1074
+ const k = Xe($.element, $.parentChildren);
1075
+ $.parentChildren.splice($.index + 1, 0, k);
1076
+ const A = $.parentChildren[$.index + 1];
1077
+ ie(A), n("duplicate-row");
1078
+ return;
1079
+ }
1080
+ }
1081
+ }, R = (g) => {
1082
+ const m = e.value.findIndex((h) => h.id === g);
1083
+ if (m !== -1) {
1084
+ const h = Xe(e.value[m], e.value);
1085
+ e.value.splice(m + 1, 0, h);
1086
+ const x = e.value[m + 1];
1087
+ ie(x), n("duplicate-row-spacer");
1088
+ return;
1089
+ }
1090
+ for (const h of e.value)
1091
+ if (h.columns)
1092
+ for (const x of h.columns) {
1093
+ const y = he(x), $ = ve(y, g);
1094
+ if ($) {
1095
+ const k = Xe($.element, $.parentChildren);
1096
+ $.parentChildren.splice($.index + 1, 0, k);
1097
+ const A = $.parentChildren[$.index + 1];
1098
+ ie(A), n("duplicate-row-spacer");
1099
+ return;
1100
+ }
1101
+ }
1102
+ }, M = (g, m, h) => {
1103
+ const x = xe(e.value, g);
1104
+ if (!x) return;
1105
+ const y = x.columns.find((f) => f.id === m);
1106
+ if (!y) return;
1107
+ const $ = {
1108
+ id: `${K()}`,
1109
+ type: "component",
1110
+ componentType: h,
1111
+ props: JSON.parse(JSON.stringify(r[h]))
1112
+ }, k = He(y);
1113
+ k.push($);
1114
+ const A = k[k.length - 1];
1115
+ ie(A), t.value = A.id, n("add-component");
1116
+ }, O = (g, m, h, x) => {
1117
+ const y = xe(e.value, g);
1118
+ if (!y) return;
1119
+ const $ = y.columns.find((B) => B.id === m);
1120
+ if (!$) return;
1121
+ const k = {
1122
+ id: `${K()}`,
1123
+ type: "component",
1124
+ componentType: h,
1125
+ props: JSON.parse(JSON.stringify(r[h]))
1126
+ }, A = He($);
1127
+ A.splice(x, 0, k);
1128
+ const f = A[x];
1129
+ ie(f), t.value = f.id, n("add-component");
1130
+ }, p = (g) => {
1131
+ for (const m of e.value)
1132
+ if (m.columns)
1133
+ for (const h of m.columns) {
1134
+ const x = he(h), y = ve(x, g);
1135
+ if (y) {
1136
+ const [$] = y.parentChildren.splice(y.index, 1);
1137
+ it($), t.value === g && (t.value = null), n("delete-component");
1138
+ return;
1139
+ }
1140
+ }
1141
+ }, u = (g, m) => {
1142
+ for (const h of e.value)
1143
+ if (h.columns)
1144
+ for (const x of h.columns) {
1145
+ const y = he(x), $ = ve(y, g);
1146
+ if ($) {
1147
+ const { parentChildren: k, index: A } = $, f = m === "up" ? A - 1 : A + 1;
1148
+ if (f >= 0 && f < k.length) {
1149
+ const [B] = k.splice(A, 1);
1150
+ k.splice(f, 0, B), n("move-component");
1151
+ }
1152
+ return;
1153
+ }
1154
+ }
1155
+ }, s = (g, m, h, x) => {
1156
+ let y = null;
1157
+ for (const A of e.value)
1158
+ if (A.columns) {
1159
+ for (const f of A.columns) {
1160
+ const B = he(f), z = ve(B, g);
1161
+ if (z) {
1162
+ y = z.element, z.parentChildren.splice(z.index, 1);
1163
+ break;
1164
+ }
1165
+ }
1166
+ if (y) break;
1167
+ }
1168
+ if (!y) return;
1169
+ const $ = xe(e.value, m);
1170
+ if (!$ || !$.columns) return;
1171
+ const k = $.columns.find((A) => A.id === h);
1172
+ k && (He(k).splice(x, 0, y), n("move-component"));
1173
+ }, S = (g) => {
1174
+ if (g == null) return null;
1175
+ const m = String(g), h = re.get(m);
1176
+ if (h && h.type === "component") return h;
1177
+ for (const x of e.value)
1178
+ if (x.columns)
1179
+ for (const y of x.columns) {
1180
+ const $ = he(y), k = ve($, g);
1181
+ if (k && k.element.type === "component")
1182
+ return re.set(m, k.element), k.element;
1183
+ }
1184
+ return null;
1185
+ };
1186
+ return {
1187
+ addRow: i,
1188
+ addNestedRow: o,
1189
+ findRow: l,
1190
+ deleteRow: c,
1191
+ moveRow: d,
1192
+ moveNestedRow: v,
1193
+ reorderRows: b,
1194
+ addSpacer: E,
1195
+ duplicateRow: w,
1196
+ duplicateRowSpacer: R,
1197
+ addComponent: M,
1198
+ addComponentAtIndex: O,
1199
+ deleteComponent: p,
1200
+ moveComponent: u,
1201
+ moveComponentBetweenColumns: s,
1202
+ findComponent: S,
1203
+ updateComponent: (g, m) => {
1204
+ const h = S(g);
1205
+ h && (Object.assign(h.props, m), a("update-component"));
1206
+ },
1207
+ duplicateComponent: (g) => {
1208
+ for (const m of e.value)
1209
+ if (m.columns)
1210
+ for (const h of m.columns) {
1211
+ const x = he(h), y = ve(x, g);
1212
+ if (y) {
1213
+ const $ = yr(y.element);
1214
+ y.parentChildren.splice(y.index + 1, 0, $);
1215
+ const k = y.parentChildren[y.index + 1];
1216
+ ie(k), t.value = k.id, n("duplicate-component");
1217
+ return;
1218
+ }
1219
+ }
1220
+ },
1221
+ rebuildIdRegistry: () => tn(e.value)
1222
+ };
1223
+ }, Z = null, kr = 600, xt = (e) => JSON.parse(JSON.stringify(e)), wr = () => {
1224
+ const t = P([]), r = P(-1), n = P(0), a = Ce(() => r.value > 0), i = Ce(() => r.value < t.value.length - 1), o = Ce(() => `${r.value + 1} / ${t.value.length}`), l = (E, w = "change", R = !1) => {
1225
+ const M = () => {
1226
+ Z = null, r.value < t.value.length - 1 && (t.value = t.value.slice(0, r.value + 1)), t.value.push({
1227
+ state: xt(E),
1228
+ action: w,
1229
+ timestamp: Date.now()
1230
+ }), r.value++, t.value.length > 100 && (t.value.shift(), r.value--), n.value++;
1231
+ };
1232
+ R ? (Z && (clearTimeout(Z), Z = null), M()) : (Z && clearTimeout(Z), Z = setTimeout(M, kr));
1233
+ }, c = () => a.value ? (Z && (clearTimeout(Z), Z = null), r.value--, n.value++, xt(t.value[r.value].state)) : null, d = () => i.value ? (Z && (clearTimeout(Z), Z = null), r.value++, n.value++, xt(t.value[r.value].state)) : null, v = () => {
1234
+ t.value = [], r.value = -1, n.value++;
1235
+ };
1236
+ return {
1237
+ canUndo: a,
1238
+ canRedo: i,
1239
+ historyStatus: o,
1240
+ saveState: l,
1241
+ undo: c,
1242
+ redo: d,
1243
+ clearHistory: v,
1244
+ initHistory: (E) => {
1245
+ v(), l(E, "initial");
1246
+ },
1247
+ version: n
1248
+ };
1249
+ }, xr = () => {
1250
+ const { saveState: e, undo: t, redo: r, canUndo: n, canRedo: a, historyStatus: i, initHistory: o, version: l } = wr();
1251
+ return {
1252
+ getCurrentState: (R, M) => ({
1253
+ rows: R.value,
1254
+ canvasStyles: M.value
1255
+ }),
1256
+ restoreState: (R, M, O, p, u, s) => {
1257
+ if (!R) return;
1258
+ M.value = R.rows, O.value = R.canvasStyles;
1259
+ const S = /* @__PURE__ */ new Set(), C = (_) => {
1260
+ for (const g of _)
1261
+ if (g?.id && (S.add(String(g.id)), g.type === "row" && Array.isArray(g.columns)))
1262
+ for (const m of g.columns)
1263
+ m?.id && S.add(String(m.id)), C(m.children ?? m.components ?? []);
1264
+ };
1265
+ if (C(R.rows), p.value && !S.has(String(p.value)) && (p.value = null), u.value && !S.has(String(u.value)) && (u.value = null), s.value) {
1266
+ const { rowId: _, columnId: g } = s.value;
1267
+ (!S.has(String(_)) || !S.has(String(g))) && (s.value = null);
1268
+ }
1269
+ },
1270
+ saveToHistory: (R, M = "change", O = !1) => {
1271
+ e(R(), M, O);
1272
+ },
1273
+ undo: (R) => {
1274
+ const M = t();
1275
+ return M ? (R(M), M) : null;
1276
+ },
1277
+ redo: (R) => {
1278
+ const M = r();
1279
+ return M ? (R(M), M) : null;
1280
+ },
1281
+ canUndo: n,
1282
+ canRedo: a,
1283
+ historyStatus: i,
1284
+ initialize: (R) => {
1285
+ o(R);
1286
+ },
1287
+ version: l
1288
+ };
1289
+ }, Cr = (e) => e == null, Pt = (e) => {
1290
+ if (!e || typeof e != "object") return !0;
1291
+ const t = e;
1292
+ return Array.isArray(t.rules) && t.rules.length > 0 ? !1 : t.enabled === !1 && t.match === "all" && t.rules.length === 0;
1293
+ }, Cn = (e) => {
1294
+ if (!e || typeof e != "object") return !0;
1295
+ const t = e;
1296
+ return !t.sides && t.width === 0 && t.style === "solid" && t.color === "#000000" && (t.radius === void 0 || t.radius === 0);
1297
+ }, Ge = (e) => !e || typeof e != "object" ? !0 : e.useGradient === !1, nn = (e) => e === !1, _r = (e) => {
1298
+ if (!e || typeof e != "object") return !0;
1299
+ const t = e;
1300
+ return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
1301
+ }, pt = (e) => {
1302
+ if (!e || typeof e != "object") return !0;
1303
+ const t = e;
1304
+ return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
1305
+ }, Tr = (e) => e === 0, Ar = (e) => e == null || e === "", Rr = (e) => {
1306
+ if (!Array.isArray(e)) return;
1307
+ const t = e.filter((r) => !(r.enabled === !0 && r.link === ""));
1308
+ if (t.length !== 0)
1309
+ return t;
1310
+ }, Er = (e) => {
1311
+ const t = {};
1312
+ for (const [r, n] of Object.entries(e))
1313
+ Cr(n) || r === "backgroundGradient" && Ge(n) || (t[r] = n);
1314
+ return Object.keys(t).length > 0 ? t : void 0;
1315
+ }, Mr = (e) => {
1316
+ const t = { ...e.props };
1317
+ if (e.props.mobile && typeof e.props.mobile == "object") {
1318
+ const r = Er(e.props.mobile);
1319
+ r ? t.mobile = r : delete t.mobile;
1320
+ }
1321
+ if (Pt(e.props.visibility) && delete t.visibility, nn(e.props.desktopHide) && delete t.desktopHide, nn(e.props.mobileHide) && delete t.mobileHide, _r(e.props.margin) && delete t.margin, pt(e.props.padding) && delete t.padding, Ge(e.props.backgroundGradient) && delete t.backgroundGradient, Tr(e.props.letterSpacing) && delete t.letterSpacing, e.props.backgroundImage || (delete t.backgroundImage, delete t.backgroundSize, delete t.backgroundPosition, delete t.backgroundRepeat), "icon" in e.props && Ar(e.props.icon) && (delete t.icon, delete t.iconAlt, delete t.iconPosition, delete t.iconSize, delete t.iconGap), "platforms" in e.props) {
1322
+ const r = Rr(e.props.platforms);
1323
+ r === void 0 ? delete t.platforms : t.platforms = r;
1324
+ }
1325
+ return {
1326
+ id: e.id,
1327
+ type: e.type,
1328
+ ...e.componentType !== void 0 && { componentType: e.componentType },
1329
+ props: t
1330
+ };
1331
+ }, Ir = (e) => e.type === "component" ? Mr(e) : _n(e), Nr = (e) => {
1332
+ const { id: t, width: r, children: n, components: a, ...i } = e, o = { ...i };
1333
+ Cn(e.border) && delete o.border, Ge(e.backgroundGradient) && delete o.backgroundGradient, pt(e.padding) && delete o.padding, e.backgroundImage || (delete o.backgroundImage, delete o.backgroundSize, delete o.backgroundPosition, delete o.backgroundRepeat);
1334
+ const l = (n ?? a ?? []).map(Ir);
1335
+ return {
1336
+ id: t,
1337
+ width: r,
1338
+ ...o,
1339
+ children: l
1340
+ };
1341
+ }, Br = (e) => {
1342
+ const { id: t, type: r, ...n } = e, a = { ...n };
1343
+ Pt(e.visibility) && delete a.visibility, Ge(e.backgroundGradient) && delete a.backgroundGradient;
1344
+ const { height: i, ...o } = a;
1345
+ return {
1346
+ id: t,
1347
+ type: r,
1348
+ height: i,
1349
+ ...o
1350
+ };
1351
+ }, _n = (e) => {
1352
+ if (e.type === "row-spacer") return Br(e);
1353
+ const { id: t, type: r, name: n, columns: a, ...i } = e, o = { ...i };
1354
+ return Pt(e.visibility) && delete o.visibility, Cn(e.border) && delete o.border, Ge(e.backgroundGradient) && delete o.backgroundGradient, pt(e.padding) && delete o.padding, e.backgroundImage || (delete o.backgroundImage, delete o.backgroundSize, delete o.backgroundPosition, delete o.backgroundRepeat), e.minHeight === 0 && delete o.minHeight, {
1355
+ id: t,
1356
+ type: r,
1357
+ ...n !== void 0 && { name: n },
1358
+ ...o,
1359
+ columns: a?.map(Nr)
1360
+ };
1361
+ }, Tn = (e) => {
1362
+ const t = { ...e };
1363
+ return e.bodyBackgroundImage || (delete t.bodyBackgroundImage, delete t.bodyBackgroundSize, delete t.bodyBackgroundPosition, delete t.bodyBackgroundRepeat), pt(e.padding) && delete t.padding, t;
1364
+ }, An = (e) => e.map(_n), Or = {
1365
+ backgroundColor: "#ffffff",
1366
+ backgroundGradient: {
1367
+ useGradient: !1,
1368
+ solid: "#ffffff",
1369
+ gradient: {
1370
+ type: "linear",
1371
+ direction: "to right",
1372
+ colors: [{
1373
+ color: "#ffffff",
1374
+ position: 0
1375
+ }, {
1376
+ color: "#eeeeee",
1377
+ position: 100
1378
+ }]
1379
+ }
1380
+ },
1381
+ backgroundImage: "",
1382
+ backgroundSize: "cover",
1383
+ backgroundPosition: "center center",
1384
+ backgroundRepeat: "no-repeat",
1385
+ padding: {
1386
+ top: 0,
1387
+ right: 0,
1388
+ bottom: 0,
1389
+ left: 0
1390
+ },
1391
+ border: {
1392
+ width: 0,
1393
+ style: "solid",
1394
+ color: "#000000",
1395
+ radius: 0
1396
+ },
1397
+ minHeight: 0,
1398
+ gap: 12,
1399
+ mobileStack: !0,
1400
+ visibility: _e()
1401
+ }, jr = {
1402
+ backgroundColor: "transparent",
1403
+ backgroundGradient: {
1404
+ useGradient: !1,
1405
+ solid: "transparent",
1406
+ gradient: {
1407
+ type: "linear",
1408
+ direction: "to right",
1409
+ colors: [{
1410
+ color: "#ffffff",
1411
+ position: 0
1412
+ }, {
1413
+ color: "#eeeeee",
1414
+ position: 100
1415
+ }]
1416
+ }
1417
+ },
1418
+ visibility: _e()
1419
+ }, zr = {
1420
+ backgroundColor: "transparent",
1421
+ backgroundGradient: {
1422
+ useGradient: !1,
1423
+ solid: "transparent",
1424
+ gradient: {
1425
+ type: "linear",
1426
+ direction: "to right",
1427
+ colors: [{
1428
+ color: "#ffffff",
1429
+ position: 0
1430
+ }, {
1431
+ color: "#eeeeee",
1432
+ position: 100
1433
+ }]
1434
+ }
1435
+ },
1436
+ backgroundImage: "",
1437
+ backgroundSize: "cover",
1438
+ backgroundPosition: "center center",
1439
+ backgroundRepeat: "no-repeat",
1440
+ padding: {
1441
+ top: 0,
1442
+ right: 0,
1443
+ bottom: 0,
1444
+ left: 0
1445
+ },
1446
+ border: {
1447
+ width: 0,
1448
+ style: "solid",
1449
+ color: "#000000",
1450
+ radius: 0
1451
+ },
1452
+ verticalAlign: "top"
1453
+ }, Pr = {
1454
+ language: "en-US",
1455
+ preheaderText: "View this email in your browser",
1456
+ bodyBackgroundColor: "#f9fafb",
1457
+ bodyBackgroundImage: "",
1458
+ bodyBackgroundSize: "cover",
1459
+ bodyBackgroundPosition: "center center",
1460
+ bodyBackgroundRepeat: "no-repeat",
1461
+ backgroundColor: "#ffffff",
1462
+ width: 600,
1463
+ padding: {
1464
+ top: 0,
1465
+ right: 0,
1466
+ bottom: 0,
1467
+ left: 0
1468
+ },
1469
+ mobileBreakpoint: 600
1470
+ }, Lr = (e) => JSON.parse(JSON.stringify(e)), je = (e, t) => {
1471
+ const r = Lr(e);
1472
+ for (const n of Object.keys(t)) {
1473
+ const a = t[n], i = e[n];
1474
+ a != null && (typeof a == "object" && !Array.isArray(a) && typeof i == "object" && i !== null && !Array.isArray(i) ? r[n] = je(i, a) : r[n] = a);
1475
+ }
1476
+ return r;
1477
+ }, rn = (e) => {
1478
+ const { defaultProps: t } = jt(), r = e.componentType ?? e.type, n = t[r];
1479
+ if (!n)
1480
+ return console.warn(`[Hydrator] Unknown component type "${r}" — skipping hydration.`), e;
1481
+ const a = je(n, e.props);
1482
+ if (n.mobile && typeof n.mobile == "object" && (a.mobile = {
1483
+ ...n.mobile,
1484
+ ...a.mobile ?? {}
1485
+ }, a.mobile && !a.mobile.backgroundGradient && (a.mobile.backgroundGradient = n.mobile.backgroundGradient)), a.visibility = a.visibility ?? _e(), a.desktopHide = a.desktopHide ?? Et().desktopHide, a.mobileHide = a.mobileHide ?? Et().mobileHide, a.margin === void 0 && n.margin && (a.margin = { ...n.margin }), a.padding === void 0 && n.padding && (a.padding = { ...n.padding }), a.letterSpacing === void 0 && n.letterSpacing !== void 0 && (a.letterSpacing = n.letterSpacing), a.backgroundGradient) {
1486
+ const i = a.backgroundColor;
1487
+ i && (a.backgroundGradient.solid = i);
1488
+ }
1489
+ return !a.backgroundImage && n.backgroundImage !== void 0 && (a.backgroundImage = n.backgroundImage, a.backgroundSize = n.backgroundSize, a.backgroundPosition = n.backgroundPosition, a.backgroundRepeat = n.backgroundRepeat), "icon" in n && (a.icon = a.icon ?? n.icon, a.iconAlt = a.iconAlt ?? n.iconAlt ?? "", a.iconPosition = a.iconPosition ?? n.iconPosition ?? "before", a.iconSize = a.iconSize ?? n.iconSize ?? 20, a.iconGap = a.iconGap ?? n.iconGap ?? 8), {
1490
+ ...e,
1491
+ type: "component",
1492
+ componentType: r,
1493
+ props: a
1494
+ };
1495
+ }, Dr = (e) => {
1496
+ if (e.type === "component") return rn(e);
1497
+ const { defaultProps: t } = jt();
1498
+ return e.type in t ? rn({
1499
+ ...e,
1500
+ type: "component",
1501
+ componentType: e.type
1502
+ }) : Rn(e);
1503
+ }, Fr = (e) => {
1504
+ const t = e.children ?? e.components ?? [], { components: r, children: n, ...a } = e, i = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: o, backgroundGradient: l, ...c } = zr;
1505
+ let d = je(c, a);
1506
+ return i ? (d.backgroundColor = e.backgroundColor, d.backgroundGradient = e.backgroundGradient) : (d.backgroundColor = o, d.backgroundGradient = l), e.backgroundImage || (d.backgroundImage = "", d.backgroundSize = "cover", d.backgroundPosition = "center center", d.backgroundRepeat = "no-repeat"), {
1507
+ ...d,
1508
+ children: t.map(Dr)
1509
+ };
1510
+ }, Hr = (e) => {
1511
+ const t = je(jr, e);
1512
+ return t.backgroundColor === void 0 && (t.backgroundColor = "transparent"), t;
1513
+ }, Rn = (e) => {
1514
+ if (e.type === "row-spacer") return Hr(e);
1515
+ const { columns: t, ...r } = e, n = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: a, backgroundGradient: i, ...o } = Or;
1516
+ let l = je(o, r);
1517
+ return n ? (l.backgroundColor = e.backgroundColor, l.backgroundGradient = e.backgroundGradient) : (l.backgroundColor = a, l.backgroundGradient = i), e.backgroundImage || (l.backgroundImage = "", l.backgroundSize = "cover", l.backgroundPosition = "center center", l.backgroundRepeat = "no-repeat"), l.minHeight === void 0 && (l.minHeight = 0), Array.isArray(t) && (l.columns = t.map(Fr)), l;
1518
+ }, ct = (e) => {
1519
+ const t = je(Pr, e);
1520
+ return e.bodyBackgroundImage || (t.bodyBackgroundImage = "", t.bodyBackgroundSize = "cover", t.bodyBackgroundPosition = "center center", t.bodyBackgroundRepeat = "no-repeat"), t;
1521
+ }, ut = (e) => e.map(Rn), ge = "maildeno:autosave", Mt = "1.0", an = (e, t, r = null, n, a) => {
1522
+ const i = Date.now();
1523
+ return {
1524
+ schemaVersion: Mt,
1525
+ templateId: r,
1526
+ expiresAt: i + 2592e6,
1527
+ touchedAt: i,
1528
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1529
+ ...n !== void 0 && { name: n },
1530
+ ...a !== void 0 && { tags: a },
1531
+ content: {
1532
+ rows: An(e),
1533
+ canvas: Tn(t)
1534
+ }
1535
+ };
1536
+ }, Ct = null, Ur = () => {
1537
+ const e = P("idle"), t = P(null);
1538
+ return {
1539
+ saveToLocal: (l, c, d = null, v, b) => {
1540
+ e.value = "saving";
1541
+ const E = () => {
1542
+ try {
1543
+ const w = an(l, c, d, v, b);
1544
+ localStorage.setItem(ge, JSON.stringify(w)), t.value = /* @__PURE__ */ new Date(), Ct && clearTimeout(Ct), e.value = "saved", Ct = setTimeout(() => {
1545
+ e.value = "idle";
1546
+ }, 2500);
1547
+ } catch (w) {
1548
+ console.error("[AutoSave] Failed to write to localStorage:", w), e.value = "error", setTimeout(() => {
1549
+ e.value = "idle";
1550
+ }, 3e3);
1551
+ }
1552
+ };
1553
+ typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback(E, { timeout: 2e3 }) : setTimeout(E, 0);
1554
+ },
1555
+ flushSave: (l, c, d = null, v, b) => {
1556
+ try {
1557
+ const E = an(l, c, d, v, b);
1558
+ localStorage.setItem(ge, JSON.stringify(E)), t.value = /* @__PURE__ */ new Date();
1559
+ } catch {
1560
+ }
1561
+ },
1562
+ loadFromLocal: () => {
1563
+ try {
1564
+ const l = localStorage.getItem(ge);
1565
+ if (!l) return null;
1566
+ const c = JSON.parse(l);
1567
+ return c.schemaVersion !== Mt ? (console.warn(`[AutoSave] Schema mismatch (stored=${c.schemaVersion}, current=${Mt}). Discarding.`), localStorage.removeItem(ge), null) : Date.now() > c.expiresAt ? (console.info("[AutoSave] Draft expired. Clearing."), localStorage.removeItem(ge), null) : !c.content?.rows || !c.content?.canvas || !Array.isArray(c.content.rows) ? (console.warn("[AutoSave] Malformed payload. Discarding."), localStorage.removeItem(ge), null) : {
1568
+ rows: ut(c.content.rows),
1569
+ canvas: ct(c.content.canvas),
1570
+ updatedAt: c.updatedAt,
1571
+ templateId: c.templateId ?? null,
1572
+ ...c.name !== void 0 && { name: c.name },
1573
+ ...c.tags !== void 0 && { tags: c.tags }
1574
+ };
1575
+ } catch (l) {
1576
+ return console.error("[AutoSave] Failed to read from localStorage:", l), localStorage.removeItem(ge), null;
1577
+ }
1578
+ },
1579
+ clearLocal: () => {
1580
+ localStorage.removeItem(ge), e.value = "idle", t.value = null;
1581
+ },
1582
+ hasDraft: (l) => {
1583
+ try {
1584
+ const c = localStorage.getItem(ge);
1585
+ if (!c) return !1;
1586
+ const d = JSON.parse(c);
1587
+ return !(Date.now() > d.expiresAt || l !== void 0 && d.templateId !== l);
1588
+ } catch {
1589
+ return !1;
1590
+ }
1591
+ },
1592
+ saveStatus: e,
1593
+ lastSaved: t
1594
+ };
1595
+ }, Lt = (e) => !e || /\{\{.*?\}\}/.test(e) || /^(https?:\/\/|mailto:|tel:)/i.test(e) ? e : `https://${e}`, Dt = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Ft = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Jr = (e) => {
1596
+ if (e == null) return "";
1597
+ const t = String(e);
1598
+ return t.indexOf("&quot;") === -1 ? t : t.replace(/style="([^"]*)"/g, (r, n) => `style="${n.replace(/&quot;/g, "'")}"`);
1599
+ }, Ht = /* @__PURE__ */ new Map();
1600
+ function ro(e, t) {
1601
+ const r = typeof e == "string" ? t : e;
1602
+ if (!r) {
1603
+ console.error("[maildeno-editor] registerBlock was called without a definition.");
1604
+ return;
1605
+ }
1606
+ const n = typeof e == "string" ? e : r.name;
1607
+ if (!n) {
1608
+ console.error("[maildeno-editor] registerBlock needs a name — either as the first argument or as `name` on the definition.");
1609
+ return;
1610
+ }
1611
+ Ht.set(n, {
1612
+ ...r,
1613
+ name: n
1614
+ });
1615
+ }
1616
+ function Ut(e) {
1617
+ return Ht.get(e);
1618
+ }
1619
+ function ao() {
1620
+ return Ht;
1621
+ }
1622
+ var Gr = () => {
1623
+ const e = (n, a) => {
1624
+ if (!(n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2)) {
1625
+ const b = n && typeof n == "object" && n.solid ? n.solid : a;
1626
+ return !b || b === "transparent" ? "" : `background-color:${b};`;
1627
+ }
1628
+ const { type: i, direction: o, colors: l } = n.gradient, c = l.map((b) => `${b.color} ${b.position}%`).join(", "), d = i === "radial" ? `radial-gradient(circle at center, ${c})` : `linear-gradient(${o}, ${c})`, v = n.solid || a || "";
1629
+ return `${v && v !== "transparent" ? `background-color:${v};` : ""}background:${d};`;
1630
+ }, t = (n, a) => n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2 ? {
1631
+ vmlOpen: `
1632
+ <!--[if mso]>
1633
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f"
1634
+ style="mso-width-percent:1000;">
1635
+ <v:fill type="solid" color="${n.solid || a || "#ffffff"}" />
1636
+ <v:textbox style="mso-fit-shape-to-text:true;">
1637
+ <![endif]-->`,
1638
+ vmlClose: `
1639
+ <!--[if mso]>
1640
+ </v:textbox>
1641
+ </v:rect>
1642
+ <![endif]-->`
1643
+ } : {
1644
+ vmlOpen: "",
1645
+ vmlClose: ""
1646
+ };
1647
+ return { generateHTMLComponent: (n) => {
1648
+ const a = n.componentType ?? n.type, { props: i } = n;
1649
+ let o = "";
1650
+ const l = `eb-${n.id}`, c = i.margin ? `margin:${i.margin?.top ?? 0}px ${i.margin?.right ?? 0}px ${i.margin?.bottom ?? 0}px ${i.margin?.left ?? 0}px;` : "", d = i.padding ? `padding:${i.padding?.top ?? 0}px ${i.padding?.right ?? 0}px ${i.padding?.bottom ?? 0}px ${i.padding?.left ?? 0}px;` : "", v = (E, w, R) => {
1651
+ const M = [R ? `${l}-${R}` : l];
1652
+ return E && M.push("desktop-hide"), w && M.push("mobile-hide"), M.join(" ");
1653
+ }, b = Ut(a);
1654
+ return b ? b.renderEmail.html(i, {
1655
+ uid: l,
1656
+ marginStyle: c,
1657
+ paddingStyle: d,
1658
+ escapeHtml: Dt,
1659
+ escapeAttr: Ft,
1660
+ safeUrl: Lt,
1661
+ resolveBgCss: e,
1662
+ resolveBgVml: t,
1663
+ getResponsiveClasses: v,
1664
+ react: null
1665
+ }) : o;
1666
+ } };
1667
+ }, En = (e) => e.replace(/<br\s*\/?>/gi, "<br />"), mt = (e) => e.split(",").map((t) => t.trim().replace(/^'+|'+$/g, "").trim()).join(", "), Mn = (e) => e.replace(/font-family\s*:\s*([^;]+)/gi, (t, r) => `font-family:${mt(r)}`), qr = (e) => e.trim().replace(/-([a-z])/g, (t, r) => r.toUpperCase()), Wr = (e) => e.split(";").map((t) => t.trim()).filter(Boolean).map((t) => {
1668
+ const r = t.indexOf(":");
1669
+ if (r < 0) return null;
1670
+ const n = t.slice(0, r).trim(), a = t.slice(r + 1).trim(), i = n.toLowerCase() === "font-family" ? mt(a) : Mn(a);
1671
+ return `${qr(n)}: "${i}"`;
1672
+ }).filter((t) => t !== null).join(", "), Vr = (e) => e.replace(/\bcontenteditable\s*=\s*(["']?)([^"'\s>]+)\1/gi, (t, r, n) => {
1673
+ const a = n.toLowerCase();
1674
+ return a === "true" || a === "false" ? `contentEditable={${a}}` : `contentEditable="${n}"`;
1675
+ }), Kr = (e) => {
1676
+ let t = Jr(e);
1677
+ return t = En(t), t = Vr(t), t = t.replace(/\bstyle="([^"]*)"/g, (r, n) => `style={{ ${Wr(n)} }}`), t;
1678
+ }, Yr = () => {
1679
+ const e = (r, n) => {
1680
+ if (!(r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2)) {
1681
+ const v = r && typeof r == "object" && r.solid ? r.solid : n;
1682
+ return !v || v === "transparent" ? "" : `background-color:${v};`;
1683
+ }
1684
+ const { type: a, direction: i, colors: o } = r.gradient, l = o.map((v) => `${v.color} ${v.position}%`).join(", "), c = a === "radial" ? `radial-gradient(circle at center, ${l})` : `linear-gradient(${i}, ${l})`, d = r.solid || n || "";
1685
+ return `${d && d !== "transparent" ? `background-color:${d};` : ""}background:${c};`;
1686
+ };
1687
+ return { generateReactEmailComponent: (r) => {
1688
+ const n = r.componentType ?? r.type, { props: a } = r;
1689
+ let i = "";
1690
+ const o = `eb-${r.id}`, l = a.margin ? `margin:${a.margin?.top ?? 0}px ${a.margin?.right ?? 0}px ${a.margin?.bottom ?? 0}px ${a.margin?.left ?? 0}px;` : "", c = a.padding ? `padding:${a.padding?.top ?? 0}px ${a.padding?.right ?? 0}px ${a.padding?.bottom ?? 0}px ${a.padding?.left ?? 0}px;` : "", d = (E, w) => E?.useGradient === !0 && Array.isArray(E?.gradient?.colors) && E.gradient.colors.length >= 2 ? {
1691
+ vmlOpen: "",
1692
+ vmlClose: ""
1693
+ } : {
1694
+ vmlOpen: "",
1695
+ vmlClose: ""
1696
+ }, v = (E, w, R) => {
1697
+ const M = [R ? `${o}-${R}` : o];
1698
+ return E && M.push("desktop-hide"), w && M.push("mobile-hide"), M.join(" ");
1699
+ }, b = Ut(n);
1700
+ return b ? b.renderEmail.reactEmail(a, {
1701
+ uid: o,
1702
+ marginStyle: l,
1703
+ paddingStyle: c,
1704
+ escapeHtml: Dt,
1705
+ escapeAttr: Ft,
1706
+ safeUrl: Lt,
1707
+ resolveBgCss: e,
1708
+ resolveBgVml: d,
1709
+ getResponsiveClasses: v,
1710
+ react: {
1711
+ parseCssString: Xr,
1712
+ parseMarginPaddingDiscrete: Qr,
1713
+ normalizeFontFamily: mt,
1714
+ styleObj: In,
1715
+ normalizeInlineStylesToReact: Kr,
1716
+ buildInlineJsx: Zr
1717
+ }
1718
+ }) : i;
1719
+ } };
1720
+ };
1721
+ function Xr(e) {
1722
+ const t = {};
1723
+ return e.split(";").map((r) => r.trim()).filter(Boolean).forEach((r) => {
1724
+ const n = r.indexOf(":");
1725
+ if (n < 0) return;
1726
+ const a = r.slice(0, n).trim(), i = r.slice(n + 1).trim(), o = a.replace(/-([a-z])/g, (l, c) => c.toUpperCase());
1727
+ t[o] = Mn(i);
1728
+ }), t;
1729
+ }
1730
+ function Qr(e, t) {
1731
+ const r = {};
1732
+ return e && (r.marginTop = `${e?.top ?? 0}px`, r.marginRight = `${e?.right ?? 0}px`, r.marginBottom = `${e?.bottom ?? 0}px`, r.marginLeft = `${e?.left ?? 0}px`), t && (r.paddingTop = `${t?.top ?? 0}px`, r.paddingRight = `${t?.right ?? 0}px`, r.paddingBottom = `${t?.bottom ?? 0}px`, r.paddingLeft = `${t?.left ?? 0}px`), r;
1733
+ }
1734
+ function In(e) {
1735
+ return Object.entries(e).filter(([, t]) => t != null && t !== "").map(([t, r]) => `${t}: "${r}"`).join(", ");
1736
+ }
1737
+ function Zr(e, t, r, n, a) {
1738
+ return `<${e}${a ? `
1739
+ as="${a}"` : ""}
1740
+ className="${t}"
1741
+ style={{ ${In(r)} }}
1742
+ >
1743
+ ${n}
1744
+ </${e}>
1745
+ `;
1746
+ }
1747
+ var Nn = () => {
1748
+ const e = (o, l) => {
1749
+ if (!(o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2)) {
1750
+ const R = o && typeof o == "object" && o.solid ? o.solid : l;
1751
+ return !R || R === "transparent" ? "" : `background-color:${R};`;
1752
+ }
1753
+ const { type: c, direction: d, colors: v } = o.gradient, b = v.map((R) => `${R.color} ${R.position}%`).join(", "), E = c === "radial" ? `radial-gradient(circle at center, ${b})` : `linear-gradient(${d}, ${b})`, w = o.solid || l || "";
1754
+ return `${w && w !== "transparent" ? `background-color:${w};` : ""}background:${E};`;
1755
+ }, t = (o, l) => o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2 ? {
1756
+ vmlOpen: `
1757
+ <!--[if mso]>
1758
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f"
1759
+ style="mso-width-percent:1000;">
1760
+ <v:fill type="solid" color="${o.solid || l || "#ffffff"}" />
1761
+ <v:textbox style="mso-fit-shape-to-text:true;">
1762
+ <![endif]-->`,
1763
+ vmlClose: `
1764
+ <!--[if mso]>
1765
+ </v:textbox>
1766
+ </v:rect>
1767
+ <![endif]-->`
1768
+ } : {
1769
+ vmlOpen: "",
1770
+ vmlClose: ""
1771
+ }, r = (o, l) => o && typeof o == "object" && o.solid && o.solid !== "transparent" ? o.solid : l && l !== "transparent" ? l : "", n = (o) => o ? `${o.top ?? 0}px ${o.right ?? 0}px ${o.bottom ?? 0}px ${o.left ?? 0}px` : "0px";
1772
+ return {
1773
+ generateMJMLComponent: (o) => {
1774
+ const l = o.componentType ?? o.type, { props: c } = o, d = `eb-${o.id}`, v = c.margin ? `margin:${c.margin?.top ?? 0}px ${c.margin?.right ?? 0}px ${c.margin?.bottom ?? 0}px ${c.margin?.left ?? 0}px;` : "", b = c.padding ? `padding:${c.padding?.top ?? 0}px ${c.padding?.right ?? 0}px ${c.padding?.bottom ?? 0}px ${c.padding?.left ?? 0}px;` : "", E = (R, M, O) => {
1775
+ const p = [O ? `${d}-${O}` : d];
1776
+ return R && p.push("desktop-hide"), M && p.push("mobile-hide"), p.join(" ");
1777
+ }, w = Ut(l);
1778
+ return w ? w.renderEmail.mjml(c, {
1779
+ uid: d,
1780
+ marginStyle: v,
1781
+ paddingStyle: b,
1782
+ escapeHtml: Dt,
1783
+ escapeAttr: Ft,
1784
+ safeUrl: Lt,
1785
+ resolveBgCss: e,
1786
+ resolveBgVml: t,
1787
+ getResponsiveClasses: E,
1788
+ react: null
1789
+ }) : "";
1790
+ },
1791
+ assembleMJML: (o, l, c, d, v, b = 600, E = "") => {
1792
+ const w = d ? `<mj-style inline="false">
1793
+ @import url('${d}');
1794
+ </mj-style>` : "", R = `<mj-style inline="false">
1795
+ .desktop-hide { display: none !important; }
1796
+ ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
1797
+ </mj-style>`, M = E.trim() ? `<mj-style inline="false">
1798
+ ${E}
1799
+ </mj-style>` : "", O = v.trim() ? `<mj-style inline="false">
1800
+ @media only screen and (max-width:${b}px) {
1801
+ ${v}
1802
+ }
1803
+ </mj-style>` : "", p = c.bodyBackgroundColor || "#ffffff", u = c.bodyBackgroundImage ? [
1804
+ `background-url="${c.bodyBackgroundImage}"`,
1805
+ `background-size="${c.bodyBackgroundSize || "cover"}"`,
1806
+ `background-position="${c.bodyBackgroundPosition || "center center"}"`,
1807
+ `background-repeat="${c.bodyBackgroundRepeat || "no-repeat"}"`
1808
+ ].join(" ") : "", s = c.backgroundColor || "#ffffff", S = n(c.padding);
1809
+ return `<mjml lang="${c.language}">
1810
+ <mj-head>
1811
+ ${w}
1812
+ <mj-title>${o}</mj-title>
1813
+ <mj-preview>${c.preheaderText} &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp;</mj-preview>
1814
+ <mj-attributes>
1815
+ <mj-all font-family="Arial, sans-serif" />
1816
+ </mj-attributes>
1817
+ <mj-raw>
1818
+ <meta name="color-scheme" content="light dark">
1819
+ <meta name="supported-color-schemes" content="light dark">
1820
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
1821
+ </mj-raw>
1822
+ ${R}
1823
+ ${M}
1824
+ ${O}
1825
+ </mj-head>
1826
+ <mj-body background-color="${p}" width="${c.width ?? 600}px">
1827
+ <mj-wrapper full-width="full-width" ${u} padding="0">
1828
+ <mj-section background-color="${s}" padding="${S}">
1829
+ ${l}
1830
+ </mj-section>
1831
+ </mj-wrapper>
1832
+ </mj-body>
1833
+ </mjml>`;
1834
+ },
1835
+ resolveSolidColor: r,
1836
+ padAttr: n
1837
+ };
1838
+ }, Bn = /* @__PURE__ */ Symbol("maildeno-editor:info-dialog");
1839
+ function oo() {
1840
+ const e = On();
1841
+ return Ie(Bn, e), e;
1842
+ }
1843
+ var ea = () => {
1844
+ const e = Oe(Bn);
1845
+ return e || (console.warn("[maildeno-editor] useInfoDialog() couldn't find a provided instance — falling back to a standalone instance (open() won't visibly show anything)."), On());
1846
+ };
1847
+ function On() {
1848
+ const e = P(!1), t = P("Info"), r = P("");
1849
+ return {
1850
+ visible: e,
1851
+ header: t,
1852
+ message: r,
1853
+ open: (a, i = "Info") => {
1854
+ r.value = a, t.value = i, e.value = !0;
1855
+ }
1856
+ };
1857
+ }
1858
+ var io = ["is_empty", "is_not_empty"], so = ["in", "not_in"], lo = [
1859
+ ">",
1860
+ "<",
1861
+ ">=",
1862
+ "<="
1863
+ ], co = [
1864
+ "date_before",
1865
+ "date_after",
1866
+ "date_on"
1867
+ ], uo = [
1868
+ {
1869
+ label: "Equals ==",
1870
+ value: "=="
1871
+ },
1872
+ {
1873
+ label: "Not Equals !=",
1874
+ value: "!="
1875
+ },
1876
+ {
1877
+ label: "Contains",
1878
+ value: "contains"
1879
+ },
1880
+ {
1881
+ label: "Not Contains",
1882
+ value: "not_contains"
1883
+ },
1884
+ {
1885
+ label: "Starts With",
1886
+ value: "starts_with"
1887
+ },
1888
+ {
1889
+ label: "Ends With",
1890
+ value: "ends_with"
1891
+ },
1892
+ {
1893
+ label: "In List (comma-separated)",
1894
+ value: "in"
1895
+ },
1896
+ {
1897
+ label: "Not In List (comma-separated)",
1898
+ value: "not_in"
1899
+ },
1900
+ {
1901
+ label: "Greater Than > (numeric)",
1902
+ value: ">"
1903
+ },
1904
+ {
1905
+ label: "Less Than < (numeric)",
1906
+ value: "<"
1907
+ },
1908
+ {
1909
+ label: "Greater Than or Equal >=",
1910
+ value: ">="
1911
+ },
1912
+ {
1913
+ label: "Less Than or Equal <=",
1914
+ value: "<="
1915
+ },
1916
+ {
1917
+ label: "Date Before",
1918
+ value: "date_before"
1919
+ },
1920
+ {
1921
+ label: "Date After",
1922
+ value: "date_after"
1923
+ },
1924
+ {
1925
+ label: "Date On",
1926
+ value: "date_on"
1927
+ },
1928
+ {
1929
+ label: "Is Empty",
1930
+ value: "is_empty"
1931
+ },
1932
+ {
1933
+ label: "Is Not Empty",
1934
+ value: "is_not_empty"
1935
+ }
1936
+ ], on = (e) => e.split(/[,\n;]+/).map((t) => t.trim()).filter(Boolean), Qe = (e, t) => [parseFloat(e ?? ""), parseFloat(t)], Ze = (e, t) => !isNaN(e) && !isNaN(t), Ee = (e) => {
1937
+ if (!e?.trim()) return null;
1938
+ const t = /^\d{4}-\d{2}-\d{2}$/.test(e.trim()) ? /* @__PURE__ */ new Date(`${e.trim()}T00:00:00Z`) : new Date(e.trim());
1939
+ return isNaN(t.getTime()) ? null : new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()));
1940
+ }, It = (e, t) => {
1941
+ const r = t[e.tag.toLowerCase()], n = r?.toLowerCase() ?? "", a = e.value.toLowerCase();
1942
+ switch (e.operator) {
1943
+ case "==":
1944
+ return n === a;
1945
+ case "!=":
1946
+ return n !== a;
1947
+ case "contains":
1948
+ return n.includes(a);
1949
+ case "not_contains":
1950
+ return !n.includes(a);
1951
+ case "starts_with":
1952
+ return n.startsWith(a);
1953
+ case "ends_with":
1954
+ return n.endsWith(a);
1955
+ case "in":
1956
+ return on(a).includes(n);
1957
+ case "not_in":
1958
+ return !on(a).includes(n);
1959
+ case ">": {
1960
+ const [i, o] = Qe(r, e.value);
1961
+ return Ze(i, o) && i > o;
1962
+ }
1963
+ case "<": {
1964
+ const [i, o] = Qe(r, e.value);
1965
+ return Ze(i, o) && i < o;
1966
+ }
1967
+ case ">=": {
1968
+ const [i, o] = Qe(r, e.value);
1969
+ return Ze(i, o) && i >= o;
1970
+ }
1971
+ case "<=": {
1972
+ const [i, o] = Qe(r, e.value);
1973
+ return Ze(i, o) && i <= o;
1974
+ }
1975
+ case "date_before": {
1976
+ const i = Ee(r), o = Ee(e.value);
1977
+ return i !== null && o !== null && i.getTime() < o.getTime();
1978
+ }
1979
+ case "date_after": {
1980
+ const i = Ee(r), o = Ee(e.value);
1981
+ return i !== null && o !== null && i.getTime() > o.getTime();
1982
+ }
1983
+ case "date_on": {
1984
+ const i = Ee(r), o = Ee(e.value);
1985
+ return i !== null && o !== null && i.getTime() === o.getTime();
1986
+ }
1987
+ case "is_empty":
1988
+ return r === void 0 || r.trim() === "";
1989
+ case "is_not_empty":
1990
+ return r !== void 0 && r.trim() !== "";
1991
+ default:
1992
+ return !0;
1993
+ }
1994
+ }, sn = (e, t) => {
1995
+ if (!e.rules.length) return !0;
1996
+ const r = e.rules.map((n) => It(n, t));
1997
+ return e.match === "any" ? r.some(Boolean) : r.every(Boolean);
1998
+ }, ft = () => ({
1999
+ evaluateVisibility: (t, r) => {
2000
+ if (!t?.enabled) return !0;
2001
+ const n = t.rules?.length > 0, a = (t.groups?.length ?? 0) > 0;
2002
+ if (!n && !a) return !0;
2003
+ const i = (t.rules ?? []).map((c) => It(c, r)), o = (t.groups ?? []).map((c) => sn(c, r)), l = [...i, ...o];
2004
+ return t.match === "any" ? l.some(Boolean) : l.every(Boolean);
2005
+ },
2006
+ evaluateRule: It,
2007
+ evaluateGroup: sn
2008
+ }), jn = (e) => {
2009
+ const { type: t, direction: r, colors: n } = e.gradient, a = n.map((i) => `${i.color} ${i.position}%`).join(", ");
2010
+ return t === "radial" ? `radial-gradient(circle at center, ${a})` : `linear-gradient(${r}, ${a})`;
2011
+ }, ce = (e) => {
2012
+ const t = [], r = e.backgroundGradient;
2013
+ if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
2014
+ const n = jn(r), a = r.solid || e.backgroundColor || "";
2015
+ a && a !== "transparent" && t.push(`background-color:${a}`), t.push(`background:${n}`);
2016
+ } else e.backgroundColor && e.backgroundColor !== "transparent" && t.push(`background-color:${e.backgroundColor}`);
2017
+ return e.backgroundImage && (t.push(`background-image:url('${e.backgroundImage}')`), t.push(`background-size:${e.backgroundSize}`), t.push(`background-position:${e.backgroundPosition}`), t.push(`background-repeat:${e.backgroundRepeat}`)), t;
2018
+ }, et = (e) => {
2019
+ const t = {}, r = e.backgroundGradient;
2020
+ if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
2021
+ const n = jn(r), a = r.solid || e.backgroundColor || "";
2022
+ a && a !== "transparent" && (t.backgroundColor = a), t.background = n;
2023
+ } else e.backgroundColor && e.backgroundColor !== "transparent" && (t.backgroundColor = e.backgroundColor);
2024
+ return e.backgroundImage && (t.backgroundImage = `url(${e.backgroundImage})`, t.backgroundSize = e.backgroundSize, t.backgroundPosition = e.backgroundPosition, t.backgroundRepeat = e.backgroundRepeat), t;
2025
+ }, ta = 5, zn = (e, t, r) => {
2026
+ if (!(r >= ta) && Array.isArray(e))
2027
+ for (const n of e) {
2028
+ if (!n || n.type === "row-spacer") continue;
2029
+ n.mobileStack && (n.gap ?? 0) > 0 && t.add(n.gap);
2030
+ const a = n.columns;
2031
+ if (Array.isArray(a))
2032
+ for (const i of a) {
2033
+ const o = i?.children ?? i?.components;
2034
+ if (!Array.isArray(o) || o.length === 0) continue;
2035
+ const l = o.filter((c) => c?.type === "row");
2036
+ l.length > 0 && zn(l, t, r + 1);
2037
+ }
2038
+ }
2039
+ }, Pn = (e) => {
2040
+ const t = /* @__PURE__ */ new Set();
2041
+ if (zn(e, t, 0), t.size === 0) return "";
2042
+ const r = [...t].sort((n, a) => n - a);
2043
+ return `${r.map((n) => `.mobile-stack.gap-${n}`).join(`,
2044
+ `) + " { display:block !important; width:100% !important; }"}
2045
+ ${r.map((n) => `.mobile-stack.gap-${n} { height:${n}px !important; line-height:${n}px !important; }`).join(`
2046
+ `)}`;
2047
+ }, tt = P(/* @__PURE__ */ new Set()), gt = () => {
2048
+ const e = P([
2049
+ "Arial",
2050
+ "Arial Black",
2051
+ "Comic Sans MS",
2052
+ "Courier New",
2053
+ "Georgia",
2054
+ "Helvetica",
2055
+ "Impact",
2056
+ "Lucida Console",
2057
+ "Lucida Sans Unicode",
2058
+ "Palatino Linotype",
2059
+ "Tahoma",
2060
+ "Times New Roman",
2061
+ "Trebuchet MS",
2062
+ "Verdana",
2063
+ "ABeeZee",
2064
+ "Abel",
2065
+ "Abril Fatface",
2066
+ "Adamina",
2067
+ "Alegreya",
2068
+ "Alegreya Sans",
2069
+ "Alfa Slab One",
2070
+ "Alice",
2071
+ "Amatic SC",
2072
+ "Amiri",
2073
+ "Anton",
2074
+ "Archivo",
2075
+ "Archivo Black",
2076
+ "Archivo Narrow",
2077
+ "Arimo",
2078
+ "Arvo",
2079
+ "Asap",
2080
+ "Asap Condensed",
2081
+ "Assistant",
2082
+ "Atkinson Hyperlegible",
2083
+ "Barlow",
2084
+ "Barlow Condensed",
2085
+ "Barlow Semi Condensed",
2086
+ "Be Vietnam Pro",
2087
+ "Bebas Neue",
2088
+ "BioRhyme",
2089
+ "Bitter",
2090
+ "Bodoni Moda",
2091
+ "Bree Serif",
2092
+ "Bricolage Grotesque",
2093
+ "Cabin",
2094
+ "Cabin Condensed",
2095
+ "Cairo",
2096
+ "Cal Sans",
2097
+ "Cardo",
2098
+ "Catamaran",
2099
+ "Caveat",
2100
+ "Chivo",
2101
+ "Comfortaa",
2102
+ "Commissioner",
2103
+ "Cormorant",
2104
+ "Cormorant Garamond",
2105
+ "Courier Prime",
2106
+ "Crimson Pro",
2107
+ "Crimson Text",
2108
+ "DM Mono",
2109
+ "DM Sans",
2110
+ "DM Serif Display",
2111
+ "DM Serif Text",
2112
+ "Dancing Script",
2113
+ "Domine",
2114
+ "Dosis",
2115
+ "EB Garamond",
2116
+ "Eczar",
2117
+ "Epilogue",
2118
+ "Exo",
2119
+ "Exo 2",
2120
+ "Figtree",
2121
+ "Fira Code",
2122
+ "Fira Mono",
2123
+ "Fira Sans",
2124
+ "Fira Sans Condensed",
2125
+ "Fjalla One",
2126
+ "Frank Ruhl Libre",
2127
+ "Fraunces",
2128
+ "Fredoka",
2129
+ "Funnel Sans",
2130
+ "Geist Mono",
2131
+ "Geologica",
2132
+ "Hanken Grotesk",
2133
+ "Heebo",
2134
+ "Hind",
2135
+ "Hind Madurai",
2136
+ "Hind Siliguri",
2137
+ "IBM Plex Mono",
2138
+ "IBM Plex Sans",
2139
+ "IBM Plex Sans Condensed",
2140
+ "IBM Plex Serif",
2141
+ "Inconsolata",
2142
+ "Inknut Antiqua",
2143
+ "Instrument Sans",
2144
+ "Instrument Serif",
2145
+ "Inter",
2146
+ "Inter Tight",
2147
+ "JetBrains Mono",
2148
+ "Josefin Sans",
2149
+ "Josefin Slab",
2150
+ "Jost",
2151
+ "Kalam",
2152
+ "Kanit",
2153
+ "Karla",
2154
+ "Khand",
2155
+ "Kumbh Sans",
2156
+ "Lato",
2157
+ "Lexend",
2158
+ "Lexend Deca",
2159
+ "Libre Baskerville",
2160
+ "Libre Bodoni",
2161
+ "Libre Caslon Text",
2162
+ "Libre Franklin",
2163
+ "Lobster",
2164
+ "Lora",
2165
+ "Manrope",
2166
+ "Marcellus",
2167
+ "Maven Pro",
2168
+ "Merriweather",
2169
+ "Merriweather Sans",
2170
+ "Mohave",
2171
+ "Montserrat",
2172
+ "Montserrat Alternates",
2173
+ "Mukta",
2174
+ "Mulish",
2175
+ "Neuton",
2176
+ "Newsreader",
2177
+ "Noticia Text",
2178
+ "Noto Sans",
2179
+ "Noto Sans Display",
2180
+ "Noto Sans Mono",
2181
+ "Noto Serif",
2182
+ "Noto Serif Display",
2183
+ "Nunito",
2184
+ "Nunito Sans",
2185
+ "Old Standard TT",
2186
+ "Onest",
2187
+ "Open Sans",
2188
+ "Oswald",
2189
+ "Outfit",
2190
+ "Overpass",
2191
+ "Overpass Mono",
2192
+ "Oxygen",
2193
+ "PT Mono",
2194
+ "PT Sans",
2195
+ "PT Sans Narrow",
2196
+ "PT Serif",
2197
+ "Pacifico",
2198
+ "Padauk",
2199
+ "Petrona",
2200
+ "Philosopher",
2201
+ "Piazzolla",
2202
+ "Playfair",
2203
+ "Playfair Display",
2204
+ "Playfair Display SC",
2205
+ "Plus Jakarta Sans",
2206
+ "Poppins",
2207
+ "Prata",
2208
+ "Prompt",
2209
+ "Proza Libre",
2210
+ "Public Sans",
2211
+ "Quattrocento",
2212
+ "Quattrocento Sans",
2213
+ "Questrial",
2214
+ "Quicksand",
2215
+ "REM",
2216
+ "Radio Canada",
2217
+ "Raleway",
2218
+ "Readex Pro",
2219
+ "Recursive",
2220
+ "Red Hat Display",
2221
+ "Red Hat Mono",
2222
+ "Red Hat Text",
2223
+ "Roboto",
2224
+ "Roboto Condensed",
2225
+ "Roboto Flex",
2226
+ "Roboto Mono",
2227
+ "Roboto Serif",
2228
+ "Roboto Slab",
2229
+ "Rokkitt",
2230
+ "Rubik",
2231
+ "Saira",
2232
+ "Saira Condensed",
2233
+ "Sanchez",
2234
+ "Sansita",
2235
+ "Sarabun",
2236
+ "Sen",
2237
+ "Signika",
2238
+ "Signika Negative",
2239
+ "Sintony",
2240
+ "Smooch Sans",
2241
+ "Sofia Sans",
2242
+ "Sono",
2243
+ "Sora",
2244
+ "Source Code Pro",
2245
+ "Source Sans 3",
2246
+ "Source Sans Pro",
2247
+ "Source Serif 4",
2248
+ "Source Serif Pro",
2249
+ "Space Grotesk",
2250
+ "Space Mono",
2251
+ "Spectral",
2252
+ "Syne",
2253
+ "Tajawal",
2254
+ "Teko",
2255
+ "Tenor Sans",
2256
+ "TikTok Sans",
2257
+ "Tinos",
2258
+ "Titillium Web",
2259
+ "Ubuntu",
2260
+ "Ubuntu Mono",
2261
+ "Unbounded",
2262
+ "Urbanist",
2263
+ "Vazirmatn",
2264
+ "Vollkorn",
2265
+ "Wix Madefor Display",
2266
+ "Wix Madefor Text",
2267
+ "Work Sans",
2268
+ "Yanone Kaffeesatz",
2269
+ "Yrsa",
2270
+ "Zilla Slab"
2271
+ ]), t = /* @__PURE__ */ new Set([
2272
+ "Arial",
2273
+ "Arial Black",
2274
+ "Comic Sans MS",
2275
+ "Courier New",
2276
+ "Georgia",
2277
+ "Helvetica",
2278
+ "Impact",
2279
+ "Lucida Console",
2280
+ "Lucida Sans Unicode",
2281
+ "Palatino Linotype",
2282
+ "Tahoma",
2283
+ "Times New Roman",
2284
+ "Trebuchet MS",
2285
+ "Verdana"
2286
+ ]), r = /* @__PURE__ */ new Set([
2287
+ "Alegreya",
2288
+ "Alegreya Sans",
2289
+ "Archivo",
2290
+ "Archivo Narrow",
2291
+ "Arimo",
2292
+ "Arvo",
2293
+ "Asap",
2294
+ "Asap Condensed",
2295
+ "Assistant",
2296
+ "Atkinson Hyperlegible",
2297
+ "Barlow",
2298
+ "Barlow Condensed",
2299
+ "Barlow Semi Condensed",
2300
+ "Be Vietnam Pro",
2301
+ "Bitter",
2302
+ "Bree Serif",
2303
+ "Cabin",
2304
+ "Cabin Condensed",
2305
+ "Cardo",
2306
+ "Catamaran",
2307
+ "Chivo",
2308
+ "Commissioner",
2309
+ "Cormorant",
2310
+ "Cormorant Garamond",
2311
+ "Courier Prime",
2312
+ "Crimson Pro",
2313
+ "Crimson Text",
2314
+ "DM Sans",
2315
+ "DM Serif Text",
2316
+ "Domine",
2317
+ "EB Garamond",
2318
+ "Eczar",
2319
+ "Epilogue",
2320
+ "Exo",
2321
+ "Exo 2",
2322
+ "Figtree",
2323
+ "Fira Code",
2324
+ "Fira Sans",
2325
+ "Fira Sans Condensed",
2326
+ "Frank Ruhl Libre",
2327
+ "Fraunces",
2328
+ "Hanken Grotesk",
2329
+ "Heebo",
2330
+ "IBM Plex Mono",
2331
+ "IBM Plex Sans",
2332
+ "IBM Plex Sans Condensed",
2333
+ "IBM Plex Serif",
2334
+ "Inconsolata",
2335
+ "Instrument Sans",
2336
+ "Instrument Serif",
2337
+ "Inter",
2338
+ "Inter Tight",
2339
+ "JetBrains Mono",
2340
+ "Josefin Sans",
2341
+ "Josefin Slab",
2342
+ "Jost",
2343
+ "Karla",
2344
+ "Lato",
2345
+ "Libre Baskerville",
2346
+ "Libre Bodoni",
2347
+ "Libre Caslon Text",
2348
+ "Libre Franklin",
2349
+ "Lora",
2350
+ "Manrope",
2351
+ "Maven Pro",
2352
+ "Merriweather",
2353
+ "Merriweather Sans",
2354
+ "Montserrat",
2355
+ "Mulish",
2356
+ "Neuton",
2357
+ "Newsreader",
2358
+ "Noticia Text",
2359
+ "Noto Sans",
2360
+ "Noto Sans Display",
2361
+ "Noto Serif",
2362
+ "Noto Serif Display",
2363
+ "Nunito",
2364
+ "Nunito Sans",
2365
+ "Open Sans",
2366
+ "Oswald",
2367
+ "Outfit",
2368
+ "Overpass",
2369
+ "Overpass Mono",
2370
+ "Oxygen",
2371
+ "PT Sans",
2372
+ "PT Serif",
2373
+ "Petrona",
2374
+ "Piazzolla",
2375
+ "Playfair",
2376
+ "Playfair Display",
2377
+ "Plus Jakarta Sans",
2378
+ "Poppins",
2379
+ "Proza Libre",
2380
+ "Public Sans",
2381
+ "Quattrocento",
2382
+ "Quattrocento Sans",
2383
+ "Quicksand",
2384
+ "Radio Canada",
2385
+ "Raleway",
2386
+ "Readex Pro",
2387
+ "Recursive",
2388
+ "Red Hat Display",
2389
+ "Red Hat Mono",
2390
+ "Red Hat Text",
2391
+ "Roboto",
2392
+ "Roboto Condensed",
2393
+ "Roboto Mono",
2394
+ "Roboto Serif",
2395
+ "Roboto Slab",
2396
+ "Rokkitt",
2397
+ "Rubik",
2398
+ "Saira",
2399
+ "Saira Condensed",
2400
+ "Sansita",
2401
+ "Sarabun",
2402
+ "Signika Negative",
2403
+ "Source Code Pro",
2404
+ "Source Sans 3",
2405
+ "Source Sans Pro",
2406
+ "Source Serif 4",
2407
+ "Source Serif Pro",
2408
+ "Spectral",
2409
+ "Tajawal",
2410
+ "Tinos",
2411
+ "Titillium Web",
2412
+ "Ubuntu",
2413
+ "Ubuntu Mono",
2414
+ "Vazirmatn",
2415
+ "Vollkorn",
2416
+ "Wix Madefor Display",
2417
+ "Wix Madefor Text",
2418
+ "Work Sans",
2419
+ "Yrsa",
2420
+ "Zilla Slab"
2421
+ ]), n = [
2422
+ 400,
2423
+ 500,
2424
+ 600,
2425
+ 700
2426
+ ], a = (b) => t.has(b), i = (b) => b.trim().replace(/\s+/g, "+"), o = (b) => {
2427
+ if (r.has(b)) {
2428
+ const E = n.map((R) => `0,${R}`), w = n.map((R) => `1,${R}`);
2429
+ return `ital,wght@${[...E, ...w].join(";")}`;
2430
+ }
2431
+ return `wght@${n.join(";")}`;
2432
+ }, l = (b) => {
2433
+ if (!b || a(b) || tt.value.has(b)) return;
2434
+ const E = document.createElement("link");
2435
+ E.rel = "stylesheet", E.href = `https://fonts.googleapis.com/css2?family=${i(b)}:${o(b)}&display=swap`, document.head.appendChild(E), tt.value.add(b);
2436
+ }, c = (b) => {
2437
+ const E = Array.from(new Set(b)).filter((w) => w && !a(w));
2438
+ return E.length ? `https://fonts.googleapis.com/css2?${E.map((w) => `family=${i(w)}:${o(w)}`).join("&")}&display=swap` : "";
2439
+ };
2440
+ return {
2441
+ googleFonts: e,
2442
+ loadGoogleFont: l,
2443
+ getGoogleFontImports: c,
2444
+ syncFontsForTemplate: (b) => {
2445
+ if (!b || b.length === 0) return;
2446
+ const E = [], w = /* @__PURE__ */ new Set();
2447
+ for (const O of b)
2448
+ O && (w.has(O) || (w.add(O), !a(O) && (tt.value.has(O) || E.push(O))));
2449
+ if (E.length === 0) return;
2450
+ const R = c(E);
2451
+ if (!R) return;
2452
+ const M = document.createElement("link");
2453
+ M.rel = "stylesheet", M.href = R, M.dataset.canvasFonts = E.join(","), document.head.appendChild(M);
2454
+ for (const O of E) tt.value.add(O);
2455
+ },
2456
+ preconnectGoogleFonts: () => {
2457
+ if (typeof document > "u") return;
2458
+ const b = (E, w = !1) => {
2459
+ const R = `link[rel="preconnect"][href="${E}"]`;
2460
+ if (document.head.querySelector(R)) return;
2461
+ const M = document.createElement("link");
2462
+ M.rel = "preconnect", M.href = E, w && (M.crossOrigin = "anonymous"), document.head.appendChild(M);
2463
+ };
2464
+ b("https://fonts.googleapis.com"), b("https://fonts.gstatic.com", !0);
2465
+ },
2466
+ isWebSafeFont: a,
2467
+ WEB_SAFE_FONTS: t,
2468
+ FONTS_WITH_ITALICS: r,
2469
+ DEFAULT_WEIGHTS: n
2470
+ };
2471
+ };
2472
+ function st(e) {
2473
+ if (typeof e != "string") return "auto";
2474
+ const t = e.trim().toLowerCase();
2475
+ return /^(?:auto|(?:\d+(?:\.\d+)?|\.\d+)(?:px|%))$/.test(t) ? t : "auto";
2476
+ }
2477
+ function na(e) {
2478
+ const t = st(e.width), r = st(e.height);
2479
+ return [
2480
+ t,
2481
+ r,
2482
+ e.mobile?.width,
2483
+ e.mobile?.height
2484
+ ].some((n) => st(n) !== "auto") ? {
2485
+ width: t,
2486
+ height: r,
2487
+ boxSizing: "border-box",
2488
+ textAlign: "center"
2489
+ } : {};
2490
+ }
2491
+ var Jt = () => ({ emailMobileStyles: (t, r) => {
2492
+ const n = t.componentType ?? t.type, a = t.props.mobileStack === !0, i = t.props.mobile;
2493
+ if (!i && !(n === "menu" && a)) return "";
2494
+ const o = i ?? {}, l = [], c = [], d = [], v = (/* @__PURE__ */ new Set(["button", "anchor"])).has(n), b = n === "button" && !!na(t.props).width, E = (/* @__PURE__ */ new Set(["menu", "socials"])).has(n), w = (p, u) => {
2495
+ u && p.push(u);
2496
+ }, R = () => {
2497
+ const p = o.backgroundGradient;
2498
+ if (p != null) {
2499
+ if (p.useGradient === !0 && Array.isArray(p.gradient?.colors) && p.gradient.colors.length >= 2) {
2500
+ const { type: s, direction: S, colors: C } = p.gradient, _ = C.map((x) => `${x.color} ${x.position}%`).join(", "), g = s === "radial" ? `radial-gradient(circle at center, ${_})` : `linear-gradient(${S}, ${_})`, m = p.solid || o.backgroundColor || "", h = [];
2501
+ return h.push(`background-color: ${m && m !== "transparent" ? m : "transparent"} !important`), h.push(`background: ${g} !important`), h;
2502
+ }
2503
+ const u = p.solid ?? o.backgroundColor;
2504
+ return u != null ? ["background: none !important", `background-color: ${u} !important`] : [];
2505
+ }
2506
+ return o.backgroundColor != null ? ["background: none !important", `background-color: ${o.backgroundColor} !important`] : [];
2507
+ }, M = (p) => {
2508
+ w(p, o.fontSize != null && `font-size: ${o.fontSize}px !important`), w(p, o.lineHeight != null && `line-height: ${o.lineHeight} !important`), w(p, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), w(p, o.color != null && `color: ${o.color} !important`), w(p, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), w(p, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), w(p, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), w(p, o.textTransform != null && `text-transform: ${o.textTransform} !important`), w(p, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), b || p.push(...R());
2509
+ };
2510
+ if (o.margin) {
2511
+ const p = o.margin;
2512
+ l.push(`margin: ${p.top}px ${p.right}px ${p.bottom}px ${p.left}px !important`);
2513
+ }
2514
+ if (o.padding && !v && !E) {
2515
+ const p = o.padding;
2516
+ l.push(`padding: ${p.top}px ${p.right}px ${p.bottom}px ${p.left}px !important`);
2517
+ }
2518
+ if (o.align != null && !E && l.push(`text-align: ${o.align} !important`), v) {
2519
+ M(c);
2520
+ const p = b ? R() : c;
2521
+ if (o.padding) {
2522
+ const u = o.padding, s = `padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`;
2523
+ b ? d.push(`.${r}-button-content { ${s} }`) : c.push(s);
2524
+ }
2525
+ if (o.border) {
2526
+ const u = o.border;
2527
+ p.push(ue(u, !0));
2528
+ }
2529
+ if (o.borderRadius != null && p.push(`border-radius: ${Y(o.borderRadius)} !important`), n === "button") {
2530
+ for (const s of ["width", "height"]) o[s] != null && p.push(`${s}: ${st(o[s])} !important`);
2531
+ const u = [];
2532
+ w(u, o.fontSize != null && `font-size: ${o.fontSize}px !important`), w(u, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), w(u, o.color != null && `color: ${o.color} !important`), w(u, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), w(u, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), w(u, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), w(u, o.textTransform != null && `text-transform: ${o.textTransform} !important`), w(u, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), u.length > 0 && d.push(`.${r}-text { ${u.join("; ")} }`);
2533
+ }
2534
+ b && p.length > 0 && d.push(`.${r}-button-table { ${p.join("; ")} }`);
2535
+ } else if (n === "image")
2536
+ w(c, o.width != null && `width: ${o.width}% !important`), w(c, o.height != null && `height: ${o.height} !important`), w(c, o.borderRadius != null && `border-radius: ${Y(o.borderRadius)} !important`), w(c, o.border != null && ue(o.border, !0));
2537
+ else if (n === "video")
2538
+ w(c, o.width != null && `width: ${o.width}% !important`), w(c, o.height != null && `height: ${o.height} !important`), w(c, o.borderRadius != null && `border-radius: ${Y(o.borderRadius)} !important`), w(c, o.border != null && ue(o.border, !0));
2539
+ else if (n === "divider") {
2540
+ const p = [], u = [];
2541
+ if (o.width != null && p.push(`width: ${o.width}% !important`), o.align != null) {
2542
+ const s = o.align === "left" ? "0" : "auto", S = o.align === "right" ? "0" : "auto";
2543
+ p.push(`margin-left: ${s} !important`), p.push(`margin-right: ${S} !important`);
2544
+ }
2545
+ o.height != null && (u.push(`height: ${o.height}px !important`), u.push(`line-height: ${o.height}px !important`)), u.push(...R()), p.length > 0 && d.push(`.${r}-divider-table { ${p.join("; ")} }`), u.length > 0 && d.push(`.${r}-divider-td { ${u.join("; ")} }`);
2546
+ } else if (n === "spacer") {
2547
+ const p = [];
2548
+ o.height != null && (p.push(`height: ${o.height}px !important`), p.push(`line-height: ${o.height}px !important`)), p.push(...R()), p.length > 0 && d.push(`.${r}-spacer-td { ${p.join("; ")} }`);
2549
+ } else if (n === "list")
2550
+ M(l), o.itemSpacing != null && d.push(`.${r} li { margin-bottom: ${o.itemSpacing}px !important; }`);
2551
+ else if (n === "menu") {
2552
+ const p = [];
2553
+ if (p.push(...R()), o.padding) {
2554
+ const s = o.padding;
2555
+ p.push(`padding: ${s.top}px ${s.right}px ${s.bottom}px ${s.left}px !important`);
2556
+ }
2557
+ p.length > 0 && d.push(`.${r}-menu-td { ${p.join("; ")} }`), o.align != null && d.push(`.${r}-menu-td { text-align: ${o.align} !important; }`);
2558
+ const u = [];
2559
+ if (o.fontSize != null && u.push(`font-size: ${o.fontSize}px !important`), o.lineHeight != null && u.push(`line-height: ${o.lineHeight} !important`), o.letterSpacing != null && u.push(`letter-spacing: ${o.letterSpacing}px !important`), o.color != null && u.push(`color: ${o.color} !important`), o.fontWeight != null && u.push(`font-weight: ${o.fontWeight} !important`), o.fontFamily != null && u.push(`font-family: '${o.fontFamily}', Arial, sans-serif !important`), o.fontStyle != null && u.push(`font-style: ${o.fontStyle} !important`), o.textTransform != null && u.push(`text-transform: ${o.textTransform} !important`), o.textDecoration != null && u.push(`text-decoration: ${o.textDecoration} !important`), u.length > 0 && d.push(`.${r}-menu-td a { ${u.join("; ")} }`), a) {
2560
+ const s = o.spacing ?? t.props.spacing ?? 0;
2561
+ d.push(`.${r}-menu-item a { display: block !important; white-space: normal !important; margin-left: 0 !important; margin-right: 0 !important; margin-bottom: ${s}px !important; }`), d.push(`.${r}-menu-item:last-of-type a { margin-bottom: 0 !important; }`);
2562
+ } else if (o.spacing != null) {
2563
+ const s = Math.ceil(o.spacing / 2);
2564
+ d.push(`.${r}-menu-item a { margin-left: ${s}px !important; margin-right: ${s}px !important; }`), d.push(`.${r}-menu-item:first-of-type a { margin-left: 0 !important; }`), d.push(`.${r}-menu-item:last-of-type a { margin-right: 0 !important; }`);
2565
+ }
2566
+ } else if (n === "socials") {
2567
+ const p = [];
2568
+ if (o.padding) {
2569
+ const u = o.padding;
2570
+ p.push(`padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2571
+ }
2572
+ if (o.align != null) {
2573
+ const u = o.align === "left" ? "0" : "auto", s = o.align === "right" ? "0" : "auto";
2574
+ d.push(`.${r}-socials-inner { display:inline-table !important; margin-left: ${u} !important; margin-right: ${s} !important; }`), p.push(`text-align: ${o.align} !important`);
2575
+ }
2576
+ if (p.length > 0 && d.push(`.${r}-socials-td { ${p.join("; ")} }`), o.iconSize != null && d.push(`.${r}-socials-inner img { width: ${o.iconSize}px !important; height: ${o.iconSize}px !important; }`), o.spacing != null) {
2577
+ const u = Math.ceil(o.spacing / 2);
2578
+ d.push(`.${r}-socials-item a { margin-left: ${u}px !important; margin-right: ${u}px !important; }`), d.push(`.${r}-socials-item:first-of-type a { margin-left: 0 !important; }`), d.push(`.${r}-socials-item:last-of-type a { margin-right: 0 !important; }`);
2579
+ }
2580
+ } else M(l);
2581
+ const O = [];
2582
+ if (l.length > 0 && O.push(`.${r} { ${l.join("; ")} }`), c.length > 0) {
2583
+ const p = v ? `.${r}-link` : n === "image" ? `.${r} img` : n === "video" ? `.${r} video` : `.${r}`;
2584
+ O.push(`${p} { ${c.join("; ")} }`);
2585
+ }
2586
+ return O.push(...d), O.join(`
2587
+ `);
2588
+ } }), ln = (e) => de(e) ? ue(e) : "", Ln = (e, t, r = [], n) => {
2589
+ const a = `padding:${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, i = t && ee(t.radius ?? 0) && de(t), o = t && de(t) && !ee(t.radius ?? 0);
2590
+ if (!i) {
2591
+ const d = [a];
2592
+ return o && d.push(ln(t)), d.push("line-height:0"), d.push("font-size:0"), `<div style="${d.join(";")}">${e}</div>`;
2593
+ }
2594
+ const l = [
2595
+ `border-radius:${Y(t.radius)}`,
2596
+ "overflow:hidden",
2597
+ "line-height:0",
2598
+ "font-size:0"
2599
+ ];
2600
+ de(t) && l.push(ln(t));
2601
+ const c = [
2602
+ a,
2603
+ "line-height:0",
2604
+ "font-size:0"
2605
+ ];
2606
+ return `<div style="${l.join(";")}"><div style="${c.join(";")}">${e}</div></div>`;
2607
+ }, ra = (e, t, r = {}, n, a = !0) => {
2608
+ const i = `${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, o = t && ee(t.radius ?? 0) && de(t) && a, l = t && de(t) && !ee(t.radius ?? 0) && a;
2609
+ if (!o) {
2610
+ const v = {
2611
+ padding: i,
2612
+ lineHeight: "0",
2613
+ fontSize: "0"
2614
+ };
2615
+ return l && (Object.assign(v, At(t)), ee(t.radius ?? 0) && (v.borderRadius = Y(t.radius))), `<div style={{ ${Object.entries(v).map(([b, E]) => `${b}:"${E}"`).join(", ")} }}>${e}</div>`;
2616
+ }
2617
+ const c = {
2618
+ borderRadius: Y(t.radius),
2619
+ overflow: "hidden",
2620
+ lineHeight: "0",
2621
+ fontSize: "0"
2622
+ };
2623
+ de(t) && Object.assign(c, At(t));
2624
+ const d = {
2625
+ padding: i,
2626
+ lineHeight: "0",
2627
+ fontSize: "0"
2628
+ };
2629
+ return `<div style={{ ${Object.entries(c).map(([v, b]) => `${v}:"${b}"`).join(", ")} }}><div style={{ ${Object.entries(d).map(([v, b]) => `${v}:"${b}"`).join(", ")} }}>${e}</div></div>`;
2630
+ }, _t = null, Tt = null;
2631
+ function Dn() {
2632
+ return _t ??= Promise.all([import("./standalone-DHvJ30Td.js"), import("./html-wb0gSX1o.js")]).then(([e, t]) => ({
2633
+ prettier: e.default ?? e,
2634
+ plugins: [t.default ?? t]
2635
+ })).catch((e) => {
2636
+ throw _t = null, e;
2637
+ }), _t;
2638
+ }
2639
+ function aa() {
2640
+ return Tt ??= Promise.all([
2641
+ import("./standalone-DHvJ30Td.js"),
2642
+ import("./babel-DV7WPQI0.js"),
2643
+ import("./estree-DY9POgc0.js")
2644
+ ]).then(([e, t, r]) => ({
2645
+ prettier: e.default ?? e,
2646
+ plugins: [t.default ?? t, r.default ?? r]
2647
+ })).catch((e) => {
2648
+ throw Tt = null, e;
2649
+ }), Tt;
2650
+ }
2651
+ async function Gt(e, t) {
2652
+ try {
2653
+ return await t();
2654
+ } catch (r) {
2655
+ return console.warn("[maildeno-editor] formatter unavailable; returning unformatted output", r), e;
2656
+ }
2657
+ }
2658
+ var oa = async (e) => Gt(e, async () => {
2659
+ const { prettier: t, plugins: r } = await Dn();
2660
+ return t.format(e, {
2661
+ parser: "html",
2662
+ plugins: r
2663
+ });
2664
+ }), ia = async (e) => Gt(e, async () => {
2665
+ const { prettier: t, plugins: r } = await aa();
2666
+ return t.format(e, {
2667
+ parser: "babel-ts",
2668
+ plugins: r
2669
+ });
2670
+ }), sa = async (e) => Gt(e, async () => {
2671
+ const { prettier: t, plugins: r } = await Dn();
2672
+ return t.format(e, {
2673
+ parser: "html",
2674
+ plugins: r
2675
+ });
2676
+ }), cn = (e) => e.trim().toLowerCase().replace(/\s+/g, "_"), la = (e) => {
2677
+ const t = e.indexOf("|");
2678
+ if (t === -1) return { key: cn(e) };
2679
+ const r = e.slice(0, t), n = e.slice(t + 1).trim().replace(/^['"]|['"]$/g, "");
2680
+ return {
2681
+ key: cn(r),
2682
+ pipeDefault: n
2683
+ };
2684
+ }, un = (e, t, r) => !r || !e ? e : e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (n, a) => {
2685
+ const { key: i, pipeDefault: o } = la(a);
2686
+ return Object.prototype.hasOwnProperty.call(t, i) && t[i] !== "" ? t[i] : o !== void 0 ? o : n;
2687
+ }), Fn = (e, t, r, n, a) => {
2688
+ let i = un(e, t, r);
2689
+ return i = un(i, n, a), i;
2690
+ }, qt = /* @__PURE__ */ new Map();
2691
+ function po(e) {
2692
+ for (const t of e) qt.set(t.key, t);
2693
+ }
2694
+ function ca() {
2695
+ return [...qt.keys()];
2696
+ }
2697
+ function ua(e, t) {
2698
+ return qt.get(e)?.tokens?.[t];
2699
+ }
2700
+ var Wt = {
2701
+ unsubscribe_url: {
2702
+ handlebars: "{{{unsubscribe_url}}}",
2703
+ sendgrid: "{{{unsubscribe_url}}}",
2704
+ iterable: "{{unsubscribeUrl}}",
2705
+ mailchimp: "*|UNSUB|*",
2706
+ klaviyo: "{% unsubscribe_link %}",
2707
+ liquid: "{{ unsubscribe_url }}",
2708
+ braze: "{{${set_user_to_unsubscribed_url}}}",
2709
+ hubspot: "{{ unsubscribe_link_url }}",
2710
+ sfmc: "%%unsub_center_url%%",
2711
+ activecampaign: "%UNSUBSCRIBELINK%",
2712
+ marketo: "{{system.unsubscribeLink}}",
2713
+ pardot: "%%unsubscribe%%",
2714
+ campaign_monitor: "<unsubscribe>Unsubscribe</unsubscribe>"
2715
+ },
2716
+ webview_url: {
2717
+ handlebars: "{{{webview_url}}}",
2718
+ sendgrid: "{{{webview_url}}}",
2719
+ iterable: "{{webViewUrl}}",
2720
+ mailchimp: "*|ARCHIVE|*",
2721
+ klaviyo: "{% web_view_link %}",
2722
+ liquid: "{{ webview_url }}",
2723
+ braze: "{{ webview_url }}",
2724
+ hubspot: "{{ view_as_page_url }}",
2725
+ sfmc: "%%view_email_url%%",
2726
+ activecampaign: "%VIEWINBROWSERLINK%",
2727
+ marketo: "{{system.viewAsWebpageLink}}",
2728
+ pardot: "%%view_online%%",
2729
+ campaign_monitor: "<webversion>View online</webversion>"
2730
+ },
2731
+ email: {
2732
+ handlebars: "{{ email }}",
2733
+ sendgrid: "{{ email }}",
2734
+ iterable: "{{email}}",
2735
+ mailchimp: "*|EMAIL|*",
2736
+ klaviyo: "{{ email }}",
2737
+ liquid: "{{ email }}",
2738
+ braze: "{{${email_address}}}",
2739
+ hubspot: "{{ contact.email }}",
2740
+ sfmc: "%%emailaddr%%",
2741
+ activecampaign: "%EMAIL%",
2742
+ marketo: "{{lead.Email Address}}",
2743
+ pardot: "%%email%%",
2744
+ campaign_monitor: "[email]"
2745
+ },
2746
+ first_name: {
2747
+ handlebars: "{{ first_name }}",
2748
+ sendgrid: "{{ first_name }}",
2749
+ iterable: "{{firstName}}",
2750
+ mailchimp: "*|FNAME|*",
2751
+ klaviyo: "{{ first_name }}",
2752
+ liquid: "{{ first_name }}",
2753
+ braze: "{{${first_name}}}",
2754
+ hubspot: "{{ contact.firstname }}",
2755
+ sfmc: "%%First Name%%",
2756
+ activecampaign: "%FIRSTNAME%",
2757
+ marketo: "{{lead.First Name}}",
2758
+ pardot: "%%first_name%%",
2759
+ campaign_monitor: "[firstname]"
2760
+ },
2761
+ last_name: {
2762
+ handlebars: "{{ last_name }}",
2763
+ sendgrid: "{{ last_name }}",
2764
+ iterable: "{{lastName}}",
2765
+ mailchimp: "*|LNAME|*",
2766
+ klaviyo: "{{ last_name }}",
2767
+ liquid: "{{ last_name }}",
2768
+ braze: "{{${last_name}}}",
2769
+ hubspot: "{{ contact.lastname }}",
2770
+ sfmc: "%%Last Name%%",
2771
+ activecampaign: "%LASTNAME%",
2772
+ marketo: "{{lead.Last Name}}",
2773
+ pardot: "%%last_name%%",
2774
+ campaign_monitor: "[lastname]"
2775
+ },
2776
+ full_name: {
2777
+ handlebars: "{{ full_name }}",
2778
+ sendgrid: "{{ full_name }}",
2779
+ iterable: "{{firstName}} {{lastName}}",
2780
+ mailchimp: "*|FNAME|* *|LNAME|*",
2781
+ klaviyo: "{{ first_name }} {{ last_name }}",
2782
+ liquid: "{{ full_name }}",
2783
+ braze: "{{${first_name}}} {{${last_name}}}",
2784
+ hubspot: "{{ contact.firstname }} {{ contact.lastname }}",
2785
+ sfmc: "%%First Name%% %%Last Name%%",
2786
+ activecampaign: "%FIRSTNAME% %LASTNAME%",
2787
+ marketo: "{{lead.Full Name}}",
2788
+ pardot: "%%full_name%%"
2789
+ },
2790
+ company: {
2791
+ handlebars: "{{ company }}",
2792
+ sendgrid: "{{ company }}",
2793
+ iterable: "{{company}}",
2794
+ mailchimp: "*|COMPANY|*",
2795
+ klaviyo: "{{ organization }}",
2796
+ liquid: "{{ company }}",
2797
+ braze: "{{custom_attribute.${company}}}",
2798
+ hubspot: "{{ contact.company }}",
2799
+ sfmc: "%%Company%%",
2800
+ activecampaign: "%ORG%",
2801
+ marketo: "{{lead.Company Name}}",
2802
+ pardot: "%%company%%"
2803
+ },
2804
+ current_date: {
2805
+ handlebars: "{{ current_date }}",
2806
+ sendgrid: "{{ current_date }}",
2807
+ iterable: "{{now}}",
2808
+ mailchimp: "*|DATE:d F Y|*",
2809
+ klaviyo: "{{ 'now' | date: '%B %d, %Y' }}",
2810
+ liquid: "{{ 'now' | date: '%B %d, %Y' }}",
2811
+ braze: "{{ 'now' | date: '%B %d, %Y' }}",
2812
+ hubspot: "{{ today }}",
2813
+ sfmc: "%%=Format(Now(),'M/d/yyyy')=%%"
2814
+ }
2815
+ }, da = (e, t, r) => {
2816
+ const n = !!r?.trim(), a = r?.trim() ?? "";
2817
+ switch (t) {
2818
+ case "liquid":
2819
+ case "klaviyo":
2820
+ case "hubspot":
2821
+ return n ? `{{ ${e} | default: '${a}' }}` : `{{ ${e} }}`;
2822
+ case "braze":
2823
+ return n ? `{{custom_attribute.${e} | default: '${a}'}}` : `{{custom_attribute.${e}}}`;
2824
+ case "handlebars":
2825
+ case "sendgrid":
2826
+ return n ? `{{ ${e} }}{{!-- default: ${a} --}}` : `{{ ${e} }}`;
2827
+ case "iterable":
2828
+ return n ? `{{${e}|default:${a}}}` : `{{${e}}}`;
2829
+ case "mailchimp":
2830
+ return n ? `*|${e.toUpperCase()}:${a}|*` : `*|${e.toUpperCase()}|*`;
2831
+ case "sfmc":
2832
+ return n ? `%%=IIF(Empty(@${e}),'${a}',@${e})=%%` : `%%=v(@${e})=%%`;
2833
+ case "activecampaign":
2834
+ return `%${e.toUpperCase()}%`;
2835
+ case "marketo":
2836
+ return n ? `{{lead.${e}:default ${a}}}` : `{{lead.${e}}}`;
2837
+ case "pardot":
2838
+ return `%%${e}%%`;
2839
+ case "campaign_monitor":
2840
+ return `[${e}]`;
2841
+ default:
2842
+ return `{{ ${e} }}`;
2843
+ }
2844
+ }, dn = (e, t, r) => {
2845
+ const n = r.trim();
2846
+ if (!n) return e;
2847
+ switch (t) {
2848
+ case "mailchimp":
2849
+ return /^\*\|[\w:]+\|\*$/.test(e) ? e.replace(/\|\*$/, `:${n}|*`) : e;
2850
+ case "marketo":
2851
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `:default ${n}}}`) : e;
2852
+ case "liquid":
2853
+ case "klaviyo":
2854
+ case "hubspot":
2855
+ return /^\{\{\s*[^}]+\s*\}\}$/.test(e) ? e.replace(/\s*\}\}$/, ` | default: '${n}'}}`) : e;
2856
+ case "braze":
2857
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, ` | default: '${n}'}}`) : e;
2858
+ case "iterable":
2859
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `|default:${n}}}`) : e;
2860
+ case "sfmc":
2861
+ return /^%%[^%]+%%$/.test(e) ? `%%=IIF(Empty(${e}),'${n}',${e})=%%` : e;
2862
+ case "handlebars":
2863
+ case "sendgrid":
2864
+ return `${e}{{!-- default: ${n} --}}`;
2865
+ default:
2866
+ return e;
2867
+ }
2868
+ }, pn = (e, t, r) => {
2869
+ const n = Wt[e];
2870
+ if (n) {
2871
+ const i = n[t];
2872
+ if (i) return r?.trim() ? dn(i, t, r) : i;
2873
+ }
2874
+ const a = ua(e, t);
2875
+ return a ? r?.trim() ? dn(a, t, r) : a : da(e, t, r);
2876
+ }, pa = (e, t) => {
2877
+ if (!e) return "";
2878
+ let r = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, a, i) => pn(a, t, i?.trim() || void 0));
2879
+ return r = r.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (n, a, i, o, l, c, d) => {
2880
+ const v = (a ?? i ?? o ?? "").trim(), b = (l ?? c ?? d ?? "").trim();
2881
+ return pn(v, t, b || void 0);
2882
+ }), r;
2883
+ }, mo = () => [...Object.keys(Wt), ...ca()], fo = (e, t) => Wt[e]?.[t] ?? null, Je = (e) => {
2884
+ let t = (e ?? "").trim().replace(/[^A-Za-z0-9_$]+/g, "_");
2885
+ return /^[0-9]/.test(t) && (t = `_${t}`), t || "_tag";
2886
+ }, mn = (e, t) => {
2887
+ const r = e.trim();
2888
+ return r ? t?.trim() ? `{${r} ?? "${t.trim().replace(/"/g, '\\"')}"}` : `{${r}}` : "";
2889
+ }, ma = (e) => {
2890
+ if (!e) return "";
2891
+ let t = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (r, n, a) => mn(n, a?.trim() || void 0));
2892
+ return t = t.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (r, n, a, i, o, l, c) => {
2893
+ const d = (n ?? a ?? i ?? "").trim(), v = (o ?? l ?? c ?? "").trim();
2894
+ return mn(d, v || void 0);
2895
+ }), t = t.replace(/(\b(?!style=)\w[\w-]*=)"([^"]*\{[^}]+\}[^"]*)"/g, (r, n, a) => {
2896
+ const i = a.match(/^\{(\w+)\}$/);
2897
+ return i ? `${n}{${i[1]}}` : `${n}{\`${a.replace(/\{(\w+)\}/g, "${$1}")}\`}`;
2898
+ }), t;
2899
+ }, fa = (e) => {
2900
+ if (e.length === 0) return {
2901
+ propsInterface: "",
2902
+ propsDestructure: ""
2903
+ };
2904
+ const t = /* @__PURE__ */ new Map();
2905
+ for (const { tagId: n, fallback: a } of e) t.has(n) || t.set(n, a);
2906
+ const r = [...t.entries()];
2907
+ return {
2908
+ propsInterface: `interface EmailProps {
2909
+ ${r.map(([n]) => ` ${n}?: string;`).join(`
2910
+ `)}
2911
+ }`,
2912
+ propsDestructure: `{ ${r.map(([n, a]) => a?.trim() ? `${n} = "${a.trim().replace(/"/g, '\\"')}"` : n).join(", ")} }: EmailProps`
2913
+ };
2914
+ }, ga = (e) => {
2915
+ const t = /* @__PURE__ */ new Map();
2916
+ for (const r of e.matchAll(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs)) {
2917
+ const n = r[1].trim();
2918
+ n && !t.has(n) && t.set(n, r[2]?.trim() || void 0);
2919
+ }
2920
+ for (const r of e.matchAll(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g)) {
2921
+ const n = (r[1] ?? r[2] ?? r[3] ?? "").trim(), a = (r[4] ?? r[5] ?? r[6] ?? "").trim();
2922
+ n && !t.has(n) && t.set(n, a || void 0);
2923
+ }
2924
+ return [...t.entries()].map(([r, n]) => ({
2925
+ tagId: r,
2926
+ fallback: n
2927
+ }));
2928
+ }, ha = (e) => {
2929
+ const t = /* @__PURE__ */ new Set(), r = (a) => {
2930
+ if (a?.enabled) {
2931
+ for (const i of a.rules ?? []) i.tag?.trim() && t.add(Je(i.tag));
2932
+ for (const i of a.groups ?? []) for (const o of i.rules ?? []) o.tag?.trim() && t.add(Je(o.tag));
2933
+ }
2934
+ }, n = (a) => {
2935
+ for (const i of a) if (i.type === "row") {
2936
+ r(i.visibility);
2937
+ for (const o of i.columns ?? []) {
2938
+ r(o.props?.visibility);
2939
+ const l = o.children ?? o.components ?? [];
2940
+ n(l);
2941
+ }
2942
+ } else i.type === "row-spacer" ? r(i.visibility) : r(i.props?.visibility);
2943
+ };
2944
+ for (const a of e) {
2945
+ r(a.visibility);
2946
+ for (const i of a.columns ?? [])
2947
+ r(i.props?.visibility), n(i.children ?? i.components ?? []);
2948
+ }
2949
+ return [...t];
2950
+ }, va = (e) => e.length === 0 ? "" : ` // Visibility data — replace with real values from your data source
2951
+ ${e.map((t) => ` const ${t} = "";`).join(`
2952
+ `)}`, Hn = (e, t, r, n, a = !1) => {
2953
+ const i = n?.mergeTagActive || n?.linkTagActive;
2954
+ if (t === "wrap" || !i) return pa(e, r);
2955
+ if (a) {
2956
+ const { mergeTagContext: o, mergeTagActive: l, linkTagContext: c, linkTagActive: d } = n;
2957
+ return Fn(e, o ?? {}, l ?? !1, c ?? {}, d ?? !1);
2958
+ }
2959
+ return e;
2960
+ }, Un = (e, t, r) => {
2961
+ if (t === "wrap" || !r) return e;
2962
+ const { mergeTagContext: n, mergeTagActive: a, linkTagContext: i, linkTagActive: o } = r;
2963
+ return !a && !o ? e : Fn(e, n, a, i, o);
2964
+ }, Vt = /* @__PURE__ */ new Map(), Jn = /* @__PURE__ */ new Map();
2965
+ function go(e, t, r) {
2966
+ Vt.set(e, t), r && Jn.set(e, r);
2967
+ }
2968
+ var ba = {
2969
+ label: "Custom",
2970
+ group: "custom",
2971
+ description: "Registered ESP syntax with no metadata override.",
2972
+ supportsNesting: !0
2973
+ };
2974
+ function $a(e, t) {
2975
+ return t[e] ?? Vt.get(e) ?? ba;
2976
+ }
2977
+ function Gn(e) {
2978
+ return Jn.get(e);
2979
+ }
2980
+ function ho() {
2981
+ return [...Vt.entries()].map(([e, t]) => ({
2982
+ id: e,
2983
+ meta: t
2984
+ }));
2985
+ }
2986
+ var ya = {
2987
+ handlebars: {
2988
+ label: "Handlebars (Generic)",
2989
+ group: "handlebars",
2990
+ description: "Generic Handlebars.js template syntax",
2991
+ supportsNesting: !0
2992
+ },
2993
+ sendgrid: {
2994
+ label: "SendGrid",
2995
+ group: "handlebars",
2996
+ description: "SendGrid Dynamic Templates (Handlebars)",
2997
+ docsUrl: "https://docs.sendgrid.com/for-developers/sending-email/using-handlebars",
2998
+ supportsNesting: !0
2999
+ },
3000
+ iterable: {
3001
+ label: "Iterable",
3002
+ group: "handlebars",
3003
+ description: "Iterable templating (Handlebars-compatible)",
3004
+ docsUrl: "https://support.iterable.com/hc/en-us/articles/205480365",
3005
+ supportsNesting: !0
3006
+ },
3007
+ mailchimp: {
3008
+ label: "Mailchimp",
3009
+ group: "custom",
3010
+ description: "Mailchimp merge tag conditionals *|IF:…|*",
3011
+ docsUrl: "https://mailchimp.com/help/use-conditional-merge-tag-blocks/",
3012
+ supportsNesting: !1
3013
+ },
3014
+ klaviyo: {
3015
+ label: "Klaviyo",
3016
+ group: "liquid",
3017
+ description: "Klaviyo (Liquid templating)",
3018
+ docsUrl: "https://help.klaviyo.com/hc/en-us/articles/115002775012",
3019
+ supportsNesting: !0
3020
+ },
3021
+ liquid: {
3022
+ label: "Liquid (Generic)",
3023
+ group: "liquid",
3024
+ description: "Generic Liquid template syntax (Shopify, etc.)",
3025
+ supportsNesting: !0
3026
+ },
3027
+ braze: {
3028
+ label: "Braze",
3029
+ group: "liquid",
3030
+ description: "Braze (Liquid + Connected Content)",
3031
+ docsUrl: "https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/",
3032
+ supportsNesting: !0
3033
+ },
3034
+ hubspot: {
3035
+ label: "HubSpot",
3036
+ group: "liquid",
3037
+ description: "HubSpot (HubL — Liquid-based)",
3038
+ docsUrl: "https://developers.hubspot.com/docs/cms/hubl/intro-to-hubl",
3039
+ supportsNesting: !0
3040
+ },
3041
+ sfmc: {
3042
+ label: "Salesforce Marketing Cloud",
3043
+ group: "ampscript",
3044
+ description: "SFMC AMPscript conditionals",
3045
+ docsUrl: "https://ampscript.guide/if/",
3046
+ supportsNesting: !0
3047
+ },
3048
+ activecampaign: {
3049
+ label: "ActiveCampaign",
3050
+ group: "custom",
3051
+ description: "ActiveCampaign conditional content tags",
3052
+ docsUrl: "https://help.activecampaign.com/hc/en-us/articles/220358207",
3053
+ supportsNesting: !0
3054
+ },
3055
+ marketo: {
3056
+ label: "Marketo",
3057
+ group: "custom",
3058
+ description: "Marketo Velocity Script conditionals",
3059
+ docsUrl: "https://nation.marketo.com/t5/product-blogs/velocity-scripting/ba-p/232782",
3060
+ supportsNesting: !0
3061
+ },
3062
+ campaign_monitor: {
3063
+ label: "Campaign Monitor",
3064
+ group: "custom",
3065
+ description: "Campaign Monitor conditional merge tags",
3066
+ docsUrl: "https://help.campaignmonitor.com/custom-fields-and-personalization",
3067
+ supportsNesting: !1
3068
+ },
3069
+ pardot: {
3070
+ label: "Pardot / MCAE",
3071
+ group: "custom",
3072
+ description: "Pardot (Marketing Cloud Account Engagement) conditionals",
3073
+ docsUrl: "https://help.salesforce.com/s/articleView?id=pardot_variable_tags.htm",
3074
+ supportsNesting: !1
3075
+ },
3076
+ mso: {
3077
+ label: "Outlook (MSO)",
3078
+ group: "mso",
3079
+ description: "Microsoft Office VML conditional comments for Outlook",
3080
+ supportsNesting: !1
3081
+ }
3082
+ }, vo = [
3083
+ {
3084
+ syntax: "handlebars",
3085
+ label: "Handlebars",
3086
+ eq: "native",
3087
+ neq: "helper",
3088
+ contains: "helper",
3089
+ not_contains: "helper",
3090
+ starts_with: "helper",
3091
+ ends_with: "helper",
3092
+ in: "helper",
3093
+ not_in: "helper",
3094
+ numeric: "helper",
3095
+ is_empty: "helper",
3096
+ date: "helper"
3097
+ },
3098
+ {
3099
+ syntax: "sendgrid",
3100
+ label: "SendGrid",
3101
+ eq: "native",
3102
+ neq: "none",
3103
+ contains: "none",
3104
+ not_contains: "none",
3105
+ starts_with: "none",
3106
+ ends_with: "none",
3107
+ in: "none",
3108
+ not_in: "none",
3109
+ numeric: "none",
3110
+ is_empty: "none",
3111
+ date: "none"
3112
+ },
3113
+ {
3114
+ syntax: "iterable",
3115
+ label: "Iterable",
3116
+ eq: "native",
3117
+ neq: "helper",
3118
+ contains: "helper",
3119
+ not_contains: "helper",
3120
+ starts_with: "helper",
3121
+ ends_with: "helper",
3122
+ in: "helper",
3123
+ not_in: "helper",
3124
+ numeric: "helper",
3125
+ is_empty: "helper",
3126
+ date: "helper"
3127
+ },
3128
+ {
3129
+ syntax: "liquid",
3130
+ label: "Liquid",
3131
+ eq: "native",
3132
+ neq: "native",
3133
+ contains: "native",
3134
+ not_contains: "native",
3135
+ starts_with: "none",
3136
+ ends_with: "none",
3137
+ in: "fallback",
3138
+ not_in: "fallback",
3139
+ numeric: "native",
3140
+ is_empty: "native",
3141
+ date: "native"
3142
+ },
3143
+ {
3144
+ syntax: "klaviyo",
3145
+ label: "Klaviyo",
3146
+ eq: "native",
3147
+ neq: "native",
3148
+ contains: "native",
3149
+ not_contains: "native",
3150
+ starts_with: "none",
3151
+ ends_with: "none",
3152
+ in: "fallback",
3153
+ not_in: "fallback",
3154
+ numeric: "native",
3155
+ is_empty: "native",
3156
+ date: "native"
3157
+ },
3158
+ {
3159
+ syntax: "braze",
3160
+ label: "Braze",
3161
+ eq: "native",
3162
+ neq: "native",
3163
+ contains: "native",
3164
+ not_contains: "native",
3165
+ starts_with: "none",
3166
+ ends_with: "none",
3167
+ in: "fallback",
3168
+ not_in: "fallback",
3169
+ numeric: "native",
3170
+ is_empty: "native",
3171
+ date: "native"
3172
+ },
3173
+ {
3174
+ syntax: "hubspot",
3175
+ label: "HubSpot",
3176
+ eq: "native",
3177
+ neq: "native",
3178
+ contains: "native",
3179
+ not_contains: "native",
3180
+ starts_with: "none",
3181
+ ends_with: "none",
3182
+ in: "fallback",
3183
+ not_in: "fallback",
3184
+ numeric: "native",
3185
+ is_empty: "native",
3186
+ date: "native"
3187
+ },
3188
+ {
3189
+ syntax: "sfmc",
3190
+ label: "SFMC",
3191
+ eq: "native",
3192
+ neq: "native",
3193
+ contains: "native",
3194
+ not_contains: "native",
3195
+ starts_with: "native",
3196
+ ends_with: "native",
3197
+ in: "fallback",
3198
+ not_in: "fallback",
3199
+ numeric: "native",
3200
+ is_empty: "native",
3201
+ date: "native"
3202
+ },
3203
+ {
3204
+ syntax: "activecampaign",
3205
+ label: "ActiveCampaign",
3206
+ eq: "native",
3207
+ neq: "native",
3208
+ contains: "native",
3209
+ not_contains: "native",
3210
+ starts_with: "none",
3211
+ ends_with: "none",
3212
+ in: "native",
3213
+ not_in: "fallback",
3214
+ numeric: "native",
3215
+ is_empty: "native",
3216
+ date: "fallback"
3217
+ },
3218
+ {
3219
+ syntax: "marketo",
3220
+ label: "Marketo",
3221
+ eq: "native",
3222
+ neq: "native",
3223
+ contains: "native",
3224
+ not_contains: "native",
3225
+ starts_with: "native",
3226
+ ends_with: "native",
3227
+ in: "fallback",
3228
+ not_in: "fallback",
3229
+ numeric: "native",
3230
+ is_empty: "native",
3231
+ date: "native"
3232
+ },
3233
+ {
3234
+ syntax: "mailchimp",
3235
+ label: "Mailchimp",
3236
+ eq: "native",
3237
+ neq: "native",
3238
+ contains: "fallback",
3239
+ not_contains: "fallback",
3240
+ starts_with: "fallback",
3241
+ ends_with: "fallback",
3242
+ in: "fallback",
3243
+ not_in: "fallback",
3244
+ numeric: "native",
3245
+ is_empty: "fallback",
3246
+ date: "fallback"
3247
+ },
3248
+ {
3249
+ syntax: "pardot",
3250
+ label: "Pardot",
3251
+ eq: "native",
3252
+ neq: "native",
3253
+ contains: "none",
3254
+ not_contains: "none",
3255
+ starts_with: "none",
3256
+ ends_with: "none",
3257
+ in: "none",
3258
+ not_in: "none",
3259
+ numeric: "none",
3260
+ is_empty: "none",
3261
+ date: "none"
3262
+ },
3263
+ {
3264
+ syntax: "campaign_monitor",
3265
+ label: "Campaign Monitor",
3266
+ eq: "native",
3267
+ neq: "native",
3268
+ contains: "none",
3269
+ not_contains: "none",
3270
+ starts_with: "none",
3271
+ ends_with: "none",
3272
+ in: "none",
3273
+ not_in: "none",
3274
+ numeric: "none",
3275
+ is_empty: "none",
3276
+ date: "none"
3277
+ },
3278
+ {
3279
+ syntax: "mso",
3280
+ label: "MSO/Outlook",
3281
+ eq: "native",
3282
+ neq: "none",
3283
+ contains: "none",
3284
+ not_contains: "none",
3285
+ starts_with: "none",
3286
+ ends_with: "none",
3287
+ in: "none",
3288
+ not_in: "none",
3289
+ numeric: "none",
3290
+ is_empty: "none",
3291
+ date: "none"
3292
+ }
3293
+ ], Sa = (e, t) => {
3294
+ const r = Je(e);
3295
+ switch (t) {
3296
+ case "sfmc":
3297
+ return `AttributeValue("${r}")`;
3298
+ case "marketo":
3299
+ return `$!{${r}}`;
3300
+ case "mailchimp":
3301
+ return r.toUpperCase();
3302
+ default:
3303
+ return r;
3304
+ }
3305
+ }, Te = (e, t) => {
3306
+ const { operator: r, value: n } = e, a = Sa(e.tag, t);
3307
+ switch (t) {
3308
+ case "handlebars":
3309
+ case "sendgrid":
3310
+ case "iterable":
3311
+ switch (r) {
3312
+ case "==":
3313
+ return `(eq ${a} '${n}')`;
3314
+ case "!=":
3315
+ return `(neq ${a} '${n}')`;
3316
+ case "contains":
3317
+ return `(contains ${a} '${n}')`;
3318
+ case "not_contains":
3319
+ return `(not (contains ${a} '${n}'))`;
3320
+ case "starts_with":
3321
+ return `(startsWith ${a} '${n}')`;
3322
+ case "ends_with":
3323
+ return `(endsWith ${a} '${n}')`;
3324
+ case "in":
3325
+ return `(in ${a} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")})`;
3326
+ case "not_in":
3327
+ return `(not (in ${a} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")}))`;
3328
+ case ">":
3329
+ return `(gt ${a} ${n})`;
3330
+ case "<":
3331
+ return `(lt ${a} ${n})`;
3332
+ case ">=":
3333
+ return `(gte ${a} ${n})`;
3334
+ case "<=":
3335
+ return `(lte ${a} ${n})`;
3336
+ case "is_empty":
3337
+ return `(isEmpty ${a})`;
3338
+ case "is_not_empty":
3339
+ return `(not (isEmpty ${a}))`;
3340
+ case "date_before":
3341
+ return `(dateBefore ${a} '${n}')`;
3342
+ case "date_after":
3343
+ return `(dateAfter ${a} '${n}')`;
3344
+ case "date_on":
3345
+ return `(dateOn ${a} '${n}')`;
3346
+ default:
3347
+ return `(eq ${a} '${n}')`;
3348
+ }
3349
+ case "liquid":
3350
+ case "klaviyo":
3351
+ case "braze":
3352
+ case "hubspot":
3353
+ switch (r) {
3354
+ case "==":
3355
+ return `${a} == '${n}'`;
3356
+ case "!=":
3357
+ return `${a} != '${n}'`;
3358
+ case "contains":
3359
+ return `${a} contains '${n}'`;
3360
+ case "not_contains":
3361
+ return `not (${a} contains '${n}')`;
3362
+ case "starts_with":
3363
+ case "ends_with":
3364
+ return null;
3365
+ case "in":
3366
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" or ");
3367
+ case "not_in":
3368
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" and ");
3369
+ case ">":
3370
+ return `${a} > ${n}`;
3371
+ case "<":
3372
+ return `${a} < ${n}`;
3373
+ case ">=":
3374
+ return `${a} >= ${n}`;
3375
+ case "<=":
3376
+ return `${a} <= ${n}`;
3377
+ case "is_empty":
3378
+ return `${a} == blank`;
3379
+ case "is_not_empty":
3380
+ return `${a} != blank`;
3381
+ case "date_before":
3382
+ return `${Nt(e.tag)} < ${Bt(e.tag, n)}`;
3383
+ case "date_after":
3384
+ return `${Nt(e.tag)} > ${Bt(e.tag, n)}`;
3385
+ case "date_on":
3386
+ return `${a} | date: '%F' == '${n}'`;
3387
+ default:
3388
+ return `${a} == '${n}'`;
3389
+ }
3390
+ case "mailchimp":
3391
+ switch (r) {
3392
+ case "==":
3393
+ return `${a}='${n}'`;
3394
+ case "!=":
3395
+ return `${a}!='${n}'`;
3396
+ case ">":
3397
+ case "<":
3398
+ case ">=":
3399
+ case "<=": {
3400
+ const i = Number(n);
3401
+ return Number.isNaN(i) ? `${a}='${n}'` : `${a}${r}${i}`;
3402
+ }
3403
+ case "date_before":
3404
+ return `${a}<'${n}'`;
3405
+ case "date_after":
3406
+ return `${a}>'${n}'`;
3407
+ case "date_on":
3408
+ return `${a}='${n}'`;
3409
+ default:
3410
+ return `${a}='${n}'`;
3411
+ }
3412
+ case "sfmc":
3413
+ switch (r) {
3414
+ case "==":
3415
+ return `${a} == '${n}'`;
3416
+ case "!=":
3417
+ return `${a} != '${n}'`;
3418
+ case "contains":
3419
+ return `Contains(${a}, '${n}')`;
3420
+ case "not_contains":
3421
+ return `Not Contains(${a}, '${n}')`;
3422
+ case "starts_with":
3423
+ return `IndexOf(${a}, '${n}') == 1`;
3424
+ case "ends_with":
3425
+ return `Substring(${a}, Subtract(Length(${a}), Subtract(Length('${n}'), 1)), Length('${n}')) == '${n}'`;
3426
+ case "in":
3427
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" OR ");
3428
+ case "not_in":
3429
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" AND ");
3430
+ case ">":
3431
+ return `${a} > ${n}`;
3432
+ case "<":
3433
+ return `${a} < ${n}`;
3434
+ case ">=":
3435
+ return `${a} >= ${n}`;
3436
+ case "<=":
3437
+ return `${a} <= ${n}`;
3438
+ case "is_empty":
3439
+ return `Empty(${a})`;
3440
+ case "is_not_empty":
3441
+ return `Not Empty(${a})`;
3442
+ case "date_before":
3443
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") < 0`;
3444
+ case "date_after":
3445
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") > 0`;
3446
+ case "date_on":
3447
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") == 0`;
3448
+ default:
3449
+ return `${a} == '${n}'`;
3450
+ }
3451
+ case "activecampaign":
3452
+ switch (r) {
3453
+ case "==":
3454
+ return `${a} EQUALS ${n}`;
3455
+ case "!=":
3456
+ return `${a} NOT EQUALS ${n}`;
3457
+ case "contains":
3458
+ return `${a} CONTAINS ${n}`;
3459
+ case "not_contains":
3460
+ return `${a} NOT CONTAINS ${n}`;
3461
+ case "starts_with":
3462
+ case "ends_with":
3463
+ return null;
3464
+ case "in":
3465
+ return `${a} IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3466
+ case "not_in":
3467
+ return `${a} NOT IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3468
+ case ">":
3469
+ return `${a} GREATER THAN ${n}`;
3470
+ case "<":
3471
+ return `${a} LESS THAN ${n}`;
3472
+ case ">=":
3473
+ return `${a} GREATER THAN OR EQUAL TO ${n}`;
3474
+ case "<=":
3475
+ return `${a} LESS THAN OR EQUAL TO ${n}`;
3476
+ case "is_empty":
3477
+ return `${a} IS EMPTY`;
3478
+ case "is_not_empty":
3479
+ return `${a} IS NOT EMPTY`;
3480
+ case "date_before":
3481
+ return `${a} LESS THAN ${n}`;
3482
+ case "date_after":
3483
+ return `${a} GREATER THAN ${n}`;
3484
+ case "date_on":
3485
+ return `${a} EQUALS ${n}`;
3486
+ default:
3487
+ return `${a} EQUALS ${n}`;
3488
+ }
3489
+ case "marketo":
3490
+ switch (r) {
3491
+ case "==":
3492
+ return `${a} == '${n}'`;
3493
+ case "!=":
3494
+ return `${a} != '${n}'`;
3495
+ case "contains":
3496
+ return `${a} && ${a}.contains('${n}')`;
3497
+ case "not_contains":
3498
+ return `!${a} || !${a}.contains('${n}')`;
3499
+ case "starts_with":
3500
+ return `${a}.startsWith('${n}')`;
3501
+ case "ends_with":
3502
+ return `${a}.endsWith('${n}')`;
3503
+ case "in":
3504
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" || ");
3505
+ case "not_in":
3506
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" && ");
3507
+ case ">":
3508
+ return `${a}.toInteger() > ${n}`;
3509
+ case "<":
3510
+ return `${a}.toInteger() < ${n}`;
3511
+ case ">=":
3512
+ return `${a}.toInteger() >= ${n}`;
3513
+ case "<=":
3514
+ return `${a}.toInteger() <= ${n}`;
3515
+ case "is_empty":
3516
+ return `!${a} || ${a} == ''`;
3517
+ case "is_not_empty":
3518
+ return `${a} && ${a} != ''`;
3519
+ case "date_before":
3520
+ return `$date.parse('yyyy-MM-dd', ${a}).before($date.parse('yyyy-MM-dd', '${n}'))`;
3521
+ case "date_after":
3522
+ return `$date.parse('yyyy-MM-dd', ${a}).after($date.parse('yyyy-MM-dd', '${n}'))`;
3523
+ case "date_on":
3524
+ return `$date.parse('yyyy-MM-dd', ${a}).equals($date.parse('yyyy-MM-dd', '${n}'))`;
3525
+ default:
3526
+ return `${a} == '${n}'`;
3527
+ }
3528
+ case "campaign_monitor":
3529
+ case "pardot":
3530
+ switch (r) {
3531
+ case "==":
3532
+ return `${a}='${n}'`;
3533
+ case "!=":
3534
+ return `${a}!='${n}'`;
3535
+ case "date_before":
3536
+ case "date_after":
3537
+ case "date_on":
3538
+ return `${a}='${n}'`;
3539
+ default:
3540
+ return `${a}='${n}'`;
3541
+ }
3542
+ case "mso":
3543
+ return "mso | IE";
3544
+ default:
3545
+ return `${a} == '${n}'`;
3546
+ }
3547
+ }, fn = (e, t, r) => {
3548
+ if (e.length === 1) return e[0];
3549
+ switch (r) {
3550
+ case "handlebars":
3551
+ case "sendgrid":
3552
+ case "iterable":
3553
+ return t === "all" ? `(and ${e.join(" ")})` : `(or ${e.join(" ")})`;
3554
+ case "sfmc":
3555
+ case "activecampaign":
3556
+ case "mailchimp":
3557
+ case "campaign_monitor":
3558
+ case "pardot":
3559
+ return e.join(t === "all" ? " AND " : " OR ");
3560
+ case "marketo":
3561
+ return e.join(t === "all" ? " && " : " || ");
3562
+ case "liquid":
3563
+ case "klaviyo":
3564
+ case "braze":
3565
+ case "hubspot":
3566
+ return e.join(t === "all" ? " and " : " or ");
3567
+ default:
3568
+ return e.join(t === "all" ? " && " : " || ");
3569
+ }
3570
+ }, qn = (e, t) => {
3571
+ const r = Gn(t)?.wrapOpenTag;
3572
+ if (r) return r(e);
3573
+ switch (t) {
3574
+ case "handlebars":
3575
+ case "sendgrid":
3576
+ case "iterable":
3577
+ return `{{#if ${e}}}`;
3578
+ case "liquid":
3579
+ case "klaviyo":
3580
+ case "braze":
3581
+ case "hubspot":
3582
+ return `{% if ${e} %}`;
3583
+ case "mailchimp":
3584
+ return `*|IF:${e}|*`;
3585
+ case "sfmc":
3586
+ return `%%[ IF ${e} THEN ]%%`;
3587
+ case "activecampaign":
3588
+ return `%IF ${e}%`;
3589
+ case "marketo":
3590
+ return `#if(${e})`;
3591
+ case "campaign_monitor":
3592
+ return `<singleline:${e}>`;
3593
+ case "pardot":
3594
+ return `%%if ${e}%%`;
3595
+ case "mso":
3596
+ return `<!--[if ${e}]>`;
3597
+ default:
3598
+ return `{{#if ${e}}}`;
3599
+ }
3600
+ }, Wn = (e) => {
3601
+ const t = Gn(e)?.wrapCloseTag;
3602
+ if (t) return t();
3603
+ switch (e) {
3604
+ case "handlebars":
3605
+ case "sendgrid":
3606
+ case "iterable":
3607
+ return "{{/if}}";
3608
+ case "liquid":
3609
+ case "klaviyo":
3610
+ case "braze":
3611
+ case "hubspot":
3612
+ return "{% endif %}";
3613
+ case "mailchimp":
3614
+ return "*|END:IF|*";
3615
+ case "sfmc":
3616
+ return "%%[ ENDIF ]%%";
3617
+ case "activecampaign":
3618
+ return "%/IF%";
3619
+ case "marketo":
3620
+ return "#end";
3621
+ case "campaign_monitor":
3622
+ return "</singleline>";
3623
+ case "pardot":
3624
+ return "%%endif%%";
3625
+ case "mso":
3626
+ return "<![endif]-->";
3627
+ default:
3628
+ return "{{/if}}";
3629
+ }
3630
+ }, Nt = (e) => `__esp_ts_${e.replace(/[^a-zA-Z0-9]/g, "_")}`, Bt = (e, t) => `__esp_cmp_${e.replace(/[^a-zA-Z0-9]/g, "_")}_${t.replace(/[^a-zA-Z0-9]/g, "_")}`, ka = (e) => {
3631
+ const t = /* @__PURE__ */ new Set(), r = [];
3632
+ for (const n of e) {
3633
+ const a = n.operator;
3634
+ if (a !== "date_before" && a !== "date_after") continue;
3635
+ const i = Nt(n.tag), o = Bt(n.tag, n.value);
3636
+ t.has(i) || (t.add(i), r.push(`{%- assign ${i} = ${Je(n.tag)} | date: '%s' -%}`)), t.has(o) || (t.add(o), r.push(`{%- assign ${o} = '${n.value}' | date: '%s' -%}`));
3637
+ }
3638
+ return r;
3639
+ }, wa = (e) => e === "liquid" || e === "klaviyo" || e === "braze" || e === "hubspot", xa = (e, t) => {
3640
+ const r = (o, l) => o.length === 0 ? l : [...o].reverse().reduce((c, d) => `*|IF:${d}|*
3641
+ ${c}
3642
+ *|END:IF|*`, l), n = (o, l) => o.length === 0 ? l : o.map((c) => `*|IF:${c}|*
3643
+ ${l}
3644
+ *|END:IF|*`).join(`
3645
+ `), a = (o, l, c) => {
3646
+ const d = o.map((v) => Te(v, "mailchimp")).filter((v) => v !== null);
3647
+ return d.length === 0 ? null : l === "all" ? r(d, c) : n(d, c);
3648
+ }, i = (t.rules ?? []).map((o) => Te(o, "mailchimp")).filter((o) => o !== null);
3649
+ if (t.match === "all") {
3650
+ let o = e;
3651
+ for (const l of [...t.groups ?? []].reverse()) {
3652
+ const c = l.rules.map((d) => Te(d, "mailchimp")).filter((d) => d !== null);
3653
+ c.length !== 0 && (o = l.match === "all" ? r(c, o) : n(c, o));
3654
+ }
3655
+ return i.length > 0 ? r(i, o) : o;
3656
+ } else {
3657
+ const o = [...i.map((l) => `*|IF:${l}|*
3658
+ ${e}
3659
+ *|END:IF|*`), ...(t.groups ?? []).map((l) => a(l.rules, l.match, e)).filter((l) => l !== null)];
3660
+ return o.length > 0 ? o.join(`
3661
+ `) : e;
3662
+ }
3663
+ }, Vn = (e, t) => {
3664
+ const r = $a(t, ya), n = (e.rules ?? []).map((o) => Te(o, t)).filter((o) => o !== null);
3665
+ let a;
3666
+ r.supportsNesting ? a = (e.groups ?? []).map((o) => {
3667
+ const l = o.rules.map((d) => Te(d, t)).filter((d) => d !== null);
3668
+ if (l.length === 0) return null;
3669
+ const c = fn(l, o.match, t);
3670
+ return l.length > 1 ? `(${c})` : c;
3671
+ }).filter((o) => o !== null) : a = (e.groups ?? []).flatMap((o) => o.rules).map((o) => Te(o, t)).filter((o) => o !== null);
3672
+ const i = [...n, ...a];
3673
+ return i.length === 0 ? null : {
3674
+ expression: fn(i, e.match, t),
3675
+ preludes: wa(t) ? ka([...e.rules ?? [], ...(e.groups ?? []).flatMap((o) => o.rules)]) : []
3676
+ };
3677
+ }, be = (e, t, r = "handlebars") => {
3678
+ if (!t?.enabled) return e;
3679
+ const n = (t.rules?.length ?? 0) > 0, a = (t.groups?.length ?? 0) > 0;
3680
+ if (!n && !a) return e;
3681
+ if (r === "mailchimp") return xa(e, t);
3682
+ const i = Vn(t, r);
3683
+ if (!i) return e;
3684
+ const { expression: o, preludes: l } = i, c = qn(o, r), d = Wn(r);
3685
+ return `${l.length > 0 ? `${l.join(`
3686
+ `)}
3687
+ ` : ""}${c}
3688
+ ${e}
3689
+ ${d}`;
3690
+ }, bo = (e, t = "handlebars") => {
3691
+ if (!e?.enabled) return null;
3692
+ const r = (e.rules?.length ?? 0) > 0, n = (e.groups?.length ?? 0) > 0;
3693
+ if (!r && !n) return null;
3694
+ if (t === "mailchimp") {
3695
+ const c = [...e.rules ?? [], ...(e.groups ?? []).flatMap((v) => v.rules)], d = c.map((v) => Te(v, "mailchimp")).find((v) => v !== null);
3696
+ return d ? {
3697
+ openTag: `*|IF:${d}|*${c.length > 1 && e.match === "all" ? " …nested…" : ""}`,
3698
+ closeTag: "*|END:IF|*"
3699
+ } : null;
3700
+ }
3701
+ const a = Vn(e, t);
3702
+ if (!a) return null;
3703
+ const { expression: i, preludes: o } = a, l = qn(i, t);
3704
+ return {
3705
+ openTag: `${o.length > 0 ? `${o.join(`
3706
+ `)}
3707
+ ` : ""}${l}`,
3708
+ closeTag: Wn(t)
3709
+ };
3710
+ }, Kn = (e) => {
3711
+ const t = Je(e.tag), r = String(e.value ?? "");
3712
+ switch (e.operator) {
3713
+ case "==":
3714
+ return `String(${t}).toLowerCase() === ${JSON.stringify(r.toLowerCase())}`;
3715
+ case "!=":
3716
+ return `String(${t}).toLowerCase() !== ${JSON.stringify(r.toLowerCase())}`;
3717
+ case "contains":
3718
+ return `String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3719
+ case "not_contains":
3720
+ return `!String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3721
+ case "starts_with":
3722
+ return `String(${t}).toLowerCase().startsWith(${JSON.stringify(r.toLowerCase())})`;
3723
+ case "ends_with":
3724
+ return `String(${t}).toLowerCase().endsWith(${JSON.stringify(r.toLowerCase())})`;
3725
+ case "in": {
3726
+ const n = r.split(/[,\n;]+/).map((a) => a.trim().toLowerCase()).filter(Boolean);
3727
+ return `${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3728
+ }
3729
+ case "not_in": {
3730
+ const n = r.split(/[,\n;]+/).map((a) => a.trim().toLowerCase()).filter(Boolean);
3731
+ return `!${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3732
+ }
3733
+ case ">":
3734
+ return `Number(${t}) > ${Number(r)}`;
3735
+ case "<":
3736
+ return `Number(${t}) < ${Number(r)}`;
3737
+ case ">=":
3738
+ return `Number(${t}) >= ${Number(r)}`;
3739
+ case "<=":
3740
+ return `Number(${t}) <= ${Number(r)}`;
3741
+ case "date_before":
3742
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) < new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3743
+ case "date_after":
3744
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) > new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3745
+ case "date_on":
3746
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) === new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3747
+ case "is_empty":
3748
+ return `(!${t} || String(${t}).trim() === "")`;
3749
+ case "is_not_empty":
3750
+ return `(!!${t} && String(${t}).trim() !== "")`;
3751
+ default:
3752
+ return "true";
3753
+ }
3754
+ }, Ca = (e) => {
3755
+ if (!e.rules.length) return null;
3756
+ const t = e.rules.map(Kn);
3757
+ return t.length === 1 ? t[0] : `(${t.join(e.match === "any" ? " || " : " && ")})`;
3758
+ }, _a = (e) => {
3759
+ const t = (e.rules ?? []).map(Kn), r = (e.groups ?? []).map(Ca).filter((i) => i !== null), n = [...t, ...r];
3760
+ if (n.length === 0) return null;
3761
+ if (n.length === 1) return n[0];
3762
+ const a = e.match === "any" ? " || " : " && ";
3763
+ return `(${n.join(a)})`;
3764
+ }, nt = (e, t) => {
3765
+ if (!t?.enabled) return e;
3766
+ const r = (t.rules?.length ?? 0) > 0, n = (t.groups?.length ?? 0) > 0;
3767
+ if (!r && !n) return e;
3768
+ const a = _a(t);
3769
+ return a ? `{${a} && (
3770
+ ${e.split(`
3771
+ `).map((i) => ` ${i}`).join(`
3772
+ `)}
3773
+ )}` : e;
3774
+ }, Ae = ({ content: e, filename: t, mimeType: r }) => {
3775
+ const n = new Blob([e], { type: r }), a = URL.createObjectURL(n), i = document.createElement("a");
3776
+ i.href = a, i.download = t, i.click(), URL.revokeObjectURL(a);
3777
+ }, ht = (e) => e.toLowerCase().replace(/\s+/g, "-"), Ne = (e, t) => `${e}${t === "wrap" ? "-master" : "-snapshot"}`, Ta = /(<style[\s>][\s\S]*?<\/style>|<script[\s>][\s\S]*?<\/script>|<!--[\s\S]*?-->)/gi;
3778
+ function Yn(e) {
3779
+ const t = e.split(Ta), r = [];
3780
+ return t.forEach((n, a) => {
3781
+ if (a % 2 === 1) {
3782
+ let i = n.replace(/^[ \t]+|[ \t]+$/gm, "");
3783
+ i = i.replace(/\n{2,}/g, `
3784
+ `), r.push(i);
3785
+ } else {
3786
+ let i = n.replace(/>\s+</g, "><");
3787
+ i = i.replace(/[ \t]{2,}/g, " "), i = i.replace(/\n+/g, ""), r.push(i);
3788
+ }
3789
+ }), r.join("");
3790
+ }
3791
+ function Aa(e) {
3792
+ return e && Yn(e);
3793
+ }
3794
+ function Ra(e) {
3795
+ return e && Yn(e);
3796
+ }
3797
+ function Ea(e) {
3798
+ if (!e) return e;
3799
+ let t = e.replace(/^[ \t]+|[ \t]+$/gm, "");
3800
+ return t = t.replace(/\n{3,}/g, `
3801
+
3802
+ `), t.trim();
3803
+ }
3804
+ function Be(e, t) {
3805
+ switch (e) {
3806
+ case "html":
3807
+ return Aa(t);
3808
+ case "mjml":
3809
+ return Ra(t);
3810
+ case "react-email":
3811
+ return Ea(t);
3812
+ default:
3813
+ return t;
3814
+ }
3815
+ }
3816
+ var Xn = "maildeno:export:minify", lt = P(Ma());
3817
+ function Ma() {
3818
+ if (typeof window > "u") return !1;
3819
+ try {
3820
+ return localStorage.getItem(Xn) === "true";
3821
+ } catch {
3822
+ return !1;
3823
+ }
3824
+ }
3825
+ hn(lt, (e) => {
3826
+ if (!(typeof window > "u"))
3827
+ try {
3828
+ localStorage.setItem(Xn, String(e));
3829
+ } catch {
3830
+ }
3831
+ });
3832
+ function Kt() {
3833
+ return {
3834
+ minifyOutput: lt,
3835
+ toggleMinify: () => {
3836
+ lt.value = !lt.value;
3837
+ }
3838
+ };
3839
+ }
3840
+ var Ia = 5, Na = (e) => {
3841
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: d, buildMobileStyleBlock: v } = e, { evaluateVisibility: b } = ft(), E = (s) => s.type === "component" ? s.props?.visibility : s.visibility, w = (s) => {
3842
+ if (!s?.enabled) return !1;
3843
+ const S = (s.rules?.length ?? 0) > 0, C = (s.groups?.length ?? 0) > 0;
3844
+ return S || C;
3845
+ }, R = (s, S, C, _) => {
3846
+ let g = "";
3847
+ for (const m of s) {
3848
+ if (C === "prune" && !b(E(m), S)) continue;
3849
+ const h = m.type;
3850
+ if (h === "row") {
3851
+ if (_ >= Ia) continue;
3852
+ const $ = M(m, S, C, _ + 1);
3853
+ $.trim() && (g += `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">${$}</table>`);
3854
+ continue;
3855
+ }
3856
+ if (h === "row-spacer") {
3857
+ if (!m.height || m.height <= 0) continue;
3858
+ const $ = ce(m);
3859
+ let k = `<div height="${m.height}" style="height:${m.height}px;line-height:${m.height}px;font-size:1px;mso-line-height-rule:exactly;${$.join(";")}">&nbsp;</div>`;
3860
+ C === "wrap" && w(m.visibility) && (k = be(k, m.visibility, a.value)), g += k;
3861
+ continue;
3862
+ }
3863
+ let x = Un(n.html(m), C, o?.value);
3864
+ const y = m.props?.visibility;
3865
+ C === "wrap" && w(y) && (x = be(x, y, a.value)), g += x;
3866
+ }
3867
+ return g;
3868
+ }, M = (s, S, C, _ = 0) => {
3869
+ if (s.type === "row-spacer") {
3870
+ if (!s.height || s.height <= 0) return "";
3871
+ const I = ce(s);
3872
+ let L = `
3873
+ <tr>
3874
+ <td>
3875
+ <div height="${s.height}" style="height:${s.height}px;line-height:${s.height}px;font-size:1px;mso-line-height-rule:exactly;${I.join(";")}">&nbsp;
3876
+ </div>
3877
+ </td>
3878
+ </tr>
3879
+ `;
3880
+ return C === "wrap" && w(s.visibility) && (L = be(L, s.visibility, a.value)), L;
3881
+ }
3882
+ const g = ce(s), m = r.value.mobileBreakpoint || 600, h = (s.gap || 0) / m * 100, x = 100 - h * (s.columns.length - 1), y = [];
3883
+ let $ = 0;
3884
+ s.columns.forEach((I) => {
3885
+ const L = I.width / 100 * x;
3886
+ y.push(L), $ += L;
3887
+ });
3888
+ const k = x - $;
3889
+ Math.abs(k) > 0.01 && y.length > 0 && (y[y.length - 1] += k);
3890
+ let A = "";
3891
+ s.columns.forEach((I, L) => {
3892
+ if (C === "prune" && !b(I.props?.visibility, S)) return;
3893
+ const V = y[L], q = s.mobileStack ? "mobile-stack" : "", W = ce(I), Q = [
3894
+ `width:${V}%`,
3895
+ `max-width:${V}%`,
3896
+ `vertical-align:${I.verticalAlign ?? "middle"}`,
3897
+ "box-sizing:border-box",
3898
+ ...W,
3899
+ ue(I.border),
3900
+ `border-radius:${Y(I.border.radius)}`,
3901
+ "overflow:hidden",
3902
+ "line-height:0",
3903
+ "font-size:0",
3904
+ `padding:${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`
3905
+ ], se = I.children ?? I.components ?? [], pe = R(se, S, C, _);
3906
+ A += `
3907
+ <td valign="${I.verticalAlign ?? "middle"}"${q ? ` class="${q}"` : ""} style="${Q.join(";")}">
3908
+ ${pe}
3909
+ </td>
3910
+ `, L < s.columns.length - 1 && s.gap && (A += `
3911
+ <td
3912
+ class="${q ? `gap-${s.gap} ${q}` : `gap-${s.gap}`}"
3913
+ width="${h}%"
3914
+ style="width:${h}%;max-width:${h}%;font-size:0;line-height:0;padding:0;">
3915
+ &nbsp;
3916
+ </td>
3917
+ `);
3918
+ });
3919
+ const f = s.columns.some((I) => ee(I.border?.radius ?? 0));
3920
+ let B = `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(s.gap ?? 0) > 0 || f ? "separate" : "collapse"};">
3921
+ <tr>
3922
+ ${A}
3923
+ </tr>
3924
+ </table>`;
3925
+ const z = ee(s.border?.radius ?? 0), N = [
3926
+ ...g,
3927
+ z ? `border-radius:${Y(s.border.radius, 2)}` : "",
3928
+ "overflow:hidden"
3929
+ ].filter(Boolean);
3930
+ let F = Ln(B, s.border, [], s.padding);
3931
+ return C === "wrap" && w(s.visibility) && (F = be(F, s.visibility, a.value)), (s.minHeight ?? 0) > 0 && N.push(`min-height:${s.minHeight}px`), `
3932
+ <tr>
3933
+ <td${N.length ? ` style="${N.join(";")}"` : ""}>
3934
+ ${F}
3935
+ </td>
3936
+ </tr>
3937
+ `;
3938
+ }, O = (s, S) => {
3939
+ const { getGoogleFontImports: C } = gt(), { emailMobileStyles: _ } = Jt(), g = i?.value ?? {}, m = C([...c(s, g)]), h = d(s, g, _), x = v(r.value.mobileBreakpoint, h), y = [
3940
+ "margin:0",
3941
+ "padding:0",
3942
+ r.value.bodyBackgroundColor ? `background-color:${r.value.bodyBackgroundColor}` : "",
3943
+ r.value.bodyBackgroundImage ? [
3944
+ `background-image:url('${r.value.bodyBackgroundImage}')`,
3945
+ `background-size:${r.value.bodyBackgroundSize}`,
3946
+ `background-position:${r.value.bodyBackgroundPosition}`,
3947
+ `background-repeat:${r.value.bodyBackgroundRepeat}`,
3948
+ "min-height:auto"
3949
+ ].join(";") : ""
3950
+ ].filter(Boolean).join(";");
3951
+ let $ = `<!DOCTYPE html>
3952
+ <html lang="${r.value.language}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
3953
+ <head>
3954
+ <meta charset="UTF-8">
3955
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
3956
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3957
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
3958
+ <meta name="x-apple-disable-message-reformatting">
3959
+ <meta name="color-scheme" content="light dark">
3960
+ <meta name="supported-color-schemes" content="light dark">
3961
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
3962
+ <title>${S}</title>
3963
+ <!--[if mso]>
3964
+ <xml>
3965
+ <o:OfficeDocumentSettings>
3966
+ <o:PixelsPerInch>96</o:PixelsPerInch>
3967
+ <o:AllowPNG/>
3968
+ </o:OfficeDocumentSettings>
3969
+ </xml>
3970
+ <![endif]-->
3971
+ ${m ? `<link href="${m}" rel="stylesheet">` : ""}
3972
+ <style>
3973
+ ${x}
3974
+ </style>
3975
+ </head>
3976
+
3977
+ <body style="${y};">
3978
+ <div style="display:none;font-size:1px;color:#fefefe;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">
3979
+ ${r.value.preheaderText} &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp;
3980
+ </div>
3981
+ <table width="100%" cellpadding="0" cellspacing="0">
3982
+ <tr>
3983
+ <td style="padding:${r.value.padding?.top ?? 0}px ${r.value.padding?.right ?? 0}px ${r.value.padding?.bottom ?? 0}px ${r.value.padding?.left ?? 0}px;">
3984
+
3985
+ <table
3986
+ width="100%"
3987
+ align="center"
3988
+ cellpadding="0"
3989
+ cellspacing="0"
3990
+ class="email-container"
3991
+ style="width:100%;max-width:${r.value.width}px;background:${r.value.backgroundColor};border-collapse:collapse;"
3992
+ >
3993
+ `;
3994
+ return t.value.forEach((k) => {
3995
+ if (s === "prune" && !b(k.visibility, g)) return;
3996
+ const A = M(k, g, s, 0);
3997
+ A.trim() && ($ += A);
3998
+ }), $ += `
3999
+ </table>
4000
+ </td>
4001
+ </tr>
4002
+ </table>
4003
+ </body>
4004
+ </html>
4005
+ `, $ = Hn($, s, a.value, o?.value), $;
4006
+ };
4007
+ return {
4008
+ export: async (s = "prune", S) => {
4009
+ if (!l("Export")) return;
4010
+ const C = S || "Untitled Template", _ = O(s, C), g = ht(C), { minifyOutput: m } = Kt();
4011
+ if (m.value) Ae({
4012
+ content: Be("html", _),
4013
+ filename: `${Ne(g, s)}.html`,
4014
+ mimeType: "text/html"
4015
+ });
4016
+ else {
4017
+ const h = await oa(_);
4018
+ Ae({
4019
+ content: h,
4020
+ filename: `${Ne(g, s)}.html`,
4021
+ mimeType: "text/html"
4022
+ });
4023
+ }
4024
+ },
4025
+ getHTML: (s = "prune", S) => {
4026
+ if (!t.value || t.value.length === 0) return null;
4027
+ const C = O(s, S || "Untitled Template");
4028
+ return Be("html", C);
4029
+ }
4030
+ };
4031
+ }, Ba = 5, Oa = (e) => {
4032
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: d, buildMobileStyleBlock: v } = e, { evaluateVisibility: b } = ft(), E = (u) => {
4033
+ if (!u?.enabled) return !1;
4034
+ const s = (u.rules?.length ?? 0) > 0, S = (u.groups?.length ?? 0) > 0;
4035
+ return s || S;
4036
+ }, w = (u, s, S, C, _) => {
4037
+ let g = "";
4038
+ for (const m of u) {
4039
+ const h = m.type === "component" ? m.props?.visibility : m.visibility;
4040
+ if (S === "prune" && !b(h, s)) continue;
4041
+ const x = m.type;
4042
+ if (x === "row") {
4043
+ if (_ >= Ba) continue;
4044
+ const $ = R(m, s, S, _ + 1);
4045
+ $.trim() && (g += ` ${$.trim()}
4046
+ `);
4047
+ continue;
4048
+ }
4049
+ if (x === "row-spacer") {
4050
+ if (!m.height || m.height <= 0) continue;
4051
+ const $ = et(m), k = Object.keys($).length > 0 ? `, ${Object.entries($).map(([f, B]) => `${f}:"${B}"`).join(", ")}` : "";
4052
+ let A = `<div style={{ display: "block", height: "${m.height}px", lineHeight: "${m.height}px", fontSize: "1px"${k} }}>&nbsp;</div>`;
4053
+ S === "wrap" && E(m.visibility) && (A = nt(A, m.visibility)), g += ` ${A}
4054
+ `;
4055
+ continue;
4056
+ }
4057
+ let y = Un(n.react(m), S, o?.value);
4058
+ S === "wrap" && E(m.props?.visibility) && (y = nt(y, m.props.visibility)), g += ` ${y.trim()}
4059
+ `;
4060
+ }
4061
+ return g;
4062
+ }, R = (u, s, S, C = 0) => {
4063
+ if (S === "prune" && !b(u.visibility, s)) return "";
4064
+ if (u.type === "row-spacer") {
4065
+ if (!u.height || u.height <= 0) return "";
4066
+ const I = et(u), L = Object.keys(I).length > 0 ? `, ${Object.entries(I).map(([q, W]) => `${q}:"${W}"`).join(", ")}` : "";
4067
+ let V = `
4068
+ {/* Row Spacer */}
4069
+ <Section>
4070
+ <div style={{ display: "block", height: "${u.height}px", lineHeight: "${u.height}px", fontSize: "1px"${L} }}>&nbsp;</div>
4071
+ </Section>`;
4072
+ return S === "wrap" && E(u.visibility) && (V = nt(V, u.visibility)), V;
4073
+ }
4074
+ const _ = r.value.mobileBreakpoint || 600, g = (u.gap || 0) / _ * 100, m = 100 - g * (u.columns.length - 1), h = [];
4075
+ let x = 0;
4076
+ u.columns.forEach((I) => {
4077
+ const L = I.width / 100 * m;
4078
+ h.push(L), x += L;
4079
+ });
4080
+ const y = m - x;
4081
+ Math.abs(y) > 0.01 && h.length > 0 && (h[h.length - 1] += y);
4082
+ let $ = "";
4083
+ u.columns.forEach((I, L) => {
4084
+ if (S === "prune" && !b(I.props?.visibility, s)) return;
4085
+ const V = h[L], q = u.mobileStack ? "mobile-stack" : "", W = et(I), Q = {
4086
+ width: `${V}%`,
4087
+ boxSizing: "border-box",
4088
+ verticalAlign: I.verticalAlign ?? "middle",
4089
+ ...At(I.border),
4090
+ borderRadius: Y(I.border?.radius ?? 0),
4091
+ overflow: "hidden",
4092
+ lineHeight: "0",
4093
+ fontSize: "0",
4094
+ padding: `${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`,
4095
+ ...W
4096
+ }, se = Object.entries(Q).map(([le, ze]) => `${le}:"${ze}"`).join(", "), pe = I.children ?? I.components ?? [], me = w(pe, s, S, u, C);
4097
+ $ += `<Column
4098
+ className="${q}"
4099
+ style={{ ${se} }}
4100
+ >
4101
+ ${me}
4102
+ </Column>
4103
+ `, L < u.columns.length - 1 && u.gap && ($ += `<Column
4104
+ className="${q ? `gap-${u.gap} ${q}` : `gap-${u.gap}`}"
4105
+ style={{ width:"${g}%", maxWidth:"${g}%", fontSize:"0", lineHeight:"0" }}
4106
+ >&nbsp;</Column>
4107
+ `);
4108
+ });
4109
+ const k = et(u), A = ee(u.border?.radius ?? 0), f = {
4110
+ ...k,
4111
+ ...A ? { borderRadius: Y(u.border.radius, 2) } : {},
4112
+ overflow: "hidden"
4113
+ }, B = Object.entries(f).filter(([I, L]) => L !== void 0 && L !== "").map(([I, L]) => `${I}:"${L}"`).join(", "), z = B ? ` style={{ ${B} }}` : "", N = `<Row>${$}</Row>`;
4114
+ let F = ` <Section${z}>
4115
+ ${ra(N, u.border, {}, u.padding, !0)}
4116
+ </Section>`;
4117
+ return S === "wrap" && E(u.visibility) && (F = nt(F, u.visibility)), F;
4118
+ }, M = (u = "prune", s) => {
4119
+ const S = s || "Untitled Template", C = S.replace(/[^a-zA-Z0-9 ]/g, "").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(""), { getGoogleFontImports: _ } = gt(), { emailMobileStyles: g } = Jt(), m = i?.value ?? {}, h = c(u, m), x = _([...h]), y = d(u, m, g), $ = v(r.value.mobileBreakpoint, y), k = t.value.map((N) => R(N, m, u, 0)).filter(Boolean).join(`
4120
+ `), A = x?.includes("fonts.googleapis.com"), f = x ? A ? ` {/* Google Fonts via <link> — all families in one request */}
4121
+ <link href="${x}" rel="stylesheet" />` : [...h].map((N) => ` <Font
4122
+ fontFamily="${mt(N)}"
4123
+ fallbackFontFamily="Arial"
4124
+ webFont={{ url: "${x}", format: "woff2" }}
4125
+ fontWeight={400}
4126
+ fontStyle="normal"
4127
+ />`).join(`
4128
+ `) : "";
4129
+ let B = `import React from "react";
4130
+ import {
4131
+ Preview,
4132
+ Body,
4133
+ Container,
4134
+ Button,
4135
+ Column,
4136
+ Font,
4137
+ Head,
4138
+ Heading,
4139
+ Hr,
4140
+ Html,
4141
+ Img,
4142
+ Link,
4143
+ Row,
4144
+ Section,
4145
+ Text,
4146
+ } from "@react-email/components";
4147
+
4148
+ ${x ? A ? "// Google Fonts loaded via <link> (email-safe fallback strategy)" : `// Custom web font${h.size > 1 ? "s" : ""} loaded via <Font> — one instance per family` : "// No custom fonts used"}
4149
+
4150
+ const styles = \`
4151
+ ${$}
4152
+ \`;
4153
+
4154
+ export default function ${C}() {
4155
+ return (
4156
+ <Html lang="${r.value.language}">
4157
+ <Head>
4158
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
4159
+ <meta name="x-apple-disable-message-reformatting" />
4160
+ <meta httpEquiv="Content-Type" content="text/html; charset=UTF-8" />
4161
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
4162
+ <meta name="color-scheme" content="light dark" />
4163
+ <meta name="supported-color-schemes" content="light dark" />
4164
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no" />
4165
+ <title>${S}</title>
4166
+ <style>{styles}</style>
4167
+ ${f}
4168
+ </Head>
4169
+ <Preview>${r.value.preheaderText}</Preview>
4170
+ <Body style={{ margin:0, padding:0, backgroundColor:"${r.value.bodyBackgroundColor}" }}>
4171
+ <Container style={{
4172
+ margin: 0,
4173
+ padding: 0,
4174
+ maxWidth: "100%",
4175
+ ${r.value.bodyBackgroundImage ? `
4176
+ backgroundImage: "url('${r.value.bodyBackgroundImage}')",
4177
+ backgroundSize: "${r.value.bodyBackgroundSize}",
4178
+ backgroundPosition: "${r.value.bodyBackgroundPosition}",
4179
+ backgroundRepeat: "${r.value.bodyBackgroundRepeat}",
4180
+ ` : ""}
4181
+ }}>
4182
+ <Container
4183
+ className="email-container"
4184
+ style={{
4185
+ width:"100%",
4186
+ maxWidth:"${r.value.width}px",
4187
+ backgroundColor:"${r.value.backgroundColor}",
4188
+ padding:"${r.value.padding?.top ?? 0}px ${r.value.padding?.right ?? 0}px ${r.value.padding?.bottom ?? 0}px ${r.value.padding?.left ?? 0}px"
4189
+ }}
4190
+ >
4191
+ ${k}
4192
+ </Container>
4193
+ </Container>
4194
+ </Body>
4195
+ </Html>
4196
+ );
4197
+ }
4198
+ `;
4199
+ const z = o?.value?.mergeTagActive || o?.value?.linkTagActive;
4200
+ if (u === "wrap" || !z) {
4201
+ const N = ga(B), F = new Set(N.map((W) => W.tagId)), I = ha(t.value).filter((W) => !F.has(W)), { propsInterface: L, propsDestructure: V } = fa(N), q = va(I);
4202
+ (L || q) && (B = B.replace(/^(export default function (\w+))\(\)\s*\{/m, [
4203
+ L ? `${L}
4204
+
4205
+ ` : "",
4206
+ `$1(${V || ""}) {`,
4207
+ q ? `
4208
+ ${q}
4209
+ ` : ""
4210
+ ].join(""))), B = ma(B);
4211
+ }
4212
+ return B = En(B), B;
4213
+ };
4214
+ return {
4215
+ export: async (u = "prune", s) => {
4216
+ if (!l("Export")) return;
4217
+ const S = s || "Untitled Template", C = M(u, S), _ = ht(S), { minifyOutput: g } = Kt();
4218
+ if (g.value) Ae({
4219
+ content: Be("react-email", C),
4220
+ filename: `${Ne(_, u)}.tsx`,
4221
+ mimeType: "text/plain"
4222
+ });
4223
+ else {
4224
+ const m = await ia(C);
4225
+ Ae({
4226
+ content: m,
4227
+ filename: `${Ne(_, u)}.tsx`,
4228
+ mimeType: "text/plain"
4229
+ });
4230
+ }
4231
+ },
4232
+ getReactEmail: (u = "prune", s) => {
4233
+ if (!t.value || t.value.length === 0) return null;
4234
+ const S = M(u, s || "Untitled Template");
4235
+ return Be("react-email", S);
4236
+ }
4237
+ };
4238
+ }, ja = 5, za = (e) => {
4239
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: d } = e, { evaluateVisibility: v } = ft(), b = (p) => {
4240
+ if (!p?.enabled) return !1;
4241
+ const u = (p.rules?.length ?? 0) > 0, s = (p.groups?.length ?? 0) > 0;
4242
+ return u || s;
4243
+ }, E = (p, u, s, S) => {
4244
+ let C = "";
4245
+ for (const _ of p) {
4246
+ const g = _.type === "component" ? _.props?.visibility : _.visibility;
4247
+ if (s === "prune" && !v(g, u)) continue;
4248
+ const m = _.type;
4249
+ if (m === "row") {
4250
+ if (S >= ja) continue;
4251
+ const x = w(_, u, s, S + 1);
4252
+ if (x.trim()) {
4253
+ let y = x;
4254
+ s === "wrap" && b(_.visibility) && (y = be(y, _.visibility, a.value)), C += y;
4255
+ }
4256
+ continue;
4257
+ }
4258
+ if (m === "row-spacer") {
4259
+ if (!_.height || _.height <= 0) continue;
4260
+ const x = ce(_);
4261
+ let y = `<div height="${_.height}" style="height:${_.height}px;line-height:${_.height}px;font-size:1px;mso-line-height-rule:exactly;${x.join(";")}">&nbsp;</div>`;
4262
+ s === "wrap" && b(_.visibility) && (y = be(y, _.visibility, a.value)), C += y;
4263
+ continue;
4264
+ }
4265
+ let h = `<div style="font-family:none;font-size:0;line-height:0;text-align:left;color:#000000;">${n.mjml(_).replace(/^<mj-text[^>]*>/i, "").replace(/<\/mj-text>\s*$/i, "")}</div>`;
4266
+ s === "wrap" && b(_.props?.visibility) && (h = be(h, _.props.visibility, a.value)), C += h;
4267
+ }
4268
+ return C;
4269
+ }, w = (p, u, s, S) => {
4270
+ if (!p.columns?.length) return "";
4271
+ const C = ce(p), _ = r.value.mobileBreakpoint || 600, g = p.gap || 0, m = g / _ * 100, h = 100 - m * (p.columns.length - 1), x = [];
4272
+ let y = 0;
4273
+ p.columns.forEach((N) => {
4274
+ const F = N.width / 100 * h;
4275
+ x.push(F), y += F;
4276
+ });
4277
+ const $ = h - y;
4278
+ Math.abs($) > 0.01 && x.length > 0 && (x[x.length - 1] += $);
4279
+ let k = "";
4280
+ p.columns.forEach((N, F) => {
4281
+ if (s === "prune" && !v(N.props?.visibility, u)) return;
4282
+ const I = x[F], L = p.mobileStack ? "mobile-stack" : "", V = ce(N), q = [
4283
+ `width:${I}%`,
4284
+ "box-sizing:border-box",
4285
+ `vertical-align:${N.verticalAlign ?? "middle"}`,
4286
+ ue(N.border),
4287
+ `border-radius:${Y(N.border.radius)}`,
4288
+ "overflow:hidden",
4289
+ ...V
4290
+ ], W = N.children ?? N.components ?? [], Q = E(W, u, s, S), se = Ln(Q, N.border, [], N.padding), pe = L ? ` class="${L}"` : "";
4291
+ if (k += `<td valign="${N.verticalAlign ?? "middle"}"${pe} style="${q.join(";")}">
4292
+ ${se}
4293
+ </td>
4294
+ `, F < p.columns.length - 1 && g > 0) {
4295
+ const me = L ? `gap-${g} ${L}` : `gap-${g}`;
4296
+ k += `<td class="${me}" width="${m}%" style="width:${m}%;max-width:${m}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4297
+ `;
4298
+ }
4299
+ });
4300
+ const A = de(p.border) ? `${ue(p.border)};border-radius:${Y(p.border.radius)};overflow:hidden;` : `border-radius:${Y(p.border.radius)};overflow:hidden;`, f = p.padding ? `${p.padding.top ?? 0}px ${p.padding.right ?? 0}px ${p.padding.bottom ?? 0}px ${p.padding.left ?? 0}px` : "0px", B = C.length ? `${C.join(";")};` : "", z = p.columns.some((N) => ee(N.border?.radius ?? 0));
4301
+ return `<div style="padding:${f};${A}${B}">
4302
+ <table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(p.gap ?? 0) > 0 || z ? "separate" : "collapse"};">
4303
+ <tr>
4304
+ ${k}</tr>
4305
+ </table>
4306
+ </div>`;
4307
+ }, R = (p = "prune", u) => {
4308
+ const s = u || "Untitled Template", { getGoogleFontImports: S } = gt(), { emailMobileStyles: C } = Jt(), { assembleMJML: _ } = Nn(), g = i?.value ?? {}, m = S([...c(p, g)]), h = d(p, g, C), x = Pn(t.value), y = [
4309
+ ".email-container { max-width:100% !important; width:100% !important; }",
4310
+ ".desktop-hide { display:block !important; }",
4311
+ ".mobile-hide { display:none !important; }",
4312
+ ".mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }",
4313
+ ...x ? [x] : []
4314
+ ].join(`
4315
+
4316
+ `), $ = h.length > 0 ? [
4317
+ y,
4318
+ "/* Mobile property overrides */",
4319
+ ...h
4320
+ ].join(`
4321
+ `) : y, k = [];
4322
+ t.value.forEach((f) => {
4323
+ if (p === "prune" && !v(f.visibility, g)) return;
4324
+ if (f.type === "row-spacer") {
4325
+ if (!f.height || f.height <= 0) return;
4326
+ const H = ce(f);
4327
+ let D = ` <mj-raw>
4328
+ <table width="100%" cellpadding="0" cellspacing="0">
4329
+ <tr>
4330
+ <td>
4331
+ <div height="${f.height}" style="height:${f.height}px;line-height:${f.height}px;font-size:1px;mso-line-height-rule:exactly;${H.join(";")}">&nbsp;</div>
4332
+ </td>
4333
+ </tr>
4334
+ </table>
4335
+ </mj-raw>`;
4336
+ p === "wrap" && b(f.visibility) && (D = be(D, f.visibility, a.value)), k.push(D);
4337
+ return;
4338
+ }
4339
+ const B = r.value.mobileBreakpoint || 600, z = f.gap || 0, N = z / B * 100, F = 100 - N * (f.columns.length - 1), I = [];
4340
+ let L = 0;
4341
+ f.columns.forEach((H) => {
4342
+ const D = H.width / 100 * F;
4343
+ I.push(D), L += D;
4344
+ });
4345
+ const V = F - L;
4346
+ Math.abs(V) > 0.01 && I.length > 0 && (I[I.length - 1] += V);
4347
+ const q = ce(f), W = (() => {
4348
+ const H = f.backgroundGradient;
4349
+ return H?.useGradient === !0 && Array.isArray(H?.gradient?.colors) && H.gradient.colors.length >= 2 ? H.solid || f.backgroundColor || "" : f.backgroundColor || "";
4350
+ })(), Q = W && W !== "transparent" ? W : "", se = f.padding ? `${f.padding.top ?? 0}px ${f.padding.right ?? 0}px ${f.padding.bottom ?? 0}px ${f.padding.left ?? 0}px` : "0px", pe = ee(f.border?.radius ?? 0), me = de(f.border) && !ee(f.border?.radius ?? 0), le = [...q, "overflow:hidden"];
4351
+ me && (le.push(ue(f.border)), le.push(`padding:${se}`)), pe && le.push(`border-radius:${Y(f.border.radius, 2)}`), (f.minHeight ?? 0) > 0 && le.push(`min-height:${f.minHeight}px`);
4352
+ const ze = le.length ? ` style="${le.join(";")}"` : "";
4353
+ let Pe = "";
4354
+ de(f.border) && (Pe = `${ue(f.border)};`, ee(f.border?.radius ?? 0) && (Pe += `border-radius:${Y(f.border.radius)};overflow:hidden;`));
4355
+ const qe = [
4356
+ `padding:${se}`,
4357
+ "font-size:0",
4358
+ "line-height:0",
4359
+ Pe
4360
+ ].filter(Boolean).join(";");
4361
+ let U = "";
4362
+ f.columns.forEach((H, D) => {
4363
+ if (p === "prune" && !v(H.props?.visibility, g)) return;
4364
+ const te = I[D], Re = f.mobileStack ? "mobile-stack" : "", vt = ce(H), bt = [
4365
+ `width:${te}%`,
4366
+ "box-sizing:border-box",
4367
+ `vertical-align:${H.verticalAlign ?? "middle"}`,
4368
+ ...vt,
4369
+ ue(H.border),
4370
+ `border-radius:${Y(H.border?.radius ?? 0)}`,
4371
+ "overflow:hidden",
4372
+ "line-height:0",
4373
+ "font-size:0",
4374
+ `padding:${H.padding?.top ?? 0}px ${H.padding?.right ?? 0}px ${H.padding?.bottom ?? 0}px ${H.padding?.left ?? 0}px`
4375
+ ], We = H.children ?? H.components ?? [], $t = E(We, g, p, 0), yt = Re ? ` class="${Re}"` : "";
4376
+ if (U += `<td valign="${H.verticalAlign ?? "middle"}"${yt} style="${bt.join(";")}">
4377
+ ${$t}
4378
+ </td>
4379
+ `, D < f.columns.length - 1 && z > 0) {
4380
+ const ne = Re ? `gap-${z} ${Re}` : `gap-${z}`;
4381
+ U += `<td class="${ne}" width="${N}%" style="width:${N}%;max-width:${N}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4382
+ `;
4383
+ }
4384
+ });
4385
+ const X = f.columns.some((H) => ee(H.border?.radius ?? 0));
4386
+ let ke = `<div style="${qe}">${`<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(f.gap ?? 0) > 0 || X ? "separate" : "collapse"};">
4387
+ <tr>
4388
+ ${U}</tr>
4389
+ </table>`}</div>`;
4390
+ p === "wrap" && b(f.visibility) && (ke = be(ke, f.visibility, a.value));
4391
+ const $e = r.value.width ?? 600;
4392
+ k.push(` <mj-raw>
4393
+ <!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:${$e}px;" width="${$e}"${Q ? ` bgcolor="${Q}"` : ""}><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
4394
+ <div style="margin:0px auto;max-width:${$e}px;">
4395
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
4396
+ <tbody>
4397
+ <tr>
4398
+ <td${ze}>
4399
+ ${ke}
4400
+ </td>
4401
+ </tr>
4402
+ </tbody>
4403
+ </table>
4404
+ </div>
4405
+ <!--[if mso | IE]></td></tr></table><![endif]-->
4406
+ </mj-raw>`);
4407
+ });
4408
+ let A = _(s, k.join(`
4409
+ `), r.value, m, $, r.value.mobileBreakpoint ?? 600, "");
4410
+ return A = Hn(A, p, a.value, o?.value, !0), A;
4411
+ };
4412
+ return {
4413
+ export: async (p = "prune", u) => {
4414
+ if (!l("Export")) return;
4415
+ const s = u || "Untitled Template", S = R(p, s), C = ht(s), { minifyOutput: _ } = Kt();
4416
+ if (_.value) Ae({
4417
+ content: Be("mjml", S),
4418
+ filename: `${Ne(C, p)}.mjml`,
4419
+ mimeType: "text/plain"
4420
+ });
4421
+ else {
4422
+ const g = await sa(S);
4423
+ Ae({
4424
+ content: g,
4425
+ filename: `${Ne(C, p)}.mjml`,
4426
+ mimeType: "text/plain"
4427
+ });
4428
+ }
4429
+ },
4430
+ getMJML: (p = "prune", u) => {
4431
+ if (!t.value || t.value.length === 0) return null;
4432
+ const s = R(p, u || "Untitled Template");
4433
+ return Be("mjml", s);
4434
+ }
4435
+ };
4436
+ }, Pa = (e) => {
4437
+ const { rows: t, canvasStyles: r, saveToHistoryFn: n, guardEmpty: a } = e, i = e.notify ?? ((v, b = "Import failed") => console.error(`[maildeno-editor] ${b}: ${v}`)), o = (v) => {
4438
+ const b = v || "Untitled Template";
4439
+ return {
4440
+ template_id: ot(b),
4441
+ template_name: b,
4442
+ canvas: Tn(JSON.parse(JSON.stringify(r.value))),
4443
+ rows: An(JSON.parse(JSON.stringify(t.value))),
4444
+ schema_version: "1.0"
4445
+ };
4446
+ };
4447
+ return {
4448
+ export: (v) => {
4449
+ if (!a("Export")) return;
4450
+ const b = o(v);
4451
+ Ae({
4452
+ content: JSON.stringify(b, null, 2),
4453
+ filename: `${ht(b.template_name)}.json`,
4454
+ mimeType: "application/json"
4455
+ });
4456
+ },
4457
+ import: (v, b) => {
4458
+ const E = new FileReader();
4459
+ E.onload = (w) => {
4460
+ try {
4461
+ let R = JSON.parse(w.target?.result);
4462
+ R = vn(R), R.canvas && R.rows ? (r.value = ct(R.canvas), t.value = ut(R.rows), b.value = null, n("import")) : i("That file isn't a Maildeno template. Export one from the editor (Export → JSON) and try again.", "Invalid template file");
4463
+ } catch (R) {
4464
+ i(R.message, "Couldn't load template");
4465
+ }
4466
+ }, E.readAsText(v);
4467
+ },
4468
+ getJSON: (v) => !t.value || t.value.length === 0 ? null : o(v)
4469
+ };
4470
+ }, La = 5, gn = /font-family\s*:\s*([^;<]+)/gi, Da = (e) => e.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&apos;/g, "'"), Fa = (e) => {
4471
+ if (!e || typeof e != "string") return [];
4472
+ if (e.indexOf("font-family") === -1) return [];
4473
+ const t = Da(e), r = [];
4474
+ let n;
4475
+ for (gn.lastIndex = 0; (n = gn.exec(t)) !== null; ) {
4476
+ const a = n[1];
4477
+ if (!a) continue;
4478
+ let i = a;
4479
+ const o = i.trimStart()[0];
4480
+ if (o === '"' || o === "'") {
4481
+ const c = i.indexOf(o), d = i.indexOf(o, c + 1);
4482
+ if (d !== -1) {
4483
+ const v = i.slice(d + 1).search(/["<]/);
4484
+ i = v === -1 ? i : i.slice(0, d + 1 + v);
4485
+ }
4486
+ } else {
4487
+ const c = i.search(/["<]/);
4488
+ c !== -1 && (i = i.slice(0, c));
4489
+ }
4490
+ const l = (i.split(",")[0] ?? "").trim().replace(/^['"]|['"]$/g, "").trim();
4491
+ l && r.push(l);
4492
+ }
4493
+ return r;
4494
+ }, Ha = (e, t, r, n, a, i, o, l, c, d) => {
4495
+ let v, b, E, w;
4496
+ typeof r == "object" && !("value" in r) ? (v = r, b = n, E = a, w = i) : (v = {
4497
+ html: r,
4498
+ react: n,
4499
+ mjml: a
4500
+ }, b = i, E = o, w = l);
4501
+ const { evaluateVisibility: R } = ft(), { open: M } = d ?? ea(), O = c ?? P({ syntax: "handlebars" }), p = ($, k, A, f, B = 0) => {
4502
+ if (!(B >= La))
4503
+ for (const z of $) {
4504
+ const N = z.type;
4505
+ if (N === "row") {
4506
+ if (k === "prune" && !R(z.visibility, A)) continue;
4507
+ for (const F of z.columns ?? []) {
4508
+ const I = F.children ?? F.components ?? [];
4509
+ p(I, k, A, f, B + 1);
4510
+ }
4511
+ continue;
4512
+ }
4513
+ N !== "row-spacer" && (k === "prune" && !R(z.props?.visibility, A) || f(z));
4514
+ }
4515
+ }, u = ($) => !e.value || e.value.length === 0 ? (M("Your template is empty. Please add at least one row before exporting.", $), !1) : !0, s = ($, k) => {
4516
+ const A = /* @__PURE__ */ new Set();
4517
+ return e.value.forEach((f) => {
4518
+ $ === "prune" && !R(f.visibility, k) || f.columns && f.columns.forEach((B) => {
4519
+ const z = B.children ?? B.components ?? [];
4520
+ p(z, $, k, (N) => {
4521
+ if (N.props?.fontFamily && A.add(N.props.fontFamily), N.props?.mobile?.fontFamily && A.add(N.props.mobile.fontFamily), typeof N.props?.content == "string") {
4522
+ const F = Fa(N.props.content);
4523
+ for (const I of F) A.add(I);
4524
+ }
4525
+ });
4526
+ });
4527
+ }), A;
4528
+ }, S = ($, k, A) => {
4529
+ const f = [];
4530
+ return e.value.forEach((B) => {
4531
+ $ === "prune" && !R(B.visibility, k) || B.columns && B.columns.forEach((z) => {
4532
+ const N = z.children ?? z.components ?? [];
4533
+ p(N, $, k, (F) => {
4534
+ const I = A(F, `eb-${F.id}`);
4535
+ I && f.push(I);
4536
+ });
4537
+ });
4538
+ }), f;
4539
+ }, C = ($, k) => {
4540
+ const A = Pn(e.value), f = k.length > 0 ? `
4541
+
4542
+ /* Mobile property overrides */
4543
+ ${k.join(`
4544
+
4545
+ `)}` : "";
4546
+ return `
4547
+ .desktop-hide { display: none !important; }
4548
+ ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
4549
+ @media only screen and (max-width:${$}px) {
4550
+ ${`
4551
+ .email-container { max-width:100% !important; width:100% !important; }
4552
+
4553
+ .desktop-hide { display:block !important; }
4554
+
4555
+ .mobile-hide { display:none !important; }
4556
+
4557
+ .mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }
4558
+ ${A ? `
4559
+ ${A}` : ""}${f}
4560
+ `}
4561
+ }`;
4562
+ }, _ = Ce(() => O.value.syntax), g = {
4563
+ rows: e,
4564
+ canvasStyles: t,
4565
+ generators: v,
4566
+ espSyntax: _,
4567
+ visibilityContext: E,
4568
+ tagSubstitution: w,
4569
+ guardEmpty: u,
4570
+ collectFonts: s,
4571
+ collectMobileCSS: S,
4572
+ buildMobileStyleBlock: C
4573
+ }, m = Na(g), h = Oa(g), x = za(g), y = Pa({
4574
+ rows: e,
4575
+ canvasStyles: t,
4576
+ saveToHistoryFn: b,
4577
+ guardEmpty: u,
4578
+ notify: ($, k) => M($, k ?? "Import failed")
4579
+ });
4580
+ return {
4581
+ exportHTML: m.export,
4582
+ getExportedHTML: m.getHTML,
4583
+ exportReactEmail: h.export,
4584
+ getExportedReactEmail: h.getReactEmail,
4585
+ exportMJML: x.export,
4586
+ getExportedMJML: x.getMJML,
4587
+ exportJSON: y.export,
4588
+ getExportedJSON: y.getJSON,
4589
+ importJSON: y.import,
4590
+ espConfig: O
4591
+ };
4592
+ }, Ua = 3e3, Me = null, Ue, rt, oe = -1, at = () => ({
4593
+ language: "en-US",
4594
+ preheaderText: "View this email in your browser",
4595
+ bodyBackgroundColor: "#f9fafb",
4596
+ bodyBackgroundImage: "",
4597
+ bodyBackgroundSize: "cover",
4598
+ bodyBackgroundPosition: "center center",
4599
+ bodyBackgroundRepeat: "no-repeat",
4600
+ backgroundColor: "#ffffff",
4601
+ width: 600,
4602
+ padding: {
4603
+ top: 0,
4604
+ right: 0,
4605
+ bottom: 0,
4606
+ left: 0
4607
+ },
4608
+ mobileBreakpoint: 600
4609
+ }), Qn = /* @__PURE__ */ Symbol("maildeno-editor:email-builder");
4610
+ function $o(e, t) {
4611
+ const r = Ja(e, t);
4612
+ return Ie(Qn, r), r;
4613
+ }
4614
+ var yo = () => {
4615
+ const e = Oe(Qn);
4616
+ if (!e) throw new Error("[maildeno-editor] useEmailBuilder() was called outside an EmailEditor instance. This composable only works inside the component tree under <EmailEditor>, which is where provideEmailBuilder() creates the shared instance.");
4617
+ return e;
4618
+ };
4619
+ function Ja(e, t) {
4620
+ const r = e ?? hr(), n = vr(), a = P([]), i = P(null), o = P(at()), l = P(null), c = P([]), d = P(null), v = P(null), b = P("properties"), E = P("desktop"), w = P(!1), R = P(!1), M = P(null), O = P("create"), p = P({}), u = P(null), s = (T, j, J = "") => {
4621
+ u.value = {
4622
+ componentId: T,
4623
+ tagName: j,
4624
+ default: J
4625
+ };
4626
+ }, S = P({}), C = P(!1), _ = P({}), g = P(!1), m = P(null), h = P(null), x = P(!1), y = P(!1), $ = P(null), k = P({ syntax: "handlebars" }), { defaultProps: A } = jt(), f = xr(), B = () => f.getCurrentState(a, o), z = (T) => f.restoreState(T, a, o, i, d, v), { generateHTMLComponent: N } = Gr(), { generateReactEmailComponent: F } = Yr(), { generateMJMLComponent: I } = Nn(), L = {
4627
+ html: N,
4628
+ react: F,
4629
+ mjml: I
4630
+ }, { saveToLocal: V, flushSave: q, loadFromLocal: W, clearLocal: Q, hasDraft: se, saveStatus: pe, lastSaved: me } = Ur(), { syncFontsForTemplate: le } = gt(), ze = 5, Pe = (T) => {
4631
+ const j = /* @__PURE__ */ new Set(), J = (G, we) => {
4632
+ if (!(we >= ze))
4633
+ for (const Ve of G) {
4634
+ if (!Ve) continue;
4635
+ const Qt = Ve.type;
4636
+ if (Qt === "row") {
4637
+ for (const Zt of Ve.columns ?? []) J(Zt.children ?? Zt.components ?? [], we + 1);
4638
+ continue;
4639
+ }
4640
+ if (Qt === "row-spacer") continue;
4641
+ const Ke = Ve.props;
4642
+ Ke?.fontFamily && j.add(Ke.fontFamily), Ke?.mobile?.fontFamily && j.add(Ke.mobile.fontFamily);
4643
+ }
4644
+ };
4645
+ for (const G of T)
4646
+ if (G && G.type !== "row-spacer")
4647
+ for (const we of G.columns ?? []) J(we.children ?? we.components ?? [], 0);
4648
+ return Array.from(j);
4649
+ };
4650
+ {
4651
+ let T = null;
4652
+ mr(() => {
4653
+ const j = Pe(a.value);
4654
+ T && clearTimeout(T), T = setTimeout(() => {
4655
+ T = null, le(j);
4656
+ }, 200);
4657
+ });
4658
+ }
4659
+ const qe = gr();
4660
+ let U = null, X = !1;
4661
+ const ke = () => {
4662
+ X || qe.value && (U && clearTimeout(U), U = setTimeout(() => {
4663
+ U = null;
4664
+ const T = f.version.value;
4665
+ T !== oe && (oe = T, Ue = l.value ?? void 0, V(a.value, o.value, Me, Ue, rt));
4666
+ }, Ua));
4667
+ };
4668
+ function $e(T = "change", j = !1) {
4669
+ f.saveToHistory(B, T, j), ke();
4670
+ }
4671
+ function H(T) {
4672
+ $e(T, !0);
4673
+ }
4674
+ const D = Sr(a, i, A, H, $e), te = () => D.rebuildIdRegistry(), Re = (T) => D.addRow(T, !0), vt = () => D.addSpacer(!0), bt = (T, j) => D.reorderRows(T, j, !0), We = (T, j) => {
4675
+ if (T?.id && (j.add(T.id), T.type === "row" && Array.isArray(T.columns)))
4676
+ for (const J of T.columns) {
4677
+ J?.id && j.add(J.id);
4678
+ const G = J.children ?? J.components ?? [];
4679
+ for (const we of G) We(we, j);
4680
+ }
4681
+ }, $t = (T) => {
4682
+ const j = D.findRow(T);
4683
+ if (j) {
4684
+ const J = /* @__PURE__ */ new Set();
4685
+ We(j, J), i.value && J.has(i.value) && (i.value = null), d.value && J.has(d.value) && (d.value = null), v.value && (J.has(v.value.rowId) || J.has(v.value.columnId)) && (v.value = null);
4686
+ }
4687
+ D.deleteRow(T);
4688
+ }, yt = Ce(() => ({
4689
+ mergeTagContext: S.value,
4690
+ mergeTagActive: C.value,
4691
+ linkTagContext: _.value,
4692
+ linkTagActive: g.value
4693
+ })), ne = Ha(a, o, L, $e, p, yt, void 0, void 0, k, t);
4694
+ {
4695
+ const T = () => {
4696
+ U && (clearTimeout(U), U = null, q(a.value, o.value, Me, Ue, rt), oe = f.version.value);
4697
+ };
4698
+ window.addEventListener("beforeunload", T), dr(() => {
4699
+ window.removeEventListener("beforeunload", T), U && (clearTimeout(U), U = null, q(a.value, o.value, Me, Ue, rt), oe = f.version.value);
4700
+ });
4701
+ }
4702
+ const Yt = () => {
4703
+ if (a.value.length > 0)
4704
+ return w.value = !0, te(), i.value = null, d.value = null, v.value = null, b.value = "properties", null;
4705
+ const T = W();
4706
+ return !T || T.templateId !== null ? (w.value = !0, null) : (w.value = !1, X = !0, a.value = T.rows, o.value = T.canvas, i.value = null, d.value = null, v.value = null, b.value = "properties", ye(() => {
4707
+ X = !1, te(), f.initialize(B()), oe = f.version.value, w.value = !0;
4708
+ }), me.value = new Date(T.updatedAt), T.name !== void 0 && (l.value = T.name), T.tags !== void 0 && (c.value = T.tags), T.updatedAt);
4709
+ }, Zn = async (T) => {
4710
+ if (!qe.value) throw new Error("[maildeno-editor] this editor has no saveTemplate — nothing was saved");
4711
+ const { templateId: j } = await r.saveTemplate(T, M.value ?? void 0);
4712
+ M.value = j, O.value === "create" && (O.value = "edit");
4713
+ const J = ne.getExportedJSON(T.name);
4714
+ return J && console.info("[maildeno-editor] Saved — exported JSON:", J), j;
4715
+ }, er = async (T) => {
4716
+ const j = await r.loadTemplate(T);
4717
+ return j ? (Xt({
4718
+ canvas: j.canvasStyles,
4719
+ content: { rows: j.rows },
4720
+ name: j.name,
4721
+ tags: j.tags
4722
+ }, T), M.value = T, O.value = "edit", !0) : !1;
4723
+ }, tr = () => {
4724
+ w.value = !1, v.value = null, d.value = null, b.value = "properties", U && (clearTimeout(U), U = null);
4725
+ const T = W();
4726
+ if (T && T.templateId === null) {
4727
+ Yt();
4728
+ return;
4729
+ }
4730
+ T && T.templateId !== null && Q(), X = !0, a.value = [], i.value = null, o.value = at(), Me = null, l.value = null, c.value = [], ye(() => {
4731
+ X = !1, te(), f.initialize(B()), oe = f.version.value, w.value = !0;
4732
+ });
4733
+ }, nr = () => {
4734
+ w.value = !1, v.value = null, d.value = null, b.value = "properties", U && (clearTimeout(U), U = null), Q(), X = !0, a.value = [], i.value = null, o.value = at(), Me = null, M.value = null, O.value = "create", l.value = null, c.value = [], ye(() => {
4735
+ X = !1, te(), f.initialize(B()), oe = f.version.value, w.value = !0;
4736
+ });
4737
+ }, Xt = (T, j, J) => {
4738
+ w.value = !1, Me = j, Ue = T.name, rt = T.tags, l.value = T.name ?? null, c.value = T.tags ?? [], U && (clearTimeout(U), U = null);
4739
+ const G = W();
4740
+ if (G && G.templateId === j) {
4741
+ console.info(`[EmailBuilder] Restoring local draft for template ${j} (saved ${G.updatedAt}).`), G.name !== void 0 && (l.value = G.name), G.tags !== void 0 && (c.value = G.tags), X = !0, o.value = G.canvas, a.value = G.rows, i.value = null, d.value = null, v.value = null, b.value = "properties", ye(() => {
4742
+ X = !1, te(), f.initialize(B()), oe = f.version.value, w.value = !0, J?.();
4743
+ }), me.value = new Date(G.updatedAt);
4744
+ return;
4745
+ }
4746
+ G && G.templateId !== j && (console.info(`[EmailBuilder] Clearing stale draft (belongs to ${G.templateId}, current is ${j}).`), Q()), X = !0, o.value = ct(JSON.parse(JSON.stringify(T.canvas))), a.value = ut(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, d.value = null, v.value = null, b.value = "properties", ye(() => {
4747
+ X = !1, te(), f.initialize(B()), oe = f.version.value, w.value = !0, J?.();
4748
+ });
4749
+ }, St = (T, j = "restore-version") => {
4750
+ U && (clearTimeout(U), U = null), X = !0, o.value = ct(JSON.parse(JSON.stringify(T.canvas))), a.value = ut(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, d.value = null, v.value = null, b.value = "properties", ye(() => {
4751
+ X = !1, te(), H(j);
4752
+ });
4753
+ }, rr = () => {
4754
+ f.undo(z) && (te(), ke());
4755
+ }, ar = () => {
4756
+ f.redo(z) && (te(), ke());
4757
+ }, or = () => {
4758
+ a.value = [], i.value = null, d.value = null, v.value = null, b.value = "properties", o.value = at(), ye(() => {
4759
+ te(), f.initialize(B()), oe = f.version.value;
4760
+ });
4761
+ }, ir = () => {
4762
+ n.require({
4763
+ message: "Are you sure you want to clear the current template? This cannot be undone.",
4764
+ header: "Clear Template",
4765
+ acceptLabel: "Yes",
4766
+ rejectLabel: "Cancel",
4767
+ acceptClass: "!bg-red-600 !hover:bg-red-700 !border-red-600 !px-6 !py-2",
4768
+ rejectClass: "!bg-gray-200 !hover:bg-gray-300 !text-gray-800 !border-gray-200 !px-6 !py-2",
4769
+ accept: () => or(),
4770
+ reject: () => {
4771
+ }
4772
+ });
4773
+ }, sr = (T, j = {}) => {
4774
+ const J = vn(T), G = {
4775
+ canvas: J.canvas,
4776
+ content: { rows: J.rows }
4777
+ };
4778
+ if (j.history === "reset") {
4779
+ St(G, "set-json"), ye(() => {
4780
+ f.initialize(B()), oe = f.version.value;
4781
+ });
4782
+ return;
4783
+ }
4784
+ St(G, "set-json");
4785
+ }, lr = () => {
4786
+ const T = i.value;
4787
+ if (!T) return null;
4788
+ const j = D.findComponent(T);
4789
+ return {
4790
+ id: T,
4791
+ type: j?.componentType ?? j?.type ?? null
4792
+ };
4793
+ }, cr = (T) => T !== null && !D.findComponent(T) ? !1 : (i.value = T, !0), ur = (T) => hn(() => f.version.value, () => T());
4794
+ return {
4795
+ rows: a,
4796
+ canvasStyles: o,
4797
+ templateTags: c,
4798
+ savedTemplateName: l,
4799
+ previewMode: E,
4800
+ sidebarTab: b,
4801
+ selectedId: i,
4802
+ selectedRowId: d,
4803
+ selectedColumn: v,
4804
+ visibilityPreviewContext: p,
4805
+ mergeTagInsertQueue: u,
4806
+ triggerMergeTagInsert: s,
4807
+ mergeTagPreviewContext: S,
4808
+ mergeTagPreviewActive: C,
4809
+ linkTagPreviewContext: _,
4810
+ linkTagPreviewActive: g,
4811
+ isBuilderReady: w,
4812
+ linksActive: R,
4813
+ espConfig: k,
4814
+ canvasHoveredId: m,
4815
+ nestedRowDragId: h,
4816
+ isRowDragActive: x,
4817
+ isTopLevelRowDragActive: y,
4818
+ layerHoveredId: $,
4819
+ addRow: D.addRow,
4820
+ addNestedRow: D.addNestedRow,
4821
+ findRow: D.findRow,
4822
+ deleteRow: $t,
4823
+ moveRow: D.moveRow,
4824
+ moveNestedRow: D.moveNestedRow,
4825
+ reorderRows: D.reorderRows,
4826
+ addSpacer: D.addSpacer,
4827
+ duplicateRow: D.duplicateRow,
4828
+ duplicateRowSpacer: D.duplicateRowSpacer,
4829
+ addRowSilent: Re,
4830
+ addSpacerSilent: vt,
4831
+ reorderRowsSilent: bt,
4832
+ addComponent: D.addComponent,
4833
+ addComponentAtIndex: D.addComponentAtIndex,
4834
+ deleteComponent: D.deleteComponent,
4835
+ moveComponent: D.moveComponent,
4836
+ moveComponentBetweenColumns: D.moveComponentBetweenColumns,
4837
+ findComponent: D.findComponent,
4838
+ updateComponent: D.updateComponent,
4839
+ duplicateComponent: D.duplicateComponent,
4840
+ exportHTML: ne.exportHTML,
4841
+ getExportedHTML: ne.getExportedHTML,
4842
+ exportReactEmail: ne.exportReactEmail,
4843
+ getExportedReactEmail: ne.getExportedReactEmail,
4844
+ exportMJML: ne.exportMJML,
4845
+ getExportedMJML: ne.getExportedMJML,
4846
+ exportJSON: ne.exportJSON,
4847
+ getExportedJSON: ne.getExportedJSON,
4848
+ importJSON: (T) => ne.importJSON(T, i),
4849
+ clearTemplate: ir,
4850
+ undo: rr,
4851
+ redo: ar,
4852
+ canUndo: f.canUndo,
4853
+ canRedo: f.canRedo,
4854
+ historyStatus: f.historyStatus,
4855
+ saveToHistory: $e,
4856
+ saveToHistoryImmediate: H,
4857
+ initFromStorage: Yt,
4858
+ clearLocal: Q,
4859
+ loadFromLocal: W,
4860
+ hasDraft: se,
4861
+ saveStatus: pe,
4862
+ lastSaved: me,
4863
+ initForCreate: tr,
4864
+ startNewTemplate: nr,
4865
+ loadTemplate: Xt,
4866
+ loadTemplateById: er,
4867
+ saveTemplate: Zn,
4868
+ templateId: M,
4869
+ builderMode: O,
4870
+ loadVersionSnapshot: St,
4871
+ setJson: sr,
4872
+ getSelection: lr,
4873
+ setSelection: cr,
4874
+ onChange: ur
4875
+ };
4876
+ }
4877
+ export {
4878
+ Tn as A,
4879
+ Ya as B,
4880
+ ft as C,
4881
+ Ut as D,
4882
+ ao as E,
4883
+ dt as F,
4884
+ $n as G,
4885
+ Va as H,
4886
+ Rt as I,
4887
+ K,
4888
+ Za as L,
4889
+ no as M,
4890
+ to as N,
4891
+ ro as O,
4892
+ Qa as P,
4893
+ vr as R,
4894
+ io as S,
4895
+ ea as T,
4896
+ Xa as U,
4897
+ Ka as V,
4898
+ hr as W,
4899
+ gt as _,
4900
+ vo as a,
4901
+ lo as b,
4902
+ ho as c,
4903
+ fo as d,
4904
+ pn as f,
4905
+ st as g,
4906
+ na as h,
4907
+ ya as i,
4908
+ An as j,
4909
+ Jr as k,
4910
+ go as l,
4911
+ po as m,
4912
+ yo as n,
4913
+ bo as o,
4914
+ ca as p,
4915
+ Kt as r,
4916
+ $a as s,
4917
+ $o as t,
4918
+ mo as u,
4919
+ co as v,
4920
+ oo as w,
4921
+ uo as x,
4922
+ so as y,
4923
+ Wa as z
4924
+ };