@lit-pigeon/editor 0.3.2 → 0.3.3

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.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { css as b, LitElement as g, html as l, nothing as te } from "lit";
2
2
  import { property as p, state as d, customElement as u } from "lit/decorators.js";
3
3
  import { t as s, c as Bt, r as po } from "./templates.js";
4
4
  import { P as Kr } from "./templates.js";
5
- import { getAllBlockDefinitions as co, getBlockDefinition as yt, updateBlock as ct, createBlock as Ye, insertBlock as ce, createColumn as Ie, insertRow as oe, createRow as Pe, cloneRowWithNewIds as jt, createBodySelection as Rt, deleteBlock as ho, deleteRow as Lt, duplicateBlock as go, duplicateRow as zt, generateId as Mt, EditorState as Ht, createHistoryPlugin as Ft, undo as uo, redo as bo, InMemoryTemplateStorage as vo, InMemoryRowLibraryStorage as fo, SYSTEM_LINK_TYPES as mo, createDocStep as dt, createDefaultDocument as _o, HISTORY_PLUGIN_NAME as Nt, canUndo as yo, canRedo as xo, createBlockSelection as ht, createRowSelection as Ut, createColumnSelection as $o, moveRow as wo, moveBlock as ko, updateRowAttributes as Co, addColumn as Io, removeColumn as Po, resizeColumns as To } from "@lit-pigeon/core";
5
+ import { getAllBlockDefinitions as co, getBlockDefinition as yt, updateBlock as ct, createBlock as Ve, insertBlock as ce, createColumn as Ie, insertRow as oe, createRow as Te, cloneRowWithNewIds as jt, createBodySelection as Mt, deleteBlock as ho, deleteRow as Rt, duplicateBlock as go, duplicateRow as Lt, generateId as zt, EditorState as Ht, createHistoryPlugin as Ft, undo as uo, redo as bo, InMemoryTemplateStorage as vo, InMemoryRowLibraryStorage as fo, SYSTEM_LINK_TYPES as mo, createDocStep as dt, createDefaultDocument as _o, HISTORY_PLUGIN_NAME as Nt, canUndo as yo, canRedo as xo, createBlockSelection as ht, createRowSelection as Ut, createColumnSelection as $o, moveRow as wo, moveBlock as ko, updateRowAttributes as Co, addColumn as Io, removeColumn as To, resizeColumns as Po } from "@lit-pigeon/core";
6
6
  import { unsafeHTML as eo } from "lit/directives/unsafe-html.js";
7
7
  import { l as xt, r as So } from "./rich-text-bridge.js";
8
8
  import { styleMap as Oo } from "lit/directives/style-map.js";
@@ -43,7 +43,7 @@ const Kt = b`
43
43
  0 2px 4px -2px rgb(0 0 0 / 0.4);
44
44
  --pigeon-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5),
45
45
  0 4px 6px -4px rgb(0 0 0 / 0.5);
46
- `, Do = b`
46
+ `, Eo = b`
47
47
  :host {
48
48
  /* base palette */
49
49
  --pigeon-bg: #ffffff;
@@ -113,12 +113,12 @@ const Kt = b`
113
113
  }
114
114
  }
115
115
  `;
116
- var Eo = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, xe = (e, t, o, r) => {
116
+ var Do = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, xe = (e, t, o, r) => {
117
117
  for (var i = r > 1 ? void 0 : r ? Ao(t, o) : t, n = e.length - 1, a; n >= 0; n--)
118
118
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
119
- return r && i && Eo(t, o, i), i;
119
+ return r && i && Do(t, o, i), i;
120
120
  };
121
- let K = class extends g {
121
+ let V = class extends g {
122
122
  constructor() {
123
123
  super(...arguments), this.canUndo = !1, this.canRedo = !1, this.device = "desktop", this.fullscreen = !1, this._exportMenuOpen = !1;
124
124
  }
@@ -319,7 +319,10 @@ let K = class extends g {
319
319
  }));
320
320
  }
321
321
  _toggleExportMenu() {
322
- this._exportMenuOpen = !this._exportMenuOpen;
322
+ this._exportMenuOpen = !this._exportMenuOpen, this._exportMenuOpen && this.dispatchEvent(new CustomEvent("toolbar-export", {
323
+ bubbles: !0,
324
+ composed: !0
325
+ }));
323
326
  }
324
327
  _onExportHtml() {
325
328
  this._exportMenuOpen = !1, this.dispatchEvent(new CustomEvent("pigeon:export-html", {
@@ -340,7 +343,7 @@ let K = class extends g {
340
343
  }));
341
344
  }
342
345
  };
343
- K.styles = b`
346
+ V.styles = b`
344
347
  :host {
345
348
  display: flex;
346
349
  align-items: center;
@@ -472,27 +475,27 @@ K.styles = b`
472
475
  `;
473
476
  xe([
474
477
  p({ type: Boolean, attribute: "can-undo" })
475
- ], K.prototype, "canUndo", 2);
478
+ ], V.prototype, "canUndo", 2);
476
479
  xe([
477
480
  p({ type: Boolean, attribute: "can-redo" })
478
- ], K.prototype, "canRedo", 2);
481
+ ], V.prototype, "canRedo", 2);
479
482
  xe([
480
483
  p({ type: String })
481
- ], K.prototype, "device", 2);
484
+ ], V.prototype, "device", 2);
482
485
  xe([
483
486
  p({ type: Boolean })
484
- ], K.prototype, "fullscreen", 2);
487
+ ], V.prototype, "fullscreen", 2);
485
488
  xe([
486
489
  d()
487
- ], K.prototype, "_exportMenuOpen", 2);
488
- K = xe([
490
+ ], V.prototype, "_exportMenuOpen", 2);
491
+ V = xe([
489
492
  u("pigeon-toolbar")
490
- ], K);
493
+ ], V);
491
494
  let $t = null;
492
495
  function Bo(e) {
493
496
  $t = e;
494
497
  }
495
- function De() {
498
+ function Ee() {
496
499
  return $t;
497
500
  }
498
501
  function Xe() {
@@ -508,14 +511,14 @@ function Fr(e) {
508
511
  if (t) return JSON.parse(t);
509
512
  } catch {
510
513
  }
511
- return De();
514
+ return Ee();
512
515
  }
513
- var jo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, $e = (e, t, o, r) => {
514
- for (var i = r > 1 ? void 0 : r ? Ro(t, o) : t, n = e.length - 1, a; n >= 0; n--)
516
+ var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, $e = (e, t, o, r) => {
517
+ for (var i = r > 1 ? void 0 : r ? Mo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
515
518
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
516
519
  return r && i && jo(t, o, i), i;
517
520
  };
518
- const Lo = {
521
+ const Ro = {
519
522
  text: "T",
520
523
  image: "[]",
521
524
  button: "[B]",
@@ -524,12 +527,12 @@ const Lo = {
524
527
  social: "@",
525
528
  html: "</>"
526
529
  };
527
- let W = class extends g {
530
+ let Y = class extends g {
528
531
  constructor() {
529
532
  super(...arguments), this.label = "", this.icon = "", this.dragType = "palette-block", this.blockType = "", this.columnCount = 1, this._didDrag = !1;
530
533
  }
531
534
  render() {
532
- const e = Lo[this.icon] ?? this.icon ?? "?", t = this.dragType === "palette-row" ? "Add layout" : "Add block";
535
+ const e = Ro[this.icon] ?? this.icon ?? "?", t = this.dragType === "palette-row" ? "Add layout" : "Add block";
533
536
  return l`
534
537
  <div
535
538
  class="item"
@@ -597,7 +600,7 @@ let W = class extends g {
597
600
  }));
598
601
  }
599
602
  };
600
- W.styles = b`
603
+ Y.styles = b`
601
604
  :host {
602
605
  display: block;
603
606
  }
@@ -657,26 +660,26 @@ W.styles = b`
657
660
  `;
658
661
  $e([
659
662
  p({ type: String })
660
- ], W.prototype, "label", 2);
663
+ ], Y.prototype, "label", 2);
661
664
  $e([
662
665
  p({ type: String })
663
- ], W.prototype, "icon", 2);
666
+ ], Y.prototype, "icon", 2);
664
667
  $e([
665
668
  p({ type: String, attribute: "drag-type" })
666
- ], W.prototype, "dragType", 2);
669
+ ], Y.prototype, "dragType", 2);
667
670
  $e([
668
671
  p({ type: String, attribute: "block-type" })
669
- ], W.prototype, "blockType", 2);
672
+ ], Y.prototype, "blockType", 2);
670
673
  $e([
671
674
  p({ type: Number, attribute: "column-count" })
672
- ], W.prototype, "columnCount", 2);
673
- W = $e([
675
+ ], Y.prototype, "columnCount", 2);
676
+ Y = $e([
674
677
  u("pigeon-palette-item")
675
- ], W);
676
- var zo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, kt = (e, t, o, r) => {
677
- for (var i = r > 1 ? void 0 : r ? Mo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
678
+ ], Y);
679
+ var Lo = Object.defineProperty, zo = Object.getOwnPropertyDescriptor, kt = (e, t, o, r) => {
680
+ for (var i = r > 1 ? void 0 : r ? zo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
678
681
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
679
- return r && i && zo(t, o, i), i;
682
+ return r && i && Lo(t, o, i), i;
680
683
  };
681
684
  const Ho = {
682
685
  text: "T",
@@ -689,7 +692,7 @@ const Ho = {
689
692
  hero: "H",
690
693
  navbar: "Nav"
691
694
  };
692
- let Ee = class extends g {
695
+ let De = class extends g {
693
696
  constructor() {
694
697
  super(...arguments), this.selection = null;
695
698
  }
@@ -748,7 +751,7 @@ let Ee = class extends g {
748
751
  }));
749
752
  }
750
753
  };
751
- Ee.styles = b`
754
+ De.styles = b`
752
755
  :host {
753
756
  display: block;
754
757
  font-family: var(--pigeon-font);
@@ -814,14 +817,14 @@ Ee.styles = b`
814
817
  `;
815
818
  kt([
816
819
  p({ type: Object })
817
- ], Ee.prototype, "doc", 2);
820
+ ], De.prototype, "doc", 2);
818
821
  kt([
819
822
  p({ type: Object })
820
- ], Ee.prototype, "selection", 2);
821
- Ee = kt([
823
+ ], De.prototype, "selection", 2);
824
+ De = kt([
822
825
  u("pigeon-layers")
823
- ], Ee);
824
- var Fo = Object.defineProperty, No = Object.getOwnPropertyDescriptor, M = (e, t, o, r) => {
826
+ ], De);
827
+ var Fo = Object.defineProperty, No = Object.getOwnPropertyDescriptor, H = (e, t, o, r) => {
825
828
  for (var i = r > 1 ? void 0 : r ? No(t, o) : t, n = e.length - 1, a; n >= 0; n--)
826
829
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
827
830
  return r && i && Fo(t, o, i), i;
@@ -840,7 +843,7 @@ const Wo = [
840
843
  { labelKey: "palette.layout.3-col", columns: 3, icon: "[|||]" },
841
844
  { labelKey: "palette.layout.4-col", columns: 4, icon: "[||||]" }
842
845
  ];
843
- let I = class extends g {
846
+ let T = class extends g {
844
847
  constructor() {
845
848
  super(...arguments), this.selection = null, this.brandKit = null, this.rowLibrary = null, this._blockDefs = [], this._activeTab = "content", this._brandTabLoaded = !1, this._savedTabLoaded = !1, this._handleBrandTabClick = async () => {
846
849
  this._activeTab = "brand", this._brandTabLoaded || (await Uo(), this._brandTabLoaded = !0);
@@ -950,7 +953,7 @@ let I = class extends g {
950
953
  return this._savedTabLoaded ? l`<pigeon-saved-tab .storage=${this.rowLibrary}></pigeon-saved-tab>` : l``;
951
954
  }
952
955
  };
953
- I.styles = b`
956
+ T.styles = b`
954
957
  :host {
955
958
  display: block;
956
959
  width: var(--pigeon-palette-width, 240px);
@@ -1029,34 +1032,34 @@ I.styles = b`
1029
1032
  gap: 6px;
1030
1033
  }
1031
1034
  `;
1032
- M([
1035
+ H([
1033
1036
  p({ type: Object })
1034
- ], I.prototype, "doc", 2);
1035
- M([
1037
+ ], T.prototype, "doc", 2);
1038
+ H([
1036
1039
  p({ type: Object })
1037
- ], I.prototype, "selection", 2);
1038
- M([
1040
+ ], T.prototype, "selection", 2);
1041
+ H([
1039
1042
  p({ attribute: !1 })
1040
- ], I.prototype, "brandKit", 2);
1041
- M([
1043
+ ], T.prototype, "brandKit", 2);
1044
+ H([
1042
1045
  p({ attribute: !1 })
1043
- ], I.prototype, "rowLibrary", 2);
1044
- M([
1046
+ ], T.prototype, "rowLibrary", 2);
1047
+ H([
1045
1048
  d()
1046
- ], I.prototype, "_blockDefs", 2);
1047
- M([
1049
+ ], T.prototype, "_blockDefs", 2);
1050
+ H([
1048
1051
  d()
1049
- ], I.prototype, "_activeTab", 2);
1050
- M([
1052
+ ], T.prototype, "_activeTab", 2);
1053
+ H([
1051
1054
  d()
1052
- ], I.prototype, "_brandTabLoaded", 2);
1053
- M([
1055
+ ], T.prototype, "_brandTabLoaded", 2);
1056
+ H([
1054
1057
  d()
1055
- ], I.prototype, "_savedTabLoaded", 2);
1056
- I = M([
1058
+ ], T.prototype, "_savedTabLoaded", 2);
1059
+ T = H([
1057
1060
  u("pigeon-palette")
1058
- ], I);
1059
- function Vo(e, t) {
1061
+ ], T);
1062
+ function qo(e, t) {
1060
1063
  if (t.length === 0) return 0;
1061
1064
  for (let o = 0; o < t.length; o++) {
1062
1065
  const r = t[o].getBoundingClientRect(), i = r.top + r.height / 2;
@@ -1065,7 +1068,7 @@ function Vo(e, t) {
1065
1068
  }
1066
1069
  return t.length;
1067
1070
  }
1068
- function Yo(e, t) {
1071
+ function Vo(e, t) {
1069
1072
  if (t.length === 0) return 0;
1070
1073
  for (let o = 0; o < t.length; o++) {
1071
1074
  const r = t[o].getBoundingClientRect(), i = r.top + r.height / 2;
@@ -1077,10 +1080,10 @@ function Yo(e, t) {
1077
1080
  function to(e, t) {
1078
1081
  return e < 0 || t === e || t === e + 1 ? null : t > e ? t - 1 : t;
1079
1082
  }
1080
- var qo = Object.defineProperty, Xo = Object.getOwnPropertyDescriptor, oo = (e, t, o, r) => {
1083
+ var Yo = Object.defineProperty, Xo = Object.getOwnPropertyDescriptor, oo = (e, t, o, r) => {
1081
1084
  for (var i = r > 1 ? void 0 : r ? Xo(t, o) : t, n = e.length - 1, a; n >= 0; n--)
1082
1085
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
1083
- return r && i && qo(t, o, i), i;
1086
+ return r && i && Yo(t, o, i), i;
1084
1087
  };
1085
1088
  let Ge = class extends g {
1086
1089
  constructor() {
@@ -1183,7 +1186,7 @@ let de = class extends g {
1183
1186
  element: this._editorHost,
1184
1187
  initialHTML: this.block.values.content,
1185
1188
  onBlur: (o) => this._commit(o),
1186
- onEscape: () => this._exit()
1189
+ onEscape: (o) => this._commit(o)
1187
1190
  }));
1188
1191
  }
1189
1192
  _teardownEditor() {
@@ -1203,10 +1206,6 @@ let de = class extends g {
1203
1206
  composed: !0
1204
1207
  }));
1205
1208
  }
1206
- _exit() {
1207
- const e = this._editor ? this._editor.getHTML() : this.block.values.content;
1208
- this._commit(e);
1209
- }
1210
1209
  _handleClick(e) {
1211
1210
  e.stopPropagation(), !this.editing && this.dispatchEvent(new CustomEvent("block-select", {
1212
1211
  detail: { blockId: this.block.id },
@@ -1598,7 +1597,7 @@ It([
1598
1597
  Be = It([
1599
1598
  u("pigeon-divider-block")
1600
1599
  ], Be);
1601
- var ri = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, Pt = (e, t, o, r) => {
1600
+ var ri = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, Tt = (e, t, o, r) => {
1602
1601
  for (var i = r > 1 ? void 0 : r ? ni(t, o) : t, n = e.length - 1, a; n >= 0; n--)
1603
1602
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
1604
1603
  return r && i && ri(t, o, i), i;
@@ -1670,16 +1669,16 @@ je.styles = b`
1670
1669
  opacity: 1;
1671
1670
  }
1672
1671
  `;
1673
- Pt([
1672
+ Tt([
1674
1673
  p({ type: Object })
1675
1674
  ], je.prototype, "block", 2);
1676
- Pt([
1675
+ Tt([
1677
1676
  p({ type: Boolean, reflect: !0 })
1678
1677
  ], je.prototype, "selected", 2);
1679
- je = Pt([
1678
+ je = Tt([
1680
1679
  u("pigeon-spacer-block")
1681
1680
  ], je);
1682
- var ai = Object.defineProperty, si = Object.getOwnPropertyDescriptor, Tt = (e, t, o, r) => {
1681
+ var ai = Object.defineProperty, si = Object.getOwnPropertyDescriptor, Pt = (e, t, o, r) => {
1683
1682
  for (var i = r > 1 ? void 0 : r ? si(t, o) : t, n = e.length - 1, a; n >= 0; n--)
1684
1683
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
1685
1684
  return r && i && ai(t, o, i), i;
@@ -1701,7 +1700,7 @@ const li = {
1701
1700
  tiktok: "#000000",
1702
1701
  custom: "#6b7280"
1703
1702
  };
1704
- let Re = class extends g {
1703
+ let Me = class extends g {
1705
1704
  constructor() {
1706
1705
  super(...arguments), this.selected = !1;
1707
1706
  }
@@ -1748,7 +1747,7 @@ let Re = class extends g {
1748
1747
  }));
1749
1748
  }
1750
1749
  };
1751
- Re.styles = b`
1750
+ Me.styles = b`
1752
1751
  :host {
1753
1752
  display: block;
1754
1753
  cursor: pointer;
@@ -1796,21 +1795,21 @@ Re.styles = b`
1796
1795
  font-size: 13px;
1797
1796
  }
1798
1797
  `;
1799
- Tt([
1798
+ Pt([
1800
1799
  p({ type: Object })
1801
- ], Re.prototype, "block", 2);
1802
- Tt([
1800
+ ], Me.prototype, "block", 2);
1801
+ Pt([
1803
1802
  p({ type: Boolean, reflect: !0 })
1804
- ], Re.prototype, "selected", 2);
1805
- Re = Tt([
1803
+ ], Me.prototype, "selected", 2);
1804
+ Me = Pt([
1806
1805
  u("pigeon-social-block")
1807
- ], Re);
1806
+ ], Me);
1808
1807
  var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, St = (e, t, o, r) => {
1809
1808
  for (var i = r > 1 ? void 0 : r ? di(t, o) : t, n = e.length - 1, a; n >= 0; n--)
1810
1809
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
1811
1810
  return r && i && ci(t, o, i), i;
1812
1811
  };
1813
- let Le = class extends g {
1812
+ let Re = class extends g {
1814
1813
  constructor() {
1815
1814
  super(...arguments), this.selected = !1;
1816
1815
  }
@@ -1823,10 +1822,24 @@ let Le = class extends g {
1823
1822
  style="${t}"
1824
1823
  @click=${this._handleClick}
1825
1824
  >
1826
- ${e.content ? l`<div class="content" .innerHTML=${e.content}></div>` : l`<div class="empty-state">&lt;/&gt; Custom HTML</div>`}
1825
+ ${e.content ? l`<iframe
1826
+ class="content"
1827
+ title="Custom HTML"
1828
+ sandbox="allow-same-origin"
1829
+ .srcdoc=${`<style>body{margin:0;display:flow-root}</style>${e.content}`}
1830
+ @load=${this._fit}
1831
+ ></iframe>` : l`<div class="empty-state">&lt;/&gt; Custom HTML</div>`}
1827
1832
  </div>
1828
1833
  `;
1829
1834
  }
1835
+ /** No scripts run inside the sandbox, so the parent sizes the frame to its content. */
1836
+ _fit(e) {
1837
+ var o;
1838
+ const t = e.target;
1839
+ (o = this._resizer) == null || o.disconnect(), this._resizer = new ResizeObserver(() => {
1840
+ t.style.height = `${t.contentDocument.body.scrollHeight}px`;
1841
+ }), this._resizer.observe(t);
1842
+ }
1830
1843
  _handleClick(e) {
1831
1844
  e.stopPropagation(), this.dispatchEvent(new CustomEvent("block-select", {
1832
1845
  detail: { blockId: this.block.id },
@@ -1835,7 +1848,7 @@ let Le = class extends g {
1835
1848
  }));
1836
1849
  }
1837
1850
  };
1838
- Le.styles = b`
1851
+ Re.styles = b`
1839
1852
  :host {
1840
1853
  display: block;
1841
1854
  cursor: pointer;
@@ -1858,8 +1871,10 @@ Le.styles = b`
1858
1871
  }
1859
1872
 
1860
1873
  .content {
1861
- word-wrap: break-word;
1862
- overflow-wrap: break-word;
1874
+ display: block;
1875
+ width: 100%;
1876
+ border: 0;
1877
+ pointer-events: none;
1863
1878
  }
1864
1879
 
1865
1880
  .empty-state {
@@ -1877,13 +1892,13 @@ Le.styles = b`
1877
1892
  `;
1878
1893
  St([
1879
1894
  p({ type: Object })
1880
- ], Le.prototype, "block", 2);
1895
+ ], Re.prototype, "block", 2);
1881
1896
  St([
1882
1897
  p({ type: Boolean, reflect: !0 })
1883
- ], Le.prototype, "selected", 2);
1884
- Le = St([
1898
+ ], Re.prototype, "selected", 2);
1899
+ Re = St([
1885
1900
  u("pigeon-html-block")
1886
- ], Le);
1901
+ ], Re);
1887
1902
  var hi = Object.defineProperty, gi = Object.getOwnPropertyDescriptor, it = (e, t, o, r) => {
1888
1903
  for (var i = r > 1 ? void 0 : r ? gi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
1889
1904
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
@@ -2051,7 +2066,7 @@ var ui = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, Ot = (e, t
2051
2066
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
2052
2067
  return r && i && ui(t, o, i), i;
2053
2068
  };
2054
- let ze = class extends g {
2069
+ let Le = class extends g {
2055
2070
  constructor() {
2056
2071
  super(...arguments), this.selected = !1;
2057
2072
  }
@@ -2094,7 +2109,7 @@ let ze = class extends g {
2094
2109
  }));
2095
2110
  }
2096
2111
  };
2097
- ze.styles = b`
2112
+ Le.styles = b`
2098
2113
  :host {
2099
2114
  display: block;
2100
2115
  cursor: pointer;
@@ -2144,19 +2159,19 @@ ze.styles = b`
2144
2159
  `;
2145
2160
  Ot([
2146
2161
  p({ type: Object })
2147
- ], ze.prototype, "block", 2);
2162
+ ], Le.prototype, "block", 2);
2148
2163
  Ot([
2149
2164
  p({ type: Boolean, reflect: !0 })
2150
- ], ze.prototype, "selected", 2);
2151
- ze = Ot([
2165
+ ], Le.prototype, "selected", 2);
2166
+ Le = Ot([
2152
2167
  u("pigeon-navbar-block")
2153
- ], ze);
2154
- var vi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, X = (e, t, o, r) => {
2168
+ ], Le);
2169
+ var vi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Z = (e, t, o, r) => {
2155
2170
  for (var i = r > 1 ? void 0 : r ? fi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
2156
2171
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
2157
2172
  return r && i && vi(t, o, i), i;
2158
2173
  };
2159
- let O = class extends g {
2174
+ let A = class extends g {
2160
2175
  constructor() {
2161
2176
  super(...arguments), this.rowId = "", this.selection = null, this.editingBlockId = null, this._dropIndex = -1, this._isDragOver = !1, this._draggingBlockId = null;
2162
2177
  }
@@ -2265,7 +2280,7 @@ let O = class extends g {
2265
2280
  );
2266
2281
  }
2267
2282
  _onDragOver(e) {
2268
- const t = De();
2283
+ const t = Ee();
2269
2284
  if (!t || t.type !== "palette-block" && t.type !== "existing-block") return;
2270
2285
  e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = t.type === "existing-block" ? "move" : "copy"), this._isDragOver = !0;
2271
2286
  const o = Array.from(
@@ -2273,14 +2288,14 @@ let O = class extends g {
2273
2288
  "pigeon-text-block, pigeon-image-block, pigeon-button-block, pigeon-divider-block, pigeon-spacer-block, pigeon-social-block, pigeon-html-block, pigeon-hero-block, pigeon-navbar-block, .custom-block"
2274
2289
  )
2275
2290
  );
2276
- this._dropIndex = Yo(e.clientY, o);
2291
+ this._dropIndex = Vo(e.clientY, o);
2277
2292
  }
2278
2293
  _onDragLeave(e) {
2279
2294
  const t = this.getBoundingClientRect();
2280
2295
  e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom || (this._isDragOver = !1, this._dropIndex = -1);
2281
2296
  }
2282
2297
  _onDrop(e) {
2283
- const t = De();
2298
+ const t = Ee();
2284
2299
  if (!t || t.type !== "palette-block" && t.type !== "existing-block") return;
2285
2300
  e.preventDefault(), e.stopPropagation();
2286
2301
  let o = this._dropIndex >= 0 ? this._dropIndex : this.column.blocks.length;
@@ -2322,7 +2337,7 @@ let O = class extends g {
2322
2337
  this._draggingBlockId = null, Xe();
2323
2338
  }
2324
2339
  };
2325
- O.styles = b`
2340
+ A.styles = b`
2326
2341
  :host {
2327
2342
  display: block;
2328
2343
  min-height: 40px;
@@ -2438,36 +2453,36 @@ O.styles = b`
2438
2453
  text-align: center;
2439
2454
  }
2440
2455
  `;
2441
- X([
2456
+ Z([
2442
2457
  p({ type: Object })
2443
- ], O.prototype, "column", 2);
2444
- X([
2458
+ ], A.prototype, "column", 2);
2459
+ Z([
2445
2460
  p({ type: String, attribute: "row-id" })
2446
- ], O.prototype, "rowId", 2);
2447
- X([
2461
+ ], A.prototype, "rowId", 2);
2462
+ Z([
2448
2463
  p({ type: Object })
2449
- ], O.prototype, "selection", 2);
2450
- X([
2464
+ ], A.prototype, "selection", 2);
2465
+ Z([
2451
2466
  p({ type: String, attribute: "editing-block-id" })
2452
- ], O.prototype, "editingBlockId", 2);
2453
- X([
2467
+ ], A.prototype, "editingBlockId", 2);
2468
+ Z([
2454
2469
  d()
2455
- ], O.prototype, "_dropIndex", 2);
2456
- X([
2470
+ ], A.prototype, "_dropIndex", 2);
2471
+ Z([
2457
2472
  d()
2458
- ], O.prototype, "_isDragOver", 2);
2459
- X([
2473
+ ], A.prototype, "_isDragOver", 2);
2474
+ Z([
2460
2475
  d()
2461
- ], O.prototype, "_draggingBlockId", 2);
2462
- O = X([
2476
+ ], A.prototype, "_draggingBlockId", 2);
2477
+ A = Z([
2463
2478
  u("pigeon-column")
2464
- ], O);
2465
- var mi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, G = (e, t, o, r) => {
2479
+ ], A);
2480
+ var mi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, Q = (e, t, o, r) => {
2466
2481
  for (var i = r > 1 ? void 0 : r ? _i(t, o) : t, n = e.length - 1, a; n >= 0; n--)
2467
2482
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
2468
2483
  return r && i && mi(t, o, i), i;
2469
2484
  };
2470
- let D = class extends g {
2485
+ let B = class extends g {
2471
2486
  constructor() {
2472
2487
  super(...arguments), this.index = 0, this.totalRows = 0, this.selection = null, this.editingBlockId = null, this.showActions = !1, this._dragging = !1;
2473
2488
  }
@@ -2627,7 +2642,7 @@ let D = class extends g {
2627
2642
  this._dragging = !1, Xe();
2628
2643
  }
2629
2644
  };
2630
- D.styles = b`
2645
+ B.styles = b`
2631
2646
  :host {
2632
2647
  display: block;
2633
2648
  position: relative;
@@ -2758,31 +2773,31 @@ D.styles = b`
2758
2773
  opacity: 1;
2759
2774
  }
2760
2775
  `;
2761
- G([
2776
+ Q([
2762
2777
  p({ type: Object })
2763
- ], D.prototype, "row", 2);
2764
- G([
2778
+ ], B.prototype, "row", 2);
2779
+ Q([
2765
2780
  p({ type: Number })
2766
- ], D.prototype, "index", 2);
2767
- G([
2781
+ ], B.prototype, "index", 2);
2782
+ Q([
2768
2783
  p({ type: Number, attribute: "total-rows" })
2769
- ], D.prototype, "totalRows", 2);
2770
- G([
2784
+ ], B.prototype, "totalRows", 2);
2785
+ Q([
2771
2786
  p({ type: Object })
2772
- ], D.prototype, "selection", 2);
2773
- G([
2787
+ ], B.prototype, "selection", 2);
2788
+ Q([
2774
2789
  p({ type: String, attribute: "editing-block-id" })
2775
- ], D.prototype, "editingBlockId", 2);
2776
- G([
2790
+ ], B.prototype, "editingBlockId", 2);
2791
+ Q([
2777
2792
  p({ type: Boolean, attribute: "show-actions", reflect: !0 })
2778
- ], D.prototype, "showActions", 2);
2779
- G([
2793
+ ], B.prototype, "showActions", 2);
2794
+ Q([
2780
2795
  d()
2781
- ], D.prototype, "_dragging", 2);
2782
- D = G([
2796
+ ], B.prototype, "_dragging", 2);
2797
+ B = Q([
2783
2798
  u("pigeon-row")
2784
- ], D);
2785
- var yi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, H = (e, t, o, r) => {
2799
+ ], B);
2800
+ var yi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, F = (e, t, o, r) => {
2786
2801
  for (var i = r > 1 ? void 0 : r ? xi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
2787
2802
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
2788
2803
  return r && i && yi(t, o, i), i;
@@ -2886,12 +2901,12 @@ let P = class extends g {
2886
2901
  }));
2887
2902
  }
2888
2903
  _onDragOver(e) {
2889
- const t = De();
2904
+ const t = Ee();
2890
2905
  if (t && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = t.type === "existing-row" ? "move" : "copy"), this._isDragOver = !0, t.type === "palette-row" || t.type === "existing-row" || t.type === "library-row" || this.doc.body.rows.length === 0)) {
2891
2906
  const o = Array.from(
2892
2907
  this.renderRoot.querySelectorAll("pigeon-row")
2893
2908
  );
2894
- this._rowDropIndex = Vo(e.clientY, o);
2909
+ this._rowDropIndex = qo(e.clientY, o);
2895
2910
  }
2896
2911
  }
2897
2912
  _onDragLeave(e) {
@@ -2901,7 +2916,7 @@ let P = class extends g {
2901
2916
  }
2902
2917
  _onDrop(e) {
2903
2918
  e.preventDefault();
2904
- const t = De();
2919
+ const t = Ee();
2905
2920
  if (!t) {
2906
2921
  this._resetDragState();
2907
2922
  return;
@@ -3073,31 +3088,31 @@ P.styles = b`
3073
3088
  border-radius: var(--pigeon-radius, 6px);
3074
3089
  }
3075
3090
  `;
3076
- H([
3091
+ F([
3077
3092
  p({ type: Object })
3078
3093
  ], P.prototype, "doc", 2);
3079
- H([
3094
+ F([
3080
3095
  p({ type: Object })
3081
3096
  ], P.prototype, "selection", 2);
3082
- H([
3097
+ F([
3083
3098
  p({ type: String, attribute: "editing-block-id" })
3084
3099
  ], P.prototype, "editingBlockId", 2);
3085
- H([
3100
+ F([
3086
3101
  p({ type: Number, attribute: "preview-width" })
3087
3102
  ], P.prototype, "previewWidth", 2);
3088
- H([
3103
+ F([
3089
3104
  p({ type: String })
3090
3105
  ], P.prototype, "device", 2);
3091
- H([
3106
+ F([
3092
3107
  d()
3093
3108
  ], P.prototype, "_rowDropIndex", 2);
3094
- H([
3109
+ F([
3095
3110
  d()
3096
3111
  ], P.prototype, "_isDragOver", 2);
3097
- H([
3112
+ F([
3098
3113
  d()
3099
3114
  ], P.prototype, "_hoveredRowId", 2);
3100
- P = H([
3115
+ P = F([
3101
3116
  u("pigeon-canvas")
3102
3117
  ], P);
3103
3118
  /**
@@ -3105,22 +3120,22 @@ P = H([
3105
3120
  * Copyright 2017 Google LLC
3106
3121
  * SPDX-License-Identifier: BSD-3-Clause
3107
3122
  */
3108
- const Se = globalThis, Wt = (e) => e, Je = Se.trustedTypes, Vt = Je ? Je.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, io = "$lit$", U = `lit$${Math.random().toFixed(9).slice(2)}$`, ro = "?" + U, $i = `<${ro}>`, ne = document, Ze = () => ne.createComment(""), Me = (e) => e === null || typeof e != "object" && typeof e != "function", Dt = Array.isArray, wi = (e) => Dt(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", bt = `[
3109
- \f\r]`, Te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Yt = /-->/g, qt = />/g, ie = RegExp(`>|${bt}(?:([^\\s"'>=/]+)(${bt}*=${bt}*(?:[^
3123
+ const Se = globalThis, Wt = (e) => e, Je = Se.trustedTypes, qt = Je ? Je.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, io = "$lit$", q = `lit$${Math.random().toFixed(9).slice(2)}$`, ro = "?" + q, $i = `<${ro}>`, ne = document, Ze = () => ne.createComment(""), ze = (e) => e === null || typeof e != "object" && typeof e != "function", Et = Array.isArray, wi = (e) => Et(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", bt = `[
3124
+ \f\r]`, Pe = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Vt = /-->/g, Yt = />/g, ie = RegExp(`>|${bt}(?:([^\\s"'>=/]+)(${bt}*=${bt}*(?:[^
3110
3125
  \f\r"'\`<>=]|("|')|))|$)`, "g"), Xt = /'/g, Gt = /"/g, no = /^(?:script|style|textarea|title)$/i, He = Symbol.for("lit-noChange"), y = Symbol.for("lit-nothing"), Jt = /* @__PURE__ */ new WeakMap(), re = ne.createTreeWalker(ne, 129);
3111
3126
  function ao(e, t) {
3112
- if (!Dt(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
3113
- return Vt !== void 0 ? Vt.createHTML(t) : t;
3127
+ if (!Et(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
3128
+ return qt !== void 0 ? qt.createHTML(t) : t;
3114
3129
  }
3115
3130
  const ki = (e, t) => {
3116
3131
  const o = e.length - 1, r = [];
3117
- let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Te;
3132
+ let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Pe;
3118
3133
  for (let h = 0; h < o; h++) {
3119
3134
  const c = e[h];
3120
3135
  let v, m, f = -1, R = 0;
3121
- for (; R < c.length && (a.lastIndex = R, m = a.exec(c), m !== null); ) R = a.lastIndex, a === Te ? m[1] === "!--" ? a = Yt : m[1] !== void 0 ? a = qt : m[2] !== void 0 ? (no.test(m[2]) && (i = RegExp("</" + m[2], "g")), a = ie) : m[3] !== void 0 && (a = ie) : a === ie ? m[0] === ">" ? (a = i ?? Te, f = -1) : m[1] === void 0 ? f = -2 : (f = a.lastIndex - m[2].length, v = m[1], a = m[3] === void 0 ? ie : m[3] === '"' ? Gt : Xt) : a === Gt || a === Xt ? a = ie : a === Yt || a === qt ? a = Te : (a = ie, i = void 0);
3122
- const N = a === ie && e[h + 1].startsWith("/>") ? " " : "";
3123
- n += a === Te ? c + $i : f >= 0 ? (r.push(v), c.slice(0, f) + io + c.slice(f) + U + N) : c + U + (f === -2 ? h : N);
3136
+ for (; R < c.length && (a.lastIndex = R, m = a.exec(c), m !== null); ) R = a.lastIndex, a === Pe ? m[1] === "!--" ? a = Vt : m[1] !== void 0 ? a = Yt : m[2] !== void 0 ? (no.test(m[2]) && (i = RegExp("</" + m[2], "g")), a = ie) : m[3] !== void 0 && (a = ie) : a === ie ? m[0] === ">" ? (a = i ?? Pe, f = -1) : m[1] === void 0 ? f = -2 : (f = a.lastIndex - m[2].length, v = m[1], a = m[3] === void 0 ? ie : m[3] === '"' ? Gt : Xt) : a === Gt || a === Xt ? a = ie : a === Vt || a === Yt ? a = Pe : (a = ie, i = void 0);
3137
+ const W = a === ie && e[h + 1].startsWith("/>") ? " " : "";
3138
+ n += a === Pe ? c + $i : f >= 0 ? (r.push(v), c.slice(0, f) + io + c.slice(f) + q + W) : c + q + (f === -2 ? h : W);
3124
3139
  }
3125
3140
  return [ao(e, n + (e[o] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
3126
3141
  };
@@ -3137,21 +3152,21 @@ class Fe {
3137
3152
  for (; (i = re.nextNode()) !== null && c.length < h; ) {
3138
3153
  if (i.nodeType === 1) {
3139
3154
  if (i.hasAttributes()) for (const f of i.getAttributeNames()) if (f.endsWith(io)) {
3140
- const R = m[a++], N = i.getAttribute(f).split(U), Ve = /([.?@])?(.*)/.exec(R);
3141
- c.push({ type: 1, index: n, name: Ve[2], strings: N, ctor: Ve[1] === "." ? Ii : Ve[1] === "?" ? Pi : Ve[1] === "@" ? Ti : nt }), i.removeAttribute(f);
3142
- } else f.startsWith(U) && (c.push({ type: 6, index: n }), i.removeAttribute(f));
3155
+ const R = m[a++], W = i.getAttribute(f).split(q), qe = /([.?@])?(.*)/.exec(R);
3156
+ c.push({ type: 1, index: n, name: qe[2], strings: W, ctor: qe[1] === "." ? Ii : qe[1] === "?" ? Ti : qe[1] === "@" ? Pi : nt }), i.removeAttribute(f);
3157
+ } else f.startsWith(q) && (c.push({ type: 6, index: n }), i.removeAttribute(f));
3143
3158
  if (no.test(i.tagName)) {
3144
- const f = i.textContent.split(U), R = f.length - 1;
3159
+ const f = i.textContent.split(q), R = f.length - 1;
3145
3160
  if (R > 0) {
3146
3161
  i.textContent = Je ? Je.emptyScript : "";
3147
- for (let N = 0; N < R; N++) i.append(f[N], Ze()), re.nextNode(), c.push({ type: 2, index: ++n });
3162
+ for (let W = 0; W < R; W++) i.append(f[W], Ze()), re.nextNode(), c.push({ type: 2, index: ++n });
3148
3163
  i.append(f[R], Ze());
3149
3164
  }
3150
3165
  }
3151
3166
  } else if (i.nodeType === 8) if (i.data === ro) c.push({ type: 2, index: n });
3152
3167
  else {
3153
3168
  let f = -1;
3154
- for (; (f = i.data.indexOf(U, f + 1)) !== -1; ) c.push({ type: 7, index: n }), f += U.length - 1;
3169
+ for (; (f = i.data.indexOf(q, f + 1)) !== -1; ) c.push({ type: 7, index: n }), f += q.length - 1;
3155
3170
  }
3156
3171
  n++;
3157
3172
  }
@@ -3165,7 +3180,7 @@ function ue(e, t, o = e, r) {
3165
3180
  var a, h;
3166
3181
  if (t === He) return t;
3167
3182
  let i = r !== void 0 ? (a = o._$Co) == null ? void 0 : a[r] : o._$Cl;
3168
- const n = Me(t) ? void 0 : t._$litDirective$;
3183
+ const n = ze(t) ? void 0 : t._$litDirective$;
3169
3184
  return (i == null ? void 0 : i.constructor) !== n && ((h = i == null ? void 0 : i._$AO) == null || h.call(i, !1), n === void 0 ? i = void 0 : (i = new n(e), i._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = i : o._$Cl = i), i !== void 0 && (t = ue(e, i._$AS(e, t.values), i, r)), t;
3170
3185
  }
3171
3186
  class Ci {
@@ -3216,7 +3231,7 @@ class rt {
3216
3231
  return this._$AB;
3217
3232
  }
3218
3233
  _$AI(t, o = this) {
3219
- t = ue(this, t, o), Me(t) ? t === y || t == null || t === "" ? (this._$AH !== y && this._$AR(), this._$AH = y) : t !== this._$AH && t !== He && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : wi(t) ? this.k(t) : this._(t);
3234
+ t = ue(this, t, o), ze(t) ? t === y || t == null || t === "" ? (this._$AH !== y && this._$AR(), this._$AH = y) : t !== this._$AH && t !== He && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : wi(t) ? this.k(t) : this._(t);
3220
3235
  }
3221
3236
  O(t) {
3222
3237
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -3225,7 +3240,7 @@ class rt {
3225
3240
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
3226
3241
  }
3227
3242
  _(t) {
3228
- this._$AH !== y && Me(this._$AH) ? this._$AA.nextSibling.data = t : this.T(ne.createTextNode(t)), this._$AH = t;
3243
+ this._$AH !== y && ze(this._$AH) ? this._$AA.nextSibling.data = t : this.T(ne.createTextNode(t)), this._$AH = t;
3229
3244
  }
3230
3245
  $(t) {
3231
3246
  var n;
@@ -3241,7 +3256,7 @@ class rt {
3241
3256
  return o === void 0 && Jt.set(t.strings, o = new Fe(t)), o;
3242
3257
  }
3243
3258
  k(t) {
3244
- Dt(this._$AH) || (this._$AH = [], this._$AR());
3259
+ Et(this._$AH) || (this._$AH = [], this._$AR());
3245
3260
  const o = this._$AH;
3246
3261
  let r, i = 0;
3247
3262
  for (const n of t) i === o.length ? o.push(r = new rt(this.O(Ze()), this.O(Ze()), this, this.options)) : r = o[i], r._$AI(n), i++;
@@ -3272,11 +3287,11 @@ class nt {
3272
3287
  _$AI(t, o = this, r, i) {
3273
3288
  const n = this.strings;
3274
3289
  let a = !1;
3275
- if (n === void 0) t = ue(this, t, o, 0), a = !Me(t) || t !== this._$AH && t !== He, a && (this._$AH = t);
3290
+ if (n === void 0) t = ue(this, t, o, 0), a = !ze(t) || t !== this._$AH && t !== He, a && (this._$AH = t);
3276
3291
  else {
3277
3292
  const h = t;
3278
3293
  let c, v;
3279
- for (t = n[0], c = 0; c < n.length - 1; c++) v = ue(this, h[r + c], o, c), v === He && (v = this._$AH[c]), a || (a = !Me(v) || v !== this._$AH[c]), v === y ? t = y : t !== y && (t += (v ?? "") + n[c + 1]), this._$AH[c] = v;
3294
+ for (t = n[0], c = 0; c < n.length - 1; c++) v = ue(this, h[r + c], o, c), v === He && (v = this._$AH[c]), a || (a = !ze(v) || v !== this._$AH[c]), v === y ? t = y : t !== y && (t += (v ?? "") + n[c + 1]), this._$AH[c] = v;
3280
3295
  }
3281
3296
  a && !i && this.j(t);
3282
3297
  }
@@ -3292,7 +3307,7 @@ class Ii extends nt {
3292
3307
  this.element[this.name] = t === y ? void 0 : t;
3293
3308
  }
3294
3309
  }
3295
- class Pi extends nt {
3310
+ class Ti extends nt {
3296
3311
  constructor() {
3297
3312
  super(...arguments), this.type = 4;
3298
3313
  }
@@ -3300,7 +3315,7 @@ class Pi extends nt {
3300
3315
  this.element.toggleAttribute(this.name, !!t && t !== y);
3301
3316
  }
3302
3317
  }
3303
- class Ti extends nt {
3318
+ class Pi extends nt {
3304
3319
  constructor(t, o, r, i, n) {
3305
3320
  super(t, o, r, i, n), this.type = 5;
3306
3321
  }
@@ -3326,7 +3341,7 @@ class Si {
3326
3341
  }
3327
3342
  }
3328
3343
  const vt = Se.litHtmlPolyfillSupport;
3329
- vt == null || vt(Fe, rt), (Se.litHtmlVersions ?? (Se.litHtmlVersions = [])).push("3.3.2");
3344
+ vt == null || vt(Fe, rt), (Se.litHtmlVersions ?? (Se.litHtmlVersions = [])).push("3.3.3");
3330
3345
  /**
3331
3346
  * @license
3332
3347
  * Copyright 2020 Google LLC
@@ -3338,7 +3353,7 @@ const Oi = (e) => e.strings === void 0;
3338
3353
  * Copyright 2017 Google LLC
3339
3354
  * SPDX-License-Identifier: BSD-3-Clause
3340
3355
  */
3341
- const Di = { CHILD: 2 }, Ei = (e) => (...t) => ({ _$litDirective$: e, values: t });
3356
+ const Ei = { CHILD: 2 }, Di = (e) => (...t) => ({ _$litDirective$: e, values: t });
3342
3357
  class Ai {
3343
3358
  constructor(t) {
3344
3359
  }
@@ -3377,7 +3392,7 @@ const Oe = (e, t) => {
3377
3392
  let o = t._$AN;
3378
3393
  if (o === void 0) t._$AN = o = /* @__PURE__ */ new Set();
3379
3394
  else if (o.has(e)) break;
3380
- o.add(e), Ri(t);
3395
+ o.add(e), Mi(t);
3381
3396
  }
3382
3397
  };
3383
3398
  function Bi(e) {
@@ -3389,10 +3404,10 @@ function ji(e, t = !1, o = 0) {
3389
3404
  else r != null && (Oe(r, !1), Qe(r));
3390
3405
  else Oe(this, e);
3391
3406
  }
3392
- const Ri = (e) => {
3393
- e.type == Di.CHILD && (e._$AP ?? (e._$AP = ji), e._$AQ ?? (e._$AQ = Bi));
3407
+ const Mi = (e) => {
3408
+ e.type == Ei.CHILD && (e._$AP ?? (e._$AP = ji), e._$AQ ?? (e._$AQ = Bi));
3394
3409
  };
3395
- class Li extends Ai {
3410
+ class Ri extends Ai {
3396
3411
  constructor() {
3397
3412
  super(...arguments), this._$AN = void 0;
3398
3413
  }
@@ -3420,20 +3435,20 @@ class Li extends Ai {
3420
3435
  * Copyright 2020 Google LLC
3421
3436
  * SPDX-License-Identifier: BSD-3-Clause
3422
3437
  */
3423
- const be = () => new zi();
3424
- class zi {
3438
+ const be = () => new Li();
3439
+ class Li {
3425
3440
  }
3426
- const ft = /* @__PURE__ */ new WeakMap(), ve = Ei(class extends Li {
3441
+ const ft = /* @__PURE__ */ new WeakMap(), ve = Di(class extends Ri {
3427
3442
  render(e) {
3428
3443
  return y;
3429
3444
  }
3430
3445
  update(e, [t]) {
3431
3446
  var r;
3432
3447
  const o = t !== this.G;
3433
- return o && this.G !== void 0 && this.rt(void 0), (o || this.lt !== this.ct) && (this.G = t, this.ht = (r = e.options) == null ? void 0 : r.host, this.rt(this.ct = e.element)), y;
3448
+ return o && this.rt(void 0), (o || this.lt !== this.ct) && (this.G = t, this.ht = (r = e.options) == null ? void 0 : r.host, this.rt(this.ct = e.element)), y;
3434
3449
  }
3435
3450
  rt(e) {
3436
- if (this.isConnected || (e = void 0), typeof this.G == "function") {
3451
+ if (this.G !== void 0) if (this.isConnected || (e = void 0), typeof this.G == "function") {
3437
3452
  const t = this.ht ?? globalThis;
3438
3453
  let o = ft.get(t);
3439
3454
  o === void 0 && (o = /* @__PURE__ */ new WeakMap(), ft.set(t, o)), o.get(this.G) !== void 0 && this.G.call(this.ht, void 0), o.set(this.G, e), e !== void 0 && this.G.call(this.ht, e);
@@ -3449,7 +3464,7 @@ const ft = /* @__PURE__ */ new WeakMap(), ve = Ei(class extends Li {
3449
3464
  reconnected() {
3450
3465
  this.rt(this.ct);
3451
3466
  }
3452
- }), C = b`
3467
+ }), I = b`
3453
3468
  :host {
3454
3469
  display: block;
3455
3470
  }
@@ -3665,10 +3680,10 @@ const ft = /* @__PURE__ */ new WeakMap(), ve = Ei(class extends Li {
3665
3680
  box-shadow: var(--pigeon-ring-shadow);
3666
3681
  }
3667
3682
  `;
3668
- var Mi = Object.defineProperty, Hi = Object.getOwnPropertyDescriptor, Et = (e, t, o, r) => {
3683
+ var zi = Object.defineProperty, Hi = Object.getOwnPropertyDescriptor, Dt = (e, t, o, r) => {
3669
3684
  for (var i = r > 1 ? void 0 : r ? Hi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
3670
3685
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
3671
- return r && i && Mi(t, o, i), i;
3686
+ return r && i && zi(t, o, i), i;
3672
3687
  };
3673
3688
  let Ne = class extends g {
3674
3689
  constructor() {
@@ -3791,13 +3806,13 @@ Ne.styles = b`
3791
3806
  height: 16px;
3792
3807
  }
3793
3808
  `;
3794
- Et([
3809
+ Dt([
3795
3810
  p({ type: String })
3796
3811
  ], Ne.prototype, "label", 2);
3797
- Et([
3812
+ Dt([
3798
3813
  p({ type: String })
3799
3814
  ], Ne.prototype, "value", 2);
3800
- Ne = Et([
3815
+ Ne = Dt([
3801
3816
  u("pigeon-alignment-picker")
3802
3817
  ], Ne);
3803
3818
  var Fi = Object.defineProperty, Ni = Object.getOwnPropertyDescriptor, At = (e, t, o, r) => {
@@ -4130,19 +4145,19 @@ le([
4130
4145
  L = le([
4131
4146
  u("pigeon-slider-input")
4132
4147
  ], L);
4133
- var Wi = Object.defineProperty, Vi = Object.getOwnPropertyDescriptor, we = (e, t, o, r) => {
4134
- for (var i = r > 1 ? void 0 : r ? Vi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
4148
+ var Wi = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, we = (e, t, o, r) => {
4149
+ for (var i = r > 1 ? void 0 : r ? qi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
4135
4150
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
4136
4151
  return r && i && Wi(t, o, i), i;
4137
4152
  };
4138
- let V = class extends g {
4153
+ let X = class extends g {
4139
4154
  constructor() {
4140
4155
  super(...arguments), this.tags = [], this.open = !1, this.x = 0, this.y = 0, this._search = "";
4141
4156
  }
4142
4157
  render() {
4143
4158
  const e = this._getFilteredTags(), t = this._groupByCategory(e);
4144
4159
  return l`
4145
- <div class="picker" style="position: absolute; left: ${this.x}px; top: ${this.y}px;">
4160
+ <div class="picker" style="position: fixed; left: ${this.x}px; top: ${this.y}px;">
4146
4161
  <div class="search-box">
4147
4162
  <input
4148
4163
  type="text"
@@ -4191,7 +4206,7 @@ let V = class extends g {
4191
4206
  })), this.open = !1, this._search = "";
4192
4207
  }
4193
4208
  };
4194
- V.styles = b`
4209
+ X.styles = b`
4195
4210
  :host {
4196
4211
  display: none;
4197
4212
  }
@@ -4284,30 +4299,30 @@ V.styles = b`
4284
4299
  `;
4285
4300
  we([
4286
4301
  p({ type: Array })
4287
- ], V.prototype, "tags", 2);
4302
+ ], X.prototype, "tags", 2);
4288
4303
  we([
4289
4304
  p({ type: Boolean, reflect: !0 })
4290
- ], V.prototype, "open", 2);
4305
+ ], X.prototype, "open", 2);
4291
4306
  we([
4292
4307
  p({ type: Number })
4293
- ], V.prototype, "x", 2);
4308
+ ], X.prototype, "x", 2);
4294
4309
  we([
4295
4310
  p({ type: Number })
4296
- ], V.prototype, "y", 2);
4311
+ ], X.prototype, "y", 2);
4297
4312
  we([
4298
4313
  d()
4299
- ], V.prototype, "_search", 2);
4300
- V = we([
4314
+ ], X.prototype, "_search", 2);
4315
+ X = we([
4301
4316
  u("pigeon-merge-tag-picker")
4302
- ], V);
4303
- var Yi = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, J = (e, t, o, r) => {
4304
- for (var i = r > 1 ? void 0 : r ? qi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
4317
+ ], X);
4318
+ var Vi = Object.defineProperty, Yi = Object.getOwnPropertyDescriptor, N = (e, t, o, r) => {
4319
+ for (var i = r > 1 ? void 0 : r ? Yi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
4305
4320
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
4306
- return r && i && Yi(t, o, i), i;
4321
+ return r && i && Vi(t, o, i), i;
4307
4322
  };
4308
- let E = class extends g {
4323
+ let S = class extends g {
4309
4324
  constructor() {
4310
- super(...arguments), this.rowId = "", this.columnId = "", this.mergeTags = [], this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._textareaRef = be(), this._triggerRef = be();
4325
+ super(...arguments), this.rowId = "", this.columnId = "", this.mergeTags = [], this.requestMergeTags = !1, this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._textareaRef = be(), this._triggerRef = be();
4311
4326
  }
4312
4327
  render() {
4313
4328
  if (!this.block) return l``;
@@ -4318,7 +4333,7 @@ let E = class extends g {
4318
4333
  <div class="field">
4319
4334
  <div class="label-row">
4320
4335
  <label>${s("panel.common.contentHtml")}</label>
4321
- ${t ? l`
4336
+ ${t || this.requestMergeTags ? l`
4322
4337
  <button class="tag-btn" ${ve(this._triggerRef)} @click=${this._togglePicker} title=${s("panel.common.insertMergeTag")}>
4323
4338
  ${s("panel.common.tagBtn")}
4324
4339
  </button>
@@ -4368,6 +4383,10 @@ let E = class extends g {
4368
4383
  `;
4369
4384
  }
4370
4385
  _togglePicker() {
4386
+ if (!this.mergeTags.length) {
4387
+ this.dispatchEvent(new CustomEvent("pigeon:merge-tag-request", { bubbles: !0, composed: !0 }));
4388
+ return;
4389
+ }
4371
4390
  const e = this._triggerRef.value;
4372
4391
  if (e) {
4373
4392
  if (!this._pickerOpen) {
@@ -4423,8 +4442,8 @@ let E = class extends g {
4423
4442
  this._emit({ padding: e.detail.value });
4424
4443
  }
4425
4444
  };
4426
- E.styles = [
4427
- C,
4445
+ S.styles = [
4446
+ I,
4428
4447
  b`
4429
4448
  /* Content textarea uses the monospace face so the HTML payload is
4430
4449
  readable to authors editing the raw markup. */
@@ -4468,30 +4487,33 @@ E.styles = [
4468
4487
  }
4469
4488
  `
4470
4489
  ];
4471
- J([
4490
+ N([
4472
4491
  p({ type: Object })
4473
- ], E.prototype, "block", 2);
4474
- J([
4492
+ ], S.prototype, "block", 2);
4493
+ N([
4475
4494
  p({ type: String })
4476
- ], E.prototype, "rowId", 2);
4477
- J([
4495
+ ], S.prototype, "rowId", 2);
4496
+ N([
4478
4497
  p({ type: String })
4479
- ], E.prototype, "columnId", 2);
4480
- J([
4498
+ ], S.prototype, "columnId", 2);
4499
+ N([
4481
4500
  p({ type: Array })
4482
- ], E.prototype, "mergeTags", 2);
4483
- J([
4501
+ ], S.prototype, "mergeTags", 2);
4502
+ N([
4503
+ p({ attribute: !1 })
4504
+ ], S.prototype, "requestMergeTags", 2);
4505
+ N([
4484
4506
  d()
4485
- ], E.prototype, "_pickerOpen", 2);
4486
- J([
4507
+ ], S.prototype, "_pickerOpen", 2);
4508
+ N([
4487
4509
  d()
4488
- ], E.prototype, "_pickerX", 2);
4489
- J([
4510
+ ], S.prototype, "_pickerX", 2);
4511
+ N([
4490
4512
  d()
4491
- ], E.prototype, "_pickerY", 2);
4492
- E = J([
4513
+ ], S.prototype, "_pickerY", 2);
4514
+ S = N([
4493
4515
  u("pigeon-text-panel")
4494
- ], E);
4516
+ ], S);
4495
4517
  var Xi = Object.defineProperty, Gi = Object.getOwnPropertyDescriptor, w = (e, t, o, r) => {
4496
4518
  for (var i = r > 1 ? void 0 : r ? Gi(t, o) : t, n = e.length - 1, a; n >= 0; n--)
4497
4519
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
@@ -4501,10 +4523,10 @@ let mt = null;
4501
4523
  function Ji() {
4502
4524
  return mt || (mt = import("./pigeon-stock-tab.js")), mt;
4503
4525
  }
4504
- const Zi = 250, qe = "__all__";
4526
+ const Zi = 250, Ye = "__all__";
4505
4527
  let x = class extends g {
4506
4528
  constructor() {
4507
- super(...arguments), this.config = {}, this.open = !1, this._tab = null, this._stockTabLoaded = !1, this._dragOver = !1, this._uploading = !1, this._progress = 0, this._error = "", this._urlInput = "", this._folder = qe, this._search = "", this._selectedTags = [], this._folders = [], this._assets = [], this._libraryLoading = !1, this._libraryError = "", this._searchTimer = null, this._libraryToken = 0, this._handleStockTabClick = async () => {
4529
+ super(...arguments), this.config = {}, this.open = !1, this._tab = null, this._stockTabLoaded = !1, this._dragOver = !1, this._uploading = !1, this._progress = 0, this._error = "", this._urlInput = "", this._folder = Ye, this._search = "", this._selectedTags = [], this._folders = [], this._assets = [], this._libraryLoading = !1, this._libraryError = "", this._searchTimer = null, this._libraryToken = 0, this._handleStockTabClick = async () => {
4508
4530
  this._tab = "stock", this._stockTabLoaded || (await Ji(), this._stockTabLoaded = !0);
4509
4531
  };
4510
4532
  }
@@ -4583,7 +4605,7 @@ let x = class extends g {
4583
4605
  .value=${this._folder}
4584
4606
  @change=${this._onFolderChange}
4585
4607
  >
4586
- <option value=${qe}>${s("asset.folder.all")}</option>
4608
+ <option value=${Ye}>${s("asset.folder.all")}</option>
4587
4609
  ${this._folders.map(
4588
4610
  (e) => l`<option value=${e} ?selected=${this._folder === e}>${e}</option>`
4589
4611
  )}
@@ -4607,7 +4629,7 @@ let x = class extends g {
4607
4629
  </div>` : te}
4608
4630
  ${this._libraryError ? l`<div class="error">${this._libraryError}</div>` : te}
4609
4631
  ${this._libraryLoading ? l`<div class="library-spinner">${s("asset.loading")}</div>` : this._assets.length === 0 ? l`<div class="empty-library">
4610
- ${this._search || this._selectedTags.length > 0 || this._folder !== qe ? s("asset.empty.filtered") : s("asset.empty.no-assets")}
4632
+ ${this._search || this._selectedTags.length > 0 || this._folder !== Ye ? s("asset.empty.filtered") : s("asset.empty.no-assets")}
4611
4633
  </div>` : l`<div class="asset-grid">
4612
4634
  ${this._assets.map((e) => this._renderAssetCard(e))}
4613
4635
  </div>`}
@@ -4685,7 +4707,7 @@ let x = class extends g {
4685
4707
  this._libraryLoading = !0, this._libraryError = "";
4686
4708
  try {
4687
4709
  const t = await this.storage.list({
4688
- folder: this._folder === qe ? void 0 : this._folder,
4710
+ folder: this._folder === Ye ? void 0 : this._folder,
4689
4711
  search: this._search.trim() || void 0,
4690
4712
  tags: this._selectedTags.length > 0 ? this._selectedTags : void 0
4691
4713
  });
@@ -5354,7 +5376,7 @@ let z = class extends g {
5354
5376
  }
5355
5377
  };
5356
5378
  z.styles = [
5357
- C,
5379
+ I,
5358
5380
  b`
5359
5381
  .upload-btn {
5360
5382
  margin-top: 6px;
@@ -5544,7 +5566,7 @@ var ir = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, ke = (e, t
5544
5566
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
5545
5567
  return r && i && ir(t, o, i), i;
5546
5568
  };
5547
- let Y = class extends g {
5569
+ let G = class extends g {
5548
5570
  constructor() {
5549
5571
  super(...arguments), this.rowId = "", this.columnId = "", this.swatches = [], this.linkTypes = [];
5550
5572
  }
@@ -5706,25 +5728,25 @@ let Y = class extends g {
5706
5728
  this._emit({ innerPadding: e.detail.value });
5707
5729
  }
5708
5730
  };
5709
- Y.styles = C;
5731
+ G.styles = I;
5710
5732
  ke([
5711
5733
  p({ type: Object })
5712
- ], Y.prototype, "block", 2);
5734
+ ], G.prototype, "block", 2);
5713
5735
  ke([
5714
5736
  p({ type: String })
5715
- ], Y.prototype, "rowId", 2);
5737
+ ], G.prototype, "rowId", 2);
5716
5738
  ke([
5717
5739
  p({ type: String })
5718
- ], Y.prototype, "columnId", 2);
5740
+ ], G.prototype, "columnId", 2);
5719
5741
  ke([
5720
5742
  p({ attribute: !1 })
5721
- ], Y.prototype, "swatches", 2);
5743
+ ], G.prototype, "swatches", 2);
5722
5744
  ke([
5723
5745
  p({ attribute: !1 })
5724
- ], Y.prototype, "linkTypes", 2);
5725
- Y = ke([
5746
+ ], G.prototype, "linkTypes", 2);
5747
+ G = ke([
5726
5748
  u("pigeon-button-panel")
5727
- ], Y);
5749
+ ], G);
5728
5750
  var nr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, lo = (e, t, o, r) => {
5729
5751
  for (var i = r > 1 ? void 0 : r ? ar(t, o) : t, n = e.length - 1, a; n >= 0; n--)
5730
5752
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
@@ -5850,7 +5872,7 @@ let et = class extends g {
5850
5872
  }
5851
5873
  };
5852
5874
  et.styles = [
5853
- C,
5875
+ I,
5854
5876
  b`
5855
5877
  .hint {
5856
5878
  margin: 4px 0 0;
@@ -6006,14 +6028,14 @@ st([
6006
6028
  me = st([
6007
6029
  u("pigeon-font-picker")
6008
6030
  ], me);
6009
- var pr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, Z = (e, t, o, r) => {
6031
+ var pr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, U = (e, t, o, r) => {
6010
6032
  for (var i = r > 1 ? void 0 : r ? cr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
6011
6033
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
6012
6034
  return r && i && pr(t, o, i), i;
6013
6035
  };
6014
- let A = class extends g {
6036
+ let O = class extends g {
6015
6037
  constructor() {
6016
- super(...arguments), this.mergeTags = [], this.swatches = [], this.brandFonts = [], this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._previewInputRef = be(), this._triggerRef = be();
6038
+ super(...arguments), this.mergeTags = [], this.requestMergeTags = !1, this.swatches = [], this.brandFonts = [], this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._previewInputRef = be(), this._triggerRef = be();
6017
6039
  }
6018
6040
  render() {
6019
6041
  if (!this.doc) return l``;
@@ -6070,7 +6092,7 @@ let A = class extends g {
6070
6092
  <div class="field">
6071
6093
  <div class="label-row">
6072
6094
  <label>${s("panel.body.previewText")}</label>
6073
- ${this.mergeTags.length > 0 ? l`
6095
+ ${this.mergeTags.length > 0 || this.requestMergeTags ? l`
6074
6096
  <button class="tag-btn" ${ve(this._triggerRef)} @click=${this._togglePicker} title=${s("panel.common.insertMergeTag")}>
6075
6097
  ${s("panel.common.tagBtn")}
6076
6098
  </button>
@@ -6097,6 +6119,10 @@ let A = class extends g {
6097
6119
  `;
6098
6120
  }
6099
6121
  _togglePicker() {
6122
+ if (!this.mergeTags.length) {
6123
+ this.dispatchEvent(new CustomEvent("pigeon:merge-tag-request", { bubbles: !0, composed: !0 }));
6124
+ return;
6125
+ }
6100
6126
  const e = this._triggerRef.value;
6101
6127
  if (e) {
6102
6128
  if (!this._pickerOpen) {
@@ -6140,8 +6166,8 @@ let A = class extends g {
6140
6166
  this._emit({ metaField: "previewText", value: e.target.value });
6141
6167
  }
6142
6168
  };
6143
- A.styles = [
6144
- C,
6169
+ O.styles = [
6170
+ I,
6145
6171
  b`
6146
6172
  .alignment-buttons {
6147
6173
  display: flex;
@@ -6214,36 +6240,39 @@ A.styles = [
6214
6240
  }
6215
6241
  `
6216
6242
  ];
6217
- Z([
6243
+ U([
6218
6244
  p({ type: Object })
6219
- ], A.prototype, "doc", 2);
6220
- Z([
6245
+ ], O.prototype, "doc", 2);
6246
+ U([
6221
6247
  p({ type: Array })
6222
- ], A.prototype, "mergeTags", 2);
6223
- Z([
6248
+ ], O.prototype, "mergeTags", 2);
6249
+ U([
6224
6250
  p({ attribute: !1 })
6225
- ], A.prototype, "swatches", 2);
6226
- Z([
6251
+ ], O.prototype, "requestMergeTags", 2);
6252
+ U([
6227
6253
  p({ attribute: !1 })
6228
- ], A.prototype, "brandFonts", 2);
6229
- Z([
6254
+ ], O.prototype, "swatches", 2);
6255
+ U([
6256
+ p({ attribute: !1 })
6257
+ ], O.prototype, "brandFonts", 2);
6258
+ U([
6230
6259
  d()
6231
- ], A.prototype, "_pickerOpen", 2);
6232
- Z([
6260
+ ], O.prototype, "_pickerOpen", 2);
6261
+ U([
6233
6262
  d()
6234
- ], A.prototype, "_pickerX", 2);
6235
- Z([
6263
+ ], O.prototype, "_pickerX", 2);
6264
+ U([
6236
6265
  d()
6237
- ], A.prototype, "_pickerY", 2);
6238
- A = Z([
6266
+ ], O.prototype, "_pickerY", 2);
6267
+ O = U([
6239
6268
  u("pigeon-body-panel")
6240
- ], A);
6241
- var dr = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, Q = (e, t, o, r) => {
6269
+ ], O);
6270
+ var dr = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, ee = (e, t, o, r) => {
6242
6271
  for (var i = r > 1 ? void 0 : r ? hr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
6243
6272
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
6244
6273
  return r && i && dr(t, o, i), i;
6245
6274
  };
6246
- let B = class extends g {
6275
+ let j = class extends g {
6247
6276
  constructor() {
6248
6277
  super(...arguments), this.rowId = "", this.columnId = "", this.swatches = [], this._assetManagerOpen = !1;
6249
6278
  }
@@ -6396,31 +6425,31 @@ let B = class extends g {
6396
6425
  this._emit({ backgroundUrl: e.detail.url }), this._assetManagerOpen = !1;
6397
6426
  }
6398
6427
  };
6399
- B.styles = [C];
6400
- Q([
6428
+ j.styles = [I];
6429
+ ee([
6401
6430
  p({ type: Object })
6402
- ], B.prototype, "block", 2);
6403
- Q([
6431
+ ], j.prototype, "block", 2);
6432
+ ee([
6404
6433
  p({ type: String })
6405
- ], B.prototype, "rowId", 2);
6406
- Q([
6434
+ ], j.prototype, "rowId", 2);
6435
+ ee([
6407
6436
  p({ type: String })
6408
- ], B.prototype, "columnId", 2);
6409
- Q([
6437
+ ], j.prototype, "columnId", 2);
6438
+ ee([
6410
6439
  p({ type: Object })
6411
- ], B.prototype, "assetManagerConfig", 2);
6412
- Q([
6440
+ ], j.prototype, "assetManagerConfig", 2);
6441
+ ee([
6413
6442
  p({ attribute: !1 })
6414
- ], B.prototype, "assetStorage", 2);
6415
- Q([
6443
+ ], j.prototype, "assetStorage", 2);
6444
+ ee([
6416
6445
  p({ attribute: !1 })
6417
- ], B.prototype, "swatches", 2);
6418
- Q([
6446
+ ], j.prototype, "swatches", 2);
6447
+ ee([
6419
6448
  d()
6420
- ], B.prototype, "_assetManagerOpen", 2);
6421
- B = Q([
6449
+ ], j.prototype, "_assetManagerOpen", 2);
6450
+ j = ee([
6422
6451
  u("pigeon-hero-panel")
6423
- ], B);
6452
+ ], j);
6424
6453
  var gr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, Ke = (e, t, o, r) => {
6425
6454
  for (var i = r > 1 ? void 0 : r ? ur(t, o) : t, n = e.length - 1, a; n >= 0; n--)
6426
6455
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
@@ -6564,7 +6593,7 @@ let ae = class extends g {
6564
6593
  }
6565
6594
  };
6566
6595
  ae.styles = [
6567
- C,
6596
+ I,
6568
6597
  b`
6569
6598
  h4 {
6570
6599
  margin: 0 0 8px;
@@ -6724,7 +6753,7 @@ let se = class extends g {
6724
6753
  this._emit({ padding: e.detail.value });
6725
6754
  }
6726
6755
  };
6727
- se.styles = C;
6756
+ se.styles = I;
6728
6757
  We([
6729
6758
  p({ type: Object })
6730
6759
  ], se.prototype, "block", 2);
@@ -6782,7 +6811,7 @@ let _e = class extends g {
6782
6811
  this._emit({ height: e.detail.value });
6783
6812
  }
6784
6813
  };
6785
- _e.styles = C;
6814
+ _e.styles = I;
6786
6815
  lt([
6787
6816
  p({ type: Object })
6788
6817
  ], _e.prototype, "block", 2);
@@ -6954,7 +6983,7 @@ let ye = class extends g {
6954
6983
  }
6955
6984
  };
6956
6985
  ye.styles = [
6957
- C,
6986
+ I,
6958
6987
  b`
6959
6988
  h4 {
6960
6989
  margin: 0 0 8px;
@@ -7025,14 +7054,14 @@ pt([
7025
7054
  ye = pt([
7026
7055
  u("pigeon-social-panel")
7027
7056
  ], ye);
7028
- var $r = Object.defineProperty, wr = Object.getOwnPropertyDescriptor, ee = (e, t, o, r) => {
7057
+ var $r = Object.defineProperty, wr = Object.getOwnPropertyDescriptor, K = (e, t, o, r) => {
7029
7058
  for (var i = r > 1 ? void 0 : r ? wr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7030
7059
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
7031
7060
  return r && i && $r(t, o, i), i;
7032
7061
  };
7033
- let j = class extends g {
7062
+ let E = class extends g {
7034
7063
  constructor() {
7035
- super(...arguments), this.rowId = "", this.columnId = "", this.mergeTags = [], this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._textareaRef = be(), this._triggerRef = be();
7064
+ super(...arguments), this.rowId = "", this.columnId = "", this.mergeTags = [], this.requestMergeTags = !1, this._pickerOpen = !1, this._pickerX = 0, this._pickerY = 0, this._textareaRef = be(), this._triggerRef = be();
7036
7065
  }
7037
7066
  render() {
7038
7067
  if (!this.block) return l``;
@@ -7043,7 +7072,7 @@ let j = class extends g {
7043
7072
  <div class="field">
7044
7073
  <div class="label-row">
7045
7074
  <label>${s("panel.html.rawHtml")}</label>
7046
- ${t ? l`
7075
+ ${t || this.requestMergeTags ? l`
7047
7076
  <button class="tag-btn" ${ve(this._triggerRef)} @click=${this._togglePicker} title=${s("panel.common.insertMergeTag")}>
7048
7077
  ${s("panel.common.tagBtn")}
7049
7078
  </button>
@@ -7092,6 +7121,10 @@ let j = class extends g {
7092
7121
  this._emit({ padding: e.detail.value });
7093
7122
  }
7094
7123
  _togglePicker() {
7124
+ if (!this.mergeTags.length) {
7125
+ this.dispatchEvent(new CustomEvent("pigeon:merge-tag-request", { bubbles: !0, composed: !0 }));
7126
+ return;
7127
+ }
7095
7128
  const e = this._triggerRef.value;
7096
7129
  if (e) {
7097
7130
  if (!this._pickerOpen) {
@@ -7110,8 +7143,8 @@ let j = class extends g {
7110
7143
  t.setSelectionRange(h, h), t.focus(), this._emit({ content: a }), this._pickerOpen = !1;
7111
7144
  }
7112
7145
  };
7113
- j.styles = [
7114
- C,
7146
+ E.styles = [
7147
+ I,
7115
7148
  b`
7116
7149
  /* HTML payload is raw markup — show in monospace and taller than the
7117
7150
  default textarea so authors have room to work. */
@@ -7155,36 +7188,39 @@ j.styles = [
7155
7188
  }
7156
7189
  `
7157
7190
  ];
7158
- ee([
7191
+ K([
7159
7192
  p({ type: Object })
7160
- ], j.prototype, "block", 2);
7161
- ee([
7193
+ ], E.prototype, "block", 2);
7194
+ K([
7162
7195
  p({ type: String })
7163
- ], j.prototype, "rowId", 2);
7164
- ee([
7196
+ ], E.prototype, "rowId", 2);
7197
+ K([
7165
7198
  p({ type: String })
7166
- ], j.prototype, "columnId", 2);
7167
- ee([
7199
+ ], E.prototype, "columnId", 2);
7200
+ K([
7168
7201
  p({ type: Array })
7169
- ], j.prototype, "mergeTags", 2);
7170
- ee([
7202
+ ], E.prototype, "mergeTags", 2);
7203
+ K([
7204
+ p({ attribute: !1 })
7205
+ ], E.prototype, "requestMergeTags", 2);
7206
+ K([
7171
7207
  d()
7172
- ], j.prototype, "_pickerOpen", 2);
7173
- ee([
7208
+ ], E.prototype, "_pickerOpen", 2);
7209
+ K([
7174
7210
  d()
7175
- ], j.prototype, "_pickerX", 2);
7176
- ee([
7211
+ ], E.prototype, "_pickerX", 2);
7212
+ K([
7177
7213
  d()
7178
- ], j.prototype, "_pickerY", 2);
7179
- j = ee([
7214
+ ], E.prototype, "_pickerY", 2);
7215
+ E = K([
7180
7216
  u("pigeon-html-panel")
7181
- ], j);
7217
+ ], E);
7182
7218
  var kr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Ce = (e, t, o, r) => {
7183
7219
  for (var i = r > 1 ? void 0 : r ? Cr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7184
7220
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
7185
7221
  return r && i && kr(t, o, i), i;
7186
7222
  };
7187
- let q = class extends g {
7223
+ let J = class extends g {
7188
7224
  constructor() {
7189
7225
  super(...arguments), this.rowId = "", this.columnId = "", this.label = "Block", this.schema = [];
7190
7226
  }
@@ -7294,33 +7330,33 @@ let q = class extends g {
7294
7330
  );
7295
7331
  }
7296
7332
  };
7297
- q.styles = C;
7333
+ J.styles = I;
7298
7334
  Ce([
7299
7335
  p({ type: Object })
7300
- ], q.prototype, "block", 2);
7336
+ ], J.prototype, "block", 2);
7301
7337
  Ce([
7302
7338
  p({ type: String })
7303
- ], q.prototype, "rowId", 2);
7339
+ ], J.prototype, "rowId", 2);
7304
7340
  Ce([
7305
7341
  p({ type: String })
7306
- ], q.prototype, "columnId", 2);
7342
+ ], J.prototype, "columnId", 2);
7307
7343
  Ce([
7308
7344
  p({ type: String })
7309
- ], q.prototype, "label", 2);
7345
+ ], J.prototype, "label", 2);
7310
7346
  Ce([
7311
7347
  p({ type: Array })
7312
- ], q.prototype, "schema", 2);
7313
- q = Ce([
7348
+ ], J.prototype, "schema", 2);
7349
+ J = Ce([
7314
7350
  u("pigeon-custom-panel")
7315
- ], q);
7316
- var Ir = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, F = (e, t, o, r) => {
7317
- for (var i = r > 1 ? void 0 : r ? Pr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7351
+ ], J);
7352
+ var Ir = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, M = (e, t, o, r) => {
7353
+ for (var i = r > 1 ? void 0 : r ? Tr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7318
7354
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
7319
7355
  return r && i && Ir(t, o, i), i;
7320
7356
  };
7321
- let T = class extends g {
7357
+ let C = class extends g {
7322
7358
  constructor() {
7323
- super(...arguments), this.selection = null, this.mergeTags = [], this.brandKit = null, this.fontConfig = [], this.linkTypes = [];
7359
+ super(...arguments), this.selection = null, this.mergeTags = [], this.requestMergeTags = !1, this.brandKit = null, this.fontConfig = [], this.linkTypes = [];
7324
7360
  }
7325
7361
  get _swatches() {
7326
7362
  var e;
@@ -7339,6 +7375,7 @@ let T = class extends g {
7339
7375
  <pigeon-body-panel
7340
7376
  .doc=${this.doc}
7341
7377
  .mergeTags=${this.mergeTags}
7378
+ .requestMergeTags=${this.requestMergeTags}
7342
7379
  .swatches=${this._swatches}
7343
7380
  .brandFonts=${this._brandFonts}
7344
7381
  ></pigeon-body-panel>
@@ -7429,7 +7466,7 @@ let T = class extends g {
7429
7466
  _renderBlockPanel(e, t, o) {
7430
7467
  switch (e.type) {
7431
7468
  case "text":
7432
- return l`<pigeon-text-panel .block=${e} .rowId=${t} .columnId=${o} .mergeTags=${this.mergeTags}></pigeon-text-panel>`;
7469
+ return l`<pigeon-text-panel .block=${e} .rowId=${t} .columnId=${o} .mergeTags=${this.mergeTags} .requestMergeTags=${this.requestMergeTags}></pigeon-text-panel>`;
7433
7470
  case "image":
7434
7471
  return l`<pigeon-image-panel
7435
7472
  .block=${e}
@@ -7458,7 +7495,7 @@ let T = class extends g {
7458
7495
  case "social":
7459
7496
  return l`<pigeon-social-panel .block=${e} .rowId=${t} .columnId=${o}></pigeon-social-panel>`;
7460
7497
  case "html":
7461
- return l`<pigeon-html-panel .block=${e} .rowId=${t} .columnId=${o} .mergeTags=${this.mergeTags}></pigeon-html-panel>`;
7498
+ return l`<pigeon-html-panel .block=${e} .rowId=${t} .columnId=${o} .mergeTags=${this.mergeTags} .requestMergeTags=${this.requestMergeTags}></pigeon-html-panel>`;
7462
7499
  default: {
7463
7500
  const r = e.type ?? "unknown", i = yt(r);
7464
7501
  return i != null && i.propertySchema && i.propertySchema.length > 0 ? l`<pigeon-custom-panel
@@ -7489,7 +7526,7 @@ let T = class extends g {
7489
7526
  return i.blocks.find((n) => n.id === o);
7490
7527
  }
7491
7528
  };
7492
- T.styles = b`
7529
+ C.styles = b`
7493
7530
  :host {
7494
7531
  display: block;
7495
7532
  width: var(--pigeon-properties-width, 300px);
@@ -7572,37 +7609,40 @@ T.styles = b`
7572
7609
  line-height: 1.5;
7573
7610
  }
7574
7611
  `;
7575
- F([
7612
+ M([
7576
7613
  p({ type: Object })
7577
- ], T.prototype, "doc", 2);
7578
- F([
7614
+ ], C.prototype, "doc", 2);
7615
+ M([
7579
7616
  p({ type: Object })
7580
- ], T.prototype, "selection", 2);
7581
- F([
7617
+ ], C.prototype, "selection", 2);
7618
+ M([
7582
7619
  p({ type: Array })
7583
- ], T.prototype, "mergeTags", 2);
7584
- F([
7620
+ ], C.prototype, "mergeTags", 2);
7621
+ M([
7585
7622
  p({ attribute: !1 })
7586
- ], T.prototype, "assetManagerConfig", 2);
7587
- F([
7623
+ ], C.prototype, "requestMergeTags", 2);
7624
+ M([
7588
7625
  p({ attribute: !1 })
7589
- ], T.prototype, "assetStorage", 2);
7590
- F([
7626
+ ], C.prototype, "assetManagerConfig", 2);
7627
+ M([
7591
7628
  p({ attribute: !1 })
7592
- ], T.prototype, "brandKit", 2);
7593
- F([
7629
+ ], C.prototype, "assetStorage", 2);
7630
+ M([
7594
7631
  p({ attribute: !1 })
7595
- ], T.prototype, "fontConfig", 2);
7596
- F([
7632
+ ], C.prototype, "brandKit", 2);
7633
+ M([
7597
7634
  p({ attribute: !1 })
7598
- ], T.prototype, "linkTypes", 2);
7599
- T = F([
7635
+ ], C.prototype, "fontConfig", 2);
7636
+ M([
7637
+ p({ attribute: !1 })
7638
+ ], C.prototype, "linkTypes", 2);
7639
+ C = M([
7600
7640
  u("pigeon-properties")
7601
- ], T);
7602
- var Tr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, S = (e, t, o, r) => {
7641
+ ], C);
7642
+ var Pr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, D = (e, t, o, r) => {
7603
7643
  for (var i = r > 1 ? void 0 : r ? Sr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7604
7644
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
7605
- return r && i && Tr(t, o, i), i;
7645
+ return r && i && Pr(t, o, i), i;
7606
7646
  };
7607
7647
  let k = class extends g {
7608
7648
  constructor() {
@@ -7691,6 +7731,7 @@ let k = class extends g {
7691
7731
  return l`
7692
7732
  <iframe
7693
7733
  style="width: ${this._device === "mobile" ? "375px" : "100%"}; height: 100%;"
7734
+ sandbox="allow-popups allow-popups-to-escape-sandbox"
7694
7735
  srcdoc=${this._htmlContent}
7695
7736
  ></iframe>
7696
7737
  `;
@@ -7898,46 +7939,46 @@ k.styles = b`
7898
7939
  font-size: 14px;
7899
7940
  }
7900
7941
  `;
7901
- S([
7942
+ D([
7902
7943
  p({ type: Object })
7903
7944
  ], k.prototype, "renderer", 2);
7904
- S([
7945
+ D([
7905
7946
  p({ type: Object })
7906
7947
  ], k.prototype, "doc", 2);
7907
- S([
7948
+ D([
7908
7949
  p({ attribute: !1 })
7909
7950
  ], k.prototype, "documentToMjml", 2);
7910
- S([
7951
+ D([
7911
7952
  p({ attribute: !1 })
7912
7953
  ], k.prototype, "fonts", 2);
7913
- S([
7954
+ D([
7914
7955
  p({ type: Boolean, reflect: !0 })
7915
7956
  ], k.prototype, "open", 2);
7916
- S([
7957
+ D([
7917
7958
  d()
7918
7959
  ], k.prototype, "_viewMode", 2);
7919
- S([
7960
+ D([
7920
7961
  d()
7921
7962
  ], k.prototype, "_device", 2);
7922
- S([
7963
+ D([
7923
7964
  d()
7924
7965
  ], k.prototype, "_htmlContent", 2);
7925
- S([
7966
+ D([
7926
7967
  d()
7927
7968
  ], k.prototype, "_mjmlContent", 2);
7928
- S([
7969
+ D([
7929
7970
  d()
7930
7971
  ], k.prototype, "_loading", 2);
7931
- k = S([
7972
+ k = D([
7932
7973
  u("pigeon-preview")
7933
7974
  ], k);
7934
- var Or = Object.defineProperty, Dr = Object.getOwnPropertyDescriptor, $ = (e, t, o, r) => {
7935
- for (var i = r > 1 ? void 0 : r ? Dr(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7975
+ var Or = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, $ = (e, t, o, r) => {
7976
+ for (var i = r > 1 ? void 0 : r ? Er(t, o) : t, n = e.length - 1, a; n >= 0; n--)
7936
7977
  (a = e[n]) && (i = (r ? a(t, o, i) : a(i)) || i);
7937
7978
  return r && i && Or(t, o, i), i;
7938
7979
  };
7939
7980
  let _t = null;
7940
- function Er() {
7981
+ function Dr() {
7941
7982
  return _t || (_t = import("./templates.js").then((e) => e.p)), _t;
7942
7983
  }
7943
7984
  function Qt(e) {
@@ -7973,7 +8014,7 @@ let _ = class extends g {
7973
8014
  e.stopPropagation(), this._applyBodyAttribute("fontFamily", e.detail.family);
7974
8015
  }, this._handleBrandLogoInsert = (e) => {
7975
8016
  e.stopPropagation();
7976
- const { logo: t } = e.detail, o = Ye("image");
8017
+ const { logo: t } = e.detail, o = Ve("image");
7977
8018
  o.values.src = t.src, o.values.alt = t.name, t.width && (o.values.width = t.width);
7978
8019
  const r = this._state.selection;
7979
8020
  if (r != null && r.rowId && (r != null && r.columnId)) {
@@ -7986,7 +8027,7 @@ let _ = class extends g {
7986
8027
  ce(n.id, a.id, o, a.blocks.length)(this._state, this._dispatch);
7987
8028
  } else {
7988
8029
  const n = Ie([o]);
7989
- oe(Pe([n]), 0)(this._state, this._dispatch);
8030
+ oe(Te([n]), 0)(this._state, this._dispatch);
7990
8031
  }
7991
8032
  }, this._dispatch = (e) => {
7992
8033
  this._state = this._state.apply(e), this._syncHistoryFlags(), this.requestUpdate(), this._fireChange(), this._fireSelect();
@@ -8021,7 +8062,7 @@ let _ = class extends g {
8021
8062
  this._emitRowLibraryError(t, "delete");
8022
8063
  }
8023
8064
  }, this._handleKeyDown = (e) => {
8024
- if (!this._state || this._isInTextInput(e) || this._editingBlockId !== null) return;
8065
+ if (!this._state || !this._isForEditor(e) || this._isInTextInput(e) || this._editingBlockId !== null) return;
8025
8066
  const t = e.metaKey || e.ctrlKey, o = this._state.selection;
8026
8067
  if (t && !e.shiftKey && e.key.toLowerCase() === "z") {
8027
8068
  e.preventDefault(), this.undo();
@@ -8033,16 +8074,16 @@ let _ = class extends g {
8033
8074
  }
8034
8075
  if (e.key === "Escape") {
8035
8076
  const r = this._state.createTransaction();
8036
- r.setSelection(Rt()), this._dispatch(r);
8077
+ r.setSelection(Mt()), this._dispatch(r);
8037
8078
  return;
8038
8079
  }
8039
8080
  if (o) {
8040
8081
  if (e.key === "Delete" || e.key === "Backspace") {
8041
- o.type === "block" && o.rowId && o.columnId && o.blockId ? (e.preventDefault(), ho(o.rowId, o.columnId, o.blockId)(this._state, this._dispatch)) : o.type === "row" && o.rowId && (e.preventDefault(), Lt(o.rowId)(this._state, this._dispatch));
8082
+ o.type === "block" && o.rowId && o.columnId && o.blockId ? (e.preventDefault(), ho(o.rowId, o.columnId, o.blockId)(this._state, this._dispatch)) : o.type === "row" && o.rowId && (e.preventDefault(), Rt(o.rowId)(this._state, this._dispatch));
8042
8083
  return;
8043
8084
  }
8044
8085
  if (t && e.key.toLowerCase() === "d") {
8045
- o.type === "block" && o.rowId && o.columnId && o.blockId ? (e.preventDefault(), go(o.rowId, o.columnId, o.blockId)(this._state, this._dispatch)) : o.type === "row" && o.rowId && (e.preventDefault(), zt(o.rowId)(this._state, this._dispatch));
8086
+ o.type === "block" && o.rowId && o.columnId && o.blockId ? (e.preventDefault(), go(o.rowId, o.columnId, o.blockId)(this._state, this._dispatch)) : o.type === "row" && o.rowId && (e.preventDefault(), Lt(o.rowId)(this._state, this._dispatch));
8046
8087
  return;
8047
8088
  }
8048
8089
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
@@ -8062,13 +8103,13 @@ let _ = class extends g {
8062
8103
  if (o.type === "block" && o.rowId && o.columnId && o.blockId) {
8063
8104
  e.preventDefault();
8064
8105
  const r = structuredClone(this._clipboard);
8065
- r.id = Mt();
8106
+ r.id = zt();
8066
8107
  const i = this._findBlockIndex(o.rowId, o.columnId, o.blockId), n = i >= 0 ? i + 1 : void 0;
8067
8108
  ce(o.rowId, o.columnId, r, n)(this._state, this._dispatch);
8068
8109
  } else if (o.type === "column" && o.rowId && o.columnId) {
8069
8110
  e.preventDefault();
8070
8111
  const r = structuredClone(this._clipboard);
8071
- r.id = Mt(), ce(o.rowId, o.columnId, r)(this._state, this._dispatch);
8112
+ r.id = zt(), ce(o.rowId, o.columnId, r)(this._state, this._dispatch);
8072
8113
  }
8073
8114
  return;
8074
8115
  }
@@ -8079,7 +8120,7 @@ let _ = class extends g {
8079
8120
  /* Lifecycle */
8080
8121
  /* ------------------------------------------------------------------ */
8081
8122
  connectedCallback() {
8082
- super.connectedCallback(), Bt(this.config.locale, this.config.messages), this._initState(), this._applyDir(), this._resolveBrandKit(), this._applyTheme(), document.addEventListener("keydown", this._handleKeyDown), this.addEventListener("brand-kit-edit", this._handleBrandKitEdit), this.addEventListener("brand-color-apply", this._handleBrandColorApply), this.addEventListener("brand-font-apply", this._handleBrandFontApply), this.addEventListener("brand-logo-insert", this._handleBrandLogoInsert);
8123
+ super.connectedCallback(), Bt(this.config.locale, this.config.messages), this._state || this._initState(), this._applyDir(), this._resolveBrandKit(), this._applyTheme(), document.addEventListener("keydown", this._handleKeyDown), this.addEventListener("brand-kit-edit", this._handleBrandKitEdit), this.addEventListener("brand-color-apply", this._handleBrandColorApply), this.addEventListener("brand-font-apply", this._handleBrandFontApply), this.addEventListener("brand-logo-insert", this._handleBrandLogoInsert);
8083
8124
  }
8084
8125
  disconnectedCallback() {
8085
8126
  super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeyDown), this.removeEventListener("brand-kit-edit", this._handleBrandKitEdit), this.removeEventListener("brand-color-apply", this._handleBrandColorApply), this.removeEventListener("brand-font-apply", this._handleBrandFontApply), this.removeEventListener("brand-logo-insert", this._handleBrandLogoInsert);
@@ -8154,7 +8195,7 @@ let _ = class extends g {
8154
8195
  /* Render */
8155
8196
  /* ------------------------------------------------------------------ */
8156
8197
  render() {
8157
- var r;
8198
+ var r, i;
8158
8199
  if (!this._state) return l``;
8159
8200
  const e = this._state.doc, t = this._state.selection, o = this._device === "mobile" ? 375 : this._device === "tablet" ? 768 : 0;
8160
8201
  return l`
@@ -8170,6 +8211,7 @@ let _ = class extends g {
8170
8211
  @toolbar-device=${this._handleDevice}
8171
8212
  @toolbar-fullscreen=${this._handleFullscreen}
8172
8213
  @toolbar-templates=${this._handleTemplatesOpen}
8214
+ @toolbar-export=${this._handleExport}
8173
8215
  @pigeon:preview=${this._handlePreview}
8174
8216
  @pigeon:export-html=${this._handleExportHtml}
8175
8217
  @pigeon:export-mjml=${this._handleExportMjml}
@@ -8226,6 +8268,7 @@ let _ = class extends g {
8226
8268
  .doc=${e}
8227
8269
  .selection=${t}
8228
8270
  .mergeTags=${((r = this.config.mergeTags) == null ? void 0 : r.tags) ?? []}
8271
+ .requestMergeTags=${!!this.config.mergeTags && !((i = this.config.mergeTags.tags) != null && i.length)}
8229
8272
  .assetManagerConfig=${this.config.assetManager ?? {}}
8230
8273
  .assetStorage=${this.assetStorage ?? this.config.assetStorage}
8231
8274
  .brandKit=${this._activeBrandKit}
@@ -8246,9 +8289,9 @@ let _ = class extends g {
8246
8289
  .renderer=${this.renderer}
8247
8290
  .documentToMjml=${this.documentToMjml}
8248
8291
  .fonts=${this._renderFonts()}
8249
- @click=${(i) => {
8250
- var n;
8251
- (n = i.target.classList) != null && n.contains("overlay") && (this._previewOpen = !1);
8292
+ @click=${(n) => {
8293
+ var a;
8294
+ (a = n.target.classList) != null && a.contains("overlay") && (this._previewOpen = !1);
8252
8295
  }}
8253
8296
  ></pigeon-preview>
8254
8297
 
@@ -8326,7 +8369,7 @@ let _ = class extends g {
8326
8369
  o.addStep(n), this._dispatch(o);
8327
8370
  }
8328
8371
  async _handleTemplatesOpen() {
8329
- this._templatePickerLoaded || (await Er(), this._templatePickerLoaded = !0), this._templatePickerOpen = !0;
8372
+ this._templatePickerLoaded || (await Dr(), this._templatePickerLoaded = !0), this._templatePickerOpen = !0;
8330
8373
  }
8331
8374
  _handleTemplateLoad(e) {
8332
8375
  var o;
@@ -8400,23 +8443,32 @@ let _ = class extends g {
8400
8443
  composed: !0
8401
8444
  }));
8402
8445
  }
8403
- _handleExportHtml() {
8446
+ _handleExport() {
8447
+ this.dispatchEvent(new CustomEvent("pigeon:export", {
8448
+ bubbles: !0,
8449
+ composed: !0
8450
+ }));
8451
+ }
8452
+ async _handleExportHtml(e) {
8453
+ e.stopPropagation();
8454
+ const t = this._state.doc, o = await this.exportHtml();
8404
8455
  this.dispatchEvent(new CustomEvent("pigeon:export-html", {
8405
- detail: { document: this._state.doc },
8456
+ detail: { document: t, html: o },
8406
8457
  bubbles: !0,
8407
8458
  composed: !0
8408
8459
  }));
8409
8460
  }
8410
- _handleExportMjml() {
8411
- const e = this.documentToMjml ? this.documentToMjml(this._state.doc, { fonts: this._renderFonts() }) : null;
8461
+ _handleExportMjml(e) {
8462
+ e.stopPropagation();
8463
+ const t = this.documentToMjml ? this.documentToMjml(this._state.doc, { fonts: this._renderFonts() }) : null;
8412
8464
  this.dispatchEvent(new CustomEvent("pigeon:export-mjml", {
8413
- detail: { document: this._state.doc, mjml: e },
8465
+ detail: { document: this._state.doc, mjml: t },
8414
8466
  bubbles: !0,
8415
8467
  composed: !0
8416
8468
  }));
8417
8469
  }
8418
- _handleExportJson() {
8419
- this.dispatchEvent(new CustomEvent("pigeon:export-json", {
8470
+ _handleExportJson(e) {
8471
+ e.stopPropagation(), this.dispatchEvent(new CustomEvent("pigeon:export-json", {
8420
8472
  detail: { document: this._state.doc },
8421
8473
  bubbles: !0,
8422
8474
  composed: !0
@@ -8473,7 +8525,7 @@ let _ = class extends g {
8473
8525
  _handleBodySelect() {
8474
8526
  this._editingBlockId = null;
8475
8527
  const e = this._state.createTransaction();
8476
- e.setSelection(Rt()), this._dispatch(e);
8528
+ e.setSelection(Mt()), this._dispatch(e);
8477
8529
  }
8478
8530
  /* ------------------------------------------------------------------ */
8479
8531
  /* Row action handlers */
@@ -8482,10 +8534,10 @@ let _ = class extends g {
8482
8534
  wo(e.detail.rowId, e.detail.toIndex)(this._state, this._dispatch);
8483
8535
  }
8484
8536
  _handleRowDuplicate(e) {
8485
- zt(e.detail.rowId)(this._state, this._dispatch);
8537
+ Lt(e.detail.rowId)(this._state, this._dispatch);
8486
8538
  }
8487
8539
  _handleRowDelete(e) {
8488
- Lt(e.detail.rowId)(this._state, this._dispatch);
8540
+ Rt(e.detail.rowId)(this._state, this._dispatch);
8489
8541
  }
8490
8542
  async _refreshSavedTab() {
8491
8543
  var o;
@@ -8516,6 +8568,11 @@ let _ = class extends g {
8516
8568
  }
8517
8569
  return !1;
8518
8570
  }
8571
+ /** True when the key press is aimed at the editor, or at nothing else on the page. */
8572
+ _isForEditor(e) {
8573
+ const t = e.composedPath()[0];
8574
+ return t === document || t === document.body || t === document.documentElement ? !0 : e.composedPath().includes(this);
8575
+ }
8519
8576
  _flattenBlockLocations() {
8520
8577
  const e = [];
8521
8578
  for (const t of this._state.doc.body.rows)
@@ -8561,13 +8618,13 @@ let _ = class extends g {
8561
8618
  /* DnD handlers */
8562
8619
  /* ------------------------------------------------------------------ */
8563
8620
  _handleRowDrop(e) {
8564
- const { index: t, columnCount: o } = e.detail, r = Array.from({ length: o }, () => Ie()), i = Pe(r);
8621
+ const { index: t, columnCount: o } = e.detail, r = Array.from({ length: o }, () => Ie()), i = Te(r);
8565
8622
  oe(i, t)(this._state, this._dispatch);
8566
8623
  }
8567
8624
  _handleBlockDrop(e) {
8568
8625
  const { rowId: t, columnId: o, index: r, dragData: i } = e.detail;
8569
8626
  if (i.type === "palette-block" && i.blockType) {
8570
- const n = Ye(i.blockType);
8627
+ const n = Ve(i.blockType);
8571
8628
  ce(t, o, n, r)(this._state, this._dispatch);
8572
8629
  } else i.type === "existing-block" && i.blockId && i.rowId && i.columnId && ko(
8573
8630
  i.rowId,
@@ -8579,7 +8636,7 @@ let _ = class extends g {
8579
8636
  )(this._state, this._dispatch);
8580
8637
  }
8581
8638
  _handleBlockDropNewRow(e) {
8582
- const { blockType: t, rowIndex: o } = e.detail, r = Ye(t), i = Ie([r]), n = Pe([i]);
8639
+ const { blockType: t, rowIndex: o } = e.detail, r = Ve(t), i = Ie([r]), n = Te([i]);
8583
8640
  oe(n, o)(this._state, this._dispatch);
8584
8641
  }
8585
8642
  /**
@@ -8591,11 +8648,11 @@ let _ = class extends g {
8591
8648
  const { type: t, blockType: o, columnCount: r } = e.detail, i = this._state.doc.body.rows;
8592
8649
  if (t === "palette-row") {
8593
8650
  const a = Array.from({ length: r }, () => Ie());
8594
- oe(Pe(a), i.length)(this._state, this._dispatch);
8651
+ oe(Te(a), i.length)(this._state, this._dispatch);
8595
8652
  return;
8596
8653
  }
8597
8654
  if (!o) return;
8598
- const n = Ye(o);
8655
+ const n = Ve(o);
8599
8656
  if (i.length > 0) {
8600
8657
  const a = i[i.length - 1], h = a.columns[0];
8601
8658
  ce(a.id, h.id, n, h.blocks.length)(
@@ -8604,7 +8661,7 @@ let _ = class extends g {
8604
8661
  );
8605
8662
  } else {
8606
8663
  const a = Ie([n]);
8607
- oe(Pe([a]), 0)(this._state, this._dispatch);
8664
+ oe(Te([a]), 0)(this._state, this._dispatch);
8608
8665
  }
8609
8666
  }
8610
8667
  /* ------------------------------------------------------------------ */
@@ -8630,11 +8687,11 @@ let _ = class extends g {
8630
8687
  const v = this._state.doc.body.rows.find((m) => m.id === t);
8631
8688
  if (v && v.columns.length > 1) {
8632
8689
  const m = v.columns[v.columns.length - 1];
8633
- Po(t, m.id)(this._state, this._dispatch);
8690
+ To(t, m.id)(this._state, this._dispatch);
8634
8691
  }
8635
8692
  }
8636
8693
  const h = this._state.doc.body.rows.find((c) => c.id === t);
8637
- h && h.columns.length === o.length && To(t, o)(this._state, this._dispatch);
8694
+ h && h.columns.length === o.length && Po(t, o)(this._state, this._dispatch);
8638
8695
  }
8639
8696
  _handleBodyPropertyChange(e) {
8640
8697
  const { attribute: t, metaField: o, value: r } = e.detail, i = this._state.createTransaction();
@@ -8668,7 +8725,7 @@ let _ = class extends g {
8668
8725
  }
8669
8726
  };
8670
8727
  _.styles = [
8671
- Do,
8728
+ Eo,
8672
8729
  b`
8673
8730
  :host {
8674
8731
  display: flex;
@@ -8755,42 +8812,42 @@ _ = $([
8755
8812
  export {
8756
8813
  Ne as PigeonAlignmentPicker,
8757
8814
  x as PigeonAssetManager,
8758
- A as PigeonBodyPanel,
8815
+ O as PigeonBodyPanel,
8759
8816
  he as PigeonButtonBlock,
8760
- Y as PigeonButtonPanel,
8817
+ G as PigeonButtonPanel,
8761
8818
  P as PigeonCanvas,
8762
8819
  fe as PigeonColorPicker,
8763
- O as PigeonColumn,
8820
+ A as PigeonColumn,
8764
8821
  Be as PigeonDividerBlock,
8765
8822
  Ge as PigeonDropIndicator,
8766
8823
  _ as PigeonEditor,
8767
8824
  ge as PigeonHeroBlock,
8768
- B as PigeonHeroPanel,
8769
- Le as PigeonHtmlBlock,
8825
+ j as PigeonHeroPanel,
8826
+ Re as PigeonHtmlBlock,
8770
8827
  Ae as PigeonImageBlock,
8771
8828
  z as PigeonImagePanel,
8772
- Ee as PigeonLayers,
8773
- V as PigeonMergeTagPicker,
8774
- ze as PigeonNavBarBlock,
8829
+ De as PigeonLayers,
8830
+ X as PigeonMergeTagPicker,
8831
+ Le as PigeonNavBarBlock,
8775
8832
  ae as PigeonNavBarPanel,
8776
- I as PigeonPalette,
8777
- W as PigeonPaletteItem,
8833
+ T as PigeonPalette,
8834
+ Y as PigeonPaletteItem,
8778
8835
  k as PigeonPreview,
8779
- T as PigeonProperties,
8780
- D as PigeonRow,
8836
+ C as PigeonProperties,
8837
+ B as PigeonRow,
8781
8838
  et as PigeonRowPanel,
8782
8839
  L as PigeonSliderInput,
8783
- Re as PigeonSocialBlock,
8840
+ Me as PigeonSocialBlock,
8784
8841
  je as PigeonSpacerBlock,
8785
8842
  Ue as PigeonSpacingInput,
8786
8843
  Kr as PigeonTemplatePicker,
8787
8844
  de as PigeonTextBlock,
8788
- E as PigeonTextPanel,
8789
- K as PigeonToolbar,
8790
- Yo as calculateBlockDropIndex,
8791
- Vo as calculateRowDropIndex,
8845
+ S as PigeonTextPanel,
8846
+ V as PigeonToolbar,
8847
+ Vo as calculateBlockDropIndex,
8848
+ qo as calculateRowDropIndex,
8792
8849
  Xe as clearDragData,
8793
- De as getDragData,
8850
+ Ee as getDragData,
8794
8851
  Fr as readDragTransfer,
8795
8852
  Bo as setDragData,
8796
8853
  wt as writeDragTransfer