monto-email-builder 1.4.4 → 1.4.6

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