monto-email-builder 1.3.1 → 1.4.1

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