@boxcc/maildeno-editor 0.0.0-stage → 0.4.14

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 +442 -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-BLID6Ty0.js +1216 -0
  7. package/dist/HealthIndicator-DfzqzPNw.js +1217 -0
  8. package/dist/PopperContent-N2nAEFeH.js +2538 -0
  9. package/dist/PopperContent-eLmz1Gjd.js +2578 -0
  10. package/dist/PreviewCanvas-D3SpILsV.js +534 -0
  11. package/dist/PreviewCanvas-PtW1UL1J.js +534 -0
  12. package/dist/RichTextEditor-D6DQqbJg.js +12218 -0
  13. package/dist/RichTextEditor-DDEfKPZm.js +12217 -0
  14. package/dist/RowPreviewChildren-BGnilx-K.js +4 -0
  15. package/dist/RowPreviewChildren-CalQWx1C.js +4 -0
  16. package/dist/RowPreviewLegacyComponent-Df_1HTly.js +403 -0
  17. package/dist/RowPreviewLegacyComponent-NECG3wpn.js +403 -0
  18. package/dist/RowPreviewRow-C2XAe5Xs.js +81 -0
  19. package/dist/RowPreviewRow-DG4AdMrv.js +81 -0
  20. package/dist/SavedRowsPanel-2JBfYdxN.js +492 -0
  21. package/dist/SavedRowsPanel-B6_VHQZm.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 +183 -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-DQw3HLit.js +21540 -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 +15032 -0
  43. package/dist/init.d.ts +180 -0
  44. package/dist/init.js +143 -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-2yCUzRx2.js +4934 -0
  52. package/dist/useEmailBuilder-D3uV7dwL.js +4934 -0
  53. package/dist/useToast-D1GgDMqQ.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,4934 @@
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 L, shallowRef as pr, watch as hn, watchEffect as mr } from "vue";
3
+ var it = (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: it(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: it("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: it(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", Pe = "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 ?? [], o = {
48
+ ...r,
49
+ id: K(),
50
+ children: n.map((i) => bn(i))
51
+ };
52
+ return delete o.components, o;
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(Pe + s) : null;
69
+ }
70
+ async function t(s, S) {
71
+ const C = S || K();
72
+ try {
73
+ const _ = fe(Pe + C);
74
+ _ && b(C, _);
75
+ } catch (_) {
76
+ console.warn("[maildeno-editor] couldn't record a template version:", _);
77
+ }
78
+ return De(Pe + 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(Pe)) 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(Pe + s), localStorage.removeItem(kt + s);
99
+ }
100
+ function o(s) {
101
+ return fe(kt + s) ?? [];
102
+ }
103
+ function i(s, S) {
104
+ De(kt + s, S);
105
+ }
106
+ async function a(s) {
107
+ return o(s).map(({ snapshot: S, ...C }) => C);
108
+ }
109
+ async function l(s, S) {
110
+ return o(s).find((C) => C.versionId === S)?.snapshot ?? null;
111
+ }
112
+ async function c(s, S) {
113
+ i(s, o(s).filter((C) => C.versionId !== S));
114
+ }
115
+ async function p(s) {
116
+ i(s, o(s).filter((S) => S.kept));
117
+ }
118
+ async function v(s, S, C) {
119
+ i(s, o(s).map((_) => _.versionId === S ? {
120
+ ..._,
121
+ kept: C
122
+ } : _));
123
+ }
124
+ function b(s, S) {
125
+ const C = o(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 u(s) {
167
+ const S = (fe(Se) ?? []).find((C) => C.id === s);
168
+ return S ? bn(S.row) : null;
169
+ }
170
+ async function d(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: a,
182
+ getTemplateVersion: l,
183
+ deleteTemplateVersion: c,
184
+ deleteAllTemplateVersions: p,
185
+ setTemplateVersionKept: v,
186
+ listSavedRows: E,
187
+ listSystemSavedRows: w,
188
+ saveSavedRow: R,
189
+ deleteSavedRow: M,
190
+ renameSavedRow: O,
191
+ cloneSavedRowForCanvas: u,
192
+ uploadImage: d
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, o] of Object.entries(e)) typeof o == "function" && (r[n] = o);
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 Ko(e) {
208
+ Ie(Sn, e);
209
+ }
210
+ var kn = /* @__PURE__ */ Symbol("maildeno-editor:has-template-library");
211
+ function Yo() {
212
+ return Oe(kn, !0);
213
+ }
214
+ function Xo(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 Qo(e) {
223
+ Ie(wn, e);
224
+ }
225
+ function Zo() {
226
+ return Oe(wn, Ce(() => ({})));
227
+ }
228
+ var dt = pr(null), Rt = L(!1);
229
+ function Ot() {
230
+ Rt.value = !1, setTimeout(() => {
231
+ Rt.value || (dt.value = null);
232
+ }, 200);
233
+ }
234
+ function ea() {
235
+ const e = dt.value;
236
+ Ot(), e?.accept?.();
237
+ }
238
+ function ta() {
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
+ }), oe = () => ({
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
+ }), na = 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
+ }), Xe = () => ({
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: Xe(),
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
+ ...oe()
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: Xe(),
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
+ ...oe()
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
+ ...oe()
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
+ ...oe()
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: Xe(),
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
+ ...oe()
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
+ ...oe()
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
+ ...oe()
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
+ ...oe()
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
+ ...oe()
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: Xe(),
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
+ ...oe()
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
+ ...oe()
732
+ }
733
+ } }), ra = (e) => e.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""), oa = (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 ?? [], o = {
751
+ ...r,
752
+ id: K(),
753
+ children: n.map((i) => zt(i))
754
+ };
755
+ return delete o.components, o;
756
+ })), t;
757
+ }, Qe = (e, t) => {
758
+ const r = zt(e);
759
+ if (r.type === "row-spacer") return r;
760
+ const n = e.name ?? xn(), o = new Set(t.map((l) => l.name));
761
+ let i = `${n}_copy`, a = 2;
762
+ for (; o.has(i); )
763
+ i = `${n}_copy_${a}`, a++;
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 o of n.columns ?? []) {
774
+ const i = ve(o.children ?? o.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 o = he(n);
784
+ for (const i of o) {
785
+ if (i.id === t && i.type === "row") return i;
786
+ if (i.type === "row" && i.columns) {
787
+ const a = xe([i], t);
788
+ if (a) return a;
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 o of n.columns)
800
+ o?.id && re.set(o.id, o), t(o.children ?? o.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
+ }, st = (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) st(n);
816
+ }
817
+ }, Sr = (e, t, r, n, o = 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
+ }, a = (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
+ st(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
+ st(k), n("delete-row");
975
+ return;
976
+ }
977
+ }
978
+ }, p = (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 = Qe(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 = Qe($.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 = Qe(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 = Qe($.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
+ }, u = (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
+ st($), t.value === g && (t.value = null), n("delete-component");
1138
+ return;
1139
+ }
1140
+ }
1141
+ }, d = (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: a,
1189
+ findRow: l,
1190
+ deleteRow: c,
1191
+ moveRow: p,
1192
+ moveNestedRow: v,
1193
+ reorderRows: b,
1194
+ addSpacer: E,
1195
+ duplicateRow: w,
1196
+ duplicateRowSpacer: R,
1197
+ addComponent: M,
1198
+ addComponentAtIndex: O,
1199
+ deleteComponent: u,
1200
+ moveComponent: d,
1201
+ moveComponentBetweenColumns: s,
1202
+ findComponent: S,
1203
+ updateComponent: (g, m) => {
1204
+ const h = S(g);
1205
+ h && (Object.assign(h.props, m), o("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 = L([]), r = L(-1), n = L(0), o = Ce(() => r.value > 0), i = Ce(() => r.value < t.value.length - 1), a = 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 = () => o.value ? (Z && (clearTimeout(Z), Z = null), r.value--, n.value++, xt(t.value[r.value].state)) : null, p = () => 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: o,
1238
+ canRedo: i,
1239
+ historyStatus: a,
1240
+ saveState: l,
1241
+ undo: c,
1242
+ redo: p,
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: o, historyStatus: i, initHistory: a, version: l } = wr();
1251
+ return {
1252
+ getCurrentState: (R, M) => ({
1253
+ rows: R.value,
1254
+ canvasStyles: M.value
1255
+ }),
1256
+ restoreState: (R, M, O, u, d, 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), u.value && !S.has(String(u.value)) && (u.value = null), d.value && !S.has(String(d.value)) && (d.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: o,
1283
+ historyStatus: i,
1284
+ initialize: (R) => {
1285
+ a(R);
1286
+ },
1287
+ version: l
1288
+ };
1289
+ }, Cr = (e) => e == null, Lt = (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
+ }, qe = (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" && qe(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 (Lt(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, qe(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: o, ...i } = e, a = { ...i };
1333
+ Cn(e.border) && delete a.border, qe(e.backgroundGradient) && delete a.backgroundGradient, pt(e.padding) && delete a.padding, e.backgroundImage || (delete a.backgroundImage, delete a.backgroundSize, delete a.backgroundPosition, delete a.backgroundRepeat);
1334
+ const l = (n ?? o ?? []).map(Ir);
1335
+ return {
1336
+ id: t,
1337
+ width: r,
1338
+ ...a,
1339
+ children: l
1340
+ };
1341
+ }, Br = (e) => {
1342
+ const { id: t, type: r, ...n } = e, o = { ...n };
1343
+ Lt(e.visibility) && delete o.visibility, qe(e.backgroundGradient) && delete o.backgroundGradient;
1344
+ const { height: i, ...a } = o;
1345
+ return {
1346
+ id: t,
1347
+ type: r,
1348
+ height: i,
1349
+ ...a
1350
+ };
1351
+ }, _n = (e) => {
1352
+ if (e.type === "row-spacer") return Br(e);
1353
+ const { id: t, type: r, name: n, columns: o, ...i } = e, a = { ...i };
1354
+ return Lt(e.visibility) && delete a.visibility, Cn(e.border) && delete a.border, qe(e.backgroundGradient) && delete a.backgroundGradient, pt(e.padding) && delete a.padding, e.backgroundImage || (delete a.backgroundImage, delete a.backgroundSize, delete a.backgroundPosition, delete a.backgroundRepeat), e.minHeight === 0 && delete a.minHeight, {
1355
+ id: t,
1356
+ type: r,
1357
+ ...n !== void 0 && { name: n },
1358
+ ...a,
1359
+ columns: o?.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
+ }, Lr = {
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
+ }, Pr = (e) => JSON.parse(JSON.stringify(e)), je = (e, t) => {
1471
+ const r = Pr(e);
1472
+ for (const n of Object.keys(t)) {
1473
+ const o = t[n], i = e[n];
1474
+ o != null && (typeof o == "object" && !Array.isArray(o) && typeof i == "object" && i !== null && !Array.isArray(i) ? r[n] = je(i, o) : r[n] = o);
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 o = je(n, e.props);
1482
+ if (n.mobile && typeof n.mobile == "object" && (o.mobile = {
1483
+ ...n.mobile,
1484
+ ...o.mobile ?? {}
1485
+ }, o.mobile && !o.mobile.backgroundGradient && (o.mobile.backgroundGradient = n.mobile.backgroundGradient)), o.visibility = o.visibility ?? _e(), o.desktopHide = o.desktopHide ?? Et().desktopHide, o.mobileHide = o.mobileHide ?? Et().mobileHide, o.margin === void 0 && n.margin && (o.margin = { ...n.margin }), o.padding === void 0 && n.padding && (o.padding = { ...n.padding }), o.letterSpacing === void 0 && n.letterSpacing !== void 0 && (o.letterSpacing = n.letterSpacing), o.backgroundGradient) {
1486
+ const i = o.backgroundColor;
1487
+ i && (o.backgroundGradient.solid = i);
1488
+ }
1489
+ return !o.backgroundImage && n.backgroundImage !== void 0 && (o.backgroundImage = n.backgroundImage, o.backgroundSize = n.backgroundSize, o.backgroundPosition = n.backgroundPosition, o.backgroundRepeat = n.backgroundRepeat), "icon" in n && (o.icon = o.icon ?? n.icon, o.iconAlt = o.iconAlt ?? n.iconAlt ?? "", o.iconPosition = o.iconPosition ?? n.iconPosition ?? "before", o.iconSize = o.iconSize ?? n.iconSize ?? 20, o.iconGap = o.iconGap ?? n.iconGap ?? 8), {
1490
+ ...e,
1491
+ type: "component",
1492
+ componentType: r,
1493
+ props: o
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, ...o } = e, i = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: a, backgroundGradient: l, ...c } = zr;
1505
+ let p = je(c, o);
1506
+ return i ? (p.backgroundColor = e.backgroundColor, p.backgroundGradient = e.backgroundGradient) : (p.backgroundColor = a, p.backgroundGradient = l), e.backgroundImage || (p.backgroundImage = "", p.backgroundSize = "cover", p.backgroundPosition = "center center", p.backgroundRepeat = "no-repeat"), {
1507
+ ...p,
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: o, backgroundGradient: i, ...a } = Or;
1516
+ let l = je(a, r);
1517
+ return n ? (l.backgroundColor = e.backgroundColor, l.backgroundGradient = e.backgroundGradient) : (l.backgroundColor = o, 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(Lr, 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", on = (e, t, r = null, n, o) => {
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
+ ...o !== void 0 && { tags: o },
1531
+ content: {
1532
+ rows: An(e),
1533
+ canvas: Tn(t)
1534
+ }
1535
+ };
1536
+ }, Ct = null, Ur = () => {
1537
+ const e = L("idle"), t = L(null);
1538
+ return {
1539
+ saveToLocal: (l, c, p = null, v, b) => {
1540
+ e.value = "saving";
1541
+ const E = () => {
1542
+ try {
1543
+ const w = on(l, c, p, 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, p = null, v, b) => {
1556
+ try {
1557
+ const E = on(l, c, p, 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 p = JSON.parse(c);
1587
+ return !(Date.now() > p.expiresAt || l !== void 0 && p.templateId !== l);
1588
+ } catch {
1589
+ return !1;
1590
+ }
1591
+ },
1592
+ saveStatus: e,
1593
+ lastSaved: t
1594
+ };
1595
+ }, Pt = (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 aa(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 ia() {
1620
+ return Ht;
1621
+ }
1622
+ var Gr = () => {
1623
+ const e = (n, o) => {
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 : o;
1626
+ return !b || b === "transparent" ? "" : `background-color:${b};`;
1627
+ }
1628
+ const { type: i, direction: a, colors: l } = n.gradient, c = l.map((b) => `${b.color} ${b.position}%`).join(", "), p = i === "radial" ? `radial-gradient(circle at center, ${c})` : `linear-gradient(${a}, ${c})`, v = n.solid || o || "";
1629
+ return `${v && v !== "transparent" ? `background-color:${v};` : ""}background:${p};`;
1630
+ }, t = (n, o) => 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 || o || "#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 o = n.componentType ?? n.type, { props: i } = n;
1649
+ let a = "";
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;` : "", p = 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(o);
1654
+ return b ? b.renderEmail.html(i, {
1655
+ uid: l,
1656
+ marginStyle: c,
1657
+ paddingStyle: p,
1658
+ escapeHtml: Dt,
1659
+ escapeAttr: Ft,
1660
+ safeUrl: Pt,
1661
+ resolveBgCss: e,
1662
+ resolveBgVml: t,
1663
+ getResponsiveClasses: v,
1664
+ react: null
1665
+ }) : a;
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(), o = t.slice(r + 1).trim(), i = n.toLowerCase() === "font-family" ? mt(o) : Mn(o);
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 o = n.toLowerCase();
1674
+ return o === "true" || o === "false" ? `contentEditable={${o}}` : `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: o, direction: i, colors: a } = r.gradient, l = a.map((v) => `${v.color} ${v.position}%`).join(", "), c = o === "radial" ? `radial-gradient(circle at center, ${l})` : `linear-gradient(${i}, ${l})`, p = r.solid || n || "";
1685
+ return `${p && p !== "transparent" ? `background-color:${p};` : ""}background:${c};`;
1686
+ };
1687
+ return { generateReactEmailComponent: (r) => {
1688
+ const n = r.componentType ?? r.type, { props: o } = r;
1689
+ let i = "";
1690
+ const a = `eb-${r.id}`, l = o.margin ? `margin:${o.margin?.top ?? 0}px ${o.margin?.right ?? 0}px ${o.margin?.bottom ?? 0}px ${o.margin?.left ?? 0}px;` : "", c = o.padding ? `padding:${o.padding?.top ?? 0}px ${o.padding?.right ?? 0}px ${o.padding?.bottom ?? 0}px ${o.padding?.left ?? 0}px;` : "", p = (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 ? `${a}-${R}` : a];
1698
+ return E && M.push("desktop-hide"), w && M.push("mobile-hide"), M.join(" ");
1699
+ }, b = Ut(n);
1700
+ return b ? b.renderEmail.reactEmail(o, {
1701
+ uid: a,
1702
+ marginStyle: l,
1703
+ paddingStyle: c,
1704
+ escapeHtml: Dt,
1705
+ escapeAttr: Ft,
1706
+ safeUrl: Pt,
1707
+ resolveBgCss: e,
1708
+ resolveBgVml: p,
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 o = r.slice(0, n).trim(), i = r.slice(n + 1).trim(), a = o.replace(/-([a-z])/g, (l, c) => c.toUpperCase());
1727
+ t[a] = 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, o) {
1738
+ return `<${e}${o ? `
1739
+ as="${o}"` : ""}
1740
+ className="${t}"
1741
+ style={{ ${In(r)} }}
1742
+ >
1743
+ ${n}
1744
+ </${e}>
1745
+ `;
1746
+ }
1747
+ var Nn = () => {
1748
+ const e = (a, l) => {
1749
+ if (!(a?.useGradient === !0 && Array.isArray(a?.gradient?.colors) && a.gradient.colors.length >= 2)) {
1750
+ const R = a && typeof a == "object" && a.solid ? a.solid : l;
1751
+ return !R || R === "transparent" ? "" : `background-color:${R};`;
1752
+ }
1753
+ const { type: c, direction: p, colors: v } = a.gradient, b = v.map((R) => `${R.color} ${R.position}%`).join(", "), E = c === "radial" ? `radial-gradient(circle at center, ${b})` : `linear-gradient(${p}, ${b})`, w = a.solid || l || "";
1754
+ return `${w && w !== "transparent" ? `background-color:${w};` : ""}background:${E};`;
1755
+ }, t = (a, l) => a?.useGradient === !0 && Array.isArray(a?.gradient?.colors) && a.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="${a.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 = (a, l) => a && typeof a == "object" && a.solid && a.solid !== "transparent" ? a.solid : l && l !== "transparent" ? l : "", n = (a) => a ? `${a.top ?? 0}px ${a.right ?? 0}px ${a.bottom ?? 0}px ${a.left ?? 0}px` : "0px";
1772
+ return {
1773
+ generateMJMLComponent: (a) => {
1774
+ const l = a.componentType ?? a.type, { props: c } = a, p = `eb-${a.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 u = [O ? `${p}-${O}` : p];
1776
+ return R && u.push("desktop-hide"), M && u.push("mobile-hide"), u.join(" ");
1777
+ }, w = Ut(l);
1778
+ return w ? w.renderEmail.mjml(c, {
1779
+ uid: p,
1780
+ marginStyle: v,
1781
+ paddingStyle: b,
1782
+ escapeHtml: Dt,
1783
+ escapeAttr: Ft,
1784
+ safeUrl: Pt,
1785
+ resolveBgCss: e,
1786
+ resolveBgVml: t,
1787
+ getResponsiveClasses: E,
1788
+ react: null
1789
+ }) : "";
1790
+ },
1791
+ assembleMJML: (a, l, c, p, v, b = 600, E = "") => {
1792
+ const w = p ? `<mj-style inline="false">
1793
+ @import url('${p}');
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>` : "", u = c.bodyBackgroundColor || "#ffffff", d = 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>${a}</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="${u}" width="${c.width ?? 600}px">
1827
+ <mj-wrapper full-width="full-width" ${d} 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 sa() {
1840
+ const e = On();
1841
+ return Ie(Bn, e), e;
1842
+ }
1843
+ var eo = () => {
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 = L(!1), t = L("Info"), r = L("");
1849
+ return {
1850
+ visible: e,
1851
+ header: t,
1852
+ message: r,
1853
+ open: (o, i = "Info") => {
1854
+ r.value = o, t.value = i, e.value = !0;
1855
+ }
1856
+ };
1857
+ }
1858
+ var la = ["is_empty", "is_not_empty"], ca = ["in", "not_in"], ua = [
1859
+ ">",
1860
+ "<",
1861
+ ">=",
1862
+ "<="
1863
+ ], da = [
1864
+ "date_before",
1865
+ "date_after",
1866
+ "date_on"
1867
+ ], pa = [
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
+ ], an = (e) => e.split(/[,\n;]+/).map((t) => t.trim()).filter(Boolean), Ze = (e, t) => [parseFloat(e ?? ""), parseFloat(t)], et = (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() ?? "", o = e.value.toLowerCase();
1942
+ switch (e.operator) {
1943
+ case "==":
1944
+ return n === o;
1945
+ case "!=":
1946
+ return n !== o;
1947
+ case "contains":
1948
+ return n.includes(o);
1949
+ case "not_contains":
1950
+ return !n.includes(o);
1951
+ case "starts_with":
1952
+ return n.startsWith(o);
1953
+ case "ends_with":
1954
+ return n.endsWith(o);
1955
+ case "in":
1956
+ return an(o).includes(n);
1957
+ case "not_in":
1958
+ return !an(o).includes(n);
1959
+ case ">": {
1960
+ const [i, a] = Ze(r, e.value);
1961
+ return et(i, a) && i > a;
1962
+ }
1963
+ case "<": {
1964
+ const [i, a] = Ze(r, e.value);
1965
+ return et(i, a) && i < a;
1966
+ }
1967
+ case ">=": {
1968
+ const [i, a] = Ze(r, e.value);
1969
+ return et(i, a) && i >= a;
1970
+ }
1971
+ case "<=": {
1972
+ const [i, a] = Ze(r, e.value);
1973
+ return et(i, a) && i <= a;
1974
+ }
1975
+ case "date_before": {
1976
+ const i = Ee(r), a = Ee(e.value);
1977
+ return i !== null && a !== null && i.getTime() < a.getTime();
1978
+ }
1979
+ case "date_after": {
1980
+ const i = Ee(r), a = Ee(e.value);
1981
+ return i !== null && a !== null && i.getTime() > a.getTime();
1982
+ }
1983
+ case "date_on": {
1984
+ const i = Ee(r), a = Ee(e.value);
1985
+ return i !== null && a !== null && i.getTime() === a.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, o = (t.groups?.length ?? 0) > 0;
2002
+ if (!n && !o) return !0;
2003
+ const i = (t.rules ?? []).map((c) => It(c, r)), a = (t.groups ?? []).map((c) => sn(c, r)), l = [...i, ...a];
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, o = n.map((i) => `${i.color} ${i.position}%`).join(", ");
2010
+ return t === "radial" ? `radial-gradient(circle at center, ${o})` : `linear-gradient(${r}, ${o})`;
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), o = r.solid || e.backgroundColor || "";
2015
+ o && o !== "transparent" && t.push(`background-color:${o}`), 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
+ }, tt = (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), o = r.solid || e.backgroundColor || "";
2022
+ o && o !== "transparent" && (t.backgroundColor = o), 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
+ }, to = 5, zn = (e, t, r) => {
2026
+ if (!(r >= to) && 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 o = n.columns;
2031
+ if (Array.isArray(o))
2032
+ for (const i of o) {
2033
+ const a = i?.children ?? i?.components;
2034
+ if (!Array.isArray(a) || a.length === 0) continue;
2035
+ const l = a.filter((c) => c?.type === "row");
2036
+ l.length > 0 && zn(l, t, r + 1);
2037
+ }
2038
+ }
2039
+ }, Ln = (e) => {
2040
+ const t = /* @__PURE__ */ new Set();
2041
+ if (zn(e, t, 0), t.size === 0) return "";
2042
+ const r = [...t].sort((n, o) => n - o);
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
+ }, nt = L(/* @__PURE__ */ new Set()), gt = () => {
2048
+ const e = L([
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
+ ], o = (b) => t.has(b), i = (b) => b.trim().replace(/\s+/g, "+"), a = (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 || o(b) || nt.value.has(b)) return;
2434
+ const E = document.createElement("link");
2435
+ E.rel = "stylesheet", E.href = `https://fonts.googleapis.com/css2?family=${i(b)}:${a(b)}&display=swap`, document.head.appendChild(E), nt.value.add(b);
2436
+ }, c = (b) => {
2437
+ const E = Array.from(new Set(b)).filter((w) => w && !o(w));
2438
+ return E.length ? `https://fonts.googleapis.com/css2?${E.map((w) => `family=${i(w)}:${a(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), !o(O) && (nt.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) nt.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: o,
2467
+ WEB_SAFE_FONTS: t,
2468
+ FONTS_WITH_ITALICS: r,
2469
+ DEFAULT_WEIGHTS: n
2470
+ };
2471
+ };
2472
+ function Je(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 no(e) {
2478
+ const t = Je(e.width), r = Je(e.height);
2479
+ return [
2480
+ t,
2481
+ r,
2482
+ e.mobile?.width,
2483
+ e.mobile?.height
2484
+ ].some((n) => Je(n) !== "auto") ? {
2485
+ width: t,
2486
+ height: r,
2487
+ boxSizing: "border-box",
2488
+ textAlign: "center"
2489
+ } : {};
2490
+ }
2491
+ function ro(e, t) {
2492
+ const r = t === "width" ? "100%" : "auto";
2493
+ if (typeof e != "string" && typeof e != "number") return r;
2494
+ let n = String(e).trim().toLowerCase();
2495
+ if (/^(?:\d+(?:\.\d+)?|\.\d+)$/.test(n) && (n += t === "width" ? "%" : "px"), t === "height" && n.endsWith("%")) return r;
2496
+ const o = Je(n);
2497
+ return o === "auto" && n !== "auto" ? r : o;
2498
+ }
2499
+ var Jt = () => ({ emailMobileStyles: (t, r) => {
2500
+ const n = t.componentType ?? t.type, o = t.props.mobileStack === !0, i = t.props.mobile;
2501
+ if (!i && !(n === "menu" && o)) return "";
2502
+ const a = i ?? {}, l = [], c = [], p = [], v = (/* @__PURE__ */ new Set(["button", "anchor"])).has(n), b = n === "button" && !!no(t.props).width, E = (/* @__PURE__ */ new Set(["menu", "socials"])).has(n), w = (u, d) => {
2503
+ d && u.push(d);
2504
+ }, R = () => {
2505
+ const u = a.backgroundGradient;
2506
+ if (u != null) {
2507
+ if (u.useGradient === !0 && Array.isArray(u.gradient?.colors) && u.gradient.colors.length >= 2) {
2508
+ const { type: s, direction: S, colors: C } = u.gradient, _ = C.map((x) => `${x.color} ${x.position}%`).join(", "), g = s === "radial" ? `radial-gradient(circle at center, ${_})` : `linear-gradient(${S}, ${_})`, m = u.solid || a.backgroundColor || "", h = [];
2509
+ return h.push(`background-color: ${m && m !== "transparent" ? m : "transparent"} !important`), h.push(`background: ${g} !important`), h;
2510
+ }
2511
+ const d = u.solid ?? a.backgroundColor;
2512
+ return d != null ? ["background: none !important", `background-color: ${d} !important`] : [];
2513
+ }
2514
+ return a.backgroundColor != null ? ["background: none !important", `background-color: ${a.backgroundColor} !important`] : [];
2515
+ }, M = (u) => {
2516
+ w(u, a.fontSize != null && `font-size: ${a.fontSize}px !important`), w(u, a.lineHeight != null && `line-height: ${a.lineHeight} !important`), w(u, a.letterSpacing != null && `letter-spacing: ${a.letterSpacing}px !important`), w(u, a.color != null && `color: ${a.color} !important`), w(u, a.fontWeight != null && `font-weight: ${a.fontWeight} !important`), w(u, a.fontFamily != null && `font-family: '${a.fontFamily}', Arial, sans-serif !important`), w(u, a.fontStyle != null && `font-style: ${a.fontStyle} !important`), w(u, a.textTransform != null && `text-transform: ${a.textTransform} !important`), w(u, a.textDecoration != null && `text-decoration: ${a.textDecoration} !important`), b || u.push(...R());
2517
+ };
2518
+ if (a.margin) {
2519
+ const u = a.margin;
2520
+ l.push(`margin: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2521
+ }
2522
+ if (a.padding && !v && !E) {
2523
+ const u = a.padding;
2524
+ l.push(`padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2525
+ }
2526
+ if (a.align != null && !E && l.push(`text-align: ${a.align} !important`), v) {
2527
+ M(c);
2528
+ const u = b ? R() : c;
2529
+ if (a.padding) {
2530
+ const d = a.padding, s = `padding: ${d.top}px ${d.right}px ${d.bottom}px ${d.left}px !important`;
2531
+ b ? p.push(`.${r}-button-content { ${s} }`) : c.push(s);
2532
+ }
2533
+ if (a.border) {
2534
+ const d = a.border;
2535
+ u.push(ue(d, !0));
2536
+ }
2537
+ if (a.borderRadius != null && u.push(`border-radius: ${Y(a.borderRadius)} !important`), n === "button") {
2538
+ for (const s of ["width", "height"]) a[s] != null && u.push(`${s}: ${Je(a[s])} !important`);
2539
+ const d = [];
2540
+ w(d, a.fontSize != null && `font-size: ${a.fontSize}px !important`), w(d, a.letterSpacing != null && `letter-spacing: ${a.letterSpacing}px !important`), w(d, a.color != null && `color: ${a.color} !important`), w(d, a.fontWeight != null && `font-weight: ${a.fontWeight} !important`), w(d, a.fontFamily != null && `font-family: '${a.fontFamily}', Arial, sans-serif !important`), w(d, a.fontStyle != null && `font-style: ${a.fontStyle} !important`), w(d, a.textTransform != null && `text-transform: ${a.textTransform} !important`), w(d, a.textDecoration != null && `text-decoration: ${a.textDecoration} !important`), d.length > 0 && p.push(`.${r}-text { ${d.join("; ")} }`);
2541
+ }
2542
+ b && u.length > 0 && p.push(`.${r}-button-table { ${u.join("; ")} }`);
2543
+ } else if (n === "image") {
2544
+ for (const u of ["width", "height"]) a[u] != null && c.push(`${u}: ${ro(a[u], u)} !important`);
2545
+ w(c, a.borderRadius != null && `border-radius: ${Y(a.borderRadius)} !important`), w(c, a.border != null && ue(a.border, !0));
2546
+ } else if (n === "video")
2547
+ w(c, a.width != null && `width: ${a.width}% !important`), w(c, a.height != null && `height: ${a.height} !important`), w(c, a.borderRadius != null && `border-radius: ${Y(a.borderRadius)} !important`), w(c, a.border != null && ue(a.border, !0));
2548
+ else if (n === "divider") {
2549
+ const u = [], d = [];
2550
+ if (a.width != null && u.push(`width: ${a.width}% !important`), a.align != null) {
2551
+ const s = a.align === "left" ? "0" : "auto", S = a.align === "right" ? "0" : "auto";
2552
+ u.push(`margin-left: ${s} !important`), u.push(`margin-right: ${S} !important`);
2553
+ }
2554
+ a.height != null && (d.push(`height: ${a.height}px !important`), d.push(`line-height: ${a.height}px !important`)), d.push(...R()), u.length > 0 && p.push(`.${r}-divider-table { ${u.join("; ")} }`), d.length > 0 && p.push(`.${r}-divider-td { ${d.join("; ")} }`);
2555
+ } else if (n === "spacer") {
2556
+ const u = [];
2557
+ a.height != null && (u.push(`height: ${a.height}px !important`), u.push(`line-height: ${a.height}px !important`)), u.push(...R()), u.length > 0 && p.push(`.${r}-spacer-td { ${u.join("; ")} }`);
2558
+ } else if (n === "list")
2559
+ M(l), a.itemSpacing != null && p.push(`.${r} li { margin-bottom: ${a.itemSpacing}px !important; }`);
2560
+ else if (n === "menu") {
2561
+ const u = [];
2562
+ if (u.push(...R()), a.padding) {
2563
+ const s = a.padding;
2564
+ u.push(`padding: ${s.top}px ${s.right}px ${s.bottom}px ${s.left}px !important`);
2565
+ }
2566
+ u.length > 0 && p.push(`.${r}-menu-td { ${u.join("; ")} }`), a.align != null && p.push(`.${r}-menu-td { text-align: ${a.align} !important; }`);
2567
+ const d = [];
2568
+ if (a.fontSize != null && d.push(`font-size: ${a.fontSize}px !important`), a.lineHeight != null && d.push(`line-height: ${a.lineHeight} !important`), a.letterSpacing != null && d.push(`letter-spacing: ${a.letterSpacing}px !important`), a.color != null && d.push(`color: ${a.color} !important`), a.fontWeight != null && d.push(`font-weight: ${a.fontWeight} !important`), a.fontFamily != null && d.push(`font-family: '${a.fontFamily}', Arial, sans-serif !important`), a.fontStyle != null && d.push(`font-style: ${a.fontStyle} !important`), a.textTransform != null && d.push(`text-transform: ${a.textTransform} !important`), a.textDecoration != null && d.push(`text-decoration: ${a.textDecoration} !important`), d.length > 0 && p.push(`.${r}-menu-td a { ${d.join("; ")} }`), o) {
2569
+ const s = a.spacing ?? t.props.spacing ?? 0;
2570
+ p.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; }`), p.push(`.${r}-menu-item:last-of-type a { margin-bottom: 0 !important; }`);
2571
+ } else if (a.spacing != null) {
2572
+ const s = Math.ceil(a.spacing / 2);
2573
+ p.push(`.${r}-menu-item a { margin-left: ${s}px !important; margin-right: ${s}px !important; }`), p.push(`.${r}-menu-item:first-of-type a { margin-left: 0 !important; }`), p.push(`.${r}-menu-item:last-of-type a { margin-right: 0 !important; }`);
2574
+ }
2575
+ } else if (n === "socials") {
2576
+ const u = [];
2577
+ if (a.padding) {
2578
+ const d = a.padding;
2579
+ u.push(`padding: ${d.top}px ${d.right}px ${d.bottom}px ${d.left}px !important`);
2580
+ }
2581
+ if (a.align != null) {
2582
+ const d = a.align === "left" ? "0" : "auto", s = a.align === "right" ? "0" : "auto";
2583
+ p.push(`.${r}-socials-inner { display:inline-table !important; margin-left: ${d} !important; margin-right: ${s} !important; }`), u.push(`text-align: ${a.align} !important`);
2584
+ }
2585
+ if (u.length > 0 && p.push(`.${r}-socials-td { ${u.join("; ")} }`), a.iconSize != null && p.push(`.${r}-socials-inner img { width: ${a.iconSize}px !important; height: ${a.iconSize}px !important; }`), a.spacing != null) {
2586
+ const d = Math.ceil(a.spacing / 2);
2587
+ p.push(`.${r}-socials-item a { margin-left: ${d}px !important; margin-right: ${d}px !important; }`), p.push(`.${r}-socials-item:first-of-type a { margin-left: 0 !important; }`), p.push(`.${r}-socials-item:last-of-type a { margin-right: 0 !important; }`);
2588
+ }
2589
+ } else M(l);
2590
+ const O = [];
2591
+ if (l.length > 0 && O.push(`.${r} { ${l.join("; ")} }`), c.length > 0) {
2592
+ const u = v ? `.${r}-link` : n === "image" ? `.${r} img` : n === "video" ? `.${r} video` : `.${r}`;
2593
+ O.push(`${u} { ${c.join("; ")} }`);
2594
+ }
2595
+ return O.push(...p), O.join(`
2596
+ `);
2597
+ } }), ln = (e) => de(e) ? ue(e) : "", Pn = (e, t, r = [], n) => {
2598
+ const o = `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), a = t && de(t) && !ee(t.radius ?? 0);
2599
+ if (!i) {
2600
+ const p = [o];
2601
+ return a && p.push(ln(t)), p.push("line-height:0"), p.push("font-size:0"), `<div style="${p.join(";")}">${e}</div>`;
2602
+ }
2603
+ const l = [
2604
+ `border-radius:${Y(t.radius)}`,
2605
+ "overflow:hidden",
2606
+ "line-height:0",
2607
+ "font-size:0"
2608
+ ];
2609
+ de(t) && l.push(ln(t));
2610
+ const c = [
2611
+ o,
2612
+ "line-height:0",
2613
+ "font-size:0"
2614
+ ];
2615
+ return `<div style="${l.join(";")}"><div style="${c.join(";")}">${e}</div></div>`;
2616
+ }, oo = (e, t, r = {}, n, o = !0) => {
2617
+ const i = `${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, a = t && ee(t.radius ?? 0) && de(t) && o, l = t && de(t) && !ee(t.radius ?? 0) && o;
2618
+ if (!a) {
2619
+ const v = {
2620
+ padding: i,
2621
+ lineHeight: "0",
2622
+ fontSize: "0"
2623
+ };
2624
+ 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>`;
2625
+ }
2626
+ const c = {
2627
+ borderRadius: Y(t.radius),
2628
+ overflow: "hidden",
2629
+ lineHeight: "0",
2630
+ fontSize: "0"
2631
+ };
2632
+ de(t) && Object.assign(c, At(t));
2633
+ const p = {
2634
+ padding: i,
2635
+ lineHeight: "0",
2636
+ fontSize: "0"
2637
+ };
2638
+ return `<div style={{ ${Object.entries(c).map(([v, b]) => `${v}:"${b}"`).join(", ")} }}><div style={{ ${Object.entries(p).map(([v, b]) => `${v}:"${b}"`).join(", ")} }}>${e}</div></div>`;
2639
+ }, _t = null, Tt = null;
2640
+ function Dn() {
2641
+ return _t ??= Promise.all([import("./standalone-DHvJ30Td.js"), import("./html-wb0gSX1o.js")]).then(([e, t]) => ({
2642
+ prettier: e.default ?? e,
2643
+ plugins: [t.default ?? t]
2644
+ })).catch((e) => {
2645
+ throw _t = null, e;
2646
+ }), _t;
2647
+ }
2648
+ function ao() {
2649
+ return Tt ??= Promise.all([
2650
+ import("./standalone-DHvJ30Td.js"),
2651
+ import("./babel-DV7WPQI0.js"),
2652
+ import("./estree-DY9POgc0.js")
2653
+ ]).then(([e, t, r]) => ({
2654
+ prettier: e.default ?? e,
2655
+ plugins: [t.default ?? t, r.default ?? r]
2656
+ })).catch((e) => {
2657
+ throw Tt = null, e;
2658
+ }), Tt;
2659
+ }
2660
+ async function Gt(e, t) {
2661
+ try {
2662
+ return await t();
2663
+ } catch (r) {
2664
+ return console.warn("[maildeno-editor] formatter unavailable; returning unformatted output", r), e;
2665
+ }
2666
+ }
2667
+ var io = async (e) => Gt(e, async () => {
2668
+ const { prettier: t, plugins: r } = await Dn();
2669
+ return t.format(e, {
2670
+ parser: "html",
2671
+ plugins: r
2672
+ });
2673
+ }), so = async (e) => Gt(e, async () => {
2674
+ const { prettier: t, plugins: r } = await ao();
2675
+ return t.format(e, {
2676
+ parser: "babel-ts",
2677
+ plugins: r
2678
+ });
2679
+ }), lo = async (e) => Gt(e, async () => {
2680
+ const { prettier: t, plugins: r } = await Dn();
2681
+ return t.format(e, {
2682
+ parser: "html",
2683
+ plugins: r
2684
+ });
2685
+ }), cn = (e) => e.trim().toLowerCase().replace(/\s+/g, "_"), co = (e) => {
2686
+ const t = e.indexOf("|");
2687
+ if (t === -1) return { key: cn(e) };
2688
+ const r = e.slice(0, t), n = e.slice(t + 1).trim().replace(/^['"]|['"]$/g, "");
2689
+ return {
2690
+ key: cn(r),
2691
+ pipeDefault: n
2692
+ };
2693
+ }, un = (e, t, r) => !r || !e ? e : e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (n, o) => {
2694
+ const { key: i, pipeDefault: a } = co(o);
2695
+ return Object.prototype.hasOwnProperty.call(t, i) && t[i] !== "" ? t[i] : a !== void 0 ? a : n;
2696
+ }), Fn = (e, t, r, n, o) => {
2697
+ let i = un(e, t, r);
2698
+ return i = un(i, n, o), i;
2699
+ }, qt = /* @__PURE__ */ new Map();
2700
+ function ma(e) {
2701
+ for (const t of e) qt.set(t.key, t);
2702
+ }
2703
+ function uo() {
2704
+ return [...qt.keys()];
2705
+ }
2706
+ function po(e, t) {
2707
+ return qt.get(e)?.tokens?.[t];
2708
+ }
2709
+ var Wt = {
2710
+ unsubscribe_url: {
2711
+ handlebars: "{{{unsubscribe_url}}}",
2712
+ sendgrid: "{{{unsubscribe_url}}}",
2713
+ iterable: "{{unsubscribeUrl}}",
2714
+ mailchimp: "*|UNSUB|*",
2715
+ klaviyo: "{% unsubscribe_link %}",
2716
+ liquid: "{{ unsubscribe_url }}",
2717
+ braze: "{{${set_user_to_unsubscribed_url}}}",
2718
+ hubspot: "{{ unsubscribe_link_url }}",
2719
+ sfmc: "%%unsub_center_url%%",
2720
+ activecampaign: "%UNSUBSCRIBELINK%",
2721
+ marketo: "{{system.unsubscribeLink}}",
2722
+ pardot: "%%unsubscribe%%",
2723
+ campaign_monitor: "<unsubscribe>Unsubscribe</unsubscribe>"
2724
+ },
2725
+ webview_url: {
2726
+ handlebars: "{{{webview_url}}}",
2727
+ sendgrid: "{{{webview_url}}}",
2728
+ iterable: "{{webViewUrl}}",
2729
+ mailchimp: "*|ARCHIVE|*",
2730
+ klaviyo: "{% web_view_link %}",
2731
+ liquid: "{{ webview_url }}",
2732
+ braze: "{{ webview_url }}",
2733
+ hubspot: "{{ view_as_page_url }}",
2734
+ sfmc: "%%view_email_url%%",
2735
+ activecampaign: "%VIEWINBROWSERLINK%",
2736
+ marketo: "{{system.viewAsWebpageLink}}",
2737
+ pardot: "%%view_online%%",
2738
+ campaign_monitor: "<webversion>View online</webversion>"
2739
+ },
2740
+ email: {
2741
+ handlebars: "{{ email }}",
2742
+ sendgrid: "{{ email }}",
2743
+ iterable: "{{email}}",
2744
+ mailchimp: "*|EMAIL|*",
2745
+ klaviyo: "{{ email }}",
2746
+ liquid: "{{ email }}",
2747
+ braze: "{{${email_address}}}",
2748
+ hubspot: "{{ contact.email }}",
2749
+ sfmc: "%%emailaddr%%",
2750
+ activecampaign: "%EMAIL%",
2751
+ marketo: "{{lead.Email Address}}",
2752
+ pardot: "%%email%%",
2753
+ campaign_monitor: "[email]"
2754
+ },
2755
+ first_name: {
2756
+ handlebars: "{{ first_name }}",
2757
+ sendgrid: "{{ first_name }}",
2758
+ iterable: "{{firstName}}",
2759
+ mailchimp: "*|FNAME|*",
2760
+ klaviyo: "{{ first_name }}",
2761
+ liquid: "{{ first_name }}",
2762
+ braze: "{{${first_name}}}",
2763
+ hubspot: "{{ contact.firstname }}",
2764
+ sfmc: "%%First Name%%",
2765
+ activecampaign: "%FIRSTNAME%",
2766
+ marketo: "{{lead.First Name}}",
2767
+ pardot: "%%first_name%%",
2768
+ campaign_monitor: "[firstname]"
2769
+ },
2770
+ last_name: {
2771
+ handlebars: "{{ last_name }}",
2772
+ sendgrid: "{{ last_name }}",
2773
+ iterable: "{{lastName}}",
2774
+ mailchimp: "*|LNAME|*",
2775
+ klaviyo: "{{ last_name }}",
2776
+ liquid: "{{ last_name }}",
2777
+ braze: "{{${last_name}}}",
2778
+ hubspot: "{{ contact.lastname }}",
2779
+ sfmc: "%%Last Name%%",
2780
+ activecampaign: "%LASTNAME%",
2781
+ marketo: "{{lead.Last Name}}",
2782
+ pardot: "%%last_name%%",
2783
+ campaign_monitor: "[lastname]"
2784
+ },
2785
+ full_name: {
2786
+ handlebars: "{{ full_name }}",
2787
+ sendgrid: "{{ full_name }}",
2788
+ iterable: "{{firstName}} {{lastName}}",
2789
+ mailchimp: "*|FNAME|* *|LNAME|*",
2790
+ klaviyo: "{{ first_name }} {{ last_name }}",
2791
+ liquid: "{{ full_name }}",
2792
+ braze: "{{${first_name}}} {{${last_name}}}",
2793
+ hubspot: "{{ contact.firstname }} {{ contact.lastname }}",
2794
+ sfmc: "%%First Name%% %%Last Name%%",
2795
+ activecampaign: "%FIRSTNAME% %LASTNAME%",
2796
+ marketo: "{{lead.Full Name}}",
2797
+ pardot: "%%full_name%%"
2798
+ },
2799
+ company: {
2800
+ handlebars: "{{ company }}",
2801
+ sendgrid: "{{ company }}",
2802
+ iterable: "{{company}}",
2803
+ mailchimp: "*|COMPANY|*",
2804
+ klaviyo: "{{ organization }}",
2805
+ liquid: "{{ company }}",
2806
+ braze: "{{custom_attribute.${company}}}",
2807
+ hubspot: "{{ contact.company }}",
2808
+ sfmc: "%%Company%%",
2809
+ activecampaign: "%ORG%",
2810
+ marketo: "{{lead.Company Name}}",
2811
+ pardot: "%%company%%"
2812
+ },
2813
+ current_date: {
2814
+ handlebars: "{{ current_date }}",
2815
+ sendgrid: "{{ current_date }}",
2816
+ iterable: "{{now}}",
2817
+ mailchimp: "*|DATE:d F Y|*",
2818
+ klaviyo: "{{ 'now' | date: '%B %d, %Y' }}",
2819
+ liquid: "{{ 'now' | date: '%B %d, %Y' }}",
2820
+ braze: "{{ 'now' | date: '%B %d, %Y' }}",
2821
+ hubspot: "{{ today }}",
2822
+ sfmc: "%%=Format(Now(),'M/d/yyyy')=%%"
2823
+ }
2824
+ }, mo = (e, t, r) => {
2825
+ const n = !!r?.trim(), o = r?.trim() ?? "";
2826
+ switch (t) {
2827
+ case "liquid":
2828
+ case "klaviyo":
2829
+ case "hubspot":
2830
+ return n ? `{{ ${e} | default: '${o}' }}` : `{{ ${e} }}`;
2831
+ case "braze":
2832
+ return n ? `{{custom_attribute.${e} | default: '${o}'}}` : `{{custom_attribute.${e}}}`;
2833
+ case "handlebars":
2834
+ case "sendgrid":
2835
+ return n ? `{{ ${e} }}{{!-- default: ${o} --}}` : `{{ ${e} }}`;
2836
+ case "iterable":
2837
+ return n ? `{{${e}|default:${o}}}` : `{{${e}}}`;
2838
+ case "mailchimp":
2839
+ return n ? `*|${e.toUpperCase()}:${o}|*` : `*|${e.toUpperCase()}|*`;
2840
+ case "sfmc":
2841
+ return n ? `%%=IIF(Empty(@${e}),'${o}',@${e})=%%` : `%%=v(@${e})=%%`;
2842
+ case "activecampaign":
2843
+ return `%${e.toUpperCase()}%`;
2844
+ case "marketo":
2845
+ return n ? `{{lead.${e}:default ${o}}}` : `{{lead.${e}}}`;
2846
+ case "pardot":
2847
+ return `%%${e}%%`;
2848
+ case "campaign_monitor":
2849
+ return `[${e}]`;
2850
+ default:
2851
+ return `{{ ${e} }}`;
2852
+ }
2853
+ }, dn = (e, t, r) => {
2854
+ const n = r.trim();
2855
+ if (!n) return e;
2856
+ switch (t) {
2857
+ case "mailchimp":
2858
+ return /^\*\|[\w:]+\|\*$/.test(e) ? e.replace(/\|\*$/, `:${n}|*`) : e;
2859
+ case "marketo":
2860
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `:default ${n}}}`) : e;
2861
+ case "liquid":
2862
+ case "klaviyo":
2863
+ case "hubspot":
2864
+ return /^\{\{\s*[^}]+\s*\}\}$/.test(e) ? e.replace(/\s*\}\}$/, ` | default: '${n}'}}`) : e;
2865
+ case "braze":
2866
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, ` | default: '${n}'}}`) : e;
2867
+ case "iterable":
2868
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `|default:${n}}}`) : e;
2869
+ case "sfmc":
2870
+ return /^%%[^%]+%%$/.test(e) ? `%%=IIF(Empty(${e}),'${n}',${e})=%%` : e;
2871
+ case "handlebars":
2872
+ case "sendgrid":
2873
+ return `${e}{{!-- default: ${n} --}}`;
2874
+ default:
2875
+ return e;
2876
+ }
2877
+ }, pn = (e, t, r) => {
2878
+ const n = Wt[e];
2879
+ if (n) {
2880
+ const i = n[t];
2881
+ if (i) return r?.trim() ? dn(i, t, r) : i;
2882
+ }
2883
+ const o = po(e, t);
2884
+ return o ? r?.trim() ? dn(o, t, r) : o : mo(e, t, r);
2885
+ }, fo = (e, t) => {
2886
+ if (!e) return "";
2887
+ let r = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, o, i) => pn(o, t, i?.trim() || void 0));
2888
+ return r = r.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (n, o, i, a, l, c, p) => {
2889
+ const v = (o ?? i ?? a ?? "").trim(), b = (l ?? c ?? p ?? "").trim();
2890
+ return pn(v, t, b || void 0);
2891
+ }), r;
2892
+ }, fa = () => [...Object.keys(Wt), ...uo()], ga = (e, t) => Wt[e]?.[t] ?? null, Ge = (e) => {
2893
+ let t = (e ?? "").trim().replace(/[^A-Za-z0-9_$]+/g, "_");
2894
+ return /^[0-9]/.test(t) && (t = `_${t}`), t || "_tag";
2895
+ }, mn = (e, t) => {
2896
+ const r = e.trim();
2897
+ return r ? t?.trim() ? `{${r} ?? "${t.trim().replace(/"/g, '\\"')}"}` : `{${r}}` : "";
2898
+ }, go = (e) => {
2899
+ if (!e) return "";
2900
+ let t = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (r, n, o) => mn(n, o?.trim() || void 0));
2901
+ return t = t.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (r, n, o, i, a, l, c) => {
2902
+ const p = (n ?? o ?? i ?? "").trim(), v = (a ?? l ?? c ?? "").trim();
2903
+ return mn(p, v || void 0);
2904
+ }), t = t.replace(/(\b(?!style=)\w[\w-]*=)"([^"]*\{[^}]+\}[^"]*)"/g, (r, n, o) => {
2905
+ const i = o.match(/^\{(\w+)\}$/);
2906
+ return i ? `${n}{${i[1]}}` : `${n}{\`${o.replace(/\{(\w+)\}/g, "${$1}")}\`}`;
2907
+ }), t;
2908
+ }, ho = (e) => {
2909
+ if (e.length === 0) return {
2910
+ propsInterface: "",
2911
+ propsDestructure: ""
2912
+ };
2913
+ const t = /* @__PURE__ */ new Map();
2914
+ for (const { tagId: n, fallback: o } of e) t.has(n) || t.set(n, o);
2915
+ const r = [...t.entries()];
2916
+ return {
2917
+ propsInterface: `interface EmailProps {
2918
+ ${r.map(([n]) => ` ${n}?: string;`).join(`
2919
+ `)}
2920
+ }`,
2921
+ propsDestructure: `{ ${r.map(([n, o]) => o?.trim() ? `${n} = "${o.trim().replace(/"/g, '\\"')}"` : n).join(", ")} }: EmailProps`
2922
+ };
2923
+ }, vo = (e) => {
2924
+ const t = /* @__PURE__ */ new Map();
2925
+ for (const r of e.matchAll(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs)) {
2926
+ const n = r[1].trim();
2927
+ n && !t.has(n) && t.set(n, r[2]?.trim() || void 0);
2928
+ }
2929
+ for (const r of e.matchAll(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g)) {
2930
+ const n = (r[1] ?? r[2] ?? r[3] ?? "").trim(), o = (r[4] ?? r[5] ?? r[6] ?? "").trim();
2931
+ n && !t.has(n) && t.set(n, o || void 0);
2932
+ }
2933
+ return [...t.entries()].map(([r, n]) => ({
2934
+ tagId: r,
2935
+ fallback: n
2936
+ }));
2937
+ }, bo = (e) => {
2938
+ const t = /* @__PURE__ */ new Set(), r = (o) => {
2939
+ if (o?.enabled) {
2940
+ for (const i of o.rules ?? []) i.tag?.trim() && t.add(Ge(i.tag));
2941
+ for (const i of o.groups ?? []) for (const a of i.rules ?? []) a.tag?.trim() && t.add(Ge(a.tag));
2942
+ }
2943
+ }, n = (o) => {
2944
+ for (const i of o) if (i.type === "row") {
2945
+ r(i.visibility);
2946
+ for (const a of i.columns ?? []) {
2947
+ r(a.props?.visibility);
2948
+ const l = a.children ?? a.components ?? [];
2949
+ n(l);
2950
+ }
2951
+ } else i.type === "row-spacer" ? r(i.visibility) : r(i.props?.visibility);
2952
+ };
2953
+ for (const o of e) {
2954
+ r(o.visibility);
2955
+ for (const i of o.columns ?? [])
2956
+ r(i.props?.visibility), n(i.children ?? i.components ?? []);
2957
+ }
2958
+ return [...t];
2959
+ }, $o = (e) => e.length === 0 ? "" : ` // Visibility data — replace with real values from your data source
2960
+ ${e.map((t) => ` const ${t} = "";`).join(`
2961
+ `)}`, Hn = (e, t, r, n, o = !1) => {
2962
+ const i = n?.mergeTagActive || n?.linkTagActive;
2963
+ if (t === "wrap" || !i) return fo(e, r);
2964
+ if (o) {
2965
+ const { mergeTagContext: a, mergeTagActive: l, linkTagContext: c, linkTagActive: p } = n;
2966
+ return Fn(e, a ?? {}, l ?? !1, c ?? {}, p ?? !1);
2967
+ }
2968
+ return e;
2969
+ }, Un = (e, t, r) => {
2970
+ if (t === "wrap" || !r) return e;
2971
+ const { mergeTagContext: n, mergeTagActive: o, linkTagContext: i, linkTagActive: a } = r;
2972
+ return !o && !a ? e : Fn(e, n, o, i, a);
2973
+ }, Vt = /* @__PURE__ */ new Map(), Jn = /* @__PURE__ */ new Map();
2974
+ function ha(e, t, r) {
2975
+ Vt.set(e, t), r && Jn.set(e, r);
2976
+ }
2977
+ var yo = {
2978
+ label: "Custom",
2979
+ group: "custom",
2980
+ description: "Registered ESP syntax with no metadata override.",
2981
+ supportsNesting: !0
2982
+ };
2983
+ function So(e, t) {
2984
+ return t[e] ?? Vt.get(e) ?? yo;
2985
+ }
2986
+ function Gn(e) {
2987
+ return Jn.get(e);
2988
+ }
2989
+ function va() {
2990
+ return [...Vt.entries()].map(([e, t]) => ({
2991
+ id: e,
2992
+ meta: t
2993
+ }));
2994
+ }
2995
+ var ko = {
2996
+ handlebars: {
2997
+ label: "Handlebars (Generic)",
2998
+ group: "handlebars",
2999
+ description: "Generic Handlebars.js template syntax",
3000
+ supportsNesting: !0
3001
+ },
3002
+ sendgrid: {
3003
+ label: "SendGrid",
3004
+ group: "handlebars",
3005
+ description: "SendGrid Dynamic Templates (Handlebars)",
3006
+ docsUrl: "https://docs.sendgrid.com/for-developers/sending-email/using-handlebars",
3007
+ supportsNesting: !0
3008
+ },
3009
+ iterable: {
3010
+ label: "Iterable",
3011
+ group: "handlebars",
3012
+ description: "Iterable templating (Handlebars-compatible)",
3013
+ docsUrl: "https://support.iterable.com/hc/en-us/articles/205480365",
3014
+ supportsNesting: !0
3015
+ },
3016
+ mailchimp: {
3017
+ label: "Mailchimp",
3018
+ group: "custom",
3019
+ description: "Mailchimp merge tag conditionals *|IF:…|*",
3020
+ docsUrl: "https://mailchimp.com/help/use-conditional-merge-tag-blocks/",
3021
+ supportsNesting: !1
3022
+ },
3023
+ klaviyo: {
3024
+ label: "Klaviyo",
3025
+ group: "liquid",
3026
+ description: "Klaviyo (Liquid templating)",
3027
+ docsUrl: "https://help.klaviyo.com/hc/en-us/articles/115002775012",
3028
+ supportsNesting: !0
3029
+ },
3030
+ liquid: {
3031
+ label: "Liquid (Generic)",
3032
+ group: "liquid",
3033
+ description: "Generic Liquid template syntax (Shopify, etc.)",
3034
+ supportsNesting: !0
3035
+ },
3036
+ braze: {
3037
+ label: "Braze",
3038
+ group: "liquid",
3039
+ description: "Braze (Liquid + Connected Content)",
3040
+ docsUrl: "https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/",
3041
+ supportsNesting: !0
3042
+ },
3043
+ hubspot: {
3044
+ label: "HubSpot",
3045
+ group: "liquid",
3046
+ description: "HubSpot (HubL — Liquid-based)",
3047
+ docsUrl: "https://developers.hubspot.com/docs/cms/hubl/intro-to-hubl",
3048
+ supportsNesting: !0
3049
+ },
3050
+ sfmc: {
3051
+ label: "Salesforce Marketing Cloud",
3052
+ group: "ampscript",
3053
+ description: "SFMC AMPscript conditionals",
3054
+ docsUrl: "https://ampscript.guide/if/",
3055
+ supportsNesting: !0
3056
+ },
3057
+ activecampaign: {
3058
+ label: "ActiveCampaign",
3059
+ group: "custom",
3060
+ description: "ActiveCampaign conditional content tags",
3061
+ docsUrl: "https://help.activecampaign.com/hc/en-us/articles/220358207",
3062
+ supportsNesting: !0
3063
+ },
3064
+ marketo: {
3065
+ label: "Marketo",
3066
+ group: "custom",
3067
+ description: "Marketo Velocity Script conditionals",
3068
+ docsUrl: "https://nation.marketo.com/t5/product-blogs/velocity-scripting/ba-p/232782",
3069
+ supportsNesting: !0
3070
+ },
3071
+ campaign_monitor: {
3072
+ label: "Campaign Monitor",
3073
+ group: "custom",
3074
+ description: "Campaign Monitor conditional merge tags",
3075
+ docsUrl: "https://help.campaignmonitor.com/custom-fields-and-personalization",
3076
+ supportsNesting: !1
3077
+ },
3078
+ pardot: {
3079
+ label: "Pardot / MCAE",
3080
+ group: "custom",
3081
+ description: "Pardot (Marketing Cloud Account Engagement) conditionals",
3082
+ docsUrl: "https://help.salesforce.com/s/articleView?id=pardot_variable_tags.htm",
3083
+ supportsNesting: !1
3084
+ },
3085
+ mso: {
3086
+ label: "Outlook (MSO)",
3087
+ group: "mso",
3088
+ description: "Microsoft Office VML conditional comments for Outlook",
3089
+ supportsNesting: !1
3090
+ }
3091
+ }, ba = [
3092
+ {
3093
+ syntax: "handlebars",
3094
+ label: "Handlebars",
3095
+ eq: "native",
3096
+ neq: "helper",
3097
+ contains: "helper",
3098
+ not_contains: "helper",
3099
+ starts_with: "helper",
3100
+ ends_with: "helper",
3101
+ in: "helper",
3102
+ not_in: "helper",
3103
+ numeric: "helper",
3104
+ is_empty: "helper",
3105
+ date: "helper"
3106
+ },
3107
+ {
3108
+ syntax: "sendgrid",
3109
+ label: "SendGrid",
3110
+ eq: "native",
3111
+ neq: "none",
3112
+ contains: "none",
3113
+ not_contains: "none",
3114
+ starts_with: "none",
3115
+ ends_with: "none",
3116
+ in: "none",
3117
+ not_in: "none",
3118
+ numeric: "none",
3119
+ is_empty: "none",
3120
+ date: "none"
3121
+ },
3122
+ {
3123
+ syntax: "iterable",
3124
+ label: "Iterable",
3125
+ eq: "native",
3126
+ neq: "helper",
3127
+ contains: "helper",
3128
+ not_contains: "helper",
3129
+ starts_with: "helper",
3130
+ ends_with: "helper",
3131
+ in: "helper",
3132
+ not_in: "helper",
3133
+ numeric: "helper",
3134
+ is_empty: "helper",
3135
+ date: "helper"
3136
+ },
3137
+ {
3138
+ syntax: "liquid",
3139
+ label: "Liquid",
3140
+ eq: "native",
3141
+ neq: "native",
3142
+ contains: "native",
3143
+ not_contains: "native",
3144
+ starts_with: "none",
3145
+ ends_with: "none",
3146
+ in: "fallback",
3147
+ not_in: "fallback",
3148
+ numeric: "native",
3149
+ is_empty: "native",
3150
+ date: "native"
3151
+ },
3152
+ {
3153
+ syntax: "klaviyo",
3154
+ label: "Klaviyo",
3155
+ eq: "native",
3156
+ neq: "native",
3157
+ contains: "native",
3158
+ not_contains: "native",
3159
+ starts_with: "none",
3160
+ ends_with: "none",
3161
+ in: "fallback",
3162
+ not_in: "fallback",
3163
+ numeric: "native",
3164
+ is_empty: "native",
3165
+ date: "native"
3166
+ },
3167
+ {
3168
+ syntax: "braze",
3169
+ label: "Braze",
3170
+ eq: "native",
3171
+ neq: "native",
3172
+ contains: "native",
3173
+ not_contains: "native",
3174
+ starts_with: "none",
3175
+ ends_with: "none",
3176
+ in: "fallback",
3177
+ not_in: "fallback",
3178
+ numeric: "native",
3179
+ is_empty: "native",
3180
+ date: "native"
3181
+ },
3182
+ {
3183
+ syntax: "hubspot",
3184
+ label: "HubSpot",
3185
+ eq: "native",
3186
+ neq: "native",
3187
+ contains: "native",
3188
+ not_contains: "native",
3189
+ starts_with: "none",
3190
+ ends_with: "none",
3191
+ in: "fallback",
3192
+ not_in: "fallback",
3193
+ numeric: "native",
3194
+ is_empty: "native",
3195
+ date: "native"
3196
+ },
3197
+ {
3198
+ syntax: "sfmc",
3199
+ label: "SFMC",
3200
+ eq: "native",
3201
+ neq: "native",
3202
+ contains: "native",
3203
+ not_contains: "native",
3204
+ starts_with: "native",
3205
+ ends_with: "native",
3206
+ in: "fallback",
3207
+ not_in: "fallback",
3208
+ numeric: "native",
3209
+ is_empty: "native",
3210
+ date: "native"
3211
+ },
3212
+ {
3213
+ syntax: "activecampaign",
3214
+ label: "ActiveCampaign",
3215
+ eq: "native",
3216
+ neq: "native",
3217
+ contains: "native",
3218
+ not_contains: "native",
3219
+ starts_with: "none",
3220
+ ends_with: "none",
3221
+ in: "native",
3222
+ not_in: "fallback",
3223
+ numeric: "native",
3224
+ is_empty: "native",
3225
+ date: "fallback"
3226
+ },
3227
+ {
3228
+ syntax: "marketo",
3229
+ label: "Marketo",
3230
+ eq: "native",
3231
+ neq: "native",
3232
+ contains: "native",
3233
+ not_contains: "native",
3234
+ starts_with: "native",
3235
+ ends_with: "native",
3236
+ in: "fallback",
3237
+ not_in: "fallback",
3238
+ numeric: "native",
3239
+ is_empty: "native",
3240
+ date: "native"
3241
+ },
3242
+ {
3243
+ syntax: "mailchimp",
3244
+ label: "Mailchimp",
3245
+ eq: "native",
3246
+ neq: "native",
3247
+ contains: "fallback",
3248
+ not_contains: "fallback",
3249
+ starts_with: "fallback",
3250
+ ends_with: "fallback",
3251
+ in: "fallback",
3252
+ not_in: "fallback",
3253
+ numeric: "native",
3254
+ is_empty: "fallback",
3255
+ date: "fallback"
3256
+ },
3257
+ {
3258
+ syntax: "pardot",
3259
+ label: "Pardot",
3260
+ eq: "native",
3261
+ neq: "native",
3262
+ contains: "none",
3263
+ not_contains: "none",
3264
+ starts_with: "none",
3265
+ ends_with: "none",
3266
+ in: "none",
3267
+ not_in: "none",
3268
+ numeric: "none",
3269
+ is_empty: "none",
3270
+ date: "none"
3271
+ },
3272
+ {
3273
+ syntax: "campaign_monitor",
3274
+ label: "Campaign Monitor",
3275
+ eq: "native",
3276
+ neq: "native",
3277
+ contains: "none",
3278
+ not_contains: "none",
3279
+ starts_with: "none",
3280
+ ends_with: "none",
3281
+ in: "none",
3282
+ not_in: "none",
3283
+ numeric: "none",
3284
+ is_empty: "none",
3285
+ date: "none"
3286
+ },
3287
+ {
3288
+ syntax: "mso",
3289
+ label: "MSO/Outlook",
3290
+ eq: "native",
3291
+ neq: "none",
3292
+ contains: "none",
3293
+ not_contains: "none",
3294
+ starts_with: "none",
3295
+ ends_with: "none",
3296
+ in: "none",
3297
+ not_in: "none",
3298
+ numeric: "none",
3299
+ is_empty: "none",
3300
+ date: "none"
3301
+ }
3302
+ ], wo = (e, t) => {
3303
+ const r = Ge(e);
3304
+ switch (t) {
3305
+ case "sfmc":
3306
+ return `AttributeValue("${r}")`;
3307
+ case "marketo":
3308
+ return `$!{${r}}`;
3309
+ case "mailchimp":
3310
+ return r.toUpperCase();
3311
+ default:
3312
+ return r;
3313
+ }
3314
+ }, Te = (e, t) => {
3315
+ const { operator: r, value: n } = e, o = wo(e.tag, t);
3316
+ switch (t) {
3317
+ case "handlebars":
3318
+ case "sendgrid":
3319
+ case "iterable":
3320
+ switch (r) {
3321
+ case "==":
3322
+ return `(eq ${o} '${n}')`;
3323
+ case "!=":
3324
+ return `(neq ${o} '${n}')`;
3325
+ case "contains":
3326
+ return `(contains ${o} '${n}')`;
3327
+ case "not_contains":
3328
+ return `(not (contains ${o} '${n}'))`;
3329
+ case "starts_with":
3330
+ return `(startsWith ${o} '${n}')`;
3331
+ case "ends_with":
3332
+ return `(endsWith ${o} '${n}')`;
3333
+ case "in":
3334
+ return `(in ${o} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")})`;
3335
+ case "not_in":
3336
+ return `(not (in ${o} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")}))`;
3337
+ case ">":
3338
+ return `(gt ${o} ${n})`;
3339
+ case "<":
3340
+ return `(lt ${o} ${n})`;
3341
+ case ">=":
3342
+ return `(gte ${o} ${n})`;
3343
+ case "<=":
3344
+ return `(lte ${o} ${n})`;
3345
+ case "is_empty":
3346
+ return `(isEmpty ${o})`;
3347
+ case "is_not_empty":
3348
+ return `(not (isEmpty ${o}))`;
3349
+ case "date_before":
3350
+ return `(dateBefore ${o} '${n}')`;
3351
+ case "date_after":
3352
+ return `(dateAfter ${o} '${n}')`;
3353
+ case "date_on":
3354
+ return `(dateOn ${o} '${n}')`;
3355
+ default:
3356
+ return `(eq ${o} '${n}')`;
3357
+ }
3358
+ case "liquid":
3359
+ case "klaviyo":
3360
+ case "braze":
3361
+ case "hubspot":
3362
+ switch (r) {
3363
+ case "==":
3364
+ return `${o} == '${n}'`;
3365
+ case "!=":
3366
+ return `${o} != '${n}'`;
3367
+ case "contains":
3368
+ return `${o} contains '${n}'`;
3369
+ case "not_contains":
3370
+ return `not (${o} contains '${n}')`;
3371
+ case "starts_with":
3372
+ case "ends_with":
3373
+ return null;
3374
+ case "in":
3375
+ return n.split(",").map((i) => `${o} == '${i.trim()}'`).join(" or ");
3376
+ case "not_in":
3377
+ return n.split(",").map((i) => `${o} != '${i.trim()}'`).join(" and ");
3378
+ case ">":
3379
+ return `${o} > ${n}`;
3380
+ case "<":
3381
+ return `${o} < ${n}`;
3382
+ case ">=":
3383
+ return `${o} >= ${n}`;
3384
+ case "<=":
3385
+ return `${o} <= ${n}`;
3386
+ case "is_empty":
3387
+ return `${o} == blank`;
3388
+ case "is_not_empty":
3389
+ return `${o} != blank`;
3390
+ case "date_before":
3391
+ return `${Nt(e.tag)} < ${Bt(e.tag, n)}`;
3392
+ case "date_after":
3393
+ return `${Nt(e.tag)} > ${Bt(e.tag, n)}`;
3394
+ case "date_on":
3395
+ return `${o} | date: '%F' == '${n}'`;
3396
+ default:
3397
+ return `${o} == '${n}'`;
3398
+ }
3399
+ case "mailchimp":
3400
+ switch (r) {
3401
+ case "==":
3402
+ return `${o}='${n}'`;
3403
+ case "!=":
3404
+ return `${o}!='${n}'`;
3405
+ case ">":
3406
+ case "<":
3407
+ case ">=":
3408
+ case "<=": {
3409
+ const i = Number(n);
3410
+ return Number.isNaN(i) ? `${o}='${n}'` : `${o}${r}${i}`;
3411
+ }
3412
+ case "date_before":
3413
+ return `${o}<'${n}'`;
3414
+ case "date_after":
3415
+ return `${o}>'${n}'`;
3416
+ case "date_on":
3417
+ return `${o}='${n}'`;
3418
+ default:
3419
+ return `${o}='${n}'`;
3420
+ }
3421
+ case "sfmc":
3422
+ switch (r) {
3423
+ case "==":
3424
+ return `${o} == '${n}'`;
3425
+ case "!=":
3426
+ return `${o} != '${n}'`;
3427
+ case "contains":
3428
+ return `Contains(${o}, '${n}')`;
3429
+ case "not_contains":
3430
+ return `Not Contains(${o}, '${n}')`;
3431
+ case "starts_with":
3432
+ return `IndexOf(${o}, '${n}') == 1`;
3433
+ case "ends_with":
3434
+ return `Substring(${o}, Subtract(Length(${o}), Subtract(Length('${n}'), 1)), Length('${n}')) == '${n}'`;
3435
+ case "in":
3436
+ return n.split(",").map((i) => `${o} == '${i.trim()}'`).join(" OR ");
3437
+ case "not_in":
3438
+ return n.split(",").map((i) => `${o} != '${i.trim()}'`).join(" AND ");
3439
+ case ">":
3440
+ return `${o} > ${n}`;
3441
+ case "<":
3442
+ return `${o} < ${n}`;
3443
+ case ">=":
3444
+ return `${o} >= ${n}`;
3445
+ case "<=":
3446
+ return `${o} <= ${n}`;
3447
+ case "is_empty":
3448
+ return `Empty(${o})`;
3449
+ case "is_not_empty":
3450
+ return `Not Empty(${o})`;
3451
+ case "date_before":
3452
+ return `DateDiff(DateParse(${o}), DateParse('${n}'), "D") < 0`;
3453
+ case "date_after":
3454
+ return `DateDiff(DateParse(${o}), DateParse('${n}'), "D") > 0`;
3455
+ case "date_on":
3456
+ return `DateDiff(DateParse(${o}), DateParse('${n}'), "D") == 0`;
3457
+ default:
3458
+ return `${o} == '${n}'`;
3459
+ }
3460
+ case "activecampaign":
3461
+ switch (r) {
3462
+ case "==":
3463
+ return `${o} EQUALS ${n}`;
3464
+ case "!=":
3465
+ return `${o} NOT EQUALS ${n}`;
3466
+ case "contains":
3467
+ return `${o} CONTAINS ${n}`;
3468
+ case "not_contains":
3469
+ return `${o} NOT CONTAINS ${n}`;
3470
+ case "starts_with":
3471
+ case "ends_with":
3472
+ return null;
3473
+ case "in":
3474
+ return `${o} IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3475
+ case "not_in":
3476
+ return `${o} NOT IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3477
+ case ">":
3478
+ return `${o} GREATER THAN ${n}`;
3479
+ case "<":
3480
+ return `${o} LESS THAN ${n}`;
3481
+ case ">=":
3482
+ return `${o} GREATER THAN OR EQUAL TO ${n}`;
3483
+ case "<=":
3484
+ return `${o} LESS THAN OR EQUAL TO ${n}`;
3485
+ case "is_empty":
3486
+ return `${o} IS EMPTY`;
3487
+ case "is_not_empty":
3488
+ return `${o} IS NOT EMPTY`;
3489
+ case "date_before":
3490
+ return `${o} LESS THAN ${n}`;
3491
+ case "date_after":
3492
+ return `${o} GREATER THAN ${n}`;
3493
+ case "date_on":
3494
+ return `${o} EQUALS ${n}`;
3495
+ default:
3496
+ return `${o} EQUALS ${n}`;
3497
+ }
3498
+ case "marketo":
3499
+ switch (r) {
3500
+ case "==":
3501
+ return `${o} == '${n}'`;
3502
+ case "!=":
3503
+ return `${o} != '${n}'`;
3504
+ case "contains":
3505
+ return `${o} && ${o}.contains('${n}')`;
3506
+ case "not_contains":
3507
+ return `!${o} || !${o}.contains('${n}')`;
3508
+ case "starts_with":
3509
+ return `${o}.startsWith('${n}')`;
3510
+ case "ends_with":
3511
+ return `${o}.endsWith('${n}')`;
3512
+ case "in":
3513
+ return n.split(",").map((i) => `${o} == '${i.trim()}'`).join(" || ");
3514
+ case "not_in":
3515
+ return n.split(",").map((i) => `${o} != '${i.trim()}'`).join(" && ");
3516
+ case ">":
3517
+ return `${o}.toInteger() > ${n}`;
3518
+ case "<":
3519
+ return `${o}.toInteger() < ${n}`;
3520
+ case ">=":
3521
+ return `${o}.toInteger() >= ${n}`;
3522
+ case "<=":
3523
+ return `${o}.toInteger() <= ${n}`;
3524
+ case "is_empty":
3525
+ return `!${o} || ${o} == ''`;
3526
+ case "is_not_empty":
3527
+ return `${o} && ${o} != ''`;
3528
+ case "date_before":
3529
+ return `$date.parse('yyyy-MM-dd', ${o}).before($date.parse('yyyy-MM-dd', '${n}'))`;
3530
+ case "date_after":
3531
+ return `$date.parse('yyyy-MM-dd', ${o}).after($date.parse('yyyy-MM-dd', '${n}'))`;
3532
+ case "date_on":
3533
+ return `$date.parse('yyyy-MM-dd', ${o}).equals($date.parse('yyyy-MM-dd', '${n}'))`;
3534
+ default:
3535
+ return `${o} == '${n}'`;
3536
+ }
3537
+ case "campaign_monitor":
3538
+ case "pardot":
3539
+ switch (r) {
3540
+ case "==":
3541
+ return `${o}='${n}'`;
3542
+ case "!=":
3543
+ return `${o}!='${n}'`;
3544
+ case "date_before":
3545
+ case "date_after":
3546
+ case "date_on":
3547
+ return `${o}='${n}'`;
3548
+ default:
3549
+ return `${o}='${n}'`;
3550
+ }
3551
+ case "mso":
3552
+ return "mso | IE";
3553
+ default:
3554
+ return `${o} == '${n}'`;
3555
+ }
3556
+ }, fn = (e, t, r) => {
3557
+ if (e.length === 1) return e[0];
3558
+ switch (r) {
3559
+ case "handlebars":
3560
+ case "sendgrid":
3561
+ case "iterable":
3562
+ return t === "all" ? `(and ${e.join(" ")})` : `(or ${e.join(" ")})`;
3563
+ case "sfmc":
3564
+ case "activecampaign":
3565
+ case "mailchimp":
3566
+ case "campaign_monitor":
3567
+ case "pardot":
3568
+ return e.join(t === "all" ? " AND " : " OR ");
3569
+ case "marketo":
3570
+ return e.join(t === "all" ? " && " : " || ");
3571
+ case "liquid":
3572
+ case "klaviyo":
3573
+ case "braze":
3574
+ case "hubspot":
3575
+ return e.join(t === "all" ? " and " : " or ");
3576
+ default:
3577
+ return e.join(t === "all" ? " && " : " || ");
3578
+ }
3579
+ }, qn = (e, t) => {
3580
+ const r = Gn(t)?.wrapOpenTag;
3581
+ if (r) return r(e);
3582
+ switch (t) {
3583
+ case "handlebars":
3584
+ case "sendgrid":
3585
+ case "iterable":
3586
+ return `{{#if ${e}}}`;
3587
+ case "liquid":
3588
+ case "klaviyo":
3589
+ case "braze":
3590
+ case "hubspot":
3591
+ return `{% if ${e} %}`;
3592
+ case "mailchimp":
3593
+ return `*|IF:${e}|*`;
3594
+ case "sfmc":
3595
+ return `%%[ IF ${e} THEN ]%%`;
3596
+ case "activecampaign":
3597
+ return `%IF ${e}%`;
3598
+ case "marketo":
3599
+ return `#if(${e})`;
3600
+ case "campaign_monitor":
3601
+ return `<singleline:${e}>`;
3602
+ case "pardot":
3603
+ return `%%if ${e}%%`;
3604
+ case "mso":
3605
+ return `<!--[if ${e}]>`;
3606
+ default:
3607
+ return `{{#if ${e}}}`;
3608
+ }
3609
+ }, Wn = (e) => {
3610
+ const t = Gn(e)?.wrapCloseTag;
3611
+ if (t) return t();
3612
+ switch (e) {
3613
+ case "handlebars":
3614
+ case "sendgrid":
3615
+ case "iterable":
3616
+ return "{{/if}}";
3617
+ case "liquid":
3618
+ case "klaviyo":
3619
+ case "braze":
3620
+ case "hubspot":
3621
+ return "{% endif %}";
3622
+ case "mailchimp":
3623
+ return "*|END:IF|*";
3624
+ case "sfmc":
3625
+ return "%%[ ENDIF ]%%";
3626
+ case "activecampaign":
3627
+ return "%/IF%";
3628
+ case "marketo":
3629
+ return "#end";
3630
+ case "campaign_monitor":
3631
+ return "</singleline>";
3632
+ case "pardot":
3633
+ return "%%endif%%";
3634
+ case "mso":
3635
+ return "<![endif]-->";
3636
+ default:
3637
+ return "{{/if}}";
3638
+ }
3639
+ }, 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, "_")}`, xo = (e) => {
3640
+ const t = /* @__PURE__ */ new Set(), r = [];
3641
+ for (const n of e) {
3642
+ const o = n.operator;
3643
+ if (o !== "date_before" && o !== "date_after") continue;
3644
+ const i = Nt(n.tag), a = Bt(n.tag, n.value);
3645
+ t.has(i) || (t.add(i), r.push(`{%- assign ${i} = ${Ge(n.tag)} | date: '%s' -%}`)), t.has(a) || (t.add(a), r.push(`{%- assign ${a} = '${n.value}' | date: '%s' -%}`));
3646
+ }
3647
+ return r;
3648
+ }, Co = (e) => e === "liquid" || e === "klaviyo" || e === "braze" || e === "hubspot", _o = (e, t) => {
3649
+ const r = (a, l) => a.length === 0 ? l : [...a].reverse().reduce((c, p) => `*|IF:${p}|*
3650
+ ${c}
3651
+ *|END:IF|*`, l), n = (a, l) => a.length === 0 ? l : a.map((c) => `*|IF:${c}|*
3652
+ ${l}
3653
+ *|END:IF|*`).join(`
3654
+ `), o = (a, l, c) => {
3655
+ const p = a.map((v) => Te(v, "mailchimp")).filter((v) => v !== null);
3656
+ return p.length === 0 ? null : l === "all" ? r(p, c) : n(p, c);
3657
+ }, i = (t.rules ?? []).map((a) => Te(a, "mailchimp")).filter((a) => a !== null);
3658
+ if (t.match === "all") {
3659
+ let a = e;
3660
+ for (const l of [...t.groups ?? []].reverse()) {
3661
+ const c = l.rules.map((p) => Te(p, "mailchimp")).filter((p) => p !== null);
3662
+ c.length !== 0 && (a = l.match === "all" ? r(c, a) : n(c, a));
3663
+ }
3664
+ return i.length > 0 ? r(i, a) : a;
3665
+ } else {
3666
+ const a = [...i.map((l) => `*|IF:${l}|*
3667
+ ${e}
3668
+ *|END:IF|*`), ...(t.groups ?? []).map((l) => o(l.rules, l.match, e)).filter((l) => l !== null)];
3669
+ return a.length > 0 ? a.join(`
3670
+ `) : e;
3671
+ }
3672
+ }, Vn = (e, t) => {
3673
+ const r = So(t, ko), n = (e.rules ?? []).map((a) => Te(a, t)).filter((a) => a !== null);
3674
+ let o;
3675
+ r.supportsNesting ? o = (e.groups ?? []).map((a) => {
3676
+ const l = a.rules.map((p) => Te(p, t)).filter((p) => p !== null);
3677
+ if (l.length === 0) return null;
3678
+ const c = fn(l, a.match, t);
3679
+ return l.length > 1 ? `(${c})` : c;
3680
+ }).filter((a) => a !== null) : o = (e.groups ?? []).flatMap((a) => a.rules).map((a) => Te(a, t)).filter((a) => a !== null);
3681
+ const i = [...n, ...o];
3682
+ return i.length === 0 ? null : {
3683
+ expression: fn(i, e.match, t),
3684
+ preludes: Co(t) ? xo([...e.rules ?? [], ...(e.groups ?? []).flatMap((a) => a.rules)]) : []
3685
+ };
3686
+ }, be = (e, t, r = "handlebars") => {
3687
+ if (!t?.enabled) return e;
3688
+ const n = (t.rules?.length ?? 0) > 0, o = (t.groups?.length ?? 0) > 0;
3689
+ if (!n && !o) return e;
3690
+ if (r === "mailchimp") return _o(e, t);
3691
+ const i = Vn(t, r);
3692
+ if (!i) return e;
3693
+ const { expression: a, preludes: l } = i, c = qn(a, r), p = Wn(r);
3694
+ return `${l.length > 0 ? `${l.join(`
3695
+ `)}
3696
+ ` : ""}${c}
3697
+ ${e}
3698
+ ${p}`;
3699
+ }, $a = (e, t = "handlebars") => {
3700
+ if (!e?.enabled) return null;
3701
+ const r = (e.rules?.length ?? 0) > 0, n = (e.groups?.length ?? 0) > 0;
3702
+ if (!r && !n) return null;
3703
+ if (t === "mailchimp") {
3704
+ const c = [...e.rules ?? [], ...(e.groups ?? []).flatMap((v) => v.rules)], p = c.map((v) => Te(v, "mailchimp")).find((v) => v !== null);
3705
+ return p ? {
3706
+ openTag: `*|IF:${p}|*${c.length > 1 && e.match === "all" ? " …nested…" : ""}`,
3707
+ closeTag: "*|END:IF|*"
3708
+ } : null;
3709
+ }
3710
+ const o = Vn(e, t);
3711
+ if (!o) return null;
3712
+ const { expression: i, preludes: a } = o, l = qn(i, t);
3713
+ return {
3714
+ openTag: `${a.length > 0 ? `${a.join(`
3715
+ `)}
3716
+ ` : ""}${l}`,
3717
+ closeTag: Wn(t)
3718
+ };
3719
+ }, Kn = (e) => {
3720
+ const t = Ge(e.tag), r = String(e.value ?? "");
3721
+ switch (e.operator) {
3722
+ case "==":
3723
+ return `String(${t}).toLowerCase() === ${JSON.stringify(r.toLowerCase())}`;
3724
+ case "!=":
3725
+ return `String(${t}).toLowerCase() !== ${JSON.stringify(r.toLowerCase())}`;
3726
+ case "contains":
3727
+ return `String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3728
+ case "not_contains":
3729
+ return `!String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3730
+ case "starts_with":
3731
+ return `String(${t}).toLowerCase().startsWith(${JSON.stringify(r.toLowerCase())})`;
3732
+ case "ends_with":
3733
+ return `String(${t}).toLowerCase().endsWith(${JSON.stringify(r.toLowerCase())})`;
3734
+ case "in": {
3735
+ const n = r.split(/[,\n;]+/).map((o) => o.trim().toLowerCase()).filter(Boolean);
3736
+ return `${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3737
+ }
3738
+ case "not_in": {
3739
+ const n = r.split(/[,\n;]+/).map((o) => o.trim().toLowerCase()).filter(Boolean);
3740
+ return `!${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3741
+ }
3742
+ case ">":
3743
+ return `Number(${t}) > ${Number(r)}`;
3744
+ case "<":
3745
+ return `Number(${t}) < ${Number(r)}`;
3746
+ case ">=":
3747
+ return `Number(${t}) >= ${Number(r)}`;
3748
+ case "<=":
3749
+ return `Number(${t}) <= ${Number(r)}`;
3750
+ case "date_before":
3751
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) < new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3752
+ case "date_after":
3753
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) > new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3754
+ case "date_on":
3755
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) === new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3756
+ case "is_empty":
3757
+ return `(!${t} || String(${t}).trim() === "")`;
3758
+ case "is_not_empty":
3759
+ return `(!!${t} && String(${t}).trim() !== "")`;
3760
+ default:
3761
+ return "true";
3762
+ }
3763
+ }, To = (e) => {
3764
+ if (!e.rules.length) return null;
3765
+ const t = e.rules.map(Kn);
3766
+ return t.length === 1 ? t[0] : `(${t.join(e.match === "any" ? " || " : " && ")})`;
3767
+ }, Ao = (e) => {
3768
+ const t = (e.rules ?? []).map(Kn), r = (e.groups ?? []).map(To).filter((i) => i !== null), n = [...t, ...r];
3769
+ if (n.length === 0) return null;
3770
+ if (n.length === 1) return n[0];
3771
+ const o = e.match === "any" ? " || " : " && ";
3772
+ return `(${n.join(o)})`;
3773
+ }, rt = (e, t) => {
3774
+ if (!t?.enabled) return e;
3775
+ const r = (t.rules?.length ?? 0) > 0, n = (t.groups?.length ?? 0) > 0;
3776
+ if (!r && !n) return e;
3777
+ const o = Ao(t);
3778
+ return o ? `{${o} && (
3779
+ ${e.split(`
3780
+ `).map((i) => ` ${i}`).join(`
3781
+ `)}
3782
+ )}` : e;
3783
+ }, Ae = ({ content: e, filename: t, mimeType: r }) => {
3784
+ const n = new Blob([e], { type: r }), o = URL.createObjectURL(n), i = document.createElement("a");
3785
+ i.href = o, i.download = t, i.click(), URL.revokeObjectURL(o);
3786
+ }, ht = (e) => e.toLowerCase().replace(/\s+/g, "-"), Ne = (e, t) => `${e}${t === "wrap" ? "-master" : "-snapshot"}`, Ro = /(<style[\s>][\s\S]*?<\/style>|<script[\s>][\s\S]*?<\/script>|<!--[\s\S]*?-->)/gi;
3787
+ function Yn(e) {
3788
+ const t = e.split(Ro), r = [];
3789
+ return t.forEach((n, o) => {
3790
+ if (o % 2 === 1) {
3791
+ let i = n.replace(/^[ \t]+|[ \t]+$/gm, "");
3792
+ i = i.replace(/\n{2,}/g, `
3793
+ `), r.push(i);
3794
+ } else {
3795
+ let i = n.replace(/>\s+</g, "><");
3796
+ i = i.replace(/[ \t]{2,}/g, " "), i = i.replace(/\n+/g, ""), r.push(i);
3797
+ }
3798
+ }), r.join("");
3799
+ }
3800
+ function Eo(e) {
3801
+ return e && Yn(e);
3802
+ }
3803
+ function Mo(e) {
3804
+ return e && Yn(e);
3805
+ }
3806
+ function Io(e) {
3807
+ if (!e) return e;
3808
+ let t = e.replace(/^[ \t]+|[ \t]+$/gm, "");
3809
+ return t = t.replace(/\n{3,}/g, `
3810
+
3811
+ `), t.trim();
3812
+ }
3813
+ function Be(e, t) {
3814
+ switch (e) {
3815
+ case "html":
3816
+ return Eo(t);
3817
+ case "mjml":
3818
+ return Mo(t);
3819
+ case "react-email":
3820
+ return Io(t);
3821
+ default:
3822
+ return t;
3823
+ }
3824
+ }
3825
+ var Xn = "maildeno:export:minify", lt = L(No());
3826
+ function No() {
3827
+ if (typeof window > "u") return !1;
3828
+ try {
3829
+ return localStorage.getItem(Xn) === "true";
3830
+ } catch {
3831
+ return !1;
3832
+ }
3833
+ }
3834
+ hn(lt, (e) => {
3835
+ if (!(typeof window > "u"))
3836
+ try {
3837
+ localStorage.setItem(Xn, String(e));
3838
+ } catch {
3839
+ }
3840
+ });
3841
+ function Kt() {
3842
+ return {
3843
+ minifyOutput: lt,
3844
+ toggleMinify: () => {
3845
+ lt.value = !lt.value;
3846
+ }
3847
+ };
3848
+ }
3849
+ var Bo = 5, Oo = (e) => {
3850
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: o, visibilityContext: i, tagSubstitution: a, guardEmpty: l, collectFonts: c, collectMobileCSS: p, buildMobileStyleBlock: v } = e, { evaluateVisibility: b } = ft(), E = (s) => s.type === "component" ? s.props?.visibility : s.visibility, w = (s) => {
3851
+ if (!s?.enabled) return !1;
3852
+ const S = (s.rules?.length ?? 0) > 0, C = (s.groups?.length ?? 0) > 0;
3853
+ return S || C;
3854
+ }, R = (s, S, C, _) => {
3855
+ let g = "";
3856
+ for (const m of s) {
3857
+ if (C === "prune" && !b(E(m), S)) continue;
3858
+ const h = m.type;
3859
+ if (h === "row") {
3860
+ if (_ >= Bo) continue;
3861
+ const $ = M(m, S, C, _ + 1);
3862
+ $.trim() && (g += `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">${$}</table>`);
3863
+ continue;
3864
+ }
3865
+ if (h === "row-spacer") {
3866
+ if (!m.height || m.height <= 0) continue;
3867
+ const $ = ce(m);
3868
+ 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>`;
3869
+ C === "wrap" && w(m.visibility) && (k = be(k, m.visibility, o.value)), g += k;
3870
+ continue;
3871
+ }
3872
+ let x = Un(n.html(m), C, a?.value);
3873
+ const y = m.props?.visibility;
3874
+ C === "wrap" && w(y) && (x = be(x, y, o.value)), g += x;
3875
+ }
3876
+ return g;
3877
+ }, M = (s, S, C, _ = 0) => {
3878
+ if (s.type === "row-spacer") {
3879
+ if (!s.height || s.height <= 0) return "";
3880
+ const I = ce(s);
3881
+ let P = `
3882
+ <tr>
3883
+ <td>
3884
+ <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;
3885
+ </div>
3886
+ </td>
3887
+ </tr>
3888
+ `;
3889
+ return C === "wrap" && w(s.visibility) && (P = be(P, s.visibility, o.value)), P;
3890
+ }
3891
+ const g = ce(s), m = r.value.mobileBreakpoint || 600, h = (s.gap || 0) / m * 100, x = 100 - h * (s.columns.length - 1), y = [];
3892
+ let $ = 0;
3893
+ s.columns.forEach((I) => {
3894
+ const P = I.width / 100 * x;
3895
+ y.push(P), $ += P;
3896
+ });
3897
+ const k = x - $;
3898
+ Math.abs(k) > 0.01 && y.length > 0 && (y[y.length - 1] += k);
3899
+ let A = "";
3900
+ s.columns.forEach((I, P) => {
3901
+ if (C === "prune" && !b(I.props?.visibility, S)) return;
3902
+ const V = y[P], q = s.mobileStack ? "mobile-stack" : "", W = ce(I), Q = [
3903
+ `width:${V}%`,
3904
+ `max-width:${V}%`,
3905
+ `vertical-align:${I.verticalAlign ?? "middle"}`,
3906
+ "box-sizing:border-box",
3907
+ ...W,
3908
+ ue(I.border),
3909
+ `border-radius:${Y(I.border.radius)}`,
3910
+ "overflow:hidden",
3911
+ "line-height:0",
3912
+ "font-size:0",
3913
+ `padding:${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`
3914
+ ], se = I.children ?? I.components ?? [], pe = R(se, S, C, _);
3915
+ A += `
3916
+ <td valign="${I.verticalAlign ?? "middle"}"${q ? ` class="${q}"` : ""} style="${Q.join(";")}">
3917
+ ${pe}
3918
+ </td>
3919
+ `, P < s.columns.length - 1 && s.gap && (A += `
3920
+ <td
3921
+ class="${q ? `gap-${s.gap} ${q}` : `gap-${s.gap}`}"
3922
+ width="${h}%"
3923
+ style="width:${h}%;max-width:${h}%;font-size:0;line-height:0;padding:0;">
3924
+ &nbsp;
3925
+ </td>
3926
+ `);
3927
+ });
3928
+ const f = s.columns.some((I) => ee(I.border?.radius ?? 0));
3929
+ let B = `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(s.gap ?? 0) > 0 || f ? "separate" : "collapse"};">
3930
+ <tr>
3931
+ ${A}
3932
+ </tr>
3933
+ </table>`;
3934
+ const z = ee(s.border?.radius ?? 0), N = [
3935
+ ...g,
3936
+ z ? `border-radius:${Y(s.border.radius, 2)}` : "",
3937
+ "overflow:hidden"
3938
+ ].filter(Boolean);
3939
+ let F = Pn(B, s.border, [], s.padding);
3940
+ return C === "wrap" && w(s.visibility) && (F = be(F, s.visibility, o.value)), (s.minHeight ?? 0) > 0 && N.push(`min-height:${s.minHeight}px`), `
3941
+ <tr>
3942
+ <td${N.length ? ` style="${N.join(";")}"` : ""}>
3943
+ ${F}
3944
+ </td>
3945
+ </tr>
3946
+ `;
3947
+ }, O = (s, S) => {
3948
+ const { getGoogleFontImports: C } = gt(), { emailMobileStyles: _ } = Jt(), g = i?.value ?? {}, m = C([...c(s, g)]), h = p(s, g, _), x = v(r.value.mobileBreakpoint, h), y = [
3949
+ "margin:0",
3950
+ "padding:0",
3951
+ r.value.bodyBackgroundColor ? `background-color:${r.value.bodyBackgroundColor}` : "",
3952
+ r.value.bodyBackgroundImage ? [
3953
+ `background-image:url('${r.value.bodyBackgroundImage}')`,
3954
+ `background-size:${r.value.bodyBackgroundSize}`,
3955
+ `background-position:${r.value.bodyBackgroundPosition}`,
3956
+ `background-repeat:${r.value.bodyBackgroundRepeat}`,
3957
+ "min-height:auto"
3958
+ ].join(";") : ""
3959
+ ].filter(Boolean).join(";");
3960
+ let $ = `<!DOCTYPE html>
3961
+ <html lang="${r.value.language}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
3962
+ <head>
3963
+ <meta charset="UTF-8">
3964
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
3965
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3966
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
3967
+ <meta name="x-apple-disable-message-reformatting">
3968
+ <meta name="color-scheme" content="light dark">
3969
+ <meta name="supported-color-schemes" content="light dark">
3970
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
3971
+ <title>${S}</title>
3972
+ <!--[if mso]>
3973
+ <xml>
3974
+ <o:OfficeDocumentSettings>
3975
+ <o:PixelsPerInch>96</o:PixelsPerInch>
3976
+ <o:AllowPNG/>
3977
+ </o:OfficeDocumentSettings>
3978
+ </xml>
3979
+ <![endif]-->
3980
+ ${m ? `<link href="${m}" rel="stylesheet">` : ""}
3981
+ <style>
3982
+ ${x}
3983
+ </style>
3984
+ </head>
3985
+
3986
+ <body style="${y};">
3987
+ <div style="display:none;font-size:1px;color:#fefefe;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">
3988
+ ${r.value.preheaderText} &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp;
3989
+ </div>
3990
+ <table width="100%" cellpadding="0" cellspacing="0">
3991
+ <tr>
3992
+ <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;">
3993
+
3994
+ <table
3995
+ width="100%"
3996
+ align="center"
3997
+ cellpadding="0"
3998
+ cellspacing="0"
3999
+ class="email-container"
4000
+ style="width:100%;max-width:${r.value.width}px;background:${r.value.backgroundColor};border-collapse:collapse;"
4001
+ >
4002
+ `;
4003
+ return t.value.forEach((k) => {
4004
+ if (s === "prune" && !b(k.visibility, g)) return;
4005
+ const A = M(k, g, s, 0);
4006
+ A.trim() && ($ += A);
4007
+ }), $ += `
4008
+ </table>
4009
+ </td>
4010
+ </tr>
4011
+ </table>
4012
+ </body>
4013
+ </html>
4014
+ `, $ = Hn($, s, o.value, a?.value), $;
4015
+ };
4016
+ return {
4017
+ export: async (s = "prune", S) => {
4018
+ if (!l("Export")) return;
4019
+ const C = S || "Untitled Template", _ = O(s, C), g = ht(C), { minifyOutput: m } = Kt();
4020
+ if (m.value) Ae({
4021
+ content: Be("html", _),
4022
+ filename: `${Ne(g, s)}.html`,
4023
+ mimeType: "text/html"
4024
+ });
4025
+ else {
4026
+ const h = await io(_);
4027
+ Ae({
4028
+ content: h,
4029
+ filename: `${Ne(g, s)}.html`,
4030
+ mimeType: "text/html"
4031
+ });
4032
+ }
4033
+ },
4034
+ getHTML: (s = "prune", S) => {
4035
+ if (!t.value || t.value.length === 0) return null;
4036
+ const C = O(s, S || "Untitled Template");
4037
+ return Be("html", C);
4038
+ }
4039
+ };
4040
+ }, jo = 5, zo = (e) => {
4041
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: o, visibilityContext: i, tagSubstitution: a, guardEmpty: l, collectFonts: c, collectMobileCSS: p, buildMobileStyleBlock: v } = e, { evaluateVisibility: b } = ft(), E = (d) => {
4042
+ if (!d?.enabled) return !1;
4043
+ const s = (d.rules?.length ?? 0) > 0, S = (d.groups?.length ?? 0) > 0;
4044
+ return s || S;
4045
+ }, w = (d, s, S, C, _) => {
4046
+ let g = "";
4047
+ for (const m of d) {
4048
+ const h = m.type === "component" ? m.props?.visibility : m.visibility;
4049
+ if (S === "prune" && !b(h, s)) continue;
4050
+ const x = m.type;
4051
+ if (x === "row") {
4052
+ if (_ >= jo) continue;
4053
+ const $ = R(m, s, S, _ + 1);
4054
+ $.trim() && (g += ` ${$.trim()}
4055
+ `);
4056
+ continue;
4057
+ }
4058
+ if (x === "row-spacer") {
4059
+ if (!m.height || m.height <= 0) continue;
4060
+ const $ = tt(m), k = Object.keys($).length > 0 ? `, ${Object.entries($).map(([f, B]) => `${f}:"${B}"`).join(", ")}` : "";
4061
+ let A = `<div style={{ display: "block", height: "${m.height}px", lineHeight: "${m.height}px", fontSize: "1px"${k} }}>&nbsp;</div>`;
4062
+ S === "wrap" && E(m.visibility) && (A = rt(A, m.visibility)), g += ` ${A}
4063
+ `;
4064
+ continue;
4065
+ }
4066
+ let y = Un(n.react(m), S, a?.value);
4067
+ S === "wrap" && E(m.props?.visibility) && (y = rt(y, m.props.visibility)), g += ` ${y.trim()}
4068
+ `;
4069
+ }
4070
+ return g;
4071
+ }, R = (d, s, S, C = 0) => {
4072
+ if (S === "prune" && !b(d.visibility, s)) return "";
4073
+ if (d.type === "row-spacer") {
4074
+ if (!d.height || d.height <= 0) return "";
4075
+ const I = tt(d), P = Object.keys(I).length > 0 ? `, ${Object.entries(I).map(([q, W]) => `${q}:"${W}"`).join(", ")}` : "";
4076
+ let V = `
4077
+ {/* Row Spacer */}
4078
+ <Section>
4079
+ <div style={{ display: "block", height: "${d.height}px", lineHeight: "${d.height}px", fontSize: "1px"${P} }}>&nbsp;</div>
4080
+ </Section>`;
4081
+ return S === "wrap" && E(d.visibility) && (V = rt(V, d.visibility)), V;
4082
+ }
4083
+ const _ = r.value.mobileBreakpoint || 600, g = (d.gap || 0) / _ * 100, m = 100 - g * (d.columns.length - 1), h = [];
4084
+ let x = 0;
4085
+ d.columns.forEach((I) => {
4086
+ const P = I.width / 100 * m;
4087
+ h.push(P), x += P;
4088
+ });
4089
+ const y = m - x;
4090
+ Math.abs(y) > 0.01 && h.length > 0 && (h[h.length - 1] += y);
4091
+ let $ = "";
4092
+ d.columns.forEach((I, P) => {
4093
+ if (S === "prune" && !b(I.props?.visibility, s)) return;
4094
+ const V = h[P], q = d.mobileStack ? "mobile-stack" : "", W = tt(I), Q = {
4095
+ width: `${V}%`,
4096
+ boxSizing: "border-box",
4097
+ verticalAlign: I.verticalAlign ?? "middle",
4098
+ ...At(I.border),
4099
+ borderRadius: Y(I.border?.radius ?? 0),
4100
+ overflow: "hidden",
4101
+ lineHeight: "0",
4102
+ fontSize: "0",
4103
+ padding: `${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`,
4104
+ ...W
4105
+ }, se = Object.entries(Q).map(([le, ze]) => `${le}:"${ze}"`).join(", "), pe = I.children ?? I.components ?? [], me = w(pe, s, S, d, C);
4106
+ $ += `<Column
4107
+ className="${q}"
4108
+ style={{ ${se} }}
4109
+ >
4110
+ ${me}
4111
+ </Column>
4112
+ `, P < d.columns.length - 1 && d.gap && ($ += `<Column
4113
+ className="${q ? `gap-${d.gap} ${q}` : `gap-${d.gap}`}"
4114
+ style={{ width:"${g}%", maxWidth:"${g}%", fontSize:"0", lineHeight:"0" }}
4115
+ >&nbsp;</Column>
4116
+ `);
4117
+ });
4118
+ const k = tt(d), A = ee(d.border?.radius ?? 0), f = {
4119
+ ...k,
4120
+ ...A ? { borderRadius: Y(d.border.radius, 2) } : {},
4121
+ overflow: "hidden"
4122
+ }, B = Object.entries(f).filter(([I, P]) => P !== void 0 && P !== "").map(([I, P]) => `${I}:"${P}"`).join(", "), z = B ? ` style={{ ${B} }}` : "", N = `<Row>${$}</Row>`;
4123
+ let F = ` <Section${z}>
4124
+ ${oo(N, d.border, {}, d.padding, !0)}
4125
+ </Section>`;
4126
+ return S === "wrap" && E(d.visibility) && (F = rt(F, d.visibility)), F;
4127
+ }, M = (d = "prune", s) => {
4128
+ 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(d, m), x = _([...h]), y = p(d, m, g), $ = v(r.value.mobileBreakpoint, y), k = t.value.map((N) => R(N, m, d, 0)).filter(Boolean).join(`
4129
+ `), A = x?.includes("fonts.googleapis.com"), f = x ? A ? ` {/* Google Fonts via <link> — all families in one request */}
4130
+ <link href="${x}" rel="stylesheet" />` : [...h].map((N) => ` <Font
4131
+ fontFamily="${mt(N)}"
4132
+ fallbackFontFamily="Arial"
4133
+ webFont={{ url: "${x}", format: "woff2" }}
4134
+ fontWeight={400}
4135
+ fontStyle="normal"
4136
+ />`).join(`
4137
+ `) : "";
4138
+ let B = `import React from "react";
4139
+ import {
4140
+ Preview,
4141
+ Body,
4142
+ Container,
4143
+ Button,
4144
+ Column,
4145
+ Font,
4146
+ Head,
4147
+ Heading,
4148
+ Hr,
4149
+ Html,
4150
+ Img,
4151
+ Link,
4152
+ Row,
4153
+ Section,
4154
+ Text,
4155
+ } from "@react-email/components";
4156
+
4157
+ ${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"}
4158
+
4159
+ const styles = \`
4160
+ ${$}
4161
+ \`;
4162
+
4163
+ export default function ${C}() {
4164
+ return (
4165
+ <Html lang="${r.value.language}">
4166
+ <Head>
4167
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
4168
+ <meta name="x-apple-disable-message-reformatting" />
4169
+ <meta httpEquiv="Content-Type" content="text/html; charset=UTF-8" />
4170
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
4171
+ <meta name="color-scheme" content="light dark" />
4172
+ <meta name="supported-color-schemes" content="light dark" />
4173
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no" />
4174
+ <title>${S}</title>
4175
+ <style>{styles}</style>
4176
+ ${f}
4177
+ </Head>
4178
+ <Preview>${r.value.preheaderText}</Preview>
4179
+ <Body style={{ margin:0, padding:0, backgroundColor:"${r.value.bodyBackgroundColor}" }}>
4180
+ <Container style={{
4181
+ margin: 0,
4182
+ padding: 0,
4183
+ maxWidth: "100%",
4184
+ ${r.value.bodyBackgroundImage ? `
4185
+ backgroundImage: "url('${r.value.bodyBackgroundImage}')",
4186
+ backgroundSize: "${r.value.bodyBackgroundSize}",
4187
+ backgroundPosition: "${r.value.bodyBackgroundPosition}",
4188
+ backgroundRepeat: "${r.value.bodyBackgroundRepeat}",
4189
+ ` : ""}
4190
+ }}>
4191
+ <Container
4192
+ className="email-container"
4193
+ style={{
4194
+ width:"100%",
4195
+ maxWidth:"${r.value.width}px",
4196
+ backgroundColor:"${r.value.backgroundColor}",
4197
+ 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"
4198
+ }}
4199
+ >
4200
+ ${k}
4201
+ </Container>
4202
+ </Container>
4203
+ </Body>
4204
+ </Html>
4205
+ );
4206
+ }
4207
+ `;
4208
+ const z = a?.value?.mergeTagActive || a?.value?.linkTagActive;
4209
+ if (d === "wrap" || !z) {
4210
+ const N = vo(B), F = new Set(N.map((W) => W.tagId)), I = bo(t.value).filter((W) => !F.has(W)), { propsInterface: P, propsDestructure: V } = ho(N), q = $o(I);
4211
+ (P || q) && (B = B.replace(/^(export default function (\w+))\(\)\s*\{/m, [
4212
+ P ? `${P}
4213
+
4214
+ ` : "",
4215
+ `$1(${V || ""}) {`,
4216
+ q ? `
4217
+ ${q}
4218
+ ` : ""
4219
+ ].join(""))), B = go(B);
4220
+ }
4221
+ return B = En(B), B;
4222
+ };
4223
+ return {
4224
+ export: async (d = "prune", s) => {
4225
+ if (!l("Export")) return;
4226
+ const S = s || "Untitled Template", C = M(d, S), _ = ht(S), { minifyOutput: g } = Kt();
4227
+ if (g.value) Ae({
4228
+ content: Be("react-email", C),
4229
+ filename: `${Ne(_, d)}.tsx`,
4230
+ mimeType: "text/plain"
4231
+ });
4232
+ else {
4233
+ const m = await so(C);
4234
+ Ae({
4235
+ content: m,
4236
+ filename: `${Ne(_, d)}.tsx`,
4237
+ mimeType: "text/plain"
4238
+ });
4239
+ }
4240
+ },
4241
+ getReactEmail: (d = "prune", s) => {
4242
+ if (!t.value || t.value.length === 0) return null;
4243
+ const S = M(d, s || "Untitled Template");
4244
+ return Be("react-email", S);
4245
+ }
4246
+ };
4247
+ }, Lo = 5, Po = (e) => {
4248
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: o, visibilityContext: i, tagSubstitution: a, guardEmpty: l, collectFonts: c, collectMobileCSS: p } = e, { evaluateVisibility: v } = ft(), b = (u) => {
4249
+ if (!u?.enabled) return !1;
4250
+ const d = (u.rules?.length ?? 0) > 0, s = (u.groups?.length ?? 0) > 0;
4251
+ return d || s;
4252
+ }, E = (u, d, s, S) => {
4253
+ let C = "";
4254
+ for (const _ of u) {
4255
+ const g = _.type === "component" ? _.props?.visibility : _.visibility;
4256
+ if (s === "prune" && !v(g, d)) continue;
4257
+ const m = _.type;
4258
+ if (m === "row") {
4259
+ if (S >= Lo) continue;
4260
+ const x = w(_, d, s, S + 1);
4261
+ if (x.trim()) {
4262
+ let y = x;
4263
+ s === "wrap" && b(_.visibility) && (y = be(y, _.visibility, o.value)), C += y;
4264
+ }
4265
+ continue;
4266
+ }
4267
+ if (m === "row-spacer") {
4268
+ if (!_.height || _.height <= 0) continue;
4269
+ const x = ce(_);
4270
+ 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>`;
4271
+ s === "wrap" && b(_.visibility) && (y = be(y, _.visibility, o.value)), C += y;
4272
+ continue;
4273
+ }
4274
+ 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>`;
4275
+ s === "wrap" && b(_.props?.visibility) && (h = be(h, _.props.visibility, o.value)), C += h;
4276
+ }
4277
+ return C;
4278
+ }, w = (u, d, s, S) => {
4279
+ if (!u.columns?.length) return "";
4280
+ const C = ce(u), _ = r.value.mobileBreakpoint || 600, g = u.gap || 0, m = g / _ * 100, h = 100 - m * (u.columns.length - 1), x = [];
4281
+ let y = 0;
4282
+ u.columns.forEach((N) => {
4283
+ const F = N.width / 100 * h;
4284
+ x.push(F), y += F;
4285
+ });
4286
+ const $ = h - y;
4287
+ Math.abs($) > 0.01 && x.length > 0 && (x[x.length - 1] += $);
4288
+ let k = "";
4289
+ u.columns.forEach((N, F) => {
4290
+ if (s === "prune" && !v(N.props?.visibility, d)) return;
4291
+ const I = x[F], P = u.mobileStack ? "mobile-stack" : "", V = ce(N), q = [
4292
+ `width:${I}%`,
4293
+ "box-sizing:border-box",
4294
+ `vertical-align:${N.verticalAlign ?? "middle"}`,
4295
+ ue(N.border),
4296
+ `border-radius:${Y(N.border.radius)}`,
4297
+ "overflow:hidden",
4298
+ ...V
4299
+ ], W = N.children ?? N.components ?? [], Q = E(W, d, s, S), se = Pn(Q, N.border, [], N.padding), pe = P ? ` class="${P}"` : "";
4300
+ if (k += `<td valign="${N.verticalAlign ?? "middle"}"${pe} style="${q.join(";")}">
4301
+ ${se}
4302
+ </td>
4303
+ `, F < u.columns.length - 1 && g > 0) {
4304
+ const me = P ? `gap-${g} ${P}` : `gap-${g}`;
4305
+ k += `<td class="${me}" width="${m}%" style="width:${m}%;max-width:${m}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4306
+ `;
4307
+ }
4308
+ });
4309
+ const A = de(u.border) ? `${ue(u.border)};border-radius:${Y(u.border.radius)};overflow:hidden;` : `border-radius:${Y(u.border.radius)};overflow:hidden;`, f = u.padding ? `${u.padding.top ?? 0}px ${u.padding.right ?? 0}px ${u.padding.bottom ?? 0}px ${u.padding.left ?? 0}px` : "0px", B = C.length ? `${C.join(";")};` : "", z = u.columns.some((N) => ee(N.border?.radius ?? 0));
4310
+ return `<div style="padding:${f};${A}${B}">
4311
+ <table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(u.gap ?? 0) > 0 || z ? "separate" : "collapse"};">
4312
+ <tr>
4313
+ ${k}</tr>
4314
+ </table>
4315
+ </div>`;
4316
+ }, R = (u = "prune", d) => {
4317
+ const s = d || "Untitled Template", { getGoogleFontImports: S } = gt(), { emailMobileStyles: C } = Jt(), { assembleMJML: _ } = Nn(), g = i?.value ?? {}, m = S([...c(u, g)]), h = p(u, g, C), x = Ln(t.value), y = [
4318
+ ".email-container { max-width:100% !important; width:100% !important; }",
4319
+ ".desktop-hide { display:block !important; }",
4320
+ ".mobile-hide { display:none !important; }",
4321
+ ".mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }",
4322
+ ...x ? [x] : []
4323
+ ].join(`
4324
+
4325
+ `), $ = h.length > 0 ? [
4326
+ y,
4327
+ "/* Mobile property overrides */",
4328
+ ...h
4329
+ ].join(`
4330
+ `) : y, k = [];
4331
+ t.value.forEach((f) => {
4332
+ if (u === "prune" && !v(f.visibility, g)) return;
4333
+ if (f.type === "row-spacer") {
4334
+ if (!f.height || f.height <= 0) return;
4335
+ const H = ce(f);
4336
+ let D = ` <mj-raw>
4337
+ <table width="100%" cellpadding="0" cellspacing="0">
4338
+ <tr>
4339
+ <td>
4340
+ <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>
4341
+ </td>
4342
+ </tr>
4343
+ </table>
4344
+ </mj-raw>`;
4345
+ u === "wrap" && b(f.visibility) && (D = be(D, f.visibility, o.value)), k.push(D);
4346
+ return;
4347
+ }
4348
+ const B = r.value.mobileBreakpoint || 600, z = f.gap || 0, N = z / B * 100, F = 100 - N * (f.columns.length - 1), I = [];
4349
+ let P = 0;
4350
+ f.columns.forEach((H) => {
4351
+ const D = H.width / 100 * F;
4352
+ I.push(D), P += D;
4353
+ });
4354
+ const V = F - P;
4355
+ Math.abs(V) > 0.01 && I.length > 0 && (I[I.length - 1] += V);
4356
+ const q = ce(f), W = (() => {
4357
+ const H = f.backgroundGradient;
4358
+ return H?.useGradient === !0 && Array.isArray(H?.gradient?.colors) && H.gradient.colors.length >= 2 ? H.solid || f.backgroundColor || "" : f.backgroundColor || "";
4359
+ })(), 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"];
4360
+ 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`);
4361
+ const ze = le.length ? ` style="${le.join(";")}"` : "";
4362
+ let Le = "";
4363
+ de(f.border) && (Le = `${ue(f.border)};`, ee(f.border?.radius ?? 0) && (Le += `border-radius:${Y(f.border.radius)};overflow:hidden;`));
4364
+ const We = [
4365
+ `padding:${se}`,
4366
+ "font-size:0",
4367
+ "line-height:0",
4368
+ Le
4369
+ ].filter(Boolean).join(";");
4370
+ let U = "";
4371
+ f.columns.forEach((H, D) => {
4372
+ if (u === "prune" && !v(H.props?.visibility, g)) return;
4373
+ const te = I[D], Re = f.mobileStack ? "mobile-stack" : "", vt = ce(H), bt = [
4374
+ `width:${te}%`,
4375
+ "box-sizing:border-box",
4376
+ `vertical-align:${H.verticalAlign ?? "middle"}`,
4377
+ ...vt,
4378
+ ue(H.border),
4379
+ `border-radius:${Y(H.border?.radius ?? 0)}`,
4380
+ "overflow:hidden",
4381
+ "line-height:0",
4382
+ "font-size:0",
4383
+ `padding:${H.padding?.top ?? 0}px ${H.padding?.right ?? 0}px ${H.padding?.bottom ?? 0}px ${H.padding?.left ?? 0}px`
4384
+ ], Ve = H.children ?? H.components ?? [], $t = E(Ve, g, u, 0), yt = Re ? ` class="${Re}"` : "";
4385
+ if (U += `<td valign="${H.verticalAlign ?? "middle"}"${yt} style="${bt.join(";")}">
4386
+ ${$t}
4387
+ </td>
4388
+ `, D < f.columns.length - 1 && z > 0) {
4389
+ const ne = Re ? `gap-${z} ${Re}` : `gap-${z}`;
4390
+ U += `<td class="${ne}" width="${N}%" style="width:${N}%;max-width:${N}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4391
+ `;
4392
+ }
4393
+ });
4394
+ const X = f.columns.some((H) => ee(H.border?.radius ?? 0));
4395
+ let ke = `<div style="${We}">${`<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(f.gap ?? 0) > 0 || X ? "separate" : "collapse"};">
4396
+ <tr>
4397
+ ${U}</tr>
4398
+ </table>`}</div>`;
4399
+ u === "wrap" && b(f.visibility) && (ke = be(ke, f.visibility, o.value));
4400
+ const $e = r.value.width ?? 600;
4401
+ k.push(` <mj-raw>
4402
+ <!--[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]-->
4403
+ <div style="margin:0px auto;max-width:${$e}px;">
4404
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
4405
+ <tbody>
4406
+ <tr>
4407
+ <td${ze}>
4408
+ ${ke}
4409
+ </td>
4410
+ </tr>
4411
+ </tbody>
4412
+ </table>
4413
+ </div>
4414
+ <!--[if mso | IE]></td></tr></table><![endif]-->
4415
+ </mj-raw>`);
4416
+ });
4417
+ let A = _(s, k.join(`
4418
+ `), r.value, m, $, r.value.mobileBreakpoint ?? 600, "");
4419
+ return A = Hn(A, u, o.value, a?.value, !0), A;
4420
+ };
4421
+ return {
4422
+ export: async (u = "prune", d) => {
4423
+ if (!l("Export")) return;
4424
+ const s = d || "Untitled Template", S = R(u, s), C = ht(s), { minifyOutput: _ } = Kt();
4425
+ if (_.value) Ae({
4426
+ content: Be("mjml", S),
4427
+ filename: `${Ne(C, u)}.mjml`,
4428
+ mimeType: "text/plain"
4429
+ });
4430
+ else {
4431
+ const g = await lo(S);
4432
+ Ae({
4433
+ content: g,
4434
+ filename: `${Ne(C, u)}.mjml`,
4435
+ mimeType: "text/plain"
4436
+ });
4437
+ }
4438
+ },
4439
+ getMJML: (u = "prune", d) => {
4440
+ if (!t.value || t.value.length === 0) return null;
4441
+ const s = R(u, d || "Untitled Template");
4442
+ return Be("mjml", s);
4443
+ }
4444
+ };
4445
+ }, Do = (e) => {
4446
+ const { rows: t, canvasStyles: r, saveToHistoryFn: n, guardEmpty: o } = e, i = e.notify ?? ((v, b = "Import failed") => console.error(`[maildeno-editor] ${b}: ${v}`)), a = (v) => {
4447
+ const b = v || "Untitled Template";
4448
+ return {
4449
+ template_id: it(b),
4450
+ template_name: b,
4451
+ canvas: Tn(JSON.parse(JSON.stringify(r.value))),
4452
+ rows: An(JSON.parse(JSON.stringify(t.value))),
4453
+ schema_version: "1.0"
4454
+ };
4455
+ };
4456
+ return {
4457
+ export: (v) => {
4458
+ if (!o("Export")) return;
4459
+ const b = a(v);
4460
+ Ae({
4461
+ content: JSON.stringify(b, null, 2),
4462
+ filename: `${ht(b.template_name)}.json`,
4463
+ mimeType: "application/json"
4464
+ });
4465
+ },
4466
+ import: (v, b) => {
4467
+ const E = new FileReader();
4468
+ E.onload = (w) => {
4469
+ try {
4470
+ let R = JSON.parse(w.target?.result);
4471
+ 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");
4472
+ } catch (R) {
4473
+ i(R.message, "Couldn't load template");
4474
+ }
4475
+ }, E.readAsText(v);
4476
+ },
4477
+ getJSON: (v) => !t.value || t.value.length === 0 ? null : a(v)
4478
+ };
4479
+ }, Fo = 5, gn = /font-family\s*:\s*([^;<]+)/gi, Ho = (e) => e.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&apos;/g, "'"), Uo = (e) => {
4480
+ if (!e || typeof e != "string") return [];
4481
+ if (e.indexOf("font-family") === -1) return [];
4482
+ const t = Ho(e), r = [];
4483
+ let n;
4484
+ for (gn.lastIndex = 0; (n = gn.exec(t)) !== null; ) {
4485
+ const o = n[1];
4486
+ if (!o) continue;
4487
+ let i = o;
4488
+ const a = i.trimStart()[0];
4489
+ if (a === '"' || a === "'") {
4490
+ const c = i.indexOf(a), p = i.indexOf(a, c + 1);
4491
+ if (p !== -1) {
4492
+ const v = i.slice(p + 1).search(/["<]/);
4493
+ i = v === -1 ? i : i.slice(0, p + 1 + v);
4494
+ }
4495
+ } else {
4496
+ const c = i.search(/["<]/);
4497
+ c !== -1 && (i = i.slice(0, c));
4498
+ }
4499
+ const l = (i.split(",")[0] ?? "").trim().replace(/^['"]|['"]$/g, "").trim();
4500
+ l && r.push(l);
4501
+ }
4502
+ return r;
4503
+ }, Jo = (e, t, r, n, o, i, a, l, c, p) => {
4504
+ let v, b, E, w;
4505
+ typeof r == "object" && !("value" in r) ? (v = r, b = n, E = o, w = i) : (v = {
4506
+ html: r,
4507
+ react: n,
4508
+ mjml: o
4509
+ }, b = i, E = a, w = l);
4510
+ const { evaluateVisibility: R } = ft(), { open: M } = p ?? eo(), O = c ?? L({ syntax: "handlebars" }), u = ($, k, A, f, B = 0) => {
4511
+ if (!(B >= Fo))
4512
+ for (const z of $) {
4513
+ const N = z.type;
4514
+ if (N === "row") {
4515
+ if (k === "prune" && !R(z.visibility, A)) continue;
4516
+ for (const F of z.columns ?? []) {
4517
+ const I = F.children ?? F.components ?? [];
4518
+ u(I, k, A, f, B + 1);
4519
+ }
4520
+ continue;
4521
+ }
4522
+ N !== "row-spacer" && (k === "prune" && !R(z.props?.visibility, A) || f(z));
4523
+ }
4524
+ }, d = ($) => !e.value || e.value.length === 0 ? (M("Your template is empty. Please add at least one row before exporting.", $), !1) : !0, s = ($, k) => {
4525
+ const A = /* @__PURE__ */ new Set();
4526
+ return e.value.forEach((f) => {
4527
+ $ === "prune" && !R(f.visibility, k) || f.columns && f.columns.forEach((B) => {
4528
+ const z = B.children ?? B.components ?? [];
4529
+ u(z, $, k, (N) => {
4530
+ if (N.props?.fontFamily && A.add(N.props.fontFamily), N.props?.mobile?.fontFamily && A.add(N.props.mobile.fontFamily), typeof N.props?.content == "string") {
4531
+ const F = Uo(N.props.content);
4532
+ for (const I of F) A.add(I);
4533
+ }
4534
+ });
4535
+ });
4536
+ }), A;
4537
+ }, S = ($, k, A) => {
4538
+ const f = [];
4539
+ return e.value.forEach((B) => {
4540
+ $ === "prune" && !R(B.visibility, k) || B.columns && B.columns.forEach((z) => {
4541
+ const N = z.children ?? z.components ?? [];
4542
+ u(N, $, k, (F) => {
4543
+ const I = A(F, `eb-${F.id}`);
4544
+ I && f.push(I);
4545
+ });
4546
+ });
4547
+ }), f;
4548
+ }, C = ($, k) => {
4549
+ const A = Ln(e.value), f = k.length > 0 ? `
4550
+
4551
+ /* Mobile property overrides */
4552
+ ${k.join(`
4553
+
4554
+ `)}` : "";
4555
+ return `
4556
+ .desktop-hide { display: none !important; }
4557
+ ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
4558
+ @media only screen and (max-width:${$}px) {
4559
+ ${`
4560
+ .email-container { max-width:100% !important; width:100% !important; }
4561
+
4562
+ .desktop-hide { display:block !important; }
4563
+
4564
+ .mobile-hide { display:none !important; }
4565
+
4566
+ .mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }
4567
+ ${A ? `
4568
+ ${A}` : ""}${f}
4569
+ `}
4570
+ }`;
4571
+ }, _ = Ce(() => O.value.syntax), g = {
4572
+ rows: e,
4573
+ canvasStyles: t,
4574
+ generators: v,
4575
+ espSyntax: _,
4576
+ visibilityContext: E,
4577
+ tagSubstitution: w,
4578
+ guardEmpty: d,
4579
+ collectFonts: s,
4580
+ collectMobileCSS: S,
4581
+ buildMobileStyleBlock: C
4582
+ }, m = Oo(g), h = zo(g), x = Po(g), y = Do({
4583
+ rows: e,
4584
+ canvasStyles: t,
4585
+ saveToHistoryFn: b,
4586
+ guardEmpty: d,
4587
+ notify: ($, k) => M($, k ?? "Import failed")
4588
+ });
4589
+ return {
4590
+ exportHTML: m.export,
4591
+ getExportedHTML: m.getHTML,
4592
+ exportReactEmail: h.export,
4593
+ getExportedReactEmail: h.getReactEmail,
4594
+ exportMJML: x.export,
4595
+ getExportedMJML: x.getMJML,
4596
+ exportJSON: y.export,
4597
+ getExportedJSON: y.getJSON,
4598
+ importJSON: y.import,
4599
+ espConfig: O
4600
+ };
4601
+ }, Go = 3e3, Me = null, Ue, ot, ae = -1, at = () => ({
4602
+ language: "en-US",
4603
+ preheaderText: "View this email in your browser",
4604
+ bodyBackgroundColor: "#f9fafb",
4605
+ bodyBackgroundImage: "",
4606
+ bodyBackgroundSize: "cover",
4607
+ bodyBackgroundPosition: "center center",
4608
+ bodyBackgroundRepeat: "no-repeat",
4609
+ backgroundColor: "#ffffff",
4610
+ width: 600,
4611
+ padding: {
4612
+ top: 0,
4613
+ right: 0,
4614
+ bottom: 0,
4615
+ left: 0
4616
+ },
4617
+ mobileBreakpoint: 600
4618
+ }), Qn = /* @__PURE__ */ Symbol("maildeno-editor:email-builder");
4619
+ function ya(e, t) {
4620
+ const r = qo(e, t);
4621
+ return Ie(Qn, r), r;
4622
+ }
4623
+ var Sa = () => {
4624
+ const e = Oe(Qn);
4625
+ 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.");
4626
+ return e;
4627
+ };
4628
+ function qo(e, t) {
4629
+ const r = e ?? hr(), n = vr(), o = L([]), i = L(null), a = L(at()), l = L(null), c = L([]), p = L(null), v = L(null), b = L("properties"), E = L("desktop"), w = L(!1), R = L(!1), M = L(null), O = L("create"), u = L({}), d = L(null), s = (T, j, J = "") => {
4630
+ d.value = {
4631
+ componentId: T,
4632
+ tagName: j,
4633
+ default: J
4634
+ };
4635
+ }, S = L({}), C = L(!1), _ = L({}), g = L(!1), m = L(null), h = L(null), x = L(!1), y = L(!1), $ = L(null), k = L({ syntax: "handlebars" }), { defaultProps: A } = jt(), f = xr(), B = () => f.getCurrentState(o, a), z = (T) => f.restoreState(T, o, a, i, p, v), { generateHTMLComponent: N } = Gr(), { generateReactEmailComponent: F } = Yr(), { generateMJMLComponent: I } = Nn(), P = {
4636
+ html: N,
4637
+ react: F,
4638
+ mjml: I
4639
+ }, { saveToLocal: V, flushSave: q, loadFromLocal: W, clearLocal: Q, hasDraft: se, saveStatus: pe, lastSaved: me } = Ur(), { syncFontsForTemplate: le } = gt(), ze = 5, Le = (T) => {
4640
+ const j = /* @__PURE__ */ new Set(), J = (G, we) => {
4641
+ if (!(we >= ze))
4642
+ for (const Ke of G) {
4643
+ if (!Ke) continue;
4644
+ const Qt = Ke.type;
4645
+ if (Qt === "row") {
4646
+ for (const Zt of Ke.columns ?? []) J(Zt.children ?? Zt.components ?? [], we + 1);
4647
+ continue;
4648
+ }
4649
+ if (Qt === "row-spacer") continue;
4650
+ const Ye = Ke.props;
4651
+ Ye?.fontFamily && j.add(Ye.fontFamily), Ye?.mobile?.fontFamily && j.add(Ye.mobile.fontFamily);
4652
+ }
4653
+ };
4654
+ for (const G of T)
4655
+ if (G && G.type !== "row-spacer")
4656
+ for (const we of G.columns ?? []) J(we.children ?? we.components ?? [], 0);
4657
+ return Array.from(j);
4658
+ };
4659
+ {
4660
+ let T = null;
4661
+ mr(() => {
4662
+ const j = Le(o.value);
4663
+ T && clearTimeout(T), T = setTimeout(() => {
4664
+ T = null, le(j);
4665
+ }, 200);
4666
+ });
4667
+ }
4668
+ const We = gr();
4669
+ let U = null, X = !1;
4670
+ const ke = () => {
4671
+ X || We.value && (U && clearTimeout(U), U = setTimeout(() => {
4672
+ U = null;
4673
+ const T = f.version.value;
4674
+ T !== ae && (ae = T, Ue = l.value ?? void 0, V(o.value, a.value, Me, Ue, ot));
4675
+ }, Go));
4676
+ };
4677
+ function $e(T = "change", j = !1) {
4678
+ f.saveToHistory(B, T, j), ke();
4679
+ }
4680
+ function H(T) {
4681
+ $e(T, !0);
4682
+ }
4683
+ const D = Sr(o, 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), Ve = (T, j) => {
4684
+ if (T?.id && (j.add(T.id), T.type === "row" && Array.isArray(T.columns)))
4685
+ for (const J of T.columns) {
4686
+ J?.id && j.add(J.id);
4687
+ const G = J.children ?? J.components ?? [];
4688
+ for (const we of G) Ve(we, j);
4689
+ }
4690
+ }, $t = (T) => {
4691
+ const j = D.findRow(T);
4692
+ if (j) {
4693
+ const J = /* @__PURE__ */ new Set();
4694
+ Ve(j, J), i.value && J.has(i.value) && (i.value = null), p.value && J.has(p.value) && (p.value = null), v.value && (J.has(v.value.rowId) || J.has(v.value.columnId)) && (v.value = null);
4695
+ }
4696
+ D.deleteRow(T);
4697
+ }, yt = Ce(() => ({
4698
+ mergeTagContext: S.value,
4699
+ mergeTagActive: C.value,
4700
+ linkTagContext: _.value,
4701
+ linkTagActive: g.value
4702
+ })), ne = Jo(o, a, P, $e, u, yt, void 0, void 0, k, t);
4703
+ {
4704
+ const T = () => {
4705
+ U && (clearTimeout(U), U = null, q(o.value, a.value, Me, Ue, ot), ae = f.version.value);
4706
+ };
4707
+ window.addEventListener("beforeunload", T), dr(() => {
4708
+ window.removeEventListener("beforeunload", T), U && (clearTimeout(U), U = null, q(o.value, a.value, Me, Ue, ot), ae = f.version.value);
4709
+ });
4710
+ }
4711
+ const Yt = () => {
4712
+ if (o.value.length > 0)
4713
+ return w.value = !0, te(), i.value = null, p.value = null, v.value = null, b.value = "properties", null;
4714
+ const T = W();
4715
+ return !T || T.templateId !== null ? (w.value = !0, null) : (w.value = !1, X = !0, o.value = T.rows, a.value = T.canvas, i.value = null, p.value = null, v.value = null, b.value = "properties", ye(() => {
4716
+ X = !1, te(), f.initialize(B()), ae = f.version.value, w.value = !0;
4717
+ }), me.value = new Date(T.updatedAt), T.name !== void 0 && (l.value = T.name), T.tags !== void 0 && (c.value = T.tags), T.updatedAt);
4718
+ }, Zn = async (T) => {
4719
+ if (!We.value) throw new Error("[maildeno-editor] this editor has no saveTemplate — nothing was saved");
4720
+ const { templateId: j } = await r.saveTemplate(T, M.value ?? void 0);
4721
+ M.value = j, O.value === "create" && (O.value = "edit");
4722
+ const J = ne.getExportedJSON(T.name);
4723
+ return J && console.info("[maildeno-editor] Saved — exported JSON:", J), j;
4724
+ }, er = async (T) => {
4725
+ const j = await r.loadTemplate(T);
4726
+ return j ? (Xt({
4727
+ canvas: j.canvasStyles,
4728
+ content: { rows: j.rows },
4729
+ name: j.name,
4730
+ tags: j.tags
4731
+ }, T), M.value = T, O.value = "edit", !0) : !1;
4732
+ }, tr = () => {
4733
+ w.value = !1, v.value = null, p.value = null, b.value = "properties", U && (clearTimeout(U), U = null);
4734
+ const T = W();
4735
+ if (T && T.templateId === null) {
4736
+ Yt();
4737
+ return;
4738
+ }
4739
+ T && T.templateId !== null && Q(), X = !0, o.value = [], i.value = null, a.value = at(), Me = null, l.value = null, c.value = [], ye(() => {
4740
+ X = !1, te(), f.initialize(B()), ae = f.version.value, w.value = !0;
4741
+ });
4742
+ }, nr = () => {
4743
+ w.value = !1, v.value = null, p.value = null, b.value = "properties", U && (clearTimeout(U), U = null), Q(), X = !0, o.value = [], i.value = null, a.value = at(), Me = null, M.value = null, O.value = "create", l.value = null, c.value = [], ye(() => {
4744
+ X = !1, te(), f.initialize(B()), ae = f.version.value, w.value = !0;
4745
+ });
4746
+ }, Xt = (T, j, J) => {
4747
+ w.value = !1, Me = j, Ue = T.name, ot = T.tags, l.value = T.name ?? null, c.value = T.tags ?? [], U && (clearTimeout(U), U = null);
4748
+ const G = W();
4749
+ if (G && G.templateId === j) {
4750
+ 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, a.value = G.canvas, o.value = G.rows, i.value = null, p.value = null, v.value = null, b.value = "properties", ye(() => {
4751
+ X = !1, te(), f.initialize(B()), ae = f.version.value, w.value = !0, J?.();
4752
+ }), me.value = new Date(G.updatedAt);
4753
+ return;
4754
+ }
4755
+ G && G.templateId !== j && (console.info(`[EmailBuilder] Clearing stale draft (belongs to ${G.templateId}, current is ${j}).`), Q()), X = !0, a.value = ct(JSON.parse(JSON.stringify(T.canvas))), o.value = ut(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, p.value = null, v.value = null, b.value = "properties", ye(() => {
4756
+ X = !1, te(), f.initialize(B()), ae = f.version.value, w.value = !0, J?.();
4757
+ });
4758
+ }, St = (T, j = "restore-version") => {
4759
+ U && (clearTimeout(U), U = null), X = !0, a.value = ct(JSON.parse(JSON.stringify(T.canvas))), o.value = ut(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, p.value = null, v.value = null, b.value = "properties", ye(() => {
4760
+ X = !1, te(), H(j);
4761
+ });
4762
+ }, rr = () => {
4763
+ f.undo(z) && (te(), ke());
4764
+ }, or = () => {
4765
+ f.redo(z) && (te(), ke());
4766
+ }, ar = () => {
4767
+ o.value = [], i.value = null, p.value = null, v.value = null, b.value = "properties", a.value = at(), ye(() => {
4768
+ te(), f.initialize(B()), ae = f.version.value;
4769
+ });
4770
+ }, ir = () => {
4771
+ n.require({
4772
+ message: "Are you sure you want to clear the current template? This cannot be undone.",
4773
+ header: "Clear Template",
4774
+ acceptLabel: "Yes",
4775
+ rejectLabel: "Cancel",
4776
+ acceptClass: "!bg-red-600 !hover:bg-red-700 !border-red-600 !px-6 !py-2",
4777
+ rejectClass: "!bg-gray-200 !hover:bg-gray-300 !text-gray-800 !border-gray-200 !px-6 !py-2",
4778
+ accept: () => ar(),
4779
+ reject: () => {
4780
+ }
4781
+ });
4782
+ }, sr = (T, j = {}) => {
4783
+ const J = vn(T), G = {
4784
+ canvas: J.canvas,
4785
+ content: { rows: J.rows }
4786
+ };
4787
+ if (j.history === "reset") {
4788
+ St(G, "set-json"), ye(() => {
4789
+ f.initialize(B()), ae = f.version.value;
4790
+ });
4791
+ return;
4792
+ }
4793
+ St(G, "set-json");
4794
+ }, lr = () => {
4795
+ const T = i.value;
4796
+ if (!T) return null;
4797
+ const j = D.findComponent(T);
4798
+ return {
4799
+ id: T,
4800
+ type: j?.componentType ?? j?.type ?? null
4801
+ };
4802
+ }, cr = (T) => T !== null && !D.findComponent(T) ? !1 : (i.value = T, !0), ur = (T) => hn(() => f.version.value, () => T());
4803
+ return {
4804
+ rows: o,
4805
+ canvasStyles: a,
4806
+ templateTags: c,
4807
+ savedTemplateName: l,
4808
+ previewMode: E,
4809
+ sidebarTab: b,
4810
+ selectedId: i,
4811
+ selectedRowId: p,
4812
+ selectedColumn: v,
4813
+ visibilityPreviewContext: u,
4814
+ mergeTagInsertQueue: d,
4815
+ triggerMergeTagInsert: s,
4816
+ mergeTagPreviewContext: S,
4817
+ mergeTagPreviewActive: C,
4818
+ linkTagPreviewContext: _,
4819
+ linkTagPreviewActive: g,
4820
+ isBuilderReady: w,
4821
+ linksActive: R,
4822
+ espConfig: k,
4823
+ canvasHoveredId: m,
4824
+ nestedRowDragId: h,
4825
+ isRowDragActive: x,
4826
+ isTopLevelRowDragActive: y,
4827
+ layerHoveredId: $,
4828
+ addRow: D.addRow,
4829
+ addNestedRow: D.addNestedRow,
4830
+ findRow: D.findRow,
4831
+ deleteRow: $t,
4832
+ moveRow: D.moveRow,
4833
+ moveNestedRow: D.moveNestedRow,
4834
+ reorderRows: D.reorderRows,
4835
+ addSpacer: D.addSpacer,
4836
+ duplicateRow: D.duplicateRow,
4837
+ duplicateRowSpacer: D.duplicateRowSpacer,
4838
+ addRowSilent: Re,
4839
+ addSpacerSilent: vt,
4840
+ reorderRowsSilent: bt,
4841
+ addComponent: D.addComponent,
4842
+ addComponentAtIndex: D.addComponentAtIndex,
4843
+ deleteComponent: D.deleteComponent,
4844
+ moveComponent: D.moveComponent,
4845
+ moveComponentBetweenColumns: D.moveComponentBetweenColumns,
4846
+ findComponent: D.findComponent,
4847
+ updateComponent: D.updateComponent,
4848
+ duplicateComponent: D.duplicateComponent,
4849
+ exportHTML: ne.exportHTML,
4850
+ getExportedHTML: ne.getExportedHTML,
4851
+ exportReactEmail: ne.exportReactEmail,
4852
+ getExportedReactEmail: ne.getExportedReactEmail,
4853
+ exportMJML: ne.exportMJML,
4854
+ getExportedMJML: ne.getExportedMJML,
4855
+ exportJSON: ne.exportJSON,
4856
+ getExportedJSON: ne.getExportedJSON,
4857
+ importJSON: (T) => ne.importJSON(T, i),
4858
+ clearTemplate: ir,
4859
+ undo: rr,
4860
+ redo: or,
4861
+ canUndo: f.canUndo,
4862
+ canRedo: f.canRedo,
4863
+ historyStatus: f.historyStatus,
4864
+ saveToHistory: $e,
4865
+ saveToHistoryImmediate: H,
4866
+ initFromStorage: Yt,
4867
+ clearLocal: Q,
4868
+ loadFromLocal: W,
4869
+ hasDraft: se,
4870
+ saveStatus: pe,
4871
+ lastSaved: me,
4872
+ initForCreate: tr,
4873
+ startNewTemplate: nr,
4874
+ loadTemplate: Xt,
4875
+ loadTemplateById: er,
4876
+ saveTemplate: Zn,
4877
+ templateId: M,
4878
+ builderMode: O,
4879
+ loadVersionSnapshot: St,
4880
+ setJson: sr,
4881
+ getSelection: lr,
4882
+ setSelection: cr,
4883
+ onChange: ur
4884
+ };
4885
+ }
4886
+ export {
4887
+ Jr as A,
4888
+ Ko as B,
4889
+ la as C,
4890
+ ia as D,
4891
+ eo as E,
4892
+ ea as F,
4893
+ hr as G,
4894
+ Xo as H,
4895
+ dt as I,
4896
+ $n as K,
4897
+ Rt as L,
4898
+ An as M,
4899
+ oa as N,
4900
+ Ut as O,
4901
+ ra as P,
4902
+ ta as R,
4903
+ pa as S,
4904
+ sa as T,
4905
+ Yo as U,
4906
+ Qo as V,
4907
+ Zo as W,
4908
+ Je as _,
4909
+ ba as a,
4910
+ ca as b,
4911
+ va as c,
4912
+ ga as d,
4913
+ pn as f,
4914
+ no as g,
4915
+ ro as h,
4916
+ ko as i,
4917
+ Tn as j,
4918
+ aa as k,
4919
+ ha as l,
4920
+ ma as m,
4921
+ Sa as n,
4922
+ $a as o,
4923
+ uo as p,
4924
+ K as q,
4925
+ Kt as r,
4926
+ So as s,
4927
+ ya as t,
4928
+ fa as u,
4929
+ gt as v,
4930
+ ft as w,
4931
+ ua as x,
4932
+ da as y,
4933
+ vr as z
4934
+ };