@getpinax/widget 0.0.0-stage → 1.0.0-beta.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +513 -2
  3. package/dist/a11y/scan.d.ts +25 -0
  4. package/dist/api.d.ts +83 -0
  5. package/dist/capture/breadcrumbs.d.ts +49 -0
  6. package/dist/capture/console.d.ts +17 -0
  7. package/dist/capture/env.d.ts +25 -0
  8. package/dist/capture/network.d.ts +23 -0
  9. package/dist/capture/ring.d.ts +14 -0
  10. package/dist/capture/signature.d.ts +7 -0
  11. package/dist/capture/text.d.ts +23 -0
  12. package/dist/capture/ua.d.ts +13 -0
  13. package/dist/chunks/editor-0Kr31Uly.mjs +1368 -0
  14. package/dist/chunks/privacy-B_b1_Y1n.mjs +39 -0
  15. package/dist/chunks/recorder-tu4yugLw.mjs +2874 -0
  16. package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
  17. package/dist/chunks/text-D9SaDBT0.mjs +36 -0
  18. package/dist/chunks/widget-BpTBdX2R.mjs +1272 -0
  19. package/dist/editor/annotator.d.ts +20 -0
  20. package/dist/editor/capture.d.ts +28 -0
  21. package/dist/editor/encode.d.ts +7 -0
  22. package/dist/editor/index.d.ts +5 -0
  23. package/dist/editor/mask.d.ts +29 -0
  24. package/dist/editor/pii.d.ts +22 -0
  25. package/dist/editor/shapes.d.ts +31 -0
  26. package/dist/editor-loader.d.ts +9 -0
  27. package/dist/editor-loader.embed.d.ts +6 -0
  28. package/dist/fixcheck.d.ts +42 -0
  29. package/dist/index.d.ts +85 -0
  30. package/dist/known.d.ts +27 -0
  31. package/dist/mount.d.ts +8 -0
  32. package/dist/navigation.d.ts +1 -0
  33. package/dist/paths.d.ts +4 -0
  34. package/dist/pinax-axe.js +46167 -0
  35. package/dist/pinax-editor.js +1417 -0
  36. package/dist/pinax-recorder.js +2915 -0
  37. package/dist/pinax.js +135 -0
  38. package/dist/pinax.mjs +1270 -0
  39. package/dist/preview.d.ts +48 -0
  40. package/dist/preview.mjs +67 -0
  41. package/dist/privacy.d.ts +24 -0
  42. package/dist/queue.d.ts +10 -0
  43. package/dist/replay/buffer.d.ts +40 -0
  44. package/dist/replay/recorder.d.ts +25 -0
  45. package/dist/replay/sanitize.d.ts +19 -0
  46. package/dist/report.d.ts +128 -0
  47. package/dist/segment.d.ts +31 -0
  48. package/dist/settings.d.ts +40 -0
  49. package/dist/types.d.ts +247 -0
  50. package/dist/ui/color.d.ts +7 -0
  51. package/dist/ui/dom.d.ts +14 -0
  52. package/dist/ui/styles.d.ts +3 -0
  53. package/dist/ui/widget.d.ts +241 -0
  54. package/package.json +74 -4
@@ -0,0 +1,2915 @@
1
+ // node_modules/@rrweb/record/dist/record.js
2
+ var e = Object.defineProperty, t = (t, n, r) => n in t ? e(t, n, {
3
+ enumerable: !0,
4
+ configurable: !0,
5
+ writable: !0,
6
+ value: r
7
+ }) : t[n] = r, n = (e, n, r) => t(e, typeof n == "symbol" ? n : n + "", r), r = /* @__PURE__ */ ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e[e.Asset = 7] = "Asset", e))(r || {}), i = /* @__PURE__ */ ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(i || {}), a = /* @__PURE__ */ ((e) => (e[e.MouseUp = 0] = "MouseUp", e[e.MouseDown = 1] = "MouseDown", e[e.Click = 2] = "Click", e[e.ContextMenu = 3] = "ContextMenu", e[e.DblClick = 4] = "DblClick", e[e.Focus = 5] = "Focus", e[e.Blur = 6] = "Blur", e[e.TouchStart = 7] = "TouchStart", e[e.TouchMove_Departed = 8] = "TouchMove_Departed", e[e.TouchEnd = 9] = "TouchEnd", e[e.TouchCancel = 10] = "TouchCancel", e))(a || {}), o = /* @__PURE__ */ ((e) => (e[e.Mouse = 0] = "Mouse", e[e.Pen = 1] = "Pen", e[e.Touch = 2] = "Touch", e))(o || {}), s = /* @__PURE__ */ ((e) => (e[e["2D"] = 0] = "2D", e[e.WebGL = 1] = "WebGL", e[e.WebGL2 = 2] = "WebGL2", e))(s || {}), c = /* @__PURE__ */ ((e) => (e[e.Play = 0] = "Play", e[e.Pause = 1] = "Pause", e[e.Seeked = 2] = "Seeked", e[e.VolumeChange = 3] = "VolumeChange", e[e.RateChange = 4] = "RateChange", e))(c || {}), l = /* @__PURE__ */ ((e) => (e[e.Document = 0] = "Document", e[e.DocumentType = 1] = "DocumentType", e[e.Element = 2] = "Element", e[e.Text = 3] = "Text", e[e.CDATA = 4] = "CDATA", e[e.Comment = 5] = "Comment", e))(l || {}), u = {
8
+ Node: [
9
+ "childNodes",
10
+ "parentNode",
11
+ "parentElement",
12
+ "textContent",
13
+ "ownerDocument",
14
+ "firstChild",
15
+ "lastChild",
16
+ "nextSibling",
17
+ "previousSibling"
18
+ ],
19
+ ShadowRoot: ["host", "styleSheets"],
20
+ Element: [
21
+ "shadowRoot",
22
+ "querySelector",
23
+ "querySelectorAll"
24
+ ],
25
+ MutationObserver: []
26
+ }, d = {
27
+ Node: ["contains", "getRootNode"],
28
+ ShadowRoot: ["getSelection"],
29
+ Element: [],
30
+ MutationObserver: ["constructor"]
31
+ }, f = {}, p = {}, m = () => !!globalThis.Zone;
32
+ function h(e) {
33
+ if (f[e]) return f[e];
34
+ let t = globalThis[e], n = t.prototype, r = e in u ? u[e] : void 0, i = !!(r && r.every((e) => !!(Object.getOwnPropertyDescriptor(n, e)?.get)?.toString().includes("[native code]"))), a = e in d ? d[e] : void 0, o = !!(a && a.every((e) => typeof n[e] == "function" && n[e]?.toString().includes("[native code]")));
35
+ if (i && o && !m()) return f[e] = t.prototype, t.prototype;
36
+ try {
37
+ let r = document.createElement("iframe");
38
+ r.style.display = "none", document.body.appendChild(r);
39
+ let i = r.contentWindow;
40
+ if (!i) return t.prototype;
41
+ let a = i[e].prototype;
42
+ if (!a) return r.remove(), n;
43
+ let o = navigator.userAgent;
44
+ return o.includes("Safari") && !o.includes("Chrome") ? (r.classList.add("rr-block"), r.setAttribute("__rrwebUntaintedMutationObserver", ""), p[e] = () => r.remove()) : r.remove(), f[e] = a;
45
+ } catch {
46
+ return n;
47
+ }
48
+ }
49
+ var g = {};
50
+ function _(e, t, n) {
51
+ let r = g[e]?.[n];
52
+ if (r) return r.call(t);
53
+ let i = h(e), a = Object.getOwnPropertyDescriptor(i, n)?.get;
54
+ return a ? ((g[e] || (g[e] = {}))[n] = a, a.call(t)) : t[n];
55
+ }
56
+ var v = {};
57
+ function y(e, t, n) {
58
+ let r = `${e}.${String(n)}`;
59
+ if (v[r]) return v[r].bind(t);
60
+ let i = h(e)[n];
61
+ return typeof i == "function" ? (v[r] = i, i.bind(t)) : t[n];
62
+ }
63
+ function b(e) {
64
+ return _("Node", e, "ownerDocument");
65
+ }
66
+ function x(e) {
67
+ return _("Node", e, "childNodes");
68
+ }
69
+ function S(e) {
70
+ return _("Node", e, "parentNode");
71
+ }
72
+ function C(e) {
73
+ return _("Node", e, "parentElement");
74
+ }
75
+ function w(e) {
76
+ return _("Node", e, "textContent");
77
+ }
78
+ function ee(e) {
79
+ return _("Node", e, "firstChild");
80
+ }
81
+ function T(e) {
82
+ return _("Node", e, "lastChild");
83
+ }
84
+ function E(e) {
85
+ return _("Node", e, "nextSibling");
86
+ }
87
+ function D(e) {
88
+ return _("Node", e, "previousSibling");
89
+ }
90
+ function O(e, t) {
91
+ return y("Node", e, "contains")(t);
92
+ }
93
+ function k(e) {
94
+ return y("Node", e, "getRootNode")();
95
+ }
96
+ function A(e) {
97
+ return !e || !("host" in e) ? null : _("ShadowRoot", e, "host");
98
+ }
99
+ function j(e) {
100
+ return e.styleSheets;
101
+ }
102
+ function te(e) {
103
+ return !e || !("shadowRoot" in e) ? null : _("Element", e, "shadowRoot");
104
+ }
105
+ function ne(e, t) {
106
+ return _("Element", e, "querySelector")(t);
107
+ }
108
+ function M(e, t) {
109
+ return _("Element", e, "querySelectorAll")(t);
110
+ }
111
+ function re() {
112
+ return [h("MutationObserver").constructor, p.MutationObserver ?? (() => {})];
113
+ }
114
+ var ie = Date.now;
115
+ /* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString()) || (ie = () => (/* @__PURE__ */ new Date()).getTime());
116
+ function N(e, t, n) {
117
+ try {
118
+ if (!(t in e)) return () => {};
119
+ let r = e[t], i = n(r);
120
+ return typeof i == "function" && (i.prototype = i.prototype || {}, Object.defineProperties(i, { __rrweb_original__: {
121
+ enumerable: !1,
122
+ value: r
123
+ } })), e[t] = i, () => {
124
+ e[t] = r;
125
+ };
126
+ } catch {
127
+ return () => {};
128
+ }
129
+ }
130
+ var P = {
131
+ ownerDocument: b,
132
+ childNodes: x,
133
+ parentNode: S,
134
+ parentElement: C,
135
+ textContent: w,
136
+ firstChild: ee,
137
+ lastChild: T,
138
+ nextSibling: E,
139
+ previousSibling: D,
140
+ contains: O,
141
+ getRootNode: k,
142
+ host: A,
143
+ styleSheets: j,
144
+ shadowRoot: te,
145
+ querySelector: ne,
146
+ querySelectorAll: M,
147
+ nowTimestamp: ie,
148
+ mutationObserverCtor: re,
149
+ patch: N
150
+ };
151
+ function ae(e) {
152
+ return e.nodeType === e.ELEMENT_NODE;
153
+ }
154
+ function F(e) {
155
+ let t = e && "host" in e && "mode" in e && P.host(e) || null;
156
+ return !!(t && "shadowRoot" in t && P.shadowRoot(t) === e);
157
+ }
158
+ function I(e) {
159
+ return Object.prototype.toString.call(e) === "[object ShadowRoot]";
160
+ }
161
+ function oe(e) {
162
+ return e.includes(" background-clip: text;") && !e.includes(" -webkit-background-clip: text;") && (e = e.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;")), e;
163
+ }
164
+ function se(e) {
165
+ let { cssText: t } = e;
166
+ if (t.split("\"").length < 3) return t;
167
+ let n = ["@import", `url(${JSON.stringify(e.href)})`];
168
+ return e.layerName === "" ? n.push("layer") : e.layerName && n.push(`layer(${e.layerName})`), e.supportsText && n.push(`supports(${e.supportsText})`), e.media.length && n.push(e.media.mediaText), n.join(" ") + ";";
169
+ }
170
+ function L(e) {
171
+ try {
172
+ let t = e.rules || e.cssRules;
173
+ if (!t) return null;
174
+ let n = e.href;
175
+ return !n && e.ownerNode && (n = e.ownerNode.baseURI), oe(Array.from(t, (e) => R(e, n)).join(""));
176
+ } catch {
177
+ return null;
178
+ }
179
+ }
180
+ function R(e, t) {
181
+ if (ce(e)) {
182
+ let t;
183
+ try {
184
+ t = L(e.styleSheet) || se(e);
185
+ } catch {
186
+ t = e.cssText;
187
+ }
188
+ return e.styleSheet.href ? xe(t, e.styleSheet.href) : t;
189
+ }
190
+ {
191
+ let n = e.cssText;
192
+ return B(e) && e.selectorText.includes(":") && (n = z(n)), t ? xe(n, t) : n;
193
+ }
194
+ }
195
+ function z(e) {
196
+ return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm, "$1\\$2");
197
+ }
198
+ function ce(e) {
199
+ return "styleSheet" in e;
200
+ }
201
+ function B(e) {
202
+ return "selectorText" in e;
203
+ }
204
+ var le = class {
205
+ constructor() {
206
+ n(this, "idNodeMap", /* @__PURE__ */ new Map()), n(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
207
+ }
208
+ getId(e) {
209
+ return e ? this.getMeta(e)?.id ?? -1 : -1;
210
+ }
211
+ getNode(e) {
212
+ return this.idNodeMap.get(e) || null;
213
+ }
214
+ getIds() {
215
+ return Array.from(this.idNodeMap.keys());
216
+ }
217
+ getMeta(e) {
218
+ return this.nodeMetaMap.get(e) || null;
219
+ }
220
+ removeNodeFromMap(e) {
221
+ let t = this.getId(e);
222
+ this.idNodeMap.delete(t), e.childNodes && e.childNodes.forEach((e) => this.removeNodeFromMap(e));
223
+ }
224
+ has(e) {
225
+ return this.idNodeMap.has(e);
226
+ }
227
+ hasNode(e) {
228
+ return this.nodeMetaMap.has(e);
229
+ }
230
+ add(e, t) {
231
+ let n = t.id;
232
+ this.idNodeMap.set(n, e), this.nodeMetaMap.set(e, t);
233
+ }
234
+ replace(e, t) {
235
+ let n = this.getNode(e);
236
+ if (n) {
237
+ let e = this.nodeMetaMap.get(n);
238
+ e && this.nodeMetaMap.set(t, e);
239
+ }
240
+ this.idNodeMap.set(e, t);
241
+ }
242
+ reset() {
243
+ this.idNodeMap = /* @__PURE__ */ new Map(), this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
244
+ }
245
+ };
246
+ function ue() {
247
+ return new le();
248
+ }
249
+ function de({ element: e, maskInputOptions: t, tagName: n, type: r, value: i, maskInputFn: a }) {
250
+ let o = i || "", s = r && V(r);
251
+ return (t[n.toLowerCase()] || s && t[s]) && (o = a ? a(o, e) : "*".repeat(o.length)), o;
252
+ }
253
+ function V(e) {
254
+ return e.toLowerCase();
255
+ }
256
+ var fe = "__rrweb_original__";
257
+ function pe(e) {
258
+ let t = e.getContext("2d");
259
+ if (!t) return !0;
260
+ for (let n = 0; n < e.width; n += 50) for (let r = 0; r < e.height; r += 50) {
261
+ let i = t.getImageData, a = fe in i ? i[fe] : i;
262
+ if (new Uint32Array(a.call(t, n, r, Math.min(50, e.width - n), Math.min(50, e.height - r)).data.buffer).some((e) => e !== 0)) return !1;
263
+ }
264
+ return !0;
265
+ }
266
+ function me(e) {
267
+ let t = e.type;
268
+ return e.hasAttribute("data-rr-is-password") ? "password" : t ? V(t) : null;
269
+ }
270
+ function he(e, t) {
271
+ let n;
272
+ try {
273
+ n = new URL(e, t ?? window.location.href);
274
+ } catch {
275
+ return null;
276
+ }
277
+ return n.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1] ?? null;
278
+ }
279
+ function ge(e) {
280
+ let t = "";
281
+ return t = e.indexOf("//") > -1 ? e.split("/").slice(0, 3).join("/") : e.split("/")[0], t = t.split("?")[0], t;
282
+ }
283
+ var _e = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm, ve = /^(?:[a-z+]+:)?\/\//i, ye = /^www\..*/i, be = /^(data:)([^,]*),(.*)/i;
284
+ function xe(e, t) {
285
+ return (e || "").replace(_e, (e, n, r, i, a, o) => {
286
+ let s = r || a || o, c = n || i || "";
287
+ if (!s) return e;
288
+ if (ve.test(s) || ye.test(s) || be.test(s)) return `url(${c}${s}${c})`;
289
+ if (s[0] === "/") return `url(${c}${ge(t) + s}${c})`;
290
+ let l = s.split("#")[0], u = s.substring(l.length), d = t.split("#")[0].split("/"), f = l.split("/");
291
+ d.pop();
292
+ for (let e of f) if (e === ".") continue;
293
+ else e === ".." ? d.pop() : d.push(e);
294
+ return `url(${c}${d.join("/")}${u}${c})`;
295
+ });
296
+ }
297
+ var Se = "(?:/\\*[^*]*\\*/)|[\\s;]", Ce = RegExp(`${Se}|\\b(0)px?`, "g"), we = new RegExp(Se, "g");
298
+ function Te(e, t = !1) {
299
+ return t ? e.replace(we, "") : e.replace(Ce, "$1");
300
+ }
301
+ function Ee(e, t, n = !1) {
302
+ let r = Array.from(t.childNodes), i = [], a = 0;
303
+ if (r.length > 1 && e && typeof e == "string") {
304
+ let t = Te(e, n), o = t.length / e.length;
305
+ for (let s = 1; s < r.length; s++) if (r[s].textContent && typeof r[s].textContent == "string") {
306
+ let c = Te(r[s].textContent, n), l = 3;
307
+ for (; l < c.length && (c[l].match(/[a-zA-Z0-9]/) || c.indexOf(c.substring(0, l), 1) !== -1); l++);
308
+ for (; l < c.length; l++) {
309
+ let u = c.substring(0, l), d = t.split(u), f = -1;
310
+ if (d.length === 2) f = d[0].length;
311
+ else if (d.length > 2 && d[0] === "" && r[s - 1].textContent !== "") f = t.indexOf(u, 1);
312
+ else if (d.length === 1) {
313
+ if (u = u.substring(0, u.length - 1), d = t.split(u), d.length <= 1) return i.push(e), i;
314
+ l = 101;
315
+ } else l === c.length - 1 && (f = t.indexOf(u));
316
+ if (d.length >= 2 && l > 100) {
317
+ let e = r[s - 1].textContent;
318
+ if (e && typeof e == "string") {
319
+ let n = Te(e).length;
320
+ f = t.indexOf(u, n);
321
+ }
322
+ f === -1 && (f = d[0].length);
323
+ }
324
+ if (f !== -1) {
325
+ let s = Math.floor(f / o);
326
+ for (; s > 0 && s < e.length;) {
327
+ if (a += 1, a > 50 * r.length) return i.push(e), i;
328
+ let c = Te(e.substring(0, s), n);
329
+ if (c.length === f) {
330
+ i.push(e.substring(0, s)), e = e.substring(s), t = t.substring(f);
331
+ break;
332
+ }
333
+ c.length < f ? s += Math.max(1, Math.floor((f - c.length) / o)) : s -= Math.max(1, Math.floor((c.length - f) * o));
334
+ }
335
+ break;
336
+ }
337
+ }
338
+ }
339
+ }
340
+ return i.push(e), i;
341
+ }
342
+ function De(e, t) {
343
+ return Ee(e, t).join("/* rr_split */");
344
+ }
345
+ var Oe = 1, ke = /* @__PURE__ */ RegExp("[^a-z0-9-_:]"), Ae = -2;
346
+ function je() {
347
+ return Oe++;
348
+ }
349
+ function Me(e) {
350
+ if (e instanceof HTMLFormElement) return "form";
351
+ let t = V(e.tagName);
352
+ return ke.test(t) ? "div" : t;
353
+ }
354
+ var H, Ne, Pe = /^[^ \t\n\r\u000c]+/, Fe = /^[, \t\n\r\u000c]+/;
355
+ function Ie(e, t) {
356
+ if (t.trim() === "") return t;
357
+ let n = 0;
358
+ function r(e) {
359
+ let r, i = e.exec(t.substring(n));
360
+ return i ? (r = i[0], n += r.length, r) : "";
361
+ }
362
+ let i = [];
363
+ for (; r(Fe), !(n >= t.length);) {
364
+ let a = r(Pe);
365
+ if (a.slice(-1) === ",") a = Re(e, a.substring(0, a.length - 1)), i.push(a);
366
+ else {
367
+ let r = "";
368
+ a = Re(e, a);
369
+ let o = !1;
370
+ for (;;) {
371
+ let e = t.charAt(n);
372
+ if (e === "") {
373
+ i.push((a + r).trim());
374
+ break;
375
+ }
376
+ if (o) e === ")" && (o = !1);
377
+ else {
378
+ if (e === ",") {
379
+ n += 1, i.push((a + r).trim());
380
+ break;
381
+ }
382
+ e === "(" && (o = !0);
383
+ }
384
+ r += e, n += 1;
385
+ }
386
+ }
387
+ }
388
+ return i.join(", ");
389
+ }
390
+ var Le = /* @__PURE__ */ new WeakMap();
391
+ function Re(e, t) {
392
+ return !t || t.trim() === "" ? t : Be(e, t);
393
+ }
394
+ function ze(e) {
395
+ return !!(e.tagName === "svg" || e.ownerSVGElement);
396
+ }
397
+ function Be(e, t) {
398
+ let n = Le.get(e);
399
+ if (n || (n = e.createElement("a"), Le.set(e, n)), !t) t = "";
400
+ else if (t.startsWith("blob:") || t.startsWith("data:")) return t;
401
+ return n.setAttribute("href", t), n.href;
402
+ }
403
+ function Ve(e, t, n, r) {
404
+ return r && (n === "src" || n === "href" && (t !== "use" || r[0] !== "#") || n === "xlink:href" && r[0] !== "#" || n === "background" && [
405
+ "table",
406
+ "td",
407
+ "th"
408
+ ].includes(t) ? Re(e, r) : n === "srcset" ? Ie(e, r) : n === "style" ? xe(r, Be(e)) : t === "object" && n === "data" ? Re(e, r) : r);
409
+ }
410
+ function He(e, t, n) {
411
+ return ["video", "audio"].includes(e) && V(t) === "autoplay";
412
+ }
413
+ function Ue(e, t, n) {
414
+ try {
415
+ if (typeof t == "string") {
416
+ if (e.classList.contains(t)) return !0;
417
+ } else for (let n = e.classList.length; n--;) {
418
+ let r = e.classList[n];
419
+ if (t.test(r)) return !0;
420
+ }
421
+ if (n) return e.matches(n);
422
+ } catch {}
423
+ return !1;
424
+ }
425
+ function We(e, t, n) {
426
+ if (!e) return !1;
427
+ if (e.nodeType !== e.ELEMENT_NODE) return n ? We(P.parentNode(e), t, n) : !1;
428
+ for (let n = e.classList.length; n--;) {
429
+ let r = e.classList[n];
430
+ if (t.test(r)) return !0;
431
+ }
432
+ return n ? We(P.parentNode(e), t, n) : !1;
433
+ }
434
+ function Ge(e, t, n, r) {
435
+ let i;
436
+ if (ae(e)) {
437
+ if (i = e, !P.childNodes(i).length) return !1;
438
+ } else if (P.parentElement(e) === null) return !1;
439
+ else i = P.parentElement(e);
440
+ try {
441
+ if (typeof t == "string") {
442
+ if (r) {
443
+ if (i.closest(`.${t}`)) return !0;
444
+ } else if (i.classList.contains(t)) return !0;
445
+ } else if (We(i, t, r)) return !0;
446
+ if (n) {
447
+ if (r) {
448
+ if (i.closest(n)) return !0;
449
+ } else if (i.matches(n)) return !0;
450
+ }
451
+ } catch {}
452
+ return !1;
453
+ }
454
+ function Ke(e, t, n) {
455
+ let r = e.contentWindow;
456
+ if (!r) return;
457
+ let i = !1, a;
458
+ try {
459
+ a = r.document.readyState;
460
+ } catch {
461
+ return;
462
+ }
463
+ if (a !== "complete") {
464
+ let r = setTimeout(() => {
465
+ i || (t(), i = !0);
466
+ }, n);
467
+ e.addEventListener("load", () => {
468
+ clearTimeout(r), i = !0, t();
469
+ });
470
+ return;
471
+ }
472
+ let o = "about:blank";
473
+ if (r.location.href !== o || e.src === o || e.src === "") return setTimeout(t, 0), e.addEventListener("load", t);
474
+ e.addEventListener("load", t);
475
+ }
476
+ function qe(e, t, n) {
477
+ let r = !1, i;
478
+ try {
479
+ i = e.sheet;
480
+ } catch {
481
+ return;
482
+ }
483
+ if (i) return;
484
+ let a = setTimeout(() => {
485
+ r || (t(), r = !0);
486
+ }, n);
487
+ e.addEventListener("load", () => {
488
+ clearTimeout(a), r = !0, t();
489
+ });
490
+ }
491
+ function Je(e, t) {
492
+ let { doc: n, mirror: r, blockClass: i, blockSelector: a, needsMask: o, inlineStylesheet: s, maskInputOptions: c = {}, maskTextFn: u, maskInputFn: d, dataURLOptions: f = {}, inlineImages: p, recordCanvas: m, keepIframeSrcFn: h, newlyAddedElement: g = !1, cssCaptured: _ = !1 } = t, v = Ye(n, r);
493
+ switch (e.nodeType) {
494
+ case e.DOCUMENT_NODE: return e.compatMode === "CSS1Compat" ? {
495
+ type: l.Document,
496
+ childNodes: []
497
+ } : {
498
+ type: l.Document,
499
+ childNodes: [],
500
+ compatMode: e.compatMode
501
+ };
502
+ case e.DOCUMENT_TYPE_NODE: return {
503
+ type: l.DocumentType,
504
+ name: e.name,
505
+ publicId: e.publicId,
506
+ systemId: e.systemId,
507
+ rootId: v
508
+ };
509
+ case e.ELEMENT_NODE: return Ze(e, {
510
+ doc: n,
511
+ blockClass: i,
512
+ blockSelector: a,
513
+ inlineStylesheet: s,
514
+ maskInputOptions: c,
515
+ maskInputFn: d,
516
+ dataURLOptions: f,
517
+ inlineImages: p,
518
+ recordCanvas: m,
519
+ keepIframeSrcFn: h,
520
+ newlyAddedElement: g,
521
+ rootId: v
522
+ });
523
+ case e.TEXT_NODE: return Xe(e, {
524
+ doc: n,
525
+ needsMask: o,
526
+ maskTextFn: u,
527
+ rootId: v,
528
+ cssCaptured: _
529
+ });
530
+ case e.CDATA_SECTION_NODE: return {
531
+ type: l.CDATA,
532
+ textContent: "",
533
+ rootId: v
534
+ };
535
+ case e.COMMENT_NODE: return {
536
+ type: l.Comment,
537
+ textContent: P.textContent(e) || "",
538
+ rootId: v
539
+ };
540
+ default: return !1;
541
+ }
542
+ }
543
+ function Ye(e, t) {
544
+ if (!t.hasNode(e)) return;
545
+ let n = t.getId(e);
546
+ return n === 1 ? void 0 : n;
547
+ }
548
+ function Xe(e, t) {
549
+ let { needsMask: n, maskTextFn: r, rootId: i, cssCaptured: a } = t, o = P.parentNode(e), s = o && o.tagName, c = "", u = s === "STYLE" || void 0, d = s === "SCRIPT" || void 0;
550
+ return d ? c = "SCRIPT_PLACEHOLDER" : a || (c = P.textContent(e), u && c && (c = xe(c, Be(t.doc)))), !u && !d && c && n && (c = r ? r(c, P.parentElement(e)) : c.replace(/[\S]/g, "*")), {
551
+ type: l.Text,
552
+ textContent: c || "",
553
+ rootId: i
554
+ };
555
+ }
556
+ function Ze(e, t) {
557
+ let { doc: n, blockClass: r, blockSelector: i, inlineStylesheet: a, maskInputOptions: o = {}, maskInputFn: s, dataURLOptions: c = {}, inlineImages: u, recordCanvas: d, keepIframeSrcFn: f, newlyAddedElement: p = !1, rootId: m } = t, h = Ue(e, r, i), g = Me(e), _ = {}, v = e.attributes.length;
558
+ for (let t = 0; t < v; t++) {
559
+ let r = e.attributes[t];
560
+ He(g, r.name, r.value) || (_[r.name] = Ve(n, g, V(r.name), r.value));
561
+ }
562
+ if (g === "link" && a) {
563
+ let t = Array.from(n.styleSheets).find((t) => t.href === e.href), r = null;
564
+ t && (r = L(t)), r && (delete _.rel, delete _.href, _._cssText = r);
565
+ }
566
+ if (g === "style" && e.sheet) {
567
+ let t = L(e.sheet);
568
+ t && (e.childNodes.length > 1 && (t = De(t, e)), _._cssText = t);
569
+ }
570
+ if ([
571
+ "input",
572
+ "textarea",
573
+ "select"
574
+ ].includes(g)) {
575
+ let t = e.value, n = e.checked;
576
+ _.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && t ? _.value = de({
577
+ element: e,
578
+ type: me(e),
579
+ tagName: g,
580
+ value: t,
581
+ maskInputOptions: o,
582
+ maskInputFn: s
583
+ }) : n && (_.checked = n);
584
+ }
585
+ if (g === "option" && (e.selected && !o.select ? _.selected = !0 : delete _.selected), g === "dialog" && e.open && (_.rr_open_mode = e.matches("dialog:modal") ? "modal" : "non-modal"), g === "canvas" && d) {
586
+ if (e.__context === "2d") pe(e) || (_.rr_dataURL = e.toDataURL(c.type, c.quality));
587
+ else if (!("__context" in e)) {
588
+ let t = e.toDataURL(c.type, c.quality), r = n.createElement("canvas");
589
+ r.width = e.width, r.height = e.height, t !== r.toDataURL(c.type, c.quality) && (_.rr_dataURL = t);
590
+ }
591
+ }
592
+ if (g === "img" && u) {
593
+ H || (H = n.createElement("canvas"), Ne = H.getContext("2d"));
594
+ let t = e, r = t.currentSrc || t.getAttribute("src") || "<unknown-src>", i = t.crossOrigin, a = () => {
595
+ t.removeEventListener("load", a);
596
+ try {
597
+ H.width = t.naturalWidth, H.height = t.naturalHeight, Ne.drawImage(t, 0, 0), _.rr_dataURL = H.toDataURL(c.type, c.quality);
598
+ } catch (e) {
599
+ if (t.crossOrigin !== "anonymous") {
600
+ t.crossOrigin = "anonymous", t.complete && t.naturalWidth !== 0 ? a() : t.addEventListener("load", a);
601
+ return;
602
+ }
603
+ console.warn(`Cannot inline img src=${r}! Error: ${e}`);
604
+ }
605
+ t.crossOrigin === "anonymous" && (i ? _.crossOrigin = i : t.removeAttribute("crossorigin"));
606
+ };
607
+ t.complete && t.naturalWidth !== 0 ? a() : t.addEventListener("load", a);
608
+ }
609
+ if (["audio", "video"].includes(g)) {
610
+ let t = _;
611
+ t.rr_mediaState = e.paused ? "paused" : "played", t.rr_mediaCurrentTime = e.currentTime, t.rr_mediaPlaybackRate = e.playbackRate, t.rr_mediaMuted = e.muted, t.rr_mediaLoop = e.loop, t.rr_mediaVolume = e.volume;
612
+ }
613
+ if (p || (e.scrollLeft && (_.rr_scrollLeft = e.scrollLeft), e.scrollTop && (_.rr_scrollTop = e.scrollTop)), h) {
614
+ let { width: t, height: n } = e.getBoundingClientRect();
615
+ _ = {
616
+ class: _.class,
617
+ rr_width: `${t}px`,
618
+ rr_height: `${n}px`
619
+ };
620
+ }
621
+ g === "iframe" && !f(_.src) && (e.contentDocument || (_.rr_src = _.src), delete _.src);
622
+ let y;
623
+ try {
624
+ customElements.get(g) && (y = !0);
625
+ } catch {}
626
+ return {
627
+ type: l.Element,
628
+ tagName: g,
629
+ attributes: _,
630
+ childNodes: [],
631
+ isSVG: ze(e) || void 0,
632
+ needBlock: h,
633
+ rootId: m,
634
+ isCustom: y
635
+ };
636
+ }
637
+ function U(e) {
638
+ return e == null ? "" : e.toLowerCase();
639
+ }
640
+ function Qe(e) {
641
+ return e === !0 || e === "all" ? {
642
+ script: !0,
643
+ comment: !0,
644
+ headFavicon: !0,
645
+ headWhitespace: !0,
646
+ headMetaSocial: !0,
647
+ headMetaRobots: !0,
648
+ headMetaHttpEquiv: !0,
649
+ headMetaVerification: !0,
650
+ headMetaAuthorship: e === "all",
651
+ headMetaDescKeywords: e === "all",
652
+ headTitleMutations: e === "all"
653
+ } : e || {};
654
+ }
655
+ function $e(e, t) {
656
+ return !!(t.comment && e.type === l.Comment || e.type === l.Element && (t.script && (e.tagName === "script" || e.tagName === "link" && (e.attributes.rel === "preload" && e.attributes.as === "script" || e.attributes.rel === "modulepreload") || e.tagName === "link" && e.attributes.rel === "prefetch" && typeof e.attributes.href == "string" && he(e.attributes.href) === "js") || t.headFavicon && (e.tagName === "link" && e.attributes.rel === "shortcut icon" || e.tagName === "meta" && (U(e.attributes.name).match(/^msapplication-tile(image|color)$/) || U(e.attributes.name) === "application-name" || U(e.attributes.rel) === "icon" || U(e.attributes.rel) === "apple-touch-icon" || U(e.attributes.rel) === "shortcut icon")) || e.tagName === "meta" && (t.headMetaDescKeywords && U(e.attributes.name).match(/^description|keywords$/) || t.headMetaSocial && (U(e.attributes.property).match(/^(og|twitter|fb):/) || U(e.attributes.name).match(/^(og|twitter):/) || U(e.attributes.name) === "pinterest") || t.headMetaRobots && (U(e.attributes.name) === "robots" || U(e.attributes.name) === "googlebot" || U(e.attributes.name) === "bingbot") || t.headMetaHttpEquiv && e.attributes["http-equiv"] !== void 0 || t.headMetaAuthorship && (U(e.attributes.name) === "author" || U(e.attributes.name) === "generator" || U(e.attributes.name) === "framework" || U(e.attributes.name) === "publisher" || U(e.attributes.name) === "progid" || U(e.attributes.property).match(/^article:/) || U(e.attributes.property).match(/^product:/)) || t.headMetaVerification && (U(e.attributes.name) === "google-site-verification" || U(e.attributes.name) === "yandex-verification" || U(e.attributes.name) === "csrf-token" || U(e.attributes.name) === "p:domain_verify" || U(e.attributes.name) === "verify-v1" || U(e.attributes.name) === "verification" || U(e.attributes.name) === "shopify-checkout-api-token"))));
657
+ }
658
+ function W(e, t) {
659
+ let { doc: n, mirror: r, blockClass: i, blockSelector: a, maskTextClass: o, maskTextSelector: s, skipChild: c = !1, inlineStylesheet: u = !0, maskInputOptions: d = {}, maskTextFn: f, maskInputFn: p, slimDOMOptions: m, dataURLOptions: h = {}, inlineImages: g = !1, recordCanvas: _ = !1, onSerialize: v, onIframeLoad: y, iframeLoadTimeout: b = 5e3, onStylesheetLoad: x, stylesheetLoadTimeout: S = 5e3, keepIframeSrcFn: C = () => !1, newlyAddedElement: w = !1, cssCaptured: ee = !1 } = t, { needsMask: T } = t, { preserveWhiteSpace: E = !0 } = t;
660
+ T || (T = Ge(e, o, s, T === void 0));
661
+ let D = Je(e, {
662
+ doc: n,
663
+ mirror: r,
664
+ blockClass: i,
665
+ blockSelector: a,
666
+ needsMask: T,
667
+ inlineStylesheet: u,
668
+ maskInputOptions: d,
669
+ maskTextFn: f,
670
+ maskInputFn: p,
671
+ dataURLOptions: h,
672
+ inlineImages: g,
673
+ recordCanvas: _,
674
+ keepIframeSrcFn: C,
675
+ newlyAddedElement: w,
676
+ cssCaptured: ee
677
+ });
678
+ if (!D) return console.warn(e, "not serialized"), null;
679
+ let O;
680
+ O = r.hasNode(e) ? r.getId(e) : $e(D, m) || !E && D.type === l.Text && !D.textContent.replace(/^\s+|\s+$/gm, "").length ? Ae : je();
681
+ let k = Object.assign(D, { id: O });
682
+ if (r.add(e, k), O === Ae) return null;
683
+ v && v(e);
684
+ let A = !c;
685
+ if (k.type === l.Element) {
686
+ A = A && !k.needBlock, delete k.needBlock;
687
+ let t = P.shadowRoot(e);
688
+ t && I(t) && (k.isShadowHost = !0);
689
+ }
690
+ if ((k.type === l.Document || k.type === l.Element) && A) {
691
+ m.headWhitespace && k.type === l.Element && k.tagName === "head" && (E = !1);
692
+ let t = {
693
+ doc: n,
694
+ mirror: r,
695
+ blockClass: i,
696
+ blockSelector: a,
697
+ needsMask: T,
698
+ maskTextClass: o,
699
+ maskTextSelector: s,
700
+ skipChild: c,
701
+ inlineStylesheet: u,
702
+ maskInputOptions: d,
703
+ maskTextFn: f,
704
+ maskInputFn: p,
705
+ slimDOMOptions: m,
706
+ dataURLOptions: h,
707
+ inlineImages: g,
708
+ recordCanvas: _,
709
+ preserveWhiteSpace: E,
710
+ onSerialize: v,
711
+ onIframeLoad: y,
712
+ iframeLoadTimeout: b,
713
+ onStylesheetLoad: x,
714
+ stylesheetLoadTimeout: S,
715
+ keepIframeSrcFn: C,
716
+ cssCaptured: !1
717
+ };
718
+ if (k.type !== l.Element || k.tagName !== "textarea" || k.attributes.value === void 0) {
719
+ k.type === l.Element && k.attributes._cssText !== void 0 && typeof k.attributes._cssText == "string" && (t.cssCaptured = !0);
720
+ for (let n of Array.from(P.childNodes(e))) {
721
+ let e = W(n, t);
722
+ e && k.childNodes.push(e);
723
+ }
724
+ }
725
+ let w = null;
726
+ if (ae(e) && (w = P.shadowRoot(e))) for (let e of Array.from(P.childNodes(w))) {
727
+ let n = W(e, t);
728
+ n && (I(w) && (n.isShadow = !0), k.childNodes.push(n));
729
+ }
730
+ }
731
+ let j = P.parentNode(e);
732
+ return j && F(j) && I(j) && (k.isShadow = !0), k.type === l.Element && k.tagName === "iframe" && Ke(e, () => {
733
+ let t = e.contentDocument;
734
+ if (t && y) {
735
+ let n = W(t, {
736
+ doc: t,
737
+ mirror: r,
738
+ blockClass: i,
739
+ blockSelector: a,
740
+ needsMask: T,
741
+ maskTextClass: o,
742
+ maskTextSelector: s,
743
+ skipChild: !1,
744
+ inlineStylesheet: u,
745
+ maskInputOptions: d,
746
+ maskTextFn: f,
747
+ maskInputFn: p,
748
+ slimDOMOptions: m,
749
+ dataURLOptions: h,
750
+ inlineImages: g,
751
+ recordCanvas: _,
752
+ preserveWhiteSpace: E,
753
+ onSerialize: v,
754
+ onIframeLoad: y,
755
+ iframeLoadTimeout: b,
756
+ onStylesheetLoad: x,
757
+ stylesheetLoadTimeout: S,
758
+ keepIframeSrcFn: C
759
+ });
760
+ n && y(e, n);
761
+ }
762
+ }, b), k.type === l.Element && k.tagName === "link" && typeof k.attributes.rel == "string" && (k.attributes.rel === "stylesheet" || k.attributes.rel === "preload" && typeof k.attributes.href == "string" && he(k.attributes.href) === "css") && qe(e, () => {
763
+ if (x) {
764
+ let t = W(e, {
765
+ doc: n,
766
+ mirror: r,
767
+ blockClass: i,
768
+ blockSelector: a,
769
+ needsMask: T,
770
+ maskTextClass: o,
771
+ maskTextSelector: s,
772
+ skipChild: !1,
773
+ inlineStylesheet: u,
774
+ maskInputOptions: d,
775
+ maskTextFn: f,
776
+ maskInputFn: p,
777
+ slimDOMOptions: m,
778
+ dataURLOptions: h,
779
+ inlineImages: g,
780
+ recordCanvas: _,
781
+ preserveWhiteSpace: E,
782
+ onSerialize: v,
783
+ onIframeLoad: y,
784
+ iframeLoadTimeout: b,
785
+ onStylesheetLoad: x,
786
+ stylesheetLoadTimeout: S,
787
+ keepIframeSrcFn: C
788
+ });
789
+ t && x(e, t);
790
+ }
791
+ }, S), k;
792
+ }
793
+ function et(e, t) {
794
+ let { mirror: n = new le(), blockClass: r = "rr-block", blockSelector: i = null, maskTextClass: a = "rr-mask", maskTextSelector: o = null, inlineStylesheet: s = !0, inlineImages: c = !1, recordCanvas: l = !1, maskAllInputs: u = !1, maskTextFn: d, maskInputFn: f, slimDOM: p = !1, dataURLOptions: m, preserveWhiteSpace: h, onSerialize: g, onIframeLoad: _, iframeLoadTimeout: v, onStylesheetLoad: y, stylesheetLoadTimeout: b, keepIframeSrcFn: x = () => !1 } = t;
795
+ return W(e, {
796
+ doc: e,
797
+ mirror: n,
798
+ blockClass: r,
799
+ blockSelector: i,
800
+ maskTextClass: a,
801
+ maskTextSelector: o,
802
+ skipChild: !1,
803
+ inlineStylesheet: s,
804
+ maskInputOptions: u === !0 ? {
805
+ color: !0,
806
+ date: !0,
807
+ "datetime-local": !0,
808
+ email: !0,
809
+ month: !0,
810
+ number: !0,
811
+ range: !0,
812
+ search: !0,
813
+ tel: !0,
814
+ text: !0,
815
+ time: !0,
816
+ url: !0,
817
+ week: !0,
818
+ textarea: !0,
819
+ select: !0,
820
+ password: !0
821
+ } : u === !1 ? { password: !0 } : u,
822
+ maskTextFn: d,
823
+ maskInputFn: f,
824
+ slimDOMOptions: Qe(p),
825
+ dataURLOptions: m,
826
+ inlineImages: c,
827
+ recordCanvas: l,
828
+ preserveWhiteSpace: h,
829
+ onSerialize: g,
830
+ onIframeLoad: _,
831
+ iframeLoadTimeout: v,
832
+ onStylesheetLoad: y,
833
+ stylesheetLoadTimeout: b,
834
+ keepIframeSrcFn: x,
835
+ newlyAddedElement: !1
836
+ });
837
+ }
838
+ var tt = class e {
839
+ constructor(...e) {
840
+ n(this, "parentElement", null), n(this, "parentNode", null), n(this, "ownerDocument"), n(this, "firstChild", null), n(this, "lastChild", null), n(this, "previousSibling", null), n(this, "nextSibling", null), n(this, "ELEMENT_NODE", 1), n(this, "TEXT_NODE", 3), n(this, "nodeType"), n(this, "nodeName"), n(this, "RRNodeType");
841
+ }
842
+ get childNodes() {
843
+ let e = [], t = this.firstChild;
844
+ for (; t;) e.push(t), t = t.nextSibling;
845
+ return e;
846
+ }
847
+ contains(t) {
848
+ if (!(t instanceof e) || t.ownerDocument !== this.ownerDocument) return !1;
849
+ if (t === this) return !0;
850
+ for (; t.parentNode;) {
851
+ if (t.parentNode === this) return !0;
852
+ t = t.parentNode;
853
+ }
854
+ return !1;
855
+ }
856
+ appendChild(e) {
857
+ throw Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.");
858
+ }
859
+ insertBefore(e, t) {
860
+ throw Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.");
861
+ }
862
+ removeChild(e) {
863
+ throw Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.");
864
+ }
865
+ toString() {
866
+ return "RRNode";
867
+ }
868
+ };
869
+ function G(e, t, n = document) {
870
+ let r = {
871
+ capture: !0,
872
+ passive: !0
873
+ };
874
+ return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
875
+ }
876
+ var K = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.", nt = {
877
+ map: {},
878
+ getId() {
879
+ return console.error(K), -1;
880
+ },
881
+ getNode() {
882
+ return console.error(K), null;
883
+ },
884
+ removeNodeFromMap() {
885
+ console.error(K);
886
+ },
887
+ has() {
888
+ return console.error(K), !1;
889
+ },
890
+ reset() {
891
+ console.error(K);
892
+ }
893
+ };
894
+ typeof window < "u" && window.Proxy && window.Reflect && (nt = new Proxy(nt, { get(e, t, n) {
895
+ return t === "map" && console.error(K), Reflect.get(e, t, n);
896
+ } }));
897
+ function rt(e, t, n = {}) {
898
+ let r = null, i = 0;
899
+ return function(...a) {
900
+ let o = Date.now();
901
+ !i && n.leading === !1 && (i = o);
902
+ let s = t - (o - i), c = this;
903
+ s <= 0 || s > t ? (r && (clearTimeout(r), r = null), i = o, e.apply(c, a)) : !r && n.trailing !== !1 && (r = setTimeout(() => {
904
+ i = n.leading === !1 ? 0 : Date.now(), r = null, e.apply(c, a);
905
+ }, s));
906
+ };
907
+ }
908
+ function it(e, t, n, r, i = window) {
909
+ let a = i.Object.getOwnPropertyDescriptor(e, t);
910
+ return i.Object.defineProperty(e, t, r ? n : { set(e) {
911
+ setTimeout(() => {
912
+ n.set.call(this, e);
913
+ }, 0), a && a.set && a.set.call(this, e);
914
+ } }), () => it(e, t, a || {}, !0);
915
+ }
916
+ function at(e) {
917
+ let t = e.document;
918
+ return {
919
+ left: t.scrollingElement ? t.scrollingElement.scrollLeft : e.pageXOffset === void 0 ? t.documentElement.scrollLeft || t?.body && P.parentElement(t.body)?.scrollLeft || t?.body?.scrollLeft || 0 : e.pageXOffset,
920
+ top: t.scrollingElement ? t.scrollingElement.scrollTop : e.pageYOffset === void 0 ? t?.documentElement.scrollTop || t?.body && P.parentElement(t.body)?.scrollTop || t?.body?.scrollTop || 0 : e.pageYOffset
921
+ };
922
+ }
923
+ function ot() {
924
+ return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
925
+ }
926
+ function st() {
927
+ return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
928
+ }
929
+ function ct(e) {
930
+ return e ? e.nodeType === e.ELEMENT_NODE ? e : P.parentElement(e) : null;
931
+ }
932
+ function q(e, t, n, r) {
933
+ if (!e) return !1;
934
+ let i = ct(e);
935
+ if (!i) return !1;
936
+ try {
937
+ if (typeof t == "string") {
938
+ if (i.classList.contains(t) || r && i.closest("." + t) !== null) return !0;
939
+ } else if (We(i, t, r)) return !0;
940
+ } catch {}
941
+ return !!(n && (i.matches(n) || r && i.closest(n) !== null));
942
+ }
943
+ function lt(e, t) {
944
+ return t.getId(e) !== -1;
945
+ }
946
+ function ut(e, t, n) {
947
+ return e.tagName === "TITLE" && n.headTitleMutations ? !0 : t.getId(e) === Ae;
948
+ }
949
+ function dt(e, t) {
950
+ if (F(e)) return !1;
951
+ let n = t.getId(e);
952
+ if (!t.has(n)) return !0;
953
+ let r = P.parentNode(e);
954
+ return r && r.nodeType === e.DOCUMENT_NODE ? !1 : !r || dt(r, t);
955
+ }
956
+ function ft(e) {
957
+ return !!e.changedTouches;
958
+ }
959
+ function pt(e = window) {
960
+ "NodeList" in e && !e.NodeList.prototype.forEach && (e.NodeList.prototype.forEach = Array.prototype.forEach), "DOMTokenList" in e && !e.DOMTokenList.prototype.forEach && (e.DOMTokenList.prototype.forEach = Array.prototype.forEach);
961
+ }
962
+ function mt(e, t) {
963
+ return !!(e.nodeName === "IFRAME" && t.getMeta(e));
964
+ }
965
+ function ht(e, t) {
966
+ return !!(e.nodeName === "LINK" && e.nodeType === e.ELEMENT_NODE && e.getAttribute && e.getAttribute("rel") === "stylesheet" && t.getMeta(e));
967
+ }
968
+ function gt(e) {
969
+ return e ? e instanceof tt && "shadowRoot" in e ? !!e.shadowRoot : !!P.shadowRoot(e) : !1;
970
+ }
971
+ var _t = class {
972
+ constructor() {
973
+ n(this, "id", 1), n(this, "styleIDMap", /* @__PURE__ */ new WeakMap()), n(this, "idStyleMap", /* @__PURE__ */ new Map());
974
+ }
975
+ getId(e) {
976
+ return this.styleIDMap.get(e) ?? -1;
977
+ }
978
+ has(e) {
979
+ return this.styleIDMap.has(e);
980
+ }
981
+ add(e, t) {
982
+ if (this.has(e)) return this.getId(e);
983
+ let n;
984
+ return n = t === void 0 ? this.id++ : t, this.styleIDMap.set(e, n), this.idStyleMap.set(n, e), n;
985
+ }
986
+ getStyle(e) {
987
+ return this.idStyleMap.get(e) || null;
988
+ }
989
+ reset() {
990
+ this.styleIDMap = /* @__PURE__ */ new WeakMap(), this.idStyleMap = /* @__PURE__ */ new Map(), this.id = 1;
991
+ }
992
+ generateId() {
993
+ return this.id++;
994
+ }
995
+ };
996
+ function vt(e) {
997
+ let t = null;
998
+ return "getRootNode" in e && P.getRootNode(e)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && P.host(P.getRootNode(e)) && (t = P.host(P.getRootNode(e))), t;
999
+ }
1000
+ function yt(e) {
1001
+ let t = e, n;
1002
+ for (; n = vt(t);) t = n;
1003
+ return t;
1004
+ }
1005
+ function bt(e) {
1006
+ let t = P.ownerDocument(e);
1007
+ if (!t) return !1;
1008
+ let n = yt(e);
1009
+ return P.contains(t, n);
1010
+ }
1011
+ function xt(e) {
1012
+ let t = P.ownerDocument(e);
1013
+ return t ? P.contains(t, e) || bt(e) : !1;
1014
+ }
1015
+ var St = (e, t) => `${e}@${t}`, Ct = class {
1016
+ constructor() {
1017
+ n(this, "frozen", !1), n(this, "locked", !1), n(this, "texts", []), n(this, "attributes", []), n(this, "attributeMap", /* @__PURE__ */ new WeakMap()), n(this, "removes", []), n(this, "mapRemoves", []), n(this, "movedMap", {}), n(this, "addedSet", /* @__PURE__ */ new Set()), n(this, "movedSet", /* @__PURE__ */ new Set()), n(this, "droppedSet", /* @__PURE__ */ new Set()), n(this, "removesSubTreeCache", /* @__PURE__ */ new Set()), n(this, "mutationCb"), n(this, "blockClass"), n(this, "blockSelector"), n(this, "maskTextClass"), n(this, "maskTextSelector"), n(this, "inlineStylesheet"), n(this, "maskInputOptions"), n(this, "maskTextFn"), n(this, "maskInputFn"), n(this, "keepIframeSrcFn"), n(this, "recordCanvas"), n(this, "inlineImages"), n(this, "slimDOMOptions"), n(this, "dataURLOptions"), n(this, "doc"), n(this, "mirror"), n(this, "iframeManager"), n(this, "stylesheetManager"), n(this, "shadowDomManager"), n(this, "canvasManager"), n(this, "processedNodeManager"), n(this, "unattachedDoc"), n(this, "processMutations", (e) => {
1018
+ e.forEach(this.processMutation), this.emit();
1019
+ }), n(this, "emit", () => {
1020
+ if (this.frozen || this.locked) return;
1021
+ let e = [], t = /* @__PURE__ */ new Set();
1022
+ for (; this.mapRemoves.length;) this.mirror.removeNodeFromMap(this.mapRemoves.shift());
1023
+ for (let e of this.movedSet) {
1024
+ let t = P.parentNode(e);
1025
+ (!this.removesSubTreeCache.has(t) || this.movedSet.has(t)) && this.addedSet.add(e);
1026
+ }
1027
+ let n = null, r = null, i = -1, a = null, o = !1, s = /* @__PURE__ */ new Set(), c = this.addedSet.values(), l = c.next();
1028
+ for (; this.addedSet.size;) {
1029
+ if (n !== null && this.addedSet.has(P.previousSibling(n))) a = n, n = P.previousSibling(n);
1030
+ else {
1031
+ for (this.addedSet.has(l.value) || (l = c.next()), n = l.value; r = P.parentNode(n), this.addedSet.has(r);) n = r;
1032
+ if (s.has(r)) r = null;
1033
+ else if (r) {
1034
+ if (xt(r) ? (o = Et(this.droppedSet, r) || this.removesSubTreeCache.has(r), o && Et(this.movedSet, n) && (o = !1)) : o = !0, this.addedSet.has(P.lastChild(r))) n = P.lastChild(r), a = null;
1035
+ else for (; a = P.nextSibling(n), this.addedSet.has(a);) n = a;
1036
+ if (i = F(r) ? this.mirror.getId(vt(n)) : this.mirror.getId(r), i === -1 && r.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1037
+ let e = P.host(r);
1038
+ i = this.mirror.getId(e);
1039
+ }
1040
+ }
1041
+ }
1042
+ if (this.addedSet.delete(n), !r || i === -1) {
1043
+ s.add(n);
1044
+ continue;
1045
+ }
1046
+ if (o) {
1047
+ this.droppedSet.add(n);
1048
+ continue;
1049
+ }
1050
+ let u = !1;
1051
+ if (n.nodeType === Node.TEXT_NODE) {
1052
+ let e = r.tagName;
1053
+ if (e === "TEXTAREA") continue;
1054
+ e === "STYLE" && t.has(i) && (u = !0);
1055
+ }
1056
+ let d = a ? this.mirror.getId(a) : null;
1057
+ for (; d === Ae;) a = a && P.nextSibling(a), d = a && this.mirror.getId(a);
1058
+ if (d === -1) {
1059
+ console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:", a), n = null;
1060
+ continue;
1061
+ }
1062
+ let f = W(n, {
1063
+ doc: this.doc,
1064
+ mirror: this.mirror,
1065
+ blockClass: this.blockClass,
1066
+ blockSelector: this.blockSelector,
1067
+ maskTextClass: this.maskTextClass,
1068
+ maskTextSelector: this.maskTextSelector,
1069
+ skipChild: !0,
1070
+ newlyAddedElement: !0,
1071
+ inlineStylesheet: this.inlineStylesheet,
1072
+ maskInputOptions: this.maskInputOptions,
1073
+ maskTextFn: this.maskTextFn,
1074
+ maskInputFn: this.maskInputFn,
1075
+ slimDOMOptions: this.slimDOMOptions,
1076
+ dataURLOptions: this.dataURLOptions,
1077
+ recordCanvas: this.recordCanvas,
1078
+ inlineImages: this.inlineImages,
1079
+ onSerialize: (e) => {
1080
+ mt(e, this.mirror) && this.iframeManager.addIframe(e), ht(e, this.mirror) && this.stylesheetManager.trackLinkElement(e), gt(n) && this.shadowDomManager.addShadowRoot(P.shadowRoot(n), this.doc);
1081
+ },
1082
+ onIframeLoad: (e, t) => {
1083
+ this.iframeManager.attachIframe(e, t), this.shadowDomManager.observeAttachShadow(e);
1084
+ },
1085
+ onStylesheetLoad: (e, t) => {
1086
+ this.stylesheetManager.attachLinkElement(e, t);
1087
+ },
1088
+ cssCaptured: u
1089
+ });
1090
+ f && (e.push({
1091
+ parentId: i,
1092
+ nextId: d,
1093
+ node: f
1094
+ }), t.add(f.id));
1095
+ }
1096
+ let u = {
1097
+ texts: this.texts.map((e) => {
1098
+ let t = e.node, n = P.parentNode(t);
1099
+ return n && n.tagName === "TEXTAREA" && this.genTextAreaValueMutation(n), {
1100
+ id: this.mirror.getId(t),
1101
+ value: e.value
1102
+ };
1103
+ }).filter((e) => !t.has(e.id)).filter((e) => this.mirror.has(e.id)),
1104
+ attributes: this.attributes.map((e) => {
1105
+ let { attributes: t } = e;
1106
+ if (typeof t.style == "string") {
1107
+ let n = JSON.stringify(e.styleDiff), r = JSON.stringify(e._unchangedStyles);
1108
+ n.length < t.style.length && (n + r).split("var(").length === t.style.split("var(").length && (t.style = e.styleDiff);
1109
+ }
1110
+ return {
1111
+ id: this.mirror.getId(e.node),
1112
+ attributes: t
1113
+ };
1114
+ }).filter((e) => !t.has(e.id)).filter((e) => this.mirror.has(e.id)),
1115
+ removes: this.removes,
1116
+ adds: e
1117
+ };
1118
+ (u.texts.length || u.attributes.length || u.removes.length || u.adds.length) && (this.texts = [], this.attributes = [], this.attributeMap = /* @__PURE__ */ new WeakMap(), this.removes = [], this.addedSet = /* @__PURE__ */ new Set(), this.movedSet = /* @__PURE__ */ new Set(), this.droppedSet = /* @__PURE__ */ new Set(), this.removesSubTreeCache = /* @__PURE__ */ new Set(), this.movedMap = {}, this.mutationCb(u));
1119
+ }), n(this, "genTextAreaValueMutation", (e) => {
1120
+ let t = this.attributeMap.get(e);
1121
+ t || (t = {
1122
+ node: e,
1123
+ attributes: {},
1124
+ styleDiff: {},
1125
+ _unchangedStyles: {}
1126
+ }, this.attributes.push(t), this.attributeMap.set(e, t));
1127
+ let n = Array.from(P.childNodes(e), (e) => P.textContent(e) || "").join("");
1128
+ t.attributes.value = de({
1129
+ element: e,
1130
+ maskInputOptions: this.maskInputOptions,
1131
+ tagName: e.tagName,
1132
+ type: me(e),
1133
+ value: n,
1134
+ maskInputFn: this.maskInputFn
1135
+ });
1136
+ }), n(this, "processMutation", (e) => {
1137
+ if (!ut(e.target, this.mirror, this.slimDOMOptions)) switch (e.type) {
1138
+ case "characterData": {
1139
+ let t = P.textContent(e.target);
1140
+ !q(e.target, this.blockClass, this.blockSelector, !1) && t !== e.oldValue && this.texts.push({
1141
+ value: Ge(e.target, this.maskTextClass, this.maskTextSelector, !0) && t ? this.maskTextFn ? this.maskTextFn(t, ct(e.target)) : t.replace(/[\S]/g, "*") : t,
1142
+ node: e.target
1143
+ });
1144
+ break;
1145
+ }
1146
+ case "attributes": {
1147
+ let t = e.target, n = V(t.tagName), r = e.attributeName, i = e.target.getAttribute(r);
1148
+ if (r === "value") {
1149
+ let e = me(t);
1150
+ i = de({
1151
+ element: t,
1152
+ maskInputOptions: this.maskInputOptions,
1153
+ tagName: t.tagName,
1154
+ type: e,
1155
+ value: i,
1156
+ maskInputFn: this.maskInputFn
1157
+ });
1158
+ }
1159
+ if (q(e.target, this.blockClass, this.blockSelector, !1) || i === e.oldValue) return;
1160
+ let a = this.attributeMap.get(e.target);
1161
+ if (n === "iframe" && r === "src" && !this.keepIframeSrcFn(i)) {
1162
+ if (!t.contentDocument) r = "rr_src";
1163
+ else return;
1164
+ }
1165
+ if (a || (a = {
1166
+ node: e.target,
1167
+ attributes: {},
1168
+ styleDiff: {},
1169
+ _unchangedStyles: {}
1170
+ }, this.attributes.push(a), this.attributeMap.set(e.target, a)), r === "type" && n === "input" && (e.oldValue || "").toLowerCase() === "password" && t.setAttribute("data-rr-is-password", "true"), !He(n, r)) {
1171
+ if (a.attributes[r] = Ve(this.doc, n, V(r), i), r === "style") {
1172
+ if (!this.unattachedDoc) try {
1173
+ this.unattachedDoc = document.implementation.createHTMLDocument();
1174
+ } catch {
1175
+ this.unattachedDoc = this.doc;
1176
+ }
1177
+ let n = this.unattachedDoc.createElement("span");
1178
+ e.oldValue && n.setAttribute("style", e.oldValue);
1179
+ for (let e of Array.from(t.style)) {
1180
+ let r = t.style.getPropertyValue(e), i = t.style.getPropertyPriority(e);
1181
+ r !== n.style.getPropertyValue(e) || i !== n.style.getPropertyPriority(e) ? i === "" ? a.styleDiff[e] = r : a.styleDiff[e] = [r, i] : a._unchangedStyles[e] = [r, i];
1182
+ }
1183
+ for (let e of Array.from(n.style)) t.style.getPropertyValue(e) === "" && (a.styleDiff[e] = !1);
1184
+ } else r === "open" && t.tagName === "DIALOG" && (t.matches("dialog:modal") ? a.attributes.rr_open_mode = "modal" : a.attributes.rr_open_mode = "non-modal");
1185
+ }
1186
+ break;
1187
+ }
1188
+ case "childList":
1189
+ if (q(e.target, this.blockClass, this.blockSelector, !0)) return;
1190
+ if (e.target.tagName === "TEXTAREA") {
1191
+ this.genTextAreaValueMutation(e.target);
1192
+ return;
1193
+ }
1194
+ e.addedNodes.forEach((t) => this.genAdds(t, e.target)), e.removedNodes.forEach((t) => {
1195
+ let n = this.mirror.getId(t), r = F(e.target) ? this.mirror.getId(P.host(e.target)) : this.mirror.getId(e.target);
1196
+ q(e.target, this.blockClass, this.blockSelector, !1) || ut(t, this.mirror, this.slimDOMOptions) || !lt(t, this.mirror) || (this.addedSet.has(t) ? (wt(this.addedSet, t), this.droppedSet.add(t)) : this.addedSet.has(e.target) && n === -1 || dt(e.target, this.mirror) || (this.movedSet.has(t) && this.movedMap[St(n, r)] ? wt(this.movedSet, t) : (this.removes.push({
1197
+ parentId: r,
1198
+ id: n,
1199
+ isShadow: F(e.target) && I(e.target) ? !0 : void 0
1200
+ }), Tt(t, this.removesSubTreeCache))), this.mapRemoves.push(t));
1201
+ });
1202
+ }
1203
+ }), n(this, "genAdds", (e, t) => {
1204
+ if (!this.processedNodeManager.inOtherBuffer(e, this) && !(this.addedSet.has(e) || this.movedSet.has(e))) {
1205
+ if (this.mirror.hasNode(e)) {
1206
+ if (ut(e, this.mirror, this.slimDOMOptions)) return;
1207
+ this.movedSet.add(e);
1208
+ let n = null;
1209
+ t && this.mirror.hasNode(t) && (n = this.mirror.getId(t)), n && n !== -1 && (this.movedMap[St(this.mirror.getId(e), n)] = !0);
1210
+ } else this.addedSet.add(e), this.droppedSet.delete(e);
1211
+ q(e, this.blockClass, this.blockSelector, !1) || (P.childNodes(e).forEach((e) => this.genAdds(e)), gt(e) && P.childNodes(P.shadowRoot(e)).forEach((t) => {
1212
+ this.processedNodeManager.add(t, this), this.genAdds(t, e);
1213
+ }));
1214
+ }
1215
+ });
1216
+ }
1217
+ init(e) {
1218
+ [
1219
+ "mutationCb",
1220
+ "blockClass",
1221
+ "blockSelector",
1222
+ "maskTextClass",
1223
+ "maskTextSelector",
1224
+ "inlineStylesheet",
1225
+ "maskInputOptions",
1226
+ "maskTextFn",
1227
+ "maskInputFn",
1228
+ "keepIframeSrcFn",
1229
+ "recordCanvas",
1230
+ "inlineImages",
1231
+ "slimDOMOptions",
1232
+ "dataURLOptions",
1233
+ "doc",
1234
+ "mirror",
1235
+ "iframeManager",
1236
+ "stylesheetManager",
1237
+ "shadowDomManager",
1238
+ "canvasManager",
1239
+ "processedNodeManager"
1240
+ ].forEach((t) => {
1241
+ this[t] = e[t];
1242
+ });
1243
+ }
1244
+ freeze() {
1245
+ this.frozen = !0, this.canvasManager.freeze();
1246
+ }
1247
+ unfreeze() {
1248
+ this.frozen = !1, this.canvasManager.unfreeze(), this.emit();
1249
+ }
1250
+ isFrozen() {
1251
+ return this.frozen;
1252
+ }
1253
+ lock() {
1254
+ this.locked = !0, this.canvasManager.lock();
1255
+ }
1256
+ unlock() {
1257
+ this.locked = !1, this.canvasManager.unlock(), this.emit();
1258
+ }
1259
+ reset() {
1260
+ this.shadowDomManager.reset(), this.canvasManager.reset();
1261
+ }
1262
+ };
1263
+ function wt(e, t) {
1264
+ e.delete(t), P.childNodes(t).forEach((t) => wt(e, t));
1265
+ }
1266
+ function Tt(e, t) {
1267
+ let n = [e];
1268
+ for (; n.length;) {
1269
+ let e = n.pop();
1270
+ t.has(e) || (t.add(e), P.childNodes(e).forEach((e) => n.push(e)));
1271
+ }
1272
+ }
1273
+ function Et(e, t) {
1274
+ return e.size !== 0 && Dt(e, t);
1275
+ }
1276
+ function Dt(e, t) {
1277
+ if (e.has(t)) return !0;
1278
+ let n = P.parentNode(t);
1279
+ return n ? Dt(e, n) : !1;
1280
+ }
1281
+ var Ot;
1282
+ function kt(e) {
1283
+ Ot = e;
1284
+ }
1285
+ function At() {
1286
+ Ot = void 0;
1287
+ }
1288
+ var J = (e) => Ot ? (...t) => {
1289
+ try {
1290
+ return e(...t);
1291
+ } catch (e) {
1292
+ if (Ot && Ot(e) === !0) return;
1293
+ throw e;
1294
+ }
1295
+ } : e, Y = [];
1296
+ function jt(e) {
1297
+ try {
1298
+ if ("composedPath" in e) {
1299
+ let t = e.composedPath();
1300
+ if (t.length) return t[0];
1301
+ } else if ("path" in e && e.path.length) return e.path[0];
1302
+ } catch {}
1303
+ return e && e.target;
1304
+ }
1305
+ function Mt(e, t) {
1306
+ let n = new Ct();
1307
+ Y.push(n), n.init(e);
1308
+ let [r, i] = re(), a = new r(J(n.processMutations.bind(n)));
1309
+ return a.observe(t, {
1310
+ attributes: !0,
1311
+ attributeOldValue: !0,
1312
+ characterData: !0,
1313
+ characterDataOldValue: !0,
1314
+ childList: !0,
1315
+ subtree: !0
1316
+ }), [a, i];
1317
+ }
1318
+ function Nt({ mousemoveCb: e, sampling: t, doc: n, mirror: r }) {
1319
+ if (t.mousemove === !1) return () => {};
1320
+ let a = typeof t.mousemove == "number" ? t.mousemove : 50, o = typeof t.mousemoveCallback == "number" ? t.mousemoveCallback : 500, s = [], c, l = rt(J((t) => {
1321
+ let n = Date.now() - c;
1322
+ e(s.map((e) => (e.timeOffset -= n, e)), t), s = [], c = null;
1323
+ }), o), u = J(rt(J((e) => {
1324
+ let t = jt(e), { clientX: n, clientY: a } = ft(e) ? e.changedTouches[0] : e;
1325
+ c || (c = ie()), s.push({
1326
+ x: n,
1327
+ y: a,
1328
+ id: r.getId(t),
1329
+ timeOffset: ie() - c
1330
+ }), l(typeof DragEvent < "u" && e instanceof DragEvent ? i.Drag : e instanceof MouseEvent ? i.MouseMove : i.TouchMove);
1331
+ }), a, { trailing: !1 })), d = [
1332
+ G("mousemove", u, n),
1333
+ G("touchmove", u, n),
1334
+ G("drag", u, n)
1335
+ ];
1336
+ return J(() => {
1337
+ d.forEach((e) => e());
1338
+ });
1339
+ }
1340
+ function Pt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: s }) {
1341
+ if (s.mouseInteraction === !1) return () => {};
1342
+ let c = s.mouseInteraction === !0 || s.mouseInteraction === void 0 ? {} : s.mouseInteraction, l = [], u = null, d = (t) => (s) => {
1343
+ let c = jt(s);
1344
+ if (q(c, r, i, !0)) return;
1345
+ let l = null, d = t;
1346
+ if ("pointerType" in s) {
1347
+ switch (s.pointerType) {
1348
+ case "mouse":
1349
+ l = o.Mouse;
1350
+ break;
1351
+ case "touch":
1352
+ l = o.Touch;
1353
+ break;
1354
+ case "pen": l = o.Pen;
1355
+ }
1356
+ l === o.Touch ? a[t] === a.MouseDown ? d = "TouchStart" : a[t] === a.MouseUp && (d = "TouchEnd") : o.Pen;
1357
+ } else ft(s) && (l = o.Touch);
1358
+ l === null ? a[t] === a.Click && (l = u, u = null) : (u = l, (d.startsWith("Touch") && l === o.Touch || d.startsWith("Mouse") && l === o.Mouse) && (l = null));
1359
+ let f = ft(s) ? s.changedTouches[0] : s;
1360
+ if (!f) return;
1361
+ let p = n.getId(c), { clientX: m, clientY: h } = f;
1362
+ J(e)({
1363
+ type: a[d],
1364
+ id: p,
1365
+ x: m,
1366
+ y: h,
1367
+ ...l !== null && { pointerType: l }
1368
+ });
1369
+ };
1370
+ return Object.keys(a).filter((e) => Number.isNaN(Number(e)) && !e.endsWith("_Departed") && c[e] !== !1).forEach((e) => {
1371
+ let n = V(e), r = d(e);
1372
+ if (window.PointerEvent) switch (a[e]) {
1373
+ case a.MouseDown:
1374
+ case a.MouseUp:
1375
+ n = n.replace("mouse", "pointer");
1376
+ break;
1377
+ case a.TouchStart:
1378
+ case a.TouchEnd: return;
1379
+ }
1380
+ l.push(G(n, r, t));
1381
+ }), J(() => {
1382
+ l.forEach((e) => e());
1383
+ });
1384
+ }
1385
+ function Ft({ scrollCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: a }) {
1386
+ return G("scroll", J(rt(J((a) => {
1387
+ let o = jt(a);
1388
+ if (!o || q(o, r, i, !0)) return;
1389
+ let s = n.getId(o);
1390
+ if (o === t && t.defaultView) {
1391
+ let n = at(t.defaultView);
1392
+ e({
1393
+ id: s,
1394
+ x: n.left,
1395
+ y: n.top
1396
+ });
1397
+ } else e({
1398
+ id: s,
1399
+ x: o.scrollLeft,
1400
+ y: o.scrollTop
1401
+ });
1402
+ }), a.scroll || 100)), t);
1403
+ }
1404
+ function It({ viewportResizeCb: e }, { win: t }) {
1405
+ let n = -1, r = -1;
1406
+ return G("resize", J(rt(J(() => {
1407
+ let t = ot(), i = st();
1408
+ (n !== t || r !== i) && (e({
1409
+ width: Number(i),
1410
+ height: Number(t)
1411
+ }), n = t, r = i);
1412
+ }), 200)), t);
1413
+ }
1414
+ var Lt = [
1415
+ "INPUT",
1416
+ "TEXTAREA",
1417
+ "SELECT"
1418
+ ], Rt = /* @__PURE__ */ new WeakMap();
1419
+ function zt({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ignoreClass: a, ignoreSelector: o, maskInputOptions: s, maskInputFn: c, sampling: l, userTriggeredOnInput: u }) {
1420
+ function d(e) {
1421
+ let n = jt(e), l = e.isTrusted, d = n && n.tagName;
1422
+ if (n && d === "OPTION" && (n = P.parentElement(n)), !n || !d || Lt.indexOf(d) < 0 || q(n, r, i, !0) || n.classList.contains(a) || o && n.matches(o)) return;
1423
+ let p = n.value, m = !1, h = me(n) || "";
1424
+ h === "radio" || h === "checkbox" ? m = n.checked : (s[d.toLowerCase()] || s[h]) && (p = de({
1425
+ element: n,
1426
+ maskInputOptions: s,
1427
+ tagName: d,
1428
+ type: h,
1429
+ value: p,
1430
+ maskInputFn: c
1431
+ })), f(n, u ? {
1432
+ text: p,
1433
+ isChecked: m,
1434
+ userTriggered: l
1435
+ } : {
1436
+ text: p,
1437
+ isChecked: m
1438
+ });
1439
+ let g = n.name;
1440
+ h === "radio" && g && m && t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e) => {
1441
+ if (e !== n) {
1442
+ let t = e.value;
1443
+ f(e, u ? {
1444
+ text: t,
1445
+ isChecked: !m,
1446
+ userTriggered: !1
1447
+ } : {
1448
+ text: t,
1449
+ isChecked: !m
1450
+ });
1451
+ }
1452
+ });
1453
+ }
1454
+ function f(t, r) {
1455
+ let i = Rt.get(t);
1456
+ if (!i || i.text !== r.text || i.isChecked !== r.isChecked) {
1457
+ Rt.set(t, r);
1458
+ let i = n.getId(t);
1459
+ J(e)({
1460
+ ...r,
1461
+ id: i
1462
+ });
1463
+ }
1464
+ }
1465
+ let p = (l.input === "last" ? ["change"] : ["input", "change"]).map((e) => G(e, J(d), t)), m = t.defaultView;
1466
+ if (!m) return () => {
1467
+ p.forEach((e) => e());
1468
+ };
1469
+ let h = m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype, "value"), g = [
1470
+ [m.HTMLInputElement.prototype, "value"],
1471
+ [m.HTMLInputElement.prototype, "checked"],
1472
+ [m.HTMLSelectElement.prototype, "value"],
1473
+ [m.HTMLTextAreaElement.prototype, "value"],
1474
+ [m.HTMLSelectElement.prototype, "selectedIndex"],
1475
+ [m.HTMLOptionElement.prototype, "selected"]
1476
+ ];
1477
+ return h && h.set && p.push(...g.map((e) => it(e[0], e[1], { set() {
1478
+ J(d)({
1479
+ target: this,
1480
+ isTrusted: !1
1481
+ });
1482
+ } }, !1, m))), J(() => {
1483
+ p.forEach((e) => e());
1484
+ });
1485
+ }
1486
+ function Bt(e) {
1487
+ let t = [];
1488
+ function n(e, t) {
1489
+ if (Xt("CSSGroupingRule") && e.parentRule instanceof CSSGroupingRule || Xt("CSSMediaRule") && e.parentRule instanceof CSSMediaRule || Xt("CSSSupportsRule") && e.parentRule instanceof CSSSupportsRule || Xt("CSSConditionRule") && e.parentRule instanceof CSSConditionRule) {
1490
+ let r = Array.from(e.parentRule.cssRules).indexOf(e);
1491
+ return t.unshift(r), n(e.parentRule, t);
1492
+ }
1493
+ if (e.parentStyleSheet) {
1494
+ let n = Array.from(e.parentStyleSheet.cssRules).indexOf(e);
1495
+ t.unshift(n);
1496
+ }
1497
+ return t;
1498
+ }
1499
+ return n(e, t);
1500
+ }
1501
+ function X(e, t, n) {
1502
+ let r, i;
1503
+ return e ? (e.ownerNode ? r = t.getId(e.ownerNode) : i = n.getId(e), {
1504
+ styleId: i,
1505
+ id: r
1506
+ }) : {};
1507
+ }
1508
+ function Vt({ styleSheetRuleCb: e, mirror: t, stylesheetManager: n }, { win: r }) {
1509
+ if (!r.CSSStyleSheet || !r.CSSStyleSheet.prototype) return () => {};
1510
+ let i = r.CSSStyleSheet.prototype.insertRule;
1511
+ r.CSSStyleSheet.prototype.insertRule = new Proxy(i, { apply: J((r, i, a) => {
1512
+ let [o, s] = a, { id: c, styleId: l } = X(i, t, n.styleMirror);
1513
+ return (c && c !== -1 || l && l !== -1) && e({
1514
+ id: c,
1515
+ styleId: l,
1516
+ adds: [{
1517
+ rule: o,
1518
+ index: s
1519
+ }]
1520
+ }), r.apply(i, a);
1521
+ }) }), r.CSSStyleSheet.prototype.addRule = function(e, t, n = this.cssRules.length) {
1522
+ let i = `${e} { ${t} }`;
1523
+ return r.CSSStyleSheet.prototype.insertRule.apply(this, [i, n]);
1524
+ };
1525
+ let a = r.CSSStyleSheet.prototype.deleteRule;
1526
+ r.CSSStyleSheet.prototype.deleteRule = new Proxy(a, { apply: J((r, i, a) => {
1527
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1528
+ return (s && s !== -1 || c && c !== -1) && e({
1529
+ id: s,
1530
+ styleId: c,
1531
+ removes: [{ index: o }]
1532
+ }), r.apply(i, a);
1533
+ }) }), r.CSSStyleSheet.prototype.removeRule = function(e) {
1534
+ return r.CSSStyleSheet.prototype.deleteRule.apply(this, [e]);
1535
+ };
1536
+ let o;
1537
+ r.CSSStyleSheet.prototype.replace && (o = r.CSSStyleSheet.prototype.replace, r.CSSStyleSheet.prototype.replace = new Proxy(o, { apply: J((r, i, a) => {
1538
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1539
+ return (s && s !== -1 || c && c !== -1) && e({
1540
+ id: s,
1541
+ styleId: c,
1542
+ replace: o
1543
+ }), r.apply(i, a);
1544
+ }) }));
1545
+ let s;
1546
+ r.CSSStyleSheet.prototype.replaceSync && (s = r.CSSStyleSheet.prototype.replaceSync, r.CSSStyleSheet.prototype.replaceSync = new Proxy(s, { apply: J((r, i, a) => {
1547
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1548
+ return (s && s !== -1 || c && c !== -1) && e({
1549
+ id: s,
1550
+ styleId: c,
1551
+ replaceSync: o
1552
+ }), r.apply(i, a);
1553
+ }) }));
1554
+ let c = {};
1555
+ Zt("CSSGroupingRule") ? c.CSSGroupingRule = r.CSSGroupingRule : (Zt("CSSMediaRule") && (c.CSSMediaRule = r.CSSMediaRule), Zt("CSSConditionRule") && (c.CSSConditionRule = r.CSSConditionRule), Zt("CSSSupportsRule") && (c.CSSSupportsRule = r.CSSSupportsRule));
1556
+ let l = {};
1557
+ return Object.entries(c).forEach(([r, i]) => {
1558
+ l[r] = {
1559
+ insertRule: i.prototype.insertRule,
1560
+ deleteRule: i.prototype.deleteRule
1561
+ }, i.prototype.insertRule = new Proxy(l[r].insertRule, { apply: J((r, i, a) => {
1562
+ let [o, s] = a, { id: c, styleId: l } = X(i.parentStyleSheet, t, n.styleMirror);
1563
+ return (c && c !== -1 || l && l !== -1) && e({
1564
+ id: c,
1565
+ styleId: l,
1566
+ adds: [{
1567
+ rule: o,
1568
+ index: [...Bt(i), s || 0]
1569
+ }]
1570
+ }), r.apply(i, a);
1571
+ }) }), i.prototype.deleteRule = new Proxy(l[r].deleteRule, { apply: J((r, i, a) => {
1572
+ let [o] = a, { id: s, styleId: c } = X(i.parentStyleSheet, t, n.styleMirror);
1573
+ return (s && s !== -1 || c && c !== -1) && e({
1574
+ id: s,
1575
+ styleId: c,
1576
+ removes: [{ index: [...Bt(i), o] }]
1577
+ }), r.apply(i, a);
1578
+ }) });
1579
+ }), J(() => {
1580
+ r.CSSStyleSheet.prototype.insertRule = i, r.CSSStyleSheet.prototype.deleteRule = a, o && (r.CSSStyleSheet.prototype.replace = o), s && (r.CSSStyleSheet.prototype.replaceSync = s), Object.entries(c).forEach(([e, t]) => {
1581
+ t.prototype.insertRule = l[e].insertRule, t.prototype.deleteRule = l[e].deleteRule;
1582
+ });
1583
+ });
1584
+ }
1585
+ function Ht({ mirror: e, stylesheetManager: t }, n) {
1586
+ let r = null;
1587
+ r = n.nodeName === "#document" ? e.getId(n) : e.getId(P.host(n));
1588
+ let i = n.nodeName === "#document" ? n.defaultView?.Document : n.ownerDocument?.defaultView?.ShadowRoot, a = i?.prototype ? Object.getOwnPropertyDescriptor(i?.prototype, "adoptedStyleSheets") : void 0;
1589
+ return r === null || r === -1 || !i || !a ? () => {} : (Object.defineProperty(n, "adoptedStyleSheets", {
1590
+ configurable: a.configurable,
1591
+ enumerable: a.enumerable,
1592
+ get() {
1593
+ return a.get?.call(this);
1594
+ },
1595
+ set(e) {
1596
+ let n = a.set?.call(this, e);
1597
+ if (r !== null && r !== -1) try {
1598
+ t.adoptStyleSheets(e, r);
1599
+ } catch {}
1600
+ return n;
1601
+ }
1602
+ }), J(() => {
1603
+ Object.defineProperty(n, "adoptedStyleSheets", {
1604
+ configurable: a.configurable,
1605
+ enumerable: a.enumerable,
1606
+ get: a.get,
1607
+ set: a.set
1608
+ });
1609
+ }));
1610
+ }
1611
+ function Ut({ styleDeclarationCb: e, mirror: t, ignoreCSSAttributes: n, stylesheetManager: r }, { win: i }) {
1612
+ let a = i.CSSStyleDeclaration.prototype.setProperty;
1613
+ i.CSSStyleDeclaration.prototype.setProperty = new Proxy(a, { apply: J((i, o, s) => {
1614
+ let [c, l, u] = s;
1615
+ if (n.has(c)) return a.apply(o, [
1616
+ c,
1617
+ l,
1618
+ u
1619
+ ]);
1620
+ let { id: d, styleId: f } = X(o.parentRule?.parentStyleSheet, t, r.styleMirror);
1621
+ return (d && d !== -1 || f && f !== -1) && e({
1622
+ id: d,
1623
+ styleId: f,
1624
+ set: {
1625
+ property: c,
1626
+ value: l,
1627
+ priority: u
1628
+ },
1629
+ index: Bt(o.parentRule)
1630
+ }), i.apply(o, s);
1631
+ }) });
1632
+ let o = i.CSSStyleDeclaration.prototype.removeProperty;
1633
+ return i.CSSStyleDeclaration.prototype.removeProperty = new Proxy(o, { apply: J((i, a, s) => {
1634
+ let [c] = s;
1635
+ if (n.has(c)) return o.apply(a, [c]);
1636
+ let { id: l, styleId: u } = X(a.parentRule?.parentStyleSheet, t, r.styleMirror);
1637
+ return (l && l !== -1 || u && u !== -1) && e({
1638
+ id: l,
1639
+ styleId: u,
1640
+ remove: { property: c },
1641
+ index: Bt(a.parentRule)
1642
+ }), i.apply(a, s);
1643
+ }) }), J(() => {
1644
+ i.CSSStyleDeclaration.prototype.setProperty = a, i.CSSStyleDeclaration.prototype.removeProperty = o;
1645
+ });
1646
+ }
1647
+ function Wt({ mediaInteractionCb: e, blockClass: t, blockSelector: n, mirror: r, sampling: i, doc: a }) {
1648
+ let o = J((a) => rt(J((i) => {
1649
+ let o = jt(i);
1650
+ if (!o || q(o, t, n, !0)) return;
1651
+ let { currentTime: s, volume: c, muted: l, playbackRate: u, loop: d } = o;
1652
+ e({
1653
+ type: a,
1654
+ id: r.getId(o),
1655
+ currentTime: s,
1656
+ volume: c,
1657
+ muted: l,
1658
+ playbackRate: u,
1659
+ loop: d
1660
+ });
1661
+ }), i.media || 500)), s = [
1662
+ G("play", o(c.Play), a),
1663
+ G("pause", o(c.Pause), a),
1664
+ G("seeked", o(c.Seeked), a),
1665
+ G("volumechange", o(c.VolumeChange), a),
1666
+ G("ratechange", o(c.RateChange), a)
1667
+ ];
1668
+ return J(() => {
1669
+ s.forEach((e) => e());
1670
+ });
1671
+ }
1672
+ function Gt({ fontCb: e, doc: t }) {
1673
+ let n = t.defaultView;
1674
+ if (!n) return () => {};
1675
+ let r = [], i = /* @__PURE__ */ new WeakMap(), a = n.FontFace;
1676
+ n.FontFace = function(e, t, n) {
1677
+ let r = new a(e, t, n);
1678
+ return i.set(r, {
1679
+ family: e,
1680
+ buffer: typeof t != "string",
1681
+ descriptors: n,
1682
+ fontSource: typeof t == "string" ? t : JSON.stringify(Array.from(new Uint8Array(t)))
1683
+ }), r;
1684
+ };
1685
+ let o = N(t.fonts, "add", function(t) {
1686
+ return function(n) {
1687
+ return setTimeout(J(() => {
1688
+ let t = i.get(n);
1689
+ t && (e(t), i.delete(n));
1690
+ }), 0), t.apply(this, [n]);
1691
+ };
1692
+ });
1693
+ return r.push(() => {
1694
+ n.FontFace = a;
1695
+ }), r.push(o), J(() => {
1696
+ r.forEach((e) => e());
1697
+ });
1698
+ }
1699
+ function Kt(e) {
1700
+ let { doc: t, mirror: n, blockClass: r, blockSelector: i, selectionCb: a } = e, o = !0, s = J(() => {
1701
+ let e = t.getSelection();
1702
+ if (!e || o && e?.isCollapsed) return;
1703
+ o = e.isCollapsed || !1;
1704
+ let s = [], c = e.rangeCount || 0;
1705
+ for (let t = 0; t < c; t++) {
1706
+ let { startContainer: a, startOffset: o, endContainer: c, endOffset: l } = e.getRangeAt(t);
1707
+ q(a, r, i, !0) || q(c, r, i, !0) || s.push({
1708
+ start: n.getId(a),
1709
+ startOffset: o,
1710
+ end: n.getId(c),
1711
+ endOffset: l
1712
+ });
1713
+ }
1714
+ a({ ranges: s });
1715
+ });
1716
+ return s(), G("selectionchange", s);
1717
+ }
1718
+ function qt({ doc: e, customElementCb: t }) {
1719
+ let n = e.defaultView;
1720
+ return !n || !n.customElements ? () => {} : N(n.customElements, "define", function(e) {
1721
+ return function(n, r, i) {
1722
+ try {
1723
+ t({ define: { name: n } });
1724
+ } catch {
1725
+ console.warn(`Custom element callback failed for ${n}`);
1726
+ }
1727
+ return e.apply(this, [
1728
+ n,
1729
+ r,
1730
+ i
1731
+ ]);
1732
+ };
1733
+ });
1734
+ }
1735
+ function Jt(e, t) {
1736
+ let { mutationCb: n, mousemoveCb: r, mouseInteractionCb: i, scrollCb: a, viewportResizeCb: o, inputCb: s, mediaInteractionCb: c, styleSheetRuleCb: l, styleDeclarationCb: u, canvasMutationCb: d, fontCb: f, selectionCb: p, customElementCb: m } = e;
1737
+ e.mutationCb = (...e) => {
1738
+ t.mutation && t.mutation(...e), n(...e);
1739
+ }, e.mousemoveCb = (...e) => {
1740
+ t.mousemove && t.mousemove(...e), r(...e);
1741
+ }, e.mouseInteractionCb = (...e) => {
1742
+ t.mouseInteraction && t.mouseInteraction(...e), i(...e);
1743
+ }, e.scrollCb = (...e) => {
1744
+ t.scroll && t.scroll(...e), a(...e);
1745
+ }, e.viewportResizeCb = (...e) => {
1746
+ t.viewportResize && t.viewportResize(...e), o(...e);
1747
+ }, e.inputCb = (...e) => {
1748
+ t.input && t.input(...e), s(...e);
1749
+ }, e.mediaInteractionCb = (...e) => {
1750
+ t.mediaInteaction && t.mediaInteaction(...e), c(...e);
1751
+ }, e.styleSheetRuleCb = (...e) => {
1752
+ t.styleSheetRule && t.styleSheetRule(...e), l(...e);
1753
+ }, e.styleDeclarationCb = (...e) => {
1754
+ t.styleDeclaration && t.styleDeclaration(...e), u(...e);
1755
+ }, e.canvasMutationCb = (...e) => {
1756
+ t.canvasMutation && t.canvasMutation(...e), d(...e);
1757
+ }, e.fontCb = (...e) => {
1758
+ t.font && t.font(...e), f(...e);
1759
+ }, e.selectionCb = (...e) => {
1760
+ t.selection && t.selection(...e), p(...e);
1761
+ }, e.customElementCb = (...e) => {
1762
+ t.customElement && t.customElement(...e), m(...e);
1763
+ };
1764
+ }
1765
+ function Yt(e, t = {}) {
1766
+ let n = e.doc.defaultView;
1767
+ if (!n) return () => {};
1768
+ Jt(e, t);
1769
+ let r, i = () => {};
1770
+ e.recordDOM && ([r, i] = Mt(e, e.doc));
1771
+ let a = Nt(e), o = Pt(e), s = Ft(e), c = It(e, { win: n }), l = zt(e), u = Wt(e), d = () => {}, f = () => {}, p = () => {}, m = () => {};
1772
+ e.recordDOM && (d = Vt(e, { win: n }), f = Ht(e, e.doc), p = Ut(e, { win: n }), e.collectFonts && (m = Gt(e)));
1773
+ let h = Kt(e), g = qt(e), _ = [];
1774
+ for (let t of e.plugins) _.push(t.observer(t.callback, n, t.options));
1775
+ return J(() => {
1776
+ Y.forEach((e) => e.reset()), r?.disconnect(), i(), a(), o(), s(), c(), l(), u(), d(), f(), p(), m(), h(), g(), _.forEach((e) => e());
1777
+ });
1778
+ }
1779
+ function Xt(e) {
1780
+ return window[e] !== void 0;
1781
+ }
1782
+ function Zt(e) {
1783
+ return !!(window[e] !== void 0 && window[e].prototype && "insertRule" in window[e].prototype && "deleteRule" in window[e].prototype);
1784
+ }
1785
+ for (var Qt = class {
1786
+ constructor(e) {
1787
+ n(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap()), n(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap()), this.generateIdFn = e;
1788
+ }
1789
+ getId(e, t, n, r) {
1790
+ let i = n || this.getIdToRemoteIdMap(e), a = r || this.getRemoteIdToIdMap(e), o = i.get(t);
1791
+ return o || (o = this.generateIdFn(), i.set(t, o), a.set(o, t)), o;
1792
+ }
1793
+ getIds(e, t) {
1794
+ let n = this.getIdToRemoteIdMap(e), r = this.getRemoteIdToIdMap(e);
1795
+ return t.map((t) => this.getId(e, t, n, r));
1796
+ }
1797
+ getRemoteId(e, t, n) {
1798
+ let r = n || this.getRemoteIdToIdMap(e);
1799
+ return typeof t == "number" ? r.get(t) || -1 : t;
1800
+ }
1801
+ getRemoteIds(e, t) {
1802
+ let n = this.getRemoteIdToIdMap(e);
1803
+ return t.map((t) => this.getRemoteId(e, t, n));
1804
+ }
1805
+ reset(e) {
1806
+ e ? (this.iframeIdToRemoteIdMap.delete(e), this.iframeRemoteIdToIdMap.delete(e)) : (this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(), this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap());
1807
+ }
1808
+ getIdToRemoteIdMap(e) {
1809
+ let t = this.iframeIdToRemoteIdMap.get(e);
1810
+ return t || (t = /* @__PURE__ */ new Map(), this.iframeIdToRemoteIdMap.set(e, t)), t;
1811
+ }
1812
+ getRemoteIdToIdMap(e) {
1813
+ let t = this.iframeRemoteIdToIdMap.get(e);
1814
+ return t || (t = /* @__PURE__ */ new Map(), this.iframeRemoteIdToIdMap.set(e, t)), t;
1815
+ }
1816
+ }, $t = class {
1817
+ constructor(e) {
1818
+ n(this, "iframes", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMirror", new Qt(je)), n(this, "crossOriginIframeStyleMirror"), n(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap()), n(this, "mirror"), n(this, "mutationCb"), n(this, "wrappedEmit"), n(this, "loadListener"), n(this, "stylesheetManager"), n(this, "recordCrossOriginIframes"), this.mutationCb = e.mutationCb, this.wrappedEmit = e.wrappedEmit, this.stylesheetManager = e.stylesheetManager, this.recordCrossOriginIframes = e.recordCrossOriginIframes, this.crossOriginIframeStyleMirror = new Qt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)), this.mirror = e.mirror, this.recordCrossOriginIframes && window.addEventListener("message", this.handleMessage.bind(this));
1819
+ }
1820
+ addIframe(e) {
1821
+ this.iframes.set(e, !0), e.contentWindow && this.crossOriginIframeMap.set(e.contentWindow, e);
1822
+ }
1823
+ addLoadListener(e) {
1824
+ this.loadListener = e;
1825
+ }
1826
+ attachIframe(e, t) {
1827
+ var n, r;
1828
+ this.mutationCb({
1829
+ adds: [{
1830
+ parentId: this.mirror.getId(e),
1831
+ nextId: null,
1832
+ node: t
1833
+ }],
1834
+ removes: [],
1835
+ texts: [],
1836
+ attributes: [],
1837
+ isAttachIframe: !0
1838
+ }), this.recordCrossOriginIframes && ((n = e.contentWindow) == null || n.addEventListener("message", this.handleMessage.bind(this))), (r = this.loadListener) == null || r.call(this, e), e.contentDocument && e.contentDocument.adoptedStyleSheets && e.contentDocument.adoptedStyleSheets.length > 0 && this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets, this.mirror.getId(e.contentDocument));
1839
+ }
1840
+ handleMessage(e) {
1841
+ let t = e;
1842
+ if (t.data.type !== "rrweb" || t.origin !== t.data.origin || !e.source) return;
1843
+ let n = this.crossOriginIframeMap.get(e.source);
1844
+ if (!n) return;
1845
+ let r = this.transformCrossOriginEvent(n, t.data.event);
1846
+ r && this.wrappedEmit(r, t.data.isCheckout);
1847
+ }
1848
+ transformCrossOriginEvent(e, t) {
1849
+ var n;
1850
+ switch (t.type) {
1851
+ case r.FullSnapshot: {
1852
+ this.crossOriginIframeMirror.reset(e), this.crossOriginIframeStyleMirror.reset(e), this.replaceIdOnNode(t.data.node, e);
1853
+ let n = t.data.node.id;
1854
+ return this.crossOriginIframeRootIdMap.set(e, n), this.patchRootIdOnNode(t.data.node, n), {
1855
+ timestamp: t.timestamp,
1856
+ type: r.IncrementalSnapshot,
1857
+ data: {
1858
+ source: i.Mutation,
1859
+ adds: [{
1860
+ parentId: this.mirror.getId(e),
1861
+ nextId: null,
1862
+ node: t.data.node
1863
+ }],
1864
+ removes: [],
1865
+ texts: [],
1866
+ attributes: [],
1867
+ isAttachIframe: !0
1868
+ }
1869
+ };
1870
+ }
1871
+ case r.Meta:
1872
+ case r.Load:
1873
+ case r.DomContentLoaded: return !1;
1874
+ case r.Plugin: return t;
1875
+ case r.Custom: return this.replaceIds(t.data.payload, e, [
1876
+ "id",
1877
+ "parentId",
1878
+ "previousId",
1879
+ "nextId"
1880
+ ]), t;
1881
+ case r.IncrementalSnapshot: switch (t.data.source) {
1882
+ case i.Mutation: return t.data.adds.forEach((t) => {
1883
+ this.replaceIds(t, e, [
1884
+ "parentId",
1885
+ "nextId",
1886
+ "previousId"
1887
+ ]), this.replaceIdOnNode(t.node, e);
1888
+ let n = this.crossOriginIframeRootIdMap.get(e);
1889
+ n && this.patchRootIdOnNode(t.node, n);
1890
+ }), t.data.removes.forEach((t) => {
1891
+ this.replaceIds(t, e, ["parentId", "id"]);
1892
+ }), t.data.attributes.forEach((t) => {
1893
+ this.replaceIds(t, e, ["id"]);
1894
+ }), t.data.texts.forEach((t) => {
1895
+ this.replaceIds(t, e, ["id"]);
1896
+ }), t;
1897
+ case i.Drag:
1898
+ case i.TouchMove:
1899
+ case i.MouseMove: return t.data.positions.forEach((t) => {
1900
+ this.replaceIds(t, e, ["id"]);
1901
+ }), t;
1902
+ case i.ViewportResize: return !1;
1903
+ case i.MediaInteraction:
1904
+ case i.MouseInteraction:
1905
+ case i.Scroll:
1906
+ case i.CanvasMutation:
1907
+ case i.Input: return this.replaceIds(t.data, e, ["id"]), t;
1908
+ case i.StyleSheetRule:
1909
+ case i.StyleDeclaration: return this.replaceIds(t.data, e, ["id"]), this.replaceStyleIds(t.data, e, ["styleId"]), t;
1910
+ case i.Font: return t;
1911
+ case i.Selection: return t.data.ranges.forEach((t) => {
1912
+ this.replaceIds(t, e, ["start", "end"]);
1913
+ }), t;
1914
+ case i.AdoptedStyleSheet: return this.replaceIds(t.data, e, ["id"]), this.replaceStyleIds(t.data, e, ["styleIds"]), (n = t.data.styles) == null || n.forEach((t) => {
1915
+ this.replaceStyleIds(t, e, ["styleId"]);
1916
+ }), t;
1917
+ }
1918
+ }
1919
+ return !1;
1920
+ }
1921
+ replace(e, t, n, r) {
1922
+ for (let i of r) (Array.isArray(t[i]) || typeof t[i] == "number") && (t[i] = Array.isArray(t[i]) ? e.getIds(n, t[i]) : e.getId(n, t[i]));
1923
+ return t;
1924
+ }
1925
+ replaceIds(e, t, n) {
1926
+ return this.replace(this.crossOriginIframeMirror, e, t, n);
1927
+ }
1928
+ replaceStyleIds(e, t, n) {
1929
+ return this.replace(this.crossOriginIframeStyleMirror, e, t, n);
1930
+ }
1931
+ replaceIdOnNode(e, t) {
1932
+ this.replaceIds(e, t, ["id", "rootId"]), "childNodes" in e && e.childNodes.forEach((e) => {
1933
+ this.replaceIdOnNode(e, t);
1934
+ });
1935
+ }
1936
+ patchRootIdOnNode(e, t) {
1937
+ e.type !== l.Document && !e.rootId && (e.rootId = t), "childNodes" in e && e.childNodes.forEach((e) => {
1938
+ this.patchRootIdOnNode(e, t);
1939
+ });
1940
+ }
1941
+ }, en = class {
1942
+ constructor(e) {
1943
+ n(this, "shadowDoms", /* @__PURE__ */ new WeakSet()), n(this, "mutationCb"), n(this, "scrollCb"), n(this, "bypassOptions"), n(this, "mirror"), n(this, "restoreHandlers", []), this.mutationCb = e.mutationCb, this.scrollCb = e.scrollCb, this.bypassOptions = e.bypassOptions, this.mirror = e.mirror, this.init();
1944
+ }
1945
+ init() {
1946
+ this.reset(), this.patchAttachShadow(Element, document);
1947
+ }
1948
+ addShadowRoot(e, t) {
1949
+ if (!I(e) || this.shadowDoms.has(e)) return;
1950
+ this.shadowDoms.add(e);
1951
+ let [n] = Mt({
1952
+ ...this.bypassOptions,
1953
+ doc: t,
1954
+ mutationCb: this.mutationCb,
1955
+ mirror: this.mirror,
1956
+ shadowDomManager: this
1957
+ }, e);
1958
+ this.restoreHandlers.push(() => n.disconnect()), this.restoreHandlers.push(Ft({
1959
+ ...this.bypassOptions,
1960
+ scrollCb: this.scrollCb,
1961
+ doc: e,
1962
+ mirror: this.mirror
1963
+ })), setTimeout(() => {
1964
+ e.adoptedStyleSheets && e.adoptedStyleSheets.length > 0 && this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets, this.mirror.getId(P.host(e))), this.restoreHandlers.push(Ht({
1965
+ mirror: this.mirror,
1966
+ stylesheetManager: this.bypassOptions.stylesheetManager
1967
+ }, e));
1968
+ }, 0);
1969
+ }
1970
+ observeAttachShadow(e) {
1971
+ e.contentWindow && e.contentDocument && this.patchAttachShadow(e.contentWindow.Element, e.contentDocument);
1972
+ }
1973
+ patchAttachShadow(e, t) {
1974
+ let n = this;
1975
+ this.restoreHandlers.push(N(e.prototype, "attachShadow", function(e) {
1976
+ return function(r) {
1977
+ let i = e.call(this, r), a = P.shadowRoot(this);
1978
+ return a && xt(this) && n.addShadowRoot(a, t), i;
1979
+ };
1980
+ }));
1981
+ }
1982
+ reset() {
1983
+ this.restoreHandlers.forEach((e) => {
1984
+ try {
1985
+ e();
1986
+ } catch {}
1987
+ }), this.restoreHandlers = [], this.shadowDoms = /* @__PURE__ */ new WeakSet();
1988
+ }
1989
+ }, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", tn = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256), nn = 0; nn < Z.length; nn++) tn[Z.charCodeAt(nn)] = nn;
1990
+ var rn = function(e) {
1991
+ var t = new Uint8Array(e), n, r = t.length, i = "";
1992
+ for (n = 0; n < r; n += 3) i += Z[t[n] >> 2], i += Z[(t[n] & 3) << 4 | t[n + 1] >> 4], i += Z[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += Z[t[n + 2] & 63];
1993
+ return r % 3 == 2 ? i = i.substring(0, i.length - 1) + "=" : r % 3 == 1 && (i = i.substring(0, i.length - 2) + "=="), i;
1994
+ }, an = /* @__PURE__ */ new Map();
1995
+ function on(e, t) {
1996
+ let n = an.get(e);
1997
+ return n || (n = /* @__PURE__ */ new Map(), an.set(e, n)), n.has(t) || n.set(t, []), n.get(t);
1998
+ }
1999
+ var sn = (e, t, n) => {
2000
+ if (!e || !(un(e, t) || typeof e == "object")) return;
2001
+ let r = e.constructor.name, i = on(n, r), a = i.indexOf(e);
2002
+ return a === -1 && (a = i.length, i.push(e)), a;
2003
+ };
2004
+ function cn(e, t, n) {
2005
+ if (e instanceof Array) return e.map((e) => cn(e, t, n));
2006
+ if (e === null) return e;
2007
+ if (e instanceof Float32Array || e instanceof Float64Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Uint8Array || e instanceof Uint16Array || e instanceof Int16Array || e instanceof Int8Array || e instanceof Uint8ClampedArray) return {
2008
+ rr_type: e.constructor.name,
2009
+ args: [Object.values(e)]
2010
+ };
2011
+ if (e instanceof ArrayBuffer) return {
2012
+ rr_type: e.constructor.name,
2013
+ base64: rn(e)
2014
+ };
2015
+ if (e instanceof DataView) return {
2016
+ rr_type: e.constructor.name,
2017
+ args: [
2018
+ cn(e.buffer, t, n),
2019
+ e.byteOffset,
2020
+ e.byteLength
2021
+ ]
2022
+ };
2023
+ if (e instanceof HTMLImageElement) {
2024
+ let t = e.constructor.name, { src: n } = e;
2025
+ return {
2026
+ rr_type: t,
2027
+ src: n
2028
+ };
2029
+ }
2030
+ return e instanceof HTMLCanvasElement ? {
2031
+ rr_type: "HTMLImageElement",
2032
+ src: e.toDataURL()
2033
+ } : e instanceof ImageData ? {
2034
+ rr_type: e.constructor.name,
2035
+ args: [
2036
+ cn(e.data, t, n),
2037
+ e.width,
2038
+ e.height
2039
+ ]
2040
+ } : un(e, t) || typeof e == "object" ? {
2041
+ rr_type: e.constructor.name,
2042
+ index: sn(e, t, n)
2043
+ } : e;
2044
+ }
2045
+ var ln = (e, t, n) => e.map((e) => cn(e, t, n)), un = (e, t) => !![
2046
+ "WebGLActiveInfo",
2047
+ "WebGLBuffer",
2048
+ "WebGLFramebuffer",
2049
+ "WebGLProgram",
2050
+ "WebGLRenderbuffer",
2051
+ "WebGLShader",
2052
+ "WebGLShaderPrecisionFormat",
2053
+ "WebGLTexture",
2054
+ "WebGLUniformLocation",
2055
+ "WebGLVertexArrayObject",
2056
+ "WebGLVertexArrayObjectOES"
2057
+ ].filter((e) => typeof t[e] == "function").find((n) => e instanceof t[n]);
2058
+ function dn(e, t, n, r) {
2059
+ let i = [], a = Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);
2060
+ for (let o of a) try {
2061
+ if (typeof t.CanvasRenderingContext2D.prototype[o] != "function") continue;
2062
+ let a = N(t.CanvasRenderingContext2D.prototype, o, function(i) {
2063
+ return function(...a) {
2064
+ return q(this.canvas, n, r, !0) || setTimeout(() => {
2065
+ let n = ln(a, t, this);
2066
+ e(this.canvas, {
2067
+ type: s["2D"],
2068
+ property: o,
2069
+ args: n
2070
+ });
2071
+ }, 0), i.apply(this, a);
2072
+ };
2073
+ });
2074
+ i.push(a);
2075
+ } catch {
2076
+ let n = it(t.CanvasRenderingContext2D.prototype, o, { set(t) {
2077
+ e(this.canvas, {
2078
+ type: s["2D"],
2079
+ property: o,
2080
+ args: [t],
2081
+ setter: !0
2082
+ });
2083
+ } });
2084
+ i.push(n);
2085
+ }
2086
+ return () => {
2087
+ i.forEach((e) => e());
2088
+ };
2089
+ }
2090
+ function fn(e) {
2091
+ return e === "experimental-webgl" ? "webgl" : e;
2092
+ }
2093
+ function pn(e, t, n, r) {
2094
+ let i = [];
2095
+ try {
2096
+ let a = N(e.HTMLCanvasElement.prototype, "getContext", function(e) {
2097
+ return function(i, ...a) {
2098
+ if (!q(this, t, n, !0)) {
2099
+ let e = fn(i);
2100
+ if ("__context" in this || (this.__context = e), r && ["webgl", "webgl2"].includes(e)) {
2101
+ if (a[0] && typeof a[0] == "object") {
2102
+ let e = a[0];
2103
+ e.preserveDrawingBuffer || (e.preserveDrawingBuffer = !0);
2104
+ } else a.splice(0, 1, { preserveDrawingBuffer: !0 });
2105
+ }
2106
+ }
2107
+ return e.apply(this, [i, ...a]);
2108
+ };
2109
+ });
2110
+ i.push(a);
2111
+ } catch {
2112
+ console.error("failed to patch HTMLCanvasElement.prototype.getContext");
2113
+ }
2114
+ return () => {
2115
+ i.forEach((e) => e());
2116
+ };
2117
+ }
2118
+ function mn(e, t, n, r, i, a) {
2119
+ let o = [], s = Object.getOwnPropertyNames(e);
2120
+ for (let c of s) if (![
2121
+ "isContextLost",
2122
+ "canvas",
2123
+ "drawingBufferWidth",
2124
+ "drawingBufferHeight"
2125
+ ].includes(c)) try {
2126
+ if (typeof e[c] != "function") continue;
2127
+ let s = N(e, c, function(e) {
2128
+ return function(...o) {
2129
+ let s = e.apply(this, o);
2130
+ if (sn(s, a, this), "tagName" in this.canvas && !q(this.canvas, r, i, !0)) {
2131
+ let e = ln(o, a, this), r = {
2132
+ type: t,
2133
+ property: c,
2134
+ args: e
2135
+ };
2136
+ n(this.canvas, r);
2137
+ }
2138
+ return s;
2139
+ };
2140
+ });
2141
+ o.push(s);
2142
+ } catch {
2143
+ let r = it(e, c, { set(e) {
2144
+ n(this.canvas, {
2145
+ type: t,
2146
+ property: c,
2147
+ args: [e],
2148
+ setter: !0
2149
+ });
2150
+ } });
2151
+ o.push(r);
2152
+ }
2153
+ return o;
2154
+ }
2155
+ function hn(e, t, n, r) {
2156
+ let i = [];
2157
+ return t.WebGLRenderingContext !== void 0 && i.push(...mn(t.WebGLRenderingContext.prototype, s.WebGL, e, n, r, t)), t.WebGL2RenderingContext !== void 0 && i.push(...mn(t.WebGL2RenderingContext.prototype, s.WebGL2, e, n, r, t)), () => {
2158
+ i.forEach((e) => e());
2159
+ };
2160
+ }
2161
+ var gn = "(function() {\n \"use strict\";\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if (\"OffscreenCanvas\" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext(\"2d\");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return \"\";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if (\"OffscreenCanvas\" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext(\"2d\");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n", _n = typeof self < "u" && self.Blob && new Blob([gn], { type: "text/javascript;charset=utf-8" });
2162
+ function vn(e) {
2163
+ let t;
2164
+ try {
2165
+ if (t = _n && (self.URL || self.webkitURL).createObjectURL(_n), !t) throw "";
2166
+ let n = new Worker(t, { name: e?.name });
2167
+ return n.addEventListener("error", () => {
2168
+ (self.URL || self.webkitURL).revokeObjectURL(t);
2169
+ }), n;
2170
+ } catch {
2171
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(gn), { name: e?.name });
2172
+ } finally {
2173
+ t && (self.URL || self.webkitURL).revokeObjectURL(t);
2174
+ }
2175
+ }
2176
+ var yn = class {
2177
+ constructor(e) {
2178
+ n(this, "pendingCanvasMutations", /* @__PURE__ */ new Map()), n(this, "rafStamps", {
2179
+ latestId: 0,
2180
+ invokeId: null
2181
+ }), n(this, "mirror"), n(this, "mutationCb"), n(this, "resetObservers"), n(this, "frozen", !1), n(this, "locked", !1), n(this, "processMutation", (e, t) => {
2182
+ (this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId || !this.rafStamps.invokeId) && (this.rafStamps.invokeId = this.rafStamps.latestId), this.pendingCanvasMutations.has(e) || this.pendingCanvasMutations.set(e, []), this.pendingCanvasMutations.get(e).push(t);
2183
+ });
2184
+ let { sampling: t = "all", win: r, blockClass: i, blockSelector: a, recordCanvas: o, dataURLOptions: s } = e;
2185
+ this.mutationCb = e.mutationCb, this.mirror = e.mirror, o && t === "all" && this.initCanvasMutationObserver(r, i, a), o && typeof t == "number" && this.initCanvasFPSObserver(t, r, i, a, { dataURLOptions: s });
2186
+ }
2187
+ reset() {
2188
+ this.pendingCanvasMutations.clear(), this.resetObservers && this.resetObservers();
2189
+ }
2190
+ freeze() {
2191
+ this.frozen = !0;
2192
+ }
2193
+ unfreeze() {
2194
+ this.frozen = !1;
2195
+ }
2196
+ lock() {
2197
+ this.locked = !0;
2198
+ }
2199
+ unlock() {
2200
+ this.locked = !1;
2201
+ }
2202
+ initCanvasFPSObserver(e, t, n, r, i) {
2203
+ let a = pn(t, n, r, !0), o = /* @__PURE__ */ new Map(), c = new vn();
2204
+ c.onmessage = (e) => {
2205
+ let { id: t } = e.data;
2206
+ if (o.set(t, !1), !("base64" in e.data)) return;
2207
+ let { base64: n, type: r, width: i, height: a } = e.data;
2208
+ this.mutationCb({
2209
+ id: t,
2210
+ type: s["2D"],
2211
+ commands: [{
2212
+ property: "clearRect",
2213
+ args: [
2214
+ 0,
2215
+ 0,
2216
+ i,
2217
+ a
2218
+ ]
2219
+ }, {
2220
+ property: "drawImage",
2221
+ args: [
2222
+ {
2223
+ rr_type: "ImageBitmap",
2224
+ args: [{
2225
+ rr_type: "Blob",
2226
+ data: [{
2227
+ rr_type: "ArrayBuffer",
2228
+ base64: n
2229
+ }],
2230
+ type: r
2231
+ }]
2232
+ },
2233
+ 0,
2234
+ 0
2235
+ ]
2236
+ }]
2237
+ });
2238
+ };
2239
+ let l = 1e3 / e, u = 0, d, f = () => {
2240
+ let e = [];
2241
+ return t.document.querySelectorAll("canvas").forEach((t) => {
2242
+ q(t, n, r, !0) || e.push(t);
2243
+ }), e;
2244
+ }, p = (e) => {
2245
+ u && e - u < l || (u = e, f().forEach(async (e) => {
2246
+ let t = this.mirror.getId(e);
2247
+ if (o.get(t) || e.width === 0 || e.height === 0) return;
2248
+ if (o.set(t, !0), ["webgl", "webgl2"].includes(e.__context)) {
2249
+ let t = e.getContext(e.__context);
2250
+ t?.getContextAttributes()?.preserveDrawingBuffer === !1 && t.clear(t.COLOR_BUFFER_BIT);
2251
+ }
2252
+ let n = await createImageBitmap(e);
2253
+ c.postMessage({
2254
+ id: t,
2255
+ bitmap: n,
2256
+ width: e.width,
2257
+ height: e.height,
2258
+ dataURLOptions: i.dataURLOptions
2259
+ }, [n]);
2260
+ })), d = requestAnimationFrame(p);
2261
+ };
2262
+ d = requestAnimationFrame(p), this.resetObservers = () => {
2263
+ a(), cancelAnimationFrame(d);
2264
+ };
2265
+ }
2266
+ initCanvasMutationObserver(e, t, n) {
2267
+ this.startRAFTimestamping(), this.startPendingCanvasMutationFlusher();
2268
+ let r = pn(e, t, n, !1), i = dn(this.processMutation.bind(this), e, t, n), a = hn(this.processMutation.bind(this), e, t, n);
2269
+ this.resetObservers = () => {
2270
+ r(), i(), a();
2271
+ };
2272
+ }
2273
+ startPendingCanvasMutationFlusher() {
2274
+ requestAnimationFrame(() => this.flushPendingCanvasMutations());
2275
+ }
2276
+ startRAFTimestamping() {
2277
+ let e = (t) => {
2278
+ this.rafStamps.latestId = t, requestAnimationFrame(e);
2279
+ };
2280
+ requestAnimationFrame(e);
2281
+ }
2282
+ flushPendingCanvasMutations() {
2283
+ this.pendingCanvasMutations.forEach((e, t) => {
2284
+ let n = this.mirror.getId(t);
2285
+ this.flushPendingCanvasMutationFor(t, n);
2286
+ }), requestAnimationFrame(() => this.flushPendingCanvasMutations());
2287
+ }
2288
+ flushPendingCanvasMutationFor(e, t) {
2289
+ if (this.frozen || this.locked) return;
2290
+ let n = this.pendingCanvasMutations.get(e);
2291
+ if (!n || t === -1) return;
2292
+ let r = n.map((e) => {
2293
+ let { type: t, ...n } = e;
2294
+ return n;
2295
+ }), { type: i } = n[0];
2296
+ this.mutationCb({
2297
+ id: t,
2298
+ type: i,
2299
+ commands: r
2300
+ }), this.pendingCanvasMutations.delete(e);
2301
+ }
2302
+ }, bn = class {
2303
+ constructor(e) {
2304
+ n(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet()), n(this, "mutationCb"), n(this, "adoptedStyleSheetCb"), n(this, "styleMirror", new _t()), this.mutationCb = e.mutationCb, this.adoptedStyleSheetCb = e.adoptedStyleSheetCb;
2305
+ }
2306
+ attachLinkElement(e, t) {
2307
+ "_cssText" in t.attributes && this.mutationCb({
2308
+ adds: [],
2309
+ removes: [],
2310
+ texts: [],
2311
+ attributes: [{
2312
+ id: t.id,
2313
+ attributes: t.attributes
2314
+ }]
2315
+ }), this.trackLinkElement(e);
2316
+ }
2317
+ trackLinkElement(e) {
2318
+ this.trackedLinkElements.has(e) || (this.trackedLinkElements.add(e), this.trackStylesheetInLinkElement(e));
2319
+ }
2320
+ adoptStyleSheets(e, t) {
2321
+ if (e.length === 0) return;
2322
+ let n = {
2323
+ id: t,
2324
+ styleIds: []
2325
+ }, r = [];
2326
+ for (let t of e) {
2327
+ let e;
2328
+ this.styleMirror.has(t) ? e = this.styleMirror.getId(t) : (e = this.styleMirror.add(t), r.push({
2329
+ styleId: e,
2330
+ rules: Array.from(t.rules || CSSRule, (e, n) => ({
2331
+ rule: R(e, t.href),
2332
+ index: n
2333
+ }))
2334
+ })), n.styleIds.push(e);
2335
+ }
2336
+ r.length > 0 && (n.styles = r), this.adoptedStyleSheetCb(n);
2337
+ }
2338
+ reset() {
2339
+ this.styleMirror.reset(), this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
2340
+ }
2341
+ trackStylesheetInLinkElement(e) {}
2342
+ }, xn = class {
2343
+ constructor() {
2344
+ n(this, "nodeMap", /* @__PURE__ */ new WeakMap()), n(this, "active", !1);
2345
+ }
2346
+ inOtherBuffer(e, t) {
2347
+ let n = this.nodeMap.get(e);
2348
+ return n && Array.from(n).some((e) => e !== t);
2349
+ }
2350
+ add(e, t) {
2351
+ this.active || (this.active = !0, requestAnimationFrame(() => {
2352
+ this.nodeMap = /* @__PURE__ */ new WeakMap(), this.active = !1;
2353
+ })), this.nodeMap.set(e, (this.nodeMap.get(e) || /* @__PURE__ */ new Set()).add(t));
2354
+ }
2355
+ destroy() {}
2356
+ }, Q, Sn, Cn, wn = !1;
2357
+ try {
2358
+ if (Array.from([1], (e) => e * 2)[0] !== 2) {
2359
+ let e = document.createElement("iframe");
2360
+ document.body.appendChild(e), Array.from = e.contentWindow?.Array.from || Array.from, document.body.removeChild(e);
2361
+ }
2362
+ } catch (e) {
2363
+ console.debug("Unable to override Array.from", e);
2364
+ }
2365
+ var $ = ue();
2366
+ function Tn(e = {}) {
2367
+ let { emit: t, checkoutEveryNms: n, checkoutEveryNth: a, blockClass: o = "rr-block", blockSelector: s = null, ignoreClass: c = "rr-ignore", ignoreSelector: l = null, maskTextClass: u = "rr-mask", maskTextSelector: d = null, inlineStylesheet: f = !0, maskAllInputs: p, maskInputOptions: m, slimDOMOptions: h, maskInputFn: g, maskTextFn: _, hooks: v, packFn: y, sampling: b = {}, dataURLOptions: x = {}, mousemoveWait: S, recordDOM: C = !0, recordCanvas: w = !1, recordCrossOriginIframes: ee = !1, recordAfter: T = e.recordAfter === "DOMContentLoaded" ? e.recordAfter : "load", userTriggeredOnInput: E = !1, collectFonts: D = !1, inlineImages: O = !1, plugins: k, keepIframeSrcFn: A = () => !1, ignoreCSSAttributes: j = /* @__PURE__ */ new Set([]), errorHandler: te } = e;
2368
+ kt(te);
2369
+ let ne = !ee || window.parent === window, M = !1;
2370
+ if (!ne) try {
2371
+ window.parent.document && (M = !1);
2372
+ } catch {
2373
+ M = !0;
2374
+ }
2375
+ if (ne && !t) throw Error("emit function is required");
2376
+ if (!ne && !M) return () => {};
2377
+ S !== void 0 && b.mousemove === void 0 && (b.mousemove = S), $.reset();
2378
+ let re = p === !0 ? {
2379
+ color: !0,
2380
+ date: !0,
2381
+ "datetime-local": !0,
2382
+ email: !0,
2383
+ month: !0,
2384
+ number: !0,
2385
+ range: !0,
2386
+ search: !0,
2387
+ tel: !0,
2388
+ text: !0,
2389
+ time: !0,
2390
+ url: !0,
2391
+ week: !0,
2392
+ textarea: !0,
2393
+ select: !0,
2394
+ password: !0
2395
+ } : m === void 0 ? { password: !0 } : m, N = Qe(h);
2396
+ pt();
2397
+ let ae, F = 0, I = (e) => {
2398
+ for (let t of k || []) t.eventProcessor && (e = t.eventProcessor(e));
2399
+ return y && !M && (e = y(e)), e;
2400
+ };
2401
+ Q = (e, o) => {
2402
+ let s = e;
2403
+ if (s.timestamp = ie(), Y[0]?.isFrozen() && s.type !== r.FullSnapshot && (s.type !== r.IncrementalSnapshot || s.data.source !== i.Mutation) && Y.forEach((e) => e.unfreeze()), ne) t?.(I(s), o);
2404
+ else if (M) {
2405
+ let e = {
2406
+ type: "rrweb",
2407
+ event: I(s),
2408
+ origin: window.location.origin,
2409
+ isCheckout: o
2410
+ };
2411
+ window.parent.postMessage(e, "*");
2412
+ }
2413
+ if (s.type === r.FullSnapshot) ae = s, F = 0;
2414
+ else if (s.type === r.IncrementalSnapshot) {
2415
+ if (s.data.source === i.Mutation && s.data.isAttachIframe) return;
2416
+ F++;
2417
+ let e = a && F >= a, t = n && s.timestamp - ae.timestamp > n;
2418
+ (e || t) && Sn(!0);
2419
+ }
2420
+ };
2421
+ let oe = (e) => {
2422
+ Q({
2423
+ type: r.IncrementalSnapshot,
2424
+ data: {
2425
+ source: i.Mutation,
2426
+ ...e
2427
+ }
2428
+ });
2429
+ }, se = (e) => Q({
2430
+ type: r.IncrementalSnapshot,
2431
+ data: {
2432
+ source: i.Scroll,
2433
+ ...e
2434
+ }
2435
+ }), L = (e) => Q({
2436
+ type: r.IncrementalSnapshot,
2437
+ data: {
2438
+ source: i.CanvasMutation,
2439
+ ...e
2440
+ }
2441
+ }), R = new bn({
2442
+ mutationCb: oe,
2443
+ adoptedStyleSheetCb: (e) => Q({
2444
+ type: r.IncrementalSnapshot,
2445
+ data: {
2446
+ source: i.AdoptedStyleSheet,
2447
+ ...e
2448
+ }
2449
+ })
2450
+ }), z = new $t({
2451
+ mirror: $,
2452
+ mutationCb: oe,
2453
+ stylesheetManager: R,
2454
+ recordCrossOriginIframes: ee,
2455
+ wrappedEmit: Q
2456
+ });
2457
+ for (let e of k || []) e.getMirror && e.getMirror({
2458
+ nodeMirror: $,
2459
+ crossOriginIframeMirror: z.crossOriginIframeMirror,
2460
+ crossOriginIframeStyleMirror: z.crossOriginIframeStyleMirror
2461
+ });
2462
+ let ce = new xn();
2463
+ Cn = new yn({
2464
+ recordCanvas: w,
2465
+ mutationCb: L,
2466
+ win: window,
2467
+ blockClass: o,
2468
+ blockSelector: s,
2469
+ mirror: $,
2470
+ sampling: b.canvas,
2471
+ dataURLOptions: x
2472
+ });
2473
+ let B = new en({
2474
+ mutationCb: oe,
2475
+ scrollCb: se,
2476
+ bypassOptions: {
2477
+ blockClass: o,
2478
+ blockSelector: s,
2479
+ maskTextClass: u,
2480
+ maskTextSelector: d,
2481
+ inlineStylesheet: f,
2482
+ maskInputOptions: re,
2483
+ dataURLOptions: x,
2484
+ maskTextFn: _,
2485
+ maskInputFn: g,
2486
+ recordCanvas: w,
2487
+ inlineImages: O,
2488
+ sampling: b,
2489
+ slimDOMOptions: N,
2490
+ iframeManager: z,
2491
+ stylesheetManager: R,
2492
+ canvasManager: Cn,
2493
+ keepIframeSrcFn: A,
2494
+ processedNodeManager: ce
2495
+ },
2496
+ mirror: $
2497
+ });
2498
+ Sn = (e = !1) => {
2499
+ if (!C) return;
2500
+ Q({
2501
+ type: r.Meta,
2502
+ data: {
2503
+ href: window.location.href,
2504
+ width: st(),
2505
+ height: ot()
2506
+ }
2507
+ }, e), R.reset(), B.init(), Y.forEach((e) => e.lock());
2508
+ let t = et(document, {
2509
+ mirror: $,
2510
+ blockClass: o,
2511
+ blockSelector: s,
2512
+ maskTextClass: u,
2513
+ maskTextSelector: d,
2514
+ inlineStylesheet: f,
2515
+ maskAllInputs: re,
2516
+ maskTextFn: _,
2517
+ maskInputFn: g,
2518
+ slimDOM: N,
2519
+ dataURLOptions: x,
2520
+ recordCanvas: w,
2521
+ inlineImages: O,
2522
+ onSerialize: (e) => {
2523
+ mt(e, $) && z.addIframe(e), ht(e, $) && R.trackLinkElement(e), gt(e) && B.addShadowRoot(P.shadowRoot(e), document);
2524
+ },
2525
+ onIframeLoad: (e, t) => {
2526
+ z.attachIframe(e, t), B.observeAttachShadow(e);
2527
+ },
2528
+ onStylesheetLoad: (e, t) => {
2529
+ R.attachLinkElement(e, t);
2530
+ },
2531
+ keepIframeSrcFn: A
2532
+ });
2533
+ if (!t) return console.warn("Failed to snapshot the document");
2534
+ Q({
2535
+ type: r.FullSnapshot,
2536
+ data: {
2537
+ node: t,
2538
+ initialOffset: at(window)
2539
+ }
2540
+ }, e), Y.forEach((e) => e.unlock()), document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0 && R.adoptStyleSheets(document.adoptedStyleSheets, $.getId(document));
2541
+ };
2542
+ try {
2543
+ let e = [], t = (e) => J(Yt)({
2544
+ mutationCb: oe,
2545
+ mousemoveCb: (e, t) => Q({
2546
+ type: r.IncrementalSnapshot,
2547
+ data: {
2548
+ source: t,
2549
+ positions: e
2550
+ }
2551
+ }),
2552
+ mouseInteractionCb: (e) => Q({
2553
+ type: r.IncrementalSnapshot,
2554
+ data: {
2555
+ source: i.MouseInteraction,
2556
+ ...e
2557
+ }
2558
+ }),
2559
+ scrollCb: se,
2560
+ viewportResizeCb: (e) => Q({
2561
+ type: r.IncrementalSnapshot,
2562
+ data: {
2563
+ source: i.ViewportResize,
2564
+ ...e
2565
+ }
2566
+ }),
2567
+ inputCb: (e) => Q({
2568
+ type: r.IncrementalSnapshot,
2569
+ data: {
2570
+ source: i.Input,
2571
+ ...e
2572
+ }
2573
+ }),
2574
+ mediaInteractionCb: (e) => Q({
2575
+ type: r.IncrementalSnapshot,
2576
+ data: {
2577
+ source: i.MediaInteraction,
2578
+ ...e
2579
+ }
2580
+ }),
2581
+ styleSheetRuleCb: (e) => Q({
2582
+ type: r.IncrementalSnapshot,
2583
+ data: {
2584
+ source: i.StyleSheetRule,
2585
+ ...e
2586
+ }
2587
+ }),
2588
+ styleDeclarationCb: (e) => Q({
2589
+ type: r.IncrementalSnapshot,
2590
+ data: {
2591
+ source: i.StyleDeclaration,
2592
+ ...e
2593
+ }
2594
+ }),
2595
+ canvasMutationCb: L,
2596
+ fontCb: (e) => Q({
2597
+ type: r.IncrementalSnapshot,
2598
+ data: {
2599
+ source: i.Font,
2600
+ ...e
2601
+ }
2602
+ }),
2603
+ selectionCb: (e) => {
2604
+ Q({
2605
+ type: r.IncrementalSnapshot,
2606
+ data: {
2607
+ source: i.Selection,
2608
+ ...e
2609
+ }
2610
+ });
2611
+ },
2612
+ customElementCb: (e) => {
2613
+ Q({
2614
+ type: r.IncrementalSnapshot,
2615
+ data: {
2616
+ source: i.CustomElement,
2617
+ ...e
2618
+ }
2619
+ });
2620
+ },
2621
+ blockClass: o,
2622
+ ignoreClass: c,
2623
+ ignoreSelector: l,
2624
+ maskTextClass: u,
2625
+ maskTextSelector: d,
2626
+ maskInputOptions: re,
2627
+ inlineStylesheet: f,
2628
+ sampling: b,
2629
+ recordDOM: C,
2630
+ recordCanvas: w,
2631
+ inlineImages: O,
2632
+ userTriggeredOnInput: E,
2633
+ collectFonts: D,
2634
+ doc: e,
2635
+ maskInputFn: g,
2636
+ maskTextFn: _,
2637
+ keepIframeSrcFn: A,
2638
+ blockSelector: s,
2639
+ slimDOMOptions: N,
2640
+ dataURLOptions: x,
2641
+ mirror: $,
2642
+ iframeManager: z,
2643
+ stylesheetManager: R,
2644
+ shadowDomManager: B,
2645
+ processedNodeManager: ce,
2646
+ canvasManager: Cn,
2647
+ ignoreCSSAttributes: j,
2648
+ plugins: (k?.filter((e) => e.observer))?.map((e) => ({
2649
+ observer: e.observer,
2650
+ options: e.options,
2651
+ callback: (t) => Q({
2652
+ type: r.Plugin,
2653
+ data: {
2654
+ plugin: e.name,
2655
+ payload: t
2656
+ }
2657
+ })
2658
+ })) || []
2659
+ }, v);
2660
+ z.addLoadListener((n) => {
2661
+ try {
2662
+ e.push(t(n.contentDocument));
2663
+ } catch (e) {
2664
+ console.warn(e);
2665
+ }
2666
+ });
2667
+ let n = () => {
2668
+ Sn(), e.push(t(document)), wn = !0;
2669
+ };
2670
+ return ["interactive", "complete"].includes(document.readyState) ? n() : (e.push(G("DOMContentLoaded", () => {
2671
+ Q({
2672
+ type: r.DomContentLoaded,
2673
+ data: {}
2674
+ }), T === "DOMContentLoaded" && n();
2675
+ })), e.push(G("load", () => {
2676
+ Q({
2677
+ type: r.Load,
2678
+ data: {}
2679
+ }), T === "load" && n();
2680
+ }, window))), () => {
2681
+ e.forEach((e) => {
2682
+ try {
2683
+ e();
2684
+ } catch (e) {
2685
+ String(e).toLowerCase().includes("cross-origin") || console.warn(e);
2686
+ }
2687
+ }), ce.destroy(), wn = !1, At();
2688
+ };
2689
+ } catch (e) {
2690
+ console.warn(e);
2691
+ }
2692
+ }
2693
+ Tn.addCustomEvent = (e, t) => {
2694
+ if (!wn) throw Error("please add custom event after start recording");
2695
+ Q({
2696
+ type: r.Custom,
2697
+ data: {
2698
+ tag: e,
2699
+ payload: t
2700
+ }
2701
+ });
2702
+ }, Tn.freezePage = () => {
2703
+ Y.forEach((e) => e.freeze());
2704
+ }, Tn.takeFullSnapshot = (e) => {
2705
+ if (!wn) throw Error("please take full snapshot after start recording");
2706
+ Sn(e);
2707
+ }, Tn.mirror = $;
2708
+ // src/privacy.ts
2709
+ var En = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g, Dn = /(?<![\w+])(?:\+\d{1,3}|\(?0\d{1,4}\)?|\(?\d{3}\)?)(?:[ .-]?\(?\d{1,5}\)?){1,6}(?![\w])/g, On = /^\(?\d{3}\)?[ .-]\d{3}[ .-]\d{4}$/;
2710
+ function kn(e) {
2711
+ let t = e.trim(), n = t.replace(/\D/g, "").length;
2712
+ return t.startsWith("+") ? n >= 8 && n <= 15 : /^\(?0/.test(t) ? n >= 10 && n <= 12 : n === 10 && On.test(t);
2713
+ }
2714
+ function An(e) {
2715
+ let t = [];
2716
+ if (e.length < 7) return t;
2717
+ if (e.includes("@")) for (let n of e.matchAll(En)) t.push({
2718
+ start: n.index ?? 0,
2719
+ end: (n.index ?? 0) + n[0].length,
2720
+ kind: "email"
2721
+ });
2722
+ if (/\d{2}/.test(e)) for (let n of e.matchAll(Dn)) {
2723
+ let e = n.index ?? 0, r = e + n[0].length;
2724
+ kn(n[0]) && (t.some((t) => e < t.end && r > t.start) || t.push({
2725
+ start: e,
2726
+ end: r,
2727
+ kind: "phone"
2728
+ }));
2729
+ }
2730
+ return t.sort((e, t) => e.start - t.start);
2731
+ }
2732
+ function jn(e) {
2733
+ let t = An(e);
2734
+ if (!t.length) return e;
2735
+ let n = "", r = 0;
2736
+ for (let i of t) n += e.slice(r, i.start) + "*".repeat(i.end - i.start), r = i.end;
2737
+ return n + e.slice(r);
2738
+ }
2739
+ var Mn = class {
2740
+ constructor(e = 3e4, t = Date.now, n = 5e4) {
2741
+ this.windowMs = e, this.now = t, this.maxEvents = n, this.segments = [];
2742
+ }
2743
+ push(e) {
2744
+ e.type !== 4 && this.segments.length || this.segments.push([]), this.segments[this.segments.length - 1].push(e), this.trim();
2745
+ }
2746
+ trim() {
2747
+ let e = this.now() - this.windowMs;
2748
+ for (; this.segments.length > 1 && (this.segments[1][0]?.timestamp ?? Infinity) <= e;) this.segments.shift();
2749
+ for (; this.segments.length > 1 && this.count() > this.maxEvents;) this.segments.shift();
2750
+ }
2751
+ count() {
2752
+ let e = 0;
2753
+ for (let t of this.segments) e += t.length;
2754
+ return e;
2755
+ }
2756
+ events(e = Infinity) {
2757
+ this.trim();
2758
+ let t = Math.max(0, this.segments.length - e);
2759
+ return this.segments.slice(t).flat();
2760
+ }
2761
+ get segmentCount() {
2762
+ return this.segments.length;
2763
+ }
2764
+ clear() {
2765
+ this.segments = [];
2766
+ }
2767
+ };
2768
+ function Nn(e) {
2769
+ let t = "", n = 32768;
2770
+ for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
2771
+ return btoa(t);
2772
+ }
2773
+ async function Pn(e) {
2774
+ if (typeof CompressionStream != "function") return null;
2775
+ try {
2776
+ let t = new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));
2777
+ return new Uint8Array(await new Response(t).arrayBuffer());
2778
+ } catch {
2779
+ return null;
2780
+ }
2781
+ }
2782
+ // src/capture/text.ts
2783
+ var Fn = /^(access_?token|token|id_token|refresh_token|auth|authorization|api_?key|key|secret|password|passwd|pwd|session|sessionid|sid|code|signature|sig)$/i;
2784
+ function In(e, t) {
2785
+ try {
2786
+ let n = new URL(e, t);
2787
+ n.hash = "", n.username = "", n.password = "";
2788
+ for (let e of [...n.searchParams.keys()]) Fn.test(e) && n.searchParams.set(e, "[hidden]");
2789
+ return n.toString();
2790
+ } catch {
2791
+ return String(e);
2792
+ }
2793
+ }
2794
+ // src/replay/sanitize.ts
2795
+ var Ln = /* @__PURE__ */ new Set([
2796
+ "href",
2797
+ "src",
2798
+ "action",
2799
+ "formaction",
2800
+ "poster",
2801
+ "cite",
2802
+ "data",
2803
+ "background",
2804
+ "longdesc",
2805
+ "ping",
2806
+ "xlink:href"
2807
+ ]), Rn = /* @__PURE__ */ new Set([
2808
+ "alt",
2809
+ "title",
2810
+ "placeholder",
2811
+ "label",
2812
+ "value",
2813
+ "summary",
2814
+ "abbr",
2815
+ "aria-label",
2816
+ "aria-description",
2817
+ "aria-roledescription",
2818
+ "aria-valuetext",
2819
+ "aria-placeholder"
2820
+ ]), zn = (e) => e === "style" || e === "_cssText" || e.startsWith("rr_");
2821
+ function Bn(e, t) {
2822
+ let n = e.trim();
2823
+ return !n || /^(data|blob):/i.test(n) ? e : n.startsWith("#") ? "#" : jn(In(n, t));
2824
+ }
2825
+ function Vn(e, t) {
2826
+ return e.split(",").map((e) => {
2827
+ let [n, ...r] = e.trim().split(/\s+/);
2828
+ return n ? [Bn(n, t), ...r].join(" ") : e;
2829
+ }).join(", ");
2830
+ }
2831
+ function Hn(e, t, n, r = !1) {
2832
+ let i = {}, a = t?.toLowerCase() === "input" && String(e.type ?? "").toLowerCase() === "hidden";
2833
+ for (let t in e) {
2834
+ let o = e[t], s = t.toLowerCase();
2835
+ a && s === "value" || (i[t] = typeof o != "string" || zn(s) ? o : Ln.has(s) ? Bn(o, n) : s === "srcset" ? Vn(o, n) : r && Rn.has(s) ? o.replace(/\S/g, "*") : jn(o));
2836
+ }
2837
+ return i;
2838
+ }
2839
+ function Un(e, t = typeof location > "u" ? void 0 : location.href, n = {}) {
2840
+ return JSON.stringify(e, function(e, r) {
2841
+ if (e === "attributes" && r && typeof r == "object" && !Array.isArray(r)) return Hn(r, this.tagName, t, n.maskText === !0);
2842
+ if (e === "data" && this.type === 4 && r && typeof r == "object" && typeof r.href == "string") {
2843
+ let e = r;
2844
+ return {
2845
+ ...e,
2846
+ href: Bn(e.href, t)
2847
+ };
2848
+ }
2849
+ return r;
2850
+ });
2851
+ }
2852
+ // src/replay/recorder.ts
2853
+ var Wn = 3e4, Gn = 1e4, Kn = "[contenteditable]:not([contenteditable=false])", qn = "img,picture,video,canvas,iframe", Jn = (e) => e.replace(/\S/g, "*");
2854
+ function Yn(e = {}) {
2855
+ let t = e.mask !== "inputs", n = new Mn(Wn), r = Tn({
2856
+ emit: (e) => {
2857
+ try {
2858
+ n.push(e);
2859
+ } catch {}
2860
+ },
2861
+ checkoutEveryNms: Gn,
2862
+ maskAllInputs: !0,
2863
+ blockClass: "pinax-mask",
2864
+ blockSelector: [
2865
+ "[data-pinax-mask]",
2866
+ "input[type=hidden]",
2867
+ t ? qn : "",
2868
+ e.exclude
2869
+ ].filter(Boolean).join(","),
2870
+ maskTextClass: "pinax-mask",
2871
+ maskTextSelector: "*",
2872
+ maskTextFn: (e, n) => {
2873
+ if (t) return Jn(e);
2874
+ try {
2875
+ return n?.closest?.(`${Kn},[data-pinax-mask],.pinax-mask`) ? Jn(e) : jn(e);
2876
+ } catch {
2877
+ return Jn(e);
2878
+ }
2879
+ },
2880
+ slimDOMOptions: "all",
2881
+ recordCanvas: !1,
2882
+ collectFonts: !1,
2883
+ inlineImages: !1,
2884
+ sampling: {
2885
+ mousemove: 50,
2886
+ scroll: 150,
2887
+ media: 800,
2888
+ input: "last"
2889
+ },
2890
+ errorHandler: () => !0
2891
+ });
2892
+ return {
2893
+ async exportReplay(e) {
2894
+ let r = n.segmentCount;
2895
+ for (let i = r; i >= 1; i--) {
2896
+ let r = n.events(i);
2897
+ if (!r.length) return null;
2898
+ let a = await Pn(Un(r, void 0, { maskText: t }));
2899
+ if (!a) return null;
2900
+ let o = Nn(a);
2901
+ if (o.length <= e) return o;
2902
+ }
2903
+ return null;
2904
+ },
2905
+ stop() {
2906
+ try {
2907
+ r?.();
2908
+ } catch {}
2909
+ n.clear();
2910
+ }
2911
+ };
2912
+ }
2913
+ export { Gn as CHECKOUT_MS, qn as MEDIA, Wn as WINDOW_MS, Yn as startRecorder };
2914
+
2915
+ //# sourceMappingURL=pinax-recorder.js.map