@emabuild/core 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/canvas/content-renderer.d.ts +14 -0
  2. package/dist/canvas/content-renderer.d.ts.map +1 -1
  3. package/dist/canvas/inline-toolbar.d.ts +13 -0
  4. package/dist/canvas/inline-toolbar.d.ts.map +1 -0
  5. package/dist/{form-tool-DShwYWpp.js → form-tool-At5Uq7es.js} +2 -2
  6. package/dist/{form-tool-DShwYWpp.js.map → form-tool-At5Uq7es.js.map} +1 -1
  7. package/dist/{html-tool-YYfXkFIO.js → html-tool-BxuBzfKP.js} +2 -2
  8. package/dist/{html-tool-YYfXkFIO.js.map → html-tool-BxuBzfKP.js.map} +1 -1
  9. package/dist/{index-BQJRD2VW.js → index-BTE3G6Ph.js} +753 -502
  10. package/dist/index-BTE3G6Ph.js.map +1 -0
  11. package/dist/index.js +1 -1
  12. package/dist/{menu-tool-Dus3qFoN.js → menu-tool-BZDYFgXW.js} +2 -2
  13. package/dist/{menu-tool-Dus3qFoN.js.map → menu-tool-BZDYFgXW.js.map} +1 -1
  14. package/dist/register-elements.d.ts.map +1 -1
  15. package/dist/{social-tool-Ba7s8khr.js → social-tool-BY75hT3n.js} +2 -2
  16. package/dist/{social-tool-Ba7s8khr.js.map → social-tool-BY75hT3n.js.map} +1 -1
  17. package/dist/{table-tool-D8yaPASq.js → table-tool-Ep89kXMr.js} +2 -2
  18. package/dist/{table-tool-D8yaPASq.js.map → table-tool-Ep89kXMr.js.map} +1 -1
  19. package/dist/{timer-tool-YDsaHv7a.js → timer-tool-Dj9QeWtN.js} +2 -2
  20. package/dist/{timer-tool-YDsaHv7a.js.map → timer-tool-Dj9QeWtN.js.map} +1 -1
  21. package/dist/tools/built-in/image-tool.d.ts.map +1 -1
  22. package/dist/{video-tool-3FQ9rHns.js → video-tool-DiIJBQpM.js} +2 -2
  23. package/dist/{video-tool-3FQ9rHns.js.map → video-tool-DiIJBQpM.js.map} +1 -1
  24. package/package.json +3 -3
  25. package/dist/index-BQJRD2VW.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { html as c, LitElement as v, css as $ } from "lit";
2
- import { property as b, customElement as k } from "lit/decorators.js";
3
- import { unsafeHTML as H } from "lit/directives/unsafe-html.js";
4
- function dt() {
1
+ import { html as p, LitElement as $, css as k } from "lit";
2
+ import { property as b, customElement as C, state as pt } from "lit/decorators.js";
3
+ import { unsafeHTML as U } from "lit/directives/unsafe-html.js";
4
+ function ht() {
5
5
  const e = {};
6
6
  return {
7
7
  getCounters() {
@@ -18,7 +18,7 @@ function dt() {
18
18
  }
19
19
  };
20
20
  }
21
- class ct {
21
+ class ut {
22
22
  constructor() {
23
23
  this.listeners = /* @__PURE__ */ new Map();
24
24
  }
@@ -45,7 +45,7 @@ class ct {
45
45
  t ? this.listeners.delete(t) : this.listeners.clear();
46
46
  }
47
47
  }
48
- class pt {
48
+ class gt {
49
49
  constructor(t = 50) {
50
50
  this.undoStack = [], this.redoStack = [], this.maxHistory = t;
51
51
  }
@@ -78,7 +78,7 @@ class pt {
78
78
  this.undoStack = [], this.redoStack = [];
79
79
  }
80
80
  }
81
- function ht() {
81
+ function ft() {
82
82
  return {
83
83
  counters: { u_row: 0, u_column: 0 },
84
84
  body: {
@@ -123,7 +123,7 @@ function ht() {
123
123
  schemaVersion: 16
124
124
  };
125
125
  }
126
- function ut(e, t) {
126
+ function bt(e, t) {
127
127
  const o = e.next("u_row"), n = t.map(() => {
128
128
  const i = e.next("u_column");
129
129
  return {
@@ -156,7 +156,7 @@ function ut(e, t) {
156
156
  }
157
157
  };
158
158
  }
159
- function gt(e, t, o = {}) {
159
+ function mt(e, t, o = {}) {
160
160
  const n = e.next(`u_content_${t}`), i = `u_content_${t}_${n}`;
161
161
  return {
162
162
  id: i,
@@ -172,37 +172,37 @@ function gt(e, t, o = {}) {
172
172
  }
173
173
  };
174
174
  }
175
- function F(e, t) {
175
+ function N(e, t) {
176
176
  return e.body.rows.find((o) => o.id === t);
177
177
  }
178
- function O(e, t) {
178
+ function j(e, t) {
179
179
  for (const o of e.body.rows) {
180
180
  const n = o.columns.find((i) => i.id === t);
181
181
  if (n) return n;
182
182
  }
183
183
  }
184
- function j(e, t) {
184
+ function W(e, t) {
185
185
  for (const o of e.body.rows)
186
186
  for (const n of o.columns) {
187
- const i = n.contents.find((r) => r.id === t);
187
+ const i = n.contents.find((s) => s.id === t);
188
188
  if (i) return i;
189
189
  }
190
190
  }
191
- function ft(e, t) {
191
+ function xt(e, t) {
192
192
  for (const o of e.body.rows)
193
193
  for (const n of o.columns)
194
194
  if (n.contents.some((i) => i.id === t)) return n;
195
195
  }
196
- function bt(e, t) {
196
+ function yt(e, t) {
197
197
  for (const o of e.body.rows)
198
198
  if (o.columns.some((n) => n.id === t)) return o;
199
199
  }
200
- function N(e, t) {
200
+ function q(e, t) {
201
201
  return e.body.rows.findIndex((o) => o.id === t);
202
202
  }
203
- class mt {
203
+ class wt {
204
204
  constructor() {
205
- this.history = new pt(), this.counterManager = dt(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new ct(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = ht();
205
+ this.history = new gt(), this.counterManager = ht(), this.subscribers = /* @__PURE__ */ new Set(), this.channelSubscribers = /* @__PURE__ */ new Map(), this.events = new ut(), this._selectedId = null, this._hoveredId = null, this._viewMode = "desktop", this._activeTab = "content", this.design = ft();
206
206
  }
207
207
  // ── Subscriptions ──────────────────────────────────────────
208
208
  /** Subscribe to ALL state changes (legacy). Returns an unsubscribe function. */
@@ -237,7 +237,7 @@ class mt {
237
237
  for (const n of this.subscribers) o.add(n);
238
238
  for (const n of t) {
239
239
  const i = this.channelSubscribers.get(n);
240
- if (i) for (const r of i) o.add(r);
240
+ if (i) for (const s of i) o.add(s);
241
241
  }
242
242
  o.forEach((n) => n());
243
243
  }
@@ -312,7 +312,7 @@ class mt {
312
312
  }
313
313
  /** Remove a row by ID */
314
314
  removeRow(t) {
315
- const o = N(this.design, t);
315
+ const o = q(this.design, t);
316
316
  o !== -1 && (this.history.push(this.design), this.design.body.rows.splice(o, 1), this._selectedId === t && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("row_removed"));
317
317
  }
318
318
  /** Move a row from one index to another */
@@ -323,51 +323,51 @@ class mt {
323
323
  }
324
324
  /** Duplicate a row, assigning fresh IDs to all nested elements */
325
325
  duplicateRow(t) {
326
- const o = F(this.design, t);
326
+ const o = N(this.design, t);
327
327
  if (!o) return;
328
328
  this.history.push(this.design);
329
329
  const n = structuredClone(o), i = this.counterManager.next("u_row");
330
330
  n.id = `u_row_${i}`, n.values._meta = { htmlID: n.id, htmlClassNames: "u_row" };
331
- for (const s of n.columns) {
332
- const l = this.counterManager.next("u_column");
333
- s.id = `u_column_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: "u_column" };
334
- for (const d of s.contents) {
335
- const p = this.counterManager.next(`u_content_${d.type}`);
336
- d.id = `u_content_${d.type}_${p}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
331
+ for (const r of n.columns) {
332
+ const a = this.counterManager.next("u_column");
333
+ r.id = `u_column_${a}`, r.values._meta = { htmlID: r.id, htmlClassNames: "u_column" };
334
+ for (const d of r.contents) {
335
+ const c = this.counterManager.next(`u_content_${d.type}`);
336
+ d.id = `u_content_${d.type}_${c}`, d.values._meta = { htmlID: d.id, htmlClassNames: `u_content_${d.type}` };
337
337
  }
338
338
  }
339
- const r = N(this.design, t);
340
- this.design.body.rows.splice(r + 1, 0, n), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", n);
339
+ const s = q(this.design, t);
340
+ this.design.body.rows.splice(s + 1, 0, n), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("row_added", n);
341
341
  }
342
342
  /** Get the index of a row */
343
343
  getRowIndex(t) {
344
- return N(this.design, t);
344
+ return q(this.design, t);
345
345
  }
346
346
  /** Update row-level values */
347
347
  updateRowValues(t, o) {
348
- const n = F(this.design, t);
348
+ const n = N(this.design, t);
349
349
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
350
350
  }
351
351
  // ── Column Operations ──────────────────────────────────────
352
352
  /** Update column-level values */
353
353
  updateColumnValues(t, o) {
354
- const n = O(this.design, t);
354
+ const n = j(this.design, t);
355
355
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
356
356
  }
357
357
  // ── Content Operations ─────────────────────────────────────
358
358
  /** Add content to a column at the given index */
359
359
  addContent(t, o, n) {
360
- const i = O(this.design, t);
360
+ const i = j(this.design, t);
361
361
  if (!i) return;
362
362
  this.history.push(this.design);
363
- const r = structuredClone(o);
364
- n !== void 0 && n >= 0 && n <= i.contents.length ? i.contents.splice(n, 0, r) : i.contents.push(r), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", r);
363
+ const s = structuredClone(o);
364
+ n !== void 0 && n >= 0 && n <= i.contents.length ? i.contents.splice(n, 0, s) : i.contents.push(s), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", s);
365
365
  }
366
366
  /** Remove a content block by ID */
367
367
  removeContent(t) {
368
368
  for (const o of this.design.body.rows)
369
369
  for (const n of o.columns) {
370
- const i = n.contents.findIndex((r) => r.id === t);
370
+ const i = n.contents.findIndex((s) => s.id === t);
371
371
  if (i !== -1) {
372
372
  this.history.push(this.design), n.contents.splice(i, 1), this._selectedId === t && (this._selectedId = null), this.notifyChannels("design"), this.emitUpdate("content_removed");
373
373
  return;
@@ -376,36 +376,36 @@ class mt {
376
376
  }
377
377
  /** Update content values by ID */
378
378
  updateContentValues(t, o) {
379
- const n = j(this.design, t);
379
+ const n = W(this.design, t);
380
380
  n && (this.history.push(this.design), Object.assign(n.values, o), this.notifyChannels("design"), this.emitUpdate("content_updated"));
381
381
  }
382
382
  /** Move a content block to a different column at a given index */
383
383
  moveContent(t, o, n) {
384
- const i = j(this.design, t);
384
+ const i = W(this.design, t);
385
385
  if (!i) return;
386
386
  this.history.push(this.design);
387
- for (const s of this.design.body.rows)
388
- for (const l of s.columns) {
389
- const d = l.contents.findIndex((p) => p.id === t);
387
+ for (const r of this.design.body.rows)
388
+ for (const a of r.columns) {
389
+ const d = a.contents.findIndex((c) => c.id === t);
390
390
  if (d !== -1) {
391
- l.contents.splice(d, 1);
391
+ a.contents.splice(d, 1);
392
392
  break;
393
393
  }
394
394
  }
395
- const r = O(this.design, o);
396
- r && r.contents.splice(n, 0, i), this.notifyChannels("design"), this.emitUpdate("content_reordered");
395
+ const s = j(this.design, o);
396
+ s && s.contents.splice(n, 0, i), this.notifyChannels("design"), this.emitUpdate("content_reordered");
397
397
  }
398
398
  /** Duplicate a content block, inserting the copy right after the original */
399
399
  duplicateContent(t) {
400
- const o = j(this.design, t);
400
+ const o = W(this.design, t);
401
401
  if (o)
402
402
  for (const n of this.design.body.rows)
403
403
  for (const i of n.columns) {
404
- const r = i.contents.findIndex((s) => s.id === t);
405
- if (r !== -1) {
404
+ const s = i.contents.findIndex((r) => r.id === t);
405
+ if (s !== -1) {
406
406
  this.history.push(this.design);
407
- const s = structuredClone(o), l = this.counterManager.next(`u_content_${o.type}`);
408
- s.id = `u_content_${o.type}_${l}`, s.values._meta = { htmlID: s.id, htmlClassNames: `u_content_${o.type}` }, i.contents.splice(r + 1, 0, s), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", s);
407
+ const r = structuredClone(o), a = this.counterManager.next(`u_content_${o.type}`);
408
+ r.id = `u_content_${o.type}_${a}`, r.values._meta = { htmlID: r.id, htmlClassNames: `u_content_${o.type}` }, i.contents.splice(s + 1, 0, r), this.syncCounters(), this.notifyChannels("design"), this.emitUpdate("content_added", r);
409
409
  return;
410
410
  }
411
411
  }
@@ -417,29 +417,29 @@ class mt {
417
417
  }
418
418
  // ── Lookups (delegate to design-lookup) ────────────────────
419
419
  findRow(t) {
420
- return F(this.design, t);
420
+ return N(this.design, t);
421
421
  }
422
422
  findColumn(t) {
423
- return O(this.design, t);
423
+ return j(this.design, t);
424
424
  }
425
425
  findContent(t) {
426
- return j(this.design, t);
426
+ return W(this.design, t);
427
427
  }
428
428
  findParentColumn(t) {
429
- return ft(this.design, t);
429
+ return xt(this.design, t);
430
430
  }
431
431
  findParentRow(t) {
432
- return bt(this.design, t);
432
+ return yt(this.design, t);
433
433
  }
434
434
  // ── Factory Methods (delegate to design-factory) ───────────
435
435
  /** Create a new row with the given column layout */
436
436
  createRow(t) {
437
- const o = ut(this.counterManager, t);
437
+ const o = bt(this.counterManager, t);
438
438
  return this.syncCounters(), o;
439
439
  }
440
440
  /** Create a new content block for the given tool type */
441
441
  createContent(t, o = {}) {
442
- const n = gt(this.counterManager, t, o);
442
+ const n = mt(this.counterManager, t, o);
443
443
  return this.syncCounters(), n;
444
444
  }
445
445
  // ── Private Helpers ────────────────────────────────────────
@@ -450,7 +450,7 @@ class mt {
450
450
  this.events.emit("design:updated", { type: t, item: o });
451
451
  }
452
452
  }
453
- class xt {
453
+ class vt {
454
454
  constructor() {
455
455
  this.tools = /* @__PURE__ */ new Map(), this.lazyLoaders = /* @__PURE__ */ new Map(), this.lazyMeta = /* @__PURE__ */ new Map(), this.loadingPromises = /* @__PURE__ */ new Map();
456
456
  }
@@ -526,8 +526,8 @@ class xt {
526
526
  if (!o) return {};
527
527
  const n = { ...o.defaultValues };
528
528
  for (const i of Object.values(o.options))
529
- for (const [r, s] of Object.entries(i.options))
530
- r in n || (n[r] = s.defaultValue);
529
+ for (const [s, r] of Object.entries(i.options))
530
+ s in n || (n[s] = r.defaultValue);
531
531
  return n;
532
532
  }
533
533
  /** Get property groups for a tool */
@@ -535,7 +535,7 @@ class xt {
535
535
  return this.tools.get(t)?.options ?? {};
536
536
  }
537
537
  }
538
- const E = {
538
+ const z = {
539
539
  /** ID of the content currently being dragged (null if not dragging content) */
540
540
  draggingContentId: null,
541
541
  startContentDrag(e) {
@@ -545,7 +545,7 @@ const E = {
545
545
  this.draggingContentId = null;
546
546
  }
547
547
  };
548
- function Q(e) {
548
+ function Z(e) {
549
549
  const t = document.createElement("div");
550
550
  return Object.assign(t.style, {
551
551
  position: "absolute",
@@ -560,63 +560,63 @@ function Q(e) {
560
560
  boxShadow: `0 0 6px ${e}80`
561
561
  }), t;
562
562
  }
563
- function Z(e, t, o, n, i = "4px") {
563
+ function tt(e, t, o, n, i = "4px") {
564
564
  e.parentNode !== t && (e.remove(), t.appendChild(e));
565
- const s = (t instanceof ShadowRoot ? t.host : t).getBoundingClientRect();
566
- let l;
567
- o.length === 0 || n === 0 ? l = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - s.top : n >= o.length ? l = o[o.length - 1].getBoundingClientRect().bottom - s.top : l = o[n].getBoundingClientRect().top - s.top, Object.assign(e.style, {
565
+ const r = (t instanceof ShadowRoot ? t.host : t).getBoundingClientRect();
566
+ let a;
567
+ o.length === 0 || n === 0 ? a = o.length === 0 ? 0 : o[0].getBoundingClientRect().top - r.top : n >= o.length ? a = o[o.length - 1].getBoundingClientRect().bottom - r.top : a = o[n].getBoundingClientRect().top - r.top, Object.assign(e.style, {
568
568
  display: "block",
569
- top: `${l}px`,
569
+ top: `${a}px`,
570
570
  left: i,
571
571
  right: i,
572
572
  width: "auto"
573
573
  });
574
574
  }
575
- function M(e) {
575
+ function I(e) {
576
576
  e && (e.style.display = "none");
577
577
  }
578
- function G(e, t) {
578
+ function K(e, t) {
579
579
  const o = (e instanceof ShadowRoot, e.children);
580
580
  for (const n of Array.from(o)) {
581
581
  const i = n;
582
- t(i), i.shadowRoot && G(i.shadowRoot, t), i.children?.length && G(i, t);
582
+ t(i), i.shadowRoot && K(i.shadowRoot, t), i.children?.length && K(i, t);
583
583
  }
584
584
  }
585
- function tt(e, t) {
585
+ function et(e, t) {
586
586
  const o = [];
587
- return G(e, (n) => {
587
+ return K(e, (n) => {
588
588
  n.matches?.(t) && o.push(n);
589
589
  }), o;
590
590
  }
591
- class yt {
591
+ class $t {
592
592
  constructor(t, o, n) {
593
593
  this.currentDrop = null, this.contentIndicator = null, this.rowIndicator = null, this.onDragOver = (i) => {
594
- const r = i.dataTransfer?.types || [], s = r.includes("application/maileditor-tool"), l = r.includes("application/maileditor-layout"), d = r.includes("application/maileditor-content") || !!E.draggingContentId;
595
- !s && !d && !l || (i.preventDefault(), i.dataTransfer.dropEffect = s || l ? "copy" : "move", l ? (this.currentDrop = this.findRowDropTarget(i.clientY), M(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), M(this.rowIndicator), this.showContentIndicator()));
594
+ const s = i.dataTransfer?.types || [], r = s.includes("application/maileditor-tool"), a = s.includes("application/maileditor-layout"), d = s.includes("application/maileditor-content") || !!z.draggingContentId;
595
+ !r && !d && !a || (i.preventDefault(), i.dataTransfer.dropEffect = r || a ? "copy" : "move", a ? (this.currentDrop = this.findRowDropTarget(i.clientY), I(this.contentIndicator), this.showRowIndicator()) : (this.currentDrop = this.findContentDropTarget(i.clientX, i.clientY), I(this.rowIndicator), this.showContentIndicator()));
596
596
  }, this.onDrop = (i) => {
597
597
  i.preventDefault(), this.hideAllIndicators();
598
- const r = this.currentDrop, s = i.dataTransfer?.getData("application/maileditor-layout");
599
- if (s) {
600
- this.handleLayoutDrop(JSON.parse(s), r), this.reset();
598
+ const s = this.currentDrop, r = i.dataTransfer?.getData("application/maileditor-layout");
599
+ if (r) {
600
+ this.handleLayoutDrop(JSON.parse(r), s), this.reset();
601
601
  return;
602
602
  }
603
- const l = i.dataTransfer?.getData("application/maileditor-tool");
604
- if (l) {
605
- this.handleToolDrop(l, r), this.reset();
603
+ const a = i.dataTransfer?.getData("application/maileditor-tool");
604
+ if (a) {
605
+ this.handleToolDrop(a, s), this.reset();
606
606
  return;
607
607
  }
608
- const d = i.dataTransfer?.getData("application/maileditor-content") || E.draggingContentId;
609
- d && this.handleContentDrop(d, r), this.reset();
608
+ const d = i.dataTransfer?.getData("application/maileditor-content") || z.draggingContentId;
609
+ d && this.handleContentDrop(d, s), this.reset();
610
610
  }, this.onDragEnd = () => {
611
611
  this.hideAllIndicators(), this.reset();
612
612
  }, this.onDragLeave = (i) => {
613
- const r = i.relatedTarget;
614
- (!r || !this.root.contains(r)) && (this.hideAllIndicators(), this.currentDrop = null);
613
+ const s = i.relatedTarget;
614
+ (!s || !this.root.contains(s)) && (this.hideAllIndicators(), this.currentDrop = null);
615
615
  }, this.store = t, this.toolRegistry = o, this.root = n;
616
616
  }
617
617
  /** Attach all drag event listeners to the shadow root */
618
618
  attach() {
619
- this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator = Q("#3b82f6"), this.rowIndicator = Q("#8b5cf6");
619
+ this.root.addEventListener("dragover", this.onDragOver), this.root.addEventListener("drop", this.onDrop), this.root.addEventListener("dragend", this.onDragEnd), this.root.addEventListener("dragleave", this.onDragLeave), this.contentIndicator = Z("#3b82f6"), this.rowIndicator = Z("#8b5cf6");
620
620
  }
621
621
  /** Remove all event listeners and clean up indicators */
622
622
  detach() {
@@ -634,8 +634,8 @@ class yt {
634
634
  } else {
635
635
  const n = this.store.createRow([1]);
636
636
  this.store.addRow(n);
637
- const i = this.toolRegistry.getDefaultValues(t), r = this.store.createContent(t, i);
638
- this.store.addContent(n.columns[0].id, r), this.store.select(r.id);
637
+ const i = this.toolRegistry.getDefaultValues(t), s = this.store.createContent(t, i);
638
+ this.store.addContent(n.columns[0].id, s), this.store.select(s.id);
639
639
  }
640
640
  }
641
641
  handleContentDrop(t, o) {
@@ -647,33 +647,33 @@ class yt {
647
647
  if (!o?.shadowRoot) return null;
648
648
  const n = Array.from(o.shadowRoot.querySelectorAll("me-row-renderer"));
649
649
  if (n.length === 0) return { type: "row", rowIndex: 0, y: 0 };
650
- let i = Math.abs(t - n[0].getBoundingClientRect().top), r = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
651
- for (let s = 0; s < n.length; s++) {
652
- const l = n[s].getBoundingClientRect().bottom, d = Math.abs(t - l);
653
- d < i && (i = d, r = { type: "row", rowIndex: s + 1, y: l });
650
+ let i = Math.abs(t - n[0].getBoundingClientRect().top), s = { type: "row", rowIndex: 0, y: n[0].getBoundingClientRect().top };
651
+ for (let r = 0; r < n.length; r++) {
652
+ const a = n[r].getBoundingClientRect().bottom, d = Math.abs(t - a);
653
+ d < i && (i = d, s = { type: "row", rowIndex: r + 1, y: a });
654
654
  }
655
- return r;
655
+ return s;
656
656
  }
657
657
  findContentDropTarget(t, o) {
658
- const n = tt(this.root, "me-column-renderer");
659
- let i = null, r = 1 / 0;
660
- for (const s of n) {
661
- const l = s.dataset.columnId;
662
- if (!l || !s.shadowRoot) continue;
663
- const d = s.getBoundingClientRect();
658
+ const n = et(this.root, "me-column-renderer");
659
+ let i = null, s = 1 / 0;
660
+ for (const r of n) {
661
+ const a = r.dataset.columnId;
662
+ if (!a || !r.shadowRoot) continue;
663
+ const d = r.getBoundingClientRect();
664
664
  if (t < d.left || t > d.right) continue;
665
- const p = Array.from(s.shadowRoot.querySelectorAll("me-content-renderer"));
666
- if (p.length === 0) {
667
- const g = Math.abs(o - (d.top + d.height / 2));
668
- g < r && (r = g, i = { type: "content", columnId: l, contentIndex: 0, y: d.top + d.height / 2 });
665
+ const c = Array.from(r.shadowRoot.querySelectorAll("me-content-renderer"));
666
+ if (c.length === 0) {
667
+ const u = Math.abs(o - (d.top + d.height / 2));
668
+ u < s && (s = u, i = { type: "content", columnId: a, contentIndex: 0, y: d.top + d.height / 2 });
669
669
  continue;
670
670
  }
671
- const h = p[0].getBoundingClientRect().top;
672
- let u = Math.abs(o - h);
673
- u < r && (r = u, i = { type: "content", columnId: l, contentIndex: 0, y: h });
674
- for (let g = 0; g < p.length; g++) {
675
- const m = p[g].getBoundingClientRect(), x = p[g + 1]?.getBoundingClientRect(), f = x ? (m.bottom + x.top) / 2 : m.bottom;
676
- u = Math.abs(o - f), u < r && (r = u, i = { type: "content", columnId: l, contentIndex: g + 1, y: f });
671
+ const h = c[0].getBoundingClientRect().top;
672
+ let g = Math.abs(o - h);
673
+ g < s && (s = g, i = { type: "content", columnId: a, contentIndex: 0, y: h });
674
+ for (let u = 0; u < c.length; u++) {
675
+ const f = c[u].getBoundingClientRect(), y = c[u + 1]?.getBoundingClientRect(), x = y ? (f.bottom + y.top) / 2 : f.bottom;
676
+ g = Math.abs(o - x), g < s && (s = g, i = { type: "content", columnId: a, contentIndex: u + 1, y: x });
677
677
  }
678
678
  }
679
679
  return i;
@@ -681,39 +681,39 @@ class yt {
681
681
  // ── Indicator Positioning ──────────────────────────────────
682
682
  showContentIndicator() {
683
683
  if (!this.contentIndicator || !this.currentDrop?.columnId) {
684
- M(this.contentIndicator);
684
+ I(this.contentIndicator);
685
685
  return;
686
686
  }
687
- const o = tt(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
687
+ const o = et(this.root, "me-column-renderer").find((i) => i.dataset.columnId === this.currentDrop.columnId);
688
688
  if (!o?.shadowRoot) return;
689
689
  const n = Array.from(o.shadowRoot.querySelectorAll("me-content-renderer"));
690
- Z(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
690
+ tt(this.contentIndicator, o.shadowRoot, n, this.currentDrop.contentIndex ?? 0, "4px");
691
691
  }
692
692
  showRowIndicator() {
693
693
  if (!this.rowIndicator || !this.currentDrop) {
694
- M(this.rowIndicator);
694
+ I(this.rowIndicator);
695
695
  return;
696
696
  }
697
697
  const t = this.root.querySelector("me-editor-canvas"), o = t?.shadowRoot?.querySelector(".canvas-body");
698
698
  if (!o) return;
699
699
  const n = Array.from(t.shadowRoot.querySelectorAll("me-row-renderer"));
700
- Z(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
700
+ tt(this.rowIndicator, o, n, this.currentDrop.rowIndex ?? 0, "0");
701
701
  }
702
702
  hideAllIndicators() {
703
- M(this.contentIndicator), M(this.rowIndicator);
703
+ I(this.contentIndicator), I(this.rowIndicator);
704
704
  }
705
705
  reset() {
706
- this.currentDrop = null, E.reset();
706
+ this.currentDrop = null, z.reset();
707
707
  }
708
708
  }
709
- function a(e, t, o = "") {
709
+ function l(e, t, o = "") {
710
710
  const n = e[t];
711
711
  return typeof n == "string" && n !== "" ? n : typeof n == "number" ? String(n) : o;
712
712
  }
713
- function et(e) {
713
+ function ot(e) {
714
714
  return typeof e == "string" ? e : e && typeof e == "object" && "url" in e && e.url || "";
715
715
  }
716
- function ot(e) {
716
+ function nt(e) {
717
717
  if (e && typeof e == "object") {
718
718
  const t = e;
719
719
  return {
@@ -723,7 +723,7 @@ function ot(e) {
723
723
  }
724
724
  return {};
725
725
  }
726
- function wt(e) {
726
+ function kt(e) {
727
727
  const t = e.action;
728
728
  if (t && typeof t == "object") {
729
729
  const o = t.values;
@@ -733,22 +733,22 @@ function wt(e) {
733
733
  };
734
734
  }
735
735
  return {
736
- href: a(e, "href"),
737
- target: a(e, "target", "_blank")
736
+ href: l(e, "href"),
737
+ target: l(e, "target", "_blank")
738
738
  };
739
739
  }
740
- function nt(e, t = "") {
740
+ function it(e, t = "") {
741
741
  const o = e.text;
742
742
  if (typeof o == "string" && o !== "") return o;
743
743
  const n = e.textJson;
744
744
  if (typeof n == "string")
745
745
  try {
746
- const i = JSON.parse(n), r = [], s = (l) => {
747
- typeof l.text == "string" && r.push(l.text), l.type === "linebreak" && r.push("<br/>");
748
- const d = l.children;
749
- d && d.forEach(s);
746
+ const i = JSON.parse(n), s = [], r = (a) => {
747
+ typeof a.text == "string" && s.push(a.text), a.type === "linebreak" && s.push("<br/>");
748
+ const d = a.children;
749
+ d && d.forEach(r);
750
750
  };
751
- if (s(i.root || i), r.length > 0) return r.join("");
751
+ if (r(i.root || i), s.length > 0) return s.join("");
752
752
  } catch {
753
753
  }
754
754
  return t;
@@ -757,19 +757,19 @@ function Y(e, t = "arial,helvetica,sans-serif") {
757
757
  const o = e.fontFamily;
758
758
  if (typeof o == "string" && o !== "") return o;
759
759
  if (o && typeof o == "object") {
760
- const n = o, i = n.value || t, r = n.url;
761
- if (r && typeof document < "u") {
762
- const s = `emabuild-font-${i.replace(/[^a-z]/gi, "")}`;
763
- if (!document.getElementById(s)) {
764
- const l = document.createElement("link");
765
- l.id = s, l.rel = "stylesheet", l.href = r, document.head.appendChild(l);
760
+ const n = o, i = n.value || t, s = n.url;
761
+ if (s && typeof document < "u") {
762
+ const r = `emabuild-font-${i.replace(/[^a-z]/gi, "")}`;
763
+ if (!document.getElementById(r)) {
764
+ const a = document.createElement("link");
765
+ a.id = r, a.rel = "stylesheet", a.href = s, document.head.appendChild(a);
766
766
  }
767
767
  }
768
768
  return i;
769
769
  }
770
770
  return t;
771
771
  }
772
- function le(e, t) {
772
+ function me(e, t) {
773
773
  if (typeof e != "string") return t;
774
774
  try {
775
775
  return JSON.parse(e);
@@ -777,26 +777,26 @@ function le(e, t) {
777
777
  return t;
778
778
  }
779
779
  }
780
- function V(e, t) {
780
+ function L(e, t) {
781
781
  const { padding: o, align: n = "left", extraTdStyle: i = "" } = t;
782
782
  return `<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
783
- <tbody><tr><td style="${`overflow-wrap:break-word;word-break:break-word;padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
783
+ <tbody><tr><td style="${`padding:${o};font-family:arial,helvetica,sans-serif;${i}`}" align="${n}">
784
784
  ${e}
785
785
  </td></tr></tbody>
786
786
  </table>`;
787
787
  }
788
- function vt(e, t, o) {
789
- const { bgColor: n, textColor: i, fontSize: r, fontWeight: s, borderRadius: l } = o, d = parseInt(l) || 0;
788
+ function Ct(e, t, o) {
789
+ const { bgColor: n, textColor: i, fontSize: s, fontWeight: r, borderRadius: a } = o, d = parseInt(a) || 0;
790
790
  if (d <= 0) return "";
791
- const p = Math.round(d / 20 * 100);
791
+ const c = Math.round(d / 20 * 100);
792
792
  return `<!--[if mso]>
793
- <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${t}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${p}%" stroke="f" fillcolor="${n}">
793
+ <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${t}" style="height:auto;v-text-anchor:middle;width:auto;" arcsize="${c}%" stroke="f" fillcolor="${n}">
794
794
  <w:anchorlock/>
795
- <center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${r};font-weight:${s};">${e}</center>
795
+ <center style="color:${i};font-family:arial,helvetica,sans-serif;font-size:${s};font-weight:${r};">${e}</center>
796
796
  </v:roundrect>
797
797
  <![endif]-->`;
798
798
  }
799
- const $t = {
799
+ const _t = {
800
800
  name: "text",
801
801
  label: "Text",
802
802
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>',
@@ -859,19 +859,19 @@ const $t = {
859
859
  },
860
860
  renderer: {
861
861
  renderEditor(e) {
862
- const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "transparent"), n = a(e, "color", "inherit"), i = a(e, "lineHeight", "140%"), r = Y(e), s = a(e, "text");
863
- return c`
864
- <div style="padding:${t};background-color:${o};color:${n};line-height:${i};font-family:${r};word-break:break-word;">
865
- ${H(s)}
862
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "transparent"), n = l(e, "color", "inherit"), i = l(e, "lineHeight", "140%"), s = Y(e), r = l(e, "text");
863
+ return p`
864
+ <div style="padding:${t};background-color:${o};color:${n};line-height:${i};font-family:${s};word-break:break-word;">
865
+ ${U(r)}
866
866
  </div>
867
867
  `;
868
868
  },
869
869
  renderHtml(e) {
870
- const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor"), n = a(e, "color", "#000000"), i = a(e, "lineHeight", "140%"), r = a(e, "textAlign", "left"), s = a(e, "text"), l = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${r};word-wrap:break-word;">${s}</div>`;
871
- return V(d, { padding: t, extraTdStyle: l });
870
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor"), n = l(e, "color", "#000000"), i = l(e, "lineHeight", "140%"), s = l(e, "textAlign", "left"), r = l(e, "text"), a = o ? `background-color:${o};` : "", d = `<div style="font-size:14px;color:${n};line-height:${i};text-align:${s};">${r}</div>`;
871
+ return L(d, { padding: t, extraTdStyle: a });
872
872
  }
873
873
  }
874
- }, kt = {
874
+ }, Dt = {
875
875
  name: "heading",
876
876
  label: "Heading",
877
877
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h12"/><path d="M6 4v16"/><path d="M18 4v16"/></svg>',
@@ -973,19 +973,19 @@ const $t = {
973
973
  },
974
974
  renderer: {
975
975
  renderEditor(e) {
976
- const t = a(e, "containerPadding", "10px"), o = a(e, "fontSize", "22px"), n = a(e, "color", "#000000"), i = a(e, "textAlign", "left"), r = a(e, "fontWeight", "700"), s = a(e, "lineHeight", "140%"), l = Y(e), d = nt(e, "Heading");
977
- return c`
978
- <div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};font-family:${l};">
979
- ${H(d)}
976
+ const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), s = l(e, "fontWeight", "700"), r = l(e, "lineHeight", "140%"), a = Y(e), d = it(e, "Heading");
977
+ return p`
978
+ <div style="padding:${t};font-size:${o};color:${n};text-align:${i};font-weight:${s};line-height:${r};font-family:${a};">
979
+ ${U(d)}
980
980
  </div>
981
981
  `;
982
982
  },
983
983
  renderHtml(e) {
984
- const t = a(e, "containerPadding", "10px"), o = a(e, "fontSize", "22px"), n = a(e, "color", "#000000"), i = a(e, "textAlign", "left"), r = a(e, "fontWeight", "700"), s = a(e, "lineHeight", "140%"), l = a(e, "letterSpacing", "normal"), d = Y(e), p = a(e, "headingType", "h1"), h = nt(e, "Heading"), u = `<${p} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${r};line-height:${s};letter-spacing:${l};font-family:${d};">${h}</${p}>`;
985
- return V(u, { padding: t });
984
+ const t = l(e, "containerPadding", "10px"), o = l(e, "fontSize", "22px"), n = l(e, "color", "#000000"), i = l(e, "textAlign", "left"), s = l(e, "fontWeight", "700"), r = l(e, "lineHeight", "140%"), a = l(e, "letterSpacing", "normal"), d = Y(e), c = l(e, "headingType", "h1"), h = it(e, "Heading"), g = `<${c} style="margin:0;font-size:${o};color:${n};text-align:${i};font-weight:${s};line-height:${r};letter-spacing:${a};font-family:${d};">${h}</${c}>`;
985
+ return L(g, { padding: t });
986
986
  }
987
987
  }
988
- }, Ct = {
988
+ }, St = {
989
989
  name: "paragraph",
990
990
  label: "Paragraph",
991
991
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="3" y1="14" x2="17" y2="14"/></svg>',
@@ -1028,15 +1028,15 @@ const $t = {
1028
1028
  },
1029
1029
  renderer: {
1030
1030
  renderEditor(e) {
1031
- const t = a(e, "containerPadding", "10px"), o = a(e, "color", "#374151"), n = a(e, "lineHeight", "160%");
1032
- return c`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${H(a(e, "text"))}</div>`;
1031
+ const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%");
1032
+ return p`<div style="padding:${t};color:${o};line-height:${n};word-break:break-word;">${U(l(e, "text"))}</div>`;
1033
1033
  },
1034
1034
  renderHtml(e) {
1035
- const t = a(e, "containerPadding", "10px"), o = a(e, "color", "#374151"), n = a(e, "lineHeight", "160%"), i = a(e, "textAlign", "left"), r = a(e, "letterSpacing", "normal"), s = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${r};word-wrap:break-word;">${a(e, "text")}</div>`;
1036
- return V(s, { padding: t });
1035
+ const t = l(e, "containerPadding", "10px"), o = l(e, "color", "#374151"), n = l(e, "lineHeight", "160%"), i = l(e, "textAlign", "left"), s = l(e, "letterSpacing", "normal"), r = `<div style="font-size:14px;color:${o};line-height:${n};text-align:${i};letter-spacing:${s};word-wrap:break-word;">${l(e, "text")}</div>`;
1036
+ return L(r, { padding: t });
1037
1037
  }
1038
1038
  }
1039
- }, _t = {
1039
+ }, Rt = {
1040
1040
  name: "image",
1041
1041
  label: "Image",
1042
1042
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
@@ -1097,15 +1097,18 @@ const $t = {
1097
1097
  },
1098
1098
  renderer: {
1099
1099
  renderEditor(e) {
1100
- const t = a(e, "containerPadding", "10px"), o = et(e.src), n = a(e, "alt"), r = ot(e.src).maxWidth || a(e, "width", "100%"), s = a(e, "borderRadius", "0px"), l = a(e, "textAlign", a(e, "align", "center"));
1101
- return o ? c`<div style="padding:${t};text-align:${l};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${r};border-radius:${s};border:0;" /></div>` : c`<div style="padding:${t};text-align:${l};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1100
+ const t = l(e, "containerPadding", "10px"), o = ot(e.src), n = l(e, "alt"), s = nt(e.src).maxWidth || l(e, "width", "100%"), r = l(e, "borderRadius", "0px"), a = l(e, "textAlign", l(e, "align", "center"));
1101
+ return o ? p`<div style="padding:${t};text-align:${a};"><img src=${o} alt=${n} style="display:inline-block;max-width:100%;width:${s};border-radius:${r};border:0;" /></div>` : p`<div style="padding:${t};text-align:${a};"><div style="background:#f1f5f9;border:2px dashed #cbd5e1;border-radius:8px;padding:40px 20px;text-align:center;color:#94a3b8;font-size:13px;">No image set. Enter a URL in the property panel.</div></div>`;
1102
1102
  },
1103
1103
  renderHtml(e, t) {
1104
- const o = a(e, "containerPadding", "10px"), n = et(e.src), i = a(e, "alt"), r = wt(e), l = ot(e.src).maxWidth || a(e, "width", "100%"), d = a(e, "borderRadius", "0px"), p = a(e, "textAlign", a(e, "align", "center")), h = l === "100%" ? t.columnWidth : parseInt(l) || t.columnWidth, u = d !== "0px" ? `border-radius:${d};` : "", g = `<img align="${p}" border="0" src="${n}" alt="${i}" title="${i}" style="outline:none;text-decoration:none;clear:both;display:inline-block!important;border:none;height:auto;float:none;width:${l};max-width:${h}px;${u}" width="${h}" />`, m = r.href ? `<a href="${r.href}" target="${r.target}" style="text-decoration:none;">${g}</a>` : g;
1105
- return V(m, { padding: o, align: p });
1104
+ const o = l(e, "containerPadding", "10px"), n = ot(e.src), i = l(e, "alt"), s = kt(e), r = nt(e.src), a = r.maxWidth || l(e, "width", "100%"), d = l(e, "borderRadius", "0px"), c = l(e, "textAlign", l(e, "align", "center"));
1105
+ let h;
1106
+ a.includes("%") ? h = Math.round(t.columnWidth * (parseFloat(a) / 100)) : a === "auto" ? h = r.width || t.columnWidth : h = parseInt(a) || t.columnWidth;
1107
+ const g = d !== "0px" ? `border-radius:${d};` : "", u = `<img align="${c}" border="0" src="${n}" alt="${i}" title="${i}" style="display:block;border:0;height:auto;width:100%;max-width:${h}px;${g}" width="${h}" />`, f = s.href ? `<a href="${s.href}" target="${s.target}" style="text-decoration:none;">${u}</a>` : u;
1108
+ return L(f, { padding: o, align: c });
1106
1109
  }
1107
1110
  }
1108
- }, Dt = {
1111
+ }, Tt = {
1109
1112
  name: "button",
1110
1113
  label: "Button",
1111
1114
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="10" rx="2"/><path d="M12 7v10"/><path d="m8 12 4-3 4 3"/></svg>',
@@ -1192,24 +1195,24 @@ const $t = {
1192
1195
  },
1193
1196
  renderer: {
1194
1197
  renderEditor(e) {
1195
- const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "#3b82f6"), n = a(e, "textColor", "#ffffff"), i = a(e, "fontSize", "14px"), r = a(e, "fontWeight", "700"), s = a(e, "borderRadius", "4px"), l = a(e, "buttonPadding", "10px 20px"), d = a(e, "text", "Click Me"), p = a(e, "textAlign", "center"), h = a(e, "buttonWidth", "auto"), u = a(e, "borderWidth", "0px"), g = a(e, "borderColor", o), m = u !== "0px" ? `border:${u} solid ${g};` : "border:none;", x = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1196
- return c`
1197
- <div style="padding:${t};text-align:${p};">
1198
- <a style="${x}background-color:${o};color:${n};font-size:${i};font-weight:${r};border-radius:${s};padding:${l};text-decoration:none;text-align:center;${m}cursor:pointer;font-family:arial,helvetica,sans-serif;box-sizing:border-box;">${d}</a>
1198
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "buttonWidth", "auto"), g = l(e, "borderWidth", "0px"), u = l(e, "borderColor", o), f = g !== "0px" ? `border:${g} solid ${u};` : "border:none;", y = h === "auto" ? "display:inline-block;" : `display:block;width:${h};`;
1199
+ return p`
1200
+ <div style="padding:${t};text-align:${c};">
1201
+ <a style="${y}background-color:${o};color:${n};font-size:${i};font-weight:${s};border-radius:${r};padding:${a};text-decoration:none;text-align:center;${f}cursor:pointer;font-family:arial,helvetica,sans-serif;">${d}</a>
1199
1202
  </div>
1200
1203
  `;
1201
1204
  },
1202
1205
  renderHtml(e) {
1203
- const t = a(e, "containerPadding", "10px"), o = a(e, "backgroundColor", "#3b82f6"), n = a(e, "textColor", "#ffffff"), i = a(e, "fontSize", "14px"), r = a(e, "fontWeight", "700"), s = a(e, "borderRadius", "4px"), l = a(e, "buttonPadding", "10px 20px"), d = a(e, "text", "Click Me"), p = a(e, "textAlign", "center"), h = a(e, "href", "#"), u = a(e, "target", "_blank"), g = a(e, "borderWidth", "0px"), m = a(e, "borderColor", o), x = g !== "0px" ? `border:${g} solid ${m};` : "border:none;", f = vt(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: r, borderRadius: s }), y = f ? `${f}
1204
- <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", z = `<div align="${p}">
1205
- ${y}
1206
- <a href="${h}" target="${u}" style="box-sizing:border-box;display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${s};font-size:${i};font-weight:${r};padding:${l};font-family:arial,helvetica,sans-serif;${x}mso-border-alt:none;word-break:keep-all;"><span style="line-height:120%;">${d}</span></a>
1206
+ const t = l(e, "containerPadding", "10px"), o = l(e, "backgroundColor", "#3b82f6"), n = l(e, "textColor", "#ffffff"), i = l(e, "fontSize", "14px"), s = l(e, "fontWeight", "700"), r = l(e, "borderRadius", "4px"), a = l(e, "buttonPadding", "10px 20px"), d = l(e, "text", "Click Me"), c = l(e, "textAlign", "center"), h = l(e, "href", "#"), g = l(e, "target", "_blank"), u = l(e, "borderWidth", "0px"), f = l(e, "borderColor", o), y = u !== "0px" ? `border:${u} solid ${f};` : "border:none;", x = Ct(d, h, { bgColor: o, textColor: n, fontSize: i, fontWeight: s, borderRadius: r }), m = x ? `${x}
1207
+ <!--[if !mso]><!-->` : "<!--[if !mso]><!-->", v = `<div align="${c}">
1208
+ ${m}
1209
+ <a href="${h}" target="${g}" style="display:inline-block;text-decoration:none;text-align:center;color:${n};background-color:${o};border-radius:${r};font-size:${i};font-weight:${s};padding:${a};font-family:arial,helvetica,sans-serif;${y}mso-border-alt:none;"><span style="line-height:120%;">${d}</span></a>
1207
1210
  <!--<![endif]-->
1208
1211
  </div>`;
1209
- return V(z, { padding: t, align: p });
1212
+ return L(v, { padding: t, align: c });
1210
1213
  }
1211
1214
  }
1212
- }, St = {
1215
+ }, It = {
1213
1216
  name: "divider",
1214
1217
  label: "Divider",
1215
1218
  icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="12" x2="22" y2="12"/></svg>',
@@ -1256,53 +1259,53 @@ const $t = {
1256
1259
  },
1257
1260
  renderer: {
1258
1261
  renderEditor(e) {
1259
- const t = a(e, "containerPadding", "10px"), o = a(e, "width", "100%"), n = `${a(e, "borderTopWidth", "1px")} ${a(e, "borderTopStyle", "solid")} ${a(e, "borderTopColor", "#cccccc")}`;
1260
- return c`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1262
+ const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`;
1263
+ return p`<div style="padding:${t};"><div style="border-top:${n};width:${o};margin:0 auto;"></div></div>`;
1261
1264
  },
1262
1265
  renderHtml(e) {
1263
- const t = a(e, "containerPadding", "10px"), o = a(e, "width", "100%"), n = `${a(e, "borderTopWidth", "1px")} ${a(e, "borderTopStyle", "solid")} ${a(e, "borderTopColor", "#cccccc")}`, i = `<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="${o}" style="border-collapse:collapse;border-top:${n};"><tbody><tr><td style="font-size:0;line-height:0;">&nbsp;</td></tr></tbody></table>`;
1264
- return V(i, { padding: t, align: "center" });
1266
+ const t = l(e, "containerPadding", "10px"), o = l(e, "width", "100%"), n = `${l(e, "borderTopWidth", "1px")} ${l(e, "borderTopStyle", "solid")} ${l(e, "borderTopColor", "#cccccc")}`, i = `<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="${o}" style="border-collapse:collapse;border-top:${n};"><tbody><tr><td style="font-size:0;line-height:0;">&nbsp;</td></tr></tbody></table>`;
1267
+ return L(i, { padding: t, align: "center" });
1265
1268
  }
1266
1269
  }
1267
- }, Rt = [
1268
- $t,
1269
- kt,
1270
- Ct,
1270
+ }, Mt = [
1271
1271
  _t,
1272
1272
  Dt,
1273
- St
1274
- ], it = [
1273
+ St,
1274
+ Rt,
1275
+ Tt,
1276
+ It
1277
+ ], st = [
1275
1278
  {
1276
1279
  meta: { name: "html", label: "HTML", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>', position: 6 },
1277
- loader: () => import("./html-tool-YYfXkFIO.js").then((e) => e.htmlTool)
1280
+ loader: () => import("./html-tool-BxuBzfKP.js").then((e) => e.htmlTool)
1278
1281
  },
1279
1282
  {
1280
1283
  meta: { name: "social", label: "Social", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>', position: 8 },
1281
- loader: () => import("./social-tool-Ba7s8khr.js").then((e) => e.socialTool)
1284
+ loader: () => import("./social-tool-BY75hT3n.js").then((e) => e.socialTool)
1282
1285
  },
1283
1286
  {
1284
1287
  meta: { name: "menu", label: "Menu", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>', position: 9 },
1285
- loader: () => import("./menu-tool-Dus3qFoN.js").then((e) => e.menuTool)
1288
+ loader: () => import("./menu-tool-BZDYFgXW.js").then((e) => e.menuTool)
1286
1289
  },
1287
1290
  {
1288
1291
  meta: { name: "video", label: "Video", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>', position: 10 },
1289
- loader: () => import("./video-tool-3FQ9rHns.js").then((e) => e.videoTool)
1292
+ loader: () => import("./video-tool-DiIJBQpM.js").then((e) => e.videoTool)
1290
1293
  },
1291
1294
  {
1292
1295
  meta: { name: "timer", label: "Timer", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>', position: 11 },
1293
- loader: () => import("./timer-tool-YDsaHv7a.js").then((e) => e.timerTool)
1296
+ loader: () => import("./timer-tool-Dj9QeWtN.js").then((e) => e.timerTool)
1294
1297
  },
1295
1298
  {
1296
1299
  meta: { name: "table", label: "Table", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/></svg>', position: 12 },
1297
- loader: () => import("./table-tool-D8yaPASq.js").then((e) => e.tableTool)
1300
+ loader: () => import("./table-tool-Ep89kXMr.js").then((e) => e.tableTool)
1298
1301
  },
1299
1302
  {
1300
1303
  meta: { name: "form", label: "Form", icon: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h6"/></svg>', position: 13 },
1301
- loader: () => import("./form-tool-DShwYWpp.js").then((e) => e.formTool)
1304
+ loader: () => import("./form-tool-At5Uq7es.js").then((e) => e.formTool)
1302
1305
  }
1303
1306
  ];
1304
- function Mt(e, t, o) {
1305
- const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", s = o.textColor || "#000000", l = o.preheaderText || "", d = l ? `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${l}${"&zwnj;&nbsp;".repeat(80)}</div>` : "";
1307
+ function Pt(e, t, o) {
1308
+ const n = o.backgroundColor || "#e7e7e7", i = o.contentWidth || "600px", s = o.fontFamily?.value || "arial,helvetica,sans-serif", r = o.textColor || "#000000", a = o.preheaderText || "" || "&zwnj;", d = `<div style="display:none;font-size:1px;color:${n};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${a}${"&zwnj;&nbsp;".repeat(80)}</div>`;
1306
1309
  return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1307
1310
  <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
1308
1311
  <head>
@@ -1321,7 +1324,7 @@ function Mt(e, t, o) {
1321
1324
  </o:OfficeDocumentSettings>
1322
1325
  </xml></noscript>
1323
1326
  <style type="text/css">
1324
- table, td, th { font-family: ${r} !important; }
1327
+ table, td, th { font-family: ${s} !important; }
1325
1328
  </style>
1326
1329
  <![endif]-->
1327
1330
  <!--[if !mso]><!-->
@@ -1333,17 +1336,15 @@ function Mt(e, t, o) {
1333
1336
  body { margin: 0; padding: 0; }
1334
1337
  table, tr, td { vertical-align: top; border-collapse: collapse; }
1335
1338
  p { margin: 0; }
1336
- .ie-container table, .mso-container table { table-layout: fixed; }
1337
- * { line-height: inherit; }
1338
1339
  a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; }
1339
1340
  </style>
1340
1341
  </head>
1341
- <body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${s};">
1342
+ <body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${n};color:${r};">
1342
1343
  ${d}
1343
- <table id="u_body" style="border-collapse:collapse;table-layout:fixed;border-spacing:0;mso-table-lspace:0pt;mso-table-rspace:0pt;vertical-align:top;min-width:320px;margin:0 auto;background-color:${n};width:100%;" cellpadding="0" cellspacing="0" border="0">
1344
+ <table id="u_body" role="presentation" style="border-collapse:collapse;border-spacing:0;margin:0 auto;background-color:${n};width:100%;" cellpadding="0" cellspacing="0" border="0">
1344
1345
  <tbody>
1345
- <tr style="vertical-align:top;">
1346
- <td style="word-break:break-word;border-collapse:collapse !important;vertical-align:top;">
1346
+ <tr>
1347
+ <td style="vertical-align:top;">
1347
1348
  <!--[if (mso)|(IE)]><table width="${parseInt(i)}" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td><![endif]-->
1348
1349
  ${e}
1349
1350
  <!--[if (mso)|(IE)]></td></tr></table><![endif]-->
@@ -1354,74 +1355,63 @@ function Mt(e, t, o) {
1354
1355
  </body>
1355
1356
  </html>`;
1356
1357
  }
1357
- function Tt(e, t, o) {
1358
- const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", s = e.values.padding || "0px", l = e.cells.reduce((f, y) => f + y, 0), d = i ? `background-color:${i};` : "", p = e.values.backgroundImage?.url ? `background-image:url('${e.values.backgroundImage.url}');background-repeat:${e.values.backgroundImage.repeat ? "repeat" : "no-repeat"};background-position:center top;background-size:${e.values.backgroundImage.cover ? "cover" : "auto"};` : "", h = e.columns.map((f, y) => {
1359
- const R = Math.round(e.cells[y] / l * n);
1360
- return rt(f, R, r, t, o);
1361
- }), u = e.columns.length > 1;
1362
- let g;
1363
- if (u) {
1364
- const f = e.columns.map((y, R) => {
1365
- const z = Math.round(e.cells[R] / l * n), at = rt(y, z, r, t, o);
1366
- return `<!--[if (mso)|(IE)]><td align="center" width="${z}" style="width:${z}px;padding:0px;border:none;" valign="top"><![endif]-->
1367
- ${at}
1368
- <!--[if (mso)|(IE)]></td><![endif]-->`;
1369
- });
1370
- g = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr>${f.join(`
1371
- `)}</tr></table><![endif]-->
1372
-
1373
- <!--[if !mso]><!-->
1374
- <div style="max-width:${n}px;margin:0 auto;">
1375
- ${h.join(`
1376
- `)}
1377
- </div>
1378
- <!--<![endif]-->`;
1358
+ function Et(e, t, o) {
1359
+ const n = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", s = e.values.columnsBackgroundColor || "", r = e.values.padding || "0px", a = e.cells.reduce((m, w) => m + w, 0), d = i ? `background-color:${i};` : "", c = e.values.backgroundImage;
1360
+ let h = "";
1361
+ if (c?.url) {
1362
+ const m = c.repeat === !0 || c.repeat === "repeat" ? "repeat" : "no-repeat", w = c.cover === !0 ? "cover" : c.fullWidth === !0 ? "100% auto" : "auto", v = c.center !== !1 ? "center top" : "left top";
1363
+ h = `background-image:url('${c.url}');background-repeat:${m};background-position:${v};background-size:${w};`;
1364
+ }
1365
+ const g = e.columns.length > 1, u = e.columns.map((m, w) => {
1366
+ const v = Math.round(e.cells[w] / a * n);
1367
+ return { colHtml: Lt(m, v, s, t, o), colWidthPx: v };
1368
+ });
1369
+ let f;
1370
+ if (g) {
1371
+ const m = u.map(
1372
+ ({ colHtml: w, colWidthPx: v }) => `<!--[if (mso)|(IE)]><td align="center" width="${v}" style="width:${v}px;padding:0px;" valign="top"><![endif]-->${w}<!--[if (mso)|(IE)]></td><![endif]-->`
1373
+ );
1374
+ f = `<!--[if (mso)|(IE)]><table role="presentation" width="${n}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${m.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
1379
1375
  } else
1380
- g = h.join(`
1381
- `);
1382
- const m = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1383
- return `<div class="u_row${m}${x}" style="padding:${s};${d}${p}">
1384
- <div style="margin:0 auto;min-width:320px;max-width:${n}px;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;background-color:transparent;">
1385
- <div style="border-collapse:collapse;display:table;width:100%;height:100%;background-color:transparent;">
1386
- ${g}
1387
- </div>
1388
- </div>
1376
+ f = u.map(({ colHtml: m }) => m).join("");
1377
+ const y = e.values.hideDesktop ? " u_hide_desktop" : "", x = e.values.hideMobile ? " u_hide_mobile" : "";
1378
+ return `<div class="u_row${y}${x}" style="padding:${r};${d}${h}">
1379
+ <div style="margin:0 auto;max-width:${n}px;${g ? "font-size:0;" : ""}text-align:center;">${f}</div>
1389
1380
  </div>`;
1390
1381
  }
1391
- function rt(e, t, o, n, i) {
1392
- const r = e.values.backgroundColor || o || "", s = e.values.padding || "0px", l = e.values.borderRadius || "0px", d = r ? `background-color:${r};` : "", p = e.contents.map((h) => {
1393
- const u = i.get(h.type);
1394
- if (!u) return `<!-- unknown tool: ${h.type} -->`;
1395
- const g = {
1382
+ function Lt(e, t, o, n, i) {
1383
+ const s = e.values.backgroundColor || o || "", r = e.values.padding || "0px", a = e.values.borderRadius || "0px", d = s ? `background-color:${s};` : "", c = e.contents.map((h) => {
1384
+ const g = i.get(h.type);
1385
+ if (!g) return `<!-- unknown tool: ${h.type} -->`;
1386
+ const u = {
1396
1387
  columnWidth: t,
1397
1388
  displayMode: "email",
1398
1389
  contentWidth: parseInt(n.contentWidth || "600"),
1399
1390
  bodyValues: n
1400
1391
  };
1401
- let m = u(h.values, g);
1402
- const x = !!h.values.hideDesktop, f = !!h.values.hideMobile;
1403
- return (x || f) && (m = `<div class="${[x && "u_hide_desktop", f && "u_hide_mobile"].filter(Boolean).join(" ")}">${m}</div>`), m;
1392
+ let f = g(h.values, u);
1393
+ const y = !!h.values.hideDesktop, x = !!h.values.hideMobile;
1394
+ return (y || x) && (f = `<div class="${[y && "u_hide_desktop", x && "u_hide_mobile"].filter(Boolean).join(" ")}">${f}</div>`), f;
1404
1395
  }).join(`
1405
1396
  `);
1406
- return `<div class="u_column" style="max-width:${t}px;min-width:${Math.min(t, 320)}px;display:table-cell;vertical-align:top;">
1407
- <div style="height:100%;width:100% !important;border-radius:${l};-webkit-border-radius:${l};${d}">
1408
- <div style="box-sizing:border-box;height:100%;padding:${s};border:none;border-radius:${l};-webkit-border-radius:${l};">
1409
- ${p || '<!--[if (!mso)&(!IE)]><!--><div style="height:0;min-height:1px;font-size:0;">&nbsp;</div><!--<![endif]-->'}
1397
+ return `<div class="u_column" style="display:inline-block;vertical-align:top;width:${t}px;max-width:${t}px;font-size:14px;text-align:left;">
1398
+ <div style="width:100%;${d}${a !== "0px" ? `border-radius:${a};` : ""}">
1399
+ <div style="padding:${r};">
1400
+ ${c || "&nbsp;"}
1410
1401
  </div>
1411
1402
  </div>
1412
1403
  </div>`;
1413
1404
  }
1414
- function It(e) {
1405
+ function zt(e) {
1415
1406
  return `
1416
1407
  @media only screen and (min-width: ${e + 20}px) {
1417
- .u_row .u_column { display: table-cell; }
1408
+ .u_row .u_column { display: inline-block !important; }
1418
1409
  }
1419
1410
 
1420
1411
  @media only screen and (max-width: ${e + 20}px) {
1421
1412
  .u_row .u_column {
1422
1413
  display: block !important;
1423
1414
  width: 100% !important;
1424
- min-width: 320px !important;
1425
1415
  max-width: 100% !important;
1426
1416
  }
1427
1417
  .u_row {
@@ -1461,27 +1451,53 @@ function It(e) {
1461
1451
  .u_hide_mobile { display: block !important; }
1462
1452
  }`;
1463
1453
  }
1464
- function Pt(e, t, o) {
1465
- const n = e.body.values, i = parseInt(n.contentWidth || "600"), r = e.body.rows.map((u) => Tt(u, n, t)).join(`
1466
- `), s = It(i);
1467
- let l = Mt(r, s, n);
1454
+ const Vt = [
1455
+ "box-sizing",
1456
+ "float",
1457
+ "overflow-wrap",
1458
+ "word-break",
1459
+ "word-wrap",
1460
+ "outline",
1461
+ "cursor",
1462
+ "transition",
1463
+ "animation",
1464
+ "transform",
1465
+ "position",
1466
+ "z-index",
1467
+ "display:\\s*flex",
1468
+ "display:\\s*grid",
1469
+ "gap"
1470
+ ], At = new RegExp(
1471
+ `(?:;\\s*|^\\s*)(${Vt.join("|")})\\s*:[^;]*;?`,
1472
+ "gi"
1473
+ ), Bt = /var\(--[^)]*\)/gi;
1474
+ function Ot(e) {
1475
+ return e.replace(/style="([^"]*)"/gi, (t, o) => {
1476
+ let n = o;
1477
+ return n = n.replace(At, ""), n = n.replace(Bt, "inherit"), n = n.replace(/;\s*;/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), n ? `style="${n}"` : "";
1478
+ });
1479
+ }
1480
+ function Ht(e, t, o) {
1481
+ const n = e.body.values, i = parseInt(n.contentWidth || "600"), s = e.body.rows.map((u) => Et(u, n, t)).join(`
1482
+ `), r = zt(i), a = Ot(s);
1483
+ let d = Pt(a, r, n);
1468
1484
  if (o?.mergeTags)
1469
- for (const [u, g] of Object.entries(o.mergeTags))
1470
- l = l.replaceAll(`{{${u}}}`, g);
1471
- const d = l.match(/<body[^>]*>([\s\S]*)<\/body>/i), p = l.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), h = [];
1472
- return n.fontFamily?.url && h.push(n.fontFamily.url), {
1485
+ for (const [u, f] of Object.entries(o.mergeTags))
1486
+ d = d.replaceAll(`{{${u}}}`, f);
1487
+ const c = d.match(/<body[^>]*>([\s\S]*)<\/body>/i), h = d.match(/<style[^>]*>([\s\S]*?)<\/style>/gi), g = [];
1488
+ return n.fontFamily?.url && g.push(n.fontFamily.url), {
1473
1489
  design: structuredClone(e),
1474
- html: l,
1490
+ html: d,
1475
1491
  chunks: {
1476
- body: d?.[1] ?? r,
1477
- css: p?.map((u) => u.replace(/<\/?style[^>]*>/gi, "")).join(`
1478
- `) ?? s,
1479
- fonts: h,
1492
+ body: c?.[1] ?? s,
1493
+ css: h?.map((u) => u.replace(/<\/?style[^>]*>/gi, "")).join(`
1494
+ `) ?? r,
1495
+ fonts: g,
1480
1496
  js: ""
1481
1497
  }
1482
1498
  };
1483
1499
  }
1484
- class S {
1500
+ class T {
1485
1501
  /**
1486
1502
  * @param host - The Lit component that owns this controller
1487
1503
  * @param channels - Which store channels to subscribe to
@@ -1505,17 +1521,170 @@ class S {
1505
1521
  }));
1506
1522
  }
1507
1523
  }
1508
- var Vt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, W = (e, t, o, n) => {
1509
- for (var i = n > 1 ? void 0 : n ? zt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1510
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1511
- return n && i && Vt(t, o, i), i;
1524
+ var jt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, at = (e, t, o, n) => {
1525
+ for (var i = n > 1 ? void 0 : n ? Wt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1526
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1527
+ return n && i && jt(t, o, i), i;
1512
1528
  };
1513
- let _ = class extends v {
1529
+ let V = class extends $ {
1514
1530
  constructor() {
1515
- super(...arguments), this.storeCtrl = new S(this, ["design", "selection", "hover", "viewMode"]), this._onDragStart = (e) => {
1516
- e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", E.startContentDrag(this.content.id);
1531
+ super(...arguments), this.visible = !1;
1532
+ }
1533
+ exec(e, t) {
1534
+ document.execCommand(e, !1, t), this.requestUpdate();
1535
+ }
1536
+ isActive(e) {
1537
+ try {
1538
+ return document.queryCommandState(e);
1539
+ } catch {
1540
+ return !1;
1541
+ }
1542
+ }
1543
+ /** Position the toolbar above a given element */
1544
+ positionAbove(e) {
1545
+ const t = e.getBoundingClientRect();
1546
+ this.style.left = `${t.left + t.width / 2}px`, this.style.top = `${t.top - 8}px`, this.style.transform = "translate(-50%, -100%)", this.classList.add("visible");
1547
+ }
1548
+ hide() {
1549
+ this.classList.remove("visible");
1550
+ }
1551
+ handleLink() {
1552
+ if (this.isActive("createLink"))
1553
+ this.exec("unlink");
1554
+ else {
1555
+ const e = prompt("Enter URL:");
1556
+ e && this.exec("createLink", e);
1557
+ }
1558
+ }
1559
+ render() {
1560
+ return p`
1561
+ <div class="toolbar" @mousedown=${(e) => e.preventDefault()}>
1562
+ <button class="btn ${this.isActive("bold") ? "active" : ""}"
1563
+ @click=${() => this.exec("bold")} title="Bold (Ctrl+B)">
1564
+ <strong>B</strong>
1565
+ </button>
1566
+ <button class="btn ${this.isActive("italic") ? "active" : ""}"
1567
+ @click=${() => this.exec("italic")} title="Italic (Ctrl+I)">
1568
+ <em>I</em>
1569
+ </button>
1570
+ <button class="btn ${this.isActive("underline") ? "active" : ""}"
1571
+ @click=${() => this.exec("underline")} title="Underline (Ctrl+U)">
1572
+ <u>U</u>
1573
+ </button>
1574
+ <button class="btn ${this.isActive("strikeThrough") ? "active" : ""}"
1575
+ @click=${() => this.exec("strikeThrough")} title="Strikethrough">
1576
+ <s>S</s>
1577
+ </button>
1578
+ <div class="separator"></div>
1579
+ <button class="btn ${this.isActive("createLink") ? "active" : ""}"
1580
+ @click=${this.handleLink} title="Link">
1581
+ <svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
1582
+ </button>
1583
+ <div class="separator"></div>
1584
+ <button class="btn" @click=${() => this.exec("justifyLeft")} title="Align Left">
1585
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="18" y2="18"/></svg>
1586
+ </button>
1587
+ <button class="btn" @click=${() => this.exec("justifyCenter")} title="Align Center">
1588
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>
1589
+ </button>
1590
+ <button class="btn" @click=${() => this.exec("justifyRight")} title="Align Right">
1591
+ <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/></svg>
1592
+ </button>
1593
+ </div>
1594
+ `;
1595
+ }
1596
+ };
1597
+ V.styles = k`
1598
+ :host {
1599
+ position: fixed;
1600
+ z-index: 10000;
1601
+ display: none;
1602
+ }
1603
+ :host(.visible) {
1604
+ display: block;
1605
+ animation: fadeIn 0.15s ease;
1606
+ }
1607
+ @keyframes fadeIn {
1608
+ from { opacity: 0; transform: translateY(4px); }
1609
+ to { opacity: 1; transform: translateY(0); }
1610
+ }
1611
+ .toolbar {
1612
+ display: flex;
1613
+ align-items: center;
1614
+ gap: 2px;
1615
+ padding: 4px 6px;
1616
+ background: #1f2937;
1617
+ border-radius: 8px;
1618
+ box-shadow: 0 4px 16px rgba(0,0,0,0.2);
1619
+ }
1620
+ .btn {
1621
+ width: 32px;
1622
+ height: 32px;
1623
+ display: flex;
1624
+ align-items: center;
1625
+ justify-content: center;
1626
+ background: none;
1627
+ border: none;
1628
+ color: #d1d5db;
1629
+ cursor: pointer;
1630
+ border-radius: 4px;
1631
+ font-size: 14px;
1632
+ font-weight: 600;
1633
+ transition: all 0.1s ease;
1634
+ padding: 0;
1635
+ }
1636
+ .btn:hover { background: rgba(255,255,255,0.1); color: white; }
1637
+ .btn.active { background: rgba(59,130,246,0.3); color: #93c5fd; }
1638
+ .separator {
1639
+ width: 1px;
1640
+ height: 20px;
1641
+ background: #374151;
1642
+ margin: 0 2px;
1643
+ }
1644
+ .btn svg {
1645
+ width: 16px;
1646
+ height: 16px;
1647
+ stroke: currentColor;
1648
+ fill: none;
1649
+ stroke-width: 2;
1650
+ stroke-linecap: round;
1651
+ stroke-linejoin: round;
1652
+ }
1653
+ `;
1654
+ at([
1655
+ b({ type: Boolean })
1656
+ ], V.prototype, "visible", 2);
1657
+ V = at([
1658
+ C("me-inline-toolbar")
1659
+ ], V);
1660
+ var Ut = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, O = (e, t, o, n) => {
1661
+ for (var i = n > 1 ? void 0 : n ? Ft(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1662
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1663
+ return n && i && Ut(t, o, i), i;
1664
+ };
1665
+ const rt = /* @__PURE__ */ new Set(["text", "heading", "paragraph"]);
1666
+ function lt(e) {
1667
+ return e === "html" ? "html" : "text";
1668
+ }
1669
+ let D = class extends $ {
1670
+ constructor() {
1671
+ super(...arguments), this.storeCtrl = new T(this, ["design", "selection", "hover", "viewMode"]), this.editing = !1, this.toolbar = null, this.editableEl = null, this.saveDebounceTimer = null, this._onDragStart = (e) => {
1672
+ if (this.editing) {
1673
+ e.preventDefault();
1674
+ return;
1675
+ }
1676
+ e.dataTransfer.setData("application/maileditor-content", this.content.id), e.dataTransfer.effectAllowed = "move", this.style.opacity = "0.4", z.startContentDrag(this.content.id);
1517
1677
  }, this._onDragEnd = () => {
1518
- this.style.opacity = "1", E.reset();
1678
+ this.style.opacity = "1", z.reset();
1679
+ }, this.handleInlineInput = () => {
1680
+ this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer), this.saveDebounceTimer = setTimeout(() => this.saveInlineContent(), 500), this.showToolbar();
1681
+ }, this.handleInlineBlur = (e) => {
1682
+ const t = e.relatedTarget;
1683
+ t && (t.closest("me-inline-toolbar") || this.toolbar?.contains(t)) || setTimeout(() => {
1684
+ !this.shadowRoot?.activeElement && !this.toolbar?.matches(":hover") && this.stopEditing();
1685
+ }, 150);
1686
+ }, this.handleInlineKeydown = (e) => {
1687
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.stopEditing()), (e.key === "Delete" || e.key === "Backspace") && e.stopPropagation();
1519
1688
  };
1520
1689
  }
1521
1690
  set store(e) {
@@ -1524,8 +1693,12 @@ let _ = class extends v {
1524
1693
  get store() {
1525
1694
  return this.storeCtrl.store;
1526
1695
  }
1696
+ // ── Event handlers ───────────────────────────────────────
1527
1697
  handleClick(e) {
1528
- e.stopPropagation(), this.store.select(this.content.id);
1698
+ e.stopPropagation(), this.editing || this.store.select(this.content.id);
1699
+ }
1700
+ handleDblClick(e) {
1701
+ e.stopPropagation(), rt.has(this.content.type) && this.startEditing();
1529
1702
  }
1530
1703
  handleMouseEnter() {
1531
1704
  this.store.hover(this.content.id);
@@ -1539,52 +1712,118 @@ let _ = class extends v {
1539
1712
  handleDuplicate(e) {
1540
1713
  e.stopPropagation(), this.store.duplicateContent(this.content.id);
1541
1714
  }
1715
+ // ── Inline editing ───────────────────────────────────────
1716
+ startEditing() {
1717
+ this.editing = !0, this.classList.add("editing"), this.setAttribute("draggable", "false"), this.updateComplete.then(() => {
1718
+ const e = this.shadowRoot?.querySelector(".inline-editable");
1719
+ if (e) {
1720
+ this.editableEl = e, e.focus();
1721
+ const t = window.getSelection(), o = document.createRange();
1722
+ o.selectNodeContents(e), o.collapse(!1), t?.removeAllRanges(), t?.addRange(o), this.showToolbar();
1723
+ }
1724
+ });
1725
+ }
1726
+ stopEditing() {
1727
+ this.editing && (this.saveInlineContent(), this.editing = !1, this.classList.remove("editing"), this.setAttribute("draggable", "true"), this.editableEl = null, this.toolbar?.hide());
1728
+ }
1729
+ saveInlineContent() {
1730
+ if (!this.editableEl) return;
1731
+ const e = this.editableEl.innerHTML, t = lt(this.content.type), o = this.content.values[t];
1732
+ e !== o && this.store.updateContentValues(this.content.id, { [t]: e });
1733
+ }
1734
+ showToolbar() {
1735
+ this.toolbar || (this.toolbar = document.createElement("me-inline-toolbar"), document.body.appendChild(this.toolbar)), this.editableEl && this.toolbar.positionAbove(this.editableEl);
1736
+ }
1737
+ // ── Lifecycle ────────────────────────────────────────────
1542
1738
  connectedCallback() {
1543
1739
  super.connectedCallback(), this.addEventListener("dragstart", this._onDragStart), this.addEventListener("dragend", this._onDragEnd);
1544
1740
  }
1545
1741
  disconnectedCallback() {
1546
- super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd);
1742
+ super.disconnectedCallback(), this.removeEventListener("dragstart", this._onDragStart), this.removeEventListener("dragend", this._onDragEnd), this.toolbar?.remove(), this.toolbar = null, this.saveDebounceTimer && clearTimeout(this.saveDebounceTimer);
1547
1743
  }
1744
+ // ── Render ───────────────────────────────────────────────
1548
1745
  render() {
1549
- if (!this.store) return c``;
1550
- const e = this.store.selectedId === this.content.id, t = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, r = o === "desktop" && n || o === "mobile" && i;
1551
- this.classList.toggle("selected", e), this.classList.toggle("hovered", t), this.classList.toggle("hidden-in-view", r), this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id;
1552
- const s = this.toolRegistry.get(this.content.type);
1553
- if (!s && this.toolRegistry.has(this.content.type))
1554
- return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), c`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;font-family:sans-serif;">Loading ${this.content.type}...</div>`;
1555
- const l = s?.renderer.renderEditor(this.content.values, {
1746
+ if (!this.store) return p``;
1747
+ const e = this.store.selectedId === this.content.id, t = this.store.hoveredId === this.content.id, o = this.store.viewMode, n = !!this.content.values.hideDesktop, i = !!this.content.values.hideMobile, s = o === "desktop" && n || o === "mobile" && i;
1748
+ this.classList.toggle("selected", e && !this.editing), this.classList.toggle("hovered", t && !this.editing), this.classList.toggle("hidden-in-view", s), this.editing || this.setAttribute("draggable", "true"), this.dataset.contentId = this.content.id, this.editing && !e && this.stopEditing();
1749
+ const r = this.toolRegistry.get(this.content.type);
1750
+ if (!r && this.toolRegistry.has(this.content.type))
1751
+ return this.toolRegistry.ensureLoaded(this.content.type).then(() => this.requestUpdate()), p`<div style="padding:16px;text-align:center;color:#9ca3af;font-size:13px;">Loading ${this.content.type}...</div>`;
1752
+ const a = n ? "Hidden on desktop" : i ? "Hidden on mobile" : "", d = rt.has(this.content.type);
1753
+ if (this.editing && d && r) {
1754
+ const h = this.content.values, g = lt(this.content.type), u = h[g] || "", f = this.getInlineStyles(h);
1755
+ return p`
1756
+ <div class="content-wrapper">
1757
+ <div
1758
+ class="inline-editable"
1759
+ contenteditable="true"
1760
+ style=${f}
1761
+ .innerHTML=${u}
1762
+ @input=${this.handleInlineInput}
1763
+ @blur=${this.handleInlineBlur}
1764
+ @keydown=${this.handleInlineKeydown}
1765
+ ></div>
1766
+ </div>
1767
+ `;
1768
+ }
1769
+ const c = r?.renderer.renderEditor(this.content.values, {
1556
1770
  isSelected: e,
1557
1771
  isHovered: t,
1558
1772
  columnWidth: 600,
1559
1773
  displayMode: "email"
1560
1774
  });
1561
- return c`
1562
- ${r ? c`<div class="hidden-badge">${n ? "Hidden on desktop" : i ? "Hidden on mobile" : ""}</div>` : ""}
1775
+ return p`
1776
+ ${s ? p`<div class="hidden-badge">${a}</div>` : ""}
1563
1777
  <div class="action-bar">
1564
1778
  <button class="action-btn" @click=${this.handleDuplicate} title="Duplicate">&#9851;</button>
1565
1779
  <button class="action-btn" @click=${this.handleDelete} title="Delete">&#10005;</button>
1566
1780
  </div>
1567
- <div class="content-wrapper" @click=${this.handleClick}
1568
- @mouseenter=${this.handleMouseEnter} @mouseleave=${this.handleMouseLeave}>
1569
- ${l ?? c`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1781
+ <div class="content-wrapper"
1782
+ @click=${this.handleClick}
1783
+ @dblclick=${this.handleDblClick}
1784
+ @mouseenter=${this.handleMouseEnter}
1785
+ @mouseleave=${this.handleMouseLeave}>
1786
+ ${c ?? p`<div style="padding:10px;color:#999;font-style:italic;">Unknown tool: ${this.content.type}</div>`}
1570
1787
  </div>
1571
1788
  `;
1572
1789
  }
1790
+ /** Build inline CSS for the contenteditable area based on content values */
1791
+ getInlineStyles(e) {
1792
+ const t = [], o = (g, u = "") => {
1793
+ const f = e[g];
1794
+ return typeof f == "string" ? f : typeof f == "number" ? String(f) : u;
1795
+ };
1796
+ t.push(`padding:${o("containerPadding", "10px")}`);
1797
+ const n = o("backgroundColor");
1798
+ n && t.push(`background-color:${n}`);
1799
+ const i = o("color");
1800
+ i && t.push(`color:${i}`);
1801
+ const s = o("fontSize");
1802
+ s && t.push(`font-size:${s}`);
1803
+ const r = o("fontWeight");
1804
+ r && t.push(`font-weight:${r}`);
1805
+ const a = o("lineHeight", "140%");
1806
+ t.push(`line-height:${a}`);
1807
+ const d = o("textAlign");
1808
+ d && t.push(`text-align:${d}`);
1809
+ const c = o("letterSpacing");
1810
+ c && c !== "normal" && t.push(`letter-spacing:${c}`);
1811
+ const h = e.fontFamily;
1812
+ return typeof h == "string" ? t.push(`font-family:${h}`) : h && typeof h == "object" && t.push(`font-family:${h.value || "inherit"}`), t.push("word-break:break-word", "outline:none", "min-height:1em"), t.join(";");
1813
+ }
1573
1814
  };
1574
- _.styles = $`
1815
+ D.styles = k`
1575
1816
  :host {
1576
1817
  display: block; position: relative; cursor: pointer;
1577
1818
  transition: outline 0.15s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
1578
1819
  }
1579
1820
  :host(.selected) { outline: 2px solid #3b82f6; outline-offset: -1px; }
1580
1821
  :host(.hovered:not(.selected)) { outline: 2px dashed #93c5fd; outline-offset: -1px; }
1822
+ :host(.editing) { outline: 2px solid #8b5cf6; outline-offset: -1px; cursor: text; }
1581
1823
  :host(.just-dropped) {
1582
1824
  animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
1583
1825
  }
1584
- :host(.hidden-in-view) {
1585
- opacity: 0.3;
1586
- position: relative;
1587
- }
1826
+ :host(.hidden-in-view) { opacity: 0.3; position: relative; }
1588
1827
  .hidden-badge {
1589
1828
  position: absolute; top: 4px; right: 4px; z-index: 5;
1590
1829
  background: #f59e0b; color: white; font-size: 10px; font-weight: 600;
@@ -1599,34 +1838,45 @@ _.styles = $`
1599
1838
  display: none; position: absolute; top: -28px; right: 4px;
1600
1839
  background: #3b82f6; border-radius: 4px; padding: 2px; gap: 2px; z-index: 10;
1601
1840
  }
1602
- :host(.selected) .action-bar { display: flex; }
1841
+ :host(.selected:not(.editing)) .action-bar { display: flex; }
1603
1842
  .action-btn {
1604
1843
  background: none; border: none; color: white; cursor: pointer;
1605
1844
  padding: 2px 6px; font-size: 12px; line-height: 1; border-radius: 2px;
1606
1845
  }
1607
1846
  .action-btn:hover { background: rgba(255,255,255,0.2); }
1608
1847
  .content-wrapper { position: relative; }
1848
+ .inline-editable {
1849
+ outline: none;
1850
+ cursor: text;
1851
+ min-height: 1em;
1852
+ }
1853
+ .inline-editable:focus {
1854
+ outline: none;
1855
+ }
1609
1856
  `;
1610
- W([
1857
+ O([
1611
1858
  b({ attribute: !1 })
1612
- ], _.prototype, "content", 2);
1613
- W([
1859
+ ], D.prototype, "content", 2);
1860
+ O([
1614
1861
  b({ attribute: !1 })
1615
- ], _.prototype, "store", 1);
1616
- W([
1862
+ ], D.prototype, "store", 1);
1863
+ O([
1617
1864
  b({ attribute: !1 })
1618
- ], _.prototype, "toolRegistry", 2);
1619
- _ = W([
1620
- k("me-content-renderer")
1621
- ], _);
1622
- var Et = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, A = (e, t, o, n) => {
1623
- for (var i = n > 1 ? void 0 : n ? Lt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1624
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1625
- return n && i && Et(t, o, i), i;
1865
+ ], D.prototype, "toolRegistry", 2);
1866
+ O([
1867
+ pt()
1868
+ ], D.prototype, "editing", 2);
1869
+ D = O([
1870
+ C("me-content-renderer")
1871
+ ], D);
1872
+ var Nt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, H = (e, t, o, n) => {
1873
+ for (var i = n > 1 ? void 0 : n ? qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1874
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1875
+ return n && i && Nt(t, o, i), i;
1626
1876
  };
1627
- let w = class extends v {
1877
+ let S = class extends $ {
1628
1878
  constructor() {
1629
- super(...arguments), this.storeCtrl = new S(this, ["design"]), this.widthPercent = 100;
1879
+ super(...arguments), this.storeCtrl = new T(this, ["design"]), this.widthPercent = 100;
1630
1880
  }
1631
1881
  set store(e) {
1632
1882
  this.storeCtrl.setStore(e);
@@ -1636,13 +1886,13 @@ let w = class extends v {
1636
1886
  }
1637
1887
  render() {
1638
1888
  const e = this.column.values.padding || "0px", t = this.column.values.backgroundColor || "transparent", o = this.column.contents;
1639
- return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = e, this.style.backgroundColor = t, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? c`
1889
+ return this.dataset.columnId = this.column.id, this.style.width = `${this.widthPercent}%`, this.style.padding = e, this.style.backgroundColor = t, this.style.verticalAlign = "top", this.style.boxSizing = "border-box", o.length === 0 ? p`
1640
1890
  <div class="empty-column" data-column-id=${this.column.id}>
1641
1891
  Drag content here
1642
1892
  </div>
1643
- ` : c`
1893
+ ` : p`
1644
1894
  ${o.map(
1645
- (n) => c`
1895
+ (n) => p`
1646
1896
  <me-content-renderer
1647
1897
  .content=${n}
1648
1898
  .store=${this.store}
@@ -1653,7 +1903,7 @@ let w = class extends v {
1653
1903
  `;
1654
1904
  }
1655
1905
  };
1656
- w.styles = $`
1906
+ S.styles = k`
1657
1907
  :host {
1658
1908
  display: block;
1659
1909
  min-height: 40px;
@@ -1683,29 +1933,29 @@ w.styles = $`
1683
1933
  opacity: 1;
1684
1934
  }
1685
1935
  `;
1686
- A([
1936
+ H([
1687
1937
  b({ attribute: !1 })
1688
- ], w.prototype, "column", 2);
1689
- A([
1938
+ ], S.prototype, "column", 2);
1939
+ H([
1690
1940
  b({ attribute: !1 })
1691
- ], w.prototype, "store", 1);
1692
- A([
1941
+ ], S.prototype, "store", 1);
1942
+ H([
1693
1943
  b({ attribute: !1 })
1694
- ], w.prototype, "toolRegistry", 2);
1695
- A([
1944
+ ], S.prototype, "toolRegistry", 2);
1945
+ H([
1696
1946
  b({ type: Number })
1697
- ], w.prototype, "widthPercent", 2);
1698
- w = A([
1699
- k("me-column-renderer")
1700
- ], w);
1701
- var Bt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, U = (e, t, o, n) => {
1702
- for (var i = n > 1 ? void 0 : n ? At(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1703
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1704
- return n && i && Bt(t, o, i), i;
1947
+ ], S.prototype, "widthPercent", 2);
1948
+ S = H([
1949
+ C("me-column-renderer")
1950
+ ], S);
1951
+ var Gt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, F = (e, t, o, n) => {
1952
+ for (var i = n > 1 ? void 0 : n ? Kt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
1953
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
1954
+ return n && i && Gt(t, o, i), i;
1705
1955
  };
1706
- let D = class extends v {
1956
+ let R = class extends $ {
1707
1957
  constructor() {
1708
- super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
1958
+ super(...arguments), this.storeCtrl = new T(this, ["design", "viewMode"]);
1709
1959
  }
1710
1960
  set store(e) {
1711
1961
  this.storeCtrl.setStore(e);
@@ -1730,10 +1980,10 @@ let D = class extends v {
1730
1980
  e.stopPropagation(), this.store.removeRow(this.row.id);
1731
1981
  }
1732
1982
  render() {
1733
- if (!this.store) return c``;
1734
- const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", r = e.values.padding || "0px", s = e.cells.reduce((f, y) => f + y, 0), l = e.values.backgroundImage, d = typeof l == "object" && l?.url ? l.url : "", p = d ? `background-image:url('${d}');background-size:${l?.cover ? "cover" : "contain"};background-position:${l?.center ? "center" : "top left"};background-repeat:${l?.repeat ? "repeat" : "no-repeat"};` : "", h = t.viewMode, u = !!e.values.hideDesktop, g = !!e.values.hideMobile, m = h === "desktop" && u || h === "mobile" && g, x = u ? "Hidden on desktop" : g ? "Hidden on mobile" : "";
1735
- return this.classList.toggle("hidden-in-view", m), this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, c`
1736
- ${m ? c`<div class="row-hidden-badge">${x}</div>` : ""}
1983
+ if (!this.store) return p``;
1984
+ const { row: e, store: t, toolRegistry: o } = this, n = e.values.backgroundColor || "transparent", i = e.values.columnsBackgroundColor || "transparent", s = e.values.padding || "0px", r = e.cells.reduce((x, m) => x + m, 0), a = e.values.backgroundImage, d = typeof a == "object" && a?.url ? a.url : "", c = d ? `background-image:url('${d}');background-size:${a?.cover ? "cover" : "contain"};background-position:${a?.center ? "center" : "top left"};background-repeat:${a?.repeat ? "repeat" : "no-repeat"};` : "", h = t.viewMode, g = !!e.values.hideDesktop, u = !!e.values.hideMobile, f = h === "desktop" && g || h === "mobile" && u, y = g ? "Hidden on desktop" : u ? "Hidden on mobile" : "";
1985
+ return this.classList.toggle("hidden-in-view", f), this.setAttribute("draggable", "true"), this.dataset.rowId = e.id, p`
1986
+ ${f ? p`<div class="row-hidden-badge">${y}</div>` : ""}
1737
1987
  <div class="row-actions">
1738
1988
  <button class="row-action-btn" @click=${this.handleMoveUp} title="Move Up">
1739
1989
  <svg viewBox="0 0 24 24"><path d="M12 19V5"/><path d="m5 12 7-7 7 7"/></svg>
@@ -1750,16 +2000,16 @@ let D = class extends v {
1750
2000
  </div>
1751
2001
  <div
1752
2002
  class="row-wrapper"
1753
- style="background-color:${n};padding:${r};${p}"
2003
+ style="background-color:${n};padding:${s};${c}"
1754
2004
  >
1755
- ${e.columns.map((f, y) => {
1756
- const R = e.cells[y] / s * 100;
1757
- return c`
2005
+ ${e.columns.map((x, m) => {
2006
+ const w = e.cells[m] / r * 100;
2007
+ return p`
1758
2008
  <me-column-renderer
1759
- .column=${f}
2009
+ .column=${x}
1760
2010
  .store=${t}
1761
2011
  .toolRegistry=${o}
1762
- .widthPercent=${R}
2012
+ .widthPercent=${w}
1763
2013
  style="background-color:${i};"
1764
2014
  ></me-column-renderer>
1765
2015
  `;
@@ -1768,7 +2018,7 @@ let D = class extends v {
1768
2018
  `;
1769
2019
  }
1770
2020
  };
1771
- D.styles = $`
2021
+ R.styles = k`
1772
2022
  :host {
1773
2023
  display: block;
1774
2024
  position: relative;
@@ -1832,26 +2082,26 @@ D.styles = $`
1832
2082
  stroke-linejoin: round;
1833
2083
  }
1834
2084
  `;
1835
- U([
2085
+ F([
1836
2086
  b({ attribute: !1 })
1837
- ], D.prototype, "row", 2);
1838
- U([
2087
+ ], R.prototype, "row", 2);
2088
+ F([
1839
2089
  b({ attribute: !1 })
1840
- ], D.prototype, "store", 1);
1841
- U([
2090
+ ], R.prototype, "store", 1);
2091
+ F([
1842
2092
  b({ attribute: !1 })
1843
- ], D.prototype, "toolRegistry", 2);
1844
- D = U([
1845
- k("me-row-renderer")
1846
- ], D);
1847
- var Ot = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, K = (e, t, o, n) => {
1848
- for (var i = n > 1 ? void 0 : n ? jt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1849
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1850
- return n && i && Ot(t, o, i), i;
2093
+ ], R.prototype, "toolRegistry", 2);
2094
+ R = F([
2095
+ C("me-row-renderer")
2096
+ ], R);
2097
+ var Yt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2098
+ for (var i = n > 1 ? void 0 : n ? Jt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2099
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2100
+ return n && i && Yt(t, o, i), i;
1851
2101
  };
1852
- let T = class extends v {
2102
+ let M = class extends $ {
1853
2103
  constructor() {
1854
- super(...arguments), this.storeCtrl = new S(this, ["design", "viewMode"]);
2104
+ super(...arguments), this.storeCtrl = new T(this, ["design", "viewMode"]);
1855
2105
  }
1856
2106
  set store(e) {
1857
2107
  this.storeCtrl.setStore(e);
@@ -1867,7 +2117,7 @@ let T = class extends v {
1867
2117
  }
1868
2118
  render() {
1869
2119
  const e = this.store.getRows(), t = this.store.getBodyValues(), o = t.contentWidth || "600px", n = t.backgroundColor || "#e7e7e7", i = this.store.viewMode;
1870
- return c`
2120
+ return p`
1871
2121
  <div class="view-toggle">
1872
2122
  <button
1873
2123
  class="view-btn ${i === "desktop" ? "active" : ""}"
@@ -1884,15 +2134,15 @@ let T = class extends v {
1884
2134
  style="max-width:${i === "mobile" ? "375px" : o};background-color:${n};"
1885
2135
  @click=${this.handleCanvasClick}
1886
2136
  >
1887
- ${e.length === 0 ? c`
2137
+ ${e.length === 0 ? p`
1888
2138
  <div class="empty-canvas">
1889
2139
  <div class="empty-icon">&#9776;</div>
1890
2140
  <div>Drag a content block here</div>
1891
2141
  </div>
1892
2142
  ` : e.map(
1893
- (s) => c`
2143
+ (r) => p`
1894
2144
  <me-row-renderer
1895
- .row=${s}
2145
+ .row=${r}
1896
2146
  .store=${this.store}
1897
2147
  .toolRegistry=${this.toolRegistry}
1898
2148
  ></me-row-renderer>
@@ -1902,7 +2152,7 @@ let T = class extends v {
1902
2152
  `;
1903
2153
  }
1904
2154
  };
1905
- T.styles = $`
2155
+ M.styles = k`
1906
2156
  :host {
1907
2157
  display: block;
1908
2158
  flex: 1;
@@ -1956,21 +2206,21 @@ T.styles = $`
1956
2206
  color: white;
1957
2207
  }
1958
2208
  `;
1959
- K([
2209
+ J([
1960
2210
  b({ attribute: !1 })
1961
- ], T.prototype, "store", 1);
1962
- K([
2211
+ ], M.prototype, "store", 1);
2212
+ J([
1963
2213
  b({ attribute: !1 })
1964
- ], T.prototype, "toolRegistry", 2);
1965
- T = K([
1966
- k("me-editor-canvas")
1967
- ], T);
1968
- var Ht = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, st = (e, t, o, n) => {
1969
- for (var i = n > 1 ? void 0 : n ? Wt(t, o) : t, r = e.length - 1, s; r >= 0; r--)
1970
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
1971
- return n && i && Ht(t, o, i), i;
2214
+ ], M.prototype, "toolRegistry", 2);
2215
+ M = J([
2216
+ C("me-editor-canvas")
2217
+ ], M);
2218
+ var Xt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, dt = (e, t, o, n) => {
2219
+ for (var i = n > 1 ? void 0 : n ? Qt(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2220
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2221
+ return n && i && Xt(t, o, i), i;
1972
2222
  };
1973
- const q = [
2223
+ const G = [
1974
2224
  // System / email-safe fonts
1975
2225
  { label: "Arial", value: "arial,helvetica,sans-serif", url: "" },
1976
2226
  { label: "Helvetica", value: "helvetica,sans-serif", url: "" },
@@ -1991,9 +2241,9 @@ const q = [
1991
2241
  { label: "Rubik", value: "'Rubik',sans-serif", url: "https://fonts.googleapis.com/css?family=Rubik:400,700" },
1992
2242
  { label: "Source Sans Pro", value: "'Source Sans Pro',sans-serif", url: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" }
1993
2243
  ];
1994
- let L = class extends v {
2244
+ let A = class extends $ {
1995
2245
  constructor() {
1996
- super(...arguments), this.storeCtrl = new S(this, ["design"]);
2246
+ super(...arguments), this.storeCtrl = new T(this, ["design"]);
1997
2247
  }
1998
2248
  set store(e) {
1999
2249
  this.storeCtrl.setStore(e);
@@ -2009,7 +2259,7 @@ let L = class extends v {
2009
2259
  this.store.updateBodyValues({ linkStyle: { ...o, [e]: t } });
2010
2260
  }
2011
2261
  updateFontFamily(e) {
2012
- const t = q.find((n) => n.value === e), o = { label: t?.label || e, value: e };
2262
+ const t = G.find((n) => n.value === e), o = { label: t?.label || e, value: e };
2013
2263
  if (t?.url) {
2014
2264
  o.url = t.url;
2015
2265
  const n = `emabuild-font-${e.replace(/[^a-z]/gi, "")}`;
@@ -2022,7 +2272,7 @@ let L = class extends v {
2022
2272
  }
2023
2273
  render() {
2024
2274
  const e = this.store.getBodyValues();
2025
- return c`
2275
+ return p`
2026
2276
  ${this.renderColorField("Background Color", e.backgroundColor || "#e7e7e7", (t) => this.update_("backgroundColor", t))}
2027
2277
 
2028
2278
  <p class="section-title" style="margin-top:16px;">Content</p>
@@ -2034,7 +2284,7 @@ let L = class extends v {
2034
2284
  <div class="field">
2035
2285
  <label class="field-label">Content Align</label>
2036
2286
  <div class="align-group">
2037
- ${["left", "center", "right"].map((t) => c`
2287
+ ${["left", "center", "right"].map((t) => p`
2038
2288
  <button class="align-btn ${e.contentAlign === t ? "active" : ""}"
2039
2289
  @click=${() => this.update_("contentAlign", t)}>${t}</button>
2040
2290
  `)}
@@ -2046,10 +2296,10 @@ let L = class extends v {
2046
2296
  <label class="field-label">Font Family</label>
2047
2297
  <select class="input" @change=${(t) => this.updateFontFamily(t.target.value)}>
2048
2298
  <optgroup label="System Fonts">
2049
- ${q.filter((t) => !t.url).map((t) => c`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2299
+ ${G.filter((t) => !t.url).map((t) => p`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2050
2300
  </optgroup>
2051
2301
  <optgroup label="Google Fonts">
2052
- ${q.filter((t) => !!t.url).map((t) => c`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2302
+ ${G.filter((t) => !!t.url).map((t) => p`<option value=${t.value} ?selected=${e.fontFamily?.value === t.value}>${t.label}</option>`)}
2053
2303
  </optgroup>
2054
2304
  </select>
2055
2305
  </div>
@@ -2076,7 +2326,7 @@ let L = class extends v {
2076
2326
  }
2077
2327
  /** Reusable color field (swatch + hex input) */
2078
2328
  renderColorField(e, t, o) {
2079
- return c`
2329
+ return p`
2080
2330
  <div class="field">
2081
2331
  <label class="field-label">${e}</label>
2082
2332
  <div class="color-row">
@@ -2087,7 +2337,7 @@ let L = class extends v {
2087
2337
  `;
2088
2338
  }
2089
2339
  };
2090
- L.styles = $`
2340
+ A.styles = k`
2091
2341
  :host { display: block; }
2092
2342
  .section-title {
2093
2343
  font-size: 11px; font-weight: 600; text-transform: uppercase;
@@ -2112,20 +2362,20 @@ L.styles = $`
2112
2362
  }
2113
2363
  .align-btn.active { border-color: #3b82f6; background: #eff6ff; color: #3b82f6; }
2114
2364
  `;
2115
- st([
2365
+ dt([
2116
2366
  b({ attribute: !1 })
2117
- ], L.prototype, "store", 1);
2118
- L = st([
2119
- k("me-body-settings")
2120
- ], L);
2121
- var Ut = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, J = (e, t, o, n) => {
2122
- for (var i = n > 1 ? void 0 : n ? Ft(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2123
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2124
- return n && i && Ut(t, o, i), i;
2367
+ ], A.prototype, "store", 1);
2368
+ A = dt([
2369
+ C("me-body-settings")
2370
+ ], A);
2371
+ var Zt = Object.defineProperty, te = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2372
+ for (var i = n > 1 ? void 0 : n ? te(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2373
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2374
+ return n && i && Zt(t, o, i), i;
2125
2375
  };
2126
- let I = class extends v {
2376
+ let P = class extends $ {
2127
2377
  constructor() {
2128
- super(...arguments), this.storeCtrl = new S(this, ["activeTab"]);
2378
+ super(...arguments), this.storeCtrl = new T(this, ["activeTab"]);
2129
2379
  }
2130
2380
  set store(e) {
2131
2381
  this.storeCtrl.setStore(e);
@@ -2145,7 +2395,7 @@ let I = class extends v {
2145
2395
  }
2146
2396
  render() {
2147
2397
  const e = this.store.activeTab, t = this.toolRegistry.getAllMeta();
2148
- return c`
2398
+ return p`
2149
2399
  <div class="tabs">
2150
2400
  <button class="tab ${e === "content" ? "active" : ""}" @click=${() => this.store.setActiveTab("content")}>Content</button>
2151
2401
  <button class="tab ${e === "blocks" ? "active" : ""}" @click=${() => this.store.setActiveTab("blocks")}>Blocks</button>
@@ -2160,17 +2410,17 @@ let I = class extends v {
2160
2410
  `;
2161
2411
  }
2162
2412
  renderContentTab(e) {
2163
- return c`
2413
+ return p`
2164
2414
  <p class="section-title">Content</p>
2165
2415
  <div class="tool-grid">
2166
2416
  ${e.map(
2167
- (t) => c`
2417
+ (t) => p`
2168
2418
  <div
2169
2419
  class="tool-item"
2170
2420
  draggable="true"
2171
2421
  @dragstart=${(o) => this.handleDragStart(o, t.name)}
2172
2422
  >
2173
- <div class="tool-icon">${H(t.icon)}</div>
2423
+ <div class="tool-icon">${U(t.icon)}</div>
2174
2424
  <span>${t.label}</span>
2175
2425
  </div>
2176
2426
  `
@@ -2190,7 +2440,7 @@ let I = class extends v {
2190
2440
  }
2191
2441
  renderLayoutOption(e, t) {
2192
2442
  const o = e.reduce((n, i) => n + i, 0);
2193
- return c`
2443
+ return p`
2194
2444
  <div
2195
2445
  class="layout-item"
2196
2446
  draggable="true"
@@ -2199,23 +2449,23 @@ let I = class extends v {
2199
2449
  title=${t}
2200
2450
  >
2201
2451
  ${e.map(
2202
- (n) => c`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
2452
+ (n) => p`<div class="layout-col" style="width:${n / o * 100}%;"></div>`
2203
2453
  )}
2204
2454
  </div>
2205
2455
  `;
2206
2456
  }
2207
2457
  renderBlocksTab() {
2208
- return c`
2458
+ return p`
2209
2459
  <p style="color:#9ca3af;font-size:13px;text-align:center;margin-top:40px;">
2210
2460
  No saved blocks yet.<br/>Select a row in the editor and save it as a block.
2211
2461
  </p>
2212
2462
  `;
2213
2463
  }
2214
2464
  renderBodyTab() {
2215
- return c`<me-body-settings .store=${this.store}></me-body-settings>`;
2465
+ return p`<me-body-settings .store=${this.store}></me-body-settings>`;
2216
2466
  }
2217
2467
  };
2218
- I.styles = $`
2468
+ P.styles = k`
2219
2469
  :host {
2220
2470
  display: flex;
2221
2471
  flex-direction: column;
@@ -2349,18 +2599,18 @@ I.styles = $`
2349
2599
  transition: background 0.2s ease;
2350
2600
  }
2351
2601
  `;
2352
- J([
2602
+ X([
2353
2603
  b({ attribute: !1 })
2354
- ], I.prototype, "store", 1);
2355
- J([
2604
+ ], P.prototype, "store", 1);
2605
+ X([
2356
2606
  b({ attribute: !1 })
2357
- ], I.prototype, "toolRegistry", 2);
2358
- I = J([
2359
- k("me-editor-sidebar")
2360
- ], I);
2361
- function Nt(e, t, o) {
2607
+ ], P.prototype, "toolRegistry", 2);
2608
+ P = X([
2609
+ C("me-editor-sidebar")
2610
+ ], P);
2611
+ function ee(e, t, o) {
2362
2612
  const n = e && /^#[0-9a-fA-F]{3,8}$/.test(e) ? e : "#000000";
2363
- return c`
2613
+ return p`
2364
2614
  <div class="prop-row">
2365
2615
  <label class="prop-label">${o}</label>
2366
2616
  <div class="prop-color">
@@ -2372,23 +2622,23 @@ function Nt(e, t, o) {
2372
2622
  </div>
2373
2623
  `;
2374
2624
  }
2375
- function qt(e, t, o, n) {
2625
+ function oe(e, t, o, n) {
2376
2626
  const i = n?.options || [];
2377
- return c`
2627
+ return p`
2378
2628
  <div class="prop-row">
2379
2629
  <label class="prop-label">${o}</label>
2380
- <select class="prop-input" @change=${(r) => t(r.target.value)}>
2381
- ${i.map((r) => c`<option value=${r.value} ?selected=${e === r.value}>${r.label}</option>`)}
2630
+ <select class="prop-input" @change=${(s) => t(s.target.value)}>
2631
+ ${i.map((s) => p`<option value=${s.value} ?selected=${e === s.value}>${s.label}</option>`)}
2382
2632
  </select>
2383
2633
  </div>
2384
2634
  `;
2385
2635
  }
2386
- function Gt(e, t, o) {
2387
- return c`
2636
+ function ne(e, t, o) {
2637
+ return p`
2388
2638
  <div class="prop-row">
2389
2639
  <label class="prop-label">${o}</label>
2390
2640
  <div style="display:flex;gap:2px;">
2391
- ${["left", "center", "right"].map((n) => c`
2641
+ ${["left", "center", "right"].map((n) => p`
2392
2642
  <button
2393
2643
  style="flex:1;padding:6px;border:1px solid ${e === n ? "#3b82f6" : "#d1d5db"};background:${e === n ? "#eff6ff" : "white"};border-radius:4px;cursor:pointer;font-size:11px;text-transform:capitalize;color:${e === n ? "#3b82f6" : "#6b7280"};"
2394
2644
  @click=${() => t(n)}
@@ -2398,29 +2648,29 @@ function Gt(e, t, o) {
2398
2648
  </div>
2399
2649
  `;
2400
2650
  }
2401
- function Yt(e) {
2402
- const t = (e || "0px").split(/\s+/).map((s) => parseInt(s) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, r = t[3] ?? n;
2403
- return [o, n, i, r];
2651
+ function ie(e) {
2652
+ const t = (e || "0px").split(/\s+/).map((r) => parseInt(r) || 0), o = t[0], n = t[1] ?? o, i = t[2] ?? o, s = t[3] ?? n;
2653
+ return [o, n, i, s];
2404
2654
  }
2405
- function Kt(e, t, o, n) {
2655
+ function se(e, t, o, n) {
2406
2656
  return e === t && t === o && o === n ? `${e}px` : e === o && t === n ? `${e}px ${t}px` : `${e}px ${t}px ${o}px ${n}px`;
2407
2657
  }
2408
- function Jt(e, t, o) {
2409
- const [n, i, r, s] = Yt(e), l = (p, h, u, g) => t(Kt(p, h, u, g));
2410
- return c`
2658
+ function re(e, t, o) {
2659
+ const [n, i, s, r] = ie(e), a = (c, h, g, u) => t(se(c, h, g, u));
2660
+ return p`
2411
2661
  <div class="prop-row">
2412
2662
  <label class="prop-label">${o}</label>
2413
2663
  <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;">
2414
2664
  ${[
2415
- { label: "T", val: n, change: (p) => l(p, i, r, s) },
2416
- { label: "R", val: i, change: (p) => l(n, p, r, s) },
2417
- { label: "B", val: r, change: (p) => l(n, i, p, s) },
2418
- { label: "L", val: s, change: (p) => l(n, i, r, p) }
2419
- ].map((p) => c`
2665
+ { label: "T", val: n, change: (c) => a(c, i, s, r) },
2666
+ { label: "R", val: i, change: (c) => a(n, c, s, r) },
2667
+ { label: "B", val: s, change: (c) => a(n, i, c, r) },
2668
+ { label: "L", val: r, change: (c) => a(n, i, s, c) }
2669
+ ].map((c) => p`
2420
2670
  <div style="display:flex;align-items:center;gap:4px;">
2421
- <span style="font-size:10px;color:#9ca3af;width:12px;">${p.label}</span>
2422
- <input type="number" .value=${p.val} min="0"
2423
- @change=${(h) => p.change(parseInt(h.target.value) || 0)}
2671
+ <span style="font-size:10px;color:#9ca3af;width:12px;">${c.label}</span>
2672
+ <input type="number" .value=${c.val} min="0"
2673
+ @change=${(h) => c.change(parseInt(h.target.value) || 0)}
2424
2674
  style="flex:1;padding:4px 6px;border:1px solid #d1d5db;border-radius:3px;font-size:12px;width:50px;" />
2425
2675
  </div>
2426
2676
  `)}
@@ -2428,8 +2678,8 @@ function Jt(e, t, o) {
2428
2678
  </div>
2429
2679
  `;
2430
2680
  }
2431
- function Xt(e, t, o) {
2432
- return c`
2681
+ function le(e, t, o) {
2682
+ return p`
2433
2683
  <div class="prop-row">
2434
2684
  <div class="prop-toggle">
2435
2685
  <input type="checkbox" .checked=${!!e}
@@ -2439,8 +2689,8 @@ function Xt(e, t, o) {
2439
2689
  </div>
2440
2690
  `;
2441
2691
  }
2442
- function Qt(e, t, o) {
2443
- return c`
2692
+ function ae(e, t, o) {
2693
+ return p`
2444
2694
  <div class="prop-row">
2445
2695
  <label class="prop-label">${o}</label>
2446
2696
  <input class="prop-input" type="text" .value=${e ?? ""}
@@ -2448,8 +2698,8 @@ function Qt(e, t, o) {
2448
2698
  </div>
2449
2699
  `;
2450
2700
  }
2451
- function Zt(e, t, o) {
2452
- return c`
2701
+ function de(e, t, o) {
2702
+ return p`
2453
2703
  <div class="prop-row">
2454
2704
  <label class="prop-label">${o}</label>
2455
2705
  <textarea class="prop-input"
@@ -2460,14 +2710,14 @@ function Zt(e, t, o) {
2460
2710
  </div>
2461
2711
  `;
2462
2712
  }
2463
- var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, X = (e, t, o, n) => {
2464
- for (var i = n > 1 ? void 0 : n ? ee(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2465
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2466
- return n && i && te(t, o, i), i;
2713
+ var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, Q = (e, t, o, n) => {
2714
+ for (var i = n > 1 ? void 0 : n ? pe(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2715
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2716
+ return n && i && ce(t, o, i), i;
2467
2717
  };
2468
- let P = class extends v {
2718
+ let E = class extends $ {
2469
2719
  constructor() {
2470
- super(...arguments), this.storeCtrl = new S(this, ["design", "selection"]);
2720
+ super(...arguments), this.storeCtrl = new T(this, ["design", "selection"]);
2471
2721
  }
2472
2722
  set store(e) {
2473
2723
  this.storeCtrl.setStore(e);
@@ -2484,21 +2734,21 @@ let P = class extends v {
2484
2734
  render() {
2485
2735
  const e = this.store.selectedId;
2486
2736
  if (!e)
2487
- return c`<div class="no-selection">Select an element to edit its properties</div>`;
2737
+ return p`<div class="no-selection">Select an element to edit its properties</div>`;
2488
2738
  const t = this.store.findContent(e);
2489
2739
  if (!t)
2490
- return c`<div class="no-selection">Select an element to edit its properties</div>`;
2740
+ return p`<div class="no-selection">Select an element to edit its properties</div>`;
2491
2741
  const o = this.toolRegistry.get(t.type);
2492
- return o ? c`
2742
+ return o ? p`
2493
2743
  <div class="header">
2494
2744
  <p class="header-title">${o.label}</p>
2495
2745
  <p class="header-type">${t.type}</p>
2496
2746
  </div>
2497
2747
  ${Object.entries(o.options).map(([, n]) => this.renderGroup(t, n))}
2498
- ` : c`<div class="no-selection">Unknown tool: ${t.type}</div>`;
2748
+ ` : p`<div class="no-selection">Unknown tool: ${t.type}</div>`;
2499
2749
  }
2500
2750
  renderGroup(e, t) {
2501
- return c`
2751
+ return p`
2502
2752
  <div class="group">
2503
2753
  <div class="group-title">${t.title}</div>
2504
2754
  <div class="group-body">
@@ -2514,24 +2764,24 @@ let P = class extends v {
2514
2764
  const n = e.values[t] ?? o.defaultValue, i = this.onChange(e.id, t);
2515
2765
  switch (o.widget) {
2516
2766
  case "color_picker":
2517
- return Nt(n, i, o.label);
2767
+ return ee(n, i, o.label);
2518
2768
  case "toggle":
2519
- return Xt(n, i, o.label);
2769
+ return le(n, i, o.label);
2520
2770
  case "rich_text":
2521
- return Zt(n, i, o.label);
2771
+ return de(n, i, o.label);
2522
2772
  case "dropdown":
2523
- return qt(n, i, o.label, o.widgetParams);
2773
+ return oe(n, i, o.label, o.widgetParams);
2524
2774
  case "alignment":
2525
- return Gt(n, i, o.label);
2775
+ return ne(n, i, o.label);
2526
2776
  case "padding":
2527
- return Jt(n, i, o.label);
2777
+ return re(n, i, o.label);
2528
2778
  case "text":
2529
2779
  default:
2530
- return Qt(n, i, o.label);
2780
+ return ae(n, i, o.label);
2531
2781
  }
2532
2782
  }
2533
2783
  };
2534
- P.styles = $`
2784
+ E.styles = k`
2535
2785
  :host {
2536
2786
  display: flex; flex-direction: column; width: 300px; min-width: 300px;
2537
2787
  background: #fff; border-left: 1px solid #e5e7eb;
@@ -2565,26 +2815,26 @@ P.styles = $`
2565
2815
  .color-swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #d1d5db; cursor: pointer; padding: 0; }
2566
2816
  textarea.prop-input { min-height: 80px; resize: vertical; font-family: monospace; }
2567
2817
  `;
2568
- X([
2818
+ Q([
2569
2819
  b({ attribute: !1 })
2570
- ], P.prototype, "store", 1);
2571
- X([
2820
+ ], E.prototype, "store", 1);
2821
+ Q([
2572
2822
  b({ attribute: !1 })
2573
- ], P.prototype, "toolRegistry", 2);
2574
- P = X([
2575
- k("me-property-panel")
2576
- ], P);
2577
- var oe = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, lt = (e, t, o, n) => {
2578
- for (var i = n > 1 ? void 0 : n ? ne(t, o) : t, r = e.length - 1, s; r >= 0; r--)
2579
- (s = e[r]) && (i = (n ? s(t, o, i) : s(i)) || i);
2580
- return n && i && oe(t, o, i), i;
2823
+ ], E.prototype, "toolRegistry", 2);
2824
+ E = Q([
2825
+ C("me-property-panel")
2826
+ ], E);
2827
+ var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, ct = (e, t, o, n) => {
2828
+ for (var i = n > 1 ? void 0 : n ? ue(t, o) : t, s = e.length - 1, r; s >= 0; s--)
2829
+ (r = e[s]) && (i = (n ? r(t, o, i) : r(i)) || i);
2830
+ return n && i && he(t, o, i), i;
2581
2831
  };
2582
- let B = class extends v {
2832
+ let B = class extends $ {
2583
2833
  constructor() {
2584
- super(...arguments), this.options = {}, this.store = new mt(), this.toolRegistry = new xt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2834
+ super(...arguments), this.options = {}, this.store = new wt(), this.toolRegistry = new vt(), this.dragManager = null, this.callbacks = /* @__PURE__ */ new Map(), this.unsubscribe = null, this._handleKeydown = (e) => {
2585
2835
  const t = e.metaKey || e.ctrlKey, n = e.composedPath().some((i) => {
2586
- const r = i?.tagName;
2587
- return r === "INPUT" || r === "TEXTAREA" || r === "SELECT";
2836
+ const s = i?.tagName;
2837
+ return s === "INPUT" || s === "TEXTAREA" || s === "SELECT";
2588
2838
  });
2589
2839
  n && !t || (t && e.key === "z" && !e.shiftKey ? (e.preventDefault(), this.store.undo()) : t && (e.key === "y" || e.key === "z" && e.shiftKey) ? (e.preventDefault(), this.store.redo()) : (e.key === "Delete" || e.key === "Backspace") && this.store.selectedId && !n ? (e.preventDefault(), this.store.removeContent(this.store.selectedId)) : e.key === "Escape" && this.store.select(null));
2590
2840
  };
@@ -2593,7 +2843,7 @@ let B = class extends v {
2593
2843
  super.connectedCallback(), this.registerBuiltInTools(), this.applyOptions(), this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this._handleKeydown);
2594
2844
  }
2595
2845
  firstUpdated() {
2596
- this.dragManager = new yt(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2846
+ this.dragManager = new $t(this.store, this.toolRegistry, this.shadowRoot), this.dragManager.attach(), this.store.events.on("design:loaded", (e) => {
2597
2847
  this.dispatchEvent(new CustomEvent("design:loaded", { detail: e, bubbles: !0, composed: !0 }));
2598
2848
  }), this.store.events.on("design:updated", (e) => {
2599
2849
  this.dispatchEvent(new CustomEvent("design:updated", { detail: e, bubbles: !0, composed: !0 }));
@@ -2613,18 +2863,18 @@ let B = class extends v {
2613
2863
  }
2614
2864
  exportHtml(e, t) {
2615
2865
  const o = this.store.getDesign(), n = /* @__PURE__ */ new Set();
2616
- for (const r of o.body.rows)
2617
- for (const s of r.columns)
2618
- for (const l of s.contents)
2619
- n.add(l.type);
2620
- const i = Array.from(n).filter((r) => !this.toolRegistry.isLoaded(r)).map((r) => this.toolRegistry.ensureLoaded(r));
2866
+ for (const s of o.body.rows)
2867
+ for (const r of s.columns)
2868
+ for (const a of r.contents)
2869
+ n.add(a.type);
2870
+ const i = Array.from(n).filter((s) => !this.toolRegistry.isLoaded(s)).map((s) => this.toolRegistry.ensureLoaded(s));
2621
2871
  i.length > 0 ? Promise.all(i).then(() => this.doExport(o, e, t)) : this.doExport(o, e, t);
2622
2872
  }
2623
2873
  doExport(e, t, o) {
2624
2874
  const n = /* @__PURE__ */ new Map();
2625
2875
  for (const i of this.toolRegistry.getAll())
2626
- n.set(i.name, (r, s) => i.renderer.renderHtml(r, s));
2627
- t(Pt(e, n, o));
2876
+ n.set(i.name, (s, r) => i.renderer.renderHtml(s, r));
2877
+ t(Ht(e, n, o));
2628
2878
  }
2629
2879
  async exportHtmlAsync(e) {
2630
2880
  return new Promise((t) => this.exportHtml(t, e));
@@ -2660,22 +2910,22 @@ let B = class extends v {
2660
2910
  */
2661
2911
  preloadLazyTools() {
2662
2912
  const e = window.requestIdleCallback ?? ((t) => setTimeout(t, 1e3));
2663
- for (const { meta: t } of it)
2913
+ for (const { meta: t } of st)
2664
2914
  e(() => {
2665
2915
  this.toolRegistry.ensureLoaded(t.name);
2666
2916
  });
2667
2917
  }
2668
2918
  registerBuiltInTools() {
2669
- for (const e of Rt)
2919
+ for (const e of Mt)
2670
2920
  this.toolRegistry.register(e);
2671
- for (const { meta: e, loader: t } of it)
2921
+ for (const { meta: e, loader: t } of st)
2672
2922
  this.toolRegistry.registerLazy(e, t);
2673
2923
  }
2674
2924
  applyOptions() {
2675
2925
  this.options.design && this.store.loadDesign(this.options.design);
2676
2926
  }
2677
2927
  render() {
2678
- return c`
2928
+ return p`
2679
2929
  <me-editor-sidebar
2680
2930
  .store=${this.store}
2681
2931
  .toolRegistry=${this.toolRegistry}
@@ -2691,7 +2941,7 @@ let B = class extends v {
2691
2941
  `;
2692
2942
  }
2693
2943
  };
2694
- B.styles = $`
2944
+ B.styles = k`
2695
2945
  :host {
2696
2946
  display: flex;
2697
2947
  width: 100%;
@@ -2706,31 +2956,32 @@ B.styles = $`
2706
2956
  }
2707
2957
  * { box-sizing: border-box; }
2708
2958
  `;
2709
- lt([
2959
+ ct([
2710
2960
  b({ type: Object })
2711
2961
  ], B.prototype, "options", 2);
2712
- B = lt([
2713
- k("mail-editor")
2962
+ B = ct([
2963
+ C("mail-editor")
2714
2964
  ], B);
2715
- function C(e, t) {
2965
+ function _(e, t) {
2716
2966
  customElements.get(e) || customElements.define(e, t);
2717
2967
  }
2718
- C("mail-editor", B);
2719
- C("me-editor-canvas", T);
2720
- C("me-row-renderer", D);
2721
- C("me-column-renderer", w);
2722
- C("me-content-renderer", _);
2723
- C("me-editor-sidebar", I);
2724
- C("me-body-settings", L);
2725
- C("me-property-panel", P);
2726
- const ae = customElements.get("mail-editor") !== void 0;
2968
+ _("mail-editor", B);
2969
+ _("me-editor-canvas", M);
2970
+ _("me-row-renderer", R);
2971
+ _("me-column-renderer", S);
2972
+ _("me-content-renderer", D);
2973
+ _("me-editor-sidebar", P);
2974
+ _("me-body-settings", A);
2975
+ _("me-property-panel", E);
2976
+ _("me-inline-toolbar", V);
2977
+ const xe = customElements.get("mail-editor") !== void 0;
2727
2978
  export {
2728
- ae as E,
2979
+ xe as E,
2729
2980
  B as M,
2730
- xt as T,
2731
- mt as a,
2732
- V as e,
2733
- le as j,
2734
- a as s
2981
+ vt as T,
2982
+ wt as a,
2983
+ L as e,
2984
+ me as j,
2985
+ l as s
2735
2986
  };
2736
- //# sourceMappingURL=index-BQJRD2VW.js.map
2987
+ //# sourceMappingURL=index-BTE3G6Ph.js.map