@journeeze/sdk 0.0.0-stage → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +67 -0
- package/CHANGELOG.md +30 -0
- package/LICENSE.md +27 -0
- package/README.md +164 -2
- package/dist/THIRD_PARTY_LICENSES.txt +246 -0
- package/dist/consent-CoKD33Rm.js +170 -0
- package/dist/context-UnG6_X61.js +17 -0
- package/dist/contract.js +10 -0
- package/dist/feedback-C4CYtS2A.js +196 -0
- package/dist/help-C1x-y2f9.js +878 -0
- package/dist/hook-BdG4UL4k.js +91 -0
- package/dist/index-B_nob8S0.js +2091 -0
- package/dist/index-CfCbJJXa.js +20 -0
- package/dist/index.js +10 -0
- package/dist/loader-Ba4X-WNl.js +95 -0
- package/dist/react.js +70 -0
- package/dist/resolve-BfWByuTp.js +97 -0
- package/dist/script.js +13 -0
- package/dist/signals-E3VEdmWH.js +477 -0
- package/dist/telemetry-Cik-cYzw.js +140 -0
- package/dist/transport-B5YJFQEF.js +60 -0
- package/dist/types/config.d.ts +17 -0
- package/dist/types/context.d.ts +6 -0
- package/dist/types/contract.d.ts +13 -0
- package/dist/types/help/core/client.d.ts +26 -0
- package/dist/types/help/core/controller.d.ts +175 -0
- package/dist/types/help/core/events.d.ts +8 -0
- package/dist/types/help/core/help.d.ts +24 -0
- package/dist/types/help/core/highlight.d.ts +38 -0
- package/dist/types/help/core/panel.d.ts +11 -0
- package/dist/types/help/core/search.d.ts +7 -0
- package/dist/types/help/ui/callout.d.ts +2 -0
- package/dist/types/help/ui/panel.d.ts +3 -0
- package/dist/types/help/ui/request.d.ts +2 -0
- package/dist/types/help/ui/styles.d.ts +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/invite.d.ts +4 -0
- package/dist/types/loader.d.ts +57 -0
- package/dist/types/mask.d.ts +10 -0
- package/dist/types/react.d.ts +9 -0
- package/dist/types/resolve/resolve.d.ts +12 -0
- package/dist/types/script.d.ts +6 -0
- package/dist/types/signals/cel.d.ts +8 -0
- package/dist/types/signals/hook.d.ts +10 -0
- package/dist/types/signals/signals.conformance.d.ts +2 -0
- package/dist/types/signals/signals.d.ts +145 -0
- package/dist/types/telemetry/telemetry.d.ts +63 -0
- package/dist/types/transport.d.ts +30 -0
- package/dist/types/types.d.ts +391 -0
- package/dist/types/widget/anchor.d.ts +11 -0
- package/dist/types/widget/capture.d.ts +28 -0
- package/dist/types/widget/consent.d.ts +25 -0
- package/dist/types/widget/feedback.d.ts +36 -0
- package/dist/types/widget/icons.d.ts +14 -0
- package/dist/types/widget/outbox.d.ts +69 -0
- package/dist/types/widget/styles.d.ts +1 -0
- package/dist/types/widget.d.ts +27 -0
- package/dist/types/wire.d.ts +66 -0
- package/dist/widget-DQZm8sAC.js +1599 -0
- package/package.json +68 -4
|
@@ -0,0 +1,1599 @@
|
|
|
1
|
+
var Pe = Object.defineProperty;
|
|
2
|
+
var Ie = (e, t, o) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var y = (e, t, o) => Ie(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { d as De, e as Le, b as Me, h as Oe, f as J, C as Z, D as $e, g as _e, i as Ue, c as Be, w as We } from "./consent-CoKD33Rm.js";
|
|
5
|
+
import { i as qe, a as Q } from "./index-CfCbJJXa.js";
|
|
6
|
+
import { d as He, s as Ve, i as ee, e as Xe, a as Ke, R as Ge } from "./hook-BdG4UL4k.js";
|
|
7
|
+
import { feedbackChannel as Ye, widgetConfig as Je } from "./feedback-C4CYtS2A.js";
|
|
8
|
+
const he = "[modern-screenshot]", P = typeof window < "u", Ze = P && "Worker" in window, X = P ? window.navigator?.userAgent : "", pe = X.includes("Chrome"), U = X.includes("AppleWebKit") && !pe, K = X.includes("Firefox"), Qe = (e) => e && "__CONTEXT__" in e, et = (e) => e.constructor.name === "CSSFontFaceRule", tt = (e) => e.constructor.name === "CSSImportRule", ot = (e) => e.constructor.name === "CSSLayerBlockRule", j = (e) => e.nodeType === 1, $ = (e) => typeof e.className == "object", fe = (e) => e.tagName === "image", nt = (e) => e.tagName === "use", L = (e) => j(e) && typeof e.style < "u" && !$(e), rt = (e) => e.nodeType === 8, it = (e) => e.nodeType === 3, I = (e) => e.tagName === "IMG", B = (e) => e.tagName === "VIDEO", st = (e) => e.tagName === "CANVAS", at = (e) => e.tagName === "TEXTAREA", ct = (e) => e.tagName === "INPUT", lt = (e) => e.tagName === "STYLE", dt = (e) => e.tagName === "SCRIPT", ut = (e) => e.tagName === "SELECT", ht = (e) => e.tagName === "SLOT", pt = (e) => e.tagName === "IFRAME", ft = (...e) => console.warn(he, ...e);
|
|
9
|
+
function gt(e) {
|
|
10
|
+
const t = e?.createElement?.("canvas");
|
|
11
|
+
return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
|
|
12
|
+
}
|
|
13
|
+
const H = (e) => e.startsWith("data:");
|
|
14
|
+
function ge(e, t) {
|
|
15
|
+
if (e.match(/^[a-z]+:\/\//i))
|
|
16
|
+
return e;
|
|
17
|
+
if (P && e.match(/^\/\//))
|
|
18
|
+
return window.location.protocol + e;
|
|
19
|
+
if (e.match(/^[a-z]+:/i) || !P)
|
|
20
|
+
return e;
|
|
21
|
+
const o = W().implementation.createHTMLDocument(), n = o.createElement("base"), i = o.createElement("a");
|
|
22
|
+
return o.head.appendChild(n), o.body.appendChild(i), t && (n.href = t), i.href = e, i.href;
|
|
23
|
+
}
|
|
24
|
+
function W(e) {
|
|
25
|
+
return (e && j(e) ? e?.ownerDocument : e) ?? window.document;
|
|
26
|
+
}
|
|
27
|
+
const q = "http://www.w3.org/2000/svg";
|
|
28
|
+
function mt(e, t, o) {
|
|
29
|
+
const n = W(o).createElementNS(q, "svg");
|
|
30
|
+
return n.setAttributeNS(null, "width", e.toString()), n.setAttributeNS(null, "height", t.toString()), n.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), n;
|
|
31
|
+
}
|
|
32
|
+
function wt(e, t) {
|
|
33
|
+
let o = new XMLSerializer().serializeToString(e);
|
|
34
|
+
return t && (o = o.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`;
|
|
35
|
+
}
|
|
36
|
+
function bt(e, t) {
|
|
37
|
+
return new Promise((o, n) => {
|
|
38
|
+
const i = new FileReader();
|
|
39
|
+
i.onload = () => o(i.result), i.onerror = () => n(i.error), i.onabort = () => n(new Error(`Failed read blob to ${t}`)), i.readAsDataURL(e);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const yt = (e) => bt(e, "dataUrl");
|
|
43
|
+
function R(e, t) {
|
|
44
|
+
const o = W(t).createElement("img");
|
|
45
|
+
return o.decoding = "sync", o.loading = "eager", o.src = e, o;
|
|
46
|
+
}
|
|
47
|
+
function M(e, t) {
|
|
48
|
+
return new Promise((o) => {
|
|
49
|
+
const { timeout: n, ownerDocument: i, onError: s, onWarn: a } = t ?? {}, r = typeof e == "string" ? R(e, W(i)) : e;
|
|
50
|
+
let u = null, d = null;
|
|
51
|
+
function c() {
|
|
52
|
+
o(r), u && clearTimeout(u), d?.();
|
|
53
|
+
}
|
|
54
|
+
if (n && (u = setTimeout(c, n)), B(r)) {
|
|
55
|
+
const f = r.currentSrc || r.src;
|
|
56
|
+
if (!f)
|
|
57
|
+
return r.poster ? M(r.poster, t).then(o) : c();
|
|
58
|
+
if (r.readyState >= 2)
|
|
59
|
+
return c();
|
|
60
|
+
const h = c, l = (g) => {
|
|
61
|
+
a?.(
|
|
62
|
+
"Failed video load",
|
|
63
|
+
f,
|
|
64
|
+
g
|
|
65
|
+
), s?.(g), c();
|
|
66
|
+
};
|
|
67
|
+
d = () => {
|
|
68
|
+
r.removeEventListener("loadeddata", h), r.removeEventListener("error", l);
|
|
69
|
+
}, r.addEventListener("loadeddata", h, { once: !0 }), r.addEventListener("error", l, { once: !0 });
|
|
70
|
+
} else {
|
|
71
|
+
const f = fe(r) ? r.href.baseVal : r.currentSrc || r.src;
|
|
72
|
+
if (!f)
|
|
73
|
+
return c();
|
|
74
|
+
const h = async () => {
|
|
75
|
+
if (I(r) && "decode" in r)
|
|
76
|
+
try {
|
|
77
|
+
await r.decode();
|
|
78
|
+
} catch (g) {
|
|
79
|
+
a?.(
|
|
80
|
+
"Failed to decode image, trying to render anyway",
|
|
81
|
+
r.dataset.originalSrc || f,
|
|
82
|
+
g
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
c();
|
|
86
|
+
}, l = (g) => {
|
|
87
|
+
a?.(
|
|
88
|
+
"Failed image load",
|
|
89
|
+
r.dataset.originalSrc || f,
|
|
90
|
+
g
|
|
91
|
+
), c();
|
|
92
|
+
};
|
|
93
|
+
if (I(r) && r.complete)
|
|
94
|
+
return h();
|
|
95
|
+
d = () => {
|
|
96
|
+
r.removeEventListener("load", h), r.removeEventListener("error", l);
|
|
97
|
+
}, r.addEventListener("load", h, { once: !0 }), r.addEventListener("error", l, { once: !0 });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async function xt(e, t) {
|
|
102
|
+
L(e) && (I(e) || B(e) ? await M(e, t) : await Promise.all(
|
|
103
|
+
["img", "video"].flatMap((o) => Array.from(e.querySelectorAll(o)).map((n) => M(n, t)))
|
|
104
|
+
));
|
|
105
|
+
}
|
|
106
|
+
const me = /* @__PURE__ */ (function() {
|
|
107
|
+
let t = 0;
|
|
108
|
+
const o = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
|
|
109
|
+
return () => (t += 1, `u${o()}${t}`);
|
|
110
|
+
})();
|
|
111
|
+
function we(e) {
|
|
112
|
+
return e?.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
|
|
113
|
+
}
|
|
114
|
+
let te = 0;
|
|
115
|
+
function vt(e) {
|
|
116
|
+
const t = `${he}[#${te}]`;
|
|
117
|
+
return te++, {
|
|
118
|
+
time: (o) => e && console.time(`${t} ${o}`),
|
|
119
|
+
timeEnd: (o) => e && console.timeEnd(`${t} ${o}`),
|
|
120
|
+
warn: (...o) => e && ft(...o)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function St(e) {
|
|
124
|
+
return {
|
|
125
|
+
cache: e ? "no-cache" : "force-cache"
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async function be(e, t) {
|
|
129
|
+
return Qe(e) ? e : kt(e, { ...t, autoDestruct: !0 });
|
|
130
|
+
}
|
|
131
|
+
async function kt(e, t) {
|
|
132
|
+
const { scale: o = 1, workerUrl: n, workerNumber: i = 1 } = t || {}, s = !!t?.debug, a = t?.features ?? !0, r = e.ownerDocument ?? (P ? window.document : void 0), u = e.ownerDocument?.defaultView ?? (P ? window : void 0), d = /* @__PURE__ */ new Map(), c = {
|
|
133
|
+
width: 0,
|
|
134
|
+
height: 0,
|
|
135
|
+
quality: 1,
|
|
136
|
+
type: "image/png",
|
|
137
|
+
scale: o,
|
|
138
|
+
backgroundColor: null,
|
|
139
|
+
style: null,
|
|
140
|
+
filter: null,
|
|
141
|
+
maximumCanvasSize: 0,
|
|
142
|
+
timeout: 3e4,
|
|
143
|
+
progress: null,
|
|
144
|
+
debug: s,
|
|
145
|
+
fetch: {
|
|
146
|
+
requestInit: St(t?.fetch?.bypassingCache),
|
|
147
|
+
placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
148
|
+
bypassingCache: !1,
|
|
149
|
+
...t?.fetch
|
|
150
|
+
},
|
|
151
|
+
fetchFn: null,
|
|
152
|
+
font: {},
|
|
153
|
+
drawImageInterval: 100,
|
|
154
|
+
workerUrl: null,
|
|
155
|
+
workerNumber: i,
|
|
156
|
+
onCloneEachNode: null,
|
|
157
|
+
onCloneNode: null,
|
|
158
|
+
onEmbedNode: null,
|
|
159
|
+
onCreateForeignObjectSvg: null,
|
|
160
|
+
includeStyleProperties: null,
|
|
161
|
+
autoDestruct: !1,
|
|
162
|
+
...t,
|
|
163
|
+
__CONTEXT__: !0,
|
|
164
|
+
log: vt(s),
|
|
165
|
+
node: e,
|
|
166
|
+
ownerDocument: r,
|
|
167
|
+
ownerWindow: u,
|
|
168
|
+
dpi: o === 1 ? null : 96 * o,
|
|
169
|
+
svgStyleElement: ye(r),
|
|
170
|
+
svgDefsElement: r?.createElementNS(q, "defs"),
|
|
171
|
+
svgStyles: /* @__PURE__ */ new Map(),
|
|
172
|
+
defaultComputedStyles: /* @__PURE__ */ new Map(),
|
|
173
|
+
workers: [
|
|
174
|
+
...Array.from({
|
|
175
|
+
length: Ze && n && i ? i : 0
|
|
176
|
+
})
|
|
177
|
+
].map(() => {
|
|
178
|
+
try {
|
|
179
|
+
const l = new Worker(n);
|
|
180
|
+
return l.onmessage = async (g) => {
|
|
181
|
+
const { url: p, result: w } = g.data;
|
|
182
|
+
w ? d.get(p)?.resolve?.(w) : d.get(p)?.reject?.(new Error(`Error receiving message from worker: ${p}`));
|
|
183
|
+
}, l.onmessageerror = (g) => {
|
|
184
|
+
const { url: p } = g.data;
|
|
185
|
+
d.get(p)?.reject?.(new Error(`Error receiving message from worker: ${p}`));
|
|
186
|
+
}, l;
|
|
187
|
+
} catch (l) {
|
|
188
|
+
return c.log.warn("Failed to new Worker", l), null;
|
|
189
|
+
}
|
|
190
|
+
}).filter(Boolean),
|
|
191
|
+
fontFamilies: /* @__PURE__ */ new Map(),
|
|
192
|
+
fontCssTexts: /* @__PURE__ */ new Map(),
|
|
193
|
+
acceptOfImage: `${[
|
|
194
|
+
gt(r) && "image/webp",
|
|
195
|
+
"image/svg+xml",
|
|
196
|
+
"image/*",
|
|
197
|
+
"*/*"
|
|
198
|
+
].filter(Boolean).join(",")};q=0.8`,
|
|
199
|
+
requests: d,
|
|
200
|
+
drawImageCount: 0,
|
|
201
|
+
tasks: [],
|
|
202
|
+
features: a,
|
|
203
|
+
isEnable: (l) => l === "restoreScrollPosition" ? typeof a == "boolean" ? !1 : a[l] ?? !1 : typeof a == "boolean" ? a : a[l] ?? !0,
|
|
204
|
+
shadowRoots: []
|
|
205
|
+
};
|
|
206
|
+
c.log.time("wait until load"), await xt(e, { timeout: c.timeout, onWarn: c.log.warn }), c.log.timeEnd("wait until load");
|
|
207
|
+
const { width: f, height: h } = Et(e, c);
|
|
208
|
+
return c.width = f, c.height = h, c;
|
|
209
|
+
}
|
|
210
|
+
function ye(e) {
|
|
211
|
+
if (!e)
|
|
212
|
+
return;
|
|
213
|
+
const t = e.createElement("style"), o = t.ownerDocument.createTextNode(`
|
|
214
|
+
.______background-clip--text {
|
|
215
|
+
background-clip: text;
|
|
216
|
+
-webkit-background-clip: text;
|
|
217
|
+
}
|
|
218
|
+
`);
|
|
219
|
+
return t.appendChild(o), t;
|
|
220
|
+
}
|
|
221
|
+
function Et(e, t) {
|
|
222
|
+
let { width: o, height: n } = t;
|
|
223
|
+
if (j(e) && (!o || !n)) {
|
|
224
|
+
const i = e.getBoundingClientRect();
|
|
225
|
+
o = o || i.width || Number(e.getAttribute("width")) || 0, n = n || i.height || Number(e.getAttribute("height")) || 0;
|
|
226
|
+
}
|
|
227
|
+
return { width: o, height: n };
|
|
228
|
+
}
|
|
229
|
+
async function Ct(e, t) {
|
|
230
|
+
const {
|
|
231
|
+
log: o,
|
|
232
|
+
timeout: n,
|
|
233
|
+
drawImageCount: i,
|
|
234
|
+
drawImageInterval: s
|
|
235
|
+
} = t;
|
|
236
|
+
o.time("image to canvas");
|
|
237
|
+
const a = await M(e, { timeout: n, onWarn: t.log.warn }), { canvas: r, context2d: u } = Tt(e.ownerDocument, t), d = () => {
|
|
238
|
+
try {
|
|
239
|
+
u?.drawImage(a, 0, 0, r.width, r.height);
|
|
240
|
+
} catch (c) {
|
|
241
|
+
t.log.warn("Failed to drawImage", c);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
if (d(), t.isEnable("fixSvgXmlDecode"))
|
|
245
|
+
for (let c = 0; c < i; c++)
|
|
246
|
+
await new Promise((f) => {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
u?.clearRect(0, 0, r.width, r.height), d(), f();
|
|
249
|
+
}, c + s);
|
|
250
|
+
});
|
|
251
|
+
return t.drawImageCount = 0, o.timeEnd("image to canvas"), r;
|
|
252
|
+
}
|
|
253
|
+
function Tt(e, t) {
|
|
254
|
+
const { width: o, height: n, scale: i, backgroundColor: s, maximumCanvasSize: a } = t, r = e.createElement("canvas");
|
|
255
|
+
r.width = Math.floor(o * i), r.height = Math.floor(n * i), r.style.width = `${o}px`, r.style.height = `${n}px`, a && (r.width > a || r.height > a) && (r.width > a && r.height > a ? r.width > r.height ? (r.height *= a / r.width, r.width = a) : (r.width *= a / r.height, r.height = a) : r.width > a ? (r.height *= a / r.width, r.width = a) : (r.width *= a / r.height, r.height = a));
|
|
256
|
+
const u = r.getContext("2d");
|
|
257
|
+
return u && s && (u.fillStyle = s, u.fillRect(0, 0, r.width, r.height)), { canvas: r, context2d: u };
|
|
258
|
+
}
|
|
259
|
+
function xe(e, t) {
|
|
260
|
+
if (e.ownerDocument)
|
|
261
|
+
try {
|
|
262
|
+
const s = e.toDataURL();
|
|
263
|
+
if (s !== "data:,")
|
|
264
|
+
return R(s, e.ownerDocument);
|
|
265
|
+
} catch (s) {
|
|
266
|
+
t.log.warn("Failed to clone canvas", s);
|
|
267
|
+
}
|
|
268
|
+
const o = e.cloneNode(!1), n = e.getContext("2d"), i = o.getContext("2d");
|
|
269
|
+
try {
|
|
270
|
+
return n && i && i.putImageData(
|
|
271
|
+
n.getImageData(0, 0, e.width, e.height),
|
|
272
|
+
0,
|
|
273
|
+
0
|
|
274
|
+
), o;
|
|
275
|
+
} catch (s) {
|
|
276
|
+
t.log.warn("Failed to clone canvas", s);
|
|
277
|
+
}
|
|
278
|
+
return o;
|
|
279
|
+
}
|
|
280
|
+
function jt(e, t) {
|
|
281
|
+
try {
|
|
282
|
+
if (e?.contentDocument?.documentElement)
|
|
283
|
+
return G(e.contentDocument.documentElement, t);
|
|
284
|
+
} catch (o) {
|
|
285
|
+
t.log.warn("Failed to clone iframe", o);
|
|
286
|
+
}
|
|
287
|
+
return e.cloneNode(!1);
|
|
288
|
+
}
|
|
289
|
+
function zt(e) {
|
|
290
|
+
const t = e.cloneNode(!1);
|
|
291
|
+
return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
|
|
292
|
+
}
|
|
293
|
+
async function Ft(e, t) {
|
|
294
|
+
if (e.ownerDocument && !e.currentSrc && e.poster)
|
|
295
|
+
return R(e.poster, e.ownerDocument);
|
|
296
|
+
const o = e.cloneNode(!1);
|
|
297
|
+
o.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (o.src = e.currentSrc);
|
|
298
|
+
const n = o.ownerDocument;
|
|
299
|
+
if (n) {
|
|
300
|
+
let i = !0;
|
|
301
|
+
if (await M(o, { onError: () => i = !1, onWarn: t.log.warn }), !i)
|
|
302
|
+
return e.poster ? R(e.poster, e.ownerDocument) : o;
|
|
303
|
+
o.currentTime = e.currentTime, await new Promise((a) => {
|
|
304
|
+
o.addEventListener("seeked", a, { once: !0 });
|
|
305
|
+
});
|
|
306
|
+
const s = n.createElement("canvas");
|
|
307
|
+
s.width = e.offsetWidth, s.height = e.offsetHeight;
|
|
308
|
+
try {
|
|
309
|
+
const a = s.getContext("2d");
|
|
310
|
+
a && a.drawImage(o, 0, 0, s.width, s.height);
|
|
311
|
+
} catch (a) {
|
|
312
|
+
return t.log.warn("Failed to clone video", a), e.poster ? R(e.poster, e.ownerDocument) : o;
|
|
313
|
+
}
|
|
314
|
+
return xe(s, t);
|
|
315
|
+
}
|
|
316
|
+
return o;
|
|
317
|
+
}
|
|
318
|
+
function Nt(e, t) {
|
|
319
|
+
return st(e) ? xe(e, t) : pt(e) ? jt(e, t) : I(e) ? zt(e) : B(e) ? Ft(e, t) : e.cloneNode(!1);
|
|
320
|
+
}
|
|
321
|
+
function At(e) {
|
|
322
|
+
let t = e.sandbox;
|
|
323
|
+
if (!t) {
|
|
324
|
+
const { ownerDocument: o } = e;
|
|
325
|
+
try {
|
|
326
|
+
o && (t = o.createElement("iframe"), t.id = `__SANDBOX__${me()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", o.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
|
|
327
|
+
} catch (n) {
|
|
328
|
+
e.log.warn("Failed to getSandBox", n);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return t;
|
|
332
|
+
}
|
|
333
|
+
const Rt = [
|
|
334
|
+
"width",
|
|
335
|
+
"height",
|
|
336
|
+
"-webkit-text-fill-color"
|
|
337
|
+
], Pt = [
|
|
338
|
+
"stroke",
|
|
339
|
+
"fill"
|
|
340
|
+
];
|
|
341
|
+
function ve(e, t, o) {
|
|
342
|
+
const { defaultComputedStyles: n } = o, i = e.nodeName.toLowerCase(), s = $(e) && i !== "svg", a = s ? Pt.map((p) => [p, e.getAttribute(p)]).filter(([, p]) => p !== null) : [], r = [
|
|
343
|
+
s && "svg",
|
|
344
|
+
i,
|
|
345
|
+
a.map((p, w) => `${p}=${w}`).join(","),
|
|
346
|
+
t
|
|
347
|
+
].filter(Boolean).join(":");
|
|
348
|
+
if (n.has(r))
|
|
349
|
+
return n.get(r);
|
|
350
|
+
const d = At(o)?.contentWindow;
|
|
351
|
+
if (!d)
|
|
352
|
+
return /* @__PURE__ */ new Map();
|
|
353
|
+
const c = d?.document;
|
|
354
|
+
let f, h;
|
|
355
|
+
s ? (f = c.createElementNS(q, "svg"), h = f.ownerDocument.createElementNS(f.namespaceURI, i), a.forEach(([p, w]) => {
|
|
356
|
+
h.setAttributeNS(null, p, w);
|
|
357
|
+
}), f.appendChild(h)) : f = h = c.createElement(i), h.textContent = " ", c.body.appendChild(f);
|
|
358
|
+
const l = d.getComputedStyle(h, t), g = /* @__PURE__ */ new Map();
|
|
359
|
+
for (let p = l.length, w = 0; w < p; w++) {
|
|
360
|
+
const b = l.item(w);
|
|
361
|
+
Rt.includes(b) || g.set(b, l.getPropertyValue(b));
|
|
362
|
+
}
|
|
363
|
+
return c.body.removeChild(f), n.set(r, g), g;
|
|
364
|
+
}
|
|
365
|
+
function Se(e, t, o) {
|
|
366
|
+
const n = /* @__PURE__ */ new Map(), i = [], s = /* @__PURE__ */ new Map();
|
|
367
|
+
if (o)
|
|
368
|
+
for (const r of o)
|
|
369
|
+
a(r);
|
|
370
|
+
else
|
|
371
|
+
for (let r = e.length, u = 0; u < r; u++) {
|
|
372
|
+
const d = e.item(u);
|
|
373
|
+
a(d);
|
|
374
|
+
}
|
|
375
|
+
for (let r = i.length, u = 0; u < r; u++)
|
|
376
|
+
s.get(i[u])?.forEach((d, c) => n.set(c, d));
|
|
377
|
+
function a(r) {
|
|
378
|
+
const u = e.getPropertyValue(r), d = e.getPropertyPriority(r), c = r.lastIndexOf("-"), f = c > -1 ? r.substring(0, c) : void 0;
|
|
379
|
+
if (f) {
|
|
380
|
+
let h = s.get(f);
|
|
381
|
+
h || (h = /* @__PURE__ */ new Map(), s.set(f, h)), h.set(r, [u, d]);
|
|
382
|
+
}
|
|
383
|
+
t.get(r) === u && !d || (f ? i.push(f) : n.set(r, [u, d]));
|
|
384
|
+
}
|
|
385
|
+
return n;
|
|
386
|
+
}
|
|
387
|
+
function It(e, t, o, n) {
|
|
388
|
+
const { ownerWindow: i, includeStyleProperties: s, currentParentNodeStyle: a } = n, r = t.style, u = i.getComputedStyle(e), d = ve(e, null, n);
|
|
389
|
+
a?.forEach((f, h) => {
|
|
390
|
+
d.delete(h);
|
|
391
|
+
});
|
|
392
|
+
const c = Se(u, d, s);
|
|
393
|
+
c.delete("transition-property"), c.delete("all"), c.delete("d"), c.delete("content"), o && (c.delete("position"), c.delete("margin-top"), c.delete("margin-right"), c.delete("margin-bottom"), c.delete("margin-left"), c.delete("margin-block-start"), c.delete("margin-block-end"), c.delete("margin-inline-start"), c.delete("margin-inline-end"), c.set("box-sizing", ["border-box", ""])), c.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text"), pe && (c.has("font-kerning") || c.set("font-kerning", ["normal", ""]), (c.get("overflow-x")?.[0] === "hidden" || c.get("overflow-y")?.[0] === "hidden") && c.get("text-overflow")?.[0] === "ellipsis" && e.scrollWidth === e.clientWidth && c.set("text-overflow", ["clip", ""]));
|
|
394
|
+
for (let f = r.length, h = 0; h < f; h++)
|
|
395
|
+
r.removeProperty(r.item(h));
|
|
396
|
+
return c.forEach(([f, h], l) => {
|
|
397
|
+
r.setProperty(l, f, h);
|
|
398
|
+
}), c;
|
|
399
|
+
}
|
|
400
|
+
function Dt(e, t) {
|
|
401
|
+
(at(e) || ct(e) || ut(e)) && t.setAttribute("value", e.value);
|
|
402
|
+
}
|
|
403
|
+
const Lt = [
|
|
404
|
+
"::before",
|
|
405
|
+
"::after"
|
|
406
|
+
], Mt = [
|
|
407
|
+
"::-webkit-scrollbar",
|
|
408
|
+
"::-webkit-scrollbar-button",
|
|
409
|
+
"::-webkit-scrollbar-thumb",
|
|
410
|
+
"::-webkit-scrollbar-track",
|
|
411
|
+
"::-webkit-scrollbar-track-piece",
|
|
412
|
+
"::-webkit-scrollbar-corner",
|
|
413
|
+
"::-webkit-resizer"
|
|
414
|
+
];
|
|
415
|
+
function Ot(e, t, o, n, i) {
|
|
416
|
+
const { ownerWindow: s, svgStyleElement: a, svgStyles: r, currentNodeStyle: u } = n;
|
|
417
|
+
if (!a || !s)
|
|
418
|
+
return;
|
|
419
|
+
function d(c) {
|
|
420
|
+
const f = s.getComputedStyle(e, c);
|
|
421
|
+
let h = f.getPropertyValue("content");
|
|
422
|
+
if (!h || h === "none")
|
|
423
|
+
return;
|
|
424
|
+
i?.(h), h = h.replace(/(')|(")|(counter\(.+\))/g, "");
|
|
425
|
+
const l = [me()], g = ve(e, c, n);
|
|
426
|
+
u?.forEach((v, S) => {
|
|
427
|
+
g.delete(S);
|
|
428
|
+
});
|
|
429
|
+
const p = Se(f, g, n.includeStyleProperties);
|
|
430
|
+
p.delete("content"), p.delete("-webkit-locale"), p.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text");
|
|
431
|
+
const w = [
|
|
432
|
+
`content: '${h}';`
|
|
433
|
+
];
|
|
434
|
+
if (p.forEach(([v, S], k) => {
|
|
435
|
+
w.push(`${k}: ${v}${S ? " !important" : ""};`);
|
|
436
|
+
}), w.length === 1)
|
|
437
|
+
return;
|
|
438
|
+
try {
|
|
439
|
+
t.className = [t.className, ...l].join(" ");
|
|
440
|
+
} catch (v) {
|
|
441
|
+
n.log.warn("Failed to copyPseudoClass", v);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const b = w.join(`
|
|
445
|
+
`);
|
|
446
|
+
let x = r.get(b);
|
|
447
|
+
x || (x = [], r.set(b, x)), x.push(`.${l[0]}${c}`);
|
|
448
|
+
}
|
|
449
|
+
Lt.forEach(d), o && Mt.forEach(d);
|
|
450
|
+
}
|
|
451
|
+
const oe = /* @__PURE__ */ new Set([
|
|
452
|
+
"symbol"
|
|
453
|
+
]);
|
|
454
|
+
async function ne(e, t, o, n, i) {
|
|
455
|
+
if (j(o) && (lt(o) || dt(o)) || n.filter && !n.filter(o))
|
|
456
|
+
return;
|
|
457
|
+
oe.has(t.nodeName) || oe.has(o.nodeName) ? n.currentParentNodeStyle = void 0 : n.currentParentNodeStyle = n.currentNodeStyle;
|
|
458
|
+
const s = await G(o, n, !1, i);
|
|
459
|
+
n.isEnable("restoreScrollPosition") && $t(e, s), t.appendChild(s);
|
|
460
|
+
}
|
|
461
|
+
async function re(e, t, o, n) {
|
|
462
|
+
let i = e.firstChild;
|
|
463
|
+
j(e) && e.shadowRoot && (i = e.shadowRoot?.firstChild, o.shadowRoots.push(e.shadowRoot));
|
|
464
|
+
for (let s = i; s; s = s.nextSibling)
|
|
465
|
+
if (!rt(s))
|
|
466
|
+
if (j(s) && ht(s) && typeof s.assignedNodes == "function") {
|
|
467
|
+
const a = s.assignedNodes();
|
|
468
|
+
for (let r = 0; r < a.length; r++)
|
|
469
|
+
await ne(e, t, a[r], o, n);
|
|
470
|
+
} else
|
|
471
|
+
await ne(e, t, s, o, n);
|
|
472
|
+
}
|
|
473
|
+
function $t(e, t) {
|
|
474
|
+
if (!L(e) || !L(t))
|
|
475
|
+
return;
|
|
476
|
+
const { scrollTop: o, scrollLeft: n } = e;
|
|
477
|
+
if (!o && !n)
|
|
478
|
+
return;
|
|
479
|
+
const { transform: i } = t.style, s = new DOMMatrix(i), { a, b: r, c: u, d } = s;
|
|
480
|
+
s.a = 1, s.b = 0, s.c = 0, s.d = 1, s.translateSelf(-n, -o), s.a = a, s.b = r, s.c = u, s.d = d, t.style.transform = s.toString();
|
|
481
|
+
}
|
|
482
|
+
function _t(e, t) {
|
|
483
|
+
const { backgroundColor: o, width: n, height: i, style: s } = t, a = e.style;
|
|
484
|
+
if (o && a.setProperty("background-color", o, "important"), n && a.setProperty("width", `${n}px`, "important"), i && a.setProperty("height", `${i}px`, "important"), s)
|
|
485
|
+
for (const r in s) a[r] = s[r];
|
|
486
|
+
}
|
|
487
|
+
const Ut = /^[\w-:]+$/;
|
|
488
|
+
async function G(e, t, o = !1, n) {
|
|
489
|
+
const { ownerDocument: i, ownerWindow: s, fontFamilies: a, onCloneEachNode: r } = t;
|
|
490
|
+
if (i && it(e))
|
|
491
|
+
return n && /\S/.test(e.data) && n(e.data), i.createTextNode(e.data);
|
|
492
|
+
if (i && s && j(e) && (L(e) || $(e))) {
|
|
493
|
+
const d = await Nt(e, t);
|
|
494
|
+
if (t.isEnable("removeAbnormalAttributes")) {
|
|
495
|
+
const p = d.getAttributeNames();
|
|
496
|
+
for (let w = p.length, b = 0; b < w; b++) {
|
|
497
|
+
const x = p[b];
|
|
498
|
+
Ut.test(x) || d.removeAttribute(x);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const c = t.currentNodeStyle = It(e, d, o, t);
|
|
502
|
+
o && _t(d, t);
|
|
503
|
+
let f = !1;
|
|
504
|
+
if (t.isEnable("copyScrollbar")) {
|
|
505
|
+
const p = [
|
|
506
|
+
c.get("overflow-x")?.[0],
|
|
507
|
+
c.get("overflow-y")?.[0]
|
|
508
|
+
];
|
|
509
|
+
f = p.includes("scroll") || (p.includes("auto") || p.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
|
|
510
|
+
}
|
|
511
|
+
const h = c.get("text-transform")?.[0], l = we(c.get("font-family")?.[0]), g = l ? (p) => {
|
|
512
|
+
h === "uppercase" ? p = p.toUpperCase() : h === "lowercase" ? p = p.toLowerCase() : h === "capitalize" && (p = p[0].toUpperCase() + p.substring(1)), l.forEach((w) => {
|
|
513
|
+
let b = a.get(w);
|
|
514
|
+
b || a.set(w, b = /* @__PURE__ */ new Set()), p.split("").forEach((x) => b.add(x));
|
|
515
|
+
});
|
|
516
|
+
} : void 0;
|
|
517
|
+
return Ot(
|
|
518
|
+
e,
|
|
519
|
+
d,
|
|
520
|
+
f,
|
|
521
|
+
t,
|
|
522
|
+
g
|
|
523
|
+
), Dt(e, d), B(e) || await re(
|
|
524
|
+
e,
|
|
525
|
+
d,
|
|
526
|
+
t,
|
|
527
|
+
g
|
|
528
|
+
), await r?.(d), d;
|
|
529
|
+
}
|
|
530
|
+
const u = e.cloneNode(!1);
|
|
531
|
+
return await re(e, u, t), await r?.(u), u;
|
|
532
|
+
}
|
|
533
|
+
function Bt(e) {
|
|
534
|
+
if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
|
|
535
|
+
try {
|
|
536
|
+
e.sandbox.remove();
|
|
537
|
+
} catch (t) {
|
|
538
|
+
e.log.warn("Failed to destroyContext", t);
|
|
539
|
+
}
|
|
540
|
+
e.sandbox = void 0;
|
|
541
|
+
}
|
|
542
|
+
e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
|
|
543
|
+
}
|
|
544
|
+
function Wt(e) {
|
|
545
|
+
const { url: t, timeout: o, responseType: n, ...i } = e, s = new AbortController(), a = o ? setTimeout(() => s.abort(), o) : void 0;
|
|
546
|
+
return fetch(t, { signal: s.signal, ...i }).then((r) => {
|
|
547
|
+
if (!r.ok)
|
|
548
|
+
throw new Error("Failed fetch, not 2xx response", { cause: r });
|
|
549
|
+
switch (n) {
|
|
550
|
+
case "arrayBuffer":
|
|
551
|
+
return r.arrayBuffer();
|
|
552
|
+
case "dataUrl":
|
|
553
|
+
return r.blob().then(yt);
|
|
554
|
+
default:
|
|
555
|
+
return r.text();
|
|
556
|
+
}
|
|
557
|
+
}).finally(() => clearTimeout(a));
|
|
558
|
+
}
|
|
559
|
+
function O(e, t) {
|
|
560
|
+
const { url: o, requestType: n = "text", responseType: i = "text", imageDom: s } = t;
|
|
561
|
+
let a = o;
|
|
562
|
+
const {
|
|
563
|
+
timeout: r,
|
|
564
|
+
acceptOfImage: u,
|
|
565
|
+
requests: d,
|
|
566
|
+
fetchFn: c,
|
|
567
|
+
fetch: {
|
|
568
|
+
requestInit: f,
|
|
569
|
+
bypassingCache: h,
|
|
570
|
+
placeholderImage: l
|
|
571
|
+
},
|
|
572
|
+
font: g,
|
|
573
|
+
workers: p,
|
|
574
|
+
fontFamilies: w
|
|
575
|
+
} = e;
|
|
576
|
+
n === "image" && (U || K) && e.drawImageCount++;
|
|
577
|
+
let b = d.get(o);
|
|
578
|
+
if (!b) {
|
|
579
|
+
h && h instanceof RegExp && h.test(a) && (a += (/\?/.test(a) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
580
|
+
const x = n.startsWith("font") && g && g.minify, v = /* @__PURE__ */ new Set();
|
|
581
|
+
x && n.split(";")[1].split(",").forEach((F) => {
|
|
582
|
+
w.has(F) && w.get(F).forEach((C) => v.add(C));
|
|
583
|
+
});
|
|
584
|
+
const S = x && v.size, k = {
|
|
585
|
+
url: a,
|
|
586
|
+
timeout: r,
|
|
587
|
+
responseType: S ? "arrayBuffer" : i,
|
|
588
|
+
headers: n === "image" ? { accept: u } : void 0,
|
|
589
|
+
...f
|
|
590
|
+
};
|
|
591
|
+
b = {
|
|
592
|
+
type: n,
|
|
593
|
+
resolve: void 0,
|
|
594
|
+
reject: void 0,
|
|
595
|
+
response: null
|
|
596
|
+
}, b.response = (async () => {
|
|
597
|
+
if (c && n === "image") {
|
|
598
|
+
const E = await c(o);
|
|
599
|
+
if (E)
|
|
600
|
+
return E;
|
|
601
|
+
}
|
|
602
|
+
return !U && o.startsWith("http") && p.length ? new Promise((E, F) => {
|
|
603
|
+
p[d.size & p.length - 1].postMessage({ rawUrl: o, ...k }), b.resolve = E, b.reject = F;
|
|
604
|
+
}) : Wt(k);
|
|
605
|
+
})().catch((E) => {
|
|
606
|
+
if (d.delete(o), n === "image" && l)
|
|
607
|
+
return e.log.warn("Failed to fetch image base64, trying to use placeholder image", a), typeof l == "string" ? l : l(s);
|
|
608
|
+
throw E;
|
|
609
|
+
}), d.set(o, b);
|
|
610
|
+
}
|
|
611
|
+
return b.response;
|
|
612
|
+
}
|
|
613
|
+
async function ke(e, t, o, n) {
|
|
614
|
+
if (!Ee(e))
|
|
615
|
+
return e;
|
|
616
|
+
for (const [i, s] of qt(e, t))
|
|
617
|
+
try {
|
|
618
|
+
const a = await O(
|
|
619
|
+
o,
|
|
620
|
+
{
|
|
621
|
+
url: s,
|
|
622
|
+
requestType: n ? "image" : "text",
|
|
623
|
+
responseType: "dataUrl"
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
e = e.replace(Ht(i), `$1${a}$3`);
|
|
627
|
+
} catch (a) {
|
|
628
|
+
o.log.warn("Failed to fetch css data url", i, a);
|
|
629
|
+
}
|
|
630
|
+
return e;
|
|
631
|
+
}
|
|
632
|
+
function Ee(e) {
|
|
633
|
+
return /url\((['"]?)([^'"]+?)\1\)/.test(e);
|
|
634
|
+
}
|
|
635
|
+
const Ce = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
636
|
+
function qt(e, t) {
|
|
637
|
+
const o = [];
|
|
638
|
+
return e.replace(Ce, (n, i, s) => (o.push([s, ge(s, t)]), n)), o.filter(([n]) => !H(n));
|
|
639
|
+
}
|
|
640
|
+
function Ht(e) {
|
|
641
|
+
const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
642
|
+
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
643
|
+
}
|
|
644
|
+
const Vt = [
|
|
645
|
+
"background-image",
|
|
646
|
+
"border-image-source",
|
|
647
|
+
"-webkit-border-image",
|
|
648
|
+
"-webkit-mask-image",
|
|
649
|
+
"list-style-image"
|
|
650
|
+
];
|
|
651
|
+
function Xt(e, t) {
|
|
652
|
+
return Vt.map((o) => {
|
|
653
|
+
const n = e.getPropertyValue(o);
|
|
654
|
+
return !n || n === "none" ? null : ((U || K) && t.drawImageCount++, ke(n, null, t, !0).then((i) => {
|
|
655
|
+
!i || n === i || e.setProperty(
|
|
656
|
+
o,
|
|
657
|
+
i,
|
|
658
|
+
e.getPropertyPriority(o)
|
|
659
|
+
);
|
|
660
|
+
}));
|
|
661
|
+
}).filter(Boolean);
|
|
662
|
+
}
|
|
663
|
+
function Kt(e, t) {
|
|
664
|
+
if (I(e)) {
|
|
665
|
+
const o = e.currentSrc || e.src;
|
|
666
|
+
if (!H(o))
|
|
667
|
+
return [
|
|
668
|
+
O(t, {
|
|
669
|
+
url: o,
|
|
670
|
+
imageDom: e,
|
|
671
|
+
requestType: "image",
|
|
672
|
+
responseType: "dataUrl"
|
|
673
|
+
}).then((n) => {
|
|
674
|
+
n && (e.srcset = "", e.dataset.originalSrc = o, e.src = n || "");
|
|
675
|
+
})
|
|
676
|
+
];
|
|
677
|
+
(U || K) && t.drawImageCount++;
|
|
678
|
+
} else if ($(e) && !H(e.href.baseVal)) {
|
|
679
|
+
const o = e.href.baseVal;
|
|
680
|
+
return [
|
|
681
|
+
O(t, {
|
|
682
|
+
url: o,
|
|
683
|
+
imageDom: e,
|
|
684
|
+
requestType: "image",
|
|
685
|
+
responseType: "dataUrl"
|
|
686
|
+
}).then((n) => {
|
|
687
|
+
n && (e.dataset.originalSrc = o, e.href.baseVal = n || "");
|
|
688
|
+
})
|
|
689
|
+
];
|
|
690
|
+
}
|
|
691
|
+
return [];
|
|
692
|
+
}
|
|
693
|
+
function Gt(e, t) {
|
|
694
|
+
const { ownerDocument: o, svgDefsElement: n } = t, i = e.getAttribute("href") ?? e.getAttribute("xlink:href");
|
|
695
|
+
if (!i)
|
|
696
|
+
return [];
|
|
697
|
+
const [s, a] = i.split("#");
|
|
698
|
+
if (a) {
|
|
699
|
+
const r = `#${a}`, u = t.shadowRoots.reduce(
|
|
700
|
+
(d, c) => d ?? c.querySelector(`svg ${r}`),
|
|
701
|
+
o?.querySelector(`svg ${r}`)
|
|
702
|
+
);
|
|
703
|
+
if (s && e.setAttribute("href", r), n?.querySelector(r))
|
|
704
|
+
return [];
|
|
705
|
+
if (u)
|
|
706
|
+
return n?.appendChild(u.cloneNode(!0)), [];
|
|
707
|
+
if (s)
|
|
708
|
+
return [
|
|
709
|
+
O(t, {
|
|
710
|
+
url: s,
|
|
711
|
+
responseType: "text"
|
|
712
|
+
}).then((d) => {
|
|
713
|
+
n?.insertAdjacentHTML("beforeend", d);
|
|
714
|
+
})
|
|
715
|
+
];
|
|
716
|
+
}
|
|
717
|
+
return [];
|
|
718
|
+
}
|
|
719
|
+
function Te(e, t) {
|
|
720
|
+
const { tasks: o } = t;
|
|
721
|
+
j(e) && ((I(e) || fe(e)) && o.push(...Kt(e, t)), nt(e) && o.push(...Gt(e, t))), L(e) && o.push(...Xt(e.style, t)), e.childNodes.forEach((n) => {
|
|
722
|
+
Te(n, t);
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
async function Yt(e, t) {
|
|
726
|
+
const {
|
|
727
|
+
ownerDocument: o,
|
|
728
|
+
svgStyleElement: n,
|
|
729
|
+
fontFamilies: i,
|
|
730
|
+
fontCssTexts: s,
|
|
731
|
+
tasks: a,
|
|
732
|
+
font: r
|
|
733
|
+
} = t;
|
|
734
|
+
if (!(!o || !n || !i.size))
|
|
735
|
+
if (r && r.cssText) {
|
|
736
|
+
const u = se(r.cssText, t);
|
|
737
|
+
n.appendChild(o.createTextNode(`${u}
|
|
738
|
+
`));
|
|
739
|
+
} else {
|
|
740
|
+
const u = Array.from(o.styleSheets).filter((l) => {
|
|
741
|
+
try {
|
|
742
|
+
return "cssRules" in l && !!l.cssRules.length;
|
|
743
|
+
} catch (g) {
|
|
744
|
+
return t.log.warn(`Error while reading CSS rules from ${l.href}`, g), !1;
|
|
745
|
+
}
|
|
746
|
+
}), d = o.implementation.createHTMLDocument(""), c = d.createElement("style");
|
|
747
|
+
d.head.appendChild(c);
|
|
748
|
+
const f = c.sheet;
|
|
749
|
+
await Promise.all(
|
|
750
|
+
u.flatMap((l) => Array.from(l.cssRules).map(async (g) => {
|
|
751
|
+
if (tt(g)) {
|
|
752
|
+
const p = g.href;
|
|
753
|
+
let w = "";
|
|
754
|
+
try {
|
|
755
|
+
w = await O(t, {
|
|
756
|
+
url: p,
|
|
757
|
+
requestType: "text",
|
|
758
|
+
responseType: "text"
|
|
759
|
+
});
|
|
760
|
+
} catch (x) {
|
|
761
|
+
t.log.warn(`Error fetch remote css import from ${p}`, x);
|
|
762
|
+
}
|
|
763
|
+
const b = w.replace(
|
|
764
|
+
Ce,
|
|
765
|
+
(x, v, S) => x.replace(S, ge(S, p))
|
|
766
|
+
);
|
|
767
|
+
for (const x of Zt(b))
|
|
768
|
+
try {
|
|
769
|
+
f.insertRule(x, f.cssRules.length);
|
|
770
|
+
} catch (v) {
|
|
771
|
+
t.log.warn("Error inserting rule from remote css import", { rule: x, error: v });
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}))
|
|
775
|
+
), f.cssRules.length && u.push(f);
|
|
776
|
+
const h = [];
|
|
777
|
+
u.forEach((l) => {
|
|
778
|
+
V(l.cssRules, h);
|
|
779
|
+
}), h.filter((l) => et(l) && Ee(l.style.getPropertyValue("src")) && we(l.style.getPropertyValue("font-family"))?.some((g) => i.has(g))).forEach((l) => {
|
|
780
|
+
const g = l, p = s.get(g.cssText);
|
|
781
|
+
p ? n.appendChild(o.createTextNode(`${p}
|
|
782
|
+
`)) : a.push(
|
|
783
|
+
ke(
|
|
784
|
+
g.cssText,
|
|
785
|
+
g.parentStyleSheet ? g.parentStyleSheet.href : null,
|
|
786
|
+
t
|
|
787
|
+
).then((w) => {
|
|
788
|
+
w = se(w, t), s.set(g.cssText, w), n.appendChild(o.createTextNode(`${w}
|
|
789
|
+
`));
|
|
790
|
+
})
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
const Jt = /(\/\*[\s\S]*?\*\/)/g, ie = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
|
|
796
|
+
function Zt(e) {
|
|
797
|
+
if (e == null)
|
|
798
|
+
return [];
|
|
799
|
+
const t = [];
|
|
800
|
+
let o = e.replace(Jt, "");
|
|
801
|
+
for (; ; ) {
|
|
802
|
+
const s = ie.exec(o);
|
|
803
|
+
if (!s)
|
|
804
|
+
break;
|
|
805
|
+
t.push(s[0]);
|
|
806
|
+
}
|
|
807
|
+
o = o.replace(ie, "");
|
|
808
|
+
const n = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, i = new RegExp(
|
|
809
|
+
"((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",
|
|
810
|
+
"gi"
|
|
811
|
+
);
|
|
812
|
+
for (; ; ) {
|
|
813
|
+
let s = n.exec(o);
|
|
814
|
+
if (s)
|
|
815
|
+
i.lastIndex = n.lastIndex;
|
|
816
|
+
else if (s = i.exec(o), s)
|
|
817
|
+
n.lastIndex = i.lastIndex;
|
|
818
|
+
else
|
|
819
|
+
break;
|
|
820
|
+
t.push(s[0]);
|
|
821
|
+
}
|
|
822
|
+
return t;
|
|
823
|
+
}
|
|
824
|
+
const Qt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, eo = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
825
|
+
function se(e, t) {
|
|
826
|
+
const { font: o } = t, n = o ? o?.preferredFormat : void 0;
|
|
827
|
+
return n ? e.replace(eo, (i) => {
|
|
828
|
+
for (; ; ) {
|
|
829
|
+
const [s, , a] = Qt.exec(i) || [];
|
|
830
|
+
if (!a)
|
|
831
|
+
return "";
|
|
832
|
+
if (a === n)
|
|
833
|
+
return `src: ${s};`;
|
|
834
|
+
}
|
|
835
|
+
}) : e;
|
|
836
|
+
}
|
|
837
|
+
function V(e, t = []) {
|
|
838
|
+
for (const o of Array.from(e))
|
|
839
|
+
ot(o) ? t.push(...V(o.cssRules)) : "cssRules" in o ? V(o.cssRules, t) : t.push(o);
|
|
840
|
+
return t;
|
|
841
|
+
}
|
|
842
|
+
const to = /\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;
|
|
843
|
+
function oo(e) {
|
|
844
|
+
return to.test(e.innerHTML);
|
|
845
|
+
}
|
|
846
|
+
async function je(e, t) {
|
|
847
|
+
const o = await be(e, t);
|
|
848
|
+
if (j(o.node) && $(o.node) && !oo(o.node))
|
|
849
|
+
return o.node;
|
|
850
|
+
const {
|
|
851
|
+
ownerDocument: n,
|
|
852
|
+
log: i,
|
|
853
|
+
tasks: s,
|
|
854
|
+
svgStyleElement: a,
|
|
855
|
+
svgDefsElement: r,
|
|
856
|
+
svgStyles: u,
|
|
857
|
+
font: d,
|
|
858
|
+
progress: c,
|
|
859
|
+
autoDestruct: f,
|
|
860
|
+
onCloneNode: h,
|
|
861
|
+
onEmbedNode: l,
|
|
862
|
+
onCreateForeignObjectSvg: g
|
|
863
|
+
} = o;
|
|
864
|
+
i.time("clone node");
|
|
865
|
+
const p = await G(o.node, o, !0);
|
|
866
|
+
if (a && n) {
|
|
867
|
+
let S = "";
|
|
868
|
+
u.forEach((k, E) => {
|
|
869
|
+
S += `${k.join(`,
|
|
870
|
+
`)} {
|
|
871
|
+
${E}
|
|
872
|
+
}
|
|
873
|
+
`;
|
|
874
|
+
}), a.appendChild(n.createTextNode(S));
|
|
875
|
+
}
|
|
876
|
+
i.timeEnd("clone node"), await h?.(p), d !== !1 && j(p) && (i.time("embed web font"), await Yt(p, o), i.timeEnd("embed web font")), i.time("embed node"), Te(p, o);
|
|
877
|
+
const w = s.length;
|
|
878
|
+
let b = 0;
|
|
879
|
+
const x = async () => {
|
|
880
|
+
for (; ; ) {
|
|
881
|
+
const S = s.pop();
|
|
882
|
+
if (!S)
|
|
883
|
+
break;
|
|
884
|
+
try {
|
|
885
|
+
await S;
|
|
886
|
+
} catch (k) {
|
|
887
|
+
o.log.warn("Failed to run task", k);
|
|
888
|
+
}
|
|
889
|
+
c?.(++b, w);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
c?.(b, w), await Promise.all([...Array.from({ length: 4 })].map(x)), i.timeEnd("embed node"), await l?.(p);
|
|
893
|
+
const v = no(p, o);
|
|
894
|
+
return r && v.insertBefore(r, v.children[0]), a && v.insertBefore(a, v.children[0]), f && Bt(o), await g?.(v), v;
|
|
895
|
+
}
|
|
896
|
+
function no(e, t) {
|
|
897
|
+
const { width: o, height: n } = t, i = mt(o, n, e.ownerDocument), s = i.ownerDocument.createElementNS(i.namespaceURI, "foreignObject");
|
|
898
|
+
return s.setAttributeNS(null, "x", "0%"), s.setAttributeNS(null, "y", "0%"), s.setAttributeNS(null, "width", "100%"), s.setAttributeNS(null, "height", "100%"), s.append(e), i.appendChild(s), i;
|
|
899
|
+
}
|
|
900
|
+
async function ro(e, t) {
|
|
901
|
+
const o = await be(e, t), n = await je(o), i = wt(n, o.isEnable("removeControlCharacter"));
|
|
902
|
+
o.autoDestruct || (o.svgStyleElement = ye(o.ownerDocument), o.svgDefsElement = o.ownerDocument?.createElementNS(q, "defs"), o.svgStyles.clear());
|
|
903
|
+
const s = R(i, n.ownerDocument);
|
|
904
|
+
return await Ct(s, o);
|
|
905
|
+
}
|
|
906
|
+
const io = "iframe, frame, object, embed, video, audio, canvas", so = (e) => qe(e) || e.matches(io), ao = "[data-journeeze]", co = "[data-jz-block]", lo = 2 * 1024 * 1024, uo = 1600;
|
|
907
|
+
class ze extends Error {
|
|
908
|
+
}
|
|
909
|
+
const N = 1, D = 3, ho = 8;
|
|
910
|
+
function Fe(e, t = {}) {
|
|
911
|
+
const o = [e], n = /* @__PURE__ */ new Map(), i = bo(t.maskSelectors), s = t.maskAllText === !0, a = (h) => so(h) || i.some((l) => {
|
|
912
|
+
try {
|
|
913
|
+
return h.matches(l);
|
|
914
|
+
} catch {
|
|
915
|
+
return !0;
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
let r;
|
|
919
|
+
const u = (h) => {
|
|
920
|
+
if (h.nodeType === N) {
|
|
921
|
+
const l = h;
|
|
922
|
+
if (l.matches(ao))
|
|
923
|
+
return n.set(l, "drop"), !1;
|
|
924
|
+
if (l.matches(co))
|
|
925
|
+
return n.set(l, "empty"), !1;
|
|
926
|
+
if (wo(l) || a(l))
|
|
927
|
+
return n.set(l, "replace"), !1;
|
|
928
|
+
}
|
|
929
|
+
return h.nodeType !== D && o.push(h), !0;
|
|
930
|
+
}, d = (h) => {
|
|
931
|
+
const l = o.pop();
|
|
932
|
+
if (!l || l.nodeName !== h.nodeName) {
|
|
933
|
+
r ?? (r = "clone order mismatch");
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
l.nodeType === N && h.nodeType === N && c(l, h);
|
|
937
|
+
};
|
|
938
|
+
function c(h, l) {
|
|
939
|
+
const g = Array.from(l.childNodes), p = l.ownerDocument ?? document;
|
|
940
|
+
let w = 0;
|
|
941
|
+
for (const b of po(h)) {
|
|
942
|
+
const x = n.get(b);
|
|
943
|
+
if (x === "drop") continue;
|
|
944
|
+
if (x === "replace") {
|
|
945
|
+
l.insertBefore(go(b, p), g[w] ?? null);
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
if (x === "empty") {
|
|
949
|
+
l.insertBefore(mo(b, p), g[w] ?? null);
|
|
950
|
+
continue;
|
|
951
|
+
}
|
|
952
|
+
const v = g[w];
|
|
953
|
+
if (v === void 0) {
|
|
954
|
+
r ?? (r = "missing clone child");
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
w++, s && b.nodeType === D && v.nodeType === D && b.data.trim() !== "" && l.replaceChild(yo(b, p), v);
|
|
958
|
+
}
|
|
959
|
+
w !== g.length && (r ?? (r = "unexpected clone child"));
|
|
960
|
+
}
|
|
961
|
+
return { filter: u, onCloneEachNode: d, onCloneNode: (h) => {
|
|
962
|
+
if (o.length !== 0 && (r ?? (r = "unbalanced clone traversal")), h.nodeType === N) {
|
|
963
|
+
const l = [h, ...Array.from(h.querySelectorAll("*"))];
|
|
964
|
+
l.some(a) && (r ?? (r = "maskable element in clone")), s && l.some(Ae) && (r ?? (r = "text in clone"));
|
|
965
|
+
}
|
|
966
|
+
if (r !== void 0) throw new ze(r);
|
|
967
|
+
}, failure: () => r };
|
|
968
|
+
}
|
|
969
|
+
function po(e) {
|
|
970
|
+
const t = [], o = e.shadowRoot ? Array.from(e.shadowRoot.childNodes) : Array.from(e.childNodes);
|
|
971
|
+
for (const n of o)
|
|
972
|
+
if (n.nodeType !== ho) {
|
|
973
|
+
if (n.nodeType === N && n.tagName === "SLOT" && typeof n.assignedNodes == "function") {
|
|
974
|
+
for (const i of n.assignedNodes()) ae(i) || t.push(i);
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
ae(n) || t.push(n);
|
|
978
|
+
}
|
|
979
|
+
return t;
|
|
980
|
+
}
|
|
981
|
+
function ae(e) {
|
|
982
|
+
return e.nodeType === N && (e.tagName === "STYLE" || e.tagName === "SCRIPT");
|
|
983
|
+
}
|
|
984
|
+
const fo = [
|
|
985
|
+
"position",
|
|
986
|
+
"top",
|
|
987
|
+
"right",
|
|
988
|
+
"bottom",
|
|
989
|
+
"left",
|
|
990
|
+
"float",
|
|
991
|
+
"clear",
|
|
992
|
+
"z-index",
|
|
993
|
+
"margin-top",
|
|
994
|
+
"margin-right",
|
|
995
|
+
"margin-bottom",
|
|
996
|
+
"margin-left",
|
|
997
|
+
"flex-grow",
|
|
998
|
+
"flex-shrink",
|
|
999
|
+
"flex-basis",
|
|
1000
|
+
"align-self",
|
|
1001
|
+
"justify-self",
|
|
1002
|
+
"order",
|
|
1003
|
+
"grid-row-start",
|
|
1004
|
+
"grid-row-end",
|
|
1005
|
+
"grid-column-start",
|
|
1006
|
+
"grid-column-end",
|
|
1007
|
+
"vertical-align",
|
|
1008
|
+
"border-top-left-radius",
|
|
1009
|
+
"border-top-right-radius",
|
|
1010
|
+
"border-bottom-left-radius",
|
|
1011
|
+
"border-bottom-right-radius",
|
|
1012
|
+
"transform",
|
|
1013
|
+
"visibility"
|
|
1014
|
+
];
|
|
1015
|
+
function go(e, t) {
|
|
1016
|
+
return Ne(e, t, !0);
|
|
1017
|
+
}
|
|
1018
|
+
function mo(e, t) {
|
|
1019
|
+
return Ne(e, t, !1);
|
|
1020
|
+
}
|
|
1021
|
+
function Ne(e, t, o) {
|
|
1022
|
+
const i = e.ownerDocument.defaultView?.getComputedStyle(e), s = e.getBoundingClientRect(), a = e instanceof HTMLElement ? e.offsetWidth : s.width, r = e instanceof HTMLElement ? e.offsetHeight : s.height, u = i?.display ?? "block", d = t.createElement(u.startsWith("inline") ? "span" : "div"), c = d.style;
|
|
1023
|
+
for (const f of fo) {
|
|
1024
|
+
const h = i?.getPropertyValue(f);
|
|
1025
|
+
h && c.setProperty(f, h);
|
|
1026
|
+
}
|
|
1027
|
+
return c.setProperty("display", u === "none" ? "none" : u === "inline" || u.startsWith("inline") ? "inline-block" : "block"), c.setProperty("box-sizing", "border-box"), c.setProperty("width", `${a}px`), c.setProperty("height", `${r}px`), c.setProperty("border", o ? "1px dashed #8A9099" : "0"), c.setProperty(
|
|
1028
|
+
"background",
|
|
1029
|
+
o ? "repeating-linear-gradient(45deg, rgb(138 144 153 / 18%) 0 4px, rgb(138 144 153 / 32%) 4px 8px)" : "transparent"
|
|
1030
|
+
), d.setAttribute(o ? "data-jz-masked-placeholder" : "data-jz-block-placeholder", ""), d;
|
|
1031
|
+
}
|
|
1032
|
+
function wo(e) {
|
|
1033
|
+
if (!e.tagName.toLowerCase().includes("-") || e.shadowRoot) return !1;
|
|
1034
|
+
const t = e.getBoundingClientRect();
|
|
1035
|
+
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1036
|
+
for (const o of Array.from(e.childNodes))
|
|
1037
|
+
if (o.nodeType === N || o.nodeType === D && o.data.trim() !== "") return !1;
|
|
1038
|
+
return !0;
|
|
1039
|
+
}
|
|
1040
|
+
function bo(e) {
|
|
1041
|
+
for (const t of e ?? [])
|
|
1042
|
+
try {
|
|
1043
|
+
document.createDocumentFragment().querySelector(t);
|
|
1044
|
+
} catch {
|
|
1045
|
+
throw ce || console.warn("[journeeze] invalid maskSelectors entry: screenshots are off"), ce = !0, new ze("invalid maskSelectors");
|
|
1046
|
+
}
|
|
1047
|
+
return [...e ?? []];
|
|
1048
|
+
}
|
|
1049
|
+
let ce = !1;
|
|
1050
|
+
function Ae(e) {
|
|
1051
|
+
for (const t of Array.from(e.childNodes))
|
|
1052
|
+
if (t.nodeType === D && t.data.trim() !== "" || t.nodeType === N && Ae(t)) return !0;
|
|
1053
|
+
return !1;
|
|
1054
|
+
}
|
|
1055
|
+
function yo(e, t) {
|
|
1056
|
+
const o = t.createRange();
|
|
1057
|
+
o.selectNodeContents(e);
|
|
1058
|
+
const n = o.getBoundingClientRect(), i = t.createElement("span"), s = i.style;
|
|
1059
|
+
return s.setProperty("display", "inline-block"), s.setProperty("width", `${n.width}px`), s.setProperty("height", `${n.height}px`), s.setProperty("background", "repeating-linear-gradient(45deg, rgb(138 144 153 / 18%) 0 4px, rgb(138 144 153 / 32%) 4px 8px)"), i.setAttribute("data-jz-masked-placeholder", ""), i;
|
|
1060
|
+
}
|
|
1061
|
+
function le(e, t) {
|
|
1062
|
+
const o = parseFloat(e.ownerDocument.defaultView?.getComputedStyle(e).getPropertyValue(t) ?? "0");
|
|
1063
|
+
return Number.isFinite(o) ? o : 0;
|
|
1064
|
+
}
|
|
1065
|
+
function Re(e, t, o, n) {
|
|
1066
|
+
const i = e.ownerDocument.defaultView ?? window;
|
|
1067
|
+
return {
|
|
1068
|
+
width: i.innerWidth,
|
|
1069
|
+
height: i.innerHeight,
|
|
1070
|
+
scale: o,
|
|
1071
|
+
quality: n,
|
|
1072
|
+
type: "image/webp",
|
|
1073
|
+
timeout: 4e3,
|
|
1074
|
+
style: { marginTop: `${le(e, "margin-top") - i.scrollY}px`, marginLeft: `${le(e, "margin-left") - i.scrollX}px` },
|
|
1075
|
+
filter: t.filter,
|
|
1076
|
+
onCloneEachNode: t.onCloneEachNode,
|
|
1077
|
+
onCloneNode: t.onCloneNode
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
async function xo(e = document.body, t = {}) {
|
|
1081
|
+
const o = e.ownerDocument.defaultView ?? window, n = Math.min(o.devicePixelRatio || 1, uo / Math.max(1, o.innerWidth));
|
|
1082
|
+
let i = await ro(e, Re(e, Fe(e, t), n, 1));
|
|
1083
|
+
for (const s of [0.8, 0.6, 0.45]) {
|
|
1084
|
+
const a = await vo(i, s);
|
|
1085
|
+
if (!a || a.type !== "image/webp" && a.type !== "image/png") return;
|
|
1086
|
+
if (a.size <= lo) return a;
|
|
1087
|
+
i = So(i, 0.75);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
function vo(e, t) {
|
|
1091
|
+
return new Promise((o) => e.toBlob(o, "image/webp", t));
|
|
1092
|
+
}
|
|
1093
|
+
function So(e, t) {
|
|
1094
|
+
const o = e.ownerDocument.createElement("canvas");
|
|
1095
|
+
return o.width = Math.max(1, Math.round(e.width * t)), o.height = Math.max(1, Math.round(e.height * t)), o.getContext("2d")?.drawImage(e, 0, 0, o.width, o.height), o;
|
|
1096
|
+
}
|
|
1097
|
+
async function Lo(e = document.body) {
|
|
1098
|
+
const t = Fe(e), o = await je(e, { ...Re(e, t, 1, 1), font: !1 });
|
|
1099
|
+
return new XMLSerializer().serializeToString(o);
|
|
1100
|
+
}
|
|
1101
|
+
const de = '<path d="M9 9h.01"/><path d="M15 9h.01"/>', ko = {
|
|
1102
|
+
like: `<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/>${de}`,
|
|
1103
|
+
dislike: `<circle cx="12" cy="12" r="10"/><path d="M16 16s-1.5-2-4-2-4 2-4 2"/>${de}`,
|
|
1104
|
+
understood: '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
|
|
1105
|
+
confused: '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
|
|
1106
|
+
close: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
|
|
1107
|
+
persona: '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
|
|
1108
|
+
step: '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
|
|
1109
|
+
info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>'
|
|
1110
|
+
};
|
|
1111
|
+
function A(e, t = 20) {
|
|
1112
|
+
const o = document.createElement("template");
|
|
1113
|
+
return o.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${ko[e]}</svg>`, o.content.firstElementChild;
|
|
1114
|
+
}
|
|
1115
|
+
const Eo = `
|
|
1116
|
+
:host { all: initial; }
|
|
1117
|
+
.jz {
|
|
1118
|
+
--jz-canvas:#F7F7F5; --jz-surface:#FFFFFF; --jz-raised:#F0F0EC; --jz-ink:#1D2024; --jz-muted:#5D636B;
|
|
1119
|
+
--jz-faint:#8A9099; --jz-rule:rgb(29 32 36 / 12%); --jz-accent:#3D63C9; --jz-accent-ink:#FFFFFF;
|
|
1120
|
+
--jz-accent-soft:rgb(61 99 201 / 10%); --jz-polished:#2F7D4F; --jz-broken:#B42318; --jz-confused:#6E4FC2;
|
|
1121
|
+
--jz-shadow:0 1px 3px rgb(0 0 0 / 12%);
|
|
1122
|
+
font: 400 13px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
1123
|
+
color: var(--jz-ink); -webkit-font-smoothing: antialiased;
|
|
1124
|
+
}
|
|
1125
|
+
@media (prefers-color-scheme: dark) {
|
|
1126
|
+
.jz { --jz-canvas:#111316; --jz-surface:#181B1F; --jz-raised:#20242A; --jz-ink:#E8EAED; --jz-muted:#A3A9B2;
|
|
1127
|
+
--jz-faint:#6F7680; --jz-rule:rgb(232 234 237 / 12%); --jz-accent:#7F9CF0; --jz-accent-ink:#111316;
|
|
1128
|
+
--jz-accent-soft:rgb(127 156 240 / 14%); --jz-confused:#A48BEA; --jz-polished:#5DBB84; }
|
|
1129
|
+
}
|
|
1130
|
+
.jz *, .jz *::before, .jz *::after { box-sizing: border-box; }
|
|
1131
|
+
/* Zero specificity: a component's own colour (.toggle, .primary, ...) must always win. */
|
|
1132
|
+
:where(.jz button) { font: inherit; color: inherit; cursor: pointer; }
|
|
1133
|
+
.jz :focus-visible { outline: 2px solid var(--jz-accent); outline-offset: 2px; }
|
|
1134
|
+
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
1135
|
+
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
|
|
1136
|
+
|
|
1137
|
+
.toggle { position:fixed; right:32px; bottom:32px; z-index:2147483646; height:44px; padding:0 16px; display:flex; align-items:center;
|
|
1138
|
+
gap:8px; border:0; border-radius:999px; background:#1D2024; color:#FFFFFF; box-shadow:var(--jz-shadow); font-weight:500; }
|
|
1139
|
+
.toggle .dot { width:8px; height:8px; border-radius:50%; background:var(--jz-polished); }
|
|
1140
|
+
.toggle .exit { color:#8A9099; }
|
|
1141
|
+
.toggle:hover .exit { color:#FFFFFF; }
|
|
1142
|
+
|
|
1143
|
+
.layer { position:fixed; inset:0; z-index:2147483640; pointer-events:none; }
|
|
1144
|
+
.hl { position:fixed; display:none; outline:1px solid var(--jz-accent); outline-offset:-1px; border-radius:2px; }
|
|
1145
|
+
.hl.masked { outline:1px dashed var(--jz-faint);
|
|
1146
|
+
background:repeating-linear-gradient(45deg, rgb(138 144 153 / 10%) 0 4px, rgb(138 144 153 / 20%) 4px 8px); }
|
|
1147
|
+
.tag { position:absolute; left:0; top:-18px; padding:1px 6px; border-radius:2px; background:var(--jz-accent); color:#FFFFFF;
|
|
1148
|
+
font-size:10px; line-height:16px; white-space:nowrap; max-width:280px; overflow:hidden; text-overflow:ellipsis; }
|
|
1149
|
+
.hl.masked .tag { background:var(--jz-muted); text-transform:uppercase; letter-spacing:.06em; }
|
|
1150
|
+
.pin { position:fixed; width:24px; height:24px; margin:-12px 0 0 -12px; border-radius:50%; display:flex; align-items:center;
|
|
1151
|
+
justify-content:center; background:var(--jz-accent); color:#FFFFFF; font-size:12px; font-weight:500; box-shadow:var(--jz-shadow); }
|
|
1152
|
+
|
|
1153
|
+
.pop, .sheet, .checkin, .toast { position:fixed; z-index:2147483645; background:var(--jz-surface); color:var(--jz-ink);
|
|
1154
|
+
border:1px solid var(--jz-rule); box-shadow:var(--jz-shadow); }
|
|
1155
|
+
.pop { width:400px; max-width:calc(100vw - 32px); max-height:calc(100vh - 32px); overflow:auto; padding:24px; border-radius:10px;
|
|
1156
|
+
animation: jz-in 180ms ease-out; }
|
|
1157
|
+
@keyframes jz-in { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
|
|
1158
|
+
.pop-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:20px; }
|
|
1159
|
+
.pop h2 { margin:0; font-size:14px; font-weight:500; }
|
|
1160
|
+
.close { width:32px; height:32px; display:flex; align-items:center; justify-content:center; border:0; border-radius:6px;
|
|
1161
|
+
background:transparent; color:var(--jz-faint); }
|
|
1162
|
+
.close:hover { color:var(--jz-ink); }
|
|
1163
|
+
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:20px; }
|
|
1164
|
+
.chip { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px; background:var(--jz-raised);
|
|
1165
|
+
color:var(--jz-muted); font-size:11px; }
|
|
1166
|
+
.reactions { display:flex; border:1px solid var(--jz-rule); border-radius:8px; overflow:hidden; margin-bottom:20px; }
|
|
1167
|
+
.reaction { flex:1; min-height:56px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
|
|
1168
|
+
padding:12px 4px; border:0; border-right:1px solid var(--jz-rule); background:transparent; color:var(--jz-muted); }
|
|
1169
|
+
.reaction:last-child { border-right:0; }
|
|
1170
|
+
.reaction:hover { background:var(--jz-canvas); }
|
|
1171
|
+
.reaction span { font-size:10px; font-weight:500; }
|
|
1172
|
+
.reaction[data-r="confused"] { color:var(--jz-confused); }
|
|
1173
|
+
.reaction[aria-checked="true"] { background:var(--jz-accent-soft); color:var(--jz-accent); }
|
|
1174
|
+
.reaction[data-r="confused"][aria-checked="true"] { background:rgb(110 79 194 / 10%); color:var(--jz-confused); }
|
|
1175
|
+
.comment { display:block; width:100%; height:112px; padding:16px; margin-bottom:20px; resize:none; border:1px solid var(--jz-rule);
|
|
1176
|
+
border-radius:8px; background:var(--jz-surface); color:var(--jz-ink); font:inherit; }
|
|
1177
|
+
.comment::placeholder { color:var(--jz-faint); }
|
|
1178
|
+
.comment:focus { outline:none; box-shadow:0 0 0 1px var(--jz-accent); }
|
|
1179
|
+
.foot { display:flex; align-items:center; justify-content:space-between; gap:12px; }
|
|
1180
|
+
.shot { display:flex; align-items:center; gap:12px; min-width:0; }
|
|
1181
|
+
.thumb { flex:none; width:80px; height:48px; border-radius:8px; border:1px solid var(--jz-rule); background:var(--jz-canvas);
|
|
1182
|
+
overflow:hidden; display:flex; align-items:center; justify-content:center; color:var(--jz-faint); font-size:8px; }
|
|
1183
|
+
.thumb img { width:100%; height:100%; object-fit:cover; }
|
|
1184
|
+
.thumb.hatch { background:repeating-linear-gradient(45deg, rgb(138 144 153 / 10%) 0 4px, rgb(138 144 153 / 20%) 4px 8px); }
|
|
1185
|
+
.shot-open { display:block; width:100%; height:100%; padding:0; border:0; background:transparent; }
|
|
1186
|
+
.optout-row { display:flex; align-items:center; gap:8px; margin-bottom:16px; color:var(--jz-muted); font-size:12px; }
|
|
1187
|
+
.optout-row[hidden] { display:none; }
|
|
1188
|
+
.note { font-size:11px; color:var(--jz-faint); line-height:1.3; }
|
|
1189
|
+
.shot-full { position:fixed; inset:0; z-index:2147483647; display:flex; align-items:center; justify-content:center; padding:24px; background:rgb(0 0 0 / 72%); }
|
|
1190
|
+
.shot-full img { max-width:100%; max-height:100%; object-fit:contain; border-radius:6px; background:var(--jz-surface); }
|
|
1191
|
+
.shot-full .close { position:absolute; top:16px; right:16px; background:var(--jz-surface); color:var(--jz-ink); }
|
|
1192
|
+
.primary { min-height:44px; padding:0 24px; border:0; border-radius:8px; background:var(--jz-accent); color:var(--jz-accent-ink); font-weight:500; }
|
|
1193
|
+
.primary:disabled { opacity:.45; cursor:not-allowed; }
|
|
1194
|
+
.secondary { min-height:44px; padding:0 16px; border:1px solid var(--jz-rule); border-radius:6px; background:transparent;
|
|
1195
|
+
color:var(--jz-muted); font-weight:500; }
|
|
1196
|
+
|
|
1197
|
+
.sheet { left:32px; bottom:32px; width:340px; max-width:calc(100vw - 32px); padding:24px; border-radius:10px; }
|
|
1198
|
+
.sheet h2 { display:flex; align-items:center; gap:8px; margin:0 0 12px; font-size:14px; font-weight:500; }
|
|
1199
|
+
.sheet h2 svg { color:var(--jz-accent); }
|
|
1200
|
+
.sheet p { margin:0 0 12px; color:var(--jz-muted); line-height:1.6; }
|
|
1201
|
+
.sheet ul { margin:0 0 20px; padding-left:18px; color:var(--jz-muted); }
|
|
1202
|
+
.row { display:flex; gap:8px; }
|
|
1203
|
+
.row > * { flex:1; }
|
|
1204
|
+
|
|
1205
|
+
.checkin { right:32px; bottom:140px; display:flex; align-items:center; gap:8px; padding:8px 8px 8px 16px; border-radius:10px; }
|
|
1206
|
+
.checkin .secondary { min-height:36px; }
|
|
1207
|
+
.toast { right:32px; bottom:88px; padding:10px 16px; border-radius:10px; }
|
|
1208
|
+
.toast.err { border-color:var(--jz-broken); }
|
|
1209
|
+
|
|
1210
|
+
@media (max-width: 479px) {
|
|
1211
|
+
.toggle { right:24px; bottom:24px; height:48px; padding:0 20px; background:var(--jz-accent); color:var(--jz-accent-ink); }
|
|
1212
|
+
.toggle .dot { background:var(--jz-accent-ink); }
|
|
1213
|
+
.toggle .exit { color:inherit; opacity:.8; }
|
|
1214
|
+
.pop { left:0 !important; right:0; top:auto !important; bottom:0; width:auto; max-width:none; max-height:85vh;
|
|
1215
|
+
border-radius:16px 16px 0 0; border-width:1px 0 0; padding:12px 24px 34px; }
|
|
1216
|
+
.pop::before { content:""; display:block; width:48px; height:4px; margin:0 auto 16px; border-radius:999px; background:var(--jz-raised); }
|
|
1217
|
+
.chip { border-radius:4px; border:1px solid var(--jz-rule); }
|
|
1218
|
+
.reactions { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; border:0; overflow:visible; }
|
|
1219
|
+
.reaction { border:1px solid var(--jz-rule); border-radius:8px; padding:16px 4px; }
|
|
1220
|
+
.reaction:last-child { border-right:1px solid var(--jz-rule); }
|
|
1221
|
+
.reaction[aria-checked="true"] { border:2px solid var(--jz-accent); }
|
|
1222
|
+
.reaction span { font-size:11px; }
|
|
1223
|
+
.foot { flex-direction:column; align-items:stretch; }
|
|
1224
|
+
.foot .primary { width:100%; min-height:52px; font-size:15px; }
|
|
1225
|
+
.sheet { left:16px; right:16px; bottom:16px; width:auto; }
|
|
1226
|
+
.toast { left:16px; right:16px; bottom:84px; }
|
|
1227
|
+
.checkin { left:16px; right:16px; bottom:136px; }
|
|
1228
|
+
}
|
|
1229
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1230
|
+
.jz *, .jz *::before, .jz *::after { animation-duration:1ms !important; transition-duration:1ms !important; }
|
|
1231
|
+
}
|
|
1232
|
+
`, Co = [
|
|
1233
|
+
["like", "Like"],
|
|
1234
|
+
["dislike", "Dislike"],
|
|
1235
|
+
["understood", "Understood"],
|
|
1236
|
+
["confused", "Confused"]
|
|
1237
|
+
], To = 5e3;
|
|
1238
|
+
function m(e, t = {}, ...o) {
|
|
1239
|
+
const n = document.createElement(e);
|
|
1240
|
+
for (const [i, s] of Object.entries(t))
|
|
1241
|
+
s === void 0 || s === !1 || n.setAttribute(i, s === !0 ? "" : s);
|
|
1242
|
+
return n.append(...o), n;
|
|
1243
|
+
}
|
|
1244
|
+
function jo(e, t) {
|
|
1245
|
+
try {
|
|
1246
|
+
const o = new URL(t.endsWith("/") ? t : `${t}/`), n = new URL(e.replace(/^\/+/, ""), o);
|
|
1247
|
+
return n.origin === o.origin ? n.href : void 0;
|
|
1248
|
+
} catch {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
function zo(e, t, o, n) {
|
|
1253
|
+
const i = { pagePath: Le(t), device: e.device || He(o) }, s = (a) => {
|
|
1254
|
+
const r = e[a];
|
|
1255
|
+
typeof r == "string" && r.trim() !== "" && (i[a] = r.trim());
|
|
1256
|
+
};
|
|
1257
|
+
return s("persona"), s("journeyId"), s("journeyStep"), s("businessType"), s("state"), n !== void 0 && (i.tflowId = n), i;
|
|
1258
|
+
}
|
|
1259
|
+
function ue(e) {
|
|
1260
|
+
const t = e.signature === void 0 ? e.userIdSig : e.signature ? e.signature.sig : void 0, o = e.signature === void 0 ? e.userIdExp : e.signature ? e.signature.exp : void 0;
|
|
1261
|
+
return typeof t != "string" || !/^[A-Za-z0-9_-]{43}$/.test(t) ? {} : typeof o != "number" || !Number.isInteger(o) || o * 1e3 <= Date.now() ? {} : { userIdSig: t, userIdExp: o };
|
|
1262
|
+
}
|
|
1263
|
+
class Fo {
|
|
1264
|
+
constructor(t, o, n) {
|
|
1265
|
+
y(this, "options");
|
|
1266
|
+
y(this, "getContext");
|
|
1267
|
+
y(this, "exit");
|
|
1268
|
+
y(this, "host", m("div", { "data-journeeze": "" }));
|
|
1269
|
+
y(this, "root");
|
|
1270
|
+
y(this, "shell", m("div", { class: "jz" }));
|
|
1271
|
+
y(this, "layer", m("div", { class: "layer" }));
|
|
1272
|
+
y(this, "highlight", m("div", { class: "hl" }));
|
|
1273
|
+
y(this, "tag", m("div", { class: "tag mono" }));
|
|
1274
|
+
y(this, "live", m("div", { class: "sr", "aria-live": "polite" }));
|
|
1275
|
+
y(this, "toggle");
|
|
1276
|
+
y(this, "channel");
|
|
1277
|
+
y(this, "outbox");
|
|
1278
|
+
y(this, "endpoint");
|
|
1279
|
+
y(this, "cleanups", []);
|
|
1280
|
+
y(this, "phase", "consent");
|
|
1281
|
+
y(this, "config", {});
|
|
1282
|
+
y(this, "pinCount", 0);
|
|
1283
|
+
y(this, "popover");
|
|
1284
|
+
y(this, "fullShot");
|
|
1285
|
+
y(this, "fullShotOpener");
|
|
1286
|
+
y(this, "consentSheet");
|
|
1287
|
+
y(this, "checkin");
|
|
1288
|
+
y(this, "toastEl");
|
|
1289
|
+
y(this, "toastTimer");
|
|
1290
|
+
y(this, "lastCtx");
|
|
1291
|
+
y(this, "lastWhere");
|
|
1292
|
+
y(this, "askedSteps", /* @__PURE__ */ new Set());
|
|
1293
|
+
y(this, "objectUrls", []);
|
|
1294
|
+
y(this, "disposed", !1);
|
|
1295
|
+
y(this, "exitTimer");
|
|
1296
|
+
y(this, "screenshotsUnavailable", !1);
|
|
1297
|
+
y(this, "uploadNotFound", 0);
|
|
1298
|
+
y(this, "pending", /* @__PURE__ */ new Set());
|
|
1299
|
+
y(this, "signals");
|
|
1300
|
+
y(this, "configReady", Promise.resolve());
|
|
1301
|
+
this.options = t, this.getContext = o, this.exit = n, this.endpoint = Me(t), this.signals = Ve(t, this.endpoint, o), this.root = this.host.attachShadow({ mode: "closed" }), this.root.append(m("style", t.nonce ? { nonce: t.nonce } : {}, Eo), this.shell), this.toggle = m(
|
|
1302
|
+
"button",
|
|
1303
|
+
{ type: "button", class: "toggle", "aria-pressed": "true", "aria-label": "Feedback mode on. Exit feedback mode" },
|
|
1304
|
+
m("span", { class: "dot", "aria-hidden": "true" }),
|
|
1305
|
+
m("span", {}, "Feedback mode on"),
|
|
1306
|
+
m("span", { class: "exit", "aria-hidden": "true" }, "· Exit")
|
|
1307
|
+
), this.toggle.addEventListener("click", () => this.exit());
|
|
1308
|
+
for (const i of ["keydown", "keyup", "keypress"]) this.shell.addEventListener(i, (s) => this.onWidgetKey(s));
|
|
1309
|
+
this.highlight.append(this.tag), this.layer.append(this.highlight), this.shell.append(this.layer, this.toggle, this.live), this.channel = Ye(t, this.endpoint, {
|
|
1310
|
+
beforePersist: () => this.stashPending(),
|
|
1311
|
+
onDropped: (i) => this.toast(No(i), !0)
|
|
1312
|
+
}), this.outbox = this.channel.outbox, document.body.append(this.host), this.listen(window, "keydown", (i) => this.onKey(i)), this.lastCtx = { ...o() }, this.lastWhere = _(), this.configReady = this.loadConfig(), Oe(J(t)) ? this.startPointing() : this.showConsent();
|
|
1313
|
+
}
|
|
1314
|
+
api() {
|
|
1315
|
+
return { unmount: (t) => this.dispose(t), contextChanged: () => this.onContextChanged() };
|
|
1316
|
+
}
|
|
1317
|
+
listen(t, o, n, i = !1, s = !1) {
|
|
1318
|
+
t.addEventListener(o, n, { capture: i, passive: s }), this.cleanups.push(() => t.removeEventListener(o, n, { capture: i }));
|
|
1319
|
+
}
|
|
1320
|
+
dispose(t) {
|
|
1321
|
+
if (!this.disposed) {
|
|
1322
|
+
this.disposed = !0, this.signals.stop(t);
|
|
1323
|
+
for (const o of this.cleanups.splice(0)) o();
|
|
1324
|
+
this.exitTimer !== void 0 && clearTimeout(this.exitTimer), this.stashPending(), this.channel.dispose(), this.toastTimer !== void 0 && clearTimeout(this.toastTimer);
|
|
1325
|
+
for (const o of this.objectUrls.splice(0)) URL.revokeObjectURL(o);
|
|
1326
|
+
this.host.remove();
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
async loadConfig() {
|
|
1330
|
+
try {
|
|
1331
|
+
if (this.config = await Je(this.endpoint, this.options.siteKey), this.config.consentText && this.consentSheet) {
|
|
1332
|
+
const t = this.consentSheet.querySelector("p");
|
|
1333
|
+
t && (t.textContent = this.config.consentText);
|
|
1334
|
+
}
|
|
1335
|
+
this.config.enabled !== !0 && (this.toast("Feedback isn't switched on for this site yet.", !0), this.exitTimer = setTimeout(() => {
|
|
1336
|
+
this.disposed || this.exit();
|
|
1337
|
+
}, 2500));
|
|
1338
|
+
} catch (t) {
|
|
1339
|
+
t instanceof Z && t.status === 404 && (this.toast("Feedback isn't set up on this site yet.", !0), this.exitTimer = setTimeout(() => {
|
|
1340
|
+
this.disposed || this.exit();
|
|
1341
|
+
}, 2500));
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
showConsent() {
|
|
1345
|
+
this.phase = "consent";
|
|
1346
|
+
const t = m("h2", { id: "jz-consent-title" }, A("info", 18), "Suggest an improvement"), o = m("button", { type: "button", class: "primary" }, "Allow and continue"), n = m("button", { type: "button", class: "secondary" }, "Not now"), i = m(
|
|
1347
|
+
"div",
|
|
1348
|
+
{ class: "sheet", role: "dialog", "aria-modal": "false", "aria-labelledby": "jz-consent-title" },
|
|
1349
|
+
t,
|
|
1350
|
+
m("p", {}, this.config.consentText || (this.screenshotsAllowed() ? $e : _e)),
|
|
1351
|
+
m("div", { class: "row" }, o, n)
|
|
1352
|
+
);
|
|
1353
|
+
o.addEventListener("click", () => {
|
|
1354
|
+
Ue(J(this.options)), i.remove(), this.consentSheet = void 0, this.startPointing(), this.toggle.focus();
|
|
1355
|
+
}), n.addEventListener("click", () => this.exit()), this.trapTab(i), this.consentSheet = i, this.shell.append(i), o.focus();
|
|
1356
|
+
}
|
|
1357
|
+
startPointing() {
|
|
1358
|
+
this.phase = "pointing", this.signals.start(this.configReady.then(() => this.config)), this.announce("Feedback mode on. Click any part of the page to comment on it. Press Escape to exit."), this.listen(document, "pointermove", (t) => this.onMove(t), !0, !0);
|
|
1359
|
+
for (const t of ["pointerdown", "mousedown", "mouseup", "pointerup"])
|
|
1360
|
+
this.listen(window, t, (o) => this.swallow(o), !0);
|
|
1361
|
+
for (const t of ["touchstart", "touchend"])
|
|
1362
|
+
this.listen(
|
|
1363
|
+
window,
|
|
1364
|
+
t,
|
|
1365
|
+
(o) => {
|
|
1366
|
+
this.phase === "pointing" && this.targetOf(o) && o.stopPropagation();
|
|
1367
|
+
},
|
|
1368
|
+
!0,
|
|
1369
|
+
!0
|
|
1370
|
+
);
|
|
1371
|
+
this.listen(window, "click", (t) => this.onClick(t), !0), this.listen(window, "scroll", () => this.reposition(), !0, !0), this.listen(window, "resize", () => this.reposition(), !1, !0), this.outbox.flush();
|
|
1372
|
+
}
|
|
1373
|
+
targetOf(t) {
|
|
1374
|
+
const o = t.composedPath();
|
|
1375
|
+
if (o.includes(this.host)) return;
|
|
1376
|
+
const n = o[0];
|
|
1377
|
+
return n instanceof Element ? n : void 0;
|
|
1378
|
+
}
|
|
1379
|
+
swallow(t) {
|
|
1380
|
+
this.phase !== "pointing" || !t.isTrusted || !this.targetOf(t) || (t.preventDefault(), t.stopPropagation());
|
|
1381
|
+
}
|
|
1382
|
+
onMove(t) {
|
|
1383
|
+
const o = this.phase === "pointing" ? this.targetOf(t) : void 0;
|
|
1384
|
+
if (!o) {
|
|
1385
|
+
this.highlight.style.display = "none";
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
const n = o.getBoundingClientRect(), i = Q(o) || ee(o);
|
|
1389
|
+
Object.assign(this.highlight.style, { display: "block", left: `${n.left}px`, top: `${n.top}px`, width: `${n.width}px`, height: `${n.height}px` }), this.highlight.classList.toggle("masked", i), this.tag.textContent = i ? "Masked" : Xe(o), this.tag.style.top = n.top < 20 ? "0" : "-18px";
|
|
1390
|
+
}
|
|
1391
|
+
onClick(t) {
|
|
1392
|
+
if (this.phase !== "pointing" || !t.isTrusted) return;
|
|
1393
|
+
const o = this.targetOf(t);
|
|
1394
|
+
o && (t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation(), this.highlight.style.display = "none", !ee(o) && this.openPopover(o, t.clientX, t.clientY));
|
|
1395
|
+
}
|
|
1396
|
+
openPopover(t, o, n) {
|
|
1397
|
+
this.phase = "composing";
|
|
1398
|
+
const i = this.screenshotsUnavailable || !this.screenshotsAllowed() ? Promise.resolve(void 0) : xo(document.body, this.maskOptions()).catch(() => {
|
|
1399
|
+
}), s = Ke(t, o, n), a = m("div", { class: "pin", "aria-hidden": "true" }, String(++this.pinCount));
|
|
1400
|
+
let r;
|
|
1401
|
+
const u = m("h2", { id: "jz-pop-title" }, "How does this feel?"), d = m("button", { type: "button", class: "close", "aria-label": "Close without sending" }, A("close")), c = m("div", { class: "chips" }), f = this.getContext(), h = _(), l = (C, z, T) => c.append(m("span", { class: "chip", "aria-label": `${z}: ${T}` }, A(C, 12), T));
|
|
1402
|
+
f.persona && l("persona", "Persona", f.persona), f.journeyStep && l("step", "Journey step", f.journeyStep);
|
|
1403
|
+
const g = m("div", { class: "reactions", role: "radiogroup", "aria-label": "Reaction" }), p = Co.map(([C, z]) => {
|
|
1404
|
+
const T = m("button", { type: "button", class: "reaction", role: "radio", "aria-checked": "false", "data-r": C }, A(C), m("span", {}, z));
|
|
1405
|
+
return T.addEventListener("click", () => {
|
|
1406
|
+
r = r === C ? void 0 : C;
|
|
1407
|
+
for (const Y of p) Y.setAttribute("aria-checked", String(Y.dataset.r === r));
|
|
1408
|
+
F();
|
|
1409
|
+
}), g.append(T), T;
|
|
1410
|
+
}), w = m("textarea", { class: "comment", "aria-label": "Comment (optional)", placeholder: "What could be improved?", maxlength: "4000" }), b = m("div", { class: "thumb hatch mono" }, "CAPTURING"), x = m("span", { class: "note" }, "Masked fields are hidden"), v = m("input", { type: "checkbox", class: "optout" }), S = m("label", { class: "optout-row", hidden: !0 }, v, "Don't include screenshot"), k = m("button", { type: "button", class: "primary" }, "Send"), E = m(
|
|
1411
|
+
"div",
|
|
1412
|
+
{ class: "pop", role: "dialog", "aria-modal": "false", "aria-labelledby": "jz-pop-title" },
|
|
1413
|
+
m("div", { class: "pop-head" }, u, d),
|
|
1414
|
+
c,
|
|
1415
|
+
g,
|
|
1416
|
+
w,
|
|
1417
|
+
S,
|
|
1418
|
+
m("div", { class: "foot" }, m("div", { class: "shot" }, b, x), k)
|
|
1419
|
+
), F = () => {
|
|
1420
|
+
k.disabled = r === void 0 && w.value.trim() === "";
|
|
1421
|
+
};
|
|
1422
|
+
w.addEventListener("input", F), F(), i.then((C) => {
|
|
1423
|
+
if (this.popover?.el === E)
|
|
1424
|
+
if (b.textContent = "", C) {
|
|
1425
|
+
const z = URL.createObjectURL(C);
|
|
1426
|
+
this.objectUrls.push(z), b.classList.remove("hatch");
|
|
1427
|
+
const T = m(
|
|
1428
|
+
"button",
|
|
1429
|
+
{ type: "button", class: "shot-open", "aria-label": "View screenshot full size" },
|
|
1430
|
+
m("img", { referrerpolicy: "no-referrer", src: z, alt: "Screenshot of this page with masked fields hidden" })
|
|
1431
|
+
);
|
|
1432
|
+
T.addEventListener("click", () => this.openFullShot(z, T)), b.append(T), S.hidden = !1;
|
|
1433
|
+
} else
|
|
1434
|
+
b.textContent = "No screenshot attached", x.textContent = "Screenshot unavailable; your feedback still sends";
|
|
1435
|
+
}), d.addEventListener("click", () => this.closePopover()), k.addEventListener("click", () => {
|
|
1436
|
+
if (k.disabled) return;
|
|
1437
|
+
k.disabled = !0;
|
|
1438
|
+
const C = w.value.trim(), z = !v.checked;
|
|
1439
|
+
this.closePopover(), this.deliver(s, r, C, z ? i : Promise.resolve(void 0), f, h);
|
|
1440
|
+
}), this.trapTab(E), this.popover = { el: E, pin: a, target: t, anchor: s }, this.layer.append(a), this.shell.append(E), this.reposition(), p[0]?.focus();
|
|
1441
|
+
}
|
|
1442
|
+
closePopover() {
|
|
1443
|
+
if (this.popover) {
|
|
1444
|
+
this.closeFullShot(), this.popover.el.remove(), this.popover.pin.remove(), this.popover = void 0;
|
|
1445
|
+
for (const t of this.objectUrls.splice(0)) URL.revokeObjectURL(t);
|
|
1446
|
+
this.phase = "pointing", this.toggle.focus();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
openFullShot(t, o) {
|
|
1450
|
+
if (this.fullShot) return;
|
|
1451
|
+
const n = m("button", { type: "button", class: "close", "aria-label": "Close full-size screenshot" }, A("close")), i = m(
|
|
1452
|
+
"div",
|
|
1453
|
+
{ class: "shot-full", role: "dialog", "aria-modal": "true", "aria-label": "Screenshot" },
|
|
1454
|
+
m("img", { referrerpolicy: "no-referrer", src: t, alt: "Screenshot of this page with masked fields hidden" }),
|
|
1455
|
+
n
|
|
1456
|
+
);
|
|
1457
|
+
n.addEventListener("click", () => this.closeFullShot()), this.trapTab(i), this.fullShot = i, this.fullShotOpener = o, this.shell.append(i), n.focus();
|
|
1458
|
+
}
|
|
1459
|
+
closeFullShot() {
|
|
1460
|
+
const t = this.fullShot;
|
|
1461
|
+
if (!t) return;
|
|
1462
|
+
this.fullShot = void 0, t.remove();
|
|
1463
|
+
const o = this.fullShotOpener;
|
|
1464
|
+
this.fullShotOpener = void 0, o?.focus();
|
|
1465
|
+
}
|
|
1466
|
+
maskOptions() {
|
|
1467
|
+
const { maskSelectors: t, maskAllText: o } = this.options;
|
|
1468
|
+
return { ...t ? { maskSelectors: t } : {}, ...o ? { maskAllText: o } : {} };
|
|
1469
|
+
}
|
|
1470
|
+
reposition() {
|
|
1471
|
+
const t = this.popover;
|
|
1472
|
+
if (!t || !t.target.isConnected) return;
|
|
1473
|
+
const o = t.target.getBoundingClientRect(), n = o.left + t.anchor.xRatio * o.width, i = o.top + t.anchor.yRatio * o.height;
|
|
1474
|
+
if (Object.assign(t.pin.style, { left: `${n}px`, top: `${i}px` }), window.innerWidth < 480) return;
|
|
1475
|
+
const s = t.el.getBoundingClientRect(), a = 16;
|
|
1476
|
+
let r = o.right + a;
|
|
1477
|
+
r + s.width > window.innerWidth - a && (r = o.left - a - s.width), r < a && (r = Math.min(Math.max(a, n + a), window.innerWidth - s.width - a));
|
|
1478
|
+
const u = Math.min(Math.max(a, i - 24), window.innerHeight - s.height - a);
|
|
1479
|
+
Object.assign(t.el.style, { left: `${Math.max(a, r)}px`, top: `${Math.max(a, u)}px` });
|
|
1480
|
+
}
|
|
1481
|
+
onContextChanged() {
|
|
1482
|
+
this.signals.contextChanged();
|
|
1483
|
+
const t = this.getContext();
|
|
1484
|
+
if (t.journeyStep === this.lastCtx.journeyStep && t.journeyId === this.lastCtx.journeyId) return;
|
|
1485
|
+
const o = this.lastCtx, n = this.lastWhere;
|
|
1486
|
+
this.lastCtx = { ...t }, this.lastWhere = _(), this.checkin?.remove(), this.checkin = void 0, this.maybeCheckin(o, n);
|
|
1487
|
+
}
|
|
1488
|
+
maybeCheckin(t, o) {
|
|
1489
|
+
const n = t, i = n.journeyStep;
|
|
1490
|
+
if (this.phase === "consent" || !i) return;
|
|
1491
|
+
const s = `${n.journeyId ?? ""}/${i}`;
|
|
1492
|
+
if (this.askedSteps.has(s)) return;
|
|
1493
|
+
this.askedSteps.add(s), this.checkin?.remove();
|
|
1494
|
+
const a = (d, c) => {
|
|
1495
|
+
const f = m("button", { type: "button", class: "secondary" }, A(d, 16), c);
|
|
1496
|
+
return f.addEventListener("click", () => {
|
|
1497
|
+
u.remove(), this.deliver(void 0, d, "", Promise.resolve(void 0), t, o);
|
|
1498
|
+
}), f;
|
|
1499
|
+
}, r = m("button", { type: "button", class: "close", "aria-label": "Dismiss" }, A("close", 16)), u = m("div", { class: "checkin", role: "group", "aria-label": "Step check-in" }, m("span", {}, "Did this step make sense?"), a("understood", "Understood"), a("confused", "Confused"), r);
|
|
1500
|
+
r.addEventListener("click", () => u.remove()), this.checkin = u, this.shell.append(u);
|
|
1501
|
+
}
|
|
1502
|
+
async deliver(t, o, n, i, s = this.getContext(), a = _()) {
|
|
1503
|
+
const r = {
|
|
1504
|
+
siteKey: this.options.siteKey,
|
|
1505
|
+
consentGiven: !0,
|
|
1506
|
+
context: zo(s, a.href, a.width, t?.tflowId)
|
|
1507
|
+
};
|
|
1508
|
+
this.options.userId !== void 0 && Object.assign(r, { userId: this.options.userId }, ue(this.options)), t && (r.anchor = t), o && (r.reaction = Ge[o]), n && (r.comment = n);
|
|
1509
|
+
const u = { request: r, stashed: !1 };
|
|
1510
|
+
this.pending.add(u);
|
|
1511
|
+
const d = await this.uploadScreenshot(i);
|
|
1512
|
+
if (this.pending.delete(u), u.stashed || this.disposed) return;
|
|
1513
|
+
d && (r.screenshotId = d);
|
|
1514
|
+
const c = await this.outbox.enqueue(r);
|
|
1515
|
+
this.disposed || (c === "sent" ? this.toast("Sent. Thank you.") : c === "queued" && this.toast("Saved. It will send when you're back online."));
|
|
1516
|
+
}
|
|
1517
|
+
stashPending() {
|
|
1518
|
+
for (const t of this.pending)
|
|
1519
|
+
t.stashed = !0, this.outbox.stash(t.request);
|
|
1520
|
+
this.pending.clear();
|
|
1521
|
+
}
|
|
1522
|
+
screenshotsAllowed() {
|
|
1523
|
+
return !!(this.options.reviewerToken || this.options.userId);
|
|
1524
|
+
}
|
|
1525
|
+
async uploadScreenshot(t) {
|
|
1526
|
+
if (!this.screenshotsUnavailable)
|
|
1527
|
+
try {
|
|
1528
|
+
let o;
|
|
1529
|
+
const n = await Promise.race([t, new Promise((d) => o = setTimeout(() => d(void 0), To))]).finally(
|
|
1530
|
+
() => clearTimeout(o)
|
|
1531
|
+
);
|
|
1532
|
+
if (!n || n.type !== "image/webp" && n.type !== "image/png") return;
|
|
1533
|
+
const i = {
|
|
1534
|
+
siteKey: this.options.siteKey,
|
|
1535
|
+
contentType: n.type,
|
|
1536
|
+
byteLength: n.size,
|
|
1537
|
+
...this.options.reviewerToken ? { reviewerToken: this.options.reviewerToken } : {},
|
|
1538
|
+
...this.options.userId ? { userId: this.options.userId, consentGiven: !0, ...ue(this.options) } : {}
|
|
1539
|
+
}, s = await Be(this.endpoint, "CreateScreenshotUpload", i), a = typeof s.uploadUrl == "string" ? jo(s.uploadUrl, this.endpoint) : void 0;
|
|
1540
|
+
if (typeof s.screenshotId != "string" || !a) return;
|
|
1541
|
+
const r = { "content-type": n.type };
|
|
1542
|
+
for (const [d, c] of Object.entries(s.headers ?? {})) typeof c == "string" && (r[d] = c);
|
|
1543
|
+
const u = await fetch(a, We({ method: "PUT", body: n, headers: r, credentials: "omit", cache: "no-store", referrerPolicy: "no-referrer" }));
|
|
1544
|
+
return this.uploadNotFound = 0, u.ok ? s.screenshotId : void 0;
|
|
1545
|
+
} catch (o) {
|
|
1546
|
+
o instanceof Z && (this.uploadNotFound = o.status === 404 ? this.uploadNotFound + 1 : 0, (o.code === "unimplemented" || this.uploadNotFound >= 3) && (this.screenshotsUnavailable = !0));
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
onKey(t) {
|
|
1551
|
+
if (t.key !== "Escape") return;
|
|
1552
|
+
const o = t.composedPath()[0];
|
|
1553
|
+
if (t.defaultPrevented || o instanceof Element && Q(o)) return;
|
|
1554
|
+
const n = document.activeElement;
|
|
1555
|
+
n && n !== document.body && n !== document.documentElement && n !== this.host || (this.popover ? this.closePopover() : this.exit());
|
|
1556
|
+
}
|
|
1557
|
+
onWidgetKey(t) {
|
|
1558
|
+
if (t.stopPropagation(), t.type !== "keydown" || t.key !== "Escape") return;
|
|
1559
|
+
if (this.fullShot) {
|
|
1560
|
+
this.closeFullShot();
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
const o = t.target;
|
|
1564
|
+
if (o instanceof HTMLTextAreaElement && o.value.trim() !== "" && this.popover) {
|
|
1565
|
+
this.popover.el.querySelector(".close")?.focus();
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
this.popover ? this.closePopover() : this.exit();
|
|
1569
|
+
}
|
|
1570
|
+
trapTab(t) {
|
|
1571
|
+
t.addEventListener("keydown", (o) => {
|
|
1572
|
+
if (o.key !== "Tab") return;
|
|
1573
|
+
const n = Array.from(t.querySelectorAll("button:not([disabled]), textarea")), i = n[0], s = n[n.length - 1], a = this.root.activeElement;
|
|
1574
|
+
!i || !s || (o.shiftKey && a === i ? (o.preventDefault(), s.focus()) : !o.shiftKey && a === s && (o.preventDefault(), i.focus()));
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
announce(t) {
|
|
1578
|
+
this.live.textContent = t;
|
|
1579
|
+
}
|
|
1580
|
+
toast(t, o = !1) {
|
|
1581
|
+
this.toastEl?.remove(), this.toastTimer !== void 0 && clearTimeout(this.toastTimer);
|
|
1582
|
+
const n = m("div", { class: o ? "toast err" : "toast", role: "status" }, t);
|
|
1583
|
+
this.toastEl = n, this.shell.append(n), this.toastTimer = setTimeout(() => n.remove(), o ? 6e3 : 3e3);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
function _() {
|
|
1587
|
+
return { href: location.href, width: window.innerWidth };
|
|
1588
|
+
}
|
|
1589
|
+
function No(e) {
|
|
1590
|
+
return e.code === "unauthenticated" ? "Open the review link from your invitation to send feedback." : e.code === "failed_precondition" ? "Consent is needed before feedback can be sent." : "This feedback couldn't be sent.";
|
|
1591
|
+
}
|
|
1592
|
+
const Mo = (e, t, o) => new Fo(e, () => De(t()), o).api();
|
|
1593
|
+
export {
|
|
1594
|
+
Lo as maskedSnapshotSvg,
|
|
1595
|
+
Mo as mount,
|
|
1596
|
+
ue as signedIdentity,
|
|
1597
|
+
jo as uploadTarget,
|
|
1598
|
+
zo as wireContext
|
|
1599
|
+
};
|