@gram-ai/elements 1.20.2 → 1.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +14 -12
- package/dist/components/Chat/stories/ConnectionConfiguration.stories.d.ts +2 -2
- package/dist/components/Chat/stories/ToolApproval.stories.d.ts +2 -0
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/tooltip.d.ts +3 -1
- package/dist/constants/tailwind.d.ts +1 -0
- package/dist/contexts/portal-container-context.d.ts +2 -0
- package/dist/contexts/portal-container.d.ts +7 -0
- package/dist/elements.cjs +1 -160
- package/dist/elements.cjs.map +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +11 -47215
- package/dist/elements.js.map +1 -1
- package/dist/hooks/usePortalContainer.d.ts +8 -0
- package/dist/hooks/useSession.d.ts +1 -2
- package/dist/index-BVvrv2G3.cjs +169 -0
- package/dist/index-BVvrv2G3.cjs.map +1 -0
- package/dist/index-OU3wjArm.js +54670 -0
- package/dist/index-OU3wjArm.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/lib/auth.d.ts +2 -2
- package/dist/lib/errorTracking.config.d.ts +16 -0
- package/dist/lib/errorTracking.d.ts +24 -0
- package/dist/lib/tools.d.ts +3 -2
- package/dist/profiler-DPH9zydw.cjs +2 -0
- package/dist/profiler-DPH9zydw.cjs.map +1 -0
- package/dist/profiler-D_HNXmyv.js +278 -0
- package/dist/profiler-D_HNXmyv.js.map +1 -0
- package/dist/startRecording-B97e4Mlu.cjs +3 -0
- package/dist/startRecording-B97e4Mlu.cjs.map +1 -0
- package/dist/startRecording-DOMzQAAr.js +1212 -0
- package/dist/startRecording-DOMzQAAr.js.map +1 -0
- package/dist/types/index.d.ts +45 -15
- package/package.json +16 -2
- package/src/components/Chat/index.tsx +31 -3
- package/src/components/Chat/stories/Composer.stories.tsx +0 -7
- package/src/components/Chat/stories/ConnectionConfiguration.stories.tsx +7 -14
- package/src/components/Chat/stories/CustomComponents.stories.tsx +0 -7
- package/src/components/Chat/stories/Density.stories.tsx +0 -7
- package/src/components/Chat/stories/ErrorBoundary.stories.tsx +4 -23
- package/src/components/Chat/stories/FrontendTools.stories.tsx +0 -7
- package/src/components/Chat/stories/Model.stories.tsx +0 -7
- package/src/components/Chat/stories/Plugins.stories.tsx +0 -7
- package/src/components/Chat/stories/Radius.stories.tsx +0 -7
- package/src/components/Chat/stories/ToolApproval.stories.tsx +51 -7
- package/src/components/Chat/stories/Tools.stories.tsx +0 -7
- package/src/components/Chat/stories/Variants.stories.tsx +5 -2
- package/src/components/Chat/stories/Welcome.stories.tsx +0 -8
- package/src/components/assistant-ui/assistant-sidecar.tsx +1 -4
- package/src/components/assistant-ui/attachment.tsx +1 -4
- package/src/components/assistant-ui/error-boundary.tsx +6 -0
- package/src/components/assistant-ui/thread-list.tsx +3 -1
- package/src/components/assistant-ui/thread.tsx +10 -12
- package/src/components/ui/dialog.tsx +10 -1
- package/src/components/ui/popover.tsx +10 -12
- package/src/components/ui/tooltip.tsx +7 -2
- package/src/constants/tailwind.ts +2 -0
- package/src/contexts/ElementsProvider.tsx +13 -1
- package/src/contexts/portal-container-context.ts +4 -0
- package/src/contexts/portal-container.tsx +20 -0
- package/src/global.css +129 -16
- package/src/hooks/useAuth.ts +6 -16
- package/src/hooks/usePortalContainer.ts +16 -0
- package/src/hooks/useSession.ts +1 -3
- package/src/index.ts +5 -0
- package/src/lib/api.test.ts +5 -5
- package/src/lib/auth.ts +4 -4
- package/src/lib/errorTracking.config.ts +16 -0
- package/src/lib/errorTracking.ts +104 -0
- package/src/lib/tools.ts +37 -8
- package/src/types/index.ts +48 -16
- package/src/vite-env.d.ts +3 -0
- package/dist/components/Chat/stories/ColorScheme.stories.d.ts +0 -8
- package/src/components/Chat/stories/ColorScheme.stories.tsx +0 -52
|
@@ -0,0 +1,1212 @@
|
|
|
1
|
+
import { i as X, t as I, a as L, b as R, g as w, N as S, c as j, d as q, e as ht, f as mt, n as C, h as D, R as gt, A as St, s as z, C as J, j as Tt, k as Et, l as B, m as yt, o as Nt, p as K, r as It, q as wt, P as Mt, u as bt, v as Ct, w as Q, x as Z, y as tt, z as v, B as Rt, D as xt, E as vt, F as V, G as _t, H as Dt, I as At, J as Lt, K as Ot, L as zt, M as Vt, O as kt, Q as Pt, S as Ft, T as Ut, U as Bt, V as Ht, W as Gt, X as Wt } from "./index-OU3wjArm.js";
|
|
2
|
+
const N = {
|
|
3
|
+
FullSnapshot: 2,
|
|
4
|
+
IncrementalSnapshot: 3,
|
|
5
|
+
Meta: 4,
|
|
6
|
+
Focus: 6,
|
|
7
|
+
ViewEnd: 7,
|
|
8
|
+
VisualViewport: 8,
|
|
9
|
+
FrustrationRecord: 9
|
|
10
|
+
}, b = {
|
|
11
|
+
Document: 0,
|
|
12
|
+
DocumentType: 1,
|
|
13
|
+
Element: 2,
|
|
14
|
+
Text: 3,
|
|
15
|
+
CDATA: 4,
|
|
16
|
+
DocumentFragment: 11
|
|
17
|
+
}, T = {
|
|
18
|
+
Mutation: 0,
|
|
19
|
+
MouseMove: 1,
|
|
20
|
+
MouseInteraction: 2,
|
|
21
|
+
Scroll: 3,
|
|
22
|
+
ViewportResize: 4,
|
|
23
|
+
Input: 5,
|
|
24
|
+
TouchMove: 6,
|
|
25
|
+
MediaInteraction: 7,
|
|
26
|
+
StyleSheetRule: 8
|
|
27
|
+
// CanvasMutation : 9,
|
|
28
|
+
// Font : 10,
|
|
29
|
+
}, E = {
|
|
30
|
+
MouseUp: 0,
|
|
31
|
+
MouseDown: 1,
|
|
32
|
+
Click: 2,
|
|
33
|
+
ContextMenu: 3,
|
|
34
|
+
DblClick: 4,
|
|
35
|
+
Focus: 5,
|
|
36
|
+
Blur: 6,
|
|
37
|
+
TouchStart: 7,
|
|
38
|
+
TouchEnd: 9
|
|
39
|
+
}, H = {
|
|
40
|
+
Play: 0,
|
|
41
|
+
Pause: 1
|
|
42
|
+
};
|
|
43
|
+
function et(t) {
|
|
44
|
+
return !!t.changedTouches;
|
|
45
|
+
}
|
|
46
|
+
function _(t) {
|
|
47
|
+
return t.composed === !0 && X(t.target) ? t.composedPath()[0] : t.target;
|
|
48
|
+
}
|
|
49
|
+
const G = 25;
|
|
50
|
+
function $t(t) {
|
|
51
|
+
return Math.abs(t.pageTop - t.offsetTop - window.scrollY) > G || Math.abs(t.pageLeft - t.offsetLeft - window.scrollX) > G;
|
|
52
|
+
}
|
|
53
|
+
const Yt = (t, n) => {
|
|
54
|
+
const e = window.visualViewport, o = {
|
|
55
|
+
layoutViewportX: t,
|
|
56
|
+
layoutViewportY: n,
|
|
57
|
+
visualViewportX: t,
|
|
58
|
+
visualViewportY: n
|
|
59
|
+
};
|
|
60
|
+
if (e)
|
|
61
|
+
$t(e) ? (o.layoutViewportX = Math.round(t + e.offsetLeft), o.layoutViewportY = Math.round(n + e.offsetTop)) : (o.visualViewportX = Math.round(t - e.offsetLeft), o.visualViewportY = Math.round(n - e.offsetTop));
|
|
62
|
+
else return o;
|
|
63
|
+
return o;
|
|
64
|
+
}, nt = (t) => ({
|
|
65
|
+
scale: t.scale,
|
|
66
|
+
offsetLeft: t.offsetLeft,
|
|
67
|
+
offsetTop: t.offsetTop,
|
|
68
|
+
pageLeft: t.pageLeft,
|
|
69
|
+
pageTop: t.pageTop,
|
|
70
|
+
height: t.height,
|
|
71
|
+
width: t.width
|
|
72
|
+
});
|
|
73
|
+
function y(t, n) {
|
|
74
|
+
return {
|
|
75
|
+
data: {
|
|
76
|
+
source: t,
|
|
77
|
+
...n
|
|
78
|
+
},
|
|
79
|
+
type: N.IncrementalSnapshot,
|
|
80
|
+
timestamp: I()
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const Xt = 50;
|
|
84
|
+
function jt(t, n, e) {
|
|
85
|
+
const { throttled: o, cancel: s } = L((r) => {
|
|
86
|
+
const u = _(r), a = n.nodeIds.get(u);
|
|
87
|
+
if (a === void 0)
|
|
88
|
+
return;
|
|
89
|
+
const c = st(r);
|
|
90
|
+
if (!c)
|
|
91
|
+
return;
|
|
92
|
+
const d = {
|
|
93
|
+
id: a,
|
|
94
|
+
timeOffset: 0,
|
|
95
|
+
x: c.x,
|
|
96
|
+
y: c.y
|
|
97
|
+
};
|
|
98
|
+
e(y(et(r) ? T.TouchMove : T.MouseMove, { positions: [d] }));
|
|
99
|
+
}, Xt, {
|
|
100
|
+
trailing: !1
|
|
101
|
+
}), { stop: i } = R(t, document, [
|
|
102
|
+
"mousemove",
|
|
103
|
+
"touchmove"
|
|
104
|
+
/* DOM_EVENT.TOUCH_MOVE */
|
|
105
|
+
], o, {
|
|
106
|
+
capture: !0,
|
|
107
|
+
passive: !0
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
stop: () => {
|
|
111
|
+
i(), s();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function st(t) {
|
|
116
|
+
let { clientX: n, clientY: e } = et(t) ? t.changedTouches[0] : t;
|
|
117
|
+
if (window.visualViewport) {
|
|
118
|
+
const { visualViewportX: o, visualViewportY: s } = Yt(n, e);
|
|
119
|
+
n = o, e = s;
|
|
120
|
+
}
|
|
121
|
+
if (!(!Number.isFinite(n) || !Number.isFinite(e)))
|
|
122
|
+
return { x: n, y: e };
|
|
123
|
+
}
|
|
124
|
+
const W = {
|
|
125
|
+
// Listen for pointerup DOM events instead of mouseup for MouseInteraction/MouseUp records. This
|
|
126
|
+
// allows to reference such records from Frustration records.
|
|
127
|
+
//
|
|
128
|
+
// In the context of supporting Mobile Session Replay, we introduced `PointerInteraction` records
|
|
129
|
+
// used by the Mobile SDKs in place of `MouseInteraction`. In the future, we should replace
|
|
130
|
+
// `MouseInteraction` by `PointerInteraction` in the Browser SDK so we have an uniform way to
|
|
131
|
+
// convey such interaction. This would cleanly solve the issue since we would have
|
|
132
|
+
// `PointerInteraction/Up` records that we could reference from `Frustration` records.
|
|
133
|
+
pointerup: E.MouseUp,
|
|
134
|
+
mousedown: E.MouseDown,
|
|
135
|
+
click: E.Click,
|
|
136
|
+
contextmenu: E.ContextMenu,
|
|
137
|
+
dblclick: E.DblClick,
|
|
138
|
+
focus: E.Focus,
|
|
139
|
+
blur: E.Blur,
|
|
140
|
+
touchstart: E.TouchStart,
|
|
141
|
+
touchend: E.TouchEnd
|
|
142
|
+
};
|
|
143
|
+
function qt(t, n, e, o) {
|
|
144
|
+
const s = (i) => {
|
|
145
|
+
const r = _(i), u = n.nodeIds.get(r);
|
|
146
|
+
if (u === void 0 || w(r, t.defaultPrivacyLevel) === S.HIDDEN)
|
|
147
|
+
return;
|
|
148
|
+
const a = W[i.type];
|
|
149
|
+
let c;
|
|
150
|
+
if (a !== E.Blur && a !== E.Focus) {
|
|
151
|
+
const l = st(i);
|
|
152
|
+
if (!l)
|
|
153
|
+
return;
|
|
154
|
+
c = { id: u, type: a, x: l.x, y: l.y };
|
|
155
|
+
} else
|
|
156
|
+
c = { id: u, type: a };
|
|
157
|
+
const d = {
|
|
158
|
+
id: o.getIdForEvent(i),
|
|
159
|
+
...y(T.MouseInteraction, c)
|
|
160
|
+
};
|
|
161
|
+
e(d);
|
|
162
|
+
};
|
|
163
|
+
return R(t, document, Object.keys(W), s, {
|
|
164
|
+
capture: !0,
|
|
165
|
+
passive: !0
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const Jt = 100;
|
|
169
|
+
function ot(t, n, e, o, s = document) {
|
|
170
|
+
const { throttled: i, cancel: r } = L((a) => {
|
|
171
|
+
const c = _(a);
|
|
172
|
+
if (!c)
|
|
173
|
+
return;
|
|
174
|
+
const d = n.nodeIds.get(c);
|
|
175
|
+
if (d === void 0 || w(c, t.defaultPrivacyLevel) === S.HIDDEN)
|
|
176
|
+
return;
|
|
177
|
+
const l = c === document ? {
|
|
178
|
+
scrollTop: j(),
|
|
179
|
+
scrollLeft: q()
|
|
180
|
+
} : {
|
|
181
|
+
scrollTop: Math.round(c.scrollTop),
|
|
182
|
+
scrollLeft: Math.round(c.scrollLeft)
|
|
183
|
+
};
|
|
184
|
+
o.set(c, l), e(y(T.Scroll, {
|
|
185
|
+
id: d,
|
|
186
|
+
x: l.scrollLeft,
|
|
187
|
+
y: l.scrollTop
|
|
188
|
+
}));
|
|
189
|
+
}, Jt), { stop: u } = ht(t, s, "scroll", i, {
|
|
190
|
+
capture: !0,
|
|
191
|
+
passive: !0
|
|
192
|
+
});
|
|
193
|
+
return {
|
|
194
|
+
stop: () => {
|
|
195
|
+
u(), r();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const Kt = 200;
|
|
200
|
+
function Qt(t, n) {
|
|
201
|
+
const e = mt(t).subscribe((o) => {
|
|
202
|
+
n(y(T.ViewportResize, o));
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
stop: () => {
|
|
206
|
+
e.unsubscribe();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function Zt(t, n) {
|
|
211
|
+
const e = window.visualViewport;
|
|
212
|
+
if (!e)
|
|
213
|
+
return { stop: C };
|
|
214
|
+
const { throttled: o, cancel: s } = L(() => {
|
|
215
|
+
n({
|
|
216
|
+
data: nt(e),
|
|
217
|
+
type: N.VisualViewport,
|
|
218
|
+
timestamp: I()
|
|
219
|
+
});
|
|
220
|
+
}, Kt, {
|
|
221
|
+
trailing: !1
|
|
222
|
+
}), { stop: i } = R(t, e, [
|
|
223
|
+
"resize",
|
|
224
|
+
"scroll"
|
|
225
|
+
/* DOM_EVENT.SCROLL */
|
|
226
|
+
], o, {
|
|
227
|
+
capture: !0,
|
|
228
|
+
passive: !0
|
|
229
|
+
});
|
|
230
|
+
return {
|
|
231
|
+
stop: () => {
|
|
232
|
+
i(), s();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function te(t, n, e) {
|
|
237
|
+
return R(t, document, [
|
|
238
|
+
"play",
|
|
239
|
+
"pause"
|
|
240
|
+
/* DOM_EVENT.PAUSE */
|
|
241
|
+
], (o) => {
|
|
242
|
+
const s = _(o);
|
|
243
|
+
if (!s)
|
|
244
|
+
return;
|
|
245
|
+
const i = n.nodeIds.get(s);
|
|
246
|
+
i === void 0 || w(s, t.defaultPrivacyLevel) === S.HIDDEN || e(y(T.MediaInteraction, {
|
|
247
|
+
id: i,
|
|
248
|
+
type: o.type === "play" ? H.Play : H.Pause
|
|
249
|
+
}));
|
|
250
|
+
}, {
|
|
251
|
+
capture: !0,
|
|
252
|
+
passive: !0
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function ee(t, n) {
|
|
256
|
+
function e(i, r) {
|
|
257
|
+
if (!i || !i.ownerNode)
|
|
258
|
+
return;
|
|
259
|
+
const u = t.nodeIds.get(i.ownerNode);
|
|
260
|
+
u !== void 0 && r(u);
|
|
261
|
+
}
|
|
262
|
+
const o = [
|
|
263
|
+
D(CSSStyleSheet.prototype, "insertRule", ({ target: i, parameters: [r, u] }) => {
|
|
264
|
+
e(i, (a) => n(y(T.StyleSheetRule, {
|
|
265
|
+
id: a,
|
|
266
|
+
adds: [{ rule: r, index: u }]
|
|
267
|
+
})));
|
|
268
|
+
}),
|
|
269
|
+
D(CSSStyleSheet.prototype, "deleteRule", ({ target: i, parameters: [r] }) => {
|
|
270
|
+
e(i, (u) => n(y(T.StyleSheetRule, {
|
|
271
|
+
id: u,
|
|
272
|
+
removes: [{ index: r }]
|
|
273
|
+
})));
|
|
274
|
+
})
|
|
275
|
+
];
|
|
276
|
+
typeof CSSGroupingRule < "u" ? s(CSSGroupingRule) : (s(CSSMediaRule), s(CSSSupportsRule));
|
|
277
|
+
function s(i) {
|
|
278
|
+
o.push(D(i.prototype, "insertRule", ({ target: r, parameters: [u, a] }) => {
|
|
279
|
+
e(r.parentStyleSheet, (c) => {
|
|
280
|
+
const d = $(r);
|
|
281
|
+
d && (d.push(a || 0), n(y(T.StyleSheetRule, {
|
|
282
|
+
id: c,
|
|
283
|
+
adds: [{ rule: u, index: d }]
|
|
284
|
+
})));
|
|
285
|
+
});
|
|
286
|
+
}), D(i.prototype, "deleteRule", ({ target: r, parameters: [u] }) => {
|
|
287
|
+
e(r.parentStyleSheet, (a) => {
|
|
288
|
+
const c = $(r);
|
|
289
|
+
c && (c.push(u), n(y(T.StyleSheetRule, {
|
|
290
|
+
id: a,
|
|
291
|
+
removes: [{ index: c }]
|
|
292
|
+
})));
|
|
293
|
+
});
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
stop: () => {
|
|
298
|
+
o.forEach((i) => i.stop());
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function $(t) {
|
|
303
|
+
const n = [];
|
|
304
|
+
let e = t;
|
|
305
|
+
for (; e.parentRule; ) {
|
|
306
|
+
const r = Array.from(e.parentRule.cssRules).indexOf(e);
|
|
307
|
+
n.unshift(r), e = e.parentRule;
|
|
308
|
+
}
|
|
309
|
+
if (!e.parentStyleSheet)
|
|
310
|
+
return;
|
|
311
|
+
const s = Array.from(e.parentStyleSheet.cssRules).indexOf(e);
|
|
312
|
+
return n.unshift(s), n;
|
|
313
|
+
}
|
|
314
|
+
function ne(t, n) {
|
|
315
|
+
return R(t, window, [
|
|
316
|
+
"focus",
|
|
317
|
+
"blur"
|
|
318
|
+
/* DOM_EVENT.BLUR */
|
|
319
|
+
], () => {
|
|
320
|
+
n({
|
|
321
|
+
data: { has_focus: document.hasFocus() },
|
|
322
|
+
type: N.Focus,
|
|
323
|
+
timestamp: I()
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function se(t, n, e) {
|
|
328
|
+
const o = t.subscribe(12, (s) => {
|
|
329
|
+
var i, r;
|
|
330
|
+
s.rawRumEvent.type === gt.ACTION && s.rawRumEvent.action.type === St.CLICK && (!((r = (i = s.rawRumEvent.action.frustration) === null || i === void 0 ? void 0 : i.type) === null || r === void 0) && r.length) && "events" in s.domainContext && s.domainContext.events && s.domainContext.events.length && n({
|
|
331
|
+
timestamp: s.rawRumEvent.date,
|
|
332
|
+
type: N.FrustrationRecord,
|
|
333
|
+
data: {
|
|
334
|
+
frustrationTypes: s.rawRumEvent.action.frustration.type,
|
|
335
|
+
recordIds: s.domainContext.events.map((u) => e.getIdForEvent(u))
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
return {
|
|
340
|
+
stop: () => {
|
|
341
|
+
o.unsubscribe();
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function oe(t, n) {
|
|
346
|
+
const e = t.subscribe(5, () => {
|
|
347
|
+
n({
|
|
348
|
+
timestamp: I(),
|
|
349
|
+
type: N.ViewEnd
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
return {
|
|
353
|
+
stop: () => {
|
|
354
|
+
e.unsubscribe();
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function k(t, n) {
|
|
359
|
+
const e = t.tagName, o = t.value;
|
|
360
|
+
if (z(t, n)) {
|
|
361
|
+
const s = t.type;
|
|
362
|
+
return e === "INPUT" && (s === "button" || s === "submit" || s === "reset") ? o : !o || e === "OPTION" ? void 0 : J;
|
|
363
|
+
}
|
|
364
|
+
if (e === "OPTION" || e === "SELECT")
|
|
365
|
+
return t.value;
|
|
366
|
+
if (!(e !== "INPUT" && e !== "TEXTAREA"))
|
|
367
|
+
return o;
|
|
368
|
+
}
|
|
369
|
+
const re = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm, ie = /^[A-Za-z]+:|^\/\//, ae = /^["']?data:.*,/i;
|
|
370
|
+
function ue(t, n) {
|
|
371
|
+
return t.replace(re, (e, o, s, i, r, u) => {
|
|
372
|
+
const a = s || r || u;
|
|
373
|
+
if (!n || !a || ie.test(a) || ae.test(a))
|
|
374
|
+
return e;
|
|
375
|
+
const c = o || i || "";
|
|
376
|
+
return `url(${c}${ce(a, n)}${c})`;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function ce(t, n) {
|
|
380
|
+
try {
|
|
381
|
+
return Tt(t, n).href;
|
|
382
|
+
} catch {
|
|
383
|
+
return t;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const de = /[^a-z1-6-_]/;
|
|
387
|
+
function rt(t) {
|
|
388
|
+
const n = t.toLowerCase().trim();
|
|
389
|
+
return de.test(n) ? "div" : n;
|
|
390
|
+
}
|
|
391
|
+
function Y(t, n) {
|
|
392
|
+
return `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' style='background-color:silver'%3E%3C/svg%3E`;
|
|
393
|
+
}
|
|
394
|
+
function it(t) {
|
|
395
|
+
if (!(t === void 0 || t.length === 0))
|
|
396
|
+
return t.map((n) => {
|
|
397
|
+
const e = n.cssRules || n.rules;
|
|
398
|
+
return {
|
|
399
|
+
cssRules: Array.from(e, (i) => i.cssText),
|
|
400
|
+
disabled: n.disabled || void 0,
|
|
401
|
+
media: n.media.length > 0 ? Array.from(n.media) : void 0
|
|
402
|
+
};
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
const le = 1e6;
|
|
406
|
+
function at(t, n, e, o) {
|
|
407
|
+
if (n === S.HIDDEN)
|
|
408
|
+
return null;
|
|
409
|
+
const s = t.getAttribute(e), i = t.tagName;
|
|
410
|
+
if (Et(i, e, s, n, o)) {
|
|
411
|
+
if (i === "IMG") {
|
|
412
|
+
const r = t;
|
|
413
|
+
if (r.naturalWidth > 0)
|
|
414
|
+
return Y(r.naturalWidth, r.naturalHeight);
|
|
415
|
+
const { width: u, height: a } = t.getBoundingClientRect();
|
|
416
|
+
return u > 0 || a > 0 ? Y(u, a) : B;
|
|
417
|
+
}
|
|
418
|
+
return i === "SOURCE" ? B : J;
|
|
419
|
+
}
|
|
420
|
+
return !s || typeof s != "string" ? s : yt(s, le);
|
|
421
|
+
}
|
|
422
|
+
function P() {
|
|
423
|
+
return {
|
|
424
|
+
cssText: {
|
|
425
|
+
count: 0,
|
|
426
|
+
max: 0,
|
|
427
|
+
sum: 0
|
|
428
|
+
},
|
|
429
|
+
serializationDuration: {
|
|
430
|
+
count: 0,
|
|
431
|
+
max: 0,
|
|
432
|
+
sum: 0
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function A(t, n, e) {
|
|
437
|
+
t[n].count += 1, t[n].max = Math.max(t[n].max, e), t[n].sum += e;
|
|
438
|
+
}
|
|
439
|
+
function fe(t, n) {
|
|
440
|
+
for (const e of ["cssText", "serializationDuration"])
|
|
441
|
+
t[e].count += n[e].count, t[e].max = Math.max(t[e].max, n[e].max), t[e].sum += n[e].sum;
|
|
442
|
+
}
|
|
443
|
+
function pe(t, n, e) {
|
|
444
|
+
if (n === S.HIDDEN)
|
|
445
|
+
return {};
|
|
446
|
+
const o = {}, s = rt(t.tagName), i = t.ownerDocument;
|
|
447
|
+
for (let d = 0; d < t.attributes.length; d += 1) {
|
|
448
|
+
const f = t.attributes.item(d).name, p = at(t, n, f, e.configuration);
|
|
449
|
+
p !== null && (o[f] = p);
|
|
450
|
+
}
|
|
451
|
+
if (t.value && (s === "textarea" || s === "select" || s === "option" || s === "input")) {
|
|
452
|
+
const d = k(t, n);
|
|
453
|
+
d !== void 0 && (o.value = d);
|
|
454
|
+
}
|
|
455
|
+
if (s === "option" && n === S.ALLOW) {
|
|
456
|
+
const d = t;
|
|
457
|
+
d.selected && (o.selected = d.selected);
|
|
458
|
+
}
|
|
459
|
+
if (s === "link") {
|
|
460
|
+
const d = Array.from(i.styleSheets).find((f) => f.href === t.href), l = O(d);
|
|
461
|
+
l && d && (A(e.serializationContext.serializationStats, "cssText", l.length), o._cssText = l);
|
|
462
|
+
}
|
|
463
|
+
if (s === "style" && t.sheet) {
|
|
464
|
+
const d = O(t.sheet);
|
|
465
|
+
d && (A(e.serializationContext.serializationStats, "cssText", d.length), o._cssText = d);
|
|
466
|
+
}
|
|
467
|
+
const r = t;
|
|
468
|
+
if (s === "input" && (r.type === "radio" || r.type === "checkbox") && (n === S.ALLOW ? o.checked = !!r.checked : z(r, n) && delete o.checked), s === "audio" || s === "video") {
|
|
469
|
+
const d = t;
|
|
470
|
+
o.rr_mediaState = d.paused ? "paused" : "played";
|
|
471
|
+
}
|
|
472
|
+
let u, a;
|
|
473
|
+
const c = e.serializationContext;
|
|
474
|
+
switch (c.status) {
|
|
475
|
+
case 0:
|
|
476
|
+
u = Math.round(t.scrollTop), a = Math.round(t.scrollLeft), (u || a) && c.elementsScrollPositions.set(t, { scrollTop: u, scrollLeft: a });
|
|
477
|
+
break;
|
|
478
|
+
case 1:
|
|
479
|
+
c.elementsScrollPositions.has(t) && ({ scrollTop: u, scrollLeft: a } = c.elementsScrollPositions.get(t));
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
return a && (o.rr_scrollLeft = a), u && (o.rr_scrollTop = u), o;
|
|
483
|
+
}
|
|
484
|
+
function O(t) {
|
|
485
|
+
if (!t)
|
|
486
|
+
return null;
|
|
487
|
+
let n;
|
|
488
|
+
try {
|
|
489
|
+
n = t.rules || t.cssRules;
|
|
490
|
+
} catch {
|
|
491
|
+
}
|
|
492
|
+
if (!n)
|
|
493
|
+
return null;
|
|
494
|
+
const e = Array.from(n, Nt() ? he : ut).join("");
|
|
495
|
+
return ue(e, t.href);
|
|
496
|
+
}
|
|
497
|
+
function he(t) {
|
|
498
|
+
if (ge(t) && t.selectorText.includes(":")) {
|
|
499
|
+
const n = /(\[[\w-]+[^\\])(:[^\]]+\])/g;
|
|
500
|
+
return t.cssText.replace(n, "$1\\$2");
|
|
501
|
+
}
|
|
502
|
+
return ut(t);
|
|
503
|
+
}
|
|
504
|
+
function ut(t) {
|
|
505
|
+
return me(t) && O(t.styleSheet) || t.cssText;
|
|
506
|
+
}
|
|
507
|
+
function me(t) {
|
|
508
|
+
return "styleSheet" in t;
|
|
509
|
+
}
|
|
510
|
+
function ge(t) {
|
|
511
|
+
return "selectorText" in t;
|
|
512
|
+
}
|
|
513
|
+
function F(t, n, e) {
|
|
514
|
+
const o = Se(t, n, e);
|
|
515
|
+
if (!o)
|
|
516
|
+
return null;
|
|
517
|
+
const s = e.scope.nodeIds.assign(t), i = o;
|
|
518
|
+
return i.id = s, e.serializedNodeIds && e.serializedNodeIds.add(s), i;
|
|
519
|
+
}
|
|
520
|
+
function U(t, n, e) {
|
|
521
|
+
const o = [];
|
|
522
|
+
return Z(t, (s) => {
|
|
523
|
+
const i = F(s, n, e);
|
|
524
|
+
i && o.push(i);
|
|
525
|
+
}), o;
|
|
526
|
+
}
|
|
527
|
+
function Se(t, n, e) {
|
|
528
|
+
switch (t.nodeType) {
|
|
529
|
+
case t.DOCUMENT_NODE:
|
|
530
|
+
return Te(t, n, e);
|
|
531
|
+
case t.DOCUMENT_FRAGMENT_NODE:
|
|
532
|
+
return Ee(t, n, e);
|
|
533
|
+
case t.DOCUMENT_TYPE_NODE:
|
|
534
|
+
return ye(t);
|
|
535
|
+
case t.ELEMENT_NODE:
|
|
536
|
+
return Ne(t, n, e);
|
|
537
|
+
case t.TEXT_NODE:
|
|
538
|
+
return we(t, n);
|
|
539
|
+
case t.CDATA_SECTION_NODE:
|
|
540
|
+
return Me();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function Te(t, n, e) {
|
|
544
|
+
return {
|
|
545
|
+
type: b.Document,
|
|
546
|
+
childNodes: U(t, n, e),
|
|
547
|
+
adoptedStyleSheets: it(t.adoptedStyleSheets)
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function Ee(t, n, e) {
|
|
551
|
+
const o = Q(t);
|
|
552
|
+
return o && e.serializationContext.shadowRootsController.addShadowRoot(t), {
|
|
553
|
+
type: b.DocumentFragment,
|
|
554
|
+
childNodes: U(t, n, e),
|
|
555
|
+
isShadowRoot: o,
|
|
556
|
+
adoptedStyleSheets: o ? it(t.adoptedStyleSheets) : void 0
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function ye(t) {
|
|
560
|
+
return {
|
|
561
|
+
type: b.DocumentType,
|
|
562
|
+
name: t.name,
|
|
563
|
+
publicId: t.publicId,
|
|
564
|
+
systemId: t.systemId
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function Ne(t, n, e) {
|
|
568
|
+
const o = rt(t.tagName), s = Ie(t) || void 0, i = It(wt(t), n);
|
|
569
|
+
if (i === S.HIDDEN) {
|
|
570
|
+
const { width: a, height: c } = t.getBoundingClientRect();
|
|
571
|
+
return {
|
|
572
|
+
type: b.Element,
|
|
573
|
+
tagName: o,
|
|
574
|
+
attributes: {
|
|
575
|
+
rr_width: `${a}px`,
|
|
576
|
+
rr_height: `${c}px`,
|
|
577
|
+
[bt]: Mt
|
|
578
|
+
},
|
|
579
|
+
childNodes: [],
|
|
580
|
+
isSVG: s
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
if (i === S.IGNORE)
|
|
584
|
+
return;
|
|
585
|
+
const r = pe(t, i, e);
|
|
586
|
+
let u = [];
|
|
587
|
+
return Ct(t) && // Do not serialize style children as the css rules are already in the _cssText attribute
|
|
588
|
+
o !== "style" && (u = U(t, i, e)), {
|
|
589
|
+
type: b.Element,
|
|
590
|
+
tagName: o,
|
|
591
|
+
attributes: r,
|
|
592
|
+
childNodes: u,
|
|
593
|
+
isSVG: s
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function Ie(t) {
|
|
597
|
+
return t.tagName === "svg" || t instanceof SVGElement;
|
|
598
|
+
}
|
|
599
|
+
function we(t, n) {
|
|
600
|
+
const e = K(t, n);
|
|
601
|
+
if (e !== void 0)
|
|
602
|
+
return {
|
|
603
|
+
type: b.Text,
|
|
604
|
+
textContent: e
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
function Me() {
|
|
608
|
+
return {
|
|
609
|
+
type: b.CDATA,
|
|
610
|
+
textContent: ""
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function be(t, n, e, o) {
|
|
614
|
+
const s = I(), i = F(t, n.defaultPrivacyLevel, {
|
|
615
|
+
serializationContext: o,
|
|
616
|
+
configuration: n,
|
|
617
|
+
scope: e
|
|
618
|
+
});
|
|
619
|
+
return A(o.serializationStats, "serializationDuration", tt(s, I())), i;
|
|
620
|
+
}
|
|
621
|
+
function Ce(t) {
|
|
622
|
+
return { nodeIds: t };
|
|
623
|
+
}
|
|
624
|
+
function ct(t, n, e, o = document) {
|
|
625
|
+
const s = t.defaultPrivacyLevel, i = /* @__PURE__ */ new WeakMap(), r = o !== document, { stop: u } = R(
|
|
626
|
+
t,
|
|
627
|
+
o,
|
|
628
|
+
// The 'input' event bubbles across shadow roots, so we don't have to listen for it on shadow
|
|
629
|
+
// roots since it will be handled by the event listener that we did add to the document. Only
|
|
630
|
+
// the 'change' event is blocked and needs to be handled on shadow roots.
|
|
631
|
+
r ? [
|
|
632
|
+
"change"
|
|
633
|
+
/* DOM_EVENT.CHANGE */
|
|
634
|
+
] : [
|
|
635
|
+
"input",
|
|
636
|
+
"change"
|
|
637
|
+
/* DOM_EVENT.CHANGE */
|
|
638
|
+
],
|
|
639
|
+
(l) => {
|
|
640
|
+
const f = _(l);
|
|
641
|
+
(f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement || f instanceof HTMLSelectElement) && c(f);
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
capture: !0,
|
|
645
|
+
passive: !0
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
let a;
|
|
649
|
+
if (r)
|
|
650
|
+
a = C;
|
|
651
|
+
else {
|
|
652
|
+
const l = [
|
|
653
|
+
v(HTMLInputElement.prototype, "value", c),
|
|
654
|
+
v(HTMLInputElement.prototype, "checked", c),
|
|
655
|
+
v(HTMLSelectElement.prototype, "value", c),
|
|
656
|
+
v(HTMLTextAreaElement.prototype, "value", c),
|
|
657
|
+
v(HTMLSelectElement.prototype, "selectedIndex", c)
|
|
658
|
+
];
|
|
659
|
+
a = () => {
|
|
660
|
+
l.forEach((f) => f.stop());
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
return {
|
|
664
|
+
stop: () => {
|
|
665
|
+
a(), u();
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
function c(l) {
|
|
669
|
+
const f = w(l, s);
|
|
670
|
+
if (f === S.HIDDEN)
|
|
671
|
+
return;
|
|
672
|
+
const p = l.type;
|
|
673
|
+
let g;
|
|
674
|
+
if (p === "radio" || p === "checkbox") {
|
|
675
|
+
if (z(l, f))
|
|
676
|
+
return;
|
|
677
|
+
g = { isChecked: l.checked };
|
|
678
|
+
} else {
|
|
679
|
+
const m = k(l, f);
|
|
680
|
+
if (m === void 0)
|
|
681
|
+
return;
|
|
682
|
+
g = { text: m };
|
|
683
|
+
}
|
|
684
|
+
d(l, g, n);
|
|
685
|
+
const h = l.name;
|
|
686
|
+
p === "radio" && h && l.checked && document.querySelectorAll(`input[type="radio"][name="${CSS.escape(h)}"]`).forEach((m) => {
|
|
687
|
+
m !== l && d(m, { isChecked: !1 }, n);
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function d(l, f, p) {
|
|
691
|
+
const g = p.nodeIds.get(l);
|
|
692
|
+
if (g === void 0)
|
|
693
|
+
return;
|
|
694
|
+
const h = i.get(l);
|
|
695
|
+
(!h || h.text !== f.text || h.isChecked !== f.isChecked) && (i.set(l, f), e(y(T.Input, {
|
|
696
|
+
id: g,
|
|
697
|
+
...f
|
|
698
|
+
})));
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
const Re = 100, xe = 16;
|
|
702
|
+
function ve(t) {
|
|
703
|
+
let n = C, e = [];
|
|
704
|
+
function o() {
|
|
705
|
+
n(), t(e), e = [];
|
|
706
|
+
}
|
|
707
|
+
const { throttled: s, cancel: i } = L(o, xe, {
|
|
708
|
+
leading: !1
|
|
709
|
+
});
|
|
710
|
+
return {
|
|
711
|
+
addMutations: (r) => {
|
|
712
|
+
e.length === 0 && (n = Rt(s, { timeout: Re })), e.push(...r);
|
|
713
|
+
},
|
|
714
|
+
flush: o,
|
|
715
|
+
stop: () => {
|
|
716
|
+
n(), i();
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function dt(t, n, e, o, s) {
|
|
721
|
+
const i = xt();
|
|
722
|
+
if (!i)
|
|
723
|
+
return { stop: C, flush: C };
|
|
724
|
+
const r = ve((a) => {
|
|
725
|
+
_e(a.concat(u.takeRecords()), t, n, e, o);
|
|
726
|
+
}), u = new i(vt(r.addMutations));
|
|
727
|
+
return u.observe(s, {
|
|
728
|
+
attributeOldValue: !0,
|
|
729
|
+
attributes: !0,
|
|
730
|
+
characterData: !0,
|
|
731
|
+
characterDataOldValue: !0,
|
|
732
|
+
childList: !0,
|
|
733
|
+
subtree: !0
|
|
734
|
+
}), {
|
|
735
|
+
stop: () => {
|
|
736
|
+
u.disconnect(), r.stop();
|
|
737
|
+
},
|
|
738
|
+
flush: () => {
|
|
739
|
+
r.flush();
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function _e(t, n, e, o, s) {
|
|
744
|
+
const i = /* @__PURE__ */ new Map();
|
|
745
|
+
t.filter((p) => p.type === "childList").forEach((p) => {
|
|
746
|
+
p.removedNodes.forEach((g) => {
|
|
747
|
+
lt(g, s.removeShadowRoot);
|
|
748
|
+
});
|
|
749
|
+
});
|
|
750
|
+
const r = t.filter((p) => p.target.isConnected && o.nodeIds.areAssignedForNodeAndAncestors(p.target) && w(p.target, e.defaultPrivacyLevel, i) !== S.HIDDEN), u = P(), { adds: a, removes: c, hasBeenSerialized: d } = De(r.filter((p) => p.type === "childList"), e, o, u, s, i), l = Ae(r.filter((p) => p.type === "characterData" && !d(p.target)), e, o, i), f = Le(r.filter((p) => p.type === "attributes" && !d(p.target)), e, o, i);
|
|
751
|
+
!l.length && !f.length && !c.length && !a.length || n(y(T.Mutation, { adds: a, removes: c, texts: l, attributes: f }), u);
|
|
752
|
+
}
|
|
753
|
+
function De(t, n, e, o, s, i) {
|
|
754
|
+
const r = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
755
|
+
for (const h of t)
|
|
756
|
+
h.addedNodes.forEach((m) => {
|
|
757
|
+
r.add(m);
|
|
758
|
+
}), h.removedNodes.forEach((m) => {
|
|
759
|
+
r.has(m) || u.set(m, h.target), r.delete(m);
|
|
760
|
+
});
|
|
761
|
+
const a = Array.from(r);
|
|
762
|
+
Oe(a);
|
|
763
|
+
const c = /* @__PURE__ */ new Set(), d = {
|
|
764
|
+
status: 2,
|
|
765
|
+
serializationStats: o,
|
|
766
|
+
shadowRootsController: s
|
|
767
|
+
}, l = [];
|
|
768
|
+
for (const h of a) {
|
|
769
|
+
if (p(h))
|
|
770
|
+
continue;
|
|
771
|
+
const m = w(h.parentNode, n.defaultPrivacyLevel, i);
|
|
772
|
+
if (m === S.HIDDEN || m === S.IGNORE)
|
|
773
|
+
continue;
|
|
774
|
+
const M = I(), x = F(h, m, {
|
|
775
|
+
serializedNodeIds: c,
|
|
776
|
+
serializationContext: d,
|
|
777
|
+
configuration: n,
|
|
778
|
+
scope: e
|
|
779
|
+
});
|
|
780
|
+
if (A(o, "serializationDuration", tt(M, I())), !x)
|
|
781
|
+
continue;
|
|
782
|
+
const pt = V(h);
|
|
783
|
+
l.push({
|
|
784
|
+
nextId: g(h),
|
|
785
|
+
parentId: e.nodeIds.get(pt),
|
|
786
|
+
node: x
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
const f = [];
|
|
790
|
+
return u.forEach((h, m) => {
|
|
791
|
+
const M = e.nodeIds.get(h), x = e.nodeIds.get(m);
|
|
792
|
+
M !== void 0 && x !== void 0 && f.push({ parentId: M, id: x });
|
|
793
|
+
}), { adds: l, removes: f, hasBeenSerialized: p };
|
|
794
|
+
function p(h) {
|
|
795
|
+
const m = e.nodeIds.get(h);
|
|
796
|
+
return m !== void 0 && c.has(m);
|
|
797
|
+
}
|
|
798
|
+
function g(h) {
|
|
799
|
+
let m = h.nextSibling;
|
|
800
|
+
for (; m; ) {
|
|
801
|
+
const M = e.nodeIds.get(m);
|
|
802
|
+
if (M !== void 0)
|
|
803
|
+
return M;
|
|
804
|
+
m = m.nextSibling;
|
|
805
|
+
}
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
function Ae(t, n, e, o) {
|
|
810
|
+
var s;
|
|
811
|
+
const i = [], r = /* @__PURE__ */ new Set(), u = t.filter((a) => r.has(a.target) ? !1 : (r.add(a.target), !0));
|
|
812
|
+
for (const a of u) {
|
|
813
|
+
if (a.target.textContent === a.oldValue)
|
|
814
|
+
continue;
|
|
815
|
+
const d = e.nodeIds.get(a.target);
|
|
816
|
+
if (d === void 0)
|
|
817
|
+
continue;
|
|
818
|
+
const l = w(V(a.target), n.defaultPrivacyLevel, o);
|
|
819
|
+
l === S.HIDDEN || l === S.IGNORE || i.push({
|
|
820
|
+
id: d,
|
|
821
|
+
value: (s = K(a.target, l)) !== null && s !== void 0 ? s : null
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
return i;
|
|
825
|
+
}
|
|
826
|
+
function Le(t, n, e, o) {
|
|
827
|
+
const s = [], i = /* @__PURE__ */ new Map(), r = t.filter((a) => {
|
|
828
|
+
const c = i.get(a.target);
|
|
829
|
+
return c && c.has(a.attributeName) ? !1 : (c ? c.add(a.attributeName) : i.set(a.target, /* @__PURE__ */ new Set([a.attributeName])), !0);
|
|
830
|
+
}), u = /* @__PURE__ */ new Map();
|
|
831
|
+
for (const a of r) {
|
|
832
|
+
if (a.target.getAttribute(a.attributeName) === a.oldValue)
|
|
833
|
+
continue;
|
|
834
|
+
const d = e.nodeIds.get(a.target);
|
|
835
|
+
if (d === void 0)
|
|
836
|
+
continue;
|
|
837
|
+
const l = w(a.target, n.defaultPrivacyLevel, o), f = at(a.target, l, a.attributeName, n);
|
|
838
|
+
let p;
|
|
839
|
+
if (a.attributeName === "value") {
|
|
840
|
+
const h = k(a.target, l);
|
|
841
|
+
if (h === void 0)
|
|
842
|
+
continue;
|
|
843
|
+
p = h;
|
|
844
|
+
} else typeof f == "string" ? p = f : p = null;
|
|
845
|
+
let g = u.get(a.target);
|
|
846
|
+
g || (g = { id: d, attributes: {} }, s.push(g), u.set(a.target, g)), g.attributes[a.attributeName] = p;
|
|
847
|
+
}
|
|
848
|
+
return s;
|
|
849
|
+
}
|
|
850
|
+
function Oe(t) {
|
|
851
|
+
t.sort((n, e) => {
|
|
852
|
+
const o = n.compareDocumentPosition(e);
|
|
853
|
+
return o & Node.DOCUMENT_POSITION_CONTAINED_BY ? -1 : o & Node.DOCUMENT_POSITION_CONTAINS || o & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : o & Node.DOCUMENT_POSITION_PRECEDING ? -1 : 0;
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
function lt(t, n) {
|
|
857
|
+
X(t) && n(t.shadowRoot), Z(t, (e) => lt(e, n));
|
|
858
|
+
}
|
|
859
|
+
function ze() {
|
|
860
|
+
const t = /* @__PURE__ */ new WeakMap();
|
|
861
|
+
return {
|
|
862
|
+
set(n, e) {
|
|
863
|
+
n === document && !document.scrollingElement || t.set(n === document ? document.scrollingElement : n, e);
|
|
864
|
+
},
|
|
865
|
+
get(n) {
|
|
866
|
+
return t.get(n);
|
|
867
|
+
},
|
|
868
|
+
has(n) {
|
|
869
|
+
return t.has(n);
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
const Ve = (t, n, e, o) => {
|
|
874
|
+
const s = /* @__PURE__ */ new Map(), i = {
|
|
875
|
+
addShadowRoot: (r) => {
|
|
876
|
+
if (s.has(r))
|
|
877
|
+
return;
|
|
878
|
+
const u = dt(e, t, n, i, r), a = ct(t, n, e, r), c = ot(t, n, e, o, r);
|
|
879
|
+
s.set(r, {
|
|
880
|
+
flush: () => u.flush(),
|
|
881
|
+
stop: () => {
|
|
882
|
+
u.stop(), a.stop(), c.stop();
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
},
|
|
886
|
+
removeShadowRoot: (r) => {
|
|
887
|
+
const u = s.get(r);
|
|
888
|
+
u && (u.stop(), s.delete(r));
|
|
889
|
+
},
|
|
890
|
+
stop: () => {
|
|
891
|
+
s.forEach(({ stop: r }) => r());
|
|
892
|
+
},
|
|
893
|
+
flush: () => {
|
|
894
|
+
s.forEach(({ flush: r }) => r());
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
return i;
|
|
898
|
+
};
|
|
899
|
+
function ke(t, n, e, o, s, i, r) {
|
|
900
|
+
const u = (c, d) => {
|
|
901
|
+
const { width: l, height: f } = _t();
|
|
902
|
+
r({
|
|
903
|
+
data: {
|
|
904
|
+
height: f,
|
|
905
|
+
href: window.location.href,
|
|
906
|
+
width: l
|
|
907
|
+
},
|
|
908
|
+
type: N.Meta,
|
|
909
|
+
timestamp: c
|
|
910
|
+
}), r({
|
|
911
|
+
data: {
|
|
912
|
+
has_focus: document.hasFocus()
|
|
913
|
+
},
|
|
914
|
+
type: N.Focus,
|
|
915
|
+
timestamp: c
|
|
916
|
+
});
|
|
917
|
+
const p = P();
|
|
918
|
+
r({
|
|
919
|
+
data: {
|
|
920
|
+
node: be(document, o, s, {
|
|
921
|
+
status: d,
|
|
922
|
+
elementsScrollPositions: t,
|
|
923
|
+
serializationStats: p,
|
|
924
|
+
shadowRootsController: n
|
|
925
|
+
}),
|
|
926
|
+
initialOffset: {
|
|
927
|
+
left: q(),
|
|
928
|
+
top: j()
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
type: N.FullSnapshot,
|
|
932
|
+
timestamp: c
|
|
933
|
+
}, p), window.visualViewport && r({
|
|
934
|
+
data: nt(window.visualViewport),
|
|
935
|
+
type: N.VisualViewport,
|
|
936
|
+
timestamp: c
|
|
937
|
+
});
|
|
938
|
+
};
|
|
939
|
+
u(
|
|
940
|
+
I(),
|
|
941
|
+
0
|
|
942
|
+
/* SerializationContextStatus.INITIAL_FULL_SNAPSHOT */
|
|
943
|
+
);
|
|
944
|
+
const { unsubscribe: a } = e.subscribe(2, (c) => {
|
|
945
|
+
i(), u(
|
|
946
|
+
c.startClocks.timeStamp,
|
|
947
|
+
1
|
|
948
|
+
/* SerializationContextStatus.SUBSEQUENT_FULL_SNAPSHOT */
|
|
949
|
+
);
|
|
950
|
+
});
|
|
951
|
+
return {
|
|
952
|
+
stop: a
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
function Pe() {
|
|
956
|
+
const t = /* @__PURE__ */ new WeakMap();
|
|
957
|
+
let n = 1;
|
|
958
|
+
return {
|
|
959
|
+
getIdForEvent(e) {
|
|
960
|
+
return t.has(e) || t.set(e, n++), t.get(e);
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
function Fe() {
|
|
965
|
+
const t = /* @__PURE__ */ new WeakMap();
|
|
966
|
+
let n = 1;
|
|
967
|
+
const e = (o) => t.get(o);
|
|
968
|
+
return {
|
|
969
|
+
assign: (o) => {
|
|
970
|
+
let s = e(o);
|
|
971
|
+
return s === void 0 && (s = n++, t.set(o, s)), s;
|
|
972
|
+
},
|
|
973
|
+
get: e,
|
|
974
|
+
areAssignedForNodeAndAncestors: (o) => {
|
|
975
|
+
let s = o;
|
|
976
|
+
for (; s; ) {
|
|
977
|
+
if (e(s) === void 0 && !Q(s))
|
|
978
|
+
return !1;
|
|
979
|
+
s = V(s);
|
|
980
|
+
}
|
|
981
|
+
return !0;
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function Ue(t) {
|
|
986
|
+
const { emit: n, configuration: e, lifeCycle: o } = t;
|
|
987
|
+
if (!n)
|
|
988
|
+
throw new Error("emit function is required");
|
|
989
|
+
const s = (p, g) => {
|
|
990
|
+
n(p, g), Dt("record", { record: p });
|
|
991
|
+
const h = t.viewHistory.findView();
|
|
992
|
+
At(h.id);
|
|
993
|
+
}, i = ze(), r = Ce(Fe()), u = Ve(e, r, s, i), { stop: a } = ke(i, u, o, e, r, c, s);
|
|
994
|
+
function c() {
|
|
995
|
+
u.flush(), l.flush();
|
|
996
|
+
}
|
|
997
|
+
const d = Pe(), l = dt(s, e, r, u, document), f = [
|
|
998
|
+
l,
|
|
999
|
+
jt(e, r, s),
|
|
1000
|
+
qt(e, r, s, d),
|
|
1001
|
+
ot(e, r, s, i, document),
|
|
1002
|
+
Qt(e, s),
|
|
1003
|
+
ct(e, r, s),
|
|
1004
|
+
te(e, r, s),
|
|
1005
|
+
ee(r, s),
|
|
1006
|
+
ne(e, s),
|
|
1007
|
+
Zt(e, s),
|
|
1008
|
+
se(o, s, d),
|
|
1009
|
+
oe(o, (p) => {
|
|
1010
|
+
c(), s(p);
|
|
1011
|
+
})
|
|
1012
|
+
];
|
|
1013
|
+
return {
|
|
1014
|
+
stop: () => {
|
|
1015
|
+
u.stop(), f.forEach((p) => p.stop()), a();
|
|
1016
|
+
},
|
|
1017
|
+
flushMutations: c,
|
|
1018
|
+
shadowRootsController: u
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
function Be(t, n, e, o) {
|
|
1022
|
+
const s = new FormData();
|
|
1023
|
+
s.append("segment", new Blob([t], {
|
|
1024
|
+
type: "application/octet-stream"
|
|
1025
|
+
}), `${n.session.id}-${n.start}`);
|
|
1026
|
+
const i = {
|
|
1027
|
+
raw_segment_size: o,
|
|
1028
|
+
compressed_segment_size: t.byteLength,
|
|
1029
|
+
...n
|
|
1030
|
+
}, r = JSON.stringify(i);
|
|
1031
|
+
return s.append("event", new Blob([r], { type: "application/json" })), {
|
|
1032
|
+
data: s,
|
|
1033
|
+
bytesCount: t.byteLength,
|
|
1034
|
+
cssText: e.cssText,
|
|
1035
|
+
isFullSnapshot: n.index_in_view === 0,
|
|
1036
|
+
rawSize: o,
|
|
1037
|
+
recordCount: n.records_count,
|
|
1038
|
+
serializationDuration: e.serializationDuration
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function He({ context: t, creationReason: n, encoder: e }) {
|
|
1042
|
+
let o = 0;
|
|
1043
|
+
const s = t.view.id, i = Lt(s), r = {
|
|
1044
|
+
start: 1 / 0,
|
|
1045
|
+
end: -1 / 0,
|
|
1046
|
+
creation_reason: n,
|
|
1047
|
+
records_count: 0,
|
|
1048
|
+
has_full_snapshot: !1,
|
|
1049
|
+
index_in_view: i,
|
|
1050
|
+
source: "browser",
|
|
1051
|
+
...t
|
|
1052
|
+
}, u = P();
|
|
1053
|
+
Ot(s);
|
|
1054
|
+
function a(d, l, f) {
|
|
1055
|
+
r.start = Math.min(r.start, d.timestamp), r.end = Math.max(r.end, d.timestamp), r.records_count += 1, r.has_full_snapshot || (r.has_full_snapshot = d.type === N.FullSnapshot), l && fe(u, l);
|
|
1056
|
+
const p = e.isEmpty ? '{"records":[' : ",";
|
|
1057
|
+
e.write(p + JSON.stringify(d), (g) => {
|
|
1058
|
+
o += g, f(o);
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
function c(d) {
|
|
1062
|
+
if (e.isEmpty)
|
|
1063
|
+
throw new Error("Empty segment flushed");
|
|
1064
|
+
e.write(`],${JSON.stringify(r).slice(1)}
|
|
1065
|
+
`), e.finish((l) => {
|
|
1066
|
+
zt(r.view.id, l.rawBytesCount), d(r, u, l);
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
return { addRecord: a, flush: c };
|
|
1070
|
+
}
|
|
1071
|
+
const Ge = 5 * Ft;
|
|
1072
|
+
let ft = 6e4;
|
|
1073
|
+
function We(t, n, e, o, s, i) {
|
|
1074
|
+
return $e(t, () => Ye(n.applicationId, e, o), s, i);
|
|
1075
|
+
}
|
|
1076
|
+
function $e(t, n, e, o) {
|
|
1077
|
+
let s = {
|
|
1078
|
+
status: 0,
|
|
1079
|
+
nextSegmentCreationReason: "init"
|
|
1080
|
+
};
|
|
1081
|
+
const { unsubscribe: i } = t.subscribe(2, () => {
|
|
1082
|
+
u("view_change");
|
|
1083
|
+
}), { unsubscribe: r } = t.subscribe(11, (a) => {
|
|
1084
|
+
u(a.reason);
|
|
1085
|
+
});
|
|
1086
|
+
function u(a) {
|
|
1087
|
+
s.status === 1 && (s.segment.flush((c, d, l) => {
|
|
1088
|
+
const f = Be(l.output, c, d, l.rawBytesCount);
|
|
1089
|
+
Vt(a) ? e.sendOnExit(f) : e.send(f);
|
|
1090
|
+
}), kt(s.expirationTimeoutId)), a !== "stop" ? s = {
|
|
1091
|
+
status: 0,
|
|
1092
|
+
nextSegmentCreationReason: a
|
|
1093
|
+
} : s = {
|
|
1094
|
+
status: 2
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
return {
|
|
1098
|
+
addRecord: (a, c) => {
|
|
1099
|
+
if (s.status !== 2) {
|
|
1100
|
+
if (s.status === 0) {
|
|
1101
|
+
const d = n();
|
|
1102
|
+
if (!d)
|
|
1103
|
+
return;
|
|
1104
|
+
s = {
|
|
1105
|
+
status: 1,
|
|
1106
|
+
segment: He({ encoder: o, context: d, creationReason: s.nextSegmentCreationReason }),
|
|
1107
|
+
expirationTimeoutId: Pt(() => {
|
|
1108
|
+
u("segment_duration_limit");
|
|
1109
|
+
}, Ge)
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
s.segment.addRecord(a, c, (d) => {
|
|
1113
|
+
d > ft && u("segment_bytes_limit");
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
stop: () => {
|
|
1118
|
+
u("stop"), i(), r();
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
function Ye(t, n, e) {
|
|
1123
|
+
const o = n.findTrackedSession(), s = e.findView();
|
|
1124
|
+
if (!(!o || !s))
|
|
1125
|
+
return {
|
|
1126
|
+
application: {
|
|
1127
|
+
id: t
|
|
1128
|
+
},
|
|
1129
|
+
session: {
|
|
1130
|
+
id: o.id
|
|
1131
|
+
},
|
|
1132
|
+
view: {
|
|
1133
|
+
id: s.id
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function Xe(t, n) {
|
|
1138
|
+
if (!t.metricsEnabled)
|
|
1139
|
+
return { stop: C };
|
|
1140
|
+
const { unsubscribe: e } = n.subscribe((o) => {
|
|
1141
|
+
if (o.type === "failure" || o.type === "queue-full" || o.type === "success" && o.payload.isFullSnapshot) {
|
|
1142
|
+
const s = je(o.type, o.bandwidth, o.payload);
|
|
1143
|
+
Ut("Segment network request metrics", { metrics: s });
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
return {
|
|
1147
|
+
stop: e
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
function je(t, n, e) {
|
|
1151
|
+
return {
|
|
1152
|
+
cssText: {
|
|
1153
|
+
count: e.cssText.count,
|
|
1154
|
+
max: e.cssText.max,
|
|
1155
|
+
sum: e.cssText.sum
|
|
1156
|
+
},
|
|
1157
|
+
isFullSnapshot: e.isFullSnapshot,
|
|
1158
|
+
ongoingRequests: {
|
|
1159
|
+
count: n.ongoingRequestCount,
|
|
1160
|
+
totalSize: n.ongoingByteCount
|
|
1161
|
+
},
|
|
1162
|
+
recordCount: e.recordCount,
|
|
1163
|
+
result: t,
|
|
1164
|
+
serializationDuration: {
|
|
1165
|
+
count: e.serializationDuration.count,
|
|
1166
|
+
max: e.serializationDuration.max,
|
|
1167
|
+
sum: e.serializationDuration.sum
|
|
1168
|
+
},
|
|
1169
|
+
size: {
|
|
1170
|
+
compressed: e.bytesCount,
|
|
1171
|
+
raw: e.rawSize
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function qe(t) {
|
|
1176
|
+
const n = Bt();
|
|
1177
|
+
return {
|
|
1178
|
+
addRecord: (e) => {
|
|
1179
|
+
const o = t.findView();
|
|
1180
|
+
n.send("record", e, o.id);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function Ke(t, n, e, o, s, i, r) {
|
|
1185
|
+
const u = [], a = (f) => {
|
|
1186
|
+
t.notify(14, { error: f }), Wt("Error reported to customer", { "error.message": f.message });
|
|
1187
|
+
}, c = r || Ht([n.sessionReplayEndpointBuilder], a, ft);
|
|
1188
|
+
let d;
|
|
1189
|
+
if (Gt())
|
|
1190
|
+
({ addRecord: d } = qe(o));
|
|
1191
|
+
else {
|
|
1192
|
+
const f = We(t, n, e, o, c, s);
|
|
1193
|
+
d = f.addRecord, u.push(f.stop);
|
|
1194
|
+
const p = Xe(i, c.observable);
|
|
1195
|
+
u.push(p.stop);
|
|
1196
|
+
}
|
|
1197
|
+
const { stop: l } = Ue({
|
|
1198
|
+
emit: d,
|
|
1199
|
+
configuration: n,
|
|
1200
|
+
lifeCycle: t,
|
|
1201
|
+
viewHistory: o
|
|
1202
|
+
});
|
|
1203
|
+
return u.push(l), {
|
|
1204
|
+
stop: () => {
|
|
1205
|
+
u.forEach((f) => f());
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
export {
|
|
1210
|
+
Ke as startRecording
|
|
1211
|
+
};
|
|
1212
|
+
//# sourceMappingURL=startRecording-DOMzQAAr.js.map
|