monto-email-builder 1.4.1 → 1.4.2

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