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