monto-email-builder 1.4.2 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/HtmlEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6F,MAAM,OAAO,CAAC;AAmBlH,OAAO,EAaL,OAAO,EAIP,KAAK,EAKN,MAAM,eAAe,CAAC;AAWvB,OAAO,EAAE,QAAQ,EAAK,MAAM,SAAS,CAAC;AAKtC,OAAO,EASL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACxC,MAAM,aAAa,CAAC;AAYrB,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,WAAW,CAAC;AACzD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kCAAkC,GACnC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,sBAAsB,EAAE,CAAC;IAC9C,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,IAAI,KAAK,sBAAsB,EAAE,CAAC;IACjG,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;IAC5D,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AA8DD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;OAEG;IACH,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACtC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,sBAAsB,EAAE,KAAK,IAAI,CAAC;IAClE;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AA48BD,QAAA,MAAM,mBAAmB,uFAevB,CAAC;AAGH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/HtmlEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6F,MAAM,OAAO,CAAC;AAmBlH,OAAO,EAaL,OAAO,EAIP,KAAK,EAKN,MAAM,eAAe,CAAC;AAWvB,OAAO,EAAE,QAAQ,EAAK,MAAM,SAAS,CAAC;AAKtC,OAAO,EASL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACxC,MAAM,aAAa,CAAC;AAYrB,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,WAAW,CAAC;AACzD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,kCAAkC,GACnC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,sBAAsB,EAAE,CAAC;IAC9C,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,IAAI,KAAK,sBAAsB,EAAE,CAAC;IACjG,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;IAC5D,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AA8DD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC;;OAEG;IACH,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACtC;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,sBAAsB,EAAE,KAAK,IAAI,CAAC;IAClE;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAi+BD,QAAA,MAAM,mBAAmB,uFAevB,CAAC;AAGH,eAAe,mBAAmB,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { jsx as o, jsxs as f, Fragment as Nt } from "react/jsx-runtime";
2
- import { forwardRef as dt, useState as E, useRef as $, useEffect as X, useCallback as D, useMemo as J, useImperativeHandle as zt } from "react";
2
+ import { forwardRef as dt, useState as V, useRef as $, useEffect as G, useCallback as L, useMemo as J, useImperativeHandle as zt } from "react";
3
3
  import Ot from "@uiw/react-codemirror";
4
4
  import { html as Pt } from "@codemirror/lang-html";
5
5
  import { xcodeDark as _t, tomorrowNightBlue as Wt, dracula as ut, basicDark as jt, abcdef as Gt, bbedit as Ut, noctisLilac as qt, gruvboxLight as Yt, tokyoNightDay as Kt, vscodeLight as Xt, xcodeLight as Jt } from "@uiw/codemirror-themes-all";
6
6
  import Q from "@mui/material/ToggleButton";
7
7
  import et from "@mui/material/ToggleButtonGroup";
8
- import { ThemeProvider as Qt, ScopedCssBaseline as Zt, useTheme as er, Box as m, Tooltip as G, FormControl as tr, InputLabel as rr, Select as or, ListSubheader as tt, MenuItem as rt, Button as ve, Tabs as ar, Tab as ot, Typography as B, Accordion as nr, AccordionSummary as ir, AccordionDetails as lr, TextField as ye, Divider as sr } from "@mui/material";
9
- import { alpha as ce } from "@mui/material/styles";
8
+ import { ThemeProvider as Qt, ScopedCssBaseline as Zt, useTheme as er, Box as b, Tooltip as U, FormControl as tr, InputLabel as rr, Select as or, ListSubheader as tt, MenuItem as rt, Button as Ie, Tabs as nr, Tab as ot, Typography as A, Accordion as ar, AccordionSummary as ir, AccordionDetails as lr, TextField as Ee, Divider as sr } from "@mui/material";
9
+ import { alpha as de } from "@mui/material/styles";
10
10
  import * as cr from "@mui/icons-material/AddOutlined";
11
11
  import * as dr from "@mui/icons-material/Code";
12
12
  import * as ur from "@mui/icons-material/DataObjectOutlined";
@@ -16,64 +16,64 @@ import * as br from "@mui/icons-material/Visibility";
16
16
  import * as pr from "@mui/icons-material/ViewColumn";
17
17
  import * as fr from "@mui/icons-material/MonitorOutlined";
18
18
  import * as xr from "@mui/icons-material/PhoneIphoneOutlined";
19
- import { B as gr, V as A, r as L, T as vr, t as yr } from "./chunks/chunk-ZMWDxWGX.js";
20
- const Ee = gr, at = "unsubscribe_link", Ve = /\{\{\s*([^{}]+?)\s*\}\}/g, nt = /\{%\s*([^{}%]+?)\s*%\}/g;
21
- function Te(a, n, s, d, c) {
22
- return a[n - 1] !== d && a[s] !== c;
19
+ import { B as gr, V as F, r as k, T as vr, t as yr } from "./chunks/chunk-ZMWDxWGX.js";
20
+ const Ve = gr, nt = "unsubscribe_link", Te = /\{\{\s*([^{}]+?)\s*\}\}/g, at = /\{%\s*([^{}%]+?)\s*%\}/g;
21
+ function Ce(n, a, s, d, c) {
22
+ return n[a - 1] !== d && n[s] !== c;
23
23
  }
24
- function mt(a, n = "user") {
25
- return n === "builtin" || n === "system" ? `{%${a}%}` : `{{${a}}}`;
24
+ function mt(n, a = "user") {
25
+ return a === "builtin" || a === "system" ? `{%${n}%}` : `{{${n}}}`;
26
26
  }
27
- function Ir(a) {
28
- const n = typeof a == "string" ? a.trim() : "";
29
- if (n.startsWith("{{") && n.endsWith("}}")) {
30
- const s = n.slice(2, -2).trim();
31
- if (A.test(s)) return { attribute: s, type: "user" };
27
+ function Ir(n) {
28
+ const a = typeof n == "string" ? n.trim() : "";
29
+ if (a.startsWith("{{") && a.endsWith("}}")) {
30
+ const s = a.slice(2, -2).trim();
31
+ if (F.test(s)) return { attribute: s, type: "user" };
32
32
  }
33
- if (n.startsWith("{%") && n.endsWith("%}")) {
34
- const s = n.slice(2, -2).trim();
35
- if (A.test(s)) return { attribute: s, type: "system" };
33
+ if (a.startsWith("{%") && a.endsWith("%}")) {
34
+ const s = a.slice(2, -2).trim();
35
+ if (F.test(s)) return { attribute: s, type: "system" };
36
36
  }
37
37
  return null;
38
38
  }
39
- function Er(a, n) {
40
- const s = a.variable ?? a.Variable ?? a.key ?? "", d = Ir(s), x = (a.type ?? a.Type ?? (d == null ? void 0 : d.type) ?? "user") === "system" ? "system" : "user", i = a.attribute ?? a.Attribute ?? (d == null ? void 0 : d.attribute) ?? "", u = String(i).trim();
41
- return !u || !A.test(u) ? null : {
42
- id: Number(a.id) || n + 1,
43
- variableInstanceId: a.variableInstanceId ?? a.VariableInstanceId,
44
- variable: x === "system" ? `{%${u}%}` : `{{${u}}}`,
39
+ function Er(n, a) {
40
+ const s = n.variable ?? n.Variable ?? n.key ?? "", d = Ir(s), x = (n.type ?? n.Type ?? (d == null ? void 0 : d.type) ?? "user") === "system" ? "system" : "user", i = n.attribute ?? n.Attribute ?? (d == null ? void 0 : d.attribute) ?? "", h = String(i).trim();
41
+ return !h || !F.test(h) ? null : {
42
+ id: Number(n.id) || a + 1,
43
+ variableInstanceId: n.variableInstanceId ?? n.VariableInstanceId,
44
+ variable: x === "system" ? `{%${h}%}` : `{{${h}}}`,
45
45
  type: x,
46
- attribute: u,
47
- default: String(a.default ?? a.Default ?? a.value ?? "")
46
+ attribute: h,
47
+ default: String(n.default ?? n.Default ?? n.value ?? "")
48
48
  };
49
49
  }
50
- function it(a) {
51
- return Array.isArray(a) ? a.map((n, s) => Er(n, s)).filter((n) => !!n).map((n, s) => ({
52
- ...n,
50
+ function it(n) {
51
+ return Array.isArray(n) ? n.map((a, s) => Er(a, s)).filter((a) => !!a).map((a, s) => ({
52
+ ...a,
53
53
  id: s + 1,
54
- variableInstanceId: n.variableInstanceId || we(n.type, n.attribute, s)
54
+ variableInstanceId: a.variableInstanceId || He(a.type, a.attribute, s)
55
55
  })) : [];
56
56
  }
57
- function de(a) {
58
- const n = a || "", s = [], d = (i, u, p) => {
59
- s.push({ attribute: i, type: u, start: p });
57
+ function Z(n) {
58
+ const a = n || "", s = [], d = (i, h, p) => {
59
+ s.push({ attribute: i, type: h, start: p });
60
60
  };
61
61
  let c;
62
- for (Ve.lastIndex = 0; c = Ve.exec(n); ) {
63
- const i = c.index, u = i + c[0].length;
64
- if (!Te(n, i, u, "{", "}")) continue;
62
+ for (Te.lastIndex = 0; c = Te.exec(a); ) {
63
+ const i = c.index, h = i + c[0].length;
64
+ if (!Ce(a, i, h, "{", "}")) continue;
65
65
  const p = c[1].trim();
66
- !p || !A.test(p) || d(p, "user", i);
66
+ !p || !F.test(p) || d(p, "user", i);
67
67
  }
68
68
  let x;
69
- for (nt.lastIndex = 0; x = nt.exec(n); ) {
70
- const i = x.index, u = i + x[0].length;
71
- if (!Te(n, i, u, "{", "}")) continue;
69
+ for (at.lastIndex = 0; x = at.exec(a); ) {
70
+ const i = x.index, h = i + x[0].length;
71
+ if (!Ce(a, i, h, "{", "}")) continue;
72
72
  const p = x[1].trim();
73
- !p || !A.test(p) || d(p, "system", i);
73
+ !p || !F.test(p) || d(p, "system", i);
74
74
  }
75
- return s.sort((i, u) => i.start - u.start), s.map((i, u) => ({
76
- id: u + 1,
75
+ return s.sort((i, h) => i.start - h.start), s.map((i, h) => ({
76
+ id: h + 1,
77
77
  variableInstanceId: wr(i.type, i.attribute, i.start),
78
78
  variable: i.type === "system" ? `{%${i.attribute}%}` : `{{${i.attribute}}}`,
79
79
  type: i.type,
@@ -81,77 +81,77 @@ function de(a) {
81
81
  default: ""
82
82
  }));
83
83
  }
84
- function Ie(a, n) {
84
+ function ue(n, a) {
85
85
  const s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
86
- return n.forEach((c) => {
86
+ return a.forEach((c) => {
87
87
  const x = { item: c, consumed: !1 };
88
88
  if (c.variableInstanceId) {
89
89
  const p = s.get(c.variableInstanceId) ?? [];
90
90
  p.push(x), s.set(c.variableInstanceId, p);
91
91
  }
92
- const i = `${c.type}:${c.attribute}`, u = d.get(i) ?? [];
93
- u.push(x), d.set(i, u);
94
- }), a.map((c, x) => {
92
+ const i = `${c.type}:${c.attribute}`, h = d.get(i) ?? [];
93
+ h.push(x), d.set(i, h);
94
+ }), n.map((c, x) => {
95
95
  var N;
96
- const i = `${c.type}:${c.attribute}`, u = c.variableInstanceId ? (N = s.get(c.variableInstanceId)) == null ? void 0 : N.find((g) => !g.consumed) : void 0, p = (d.get(i) ?? []).find((g) => !g.consumed), w = u ?? p;
97
- return w && (w.consumed = !0), {
96
+ const i = `${c.type}:${c.attribute}`, h = c.variableInstanceId ? (N = s.get(c.variableInstanceId)) == null ? void 0 : N.find((g) => !g.consumed) : void 0, p = (d.get(i) ?? []).find((g) => !g.consumed), H = h ?? p;
97
+ return H && (H.consumed = !0), {
98
98
  ...c,
99
99
  id: x + 1,
100
- variableInstanceId: c.variableInstanceId || we(c.type, c.attribute, x),
101
- default: c.type === "system" ? "" : (w == null ? void 0 : w.item.default) ?? c.default ?? ""
100
+ variableInstanceId: c.variableInstanceId || He(c.type, c.attribute, x),
101
+ default: c.type === "system" ? "" : (H == null ? void 0 : H.item.default) ?? c.default ?? ""
102
102
  };
103
103
  });
104
104
  }
105
- function Vr(a) {
106
- return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
105
+ function Vr(n) {
106
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
107
107
  }
108
- function lt(a, n) {
108
+ function lt(n, a) {
109
109
  const s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
110
- n.forEach((i) => {
110
+ a.forEach((i) => {
111
111
  i.type === "user" && (i.variableInstanceId && s.set(i.variableInstanceId, i.default ?? ""), d.has(i.attribute) || d.set(i.attribute, i.default ?? ""));
112
112
  });
113
- const c = de(a), x = /* @__PURE__ */ new Map();
113
+ const c = Z(n), x = /* @__PURE__ */ new Map();
114
114
  return c.forEach((i) => {
115
- const u = Number(String(i.variableInstanceId ?? "").split("-at-")[1]);
116
- Number.isFinite(u) && x.set(u, i);
117
- }), (a || "").replace(Ve, (i, u, p, w) => {
118
- var Z;
115
+ const h = Number(String(i.variableInstanceId ?? "").split("-at-")[1]);
116
+ Number.isFinite(h) && x.set(h, i);
117
+ }), (n || "").replace(Te, (i, h, p, H) => {
118
+ var ee;
119
119
  const N = p + i.length;
120
- if (!Te(w, p, N, "{", "}")) return i;
121
- const g = String(u).trim();
122
- if (!g || !A.test(g)) return i;
123
- const F = (Z = x.get(p)) == null ? void 0 : Z.variableInstanceId, z = (F ? s.get(F) : void 0) ?? (n.filter((l) => l.type === "user" && l.attribute === g).length === 1 ? d.get(g) : void 0);
120
+ if (!Ce(H, p, N, "{", "}")) return i;
121
+ const g = String(h).trim();
122
+ if (!g || !F.test(g)) return i;
123
+ const R = (ee = x.get(p)) == null ? void 0 : ee.variableInstanceId, z = (R ? s.get(R) : void 0) ?? (a.filter((l) => l.type === "user" && l.attribute === g).length === 1 ? d.get(g) : void 0);
124
124
  return z === void 0 || z === "" ? i : Vr(z);
125
125
  });
126
126
  }
127
- function st(a, n, s = "") {
128
- const d = a.trim();
129
- if (!d || !A.test(d)) return null;
130
- const c = n === "builtin" ? "system" : "user";
127
+ function st(n, a, s = "") {
128
+ const d = n.trim();
129
+ if (!d || !F.test(d)) return null;
130
+ const c = a === "builtin" ? "system" : "user";
131
131
  return {
132
132
  id: 1,
133
- variableInstanceId: we(c, d, 0),
134
- variable: mt(d, n),
133
+ variableInstanceId: He(c, d, 0),
134
+ variable: mt(d, a),
135
135
  type: c,
136
136
  attribute: d,
137
137
  default: c === "system" ? "" : s
138
138
  };
139
139
  }
140
- function Tr(a) {
141
- const n = a.trim();
142
- return n ? Ee.some((s) => s.items.some((d) => d.name === n)) : !1;
140
+ function Tr(n) {
141
+ const a = n.trim();
142
+ return a ? Ve.some((s) => s.items.some((d) => d.name === a)) : !1;
143
143
  }
144
- function Cr(a, n) {
145
- const s = a.trim();
146
- return n === "user" && s === at ? `<a href="{{${at}}}">Unsubscribe Link</a>` : mt(s, n);
144
+ function Cr(n, a) {
145
+ const s = n.trim();
146
+ return a === "user" && s === nt ? `<a href="{{${nt}}}">Unsubscribe Link</a>` : mt(s, a);
147
147
  }
148
- function we(a, n, s) {
149
- return `html-${a}-${n}-${s + 1}`;
148
+ function He(n, a, s) {
149
+ return `html-${n}-${a}-${s + 1}`;
150
150
  }
151
- function wr(a, n, s) {
152
- return `html-${a}-${n}-at-${s}`;
151
+ function wr(n, a, s) {
152
+ return `html-${n}-${a}-at-${s}`;
153
153
  }
154
- const Hr = L(cr), Sr = L(dr), Mr = L(ur), Dr = L(mr), Lr = L(hr), kr = L(br), Br = L(pr), Ar = L(fr), Fr = L(xr), Ce = {
154
+ const Hr = k(cr), Sr = k(dr), Mr = k(ur), Dr = k(mr), Lr = k(hr), kr = k(br), Br = k(pr), Ar = k(fr), Fr = k(xr), we = {
155
155
  // 浅色主题
156
156
  xcodeLight: Jt,
157
157
  vscodeLight: Xt,
@@ -179,207 +179,214 @@ const Hr = L(cr), Sr = L(dr), Mr = L(ur), Dr = L(mr), Lr = L(hr), kr = L(br), Br
179
179
  tomorrowNightBlue: "Tomorrow Night Blue (Dark)",
180
180
  xcodeDark: "Xcode Dark (Dark)"
181
181
  }, ht = "html-editor-theme", ct = "dracula";
182
- function Nr(a = ct) {
183
- const n = a && Ce[a] ? a : ct;
184
- if (typeof window > "u") return n;
182
+ function Nr(n = ct) {
183
+ const a = n && we[n] ? n : ct;
184
+ if (typeof window > "u") return a;
185
185
  try {
186
186
  const s = localStorage.getItem(ht);
187
- if (s && Ce[s]) return s;
187
+ if (s && we[s]) return s;
188
188
  } catch {
189
189
  console.error("Failed to get HTML Editor stored theme");
190
190
  }
191
- return n;
191
+ return a;
192
192
  }
193
- function zr(a) {
193
+ function zr(n) {
194
194
  try {
195
- localStorage.setItem(ht, a);
195
+ localStorage.setItem(ht, n);
196
196
  } catch {
197
- console.error("Failed to set HTML Editor stored theme", a);
197
+ console.error("Failed to set HTML Editor stored theme", n);
198
198
  }
199
199
  }
200
200
  function Or({
201
- value: a,
202
- onChange: n,
201
+ value: n,
202
+ onChange: a,
203
203
  language: s = "zh",
204
204
  initialMode: d = "split",
205
205
  initialDevice: c = "desktop",
206
206
  codeEditorHeight: x = "100%",
207
207
  previewHeight: i = "100%",
208
- sx: u,
208
+ sx: h,
209
209
  showToolbar: p = !0,
210
- initialTheme: w,
210
+ initialTheme: H,
211
211
  initialRightTab: N = "preview",
212
212
  variables: g,
213
- onVariablesChange: F,
213
+ onVariablesChange: R,
214
214
  requireVariableDefaults: z = !0
215
- }, Z) {
215
+ }, ee) {
216
216
  var Re, $e, Ne, ze, Oe, Pe, _e, We, je, Ge, Ue, qe, Ye, Ke, Xe, Je, Qe, Ze;
217
- const l = (e, t) => yr(e, t, s), [H, pt] = E(d), [O, ft] = E(c), [He, xt] = E(() => Nr(w)), [T, ue] = E(a), [ee, P] = E(N), [C, Se] = E(() => it(g)), [gt, vt] = E(!1), [yt, It] = E(null), [_, Me] = E(""), [W, De] = E(""), [me, te] = E(!1), [he, re] = E(!1), U = $(null), be = $(null), R = $(C), Le = $(null), ke = $(null), pe = $(!1), oe = $(null);
218
- X(() => {
219
- a !== T && ue(a);
220
- }, [a]), X(() => {
217
+ const l = (e, t) => yr(e, t, s), [S, pt] = V(d), [O, ft] = V(c), [Se, xt] = V(() => Nr(H)), [E, me] = V(n), [te, P] = V(N), [w, he] = V(() => it(g)), [gt, vt] = V(!1), [yt, It] = V(null), [_, Me] = V(""), [W, De] = V(""), [be, re] = V(!1), [pe, oe] = V(!1), q = $(null), fe = $(null), T = $(w), Le = $(null), ke = $(null), xe = $(!1), ne = $(null);
218
+ G(() => {
219
+ n !== E && me(n);
220
+ }, [n]), G(() => {
221
221
  if (g === void 0) return;
222
222
  const e = it(g);
223
- R.current = e, Se(e);
224
- }, [g]);
225
- const k = D(
223
+ T.current = e, he(e);
224
+ }, [g]), G(() => {
225
+ if (g !== void 0) return;
226
+ const e = Z(E), t = ue(e, T.current);
227
+ (t.length !== T.current.length || t.some((u, v) => {
228
+ const m = T.current[v];
229
+ return !m || m.variableInstanceId !== u.variableInstanceId || m.attribute !== u.attribute || m.type !== u.type || m.default !== u.default;
230
+ })) && (T.current = t, he(t));
231
+ }, [E, g]);
232
+ const B = L(
226
233
  (e) => {
227
- const t = e.map((r, h) => ({
234
+ const t = e.map((r, u) => ({
228
235
  ...r,
229
- id: h + 1,
236
+ id: u + 1,
230
237
  default: r.type === "system" ? "" : r.default ?? ""
231
238
  }));
232
- return R.current = t, Se(t), F == null || F(t), t;
239
+ return T.current = t, he(t), R == null || R(t), t;
233
240
  },
234
- [F]
235
- ), S = D(() => {
241
+ [R]
242
+ ), M = L(() => {
236
243
  var t, r;
237
- const e = (r = (t = be.current) == null ? void 0 : t.state) == null ? void 0 : r.doc;
238
- return e && typeof e.toString == "function" ? e.toString() : T;
239
- }, [T]), fe = (e) => {
240
- ue(e), U.current && clearTimeout(U.current), U.current = setTimeout(() => {
241
- n == null || n(e);
244
+ const e = (r = (t = fe.current) == null ? void 0 : t.state) == null ? void 0 : r.doc;
245
+ return e && typeof e.toString == "function" ? e.toString() : E;
246
+ }, [E]), ge = (e) => {
247
+ me(e), q.current && clearTimeout(q.current), q.current = setTimeout(() => {
248
+ a == null || a(e);
242
249
  }, 300);
243
- }, q = D(
250
+ }, Y = L(
244
251
  (e) => {
245
- const t = de(e ?? S()), r = Ie(t, R.current);
246
- return k(r);
252
+ const t = Z(e ?? M()), r = ue(t, T.current);
253
+ return B(r);
247
254
  },
248
- [S, k]
249
- ), ae = D(() => {
250
- const e = S();
251
- e !== T && ue(e);
252
- const t = q(e), r = z ? t.filter((h) => h.type === "user" && h.default.trim() === "") : [];
255
+ [M, B]
256
+ ), ae = L(() => {
257
+ const e = M();
258
+ e !== E && me(e);
259
+ const t = Y(e), r = z ? t.filter((u) => u.type === "user" && u.default.trim() === "") : [];
253
260
  return vt(r.length > 0), r.length > 0 && P("variables"), {
254
261
  valid: r.length === 0,
255
262
  variables: t,
256
263
  missing: r
257
264
  };
258
- }, [S, T, z, q]), Et = D(() => {
259
- pe.current = !0, ae(), P("variables");
265
+ }, [M, E, z, Y]), Et = L(() => {
266
+ xe.current = !0, ae(), P("variables");
260
267
  }, [ae]);
261
- X(() => {
262
- if (ee !== "variables" || !pe.current) return;
268
+ G(() => {
269
+ if (te !== "variables" || !xe.current) return;
263
270
  const e = window.requestAnimationFrame(() => {
264
271
  const t = Le.current, r = ke.current;
265
272
  t && r && t.scrollTo({
266
273
  top: Math.max(r.offsetTop - 8, 0),
267
274
  behavior: "auto"
268
- }), pe.current = !1;
275
+ }), xe.current = !1;
269
276
  });
270
277
  return () => window.cancelAnimationFrame(e);
271
- }, [ee, C.length]), X(() => () => {
272
- U.current && clearTimeout(U.current);
278
+ }, [te, w.length]), G(() => () => {
279
+ q.current && clearTimeout(q.current);
273
280
  }, []);
274
281
  const Vt = (e) => {
275
- var y, I, Y;
282
+ var y, I, K;
276
283
  const t = e || "";
277
284
  let r = t;
278
285
  if (!t.trim())
279
286
  r = "<!DOCTYPE html><html><head></head><body></body></html>";
280
287
  else {
281
- const M = new DOMParser().parseFromString(t, "text/html"), ge = ((y = M.documentElement) == null ? void 0 : y.tagName.toLowerCase()) === "html", Ft = ((I = M.head) == null ? void 0 : I.tagName.toLowerCase()) === "head", Rt = ((Y = M.body) == null ? void 0 : Y.tagName.toLowerCase()) === "body";
282
- if (!ge || !Ft || !Rt) {
283
- const $t = M.body ? M.body.innerHTML : t;
284
- r = `<!DOCTYPE html><html><head>${M.head ? M.head.innerHTML : ""}</head><body>${$t}</body></html>`;
288
+ const D = new DOMParser().parseFromString(t, "text/html"), ye = ((y = D.documentElement) == null ? void 0 : y.tagName.toLowerCase()) === "html", Ft = ((I = D.head) == null ? void 0 : I.tagName.toLowerCase()) === "head", Rt = ((K = D.body) == null ? void 0 : K.tagName.toLowerCase()) === "body";
289
+ if (!ye || !Ft || !Rt) {
290
+ const $t = D.body ? D.body.innerHTML : t;
291
+ r = `<!DOCTYPE html><html><head>${D.head ? D.head.innerHTML : ""}</head><body>${$t}</body></html>`;
285
292
  } else
286
- r = `<!DOCTYPE html>${M.documentElement.outerHTML}`;
293
+ r = `<!DOCTYPE html>${D.documentElement.outerHTML}`;
287
294
  }
288
- const h = ["script", "iframe", "object", "embed", "canvas"], b = new DOMParser().parseFromString(r, "text/html");
289
- return h.forEach((K) => {
290
- b.querySelectorAll(K).forEach((ge) => ge.remove());
291
- }), r = `<!DOCTYPE html>${b.documentElement.outerHTML}`, r;
295
+ const u = ["script", "iframe", "object", "embed", "canvas"], m = new DOMParser().parseFromString(r, "text/html");
296
+ return u.forEach((X) => {
297
+ m.querySelectorAll(X).forEach((ye) => ye.remove());
298
+ }), r = `<!DOCTYPE html>${m.documentElement.outerHTML}`, r;
292
299
  }, Be = J(
293
- () => lt(T, C),
294
- [C, T]
295
- ), ne = J(() => Vt(Be), [Be]);
300
+ () => lt(E, w),
301
+ [w, E]
302
+ ), ie = J(() => Vt(Be), [Be]);
296
303
  zt(
297
- Z,
304
+ ee,
298
305
  () => ({
299
- getValue: () => S(),
300
- getPreviewHtml: () => lt(S(), R.current),
301
- scanVariables: () => q(S()),
306
+ getValue: () => M(),
307
+ getPreviewHtml: () => lt(M(), T.current),
308
+ scanVariables: () => Y(M()),
302
309
  getVariables: (e) => {
303
- const t = q(S());
310
+ const t = Y(M());
304
311
  return e == null || e(t), t;
305
312
  },
306
313
  validateVariables: ae,
307
314
  showVariables: () => P("variables")
308
315
  }),
309
- [S, q, ae]
310
- ), X(() => {
311
- oe.current && oe.current.srcdoc !== ne && (oe.current.srcdoc = ne);
312
- }, [ne]);
316
+ [M, Y, ae]
317
+ ), G(() => {
318
+ ne.current && ne.current.srcdoc !== ie && (ne.current.srcdoc = ie);
319
+ }, [ie]);
313
320
  const Tt = (e, t) => {
314
321
  t !== null && pt(t);
315
322
  }, Ct = (e, t) => {
316
323
  (t === "desktop" || t === "mobile") && ft(t);
317
- }, ie = D(
324
+ }, le = L(
318
325
  (e) => {
319
- var h, v;
320
- const t = be.current;
326
+ var u, v;
327
+ const t = fe.current;
321
328
  if (t != null && t.state && (t != null && t.dispatch)) {
322
- const b = (h = t.state.selection) == null ? void 0 : h.main, y = t.state.doc.toString(), I = (b == null ? void 0 : b.from) ?? t.state.doc.length, Y = (b == null ? void 0 : b.to) ?? I, K = `${y.slice(0, I)}${e}${y.slice(Y)}`;
329
+ const m = (u = t.state.selection) == null ? void 0 : u.main, y = t.state.doc.toString(), I = (m == null ? void 0 : m.from) ?? t.state.doc.length, K = (m == null ? void 0 : m.to) ?? I, X = `${y.slice(0, I)}${e}${y.slice(K)}`;
323
330
  return t.dispatch({
324
- changes: { from: I, to: Y, insert: e },
331
+ changes: { from: I, to: K, insert: e },
325
332
  selection: { anchor: I + e.length }
326
- }), (v = t.focus) == null || v.call(t), fe(K), K;
333
+ }), (v = t.focus) == null || v.call(t), ge(X), X;
327
334
  }
328
- const r = `${T}${e}`;
329
- return fe(r), r;
335
+ const r = `${E}${e}`;
336
+ return ge(r), r;
330
337
  },
331
- [T]
332
- ), wt = D(
338
+ [E]
339
+ ), wt = L(
333
340
  (e, t) => {
334
- const r = R.current;
335
- k(
341
+ const r = T.current;
342
+ B(
336
343
  r.map(
337
- (h) => h.variableInstanceId === e ? { ...h, default: t } : h
344
+ (u) => u.variableInstanceId === e ? { ...u, default: t } : u
338
345
  )
339
346
  );
340
347
  },
341
- [k]
342
- ), Ht = D(
348
+ [B]
349
+ ), Ht = L(
343
350
  (e, t) => {
344
351
  if (!st(e, t)) return;
345
- const h = ie(Cr(e, t)), v = de(h), b = Ie(v, R.current);
346
- k(b), P("variables");
352
+ const u = le(Cr(e, t)), v = Z(u), m = ue(v, T.current);
353
+ B(m), P("variables");
347
354
  },
348
- [ie, k]
349
- ), le = J(() => {
355
+ [le, B]
356
+ ), se = J(() => {
350
357
  const e = _.trim();
351
- return e ? A.test(e) ? Tr(e) || C.some((t) => t.type === "user" && t.attribute === e) ? l("text.variables.customVariableNameDuplicate") : "" : l("text.variables.customVariableNameInvalid") : l("text.variables.customVariableNameRequired");
352
- }, [_, C]), St = D(() => {
358
+ return e ? F.test(e) ? Tr(e) || w.some((t) => t.type === "user" && t.attribute === e) ? l("text.variables.customVariableNameDuplicate") : "" : l("text.variables.customVariableNameInvalid") : l("text.variables.customVariableNameRequired");
359
+ }, [_, w]), St = L(() => {
353
360
  const e = W.trim();
354
- if (te(!0), re(!0), le || e === "") return;
361
+ if (re(!0), oe(!0), se || e === "") return;
355
362
  const t = st(_.trim(), "user", e);
356
363
  if (!t) return;
357
- const r = ie(t.variable), h = de(r), v = Ie(h, R.current);
358
- let b = -1;
364
+ const r = le(t.variable), u = Z(r), v = ue(u, T.current);
365
+ let m = -1;
359
366
  for (let y = v.length - 1; y >= 0; y -= 1) {
360
367
  const I = v[y];
361
368
  if (I.type === t.type && I.attribute === t.attribute && I.default === "") {
362
- b = y;
369
+ m = y;
363
370
  break;
364
371
  }
365
372
  }
366
- k(
373
+ B(
367
374
  v.map(
368
- (y, I) => I === b ? { ...y, default: t.default } : y
375
+ (y, I) => I === m ? { ...y, default: t.default } : y
369
376
  )
370
- ), Me(""), De(""), te(!1), re(!1), P("variables");
371
- }, [W, _, le, ie, k]), Mt = J(() => {
377
+ ), Me(""), De(""), re(!1), oe(!1), P("variables");
378
+ }, [W, _, se, le, B]), Mt = J(() => {
372
379
  const e = /* @__PURE__ */ new Set();
373
- return [{ id: "custom", items: C.filter((r) => r.type === "user").filter((r) => !Ee.some((h) => h.items.some((v) => v.name === r.attribute))).filter((r) => e.has(r.attribute) ? !1 : (e.add(r.attribute), !0)).map((r) => ({
380
+ return [{ id: "custom", items: w.filter((r) => r.type === "user").filter((r) => !Ve.some((u) => u.items.some((v) => v.name === r.attribute))).filter((r) => e.has(r.attribute) ? !1 : (e.add(r.attribute), !0)).map((r) => ({
374
381
  name: r.attribute,
375
382
  labelKey: r.attribute,
376
383
  kind: "user"
377
- })) }, ...Ee];
378
- }, [C]), se = J(
379
- () => C.filter((e) => e.type !== "system"),
380
- [C]
381
- ), Dt = (e) => e === "custom" ? "text.variables.groupCustom" : e === "contacts" ? "text.variables.groupContacts" : e === "email" ? "text.variables.groupEmail" : e === "organization" ? "text.variables.groupOrganization" : e === "date" ? "text.variables.groupDate" : "text.variables.groupLinks", V = er(), Lt = O === "desktop" || O === "mobile" ? O : "desktop", kt = H === "split" || H === "code" || H === "preview" ? H : "split";
382
- ($e = (Re = V.palette) == null ? void 0 : Re.action) == null || $e.selected, (ze = (Ne = V.palette) == null ? void 0 : Ne.primary) == null || ze.main, (Pe = (Oe = V.palette) == null ? void 0 : Oe.action) == null || Pe.selected, (We = (_e = V.palette) == null ? void 0 : _e.background) == null || We.paper, (Ge = (je = V.palette) == null ? void 0 : je.text) == null || Ge.primary, (qe = (Ue = V.palette) == null ? void 0 : Ue.action) == null || qe.hover;
384
+ })) }, ...Ve];
385
+ }, [w]), ce = J(
386
+ () => w.filter((e) => e.type !== "system"),
387
+ [w]
388
+ ), Dt = (e) => e === "custom" ? "text.variables.groupCustom" : e === "contacts" ? "text.variables.groupContacts" : e === "email" ? "text.variables.groupEmail" : e === "organization" ? "text.variables.groupOrganization" : e === "date" ? "text.variables.groupDate" : "text.variables.groupLinks", C = er(), Lt = O === "desktop" || O === "mobile" ? O : "desktop", kt = S === "split" || S === "code" || S === "preview" ? S : "split";
389
+ ($e = (Re = C.palette) == null ? void 0 : Re.action) == null || $e.selected, (ze = (Ne = C.palette) == null ? void 0 : Ne.primary) == null || ze.main, (Pe = (Oe = C.palette) == null ? void 0 : Oe.action) == null || Pe.selected, (We = (_e = C.palette) == null ? void 0 : _e.background) == null || We.paper, (Ge = (je = C.palette) == null ? void 0 : je.text) == null || Ge.primary, (qe = (Ue = C.palette) == null ? void 0 : Ue.action) == null || qe.hover;
383
390
  const j = {
384
391
  tooltip: {
385
392
  sx: {
@@ -387,14 +394,14 @@ function Or({
387
394
  fontWeight: 400,
388
395
  lineHeight: 1.45,
389
396
  maxWidth: 360,
390
- backgroundColor: ce(((Ke = (Ye = V.palette) == null ? void 0 : Ye.text) == null ? void 0 : Ke.primary) ?? "#1F1F21", 0.9),
391
- color: ((Je = (Xe = V.palette) == null ? void 0 : Xe.common) == null ? void 0 : Je.white) ?? "#fff"
397
+ backgroundColor: de(((Ke = (Ye = C.palette) == null ? void 0 : Ye.text) == null ? void 0 : Ke.primary) ?? "#1F1F21", 0.9),
398
+ color: ((Je = (Xe = C.palette) == null ? void 0 : Xe.common) == null ? void 0 : Je.white) ?? "#fff"
392
399
  }
393
400
  },
394
401
  arrow: {
395
- sx: { color: ce(((Ze = (Qe = V.palette) == null ? void 0 : Qe.text) == null ? void 0 : Ze.primary) ?? "#1F1F21", 0.9) }
402
+ sx: { color: de(((Ze = (Qe = C.palette) == null ? void 0 : Qe.text) == null ? void 0 : Ze.primary) ?? "#1F1F21", 0.9) }
396
403
  }
397
- }, xe = {
404
+ }, ve = {
398
405
  component: "div",
399
406
  sx: {
400
407
  mt: 0.5,
@@ -403,7 +410,7 @@ function Or({
403
410
  lineHeight: 1.5
404
411
  }
405
412
  }, Ae = () => /* @__PURE__ */ f(
406
- m,
413
+ b,
407
414
  {
408
415
  sx: {
409
416
  height: x,
@@ -411,12 +418,12 @@ function Or({
411
418
  display: "flex",
412
419
  flexDirection: "column",
413
420
  position: "relative",
414
- borderRight: H === "split" ? "1px solid" : "none",
421
+ borderRight: S === "split" ? "1px solid" : "none",
415
422
  borderColor: "divider"
416
423
  },
417
424
  children: [
418
425
  /* @__PURE__ */ o(
419
- m,
426
+ b,
420
427
  {
421
428
  sx: {
422
429
  flex: 1,
@@ -449,13 +456,13 @@ function Or({
449
456
  children: /* @__PURE__ */ o(
450
457
  Ot,
451
458
  {
452
- value: T,
459
+ value: E,
453
460
  height: "100%",
454
461
  extensions: [Pt()],
455
- theme: Ce[He] || ut,
456
- onChange: fe,
462
+ theme: we[Se] || ut,
463
+ onChange: ge,
457
464
  onCreateEditor: (e) => {
458
- be.current = e;
465
+ fe.current = e;
459
466
  },
460
467
  basicSetup: {
461
468
  lineNumbers: !0,
@@ -468,7 +475,7 @@ function Or({
468
475
  }
469
476
  ),
470
477
  /* @__PURE__ */ o(
471
- ve,
478
+ Ie,
472
479
  {
473
480
  size: "small",
474
481
  variant: "contained",
@@ -487,7 +494,7 @@ function Or({
487
494
  )
488
495
  ]
489
496
  }
490
- ), Bt = () => /* @__PURE__ */ o(m, { sx: {
497
+ ), Bt = () => /* @__PURE__ */ o(b, { sx: {
491
498
  height: i,
492
499
  overflow: "auto",
493
500
  backgroundColor: "#F5F5F5",
@@ -495,7 +502,7 @@ function Or({
495
502
  display: "flex",
496
503
  justifyContent: "center"
497
504
  }, children: /* @__PURE__ */ o(
498
- m,
505
+ b,
499
506
  {
500
507
  sx: {
501
508
  width: "100%",
@@ -507,8 +514,8 @@ function Or({
507
514
  children: /* @__PURE__ */ o(
508
515
  "iframe",
509
516
  {
510
- ref: oe,
511
- srcDoc: ne,
517
+ ref: ne,
518
+ srcDoc: ie,
512
519
  style: {
513
520
  width: "100%",
514
521
  height: "100%",
@@ -521,7 +528,7 @@ function Or({
521
528
  )
522
529
  }
523
530
  ) }), At = () => /* @__PURE__ */ f(
524
- m,
531
+ b,
525
532
  {
526
533
  ref: Le,
527
534
  sx: {
@@ -535,23 +542,23 @@ function Or({
535
542
  pb: 6
536
543
  },
537
544
  children: [
538
- /* @__PURE__ */ o(m, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */ f(m, { sx: { minWidth: 0 }, children: [
539
- /* @__PURE__ */ f(m, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
540
- /* @__PURE__ */ o(B, { variant: "subtitle1", sx: { fontWeight: 700 }, children: l("htmlEditor.variables.title") }),
541
- /* @__PURE__ */ o(G, { title: l("htmlEditor.variables.help"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(m, { component: "span", sx: { display: "inline-flex", color: "text.secondary", cursor: "help" }, children: /* @__PURE__ */ o(Lr, { fontSize: "small" }) }) })
545
+ /* @__PURE__ */ o(b, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */ f(b, { sx: { minWidth: 0 }, children: [
546
+ /* @__PURE__ */ f(b, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
547
+ /* @__PURE__ */ o(A, { variant: "subtitle1", sx: { fontWeight: 700 }, children: l("htmlEditor.variables.title") }),
548
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.variables.help"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(b, { component: "span", sx: { display: "inline-flex", color: "text.secondary", cursor: "help" }, children: /* @__PURE__ */ o(Lr, { fontSize: "small" }) }) })
542
549
  ] }),
543
- /* @__PURE__ */ o(B, { component: "div", variant: "body2", color: "text.secondary", children: l("htmlEditor.variables.scanHint") })
550
+ /* @__PURE__ */ o(A, { component: "div", variant: "body2", color: "text.secondary", children: l("htmlEditor.variables.scanHint") })
544
551
  ] }) }),
545
- /* @__PURE__ */ o(m, { sx: { mb: 2 }, children: Mt.map((e) => {
552
+ /* @__PURE__ */ o(b, { sx: { mb: 2 }, children: Mt.map((e) => {
546
553
  const t = yt === e.id;
547
554
  return /* @__PURE__ */ f(
548
- nr,
555
+ ar,
549
556
  {
550
557
  disableGutters: !0,
551
558
  square: !0,
552
559
  elevation: 0,
553
560
  expanded: t,
554
- onChange: (r, h) => It(h ? e.id : null),
561
+ onChange: (r, u) => It(u ? e.id : null),
555
562
  sx: {
556
563
  "&:before": { display: "none" },
557
564
  border: 1,
@@ -569,13 +576,13 @@ function Or({
569
576
  minHeight: 44,
570
577
  "& .MuiAccordionSummary-content": { my: 1 }
571
578
  },
572
- children: /* @__PURE__ */ o(B, { component: "div", variant: "body2", color: "text.primary", children: l(Dt(e.id)) })
579
+ children: /* @__PURE__ */ o(A, { component: "div", variant: "body2", color: "text.primary", children: l(Dt(e.id)) })
573
580
  }
574
581
  ),
575
582
  /* @__PURE__ */ f(lr, { sx: { pt: 0, pb: 1.25 }, children: [
576
- e.id === "custom" && /* @__PURE__ */ f(m, { sx: { mb: 1 }, children: [
583
+ e.id === "custom" && /* @__PURE__ */ f(b, { sx: { mb: 1 }, children: [
577
584
  /* @__PURE__ */ o(
578
- ye,
585
+ Ee,
579
586
  {
580
587
  size: "small",
581
588
  fullWidth: !0,
@@ -583,19 +590,19 @@ function Or({
583
590
  value: _,
584
591
  placeholder: "e.g. order_id",
585
592
  onChange: (r) => {
586
- Me(r.target.value), !me && r.target.value.trim() !== "" && te(!0);
593
+ Me(r.target.value), !be && r.target.value.trim() !== "" && re(!0);
587
594
  },
588
595
  onBlur: () => {
589
- _.trim() !== "" && te(!0);
596
+ _.trim() !== "" && re(!0);
590
597
  },
591
- error: me && !!le,
592
- helperText: me && le || " ",
593
- FormHelperTextProps: xe,
598
+ error: be && !!se,
599
+ helperText: be && se || " ",
600
+ FormHelperTextProps: ve,
594
601
  sx: { mb: 1 }
595
602
  }
596
603
  ),
597
604
  /* @__PURE__ */ o(
598
- ye,
605
+ Ee,
599
606
  {
600
607
  size: "small",
601
608
  fullWidth: !0,
@@ -603,18 +610,18 @@ function Or({
603
610
  value: W,
604
611
  placeholder: l("text.variables.defaultPlaceholder"),
605
612
  onChange: (r) => {
606
- De(r.target.value), !he && r.target.value.trim() !== "" && re(!0);
613
+ De(r.target.value), !pe && r.target.value.trim() !== "" && oe(!0);
607
614
  },
608
615
  onBlur: () => {
609
- W.trim() !== "" && re(!0);
616
+ W.trim() !== "" && oe(!0);
610
617
  },
611
- error: he && W.trim() === "",
612
- helperText: he && W.trim() === "" ? l("text.variables.defaultRequired") : " ",
613
- FormHelperTextProps: xe
618
+ error: pe && W.trim() === "",
619
+ helperText: pe && W.trim() === "" ? l("text.variables.defaultRequired") : " ",
620
+ FormHelperTextProps: ve
614
621
  }
615
622
  ),
616
623
  /* @__PURE__ */ o(
617
- ve,
624
+ Ie,
618
625
  {
619
626
  fullWidth: !0,
620
627
  size: "small",
@@ -632,8 +639,8 @@ function Or({
632
639
  }
633
640
  )
634
641
  ] }),
635
- e.items.length > 0 && /* @__PURE__ */ o(m, { sx: { display: "grid", gap: 0.75 }, children: e.items.map((r) => /* @__PURE__ */ o(
636
- ve,
642
+ e.items.length > 0 && /* @__PURE__ */ o(b, { sx: { display: "grid", gap: 0.75 }, children: e.items.map((r) => /* @__PURE__ */ o(
643
+ Ie,
637
644
  {
638
645
  size: "small",
639
646
  variant: "outlined",
@@ -644,10 +651,10 @@ function Or({
644
651
  color: "text.secondary",
645
652
  textTransform: "none"
646
653
  },
647
- children: /* @__PURE__ */ f(m, { sx: { textAlign: "left", minWidth: 0 }, children: [
648
- /* @__PURE__ */ o(B, { component: "div", variant: "body2", color: "text.primary", children: e.id === "custom" ? r.name : l(r.labelKey) }),
654
+ children: /* @__PURE__ */ f(b, { sx: { textAlign: "left", minWidth: 0 }, children: [
655
+ /* @__PURE__ */ o(A, { component: "div", variant: "body2", color: "text.primary", children: e.id === "custom" ? r.name : l(r.labelKey) }),
649
656
  /* @__PURE__ */ o(
650
- B,
657
+ A,
651
658
  {
652
659
  component: "div",
653
660
  variant: "caption",
@@ -667,10 +674,10 @@ function Or({
667
674
  );
668
675
  }) }),
669
676
  /* @__PURE__ */ o(sr, { sx: { my: 2 } }),
670
- /* @__PURE__ */ o(B, { component: "div", ref: ke, variant: "subtitle2", sx: { mb: 0.5 }, children: l("htmlEditor.variables.detected") }),
671
- /* @__PURE__ */ o(B, { component: "div", variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: l("htmlEditor.variables.defaultHelp") }),
672
- se.length === 0 ? /* @__PURE__ */ o(
673
- m,
677
+ /* @__PURE__ */ o(A, { component: "div", ref: ke, variant: "subtitle2", sx: { mb: 0.5 }, children: l("htmlEditor.variables.detected") }),
678
+ /* @__PURE__ */ o(A, { component: "div", variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: l("htmlEditor.variables.defaultHelp") }),
679
+ ce.length === 0 ? /* @__PURE__ */ o(
680
+ b,
674
681
  {
675
682
  sx: {
676
683
  border: "1px dashed",
@@ -683,10 +690,10 @@ function Or({
683
690
  },
684
691
  children: l("htmlEditor.variables.empty")
685
692
  }
686
- ) : /* @__PURE__ */ o(m, { sx: { display: "grid", gap: 0.25 }, children: se.map((e, t) => {
687
- const r = gt && e.type === "user" && e.default.trim() === "", h = se.filter((b) => b.type === e.type && b.attribute === e.attribute).length, v = se.slice(0, t + 1).filter((b) => b.type === e.type && b.attribute === e.attribute).length;
693
+ ) : /* @__PURE__ */ o(b, { sx: { display: "grid", gap: 0.25 }, children: ce.map((e, t) => {
694
+ const r = gt && e.type === "user" && e.default.trim() === "", u = ce.filter((m) => m.type === e.type && m.attribute === e.attribute).length, v = ce.slice(0, t + 1).filter((m) => m.type === e.type && m.attribute === e.attribute).length;
688
695
  return /* @__PURE__ */ f(
689
- m,
696
+ b,
690
697
  {
691
698
  sx: {
692
699
  display: "grid",
@@ -699,16 +706,16 @@ function Or({
699
706
  borderColor: r ? "error.main" : "transparent",
700
707
  borderRadius: 1,
701
708
  borderBottomColor: r ? "error.main" : "divider",
702
- backgroundColor: r ? ce(V.palette.error.main, 0.04) : "transparent",
709
+ backgroundColor: r ? de(C.palette.error.main, 0.04) : "transparent",
703
710
  transition: "background-color 120ms ease, border-color 120ms ease",
704
711
  "&:hover": {
705
- backgroundColor: r ? ce(V.palette.error.main, 0.04) : "action.hover",
712
+ backgroundColor: r ? de(C.palette.error.main, 0.04) : "action.hover",
706
713
  borderColor: r ? "error.main" : "divider"
707
714
  }
708
715
  },
709
716
  children: [
710
717
  /* @__PURE__ */ o(
711
- B,
718
+ A,
712
719
  {
713
720
  component: "div",
714
721
  variant: "body2",
@@ -719,11 +726,11 @@ function Or({
719
726
  wordBreak: "break-all",
720
727
  color: r ? "error.main" : "text.primary"
721
728
  },
722
- children: h > 1 ? `${e.variable} (${v})` : e.variable
729
+ children: u > 1 ? `${e.variable} (${v})` : e.variable
723
730
  }
724
731
  ),
725
732
  /* @__PURE__ */ o(
726
- ye,
733
+ Ee,
727
734
  {
728
735
  size: "small",
729
736
  fullWidth: !0,
@@ -733,8 +740,8 @@ function Or({
733
740
  placeholder: e.type === "system" ? l("htmlEditor.variables.systemDefault") : l("text.variables.defaultPlaceholder"),
734
741
  error: r,
735
742
  helperText: r ? l("text.variables.defaultRequired") : void 0,
736
- FormHelperTextProps: xe,
737
- onChange: (b) => wt(e.variableInstanceId, b.target.value),
743
+ FormHelperTextProps: ve,
744
+ onChange: (m) => wt(e.variableInstanceId, m.target.value),
738
745
  sx: {
739
746
  "& .MuiInputBase-input": {
740
747
  py: 0.75,
@@ -750,11 +757,11 @@ function Or({
750
757
  }) })
751
758
  ]
752
759
  }
753
- ), Fe = () => /* @__PURE__ */ f(m, { sx: { height: i, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
760
+ ), Fe = () => /* @__PURE__ */ f(b, { sx: { height: i, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
754
761
  /* @__PURE__ */ f(
755
- ar,
762
+ nr,
756
763
  {
757
- value: ee,
764
+ value: te,
758
765
  onChange: (e, t) => P(t),
759
766
  sx: {
760
767
  minHeight: 40,
@@ -772,10 +779,10 @@ function Or({
772
779
  ]
773
780
  }
774
781
  ),
775
- /* @__PURE__ */ o(m, { sx: { flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column" }, children: ee === "preview" ? Bt() : At() })
782
+ /* @__PURE__ */ o(b, { sx: { flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column" }, children: te === "preview" ? Bt() : At() })
776
783
  ] });
777
784
  return /* @__PURE__ */ f(
778
- m,
785
+ b,
779
786
  {
780
787
  sx: {
781
788
  display: "flex",
@@ -784,11 +791,11 @@ function Or({
784
791
  width: "100%",
785
792
  minHeight: 0,
786
793
  minWidth: 0,
787
- ...u
794
+ ...h
788
795
  },
789
796
  children: [
790
797
  p && /* @__PURE__ */ f(
791
- m,
798
+ b,
792
799
  {
793
800
  sx: {
794
801
  display: "flex",
@@ -800,7 +807,7 @@ function Or({
800
807
  backgroundColor: "background.paper"
801
808
  },
802
809
  children: [
803
- /* @__PURE__ */ f(m, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
810
+ /* @__PURE__ */ f(b, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
804
811
  /* @__PURE__ */ f(
805
812
  et,
806
813
  {
@@ -810,7 +817,7 @@ function Or({
810
817
  size: "small",
811
818
  "aria-label": l("htmlEditor.mode.split"),
812
819
  children: [
813
- /* @__PURE__ */ o(G, { title: l("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
820
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
814
821
  Q,
815
822
  {
816
823
  value: "split",
@@ -818,7 +825,7 @@ function Or({
818
825
  children: /* @__PURE__ */ o(Br, { fontSize: "small" })
819
826
  }
820
827
  ) }),
821
- /* @__PURE__ */ o(G, { title: l("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
828
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
822
829
  Q,
823
830
  {
824
831
  value: "code",
@@ -826,7 +833,7 @@ function Or({
826
833
  children: /* @__PURE__ */ o(Sr, { fontSize: "small" })
827
834
  }
828
835
  ) }),
829
- /* @__PURE__ */ o(G, { title: l("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
836
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
830
837
  Q,
831
838
  {
832
839
  value: "preview",
@@ -844,7 +851,7 @@ function Or({
844
851
  {
845
852
  labelId: "theme-select-label",
846
853
  id: "theme-select",
847
- value: He,
854
+ value: Se,
848
855
  label: l("htmlEditor.theme"),
849
856
  onChange: (e) => {
850
857
  const t = e.target.value;
@@ -866,7 +873,7 @@ function Or({
866
873
  )
867
874
  ] })
868
875
  ] }),
869
- /* @__PURE__ */ o(m, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: H !== "code" && /* @__PURE__ */ f(
876
+ /* @__PURE__ */ o(b, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: S !== "code" && /* @__PURE__ */ f(
870
877
  et,
871
878
  {
872
879
  value: Lt,
@@ -875,7 +882,7 @@ function Or({
875
882
  size: "small",
876
883
  "aria-label": l("htmlEditor.device.desktop"),
877
884
  children: [
878
- /* @__PURE__ */ o(G, { title: l("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
885
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
879
886
  Q,
880
887
  {
881
888
  value: "desktop",
@@ -883,7 +890,7 @@ function Or({
883
890
  children: /* @__PURE__ */ o(Ar, { fontSize: "small" })
884
891
  }
885
892
  ) }),
886
- /* @__PURE__ */ o(G, { title: l("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
893
+ /* @__PURE__ */ o(U, { title: l("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ o(
887
894
  Q,
888
895
  {
889
896
  value: "mobile",
@@ -898,7 +905,7 @@ function Or({
898
905
  }
899
906
  ),
900
907
  /* @__PURE__ */ f(
901
- m,
908
+ b,
902
909
  {
903
910
  sx: {
904
911
  flex: 1,
@@ -908,12 +915,12 @@ function Or({
908
915
  overflow: "hidden"
909
916
  },
910
917
  children: [
911
- H === "split" && /* @__PURE__ */ f(Nt, { children: [
912
- /* @__PURE__ */ o(m, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
913
- /* @__PURE__ */ o(m, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
918
+ S === "split" && /* @__PURE__ */ f(Nt, { children: [
919
+ /* @__PURE__ */ o(b, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
920
+ /* @__PURE__ */ o(b, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
914
921
  ] }),
915
- H === "code" && /* @__PURE__ */ o(m, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
916
- H === "preview" && /* @__PURE__ */ o(m, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
922
+ S === "code" && /* @__PURE__ */ o(b, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
923
+ S === "preview" && /* @__PURE__ */ o(b, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
917
924
  ]
918
925
  }
919
926
  )
@@ -923,7 +930,7 @@ function Or({
923
930
  }
924
931
  const bt = dt(Or);
925
932
  bt.displayName = "HtmlEditorContent";
926
- const Pr = dt((a, n) => /* @__PURE__ */ o(Qt, { theme: vr, children: /* @__PURE__ */ o(
933
+ const Pr = dt((n, a) => /* @__PURE__ */ o(Qt, { theme: vr, children: /* @__PURE__ */ o(
927
934
  Zt,
928
935
  {
929
936
  sx: {
@@ -934,7 +941,7 @@ const Pr = dt((a, n) => /* @__PURE__ */ o(Qt, { theme: vr, children: /* @__PURE_
934
941
  display: "flex",
935
942
  flexDirection: "column"
936
943
  },
937
- children: /* @__PURE__ */ o(bt, { ref: n, ...a })
944
+ children: /* @__PURE__ */ o(bt, { ref: a, ...n })
938
945
  }
939
946
  ) }));
940
947
  Pr.displayName = "HtmlEditor";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monto-email-builder",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "A powerful and customizable email template builder React component library with visual editing, internationalization, and image upload support",
5
5
  "keywords": [
6
6
  "email",