@emabuild/email-renderer 0.8.0 → 0.9.0
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/README.md +1 -1
- package/dist/index.js +816 -775
- package/dist/index.js.map +1 -1
- package/dist/layout/document-shell.d.ts +1 -1
- package/dist/layout/document-shell.d.ts.map +1 -1
- package/dist/layout/fluid-hybrid.d.ts +4 -0
- package/dist/layout/fluid-hybrid.d.ts.map +1 -1
- package/dist/layout/web-layout.d.ts +1 -1
- package/dist/layout/web-layout.d.ts.map +1 -1
- package/dist/render.d.ts +2 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/utils/background.d.ts +37 -0
- package/dist/utils/background.d.ts.map +1 -0
- package/dist/utils/border.d.ts.map +1 -1
- package/dist/utils/css-inliner.d.ts.map +1 -1
- package/dist/utils/dark-mode.d.ts +2 -3
- package/dist/utils/dark-mode.d.ts.map +1 -1
- package/dist/utils/html-minifier.d.ts.map +1 -1
- package/dist/utils/markup.d.ts +12 -0
- package/dist/utils/markup.d.ts.map +1 -0
- package/dist/utils/mso.d.ts +27 -0
- package/dist/utils/mso.d.ts.map +1 -0
- package/dist/utils/plain-text.d.ts +2 -2
- package/dist/utils/plain-text.d.ts.map +1 -1
- package/dist/utils/responsive-overrides.d.ts +5 -4
- package/dist/utils/responsive-overrides.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,55 +1,84 @@
|
|
|
1
|
-
function
|
|
1
|
+
function T(e) {
|
|
2
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
3
|
+
}
|
|
4
|
+
function ue(e) {
|
|
5
|
+
return T(e) ? e : {};
|
|
6
|
+
}
|
|
7
|
+
function j(e) {
|
|
2
8
|
return typeof e != "string" && typeof e != "number" ? null : String(e).replace(/[;{}<>"]/g, "").replace(/!important/gi, "").trim() || null;
|
|
3
9
|
}
|
|
4
|
-
function
|
|
5
|
-
return typeof e == "string" && e.trim() !== "" &&
|
|
10
|
+
function Z(e) {
|
|
11
|
+
return typeof e == "string" && e.trim() !== "" && j(e) === e.trim();
|
|
6
12
|
}
|
|
7
|
-
function
|
|
13
|
+
function se(e) {
|
|
8
14
|
const t = e?.body;
|
|
9
15
|
return t ? [...t.headers ?? [], ...t.rows ?? [], ...t.footers ?? []] : [];
|
|
10
16
|
}
|
|
11
|
-
const Y = (e) => typeof e == "string" ? e.trim() : "",
|
|
12
|
-
function
|
|
17
|
+
const Y = (e) => typeof e == "string" ? e.trim() : "", Fe = (e) => typeof e == "string" && /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e);
|
|
18
|
+
function we(e, t) {
|
|
13
19
|
return Y(t) || Y(e?.title) || Y(e?.subject);
|
|
14
20
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
21
|
+
function ke(e) {
|
|
22
|
+
const t = e?.language;
|
|
23
|
+
return Fe(t) ? t : "";
|
|
17
24
|
}
|
|
18
|
-
function
|
|
25
|
+
function xe(e) {
|
|
19
26
|
const t = String(e?.fontWeight ?? "");
|
|
20
27
|
return /^\d{3}$|^(normal|bold)$/.test(t) ? t : "";
|
|
21
28
|
}
|
|
22
|
-
function
|
|
29
|
+
function ee(e) {
|
|
23
30
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
const He = /[\u00AD\u034F\u200B-\u200F\u2060\uFEFF]/g;
|
|
33
|
+
function de(e) {
|
|
34
|
+
return e.replace(He, "");
|
|
35
|
+
}
|
|
36
|
+
function S(e) {
|
|
37
|
+
return e.replace(/&(?![a-zA-Z0-9#]+;)/g, "&").replace(/"/g, """);
|
|
38
|
+
}
|
|
39
|
+
function Ue(e) {
|
|
26
40
|
return e.trim().replace(/['"()\\\s<>]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
|
|
27
41
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const n = De(o.url), s = o.repeat === !0 || o.repeat === "repeat" ? "repeat" : "no-repeat", i = o.cover === !0 ? "cover" : o.fullWidth === !0 ? "100% auto" : "auto", r = o.center !== !1 ? "center top" : "left top", a = s === "repeat" ? "tile" : "frame";
|
|
42
|
+
function ie(e) {
|
|
43
|
+
if (!T(e) || typeof e.url != "string" || !e.url.trim()) return null;
|
|
44
|
+
const t = Ue(e.url), n = e.repeat === !0 || e.repeat === "repeat" ? "repeat" : "no-repeat", o = e.cover === !0 ? "cover" : e.fullWidth === !0 ? "100% auto" : "auto", s = e.center !== !1 ? "center top" : "left top";
|
|
32
45
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
url: t,
|
|
47
|
+
repeat: n,
|
|
48
|
+
css: `background-image:url('${t}');background-repeat:${n};background-position:${s};background-size:${o};`,
|
|
49
|
+
fillType: n === "repeat" ? "tile" : "frame"
|
|
37
50
|
};
|
|
38
51
|
}
|
|
39
|
-
function
|
|
40
|
-
return e
|
|
52
|
+
function Ce(e) {
|
|
53
|
+
return ie(e)?.css ?? "";
|
|
54
|
+
}
|
|
55
|
+
function Ge(e, t, n) {
|
|
56
|
+
const o = `<v:fill type="${e.fillType}" src="${S(e.url)}"${n ? ` color="${S(n)}"` : ""}/>`;
|
|
57
|
+
return {
|
|
58
|
+
open: `<!--[if gte mso 9]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:${t}px;">${o}<v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0"><![endif]-->`,
|
|
59
|
+
close: "<!--[if gte mso 9]></v:textbox></v:rect><![endif]-->"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function Ke(e, t) {
|
|
63
|
+
const n = ie(e.backgroundImage);
|
|
64
|
+
return n ? {
|
|
65
|
+
attr: ` background="${S(n.url)}"`,
|
|
66
|
+
css: n.css,
|
|
67
|
+
vml: `<!--[if gte mso 9]><v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t"><v:fill type="${n.fillType}" src="${S(n.url)}" color="${S(t)}"/></v:background><![endif]-->
|
|
68
|
+
`
|
|
69
|
+
} : { attr: "", css: "", vml: "" };
|
|
41
70
|
}
|
|
42
|
-
function
|
|
43
|
-
const s =
|
|
71
|
+
function Ze(e, t, n, o = {}) {
|
|
72
|
+
const s = n.backgroundColor || "transparent", i = n.contentWidth || "600px", r = n.fontFamily?.value || "arial,helvetica,sans-serif", c = n.textColor || "#000000", l = n.preheaderText || "", d = we(n, o.title), u = ke(n), a = u ? ` lang="${u}" xml:lang="${u}"` : "", h = ee(d || l.trim()), m = o.darkMode ? "light dark" : "light", y = xe(n), b = y ? `font-weight:${y};` : "", f = Ke(n, s), p = (o.fontUrls ?? []).length ? `
|
|
44
73
|
<!--[if !mso]><!-->
|
|
45
|
-
${
|
|
74
|
+
${o.fontUrls.map((v) => ` <link href="${S(v)}" rel="stylesheet" type="text/css">`).join(`
|
|
46
75
|
`)}
|
|
47
|
-
<!--<![endif]-->` : "",
|
|
76
|
+
<!--<![endif]-->` : "", g = (o.styles ?? []).map((v) => `
|
|
48
77
|
<style type="text/css">
|
|
49
|
-
${
|
|
50
|
-
</style>`).join(""),
|
|
78
|
+
${v}
|
|
79
|
+
</style>`).join(""), $ = l ? ee(l) : "‌", w = `<div style="display:none;mso-hide:all;font-size:1px;color:${s};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${$}${"‌ ".repeat(80)}</div>`;
|
|
51
80
|
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
52
|
-
<html${
|
|
81
|
+
<html${a} xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
53
82
|
<head>
|
|
54
83
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
55
84
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
@@ -58,7 +87,7 @@ ${$}
|
|
|
58
87
|
<meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no">
|
|
59
88
|
<meta name="color-scheme" content="${m}">
|
|
60
89
|
<meta name="supported-color-schemes" content="${m}">
|
|
61
|
-
<title>${h}</title>${
|
|
90
|
+
<title>${h}</title>${p}
|
|
62
91
|
<!--[if mso]>
|
|
63
92
|
<noscript><xml>
|
|
64
93
|
<o:OfficeDocumentSettings>
|
|
@@ -79,11 +108,11 @@ ${$}
|
|
|
79
108
|
table, tr, td { vertical-align: top; border-collapse: collapse; }
|
|
80
109
|
p { margin: 0; }
|
|
81
110
|
a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; }
|
|
82
|
-
</style>${
|
|
111
|
+
</style>${g}
|
|
83
112
|
</head>
|
|
84
|
-
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${s};color:${
|
|
85
|
-
${
|
|
86
|
-
<table id="u_body" role="presentation"${
|
|
113
|
+
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${s};color:${c};${b}">
|
|
114
|
+
${f.vml}${w}
|
|
115
|
+
<table id="u_body" role="presentation"${f.attr} style="border-collapse:collapse;border-spacing:0;margin:0 auto;background-color:${s};${f.css}width:100%;" cellpadding="0" cellspacing="0" border="0">
|
|
87
116
|
<tbody>
|
|
88
117
|
<tr>
|
|
89
118
|
<td style="vertical-align:top;">
|
|
@@ -97,21 +126,21 @@ ${$}
|
|
|
97
126
|
</body>
|
|
98
127
|
</html>`;
|
|
99
128
|
}
|
|
100
|
-
function
|
|
129
|
+
function re(e, t) {
|
|
101
130
|
if (!t || typeof t != "object") return e;
|
|
102
|
-
const
|
|
103
|
-
return !
|
|
131
|
+
const n = typeof t.before == "string" ? t.before : "", o = typeof t.after == "string" ? t.after : "";
|
|
132
|
+
return !n && !o ? e : `${n}${e}${o}`;
|
|
104
133
|
}
|
|
105
|
-
function
|
|
134
|
+
function N(e) {
|
|
106
135
|
return `only screen and (max-width: ${e + 20}px)`;
|
|
107
136
|
}
|
|
108
|
-
function
|
|
137
|
+
function Ye(e) {
|
|
109
138
|
return `
|
|
110
139
|
@media only screen and (min-width: ${e + 20}px) {
|
|
111
140
|
.u_row .u_column { display: inline-block !important; }
|
|
112
141
|
}
|
|
113
142
|
|
|
114
|
-
@media ${
|
|
143
|
+
@media ${N(e)} {
|
|
115
144
|
.u_row .u_column {
|
|
116
145
|
display: block !important;
|
|
117
146
|
width: 100% !important;
|
|
@@ -126,7 +155,7 @@ function Pe(e) {
|
|
|
126
155
|
}
|
|
127
156
|
}
|
|
128
157
|
|
|
129
|
-
@media ${
|
|
158
|
+
@media ${N(e)} {
|
|
130
159
|
.u_row-container {
|
|
131
160
|
max-width: 100% !important;
|
|
132
161
|
padding-left: 0 !important;
|
|
@@ -150,30 +179,35 @@ function Pe(e) {
|
|
|
150
179
|
function L(e) {
|
|
151
180
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
152
181
|
}
|
|
153
|
-
function
|
|
182
|
+
function Xe(e) {
|
|
154
183
|
return `v-${L(e)}`;
|
|
155
184
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
return e.replace(/[:.]/g, "\\$&").replace(/^(-?)(\d)/, (t,
|
|
185
|
+
const te = (e) => typeof e == "string" ? e.trim().replace(/[^A-Za-z0-9_:.-]/g, "-") : "";
|
|
186
|
+
function F(e) {
|
|
187
|
+
return e.replace(/[:.]/g, "\\$&").replace(/^(-?)(\d)/, (t, n, o) => `${n}\\3${o} `);
|
|
159
188
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
189
|
+
function Je(e, t) {
|
|
190
|
+
return te(`${e}${typeof t == "string" || typeof t == "number" ? t : ""}`);
|
|
162
191
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
return M(t.anchor) || M(R(t._meta) ? t._meta.htmlID : "") || $e("u_content_", e.id);
|
|
192
|
+
function le(e) {
|
|
193
|
+
return _e(e, "u_content_");
|
|
166
194
|
}
|
|
167
195
|
function H(e) {
|
|
168
|
-
|
|
169
|
-
|
|
196
|
+
return _e(e, "u_row_");
|
|
197
|
+
}
|
|
198
|
+
function _e(e, t) {
|
|
199
|
+
const n = ue(e.values);
|
|
200
|
+
return te(n.anchor) || te(ue(n._meta).htmlID) || Je(t, e.id);
|
|
201
|
+
}
|
|
202
|
+
function Se(e, t) {
|
|
203
|
+
if (!T(e) || !T(e._override)) return null;
|
|
204
|
+
const n = e._override[t];
|
|
205
|
+
return T(n) && Object.keys(n).length > 0 ? n : null;
|
|
170
206
|
}
|
|
171
207
|
function B(e) {
|
|
172
|
-
|
|
173
|
-
const t = e._override.mobile;
|
|
174
|
-
return !R(t) || Object.keys(t).length === 0 ? null : t;
|
|
208
|
+
return Se(e, "mobile");
|
|
175
209
|
}
|
|
176
|
-
const
|
|
210
|
+
const Qe = /* @__PURE__ */ new Set([
|
|
177
211
|
"_meta",
|
|
178
212
|
"_override",
|
|
179
213
|
"text",
|
|
@@ -190,175 +224,184 @@ const Ne = /* @__PURE__ */ new Set([
|
|
|
190
224
|
"name",
|
|
191
225
|
"calculatedWidth",
|
|
192
226
|
"calculatedHeight"
|
|
193
|
-
]),
|
|
227
|
+
]), Ve = /* @__PURE__ */ new Set(["fontSize", "letterSpacing", "width", "height", "maxWidth", "borderRadius", "iconSize", "spacing"]), et = {
|
|
194
228
|
containerPadding: "padding",
|
|
195
229
|
columnsBackgroundColor: "background-color"
|
|
196
230
|
};
|
|
197
231
|
function X(e, t) {
|
|
198
|
-
return typeof t == "number" ? isFinite(t) ?
|
|
232
|
+
return typeof t == "number" ? isFinite(t) ? Ve.has(e) ? `${t}px` : String(t) : null : typeof t == "string" ? j(t) : null;
|
|
199
233
|
}
|
|
200
|
-
function
|
|
234
|
+
function U(e) {
|
|
201
235
|
const t = [];
|
|
202
|
-
for (const [
|
|
203
|
-
if (
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
206
|
-
for (const [i, r] of Object.entries(
|
|
236
|
+
for (const [n, o] of Object.entries(e)) {
|
|
237
|
+
if (Qe.has(n)) continue;
|
|
238
|
+
if (T(o)) {
|
|
239
|
+
if (n === "border")
|
|
240
|
+
for (const [i, r] of Object.entries(o)) {
|
|
207
241
|
if (!/^border(Top|Right|Bottom|Left)?(Width|Style|Color)$/.test(i)) continue;
|
|
208
|
-
const
|
|
209
|
-
|
|
242
|
+
const c = X(i, r);
|
|
243
|
+
c && t.push({ className: "v-border", property: L(i), value: c });
|
|
210
244
|
}
|
|
211
|
-
else if (
|
|
245
|
+
else if (n === "buttonColors")
|
|
212
246
|
for (const i of ["backgroundColor", "color"]) {
|
|
213
|
-
const r = X(i,
|
|
247
|
+
const r = X(i, o[i]);
|
|
214
248
|
r && t.push({ className: "v-button-colors", property: L(i), value: r });
|
|
215
249
|
}
|
|
216
250
|
continue;
|
|
217
251
|
}
|
|
218
|
-
const s = X(
|
|
219
|
-
s && t.push({ className:
|
|
252
|
+
const s = X(n, o);
|
|
253
|
+
s && t.push({ className: Xe(n), property: et[n] ?? L(n), value: s });
|
|
220
254
|
}
|
|
221
255
|
return t;
|
|
222
256
|
}
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
for (const
|
|
226
|
-
const s =
|
|
227
|
-
s.push(`${
|
|
257
|
+
function Ae(e, t) {
|
|
258
|
+
const n = /* @__PURE__ */ new Map();
|
|
259
|
+
for (const o of e) {
|
|
260
|
+
const s = n.get(o.className) ?? [];
|
|
261
|
+
s.push(`${o.property}: ${o.value} !important;`), n.set(o.className, s);
|
|
228
262
|
}
|
|
229
|
-
return [...
|
|
263
|
+
return [...n].map(([o, s]) => ` ${t(o)} { ${s.join(" ")} }`);
|
|
230
264
|
}
|
|
231
|
-
function
|
|
265
|
+
function tt(e) {
|
|
232
266
|
const t = B(e.values);
|
|
233
267
|
if (!t) return [];
|
|
234
|
-
const
|
|
235
|
-
return
|
|
268
|
+
const n = F(le(e));
|
|
269
|
+
return n ? Ae(U(t), (o) => `#${n} .${o}, #${n}.${o}`) : [];
|
|
236
270
|
}
|
|
237
|
-
function
|
|
271
|
+
function nt(e) {
|
|
238
272
|
const t = B(e.values);
|
|
239
273
|
if (!t) return [];
|
|
240
|
-
const
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
(
|
|
274
|
+
const n = F(H(e));
|
|
275
|
+
return n ? Ae(
|
|
276
|
+
U(t),
|
|
277
|
+
(o) => o === "v-columns-background-color" ? `#${n} .${o}` : `#${n}.${o}`
|
|
244
278
|
) : [];
|
|
245
279
|
}
|
|
246
|
-
function
|
|
247
|
-
const t =
|
|
248
|
-
for (const
|
|
249
|
-
for (const
|
|
280
|
+
function Te(e) {
|
|
281
|
+
const t = nt(e);
|
|
282
|
+
for (const n of e.columns ?? [])
|
|
283
|
+
for (const o of n.contents ?? []) t.push(...tt(o));
|
|
250
284
|
return t;
|
|
251
285
|
}
|
|
252
|
-
function
|
|
253
|
-
return e.length ? `@media ${
|
|
286
|
+
function Ee(e, t) {
|
|
287
|
+
return e.length ? `@media ${N(t)} {
|
|
254
288
|
${e.join(`
|
|
255
289
|
`)}
|
|
256
290
|
}` : "";
|
|
257
291
|
}
|
|
258
|
-
function
|
|
292
|
+
function gn(e) {
|
|
259
293
|
const t = e?.body;
|
|
260
294
|
if (!t) return "";
|
|
261
|
-
const
|
|
262
|
-
for (const s of
|
|
263
|
-
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
let
|
|
295
|
+
const n = parseInt(String(t.values?.contentWidth || "600")) || 600, o = [];
|
|
296
|
+
for (const s of se(e))
|
|
297
|
+
o.push(...Te(s));
|
|
298
|
+
return Ee(o, n);
|
|
299
|
+
}
|
|
300
|
+
const J = (e) => typeof e == "string" || typeof e == "number" ? String(e) : "";
|
|
301
|
+
function Ie(e) {
|
|
302
|
+
if (!T(e)) return "";
|
|
303
|
+
let t = "";
|
|
270
304
|
for (const n of ["Top", "Right", "Bottom", "Left"]) {
|
|
271
|
-
const
|
|
272
|
-
if (!
|
|
273
|
-
const
|
|
274
|
-
!
|
|
275
|
-
}
|
|
276
|
-
return o;
|
|
277
|
-
}
|
|
278
|
-
const Ce = (e) => e.replace(/&(?![a-zA-Z0-9#]+;)/g, "&").replace(/"/g, """);
|
|
279
|
-
function Ze(e, t, o, n = "email") {
|
|
280
|
-
const s = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", a = e.values.padding || "0px", l = e.cells.reduce((C, A) => C + A, 0), u = i ? `background-color:${i};` : "", c = e.values.backgroundImage;
|
|
281
|
-
let d = "";
|
|
282
|
-
if (c?.url) {
|
|
283
|
-
const C = c.repeat === !0 || c.repeat === "repeat" ? "repeat" : "no-repeat", A = c.cover === !0 ? "cover" : c.fullWidth === !0 ? "100% auto" : "auto", E = c.center !== !1 ? "center top" : "left top";
|
|
284
|
-
d = `background-image:url('${c.url}');background-repeat:${C};background-position:${E};background-size:${A};`;
|
|
305
|
+
const o = J(e[`border${n}Width`]).trim();
|
|
306
|
+
if (!Z(o) || parseFloat(o) <= 0) continue;
|
|
307
|
+
const s = J(e[`border${n}Style`]) || "solid", i = J(e[`border${n}Color`]) || "#CCCCCC";
|
|
308
|
+
!Z(s) || !Z(i) || (t += `border-${n.toLowerCase()}:${o} ${s} ${i};`);
|
|
285
309
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
310
|
+
return t;
|
|
311
|
+
}
|
|
312
|
+
function Re(e) {
|
|
313
|
+
const t = (e ?? "").trim().split(/\s+/).filter(Boolean);
|
|
314
|
+
if (!t.length) return ["0px", "0px", "0px", "0px"];
|
|
315
|
+
const [n = "0px", o = n, s = n, i = o] = t;
|
|
316
|
+
return [n, o, s, i];
|
|
317
|
+
}
|
|
318
|
+
function ot(e) {
|
|
319
|
+
return Re(e).every((t) => /^0(\.0+)?([a-z%]+)?$/i.test(t));
|
|
320
|
+
}
|
|
321
|
+
function je(e, t = "") {
|
|
322
|
+
if (ot(e) && !t) return { open: "", close: "" };
|
|
323
|
+
const n = t ? `background-color:${t};` : "";
|
|
324
|
+
return {
|
|
325
|
+
open: `<!--[if mso]><table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td${t && /^#[0-9a-f]{3,8}$/i.test(t) ? ` bgcolor="${t}"` : ""} style="padding:${e};${n}"><![endif]-->`,
|
|
326
|
+
close: "<!--[if mso]></td></tr></table><![endif]-->"
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function Oe(e) {
|
|
330
|
+
return `<!--[if !mso]><!-->${e}<!--<![endif]-->`;
|
|
331
|
+
}
|
|
332
|
+
function st(e, t, n, o = "email") {
|
|
333
|
+
const s = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", c = e.values.padding || "0px", l = e.cells.reduce((_, M) => _ + M, 0), d = i ? `background-color:${i};` : "", u = ie(e.values.backgroundImage), a = u?.css ?? "", h = e.columns.length > 1, m = B(e.values), y = !!e.values.noStackMobile && e.columns.length > 1, b = !!m && "columnsBackgroundColor" in m, f = e.columns.map((_, M) => {
|
|
334
|
+
const z = (e.cells[M] ?? 0) / l, ae = Math.round(z * s), qe = y ? +(z * 100).toFixed(4) : 0;
|
|
335
|
+
return { colHtml: it(_, ae, r, t, n, { pct: qe, colsBgHook: b, displayMode: o }), colWidthPx: ae };
|
|
289
336
|
});
|
|
290
|
-
let
|
|
337
|
+
let p;
|
|
291
338
|
if (h) {
|
|
292
|
-
const
|
|
293
|
-
({ colHtml:
|
|
339
|
+
const _ = f.map(
|
|
340
|
+
({ colHtml: M, colWidthPx: z }) => `<!--[if (mso)|(IE)]><td align="center" width="${z}" style="width:${z}px;padding:0px;" valign="top"><![endif]-->${M}<!--[if (mso)|(IE)]></td><![endif]-->`
|
|
294
341
|
);
|
|
295
|
-
|
|
342
|
+
p = `<!--[if (mso)|(IE)]><table role="presentation" width="${s}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${_.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
|
|
296
343
|
} else
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
344
|
+
p = f.map(({ colHtml: _ }) => _).join("");
|
|
345
|
+
const g = e.values.hideDesktop ? " u_hide_desktop" : "", $ = e.values.hideMobile ? " u_hide_mobile" : "", w = h ? "font-size:0;" : "", v = y ? " no-stack" : "", x = m ? ["padding", "backgroundColor"].filter((_) => _ in m).map((_) => _ === "padding" ? " v-padding" : " v-background-color").join("") : "", E = e.values.anchor || e.values._meta?.htmlID || m ? H(e) : "", W = E ? ` id="${S(E)}"` : "", [A, , C] = Re(c), k = je(`${A} 0px ${C} 0px`), ce = u ? Ge(u, s, i) : { open: "", close: "" };
|
|
346
|
+
let K = `<div class="u_row${v}${g}${$}${x}"${W} style="padding:${c};${d}${a}">
|
|
347
|
+
${ce.open}${k.open}<div style="margin:0 auto;max-width:${s}px;${w}text-align:center;">${p}</div>${k.close}${ce.close}
|
|
300
348
|
</div>`;
|
|
301
|
-
return
|
|
349
|
+
return e.values.hideDesktop && (K = Oe(K)), re(K, e.values.displayCondition);
|
|
302
350
|
}
|
|
303
|
-
function
|
|
304
|
-
const r = e.values?.backgroundColor || "",
|
|
305
|
-
<div style="padding:${
|
|
351
|
+
function it(e, t, n, o, s, i) {
|
|
352
|
+
const r = e.values?.backgroundColor || "", c = r || n || "", l = i.colsBgHook && !r ? ' class="v-columns-background-color"' : "", d = e.values.padding || "0px", u = e.values.borderRadius || "0px", a = c ? `background-color:${c};` : "", h = Me(e, t, o, s, i.displayMode), m = je(d), y = `<div${l} style="width:100%;box-sizing:border-box;${a}${Ie(e.values.border)}${u !== "0px" ? `border-radius:${u};` : ""}">
|
|
353
|
+
${m.open}<div style="padding:${d};">
|
|
306
354
|
${h || " "}
|
|
307
|
-
</div
|
|
355
|
+
</div>${m.close}
|
|
308
356
|
</div>`;
|
|
309
357
|
return i.pct ? `<div class="u_column_ns" style="display:inline-block;vertical-align:top;width:${i.pct}%;max-width:${t}px;">
|
|
310
358
|
<div class="u_column" style="display:inline-block;vertical-align:top;width:100%;font-size:14px;text-align:left;">
|
|
311
|
-
${
|
|
359
|
+
${y}
|
|
312
360
|
</div>
|
|
313
361
|
</div>` : `<div class="u_column" style="display:inline-block;vertical-align:top;width:100%;max-width:${t}px;font-size:14px;text-align:left;">
|
|
314
|
-
${
|
|
362
|
+
${y}
|
|
315
363
|
</div>`;
|
|
316
364
|
}
|
|
317
|
-
function
|
|
318
|
-
const i = parseInt(
|
|
365
|
+
function Me(e, t, n, o, s) {
|
|
366
|
+
const i = parseInt(n.contentWidth || "600");
|
|
319
367
|
return e.contents.map((r) => {
|
|
320
|
-
const
|
|
321
|
-
if (!
|
|
322
|
-
const l = { columnWidth: t, displayMode: s, contentWidth: i, bodyValues:
|
|
323
|
-
let
|
|
324
|
-
const
|
|
325
|
-
if ((
|
|
326
|
-
const h =
|
|
327
|
-
h && !
|
|
368
|
+
const c = o.get(r.type);
|
|
369
|
+
if (!c) return `<!-- unknown tool: ${r.type} -->`;
|
|
370
|
+
const l = { columnWidth: t, displayMode: s, contentWidth: i, bodyValues: n };
|
|
371
|
+
let d = c(r.values, l);
|
|
372
|
+
const u = !!r.values.hideDesktop, a = !!r.values.hideMobile;
|
|
373
|
+
if ((u || a) && (d = `<div class="${[u && "u_hide_desktop", a && "u_hide_mobile"].filter(Boolean).join(" ")}">${d}</div>`, u && s === "email" && (d = Oe(d))), B(r.values)) {
|
|
374
|
+
const h = le(r);
|
|
375
|
+
h && !d.includes(`id="${h}"`) && (d = `<div id="${S(h)}">${d}</div>`);
|
|
328
376
|
}
|
|
329
|
-
return
|
|
377
|
+
return re(d, r.values.displayCondition);
|
|
330
378
|
}).join(`
|
|
331
379
|
`);
|
|
332
380
|
}
|
|
333
|
-
const
|
|
334
|
-
function
|
|
335
|
-
|
|
336
|
-
const t = e.repeat === !0 || e.repeat === "repeat" ? "repeat" : "no-repeat", o = e.cover === !0 ? "cover" : e.fullWidth === !0 ? "100% auto" : "auto", n = e.center !== !1 ? "center top" : "left top";
|
|
337
|
-
return `background-image:url('${Ye(e.url)}');background-repeat:${t};background-position:${n};background-size:${o};`;
|
|
338
|
-
}
|
|
339
|
-
function Xe(e, t, o) {
|
|
340
|
-
const n = parseInt(t.contentWidth || "600") || 600, s = e.cells.reduce((b, v) => b + v, 0) || 1, i = e.values.backgroundColor ? `background-color:${S(e.values.backgroundColor)};` : "", r = Se(e.values.backgroundImage), a = S(e.values.padding || "0px"), l = B(e.values), u = !!e.values.noStackMobile && e.columns.length > 1, c = !!l && "columnsBackgroundColor" in l, d = e.values.columnsBackgroundColor || "", h = e.columns.map((b, v) => Je(b, e.cells[v] ?? 1, Math.round((e.cells[v] ?? 1) / s * n), d, c, t, o)).join(`
|
|
381
|
+
const I = (e) => j(e) ?? "";
|
|
382
|
+
function rt(e, t, n) {
|
|
383
|
+
const o = parseInt(t.contentWidth || "600") || 600, s = e.cells.reduce((p, g) => p + g, 0) || 1, i = e.values.backgroundColor ? `background-color:${I(e.values.backgroundColor)};` : "", r = Ce(e.values.backgroundImage), c = I(e.values.padding || "0px"), l = B(e.values), d = !!e.values.noStackMobile && e.columns.length > 1, u = !!l && "columnsBackgroundColor" in l, a = e.values.columnsBackgroundColor || "", h = e.columns.map((p, g) => lt(p, e.cells[g] ?? 1, Math.round((e.cells[g] ?? 1) / s * o), a, u, t, n)).join(`
|
|
341
384
|
`), m = ["u_row"];
|
|
342
|
-
|
|
343
|
-
const
|
|
385
|
+
d && m.push("no-stack"), e.values.hideDesktop && m.push("u_hide_desktop"), e.values.hideMobile && m.push("u_hide_mobile"), l && ("padding" in l && m.push("v-padding"), "backgroundColor" in l && m.push("v-background-color"));
|
|
386
|
+
const y = e.values.anchor || e.values._meta?.htmlID || l ? H(e) : "", b = y ? ` id="${S(y)}"` : "", f = `<div class="${m.join(" ")}"${b} style="padding:${c};${i}${r}">
|
|
344
387
|
<div class="u_row_inner">
|
|
345
388
|
${h}
|
|
346
389
|
</div>
|
|
347
390
|
</div>`;
|
|
348
|
-
return
|
|
391
|
+
return re(ct(f), e.values.displayCondition);
|
|
349
392
|
}
|
|
350
|
-
function
|
|
351
|
-
const
|
|
393
|
+
function lt(e, t, n, o, s, i, r) {
|
|
394
|
+
const c = e.values?.backgroundColor || "", l = c || o, d = s && !c ? " v-columns-background-color" : "", u = e.values?.borderRadius && e.values.borderRadius !== "0px" ? `border-radius:${I(e.values.borderRadius)};` : "", a = I(e.values?.padding || "0px"), h = Me(e, n, i, r, "web");
|
|
352
395
|
return ` <div class="u_column" style="flex:${+t || 1} 1 0%;">
|
|
353
|
-
<div class="u_column_inner${
|
|
396
|
+
<div class="u_column_inner${d}" style="${l ? `background-color:${I(l)};` : ""}${Ie(e.values?.border)}${u}padding:${a};">
|
|
354
397
|
${h}
|
|
355
398
|
</div>
|
|
356
399
|
</div>`;
|
|
357
400
|
}
|
|
358
|
-
function
|
|
401
|
+
function ct(e) {
|
|
359
402
|
return !e.includes("<!--[if") && !e.includes("<![endif]") ? e : e.replace(/<!--\[if [^\]]*\]>(?!<!-->)[\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--\[if [^\]]*\]><!-->/gi, "").replace(/<!--<!\[endif\]-->/gi, "");
|
|
360
403
|
}
|
|
361
|
-
function
|
|
404
|
+
function at(e) {
|
|
362
405
|
return `*, *::before, *::after { box-sizing: border-box; }
|
|
363
406
|
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
364
407
|
body { margin: 0; padding: 0; }
|
|
@@ -370,7 +413,7 @@ table { border-collapse: collapse; }
|
|
|
370
413
|
.u_row_inner { display: flex; flex-wrap: nowrap; align-items: stretch; max-width: ${e}px; margin: 0 auto; }
|
|
371
414
|
.u_column { min-width: 0; }
|
|
372
415
|
.u_column_inner { height: 100%; }
|
|
373
|
-
@media ${
|
|
416
|
+
@media ${N(e)} {
|
|
374
417
|
.u_row:not(.no-stack) > .u_row_inner { flex-direction: column; }
|
|
375
418
|
.u_row:not(.no-stack) > .u_row_inner > .u_column { flex: 0 0 auto !important; width: 100% !important; }
|
|
376
419
|
.u_hide_mobile { display: none !important; }
|
|
@@ -379,29 +422,29 @@ table { border-collapse: collapse; }
|
|
|
379
422
|
.u_hide_desktop { display: none !important; }
|
|
380
423
|
}`;
|
|
381
424
|
}
|
|
382
|
-
function
|
|
425
|
+
function ut(e) {
|
|
383
426
|
if (!e || typeof e != "object") return "";
|
|
384
|
-
const t = (s, i) => [s ? `color: ${
|
|
385
|
-
return (
|
|
386
|
-
.u_body a { ${
|
|
387
|
-
.u_body a:hover { ${
|
|
388
|
-
}
|
|
389
|
-
function
|
|
390
|
-
const
|
|
391
|
-
<link href="${
|
|
427
|
+
const t = (s, i) => [s ? `color: ${I(s)};` : "", typeof i == "boolean" ? `text-decoration: ${i ? "underline" : "none"};` : ""].filter(Boolean).join(" "), n = t(e.linkColor, e.linkUnderline), o = t(e.linkHoverColor, e.linkHoverUnderline);
|
|
428
|
+
return (n ? `
|
|
429
|
+
.u_body a { ${n} }` : "") + (o ? `
|
|
430
|
+
.u_body a:hover { ${o} }` : "");
|
|
431
|
+
}
|
|
432
|
+
function dt(e, t, n = {}) {
|
|
433
|
+
const o = parseInt(t.contentWidth || "600") || 600, s = I(t.backgroundColor || "#ffffff"), i = I(t.textColor || "#000000"), r = I(t.fontFamily?.value || "arial,helvetica,sans-serif"), c = xe(t), l = c ? ` font-weight: ${c};` : "", d = we(t, n.title), u = Ce(t.backgroundImage), a = ut(t.linkStyle), h = (n.fontUrls ?? []).map((b) => `
|
|
434
|
+
<link href="${S(b)}" rel="stylesheet">`).join(""), m = (n.styles ?? []).map((b) => `
|
|
392
435
|
<style>
|
|
393
|
-
${
|
|
436
|
+
${b}
|
|
394
437
|
</style>`).join("");
|
|
395
438
|
return `<!DOCTYPE html>
|
|
396
|
-
<html lang="${
|
|
439
|
+
<html lang="${S(n.lang || ke(t) || "en")}">
|
|
397
440
|
<head>
|
|
398
441
|
<meta charset="utf-8">
|
|
399
442
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
400
|
-
<title>${
|
|
443
|
+
<title>${d ? ee(d) : ""}</title>${h}
|
|
401
444
|
<style>
|
|
402
|
-
${
|
|
445
|
+
${at(o)}
|
|
403
446
|
body { background-color: ${s}; color: ${i}; font-family: ${r};${l} }
|
|
404
|
-
.u_body { background-color: ${s};${
|
|
447
|
+
.u_body { background-color: ${s};${u ? ` ${u.replace(/;(?=.)/g, "; ")}` : ""} }${a}
|
|
405
448
|
</style>${m}
|
|
406
449
|
</head>
|
|
407
450
|
<body>
|
|
@@ -411,60 +454,57 @@ ${e}
|
|
|
411
454
|
</body>
|
|
412
455
|
</html>`;
|
|
413
456
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (!N(e) || !N(e._override)) return null;
|
|
417
|
-
const t = e._override.dark;
|
|
418
|
-
return N(t) && Object.keys(t).length ? t : null;
|
|
457
|
+
function ze(e) {
|
|
458
|
+
return Se(e, "dark");
|
|
419
459
|
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
422
|
-
const
|
|
423
|
-
for (const
|
|
424
|
-
return [...
|
|
460
|
+
const ft = (e) => /color$/.test(e.property);
|
|
461
|
+
function De(e, t) {
|
|
462
|
+
const n = /* @__PURE__ */ new Map();
|
|
463
|
+
for (const o of e.filter(ft)) n.set(o.className, [...n.get(o.className) ?? [], o]);
|
|
464
|
+
return [...n].map(([o, s]) => ({ selector: t(o), decls: s }));
|
|
425
465
|
}
|
|
426
|
-
function
|
|
427
|
-
const t =
|
|
466
|
+
function pt(e) {
|
|
467
|
+
const t = ze(e.values);
|
|
428
468
|
if (!t) return [];
|
|
429
|
-
const
|
|
430
|
-
return
|
|
469
|
+
const n = F(le(e));
|
|
470
|
+
return n ? De(U(t), (o) => `#${n} .${o}, #${n}.${o}`) : [];
|
|
431
471
|
}
|
|
432
|
-
function
|
|
433
|
-
const t =
|
|
472
|
+
function mt(e) {
|
|
473
|
+
const t = ze(e.values);
|
|
434
474
|
if (!t) return [];
|
|
435
|
-
const
|
|
436
|
-
return
|
|
475
|
+
const n = F(H(e));
|
|
476
|
+
return n ? De(U(t), (o) => o === "v-columns-background-color" ? `#${n} .${o}` : `#${n}.${o}`) : [];
|
|
437
477
|
}
|
|
438
|
-
function
|
|
478
|
+
function ht(e) {
|
|
439
479
|
const t = e.body?.values?.darkMode;
|
|
440
|
-
if (!
|
|
441
|
-
const
|
|
442
|
-
return
|
|
443
|
-
}
|
|
444
|
-
function
|
|
445
|
-
return
|
|
446
|
-
}
|
|
447
|
-
function
|
|
448
|
-
const t = [...
|
|
449
|
-
for (const r of
|
|
450
|
-
t.push(...
|
|
451
|
-
for (const
|
|
480
|
+
if (!T(t)) return [];
|
|
481
|
+
const n = [], o = j(t.backgroundColor), s = j(t.textColor), i = j(t.linkColor);
|
|
482
|
+
return o && n.push({ selector: "body, .u_body, #u_body", decls: [{ className: "", property: "background-color", value: o }] }), s && n.push({ selector: "body, .u_body, #u_body, .u_body .v-color", decls: [{ className: "", property: "color", value: s }] }), i && n.push({ selector: ".u_body a, #u_body a", decls: [{ className: "", property: "color", value: i }] }), n;
|
|
483
|
+
}
|
|
484
|
+
function yn(e) {
|
|
485
|
+
return Be(e) !== "";
|
|
486
|
+
}
|
|
487
|
+
function Be(e) {
|
|
488
|
+
const t = [...ht(e)];
|
|
489
|
+
for (const r of se(e)) {
|
|
490
|
+
t.push(...mt(r));
|
|
491
|
+
for (const c of r.columns ?? []) for (const l of c.contents ?? []) t.push(...pt(l));
|
|
452
492
|
}
|
|
453
493
|
if (!t.length) return "";
|
|
454
|
-
const
|
|
455
|
-
`), s = (r,
|
|
494
|
+
const n = (r) => `${r.property}: ${r.value} !important;`, o = t.map((r) => ` ${r.selector} { ${r.decls.map(n).join(" ")} }`).join(`
|
|
495
|
+
`), s = (r, c) => t.map((l) => ({ sel: l.selector.split(",").map((d) => `[${r}] ${d.trim()}`).join(", "), decls: l.decls.filter(c) })).filter((l) => l.decls.length).map((l) => `${l.sel} { ${l.decls.map(n).join(" ")} }`).join(`
|
|
456
496
|
`), i = (r) => r.property === "background-color";
|
|
457
497
|
return [
|
|
458
498
|
":root { color-scheme: light dark; supported-color-schemes: light dark; }",
|
|
459
499
|
`@media (prefers-color-scheme: dark) {
|
|
460
|
-
${
|
|
500
|
+
${o}
|
|
461
501
|
}`,
|
|
462
502
|
s("data-ogsc", (r) => !i(r)),
|
|
463
503
|
s("data-ogsb", i)
|
|
464
504
|
].filter(Boolean).join(`
|
|
465
505
|
`);
|
|
466
506
|
}
|
|
467
|
-
const
|
|
507
|
+
const gt = [
|
|
468
508
|
"box-sizing",
|
|
469
509
|
"overflow-wrap",
|
|
470
510
|
"word-break",
|
|
@@ -478,17 +518,17 @@ const rt = [
|
|
|
478
518
|
"display:\\s*flex",
|
|
479
519
|
"display:\\s*grid",
|
|
480
520
|
"gap"
|
|
481
|
-
],
|
|
482
|
-
`(?:;\\s*|^\\s*)(${
|
|
521
|
+
], yt = new RegExp(
|
|
522
|
+
`(?:;\\s*|^\\s*)(${gt.join("|")})\\s*:[^;]*`,
|
|
483
523
|
"gi"
|
|
484
|
-
),
|
|
485
|
-
function
|
|
486
|
-
return e.replace(/style="([^"]*)"/gi, (t,
|
|
487
|
-
let
|
|
488
|
-
return
|
|
524
|
+
), bt = /var\(--[^)]*\)/gi;
|
|
525
|
+
function $t(e) {
|
|
526
|
+
return e.replace(/style="([^"]*)"/gi, (t, n) => {
|
|
527
|
+
let o = n;
|
|
528
|
+
return o = o.replace(yt, ";"), o = o.replace(bt, "inherit"), o = o.replace(/;(\s*;)+/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), o ? `style="${o}"` : "";
|
|
489
529
|
});
|
|
490
530
|
}
|
|
491
|
-
const
|
|
531
|
+
const vt = /* @__PURE__ */ new Set(["style", "script", "textarea", "title"]), ne = /* @__PURE__ */ new Set([
|
|
492
532
|
"area",
|
|
493
533
|
"base",
|
|
494
534
|
"br",
|
|
@@ -505,429 +545,431 @@ const ut = /* @__PURE__ */ new Set(["style", "script", "textarea", "title"]), ee
|
|
|
505
545
|
"wbr"
|
|
506
546
|
]);
|
|
507
547
|
function O(e) {
|
|
508
|
-
const t = [],
|
|
509
|
-
let
|
|
548
|
+
const t = [], n = e.length;
|
|
549
|
+
let o = 0, s = 0;
|
|
510
550
|
const i = (r) => {
|
|
511
551
|
r > s && t.push({ type: "text", raw: e.slice(s, r) });
|
|
512
552
|
};
|
|
513
|
-
for (;
|
|
514
|
-
const r = e.indexOf("<",
|
|
553
|
+
for (; o < n; ) {
|
|
554
|
+
const r = e.indexOf("<", o);
|
|
515
555
|
if (r === -1) break;
|
|
516
|
-
const
|
|
556
|
+
const c = e.charAt(r + 1);
|
|
517
557
|
if (e.startsWith("<!--", r)) {
|
|
518
|
-
const l = e.indexOf("-->", r + 4),
|
|
519
|
-
i(r), t.push({ type: "comment", raw: e.slice(r,
|
|
558
|
+
const l = e.indexOf("-->", r + 4), d = l === -1 ? n : l + 3;
|
|
559
|
+
i(r), t.push({ type: "comment", raw: e.slice(r, d) }), o = s = d;
|
|
520
560
|
continue;
|
|
521
561
|
}
|
|
522
|
-
if (
|
|
523
|
-
const l = e.indexOf(">", r + 2),
|
|
524
|
-
i(r), t.push({ type: "doctype", raw: e.slice(r,
|
|
562
|
+
if (c === "!" || c === "?") {
|
|
563
|
+
const l = e.indexOf(">", r + 2), d = l === -1 ? n : l + 1;
|
|
564
|
+
i(r), t.push({ type: "doctype", raw: e.slice(r, d) }), o = s = d;
|
|
525
565
|
continue;
|
|
526
566
|
}
|
|
527
|
-
if (
|
|
528
|
-
const l = e.indexOf(">", r + 2),
|
|
529
|
-
i(r), t.push({ type: "close", name:
|
|
567
|
+
if (c === "/" && /[a-zA-Z]/.test(e.charAt(r + 2))) {
|
|
568
|
+
const l = e.indexOf(">", r + 2), d = l === -1 ? n : l + 1, u = e.slice(r + 2, l === -1 ? n : l).trim().split(/\s/, 1)[0]?.toLowerCase() ?? "";
|
|
569
|
+
i(r), t.push({ type: "close", name: u, raw: e.slice(r, d) }), o = s = d;
|
|
530
570
|
continue;
|
|
531
571
|
}
|
|
532
|
-
if (/[a-zA-Z]/.test(
|
|
533
|
-
const l =
|
|
572
|
+
if (/[a-zA-Z]/.test(c)) {
|
|
573
|
+
const l = wt(e, r);
|
|
534
574
|
if (!l) {
|
|
535
|
-
|
|
575
|
+
o = r + 1;
|
|
536
576
|
continue;
|
|
537
577
|
}
|
|
538
|
-
if (i(r), t.push(l.token),
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
|
|
578
|
+
if (i(r), t.push(l.token), o = s = l.end, vt.has(l.token.name) && !l.token.selfClosing) {
|
|
579
|
+
const d = new RegExp(`</${l.token.name}\\s*>`, "ig");
|
|
580
|
+
d.lastIndex = o;
|
|
581
|
+
const u = d.exec(e), a = u ? u.index : n;
|
|
582
|
+
a > o && t.push({ type: "rawtext", parent: l.token.name, raw: e.slice(o, a) }), u ? (t.push({ type: "close", name: l.token.name, raw: u[0] }), o = s = a + u[0].length) : o = s = n;
|
|
543
583
|
}
|
|
544
584
|
continue;
|
|
545
585
|
}
|
|
546
|
-
|
|
586
|
+
o = r + 1;
|
|
547
587
|
}
|
|
548
|
-
return i(
|
|
588
|
+
return i(n), t;
|
|
549
589
|
}
|
|
550
|
-
function
|
|
551
|
-
const
|
|
552
|
-
let
|
|
553
|
-
const s = /^[a-zA-Z][^\s/>]*/.exec(e.slice(
|
|
590
|
+
function wt(e, t) {
|
|
591
|
+
const n = e.length;
|
|
592
|
+
let o = t + 1;
|
|
593
|
+
const s = /^[a-zA-Z][^\s/>]*/.exec(e.slice(o, o + 128));
|
|
554
594
|
if (!s) return null;
|
|
555
595
|
const i = s[0].toLowerCase();
|
|
556
|
-
|
|
596
|
+
o += s[0].length;
|
|
557
597
|
const r = [];
|
|
558
|
-
let
|
|
559
|
-
for (;
|
|
560
|
-
for (;
|
|
561
|
-
const l = e.charAt(
|
|
598
|
+
let c = !1;
|
|
599
|
+
for (; o < n; ) {
|
|
600
|
+
for (; o < n && /\s/.test(e.charAt(o)); ) o++;
|
|
601
|
+
const l = e.charAt(o);
|
|
562
602
|
if (l === ">")
|
|
563
|
-
return
|
|
603
|
+
return o++, { token: { type: "open", name: i, attrs: r, selfClosing: c, raw: e.slice(t, o) }, end: o };
|
|
564
604
|
if (l === "/") {
|
|
565
|
-
if (
|
|
566
|
-
return
|
|
605
|
+
if (o++, e.charAt(o) === ">")
|
|
606
|
+
return c = !0, o++, { token: { type: "open", name: i, attrs: r, selfClosing: c, raw: e.slice(t, o) }, end: o };
|
|
567
607
|
continue;
|
|
568
608
|
}
|
|
569
|
-
if (
|
|
570
|
-
const
|
|
571
|
-
for (;
|
|
572
|
-
if (
|
|
573
|
-
|
|
609
|
+
if (o >= n) break;
|
|
610
|
+
const d = o;
|
|
611
|
+
for (; o < n && !/[\s=/>]/.test(e.charAt(o)); ) o++;
|
|
612
|
+
if (o === d) {
|
|
613
|
+
o++;
|
|
574
614
|
continue;
|
|
575
615
|
}
|
|
576
|
-
const
|
|
577
|
-
let
|
|
578
|
-
for (;
|
|
579
|
-
if (e.charAt(
|
|
580
|
-
for (
|
|
581
|
-
const h = e.charAt(
|
|
616
|
+
const u = e.slice(d, o).toLowerCase();
|
|
617
|
+
let a = o;
|
|
618
|
+
for (; a < n && /\s/.test(e.charAt(a)); ) a++;
|
|
619
|
+
if (e.charAt(a) === "=") {
|
|
620
|
+
for (a++; a < n && /\s/.test(e.charAt(a)); ) a++;
|
|
621
|
+
const h = e.charAt(a);
|
|
582
622
|
if (h === '"' || h === "'") {
|
|
583
|
-
const m = e.indexOf(h,
|
|
584
|
-
r.push({ name:
|
|
623
|
+
const m = e.indexOf(h, a + 1), y = m === -1 ? n : m;
|
|
624
|
+
r.push({ name: u, value: e.slice(a + 1, y), quote: h }), o = m === -1 ? n : m + 1;
|
|
585
625
|
} else {
|
|
586
|
-
const m =
|
|
587
|
-
for (;
|
|
588
|
-
r.push({ name:
|
|
626
|
+
const m = a;
|
|
627
|
+
for (; a < n && !/[\s>]/.test(e.charAt(a)); ) a++;
|
|
628
|
+
r.push({ name: u, value: e.slice(m, a), quote: "" }), o = a;
|
|
589
629
|
}
|
|
590
630
|
} else
|
|
591
|
-
r.push({ name:
|
|
631
|
+
r.push({ name: u, value: null, quote: "" });
|
|
592
632
|
}
|
|
593
633
|
return null;
|
|
594
634
|
}
|
|
595
|
-
function
|
|
635
|
+
function kt(e) {
|
|
596
636
|
let t = `<${e.name}`;
|
|
597
|
-
for (const
|
|
598
|
-
if (
|
|
599
|
-
t += ` ${
|
|
637
|
+
for (const n of e.attrs) {
|
|
638
|
+
if (n.value === null) {
|
|
639
|
+
t += ` ${n.name}`;
|
|
600
640
|
continue;
|
|
601
641
|
}
|
|
602
|
-
let
|
|
603
|
-
|
|
604
|
-
const s =
|
|
605
|
-
t += ` ${
|
|
642
|
+
let o = n.quote || '"';
|
|
643
|
+
o === "'" && n.value.includes("'") && (o = '"');
|
|
644
|
+
const s = o === '"' ? n.value.replace(/"/g, """) : n.value;
|
|
645
|
+
t += ` ${n.name}=${o}${s}${o}`;
|
|
606
646
|
}
|
|
607
647
|
return t += e.selfClosing ? " />" : ">", t;
|
|
608
648
|
}
|
|
609
|
-
function
|
|
649
|
+
function P(e) {
|
|
610
650
|
let t = "";
|
|
611
|
-
for (const
|
|
612
|
-
t +=
|
|
651
|
+
for (const n of e)
|
|
652
|
+
t += n.type === "open" && n.dirty ? kt(n) : n.raw;
|
|
613
653
|
return t;
|
|
614
654
|
}
|
|
615
|
-
function
|
|
616
|
-
const
|
|
617
|
-
return
|
|
655
|
+
function R(e, t) {
|
|
656
|
+
const n = e.attrs.find((o) => o.name === t);
|
|
657
|
+
return n ? n.value : void 0;
|
|
618
658
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
|
|
659
|
+
function xt(e, t, n) {
|
|
660
|
+
const o = e.attrs.find((s) => s.name === t);
|
|
661
|
+
o ? (o.value = n, o.quote || (o.quote = '"')) : e.attrs.push({ name: t, value: n, quote: '"' }), e.dirty = !0;
|
|
622
662
|
}
|
|
623
|
-
function
|
|
663
|
+
function Ct(e) {
|
|
624
664
|
const t = e.slice(4, e.endsWith("-->") ? -3 : void 0).trim();
|
|
625
665
|
return /^\[if\b/i.test(t) || /^<!\[endif\]/i.test(t) || /<!\[endif\]$/i.test(t);
|
|
626
666
|
}
|
|
627
|
-
function
|
|
628
|
-
let t = "",
|
|
629
|
-
for (;
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
632
|
-
const s = G(e,
|
|
633
|
-
t += e.slice(
|
|
634
|
-
} else if (
|
|
635
|
-
const s = e.indexOf("*/",
|
|
636
|
-
|
|
667
|
+
function Pe(e) {
|
|
668
|
+
let t = "", n = 0;
|
|
669
|
+
for (; n < e.length; ) {
|
|
670
|
+
const o = e.charAt(n);
|
|
671
|
+
if (o === '"' || o === "'") {
|
|
672
|
+
const s = G(e, n);
|
|
673
|
+
t += e.slice(n, s), n = s;
|
|
674
|
+
} else if (o === "/" && e[n + 1] === "*") {
|
|
675
|
+
const s = e.indexOf("*/", n + 2);
|
|
676
|
+
n = s === -1 ? e.length : s + 2;
|
|
637
677
|
} else
|
|
638
|
-
t +=
|
|
678
|
+
t += o, n++;
|
|
639
679
|
}
|
|
640
680
|
return t;
|
|
641
681
|
}
|
|
642
682
|
function G(e, t) {
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
for (;
|
|
646
|
-
if (e[
|
|
647
|
-
|
|
683
|
+
const n = e.charAt(t);
|
|
684
|
+
let o = t + 1;
|
|
685
|
+
for (; o < e.length; ) {
|
|
686
|
+
if (e[o] === "\\") {
|
|
687
|
+
o += 2;
|
|
648
688
|
continue;
|
|
649
689
|
}
|
|
650
|
-
if (e[
|
|
651
|
-
`) return
|
|
652
|
-
|
|
690
|
+
if (e[o] === n || e[o] === `
|
|
691
|
+
`) return o + 1;
|
|
692
|
+
o++;
|
|
653
693
|
}
|
|
654
694
|
return e.length;
|
|
655
695
|
}
|
|
656
|
-
function
|
|
657
|
-
let
|
|
696
|
+
function q(e, t, n) {
|
|
697
|
+
let o = 0, s = t;
|
|
658
698
|
for (; s < e.length; ) {
|
|
659
|
-
const i = e
|
|
699
|
+
const i = e.charAt(s);
|
|
660
700
|
if (i === '"' || i === "'") {
|
|
661
701
|
s = G(e, s);
|
|
662
702
|
continue;
|
|
663
703
|
}
|
|
664
|
-
if (i === "(" || i === "[")
|
|
665
|
-
else if (i === ")" || i === "]")
|
|
666
|
-
else if (
|
|
704
|
+
if (i === "(" || i === "[") o++;
|
|
705
|
+
else if (i === ")" || i === "]") o = Math.max(0, o - 1);
|
|
706
|
+
else if (o === 0 && n.includes(i)) return s;
|
|
667
707
|
s++;
|
|
668
708
|
}
|
|
669
709
|
return -1;
|
|
670
710
|
}
|
|
671
|
-
function
|
|
672
|
-
let
|
|
673
|
-
for (;
|
|
674
|
-
const s = e
|
|
711
|
+
function fe(e, t) {
|
|
712
|
+
let n = 0, o = t;
|
|
713
|
+
for (; o < e.length; ) {
|
|
714
|
+
const s = e.charAt(o);
|
|
675
715
|
if (s === '"' || s === "'") {
|
|
676
|
-
|
|
716
|
+
o = G(e, o);
|
|
677
717
|
continue;
|
|
678
718
|
}
|
|
679
|
-
if (s === "{")
|
|
680
|
-
else if (s === "}" && (
|
|
681
|
-
return
|
|
682
|
-
|
|
719
|
+
if (s === "{") n++;
|
|
720
|
+
else if (s === "}" && (n--, n === 0))
|
|
721
|
+
return o;
|
|
722
|
+
o++;
|
|
683
723
|
}
|
|
684
724
|
return e.length - 1;
|
|
685
725
|
}
|
|
686
|
-
function
|
|
687
|
-
const
|
|
688
|
-
let
|
|
726
|
+
function We(e, t) {
|
|
727
|
+
const n = [];
|
|
728
|
+
let o = 0, s = q(e, 0, t);
|
|
689
729
|
for (; s !== -1; )
|
|
690
|
-
|
|
691
|
-
return
|
|
730
|
+
n.push(e.slice(o, s)), o = s + 1, s = q(e, o, t);
|
|
731
|
+
return n.push(e.slice(o)), n;
|
|
692
732
|
}
|
|
693
|
-
function
|
|
733
|
+
function Le(e) {
|
|
694
734
|
const t = [];
|
|
695
|
-
for (const
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
698
|
-
const s =
|
|
699
|
-
let i =
|
|
735
|
+
for (const n of We(e, ";")) {
|
|
736
|
+
const o = n.indexOf(":");
|
|
737
|
+
if (o === -1) continue;
|
|
738
|
+
const s = n.slice(0, o).trim().toLowerCase();
|
|
739
|
+
let i = n.slice(o + 1).trim();
|
|
700
740
|
if (!s || !i) continue;
|
|
701
741
|
let r = !1;
|
|
702
|
-
const
|
|
703
|
-
|
|
742
|
+
const c = /\s*!\s*important\s*$/i.exec(i);
|
|
743
|
+
c && (r = !0, i = i.slice(0, c.index).trim()), t.push({ property: s, value: i, important: r });
|
|
704
744
|
}
|
|
705
745
|
return t;
|
|
706
746
|
}
|
|
707
|
-
function
|
|
747
|
+
function pe(e) {
|
|
708
748
|
return e.map((t) => `${t.property}:${t.value}${t.important ? " !important" : ""}`).join(";");
|
|
709
749
|
}
|
|
710
|
-
function
|
|
711
|
-
const t =
|
|
712
|
-
let
|
|
713
|
-
for (;
|
|
714
|
-
for (;
|
|
715
|
-
if (t.startsWith("<!--",
|
|
716
|
-
|
|
750
|
+
function _t(e) {
|
|
751
|
+
const t = Pe(e), n = [];
|
|
752
|
+
let o = 0;
|
|
753
|
+
for (; o < t.length; ) {
|
|
754
|
+
for (; o < t.length && /[\s;]/.test(t.charAt(o)); ) o++;
|
|
755
|
+
if (t.startsWith("<!--", o)) {
|
|
756
|
+
o += 4;
|
|
717
757
|
continue;
|
|
718
758
|
}
|
|
719
|
-
if (t.startsWith("-->",
|
|
720
|
-
|
|
759
|
+
if (t.startsWith("-->", o)) {
|
|
760
|
+
o += 3;
|
|
721
761
|
continue;
|
|
722
762
|
}
|
|
723
|
-
if (
|
|
724
|
-
if (t[
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
|
|
763
|
+
if (o >= t.length) break;
|
|
764
|
+
if (t[o] === "@") {
|
|
765
|
+
const d = (/^@([\w-]+)/.exec(t.slice(o))?.[1] ?? "").toLowerCase(), u = q(t, o, ";{");
|
|
766
|
+
if (u === -1) {
|
|
767
|
+
n.push({ type: "at-rule", name: d, raw: t.slice(o).trim() });
|
|
728
768
|
break;
|
|
729
769
|
}
|
|
730
|
-
if (t[
|
|
731
|
-
|
|
770
|
+
if (t[u] === ";")
|
|
771
|
+
n.push({ type: "at-rule", name: d, raw: t.slice(o, u + 1).trim() }), o = u + 1;
|
|
732
772
|
else {
|
|
733
|
-
const
|
|
734
|
-
|
|
773
|
+
const a = fe(t, u);
|
|
774
|
+
n.push({ type: "at-rule", name: d, raw: t.slice(o, a + 1).trim() }), o = a + 1;
|
|
735
775
|
}
|
|
736
776
|
continue;
|
|
737
777
|
}
|
|
738
|
-
const s =
|
|
778
|
+
const s = q(t, o, "{");
|
|
739
779
|
if (s === -1) break;
|
|
740
|
-
const i =
|
|
741
|
-
|
|
780
|
+
const i = fe(t, s), r = t.slice(o, s).trim(), c = t.slice(s + 1, i);
|
|
781
|
+
n.push({
|
|
742
782
|
type: "rule",
|
|
743
|
-
selectors:
|
|
744
|
-
declarations:
|
|
745
|
-
raw: t.slice(
|
|
746
|
-
}),
|
|
783
|
+
selectors: We(r, ",").map((l) => l.trim()).filter(Boolean),
|
|
784
|
+
declarations: Le(c),
|
|
785
|
+
raw: t.slice(o, i + 1).trim()
|
|
786
|
+
}), o = i + 1;
|
|
747
787
|
}
|
|
748
|
-
return
|
|
788
|
+
return n;
|
|
749
789
|
}
|
|
750
|
-
const
|
|
751
|
-
function
|
|
752
|
-
const t =
|
|
753
|
-
let
|
|
790
|
+
const St = /^@(?:-[a-z]+-)?(?:media|supports|document|container|layer|keyframes)\b/i;
|
|
791
|
+
function At(e) {
|
|
792
|
+
const t = Pe(e);
|
|
793
|
+
let n = "", o = 0;
|
|
754
794
|
const s = [];
|
|
755
795
|
let i = 0;
|
|
756
796
|
const r = () => s.length > 0 && s[s.length - 1];
|
|
757
|
-
for (;
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
const l = G(t,
|
|
761
|
-
|
|
797
|
+
for (; o < t.length; ) {
|
|
798
|
+
const c = t.charAt(o);
|
|
799
|
+
if (c === '"' || c === "'") {
|
|
800
|
+
const l = G(t, o);
|
|
801
|
+
n += t.slice(o, l), o = l;
|
|
762
802
|
continue;
|
|
763
803
|
}
|
|
764
|
-
if (/\s/.test(
|
|
765
|
-
for (;
|
|
766
|
-
const l =
|
|
767
|
-
if (l === void 0 ||
|
|
768
|
-
|
|
804
|
+
if (/\s/.test(c)) {
|
|
805
|
+
for (; o < t.length && /\s/.test(t.charAt(o)); ) o++;
|
|
806
|
+
const l = n.at(-1);
|
|
807
|
+
if (l === void 0 || o >= t.length) continue;
|
|
808
|
+
const d = t.charAt(o);
|
|
809
|
+
if ("{};,>".includes(l) || "{};,>".includes(d) || l === ":" || d === ":" && r()) continue;
|
|
810
|
+
n += " ";
|
|
769
811
|
continue;
|
|
770
812
|
}
|
|
771
|
-
if (
|
|
772
|
-
const l =
|
|
773
|
-
s.push(!
|
|
813
|
+
if (c === "{") {
|
|
814
|
+
const l = n.slice(i).trim();
|
|
815
|
+
s.push(!St.test(l)), n += c, i = n.length, o++;
|
|
774
816
|
continue;
|
|
775
817
|
}
|
|
776
|
-
|
|
818
|
+
c === "}" && (n[n.length - 1] === ";" && (n = n.slice(0, -1)), s.pop()), n += c, (c === "}" || c === ";") && (i = n.length), o++;
|
|
777
819
|
}
|
|
778
|
-
return
|
|
820
|
+
return n.trim();
|
|
779
821
|
}
|
|
780
|
-
const
|
|
781
|
-
function
|
|
822
|
+
const Tt = /^[a-zA-Z0-9_\-#.*\s>]+$/, Et = /^(\*|[a-zA-Z][a-zA-Z0-9-]*)?((?:[#.][a-zA-Z_-][a-zA-Z0-9_-]*)*)$/;
|
|
823
|
+
function It(e) {
|
|
782
824
|
const t = e.trim();
|
|
783
|
-
if (!t || !
|
|
784
|
-
const
|
|
825
|
+
if (!t || !Tt.test(t)) return null;
|
|
826
|
+
const n = t.replace(/\s*>\s*/g, " > ").trim().split(/\s+/), o = [], s = [], i = [0, 0, 0];
|
|
785
827
|
let r = null;
|
|
786
|
-
for (const
|
|
787
|
-
if (
|
|
788
|
-
if (
|
|
828
|
+
for (const c of n) {
|
|
829
|
+
if (c === ">") {
|
|
830
|
+
if (o.length === 0 || r === ">") return null;
|
|
789
831
|
r = ">";
|
|
790
832
|
continue;
|
|
791
833
|
}
|
|
792
|
-
const l =
|
|
834
|
+
const l = Et.exec(c);
|
|
793
835
|
if (!l || !l[1] && !l[2]) return null;
|
|
794
|
-
const
|
|
795
|
-
l[1] && l[1] !== "*" && (
|
|
796
|
-
for (const
|
|
797
|
-
if (
|
|
798
|
-
if (
|
|
799
|
-
|
|
836
|
+
const d = { tag: null, id: null, classes: [] };
|
|
837
|
+
l[1] && l[1] !== "*" && (d.tag = l[1].toLowerCase(), i[2]++);
|
|
838
|
+
for (const u of l[2]?.match(/[#.][^#.]+/g) ?? [])
|
|
839
|
+
if (u[0] === "#") {
|
|
840
|
+
if (d.id !== null && d.id !== u.slice(1)) return null;
|
|
841
|
+
d.id = u.slice(1), i[0]++;
|
|
800
842
|
} else
|
|
801
|
-
|
|
802
|
-
|
|
843
|
+
d.classes.push(u.slice(1)), i[1]++;
|
|
844
|
+
o.length > 0 && s.push(r ?? " "), r = null, o.push(d);
|
|
803
845
|
}
|
|
804
|
-
return r !== null ||
|
|
846
|
+
return r !== null || o.length === 0 ? null : (o.reverse(), s.reverse(), { compounds: o, combinators: s, specificity: i });
|
|
805
847
|
}
|
|
806
|
-
function
|
|
848
|
+
function Rt(e, t) {
|
|
807
849
|
if (t.tag !== null && e.token.name !== t.tag || t.id !== null && e.id !== t.id) return !1;
|
|
808
|
-
for (const
|
|
809
|
-
if (!e.classes.includes(
|
|
850
|
+
for (const n of t.classes)
|
|
851
|
+
if (!e.classes.includes(n)) return !1;
|
|
810
852
|
return !0;
|
|
811
853
|
}
|
|
812
|
-
function
|
|
813
|
-
|
|
814
|
-
if (o
|
|
815
|
-
if (t.
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
854
|
+
function oe(e, t, n) {
|
|
855
|
+
const o = t.compounds[n];
|
|
856
|
+
if (!o || !Rt(e, o)) return !1;
|
|
857
|
+
if (n === t.compounds.length - 1) return !0;
|
|
858
|
+
if (t.combinators[n] === ">")
|
|
859
|
+
return e.parent !== null && oe(e.parent, t, n + 1);
|
|
860
|
+
for (let i = e.parent; i; i = i.parent)
|
|
861
|
+
if (oe(i, t, n + 1)) return !0;
|
|
819
862
|
return !1;
|
|
820
863
|
}
|
|
821
|
-
function
|
|
822
|
-
return
|
|
864
|
+
function jt(e, t) {
|
|
865
|
+
return oe(e, t, 0);
|
|
823
866
|
}
|
|
824
|
-
function
|
|
867
|
+
function Ot(e, t) {
|
|
825
868
|
return e[0] - t[0] || e[1] - t[1] || e[2] - t[2];
|
|
826
869
|
}
|
|
827
|
-
function
|
|
828
|
-
const t = [],
|
|
829
|
-
for (const
|
|
830
|
-
if (
|
|
831
|
-
const s =
|
|
832
|
-
token:
|
|
833
|
-
parent:
|
|
870
|
+
function Mt(e) {
|
|
871
|
+
const t = [], n = [];
|
|
872
|
+
for (const o of e)
|
|
873
|
+
if (o.type === "open") {
|
|
874
|
+
const s = R(o, "id"), i = R(o, "class"), r = {
|
|
875
|
+
token: o,
|
|
876
|
+
parent: n[n.length - 1] ?? null,
|
|
834
877
|
id: s ? s.trim() : null,
|
|
835
878
|
classes: i ? i.trim().split(/\s+/).filter(Boolean) : []
|
|
836
879
|
};
|
|
837
|
-
t.push(r), !
|
|
838
|
-
} else if (
|
|
839
|
-
for (let s =
|
|
840
|
-
if (
|
|
841
|
-
|
|
880
|
+
t.push(r), !o.selfClosing && !ne.has(o.name) && n.push(r);
|
|
881
|
+
} else if (o.type === "close") {
|
|
882
|
+
for (let s = n.length - 1; s >= 0; s--)
|
|
883
|
+
if (n[s]?.token.name === o.name) {
|
|
884
|
+
n.length = s;
|
|
842
885
|
break;
|
|
843
886
|
}
|
|
844
887
|
}
|
|
845
888
|
return t;
|
|
846
889
|
}
|
|
847
|
-
function
|
|
890
|
+
function zt(e) {
|
|
848
891
|
for (let t = e; t; t = t.parent)
|
|
849
892
|
if (t.token.name === "body") return !0;
|
|
850
893
|
return !1;
|
|
851
894
|
}
|
|
852
|
-
function
|
|
853
|
-
const
|
|
895
|
+
function Dt(e, t = {}) {
|
|
896
|
+
const n = t.removeInlinedRules !== !1, o = O(e), s = [];
|
|
854
897
|
let i = 0;
|
|
855
898
|
const r = /* @__PURE__ */ new Map();
|
|
856
|
-
for (
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
const h = n[c + 1];
|
|
899
|
+
for (const [u, a] of o.entries()) {
|
|
900
|
+
if (a.type !== "open" || a.name !== "style" || R(a, "media") !== void 0) continue;
|
|
901
|
+
const h = o[u + 1];
|
|
860
902
|
if (!h || h.type !== "rawtext") continue;
|
|
861
903
|
const m = [];
|
|
862
|
-
let
|
|
863
|
-
for (const
|
|
864
|
-
if (
|
|
865
|
-
m.push(
|
|
904
|
+
let y = !1;
|
|
905
|
+
for (const b of _t(h.raw)) {
|
|
906
|
+
if (b.type === "at-rule") {
|
|
907
|
+
m.push(b.raw);
|
|
866
908
|
continue;
|
|
867
909
|
}
|
|
868
|
-
const
|
|
869
|
-
for (const
|
|
870
|
-
const w =
|
|
910
|
+
const f = [], p = [];
|
|
911
|
+
for (const $ of b.selectors) {
|
|
912
|
+
const w = It($);
|
|
871
913
|
if (w) {
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
|
|
914
|
+
f.push($);
|
|
915
|
+
const v = b.declarations.filter((x) => !x.important);
|
|
916
|
+
v.length > 0 && s.push({ selector: w, declarations: v, order: i++ });
|
|
875
917
|
} else
|
|
876
|
-
|
|
918
|
+
p.push($);
|
|
877
919
|
}
|
|
878
|
-
if (
|
|
879
|
-
m.push(
|
|
920
|
+
if (f.length === 0 || !n) {
|
|
921
|
+
m.push(b.raw);
|
|
880
922
|
continue;
|
|
881
923
|
}
|
|
882
|
-
|
|
883
|
-
const
|
|
884
|
-
|
|
924
|
+
y = !0, p.length > 0 && m.push(`${p.join(", ")} { ${pe(b.declarations)} }`);
|
|
925
|
+
const g = b.declarations.filter(($) => $.important);
|
|
926
|
+
g.length > 0 && m.push(`${f.join(", ")} { ${pe(g)} }`);
|
|
885
927
|
}
|
|
886
|
-
|
|
928
|
+
y && r.set(u + 1, m.join(`
|
|
887
929
|
`));
|
|
888
930
|
}
|
|
889
931
|
if (s.length === 0) return e;
|
|
890
|
-
s.sort((
|
|
891
|
-
const
|
|
892
|
-
for (const
|
|
893
|
-
if (l && !
|
|
894
|
-
const
|
|
895
|
-
for (const
|
|
896
|
-
if (
|
|
897
|
-
for (const
|
|
898
|
-
|
|
899
|
-
if (
|
|
900
|
-
const h = (
|
|
901
|
-
for (const [
|
|
902
|
-
m.has(
|
|
903
|
-
if (
|
|
904
|
-
const
|
|
905
|
-
|
|
932
|
+
s.sort((u, a) => Ot(u.selector.specificity, a.selector.specificity) || u.order - a.order);
|
|
933
|
+
const c = Mt(o), l = c.some((u) => u.token.name === "body");
|
|
934
|
+
for (const u of c) {
|
|
935
|
+
if (l && !zt(u)) continue;
|
|
936
|
+
const a = /* @__PURE__ */ new Map();
|
|
937
|
+
for (const p of s)
|
|
938
|
+
if (jt(u, p.selector))
|
|
939
|
+
for (const g of p.declarations)
|
|
940
|
+
a.delete(g.property), a.set(g.property, g.value);
|
|
941
|
+
if (a.size === 0) continue;
|
|
942
|
+
const h = (R(u.token, "style") ?? "").trim(), m = new Set(Le(h).map((p) => p.property)), y = [];
|
|
943
|
+
for (const [p, g] of a)
|
|
944
|
+
m.has(p) || y.push(`${p}:${g}`);
|
|
945
|
+
if (y.length === 0) continue;
|
|
946
|
+
const b = h.replace(/^;+/, ""), f = b ? `${y.join(";")};${b}` : `${y.join(";")};`;
|
|
947
|
+
xt(u.token, "style", f);
|
|
906
948
|
}
|
|
907
|
-
const
|
|
908
|
-
for (const [
|
|
909
|
-
|
|
910
|
-
${
|
|
911
|
-
` } : (
|
|
912
|
-
return
|
|
913
|
-
}
|
|
914
|
-
const
|
|
949
|
+
const d = /* @__PURE__ */ new Set();
|
|
950
|
+
for (const [u, a] of r)
|
|
951
|
+
a.trim() ? o[u] = { type: "rawtext", parent: "style", raw: `
|
|
952
|
+
${a}
|
|
953
|
+
` } : (d.add(u - 1), d.add(u), o[u + 1]?.type === "close" && d.add(u + 1));
|
|
954
|
+
return P(o.filter((u, a) => !d.has(a)));
|
|
955
|
+
}
|
|
956
|
+
const Bt = /* @__PURE__ */ new Set(["class", "style", "id"]), Pt = /* @__PURE__ */ new Set([
|
|
915
957
|
"contenteditable",
|
|
916
958
|
"spellcheck",
|
|
917
959
|
"data-content-id",
|
|
918
960
|
"data-column-id",
|
|
919
961
|
"data-row-id"
|
|
920
962
|
]);
|
|
921
|
-
function
|
|
963
|
+
function Wt(e) {
|
|
922
964
|
const t = O(e);
|
|
923
|
-
for (const
|
|
924
|
-
if (
|
|
925
|
-
const
|
|
926
|
-
|
|
965
|
+
for (const n of t) {
|
|
966
|
+
if (n.type !== "open" || n.attrs.length === 0) continue;
|
|
967
|
+
const o = n.attrs.filter((s) => !(Pt.has(s.name) || Bt.has(s.name) && (s.value === null || !s.value.trim())));
|
|
968
|
+
o.length !== n.attrs.length && (n.attrs = o, n.dirty = !0);
|
|
927
969
|
}
|
|
928
|
-
return
|
|
970
|
+
return P(t);
|
|
929
971
|
}
|
|
930
|
-
const
|
|
972
|
+
const Lt = /* @__PURE__ */ new Set([
|
|
931
973
|
"html",
|
|
932
974
|
"head",
|
|
933
975
|
"body",
|
|
@@ -979,14 +1021,14 @@ const jt = /* @__PURE__ */ new Set([
|
|
|
979
1021
|
"noscript",
|
|
980
1022
|
"xml",
|
|
981
1023
|
"pre"
|
|
982
|
-
]),
|
|
983
|
-
function
|
|
984
|
-
return !e || e.type === "comment" || e.type === "doctype" ? !0 : e.type === "open" || e.type === "close" ?
|
|
1024
|
+
]), Nt = /[ \t\n\r\f]+/g, qt = /^[ \t\n\r\f]*$/;
|
|
1025
|
+
function me(e) {
|
|
1026
|
+
return !e || e.type === "comment" || e.type === "doctype" ? !0 : e.type === "open" || e.type === "close" ? Lt.has(e.name) || e.name.includes(":") : !1;
|
|
985
1027
|
}
|
|
986
|
-
function
|
|
1028
|
+
function Ft(e) {
|
|
987
1029
|
const t = [];
|
|
988
1030
|
for (const s of O(e)) {
|
|
989
|
-
if (s.type === "comment" && !
|
|
1031
|
+
if (s.type === "comment" && !Ct(s.raw)) continue;
|
|
990
1032
|
const i = t[t.length - 1];
|
|
991
1033
|
if (s.type === "text" && i?.type === "text") {
|
|
992
1034
|
t[t.length - 1] = { type: "text", raw: i.raw + s.raw };
|
|
@@ -994,30 +1036,29 @@ function Ot(e) {
|
|
|
994
1036
|
}
|
|
995
1037
|
t.push(s);
|
|
996
1038
|
}
|
|
997
|
-
const
|
|
998
|
-
let
|
|
999
|
-
for (
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
i.parent === "style" ? o.push({ ...i, raw: yt(i.raw) }) : o.push(i);
|
|
1039
|
+
const n = [];
|
|
1040
|
+
let o = 0;
|
|
1041
|
+
for (const [s, i] of t.entries()) {
|
|
1042
|
+
if (i.type === "open" && i.name === "pre" && !i.selfClosing && o++, i.type === "close" && i.name === "pre" && (o = Math.max(0, o - 1)), i.type === "rawtext") {
|
|
1043
|
+
i.parent === "style" ? n.push({ ...i, raw: At(i.raw) }) : n.push(i);
|
|
1003
1044
|
continue;
|
|
1004
1045
|
}
|
|
1005
|
-
if (i.type !== "text" ||
|
|
1006
|
-
|
|
1046
|
+
if (i.type !== "text" || o > 0) {
|
|
1047
|
+
n.push(i);
|
|
1007
1048
|
continue;
|
|
1008
1049
|
}
|
|
1009
|
-
const r =
|
|
1010
|
-
if (
|
|
1011
|
-
if (r ||
|
|
1012
|
-
|
|
1050
|
+
const r = me(t[s - 1]), c = me(t[s + 1]);
|
|
1051
|
+
if (qt.test(i.raw)) {
|
|
1052
|
+
if (r || c) continue;
|
|
1053
|
+
n.push({ type: "text", raw: " " });
|
|
1013
1054
|
continue;
|
|
1014
1055
|
}
|
|
1015
|
-
let l = i.raw.replace(
|
|
1016
|
-
r && (l = l.replace(/^ /, "")),
|
|
1056
|
+
let l = i.raw.replace(Nt, " ");
|
|
1057
|
+
r && (l = l.replace(/^ /, "")), c && (l = l.replace(/ $/, "")), n.push({ type: "text", raw: l });
|
|
1017
1058
|
}
|
|
1018
|
-
return
|
|
1059
|
+
return P(n).trim();
|
|
1019
1060
|
}
|
|
1020
|
-
const
|
|
1061
|
+
const Ht = /* @__PURE__ */ new Set([
|
|
1021
1062
|
"iframe",
|
|
1022
1063
|
"frame",
|
|
1023
1064
|
"frameset",
|
|
@@ -1033,7 +1074,7 @@ const zt = /* @__PURE__ */ new Set([
|
|
|
1033
1074
|
"discard",
|
|
1034
1075
|
"handler",
|
|
1035
1076
|
"listener"
|
|
1036
|
-
]),
|
|
1077
|
+
]), Ut = /* @__PURE__ */ new Set([
|
|
1037
1078
|
"href",
|
|
1038
1079
|
"src",
|
|
1039
1080
|
"action",
|
|
@@ -1049,56 +1090,56 @@ const zt = /* @__PURE__ */ new Set([
|
|
|
1049
1090
|
"ping",
|
|
1050
1091
|
"xlink:href",
|
|
1051
1092
|
"srcset"
|
|
1052
|
-
]),
|
|
1053
|
-
function
|
|
1054
|
-
return e.replace(/�*([0-9a-f]+);?/gi, (t,
|
|
1093
|
+
]), Gt = /^(?:javascript|vbscript|livescript):|^data:(?:text\/html|application\/(?:x?html|javascript))/i, Kt = /^data:image\/svg/i, Zt = /(?:javascript|vbscript|livescript):/i, Yt = /expression\s*\(|javascript:|vbscript:|-moz-binding|behavior\s*:/i, Xt = /<(?:script|i?frame|object|embed|applet|base|meta[^>]*refresh|animate|set|discard|handler|listener)\b|\son[a-z]+\s*=|srcdoc|formaction|script\s*:|data\s*:|expression|behavior|binding|&#|&colon|&tab|&newline/i;
|
|
1094
|
+
function Q(e) {
|
|
1095
|
+
return e.replace(/�*([0-9a-f]+);?/gi, (t, n) => String.fromCodePoint(parseInt(n, 16) % 1114112)).replace(/�*(\d+);?/g, (t, n) => String.fromCodePoint(Number(n) % 1114112)).replace(/:?/gi, ":").replace(/&tab;?/gi, "").replace(/&newline;?/gi, "").replace(/[\u0000- \u007f-\u009f]/g, "");
|
|
1055
1096
|
}
|
|
1056
|
-
function
|
|
1097
|
+
function Jt(e, t) {
|
|
1057
1098
|
if (e.startsWith("on") || e === "srcdoc" || e === "formaction") return !0;
|
|
1058
1099
|
if (t === null) return !1;
|
|
1059
|
-
if (e === "srcset") return
|
|
1060
|
-
if (
|
|
1061
|
-
const
|
|
1062
|
-
return
|
|
1100
|
+
if (e === "srcset") return Zt.test(Q(t));
|
|
1101
|
+
if (Ut.has(e) || e.endsWith(":href")) {
|
|
1102
|
+
const n = Q(t);
|
|
1103
|
+
return Gt.test(n) || (e === "href" || e.endsWith(":href")) && Kt.test(n);
|
|
1063
1104
|
}
|
|
1064
|
-
return e === "style" ?
|
|
1105
|
+
return e === "style" ? Yt.test(Q(t)) : !1;
|
|
1065
1106
|
}
|
|
1066
|
-
function
|
|
1067
|
-
if (!
|
|
1068
|
-
const t = O(e),
|
|
1069
|
-
let
|
|
1107
|
+
function Qt(e) {
|
|
1108
|
+
if (!Xt.test(e)) return e;
|
|
1109
|
+
const t = O(e), n = [];
|
|
1110
|
+
let o = !1, s = !1;
|
|
1070
1111
|
for (const i of t) {
|
|
1071
1112
|
if (s) {
|
|
1072
|
-
|
|
1113
|
+
o = !0, i.type === "close" && i.name === "script" && (s = !1);
|
|
1073
1114
|
continue;
|
|
1074
1115
|
}
|
|
1075
1116
|
if (i.type === "open" || i.type === "close") {
|
|
1076
1117
|
if (i.name === "script") {
|
|
1077
|
-
|
|
1118
|
+
o = !0, i.type === "open" && !i.selfClosing && (s = !0);
|
|
1078
1119
|
continue;
|
|
1079
1120
|
}
|
|
1080
|
-
if (
|
|
1081
|
-
|
|
1121
|
+
if (Ht.has(i.name)) {
|
|
1122
|
+
o = !0;
|
|
1082
1123
|
continue;
|
|
1083
1124
|
}
|
|
1084
1125
|
}
|
|
1085
1126
|
if (i.type === "rawtext" && i.parent === "script") {
|
|
1086
|
-
|
|
1127
|
+
o = !0;
|
|
1087
1128
|
continue;
|
|
1088
1129
|
}
|
|
1089
1130
|
if (i.type === "open") {
|
|
1090
|
-
if (i.name === "meta" && i.attrs.some((
|
|
1091
|
-
|
|
1131
|
+
if (i.name === "meta" && i.attrs.some((c) => c.name === "http-equiv" && /refresh/i.test(c.value ?? ""))) {
|
|
1132
|
+
o = !0;
|
|
1092
1133
|
continue;
|
|
1093
1134
|
}
|
|
1094
|
-
const r = i.attrs.filter((
|
|
1095
|
-
r.length !== i.attrs.length && (i.attrs = r, i.dirty = !0,
|
|
1135
|
+
const r = i.attrs.filter((c) => !Jt(c.name, c.value));
|
|
1136
|
+
r.length !== i.attrs.length && (i.attrs = r, i.dirty = !0, o = !0);
|
|
1096
1137
|
}
|
|
1097
|
-
|
|
1138
|
+
n.push(i);
|
|
1098
1139
|
}
|
|
1099
|
-
return
|
|
1140
|
+
return o ? P(n) : e;
|
|
1100
1141
|
}
|
|
1101
|
-
const
|
|
1142
|
+
const he = {
|
|
1102
1143
|
amp: "&",
|
|
1103
1144
|
lt: "<",
|
|
1104
1145
|
gt: ">",
|
|
@@ -1175,17 +1216,17 @@ const ce = {
|
|
|
1175
1216
|
hearts: "♥",
|
|
1176
1217
|
star: "☆",
|
|
1177
1218
|
check: "✓"
|
|
1178
|
-
}
|
|
1179
|
-
function
|
|
1180
|
-
return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]*);/gi, (t,
|
|
1181
|
-
if (
|
|
1182
|
-
const
|
|
1183
|
-
return !isFinite(
|
|
1219
|
+
};
|
|
1220
|
+
function V(e) {
|
|
1221
|
+
return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]*);/gi, (t, n) => {
|
|
1222
|
+
if (n[0] === "#") {
|
|
1223
|
+
const o = n[1] === "x" || n[1] === "X" ? parseInt(n.slice(2), 16) : parseInt(n.slice(1), 10);
|
|
1224
|
+
return !isFinite(o) || o <= 0 || o > 1114111 ? "" : o === 160 ? " " : String.fromCodePoint(o);
|
|
1184
1225
|
}
|
|
1185
|
-
return
|
|
1226
|
+
return (Object.hasOwn(he, n) ? he[n] : void 0) ?? t;
|
|
1186
1227
|
});
|
|
1187
1228
|
}
|
|
1188
|
-
const
|
|
1229
|
+
const ge = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]), ye = /* @__PURE__ */ new Set([
|
|
1189
1230
|
"div",
|
|
1190
1231
|
"table",
|
|
1191
1232
|
"tbody",
|
|
@@ -1210,119 +1251,119 @@ const de = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]), fe = /
|
|
|
1210
1251
|
"figcaption",
|
|
1211
1252
|
"pre",
|
|
1212
1253
|
"address"
|
|
1213
|
-
]),
|
|
1214
|
-
function
|
|
1215
|
-
if (
|
|
1216
|
-
const t = (
|
|
1254
|
+
]), be = /* @__PURE__ */ new Set(["p", "blockquote"]), Vt = /* @__PURE__ */ new Set(["head", "style", "script", "title", "noscript", "template", "svg", "select", "textarea", "object", "video", "audio", "map"]);
|
|
1255
|
+
function en(e) {
|
|
1256
|
+
if (R(e, "hidden") !== void 0 || R(e, "aria-hidden") === "true" && e.name !== "img") return !0;
|
|
1257
|
+
const t = (R(e, "style") ?? "").toLowerCase().replace(/\s+/g, "");
|
|
1217
1258
|
return /(^|;)display:none/.test(t) || /mso-hide:all/.test(t) || /(^|;)max-height:0(px|em|%)?(;|$|!)/.test(t);
|
|
1218
1259
|
}
|
|
1219
|
-
function
|
|
1220
|
-
const
|
|
1221
|
-
return
|
|
1222
|
-
}
|
|
1223
|
-
function
|
|
1224
|
-
const
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
},
|
|
1228
|
-
let
|
|
1229
|
-
if (!
|
|
1230
|
-
const g =
|
|
1231
|
-
(!g.buf || /[\s]$/.test(g.buf)) && (
|
|
1232
|
-
},
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1235
|
-
if (!
|
|
1236
|
-
const g = /\n
|
|
1237
|
-
g <
|
|
1238
|
-
`.repeat(
|
|
1239
|
-
},
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1260
|
+
function tn(e, t) {
|
|
1261
|
+
const n = (o) => o.trim().toLowerCase().replace(/^(mailto:|tel:|sms:)/, "").replace(/^https?:\/\//, "").replace(/^www\./, "").replace(/\/+$/, "");
|
|
1262
|
+
return n(e) === n(t);
|
|
1263
|
+
}
|
|
1264
|
+
function nn(e, t = {}) {
|
|
1265
|
+
const n = t.linkStyle ?? "inline", o = [], s = { kind: "root", buf: "" }, i = [s], r = [], c = () => i.at(-1) ?? s, l = () => (i.length > 1 ? i.pop() : void 0) ?? s, d = () => {
|
|
1266
|
+
const f = c();
|
|
1267
|
+
f.buf = f.buf.replace(/[ \t]+$/, "");
|
|
1268
|
+
}, u = (f) => {
|
|
1269
|
+
let p = de(V(f.replace(/\s+/g, " "))).replace(/[ \t\u00A0]+/g, " ");
|
|
1270
|
+
if (!p) return;
|
|
1271
|
+
const g = c();
|
|
1272
|
+
(!g.buf || /[\s]$/.test(g.buf)) && (p = p.replace(/^ /, "")), g.buf += p;
|
|
1273
|
+
}, a = (f) => {
|
|
1274
|
+
d();
|
|
1275
|
+
const p = c();
|
|
1276
|
+
if (!p.buf) return;
|
|
1277
|
+
const g = p.buf.length - p.buf.replace(/\n+$/, "").length;
|
|
1278
|
+
g < f && (p.buf += `
|
|
1279
|
+
`.repeat(f - g));
|
|
1280
|
+
}, h = () => {
|
|
1281
|
+
const f = c();
|
|
1282
|
+
f.buf && !/\s$/.test(f.buf) && (f.buf += " ");
|
|
1242
1283
|
};
|
|
1243
|
-
let
|
|
1244
|
-
for (const
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1284
|
+
let m = "", y = 0;
|
|
1285
|
+
for (const f of O(e)) {
|
|
1286
|
+
if (y) {
|
|
1287
|
+
f.type === "open" && f.name === m && !f.selfClosing && !ne.has(f.name) ? y++ : f.type === "close" && f.name === m && y--;
|
|
1247
1288
|
continue;
|
|
1248
1289
|
}
|
|
1249
|
-
if (
|
|
1250
|
-
|
|
1290
|
+
if (f.type === "text") {
|
|
1291
|
+
u(f.raw);
|
|
1251
1292
|
continue;
|
|
1252
1293
|
}
|
|
1253
|
-
if (
|
|
1254
|
-
const
|
|
1255
|
-
if (
|
|
1256
|
-
const g =
|
|
1257
|
-
if (
|
|
1258
|
-
g || (
|
|
1294
|
+
if (f.type !== "open" && f.type !== "close") continue;
|
|
1295
|
+
const p = f.name;
|
|
1296
|
+
if (f.type === "open") {
|
|
1297
|
+
const g = ne.has(p) || f.selfClosing;
|
|
1298
|
+
if (Vt.has(p) || en(f) && p !== "br") {
|
|
1299
|
+
g || (m = p, y = 1);
|
|
1259
1300
|
continue;
|
|
1260
1301
|
}
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1302
|
+
if (p === "br")
|
|
1303
|
+
d(), c().buf += `
|
|
1263
1304
|
`;
|
|
1264
|
-
else if (
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
} else if (
|
|
1268
|
-
|
|
1269
|
-
else if (
|
|
1270
|
-
|
|
1271
|
-
else if (
|
|
1272
|
-
|
|
1273
|
-
else if (
|
|
1274
|
-
|
|
1275
|
-
else if (
|
|
1276
|
-
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1279
|
-
} else
|
|
1305
|
+
else if (p === "img") {
|
|
1306
|
+
const $ = de(V(R(f, "alt") ?? "")).trim();
|
|
1307
|
+
$ && (h(), c().buf += `[${$}]`);
|
|
1308
|
+
} else if (p === "hr")
|
|
1309
|
+
a(1), c().buf += "---", a(1);
|
|
1310
|
+
else if (ge.has(p))
|
|
1311
|
+
a(2), i.push({ kind: "heading", buf: "" });
|
|
1312
|
+
else if (p === "a")
|
|
1313
|
+
i.push({ kind: "link", buf: "", href: V(R(f, "href") ?? "").trim() });
|
|
1314
|
+
else if (p === "ul" || p === "ol")
|
|
1315
|
+
a(1), r.push({ ordered: p === "ol", n: 0 });
|
|
1316
|
+
else if (p === "li") {
|
|
1317
|
+
a(1);
|
|
1318
|
+
const $ = r[r.length - 1], w = " ".repeat(Math.max(0, r.length - 1));
|
|
1319
|
+
c().buf += $?.ordered ? `${w}${++$.n}. ` : `${w}- `;
|
|
1320
|
+
} else be.has(p) ? a(2) : ye.has(p) ? a(1) : (p === "td" || p === "th") && h();
|
|
1280
1321
|
continue;
|
|
1281
1322
|
}
|
|
1282
|
-
if (
|
|
1283
|
-
const g =
|
|
1284
|
-
|
|
1285
|
-
} else if (
|
|
1286
|
-
const g =
|
|
1287
|
-
let
|
|
1288
|
-
if (v && !
|
|
1289
|
-
if (
|
|
1290
|
-
else if (
|
|
1291
|
-
let
|
|
1292
|
-
|
|
1293
|
-
} else
|
|
1294
|
-
|
|
1295
|
-
} else
|
|
1323
|
+
if (ge.has(p) && c().kind === "heading") {
|
|
1324
|
+
const g = l().buf.trim().toUpperCase();
|
|
1325
|
+
a(2), g && (c().buf += g), a(2);
|
|
1326
|
+
} else if (p === "a" && c().kind === "link") {
|
|
1327
|
+
const g = l(), $ = g.buf.replace(/\s+/g, " ").trim(), w = g.href ?? "", v = w && !w.startsWith("#") && !/^javascript:/i.test(w);
|
|
1328
|
+
let x = $;
|
|
1329
|
+
if (v && !tn(w, $))
|
|
1330
|
+
if (!$) x = w;
|
|
1331
|
+
else if (n === "footnote") {
|
|
1332
|
+
let E = o.indexOf(w);
|
|
1333
|
+
E === -1 && (E = o.push(w) - 1), x = `${$} [${E + 1}]`;
|
|
1334
|
+
} else x = `${$} (${w})`;
|
|
1335
|
+
x && (h(), c().buf += x);
|
|
1336
|
+
} else p === "ul" || p === "ol" ? (r.pop(), a(1)) : p === "table" ? a(2) : p === "li" || ye.has(p) ? a(1) : be.has(p) ? a(2) : (p === "td" || p === "th") && h();
|
|
1296
1337
|
}
|
|
1297
|
-
for (;
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1338
|
+
for (; i.length > 1; ) {
|
|
1339
|
+
const f = l();
|
|
1340
|
+
c().buf += f.kind === "heading" ? f.buf.toUpperCase() : f.buf;
|
|
1300
1341
|
}
|
|
1301
|
-
let
|
|
1302
|
-
`).map((
|
|
1342
|
+
let b = c().buf.split(`
|
|
1343
|
+
`).map((f) => f.replace(/[ \t]+/g, " ").trim()).join(`
|
|
1303
1344
|
`).replace(/\n{4,}/g, `
|
|
1304
1345
|
|
|
1305
1346
|
|
|
1306
1347
|
`).trim();
|
|
1307
|
-
return t.wordwrap && (
|
|
1348
|
+
return t.wordwrap && (b = on(b, t.wordwrap)), o.length && (b += `
|
|
1308
1349
|
|
|
1309
|
-
${
|
|
1310
|
-
`)}`),
|
|
1350
|
+
${o.map((f, p) => `[${p + 1}] ${f}`).join(`
|
|
1351
|
+
`)}`), b;
|
|
1311
1352
|
}
|
|
1312
|
-
function
|
|
1353
|
+
function on(e, t) {
|
|
1313
1354
|
return t > 0 ? e.split(`
|
|
1314
|
-
`).map((
|
|
1315
|
-
if (
|
|
1316
|
-
const
|
|
1355
|
+
`).map((n) => {
|
|
1356
|
+
if (n.length <= t) return n;
|
|
1357
|
+
const o = /^(\s*(?:- |\d+\. ))?/.exec(n)[0].replace(/./g, " "), s = [];
|
|
1317
1358
|
let i = "";
|
|
1318
|
-
for (const r of
|
|
1319
|
-
i ? i.length + 1 + r.length <= t ? i += ` ${r}` : (s.push(i), i =
|
|
1359
|
+
for (const r of n.split(" "))
|
|
1360
|
+
i ? i.length + 1 + r.length <= t ? i += ` ${r}` : (s.push(i), i = o + r) : i = r;
|
|
1320
1361
|
return i && s.push(i), s.join(`
|
|
1321
1362
|
`);
|
|
1322
1363
|
}).join(`
|
|
1323
1364
|
`) : e;
|
|
1324
1365
|
}
|
|
1325
|
-
class
|
|
1366
|
+
class Ne {
|
|
1326
1367
|
constructor() {
|
|
1327
1368
|
this.rows = /* @__PURE__ */ new WeakMap(), this.stats = { hits: 0, misses: 0 };
|
|
1328
1369
|
}
|
|
@@ -1330,231 +1371,231 @@ class Oe {
|
|
|
1330
1371
|
this.rows = /* @__PURE__ */ new WeakMap(), this.stats = { hits: 0, misses: 0 };
|
|
1331
1372
|
}
|
|
1332
1373
|
}
|
|
1333
|
-
function
|
|
1334
|
-
return new
|
|
1374
|
+
function bn() {
|
|
1375
|
+
return new Ne();
|
|
1335
1376
|
}
|
|
1336
|
-
const
|
|
1337
|
-
let
|
|
1338
|
-
function
|
|
1339
|
-
let t =
|
|
1340
|
-
return t === void 0 && (t =
|
|
1341
|
-
}
|
|
1342
|
-
const
|
|
1343
|
-
function
|
|
1344
|
-
const
|
|
1345
|
-
for (const s of Object.keys(e ?? {}))
|
|
1346
|
-
return `${t}|${
|
|
1347
|
-
}
|
|
1348
|
-
function
|
|
1349
|
-
const s =
|
|
1350
|
-
for (const
|
|
1377
|
+
const $e = /* @__PURE__ */ new WeakMap();
|
|
1378
|
+
let sn = 1;
|
|
1379
|
+
function rn(e) {
|
|
1380
|
+
let t = $e.get(e);
|
|
1381
|
+
return t === void 0 && (t = sn++, $e.set(e, t)), t;
|
|
1382
|
+
}
|
|
1383
|
+
const ln = /* @__PURE__ */ new Set(["preheaderText"]);
|
|
1384
|
+
function cn(e, t, n) {
|
|
1385
|
+
const o = {};
|
|
1386
|
+
for (const s of Object.keys(e ?? {})) ln.has(s) || (o[s] = e[s]);
|
|
1387
|
+
return `${t}|${rn(n)}|${JSON.stringify(o)}`;
|
|
1388
|
+
}
|
|
1389
|
+
function ve(e, t, n, o) {
|
|
1390
|
+
const s = o ? rt(e, t, n) : st(e, t, n, "email"), i = fn(s), r = /* @__PURE__ */ new Set();
|
|
1391
|
+
for (const c of e.columns ?? []) for (const l of c.contents ?? []) D(l.values, r);
|
|
1351
1392
|
return {
|
|
1352
1393
|
// Web pages keep modern CSS (flex, grid, …); email strips what clients don't support
|
|
1353
|
-
html:
|
|
1394
|
+
html: o ? i.html : $t(i.html),
|
|
1354
1395
|
styles: i.styles,
|
|
1355
1396
|
fonts: [...r],
|
|
1356
|
-
overrides:
|
|
1397
|
+
overrides: Te(e)
|
|
1357
1398
|
};
|
|
1358
1399
|
}
|
|
1359
|
-
function
|
|
1360
|
-
const s = e.body.values, i = parseInt(s.contentWidth || "600") || 600, r =
|
|
1400
|
+
function an(e, t, n, o) {
|
|
1401
|
+
const s = e.body.values, i = parseInt(s.contentWidth || "600") || 600, r = n?.displayMode === "web", c = o?.cache ?? n?.cache, l = c instanceof Ne, d = l ? cn(s, r ? "web" : "email", t) : "", u = [
|
|
1361
1402
|
...e.body.headers ?? [],
|
|
1362
1403
|
...e.body.rows ?? [],
|
|
1363
1404
|
...e.body.footers ?? []
|
|
1364
|
-
],
|
|
1365
|
-
D({ fontFamily: s?.fontFamily },
|
|
1366
|
-
const
|
|
1367
|
-
for (const
|
|
1368
|
-
let
|
|
1405
|
+
], a = [], h = [], m = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
|
|
1406
|
+
D({ fontFamily: s?.fontFamily }, y);
|
|
1407
|
+
const b = [];
|
|
1408
|
+
for (const A of u) {
|
|
1409
|
+
let C;
|
|
1369
1410
|
if (l) {
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1411
|
+
const k = c.rows.get(A);
|
|
1412
|
+
k && k.key === d ? (C = k.parts, c.stats.hits++) : (C = ve(A, s, t, r), c.rows.set(A, { key: d, parts: C }), c.stats.misses++);
|
|
1372
1413
|
} else
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
for (const
|
|
1376
|
-
m.has(
|
|
1377
|
-
for (const
|
|
1378
|
-
for (const
|
|
1414
|
+
C = ve(A, s, t, r);
|
|
1415
|
+
a.push(C.html);
|
|
1416
|
+
for (const k of C.styles)
|
|
1417
|
+
m.has(k) || (m.add(k), h.push(k));
|
|
1418
|
+
for (const k of C.fonts) y.add(k);
|
|
1419
|
+
for (const k of C.overrides) b.push(k);
|
|
1379
1420
|
}
|
|
1380
|
-
const
|
|
1381
|
-
`),
|
|
1382
|
-
let
|
|
1383
|
-
fontUrls:
|
|
1421
|
+
const f = a.join(`
|
|
1422
|
+
`), p = [...y], g = Ee(b, i), $ = Be(e), w = [...h, ...g ? [g] : [], ...$ ? [$] : []];
|
|
1423
|
+
let v = r ? dt(f, s, { fontUrls: p, styles: w, title: n?.title }) : Ze(f, Ye(i), s, {
|
|
1424
|
+
fontUrls: p,
|
|
1384
1425
|
styles: w,
|
|
1385
|
-
title:
|
|
1386
|
-
darkMode:
|
|
1426
|
+
title: n?.title,
|
|
1427
|
+
darkMode: !!$
|
|
1387
1428
|
});
|
|
1388
|
-
if (
|
|
1389
|
-
for (const [
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
const
|
|
1393
|
-
html:
|
|
1429
|
+
if (n?.mergeTags)
|
|
1430
|
+
for (const [A, C] of Object.entries(n.mergeTags))
|
|
1431
|
+
v = v.replaceAll(`{{${A}}}`, C);
|
|
1432
|
+
n?.designTags && (v = un(v, n.designTags, n.designTagsDelimiter)), !r && n?.displayMode !== "popup" && (v = Qt(v)), n?.inlineStyles && (v = Dt(v)), n?.cleanup && (v = Wt(v)), (n?.minify ?? !r) && (v = Ft(v));
|
|
1433
|
+
const x = pn(v), E = {
|
|
1434
|
+
html: v,
|
|
1394
1435
|
chunks: {
|
|
1395
|
-
body:
|
|
1396
|
-
css:
|
|
1397
|
-
fonts:
|
|
1436
|
+
body: x.body,
|
|
1437
|
+
css: x.css,
|
|
1438
|
+
fonts: p,
|
|
1398
1439
|
js: ""
|
|
1399
1440
|
}
|
|
1400
1441
|
};
|
|
1401
|
-
if (l) {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
z.design = structuredClone(e);
|
|
1413
|
-
return z;
|
|
1442
|
+
if (!l) return { ...E, design: structuredClone(e) };
|
|
1443
|
+
let W;
|
|
1444
|
+
return {
|
|
1445
|
+
...E,
|
|
1446
|
+
get design() {
|
|
1447
|
+
return W ??= structuredClone(e);
|
|
1448
|
+
},
|
|
1449
|
+
set design(A) {
|
|
1450
|
+
W = A;
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1414
1453
|
}
|
|
1415
|
-
function
|
|
1416
|
-
const { html: s } =
|
|
1454
|
+
function $n(e, t, n, o) {
|
|
1455
|
+
const { html: s } = an(
|
|
1417
1456
|
e,
|
|
1418
1457
|
t,
|
|
1419
|
-
{ ...
|
|
1420
|
-
|
|
1458
|
+
{ ...n, inlineStyles: !1, minify: !1, cleanup: !1 },
|
|
1459
|
+
o
|
|
1421
1460
|
);
|
|
1422
|
-
return
|
|
1461
|
+
return nn(s, { wordwrap: n?.wordwrap, linkStyle: n?.linkStyle });
|
|
1423
1462
|
}
|
|
1424
|
-
function
|
|
1425
|
-
const [
|
|
1463
|
+
function un(e, t, n = ["{{", "}}"]) {
|
|
1464
|
+
const [o, s] = n;
|
|
1426
1465
|
let i = e;
|
|
1427
|
-
for (const [r,
|
|
1428
|
-
i = i.replaceAll(`${
|
|
1466
|
+
for (const [r, c] of Object.entries(t))
|
|
1467
|
+
i = i.replaceAll(`${o}${r}${s}`, String(c));
|
|
1429
1468
|
return i;
|
|
1430
1469
|
}
|
|
1431
|
-
function
|
|
1470
|
+
function dn(e) {
|
|
1432
1471
|
return e === "fontFamily" || e.endsWith("FontFamily");
|
|
1433
1472
|
}
|
|
1434
|
-
function D(e, t,
|
|
1435
|
-
if (!(!e ||
|
|
1436
|
-
for (const [
|
|
1473
|
+
function D(e, t, n = 0) {
|
|
1474
|
+
if (!(!T(e) || n > 4)) {
|
|
1475
|
+
for (const [o, s] of Object.entries(e))
|
|
1437
1476
|
if (!(!s || typeof s != "object"))
|
|
1438
|
-
if (
|
|
1439
|
-
const i = s.url;
|
|
1477
|
+
if (dn(o)) {
|
|
1478
|
+
const i = T(s) ? s.url : void 0;
|
|
1440
1479
|
typeof i == "string" && i.trim() && t.add(i.trim());
|
|
1441
1480
|
} else
|
|
1442
|
-
D(s, t,
|
|
1481
|
+
D(s, t, n + 1);
|
|
1443
1482
|
}
|
|
1444
1483
|
}
|
|
1445
|
-
function
|
|
1484
|
+
function vn(e) {
|
|
1446
1485
|
const t = /* @__PURE__ */ new Set();
|
|
1447
1486
|
D({ fontFamily: e.body.values?.fontFamily }, t);
|
|
1448
|
-
const
|
|
1449
|
-
for (const
|
|
1450
|
-
for (const s of
|
|
1487
|
+
const n = se(e);
|
|
1488
|
+
for (const o of n)
|
|
1489
|
+
for (const s of o.columns ?? [])
|
|
1451
1490
|
for (const i of s.contents ?? [])
|
|
1452
1491
|
D(i.values, t);
|
|
1453
1492
|
return [...t];
|
|
1454
1493
|
}
|
|
1455
|
-
function
|
|
1456
|
-
const t = O(e),
|
|
1494
|
+
function fn(e) {
|
|
1495
|
+
const t = O(e), n = [], o = /* @__PURE__ */ new Set(), s = [];
|
|
1457
1496
|
for (let i = 0; i < t.length; i++) {
|
|
1458
1497
|
const r = t[i];
|
|
1459
1498
|
if (r.type === "open" && r.name === "style" && !r.selfClosing) {
|
|
1460
|
-
let
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1499
|
+
let c = i + 1, l = "";
|
|
1500
|
+
const d = t[c];
|
|
1501
|
+
d?.type === "rawtext" && (l = d.raw.trim(), c++);
|
|
1502
|
+
const u = r.attrs.find((h) => h.name === "media")?.value?.trim();
|
|
1503
|
+
l && u && u !== "all" && (l = `@media ${u} {
|
|
1464
1504
|
${l}
|
|
1465
|
-
}`)
|
|
1466
|
-
|
|
1505
|
+
}`);
|
|
1506
|
+
const a = t[c];
|
|
1507
|
+
if (a?.type === "close" && a.name === "style") {
|
|
1508
|
+
l && !o.has(l) && (o.add(l), n.push(l)), i = c;
|
|
1467
1509
|
continue;
|
|
1468
1510
|
}
|
|
1469
1511
|
}
|
|
1470
1512
|
s.push(r);
|
|
1471
1513
|
}
|
|
1472
|
-
return { html:
|
|
1514
|
+
return { html: n.length || s.length !== t.length ? P(s) : e, styles: n };
|
|
1473
1515
|
}
|
|
1474
|
-
function
|
|
1475
|
-
const t = e.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
|
1516
|
+
function pn(e) {
|
|
1476
1517
|
return {
|
|
1477
|
-
body:
|
|
1478
|
-
css:
|
|
1518
|
+
body: e.match(/<body[^>]*>([\s\S]*)<\/body>/i)?.[1]?.trim() ?? e,
|
|
1519
|
+
css: mn(e)
|
|
1479
1520
|
};
|
|
1480
1521
|
}
|
|
1481
|
-
function
|
|
1482
|
-
const t = /<!--[\s\S]*?-->|<(script|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi,
|
|
1483
|
-
let
|
|
1484
|
-
for (;
|
|
1485
|
-
if (
|
|
1486
|
-
const s =
|
|
1487
|
-
s &&
|
|
1522
|
+
function mn(e) {
|
|
1523
|
+
const t = /<!--[\s\S]*?-->|<(script|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi, n = [];
|
|
1524
|
+
let o;
|
|
1525
|
+
for (; o = t.exec(e); ) {
|
|
1526
|
+
if (o[2] === void 0) continue;
|
|
1527
|
+
const s = o[2].trim();
|
|
1528
|
+
s && n.push(s);
|
|
1488
1529
|
}
|
|
1489
|
-
return
|
|
1530
|
+
return n.join(`
|
|
1490
1531
|
`);
|
|
1491
1532
|
}
|
|
1492
|
-
function
|
|
1493
|
-
const t = [],
|
|
1494
|
-
e.includes("<!DOCTYPE") || t.push({ rule: "doctype", message: "Missing <!DOCTYPE> declaration. Required for consistent rendering.", severity: "error" }), (!e.includes("<meta") || !e.includes("charset")) && t.push({ rule: "charset", message: 'Missing charset meta tag. Add <meta charset="UTF-8">.', severity: "error" }), e.includes("viewport") ||
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1533
|
+
function wn(e) {
|
|
1534
|
+
const t = [], n = [];
|
|
1535
|
+
e.includes("<!DOCTYPE") || t.push({ rule: "doctype", message: "Missing <!DOCTYPE> declaration. Required for consistent rendering.", severity: "error" }), (!e.includes("<meta") || !e.includes("charset")) && t.push({ rule: "charset", message: 'Missing charset meta tag. Add <meta charset="UTF-8">.', severity: "error" }), e.includes("viewport") || n.push({ rule: "viewport", message: "Missing viewport meta tag. Needed for responsive rendering on mobile.", severity: "warning" });
|
|
1536
|
+
const o = (e.match(/<table/gi) || []).length, s = (e.match(/role="presentation"/gi) || []).length;
|
|
1537
|
+
o > 0 && s < o * 0.5 && n.push({ rule: "table-role", message: `Only ${s}/${o} tables have role="presentation". Screen readers may interpret layout tables as data tables.`, severity: "warning" });
|
|
1497
1538
|
const i = e.match(/<img[^>]*>/gi) || [];
|
|
1498
|
-
for (const
|
|
1499
|
-
|
|
1500
|
-
const r = e.match(/<style[^>]*>[\s\S]*?<\/style>/gi) || [],
|
|
1501
|
-
r.length > 0 && !e.includes("@media") &&
|
|
1539
|
+
for (const f of i)
|
|
1540
|
+
f.includes("alt=") || t.push({ rule: "img-alt", message: "Image missing alt attribute. Required for accessibility and when images are blocked.", severity: "error" }), (!f.includes("style=") || !f.includes("display")) && n.push({ rule: "img-display", message: "Image without display:block may have a bottom gap in some email clients.", severity: "warning" }), (f.includes('width="100%"') || !f.includes("width=") && !f.includes("width:")) && n.push({ rule: "img-width", message: "Image without explicit pixel width. Some email clients ignore percentage widths.", severity: "warning" });
|
|
1541
|
+
const r = e.match(/<style[^>]*>[\s\S]*?<\/style>/gi) || [], c = e.includes('style="');
|
|
1542
|
+
r.length > 0 && !e.includes("@media") && n.push({ rule: "no-media-queries", message: "Style block found but no @media queries. Consider adding responsive breakpoints.", severity: "warning" }), !c && o > 0 && t.push({ rule: "inline-styles", message: "No inline styles detected. Gmail and many clients strip <style> tags — inline styles are essential.", severity: "error" });
|
|
1502
1543
|
const l = ["position:fixed", "position:absolute", "display:flex", "display:grid", "gap:", "transform:", "animation:"];
|
|
1503
|
-
for (const
|
|
1504
|
-
e.includes('style="') && e.match(new RegExp(`style="[^"]*${
|
|
1505
|
-
e.includes("<!--[if") ||
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
const h = 100, m = t.length * 15,
|
|
1544
|
+
for (const f of l)
|
|
1545
|
+
e.includes('style="') && e.match(new RegExp(`style="[^"]*${f.replace(":", ":\\s*")}`, "i")) && n.push({ rule: "unsupported-css", message: `CSS property "${f.replace(":", "")}" not supported in most email clients.`, severity: "warning" });
|
|
1546
|
+
e.includes("<!--[if") || n.push({ rule: "mso-conditionals", message: "No MSO conditional comments found. Outlook may not render multi-column layouts correctly.", severity: "warning" }), !e.includes("xmlns:v") && !e.includes("xmlns:o") && n.push({ rule: "mso-namespace", message: "Missing Microsoft Office XML namespaces. May affect Outlook rendering.", severity: "warning" });
|
|
1547
|
+
const u = (e.match(/<a[^>]*>/gi) || []).filter((f) => !f.includes("style="));
|
|
1548
|
+
u.length > 0 && n.push({ rule: "link-color", message: `${u.length} link(s) without inline styles. Email clients override unstyled link colors.`, severity: "warning" }), !e.includes("color-scheme") && !e.includes("prefers-color-scheme") && n.push({ rule: "dark-mode", message: "No dark mode support detected. Consider adding color-scheme meta and prefers-color-scheme media query.", severity: "warning" });
|
|
1549
|
+
const a = Math.round(e.length / 1024);
|
|
1550
|
+
a > 102 ? t.push({ rule: "size-limit", message: `Email HTML is ${a}KB. Gmail clips emails larger than 102KB.`, severity: "error" }) : a > 80 && n.push({ rule: "size-warning", message: `Email HTML is ${a}KB. Getting close to Gmail's 102KB clip limit.`, severity: "warning" }), !e.includes("display:none") && !e.includes("max-height:0") && n.push({ rule: "preheader", message: "No preheader text detected. Preheader text improves open rates in inbox previews.", severity: "warning" });
|
|
1551
|
+
const h = 100, m = t.length * 15, y = n.length * 5, b = Math.max(0, h - m - y);
|
|
1511
1552
|
return {
|
|
1512
1553
|
valid: t.length === 0,
|
|
1513
1554
|
errors: t,
|
|
1514
|
-
warnings:
|
|
1515
|
-
score:
|
|
1555
|
+
warnings: n,
|
|
1556
|
+
score: b
|
|
1516
1557
|
};
|
|
1517
1558
|
}
|
|
1518
1559
|
export {
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1560
|
+
se as allRows,
|
|
1561
|
+
xe as bodyFontWeight,
|
|
1562
|
+
Be as buildDarkModeCss,
|
|
1563
|
+
gn as buildResponsiveOverridesCss,
|
|
1564
|
+
j as cleanCssValue,
|
|
1565
|
+
Wt as cleanupHtml,
|
|
1566
|
+
vn as collectFontUrls,
|
|
1567
|
+
le as contentElementId,
|
|
1568
|
+
bn as createRenderCache,
|
|
1569
|
+
V as decodeEntities,
|
|
1570
|
+
ke as documentLanguage,
|
|
1571
|
+
we as documentTitle,
|
|
1572
|
+
ze as getDarkOverrides,
|
|
1532
1573
|
B as getMobileOverrides,
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1574
|
+
Ye as getResponsiveCss,
|
|
1575
|
+
at as getWebCss,
|
|
1576
|
+
yn as hasDarkMode,
|
|
1577
|
+
Dt as inlineCss,
|
|
1578
|
+
Fe as isLanguageCode,
|
|
1579
|
+
Z as isSafeCssValue,
|
|
1539
1580
|
L as kebabKey,
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1581
|
+
At as minifyCss,
|
|
1582
|
+
Ft as minifyHtml,
|
|
1583
|
+
N as mobileMediaQuery,
|
|
1584
|
+
Xe as overrideClass,
|
|
1585
|
+
U as overrideDeclarations,
|
|
1586
|
+
an as renderDesignToHtml,
|
|
1587
|
+
$n as renderDesignToPlainText,
|
|
1588
|
+
nn as renderPlainText,
|
|
1589
|
+
st as renderRow,
|
|
1590
|
+
rt as renderWebRow,
|
|
1591
|
+
un as replaceDesignTags,
|
|
1551
1592
|
H as rowElementId,
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1593
|
+
Qt as stripActiveContent,
|
|
1594
|
+
ct as stripMsoConditionals,
|
|
1595
|
+
wn as validateEmailHtml,
|
|
1596
|
+
Ze as wrapInDocumentShell,
|
|
1597
|
+
dt as wrapInWebShell,
|
|
1598
|
+
on as wrapText,
|
|
1599
|
+
re as wrapWithDisplayCondition
|
|
1559
1600
|
};
|
|
1560
1601
|
//# sourceMappingURL=index.js.map
|