@picked/analytics 0.0.42 → 0.0.43

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.
@@ -1,1241 +0,0 @@
1
- import { trackSelfDescribingEvent as ot, newTracker as St, addGlobalContexts as Yt, enableActivityTracking as Bt, enableActivityTrackingCallback as At } from "@snowplow/browser-tracker";
2
- import { ButtonClickTrackingPlugin as Ht, enableButtonClickTracking as Ot } from "@snowplow/browser-plugin-button-click-tracking";
3
- import { PerformanceNavigationTimingPlugin as jt } from "@snowplow/browser-plugin-performance-navigation-timing";
4
- import { ErrorTrackingPlugin as qt, enableErrorTracking as Ft } from "@snowplow/browser-plugin-error-tracking";
5
- import { WebVitalsPlugin as Rt } from "@snowplow/browser-plugin-web-vitals";
6
- import { supportsDocument as at, supportsWindow as Wt, supportsCookies as It } from "@picked/client";
7
- function it(t, e) {
8
- return `iglu:dev.pckd/${t}/jsonschema/${e}`;
9
- }
10
- function $(t, ...e) {
11
- }
12
- function g(t, ...e) {
13
- }
14
- function l(t, e, s = {}) {
15
- return {
16
- event: {
17
- schema: it("event", "1-0-0"),
18
- data: {
19
- type: t,
20
- meta: s
21
- }
22
- },
23
- context: e.filter(
24
- (i) => i !== void 0
25
- )
26
- };
27
- }
28
- function n(t, e, s) {
29
- return {
30
- schema: it(t, e),
31
- data: s
32
- };
33
- }
34
- function p(t, e) {
35
- return (s, i) => {
36
- const o = e(s, i);
37
- ot(o);
38
- };
39
- }
40
- function k(t, e, s = { passive: !0 }) {
41
- const i = /* @__PURE__ */ new WeakMap();
42
- return (o, a) => {
43
- let r = i.get(o);
44
- if (r || (r = /* @__PURE__ */ new Set(), i.set(o, r)), r.has(t))
45
- return;
46
- function c(m) {
47
- const E = a();
48
- e({ event: m, analyticsContext: E });
49
- }
50
- o.addEventListener(t, c, s), r.add(t);
51
- };
52
- }
53
- function zt(t, e) {
54
- const s = /* @__PURE__ */ new Set();
55
- return (i) => {
56
- if (s.has(t) || !at())
57
- return;
58
- function o(a) {
59
- const r = i();
60
- e({ event: a, analyticsContext: r });
61
- }
62
- document.addEventListener(t, o, { passive: !0 }), s.add(t);
63
- };
64
- }
65
- function h(t, e) {
66
- const s = /* @__PURE__ */ new Set();
67
- return (i) => {
68
- if (s.has(t) || !Wt())
69
- return;
70
- function o(a) {
71
- const r = i();
72
- e({ event: a, analyticsContext: r });
73
- }
74
- window.addEventListener(t, o, { passive: !0 }), s.add(t);
75
- };
76
- }
77
- function u(t) {
78
- return { items: t.features?.map(({ feature: s, name: i, key: o, bucket: a }) => ({
79
- ab_feature: s,
80
- ab_name: i,
81
- ab_key: o,
82
- ab_bucket: a
83
- })) || [] };
84
- }
85
- const _ = "unknown";
86
- function f(t) {
87
- const e = Mt(), s = {
88
- id: t.sessionId || null
89
- };
90
- return t.isUser !== void 0 && (s.is_user = t.isUser), t.identifiers && Object.assign(s, t.identifiers), e && (s.gaid = e), t.shopifySession?.clientId && (s.shopify_client_id = t.shopifySession.clientId), t.shopifySession?.customerId && (s.shopify_customer_id = t.shopifySession.customerId), t.shopifySession?.checkoutToken && (s.shopify_checkout_token = t.shopifySession.checkoutToken), s;
91
- }
92
- function H(t) {
93
- if (t.fields)
94
- return {
95
- items: t.fields.map(({ id: e, type: s, label: i, options: o }) => ({
96
- id: e,
97
- type: s,
98
- label: i,
99
- options: Array.isArray(o) ? o : void 0
100
- }))
101
- };
102
- }
103
- function X(t) {
104
- if (t.responses)
105
- return {
106
- items: t.responses.map(
107
- ({ fieldId: e, value: s }) => ({
108
- field_id: e,
109
- values: Array.isArray(s) ? s.map((i) => ({ value: i })) : [{ value: s }]
110
- })
111
- )
112
- };
113
- }
114
- function d(t, e = !1) {
115
- const { step: s } = t;
116
- if (s)
117
- return {
118
- id: s.id,
119
- title: s.label
120
- };
121
- if (e)
122
- return g('"step" is required for this event', t), {
123
- id: _,
124
- title: _
125
- };
126
- }
127
- function Ut(t, e = !1) {
128
- const { productList: s } = t;
129
- if (s) {
130
- const i = {};
131
- "title" in s && s.title && Object.assign(i, { title: s.title });
132
- const o = "items" in s ? s.items : s;
133
- return Object.assign(i, {
134
- items: o.map((a) => ({
135
- item_id: a.itemId,
136
- item_name: a.itemName,
137
- affiliation: a.affiliation,
138
- coupon: a.coupon,
139
- currency: a.currency,
140
- creative_name: a.creativeName,
141
- creative_slot: a.creativeSlot,
142
- discount: B(a.discount),
143
- index: B(a.index),
144
- item_brand: a.itemBrand,
145
- item_category: a.itemCategory,
146
- item_category2: a.itemCategory2,
147
- item_category3: a.itemCategory3,
148
- item_category4: a.itemCategory4,
149
- item_category5: a.itemCategory5,
150
- item_list_id: a.itemListId,
151
- item_list_name: a.itemListName,
152
- item_variant: a.itemVariant,
153
- location_id: a.locationId,
154
- price: B(a.price),
155
- promotion_id: a.promotionId,
156
- promotion_name: a.promotionName,
157
- quantity: B(a.quantity),
158
- in_stock: a.inStock
159
- }))
160
- }), i;
161
- }
162
- if (e)
163
- return g('"productList" is required for this event', t), {
164
- items: []
165
- };
166
- }
167
- function Gt(t, e = !1) {
168
- const { order: s } = t;
169
- if (s) {
170
- const i = {
171
- id: s.id
172
- };
173
- return s.checkoutToken && (i.checkout_token = s.checkoutToken), s.cartToken && (i.cart_token = s.cartToken), s.customerId && (i.customer_id = s.customerId), i;
174
- }
175
- if (e)
176
- return g('"order" is required for this event', t), {
177
- id: _
178
- };
179
- }
180
- function x(t, e = !1) {
181
- const { experience: s } = t;
182
- if (s)
183
- return {
184
- id: s.id,
185
- title: s.title
186
- };
187
- if (e)
188
- return g('"experience" is required for this event', t), {
189
- id: _,
190
- title: _
191
- };
192
- }
193
- function J(t, e = !1) {
194
- const { exception: s } = t;
195
- if (s)
196
- return typeof s == "string" ? { reason: s } : {
197
- reason: s.systemMessage
198
- };
199
- if (e)
200
- return g('"exception" is required for this event', t), {
201
- reason: _
202
- };
203
- }
204
- function N(t) {
205
- const { form: e } = t;
206
- return e ? {
207
- id: e.id,
208
- title: e.title
209
- } : (g('"form" is required for this event', t), {
210
- id: _,
211
- title: _
212
- });
213
- }
214
- function Kt(t) {
215
- const { modal: e } = t;
216
- return e ? {
217
- id: e.id,
218
- title: e.title
219
- } : (g('"modal" is required for this event', t), {
220
- id: _,
221
- title: _
222
- });
223
- }
224
- function O(t, e = 300) {
225
- let s;
226
- return function(...i) {
227
- clearTimeout(s), s = setTimeout(() => t.apply(this, i), e);
228
- };
229
- }
230
- function B(t) {
231
- if (typeof t == "number")
232
- return t;
233
- if (typeof t != "string")
234
- return;
235
- const e = parseFloat(t);
236
- if (!isNaN(e))
237
- return e;
238
- }
239
- function Mt() {
240
- if (!at() || !It())
241
- return null;
242
- const t = "_ga=", e = document.cookie ? document.cookie.split(";") : [];
243
- for (const s of e) {
244
- const i = s.trim();
245
- if (i.startsWith(t)) {
246
- const a = i.substring(t.length).split(".");
247
- if (a.length > 2)
248
- return a.slice(2).join(".");
249
- }
250
- }
251
- }
252
- function Xt(t) {
253
- const e = [];
254
- return t.trackErrors && ($(), e.push(qt())), t.trackVitals && ($(), e.push(Rt())), t.trackPerformance && ($(), e.push(jt())), (t.trackButtonClickAllowList || t.trackButtonClickFilter) && e.push(Ht()), e;
255
- }
256
- function Jt(t) {
257
- t.trackActivity && !t.trackActivityCallback && ($(), Bt({
258
- minimumVisitLength: 30,
259
- heartbeatDelay: 10
260
- })), t.trackActivity && t.trackActivityCallback && ($(), At({
261
- minimumVisitLength: 30,
262
- heartbeatDelay: 10,
263
- callback: t.trackActivityCallback
264
- })), (t.trackButtonClickAllowList || t.trackButtonClickFilter) && ($(), Ot({
265
- filter: t.trackButtonClickAllowList ? {
266
- allowlist: t.trackButtonClickAllowList
267
- } : t.trackButtonClickFilter
268
- })), t.trackErrors && ($(), Ft());
269
- }
270
- function Un({
271
- organizationId: t,
272
- projectId: e,
273
- cvlyX: s,
274
- deployment: i,
275
- collectorUrl: o = "evnts.pckd.dev",
276
- appId: a = "picked-analytics",
277
- trackVitals: r = !1,
278
- trackPerformance: c = !1,
279
- trackWebPage: m = !0,
280
- trackSessions: E = !0,
281
- trackBrowser: w = !0,
282
- trackActivity: P = !1,
283
- trackErrors: V = !1,
284
- trackActivityCallback: j,
285
- trackButtonClickAllowList: S
286
- }) {
287
- $();
288
- const Y = {
289
- trackVitals: r,
290
- trackErrors: V,
291
- trackActivity: P,
292
- trackPerformance: c,
293
- trackActivityCallback: j,
294
- trackButtonClickAllowList: S
295
- }, Pt = {
296
- appId: a,
297
- platform: "web",
298
- contexts: {
299
- webPage: m,
300
- session: E,
301
- browser: w || !1
302
- },
303
- plugins: Xt(Y)
304
- }, Vt = St(a, o, Pt);
305
- return Qt({
306
- organizationId: t,
307
- projectId: e,
308
- cvlyX: s,
309
- deployment: i
310
- }), Jt(Y), Vt;
311
- }
312
- function Qt({ organizationId: t, projectId: e, cvlyX: s, deployment: i }) {
313
- if (!t || !e)
314
- throw new Error("bindGlobalContext: Both organizationId and projectId are required");
315
- const o = [];
316
- o.push(
317
- n("app", "1-0-0", {
318
- organization_id: t,
319
- project_id: e
320
- }),
321
- n("deployment", "1-0-1", {
322
- sha: i.sha,
323
- id: i.id,
324
- env: i.env,
325
- host: i.host
326
- })
327
- ), s && o.push(
328
- n("cvly_x", "1-0-1", {
329
- vercel_deployment_id: s.vercelDeploymentId,
330
- vercel_env: s.vercelEnv,
331
- vercel_url: s.vercelUrl
332
- })
333
- ), Yt(o);
334
- }
335
- const rt = "app_close";
336
- function Zt(t, e) {
337
- const s = u(t), i = f(t), o = x(t), a = d(t);
338
- return l(
339
- rt,
340
- [
341
- n("feature_list", "2-0-0", s),
342
- n("session", "1-0-4", i),
343
- a ? n("step", "1-0-0", a) : void 0,
344
- o ? n("experience", "1-0-1", o) : void 0
345
- ],
346
- e
347
- );
348
- }
349
- const Gn = p(rt, Zt), ct = "app_initialize";
350
- function te(t, e) {
351
- const s = u(t), i = f(t), o = x(t), a = d(t);
352
- return l(
353
- ct,
354
- [
355
- n("feature_list", "2-0-0", s),
356
- n("session", "1-0-4", i),
357
- a ? n("step", "1-0-0", a) : void 0,
358
- o ? n("experience", "1-0-1", o) : void 0
359
- ],
360
- e
361
- );
362
- }
363
- const Kn = p(ct, te), lt = "app_load";
364
- function ee(t, e) {
365
- const s = u(t), i = f(t), o = x(t), a = d(t);
366
- return l(
367
- lt,
368
- [
369
- n("feature_list", "2-0-0", s),
370
- n("session", "1-0-4", i),
371
- a ? n("step", "1-0-0", a) : void 0,
372
- o ? n("experience", "1-0-1", o) : void 0
373
- ],
374
- e
375
- );
376
- }
377
- const Mn = p(lt, ee), ut = "app_open";
378
- function ne(t, e) {
379
- const s = u(t), i = f(t), o = x(t), a = d(t);
380
- return l(
381
- ut,
382
- [
383
- n("feature_list", "2-0-0", s),
384
- n("session", "1-0-4", i),
385
- a ? n("step", "1-0-0", a) : void 0,
386
- o ? n("experience", "1-0-1", o) : void 0
387
- ],
388
- e
389
- );
390
- }
391
- const Xn = p(ut, ne), ft = "experience_load";
392
- function se(t, e) {
393
- const s = u(t), i = f(t), o = x(t, !0), a = d(t);
394
- return l(
395
- ft,
396
- [
397
- n("feature_list", "2-0-0", s),
398
- n("session", "1-0-4", i),
399
- n("experience", "1-0-1", o),
400
- a ? n("step", "1-0-0", a) : void 0
401
- ],
402
- e
403
- );
404
- }
405
- const Jn = p(ft, se), dt = "feature_decide";
406
- function oe(t, e) {
407
- const s = u(t), i = f(t), o = x(t), a = d(t);
408
- return l(
409
- dt,
410
- [
411
- n("feature_list", "2-0-0", s),
412
- n("session", "1-0-4", i),
413
- a ? n("step", "1-0-0", a) : void 0,
414
- o ? n("experience", "1-0-1", o) : void 0
415
- ],
416
- e
417
- );
418
- }
419
- const Qn = p(dt, oe), xt = "step_enter";
420
- function ae(t, e) {
421
- const s = u(t), i = f(t), o = x(t), a = d(t, !0), r = H(t);
422
- return l(
423
- xt,
424
- [
425
- n("feature_list", "2-0-0", s),
426
- n("session", "1-0-4", i),
427
- n("step", "1-0-0", a),
428
- r && n("field_list", "1-0-0", r),
429
- o && n("experience", "1-0-1", o)
430
- ],
431
- e
432
- );
433
- }
434
- const Zn = p(xt, ae), pt = "step_submit";
435
- function ie(t, e) {
436
- const s = u(t), i = f(t), o = x(t), a = d(t, !0), r = X(t), c = H(t);
437
- return l(
438
- pt,
439
- [
440
- n("feature_list", "2-0-0", s),
441
- n("session", "1-0-4", i),
442
- n("step", "1-0-0", a),
443
- c && n("field_list", "1-0-0", c),
444
- r && n("response_list", "1-0-0", r),
445
- o && n("experience", "1-0-1", o)
446
- ],
447
- e
448
- );
449
- }
450
- const ts = p(pt, ie), mt = "step_submit_success";
451
- function re(t, e) {
452
- const s = u(t), i = f(t), o = x(t), a = d(t, !0), r = H(t), c = X(t);
453
- return l(
454
- mt,
455
- [
456
- n("feature_list", "2-0-0", s),
457
- n("session", "1-0-4", i),
458
- n("step", "1-0-0", a),
459
- r && n("field_list", "1-0-0", r),
460
- c && n("response_list", "1-0-0", c),
461
- o && n("experience", "1-0-1", o)
462
- ],
463
- e
464
- );
465
- }
466
- const es = p(mt, re), Ct = "field_validation_error";
467
- function ce(t, e) {
468
- const s = u(t), i = f(t), o = N(t), a = J(t, !0), r = x(t), c = d(t);
469
- return l(
470
- Ct,
471
- [
472
- n("feature_list", "2-0-0", s),
473
- n("session", "1-0-4", i),
474
- n("exception", "1-0-0", a),
475
- n("form", "1-0-0", o),
476
- r && n("experience", "1-0-1", r),
477
- c && n("step", "1-0-0", c)
478
- ],
479
- e
480
- );
481
- }
482
- const ns = p(Ct, ce), Et = "form_submit";
483
- function le(t, e) {
484
- const s = u(t), i = f(t), o = N(t), a = x(t), r = d(t);
485
- return l(
486
- Et,
487
- [
488
- n("feature_list", "2-0-0", s),
489
- n("session", "1-0-4", i),
490
- n("form", "1-0-0", o),
491
- a && n("experience", "1-0-1", a),
492
- r && n("step", "1-0-0", r)
493
- ],
494
- e
495
- );
496
- }
497
- const ss = p(Et, le), vt = "form_submit_error";
498
- function ue(t, e) {
499
- const s = u(t), i = f(t), o = N(t), a = J(t, !0), r = x(t), c = d(t);
500
- return l(
501
- vt,
502
- [
503
- n("feature_list", "2-0-0", s),
504
- n("session", "1-0-4", i),
505
- n("form", "1-0-0", o),
506
- n("exception", "1-0-0", a),
507
- r && n("experience", "1-0-1", r),
508
- c && n("step", "1-0-0", c)
509
- ],
510
- e
511
- );
512
- }
513
- const os = p(vt, ue), Dt = "form_submit_success";
514
- function fe(t, e) {
515
- const s = u(t), i = f(t), o = N(t), a = x(t), r = d(t);
516
- return l(
517
- Dt,
518
- [
519
- n("feature_list", "2-0-0", s),
520
- n("session", "1-0-4", i),
521
- n("form", "1-0-0", o),
522
- a && n("experience", "1-0-1", a),
523
- r && n("step", "1-0-0", r)
524
- ],
525
- e
526
- );
527
- }
528
- const as = p(Dt, fe);
529
- function D(t) {
530
- return t instanceof Element;
531
- }
532
- function de(t) {
533
- return `data-picked-${t.replaceAll("_", "-")}`;
534
- }
535
- function T(t) {
536
- const e = [
537
- "a",
538
- "button",
539
- "input",
540
- "select",
541
- "textarea",
542
- "details",
543
- "summary",
544
- "label",
545
- "form",
546
- "fieldset",
547
- "legend",
548
- "optgroup",
549
- "option",
550
- "output",
551
- "datalist",
552
- "dialog",
553
- "menu",
554
- "menuitem",
555
- "iframe",
556
- "audio",
557
- "video",
558
- "embed",
559
- "object",
560
- "canvas"
561
- ].join(", ");
562
- return D(t) ? t.matches(e) ? t : t.closest(e) : null;
563
- }
564
- function v(t) {
565
- if (t instanceof HTMLSelectElement) {
566
- const e = t.selectedIndex || 0;
567
- return t.options[e]?.text ?? "";
568
- }
569
- return "innerText" in t && typeof t.innerText == "string" ? t.innerText : t.textContent;
570
- }
571
- function b(t) {
572
- const e = t.getAttribute("aria-label");
573
- if (e)
574
- return e;
575
- const s = t.getAttribute("aria-labelledby");
576
- if (s) {
577
- const o = document.getElementById(s);
578
- if (o) {
579
- const a = v(o);
580
- if (a)
581
- return a;
582
- }
583
- }
584
- if ("id" in t && t.id) {
585
- const o = document.querySelector(`label[for="${t.id}"]`);
586
- if (o) {
587
- const a = v(o);
588
- if (a)
589
- return a;
590
- }
591
- }
592
- let i = t.parentElement;
593
- for (; i; ) {
594
- if (i.tagName.toLowerCase() === "label") {
595
- const o = v(i);
596
- if (o)
597
- return o;
598
- }
599
- i = i.parentElement;
600
- }
601
- if (t instanceof HTMLInputElement && "labels" in t && t.labels) {
602
- const o = Array.from(t.labels).map((a) => v(a)).filter(Boolean).join(" ");
603
- if (o)
604
- return o;
605
- }
606
- return "placeholder" in t && typeof t.placeholder == "string" ? t.placeholder : null;
607
- }
608
- function xe(t, e) {
609
- if (!D(t))
610
- return null;
611
- const s = de(e), i = t.closest(`[${s}]`);
612
- if (!i)
613
- return null;
614
- const o = i.getAttribute(s);
615
- return o ? { element: i, customEventName: o } : null;
616
- }
617
- const pe = 255;
618
- function C(t) {
619
- return t ? t.slice(0, pe) : null;
620
- }
621
- const F = "click";
622
- function me(t, e) {
623
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
624
- if (!D(r)) {
625
- const E = {
626
- node_type: "unknown"
627
- };
628
- return l(
629
- F,
630
- [
631
- n("feature_list", "2-0-0", s),
632
- n("session", "1-0-4", i),
633
- n("element", "1-0-0", E),
634
- a ? n("step", "1-0-0", a) : void 0,
635
- o ? n("experience", "1-0-1", o) : void 0
636
- ],
637
- e
638
- );
639
- }
640
- const c = T(r) || r, m = {
641
- id: c.id || null,
642
- node_type: c.nodeName.toLowerCase(),
643
- label: C(b(c)),
644
- text: C(v(c))
645
- };
646
- return l(
647
- F,
648
- [
649
- n("feature_list", "2-0-0", s),
650
- n("session", "1-0-4", i),
651
- n("element", "1-0-0", m),
652
- a ? n("step", "1-0-0", a) : void 0,
653
- o ? n("experience", "1-0-1", o) : void 0
654
- ],
655
- e
656
- );
657
- }
658
- const Ce = p(F, me);
659
- function Ee(t, e, s, i) {
660
- const o = J(s.analyticsContext), a = x(s.analyticsContext), r = u(s.analyticsContext), c = H(s.analyticsContext), m = N(s.analyticsContext), E = Kt(s.analyticsContext), w = Gt(s.analyticsContext), P = Ut(s.analyticsContext), V = X(s.analyticsContext), j = f(s.analyticsContext), S = d(s.analyticsContext), Y = {
661
- id: e.id || null,
662
- node_type: e.nodeName.toLowerCase(),
663
- label: C(b(e)),
664
- text: C(v(e))
665
- };
666
- return l(
667
- t,
668
- [
669
- n("app", "1-0-0", {
670
- organization_id: s.analyticsContext.organizationId,
671
- project_id: s.analyticsContext.projectId
672
- }),
673
- n("session", "1-0-4", j),
674
- n("element", "1-0-0", Y),
675
- o ? n("exception", "1-0-0", o) : void 0,
676
- a ? n("experience", "1-0-1", a) : void 0,
677
- r ? n("feature_list", "2-0-0", r) : void 0,
678
- c ? n("field_list", "1-0-0", c) : void 0,
679
- m ? n("form", "1-0-0", m) : void 0,
680
- E ? n("modal", "1-0-0", E) : void 0,
681
- w ? n("order", "1-0-0", w) : void 0,
682
- P ? n("product_list", "2-0-1", P) : void 0,
683
- V ? n("response_list", "1-0-0", V) : void 0,
684
- S ? n("step", "1-0-0", S) : void 0
685
- ],
686
- i
687
- );
688
- }
689
- function L(t, e, s) {
690
- const i = xe(e.event.target, t);
691
- if (!i)
692
- return;
693
- const { element: o, customEventName: a } = i, r = Ee(a, o, e, s);
694
- ot(r);
695
- }
696
- const R = "rapid_scroll";
697
- function ve(t, e) {
698
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
699
- if (!D(r)) {
700
- const E = {
701
- node_type: "unknown"
702
- };
703
- return l(
704
- R,
705
- [
706
- n("feature_list", "2-0-0", s),
707
- n("session", "1-0-4", i),
708
- a ? n("step", "1-0-0", a) : void 0,
709
- o ? n("experience", "1-0-1", o) : void 0,
710
- n("element", "1-0-0", E)
711
- ],
712
- e
713
- );
714
- }
715
- const c = T(r) || r, m = {
716
- id: c.id || null,
717
- node_type: c.nodeName.toLowerCase(),
718
- label: C(b(c)),
719
- text: C(v(c))
720
- };
721
- return l(
722
- R,
723
- [
724
- n("feature_list", "2-0-0", s),
725
- n("session", "1-0-4", i),
726
- a ? n("step", "1-0-0", a) : void 0,
727
- o ? n("experience", "1-0-1", o) : void 0,
728
- n("element", "1-0-0", m)
729
- ],
730
- e
731
- );
732
- }
733
- const De = p(R, ve), _e = 100, ke = 100, be = 300;
734
- let Q = 0, Z = 0;
735
- const Te = O(
736
- (t, e) => {
737
- De(t, e), L("rapid_scroll", t, e);
738
- },
739
- be
740
- );
741
- function $e(t, e) {
742
- const s = t.event.target || document.documentElement;
743
- if (!(s instanceof HTMLElement))
744
- return;
745
- const i = s.scrollTop, o = Date.now() - Z;
746
- Math.abs(i - Q) > _e && o < ke && Te(t, e), Q = i, Z = Date.now();
747
- }
748
- const ge = k("scroll", $e, !0), W = "rapid_click";
749
- function Le(t, e) {
750
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
751
- if (!D(r)) {
752
- const E = {
753
- node_type: "unknown"
754
- };
755
- return l(
756
- W,
757
- [
758
- n("feature_list", "2-0-0", s),
759
- n("session", "1-0-4", i),
760
- n("element", "1-0-0", E),
761
- a ? n("step", "1-0-0", a) : void 0,
762
- o ? n("experience", "1-0-1", o) : void 0
763
- ],
764
- e
765
- );
766
- }
767
- const c = T(r) || r, m = {
768
- id: c.id || null,
769
- node_type: c.nodeName.toLowerCase(),
770
- label: C(b(c)),
771
- text: C(v(c))
772
- };
773
- return l(
774
- W,
775
- [
776
- n("feature_list", "2-0-0", s),
777
- n("session", "1-0-4", i),
778
- n("element", "1-0-0", m),
779
- a ? n("step", "1-0-0", a) : void 0,
780
- o ? n("experience", "1-0-1", o) : void 0
781
- ],
782
- e
783
- );
784
- }
785
- const ye = p(W, Le);
786
- let A = 0, tt = 0;
787
- const he = 3, Ne = 500;
788
- function we(t, e) {
789
- const s = (/* @__PURE__ */ new Date()).getTime();
790
- s - tt < Ne ? A++ : A = 1, tt = s, A >= he && (ye(t, e), L("rapid_click", t, e), A = 0);
791
- }
792
- const Pe = k("click", we), I = "right_click";
793
- function Ve(t, e) {
794
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
795
- if (!D(r)) {
796
- const E = {
797
- node_type: "unknown"
798
- };
799
- return l(I, [
800
- n("feature_list", "2-0-0", s),
801
- n("session", "1-0-4", i),
802
- n("element", "1-0-0", E),
803
- a ? n("step", "1-0-0", a) : void 0,
804
- o ? n("experience", "1-0-1", o) : void 0
805
- ]);
806
- }
807
- const c = T(r) || r, m = {
808
- id: c.id || null,
809
- node_type: c.nodeName.toLowerCase(),
810
- label: C(b(c)),
811
- text: C(v(c))
812
- };
813
- return l(
814
- I,
815
- [
816
- n("feature_list", "2-0-0", s),
817
- n("session", "1-0-4", i),
818
- n("element", "1-0-0", m),
819
- a ? n("step", "1-0-0", a) : void 0,
820
- o ? n("experience", "1-0-1", o) : void 0
821
- ],
822
- e
823
- );
824
- }
825
- const Se = p(I, Ve);
826
- function Ye(t, e) {
827
- Se(t, e), L("right_click", t, e);
828
- }
829
- const Be = k("contextmenu", Ye), _t = "mouse_shake";
830
- function Ae(t, e) {
831
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
832
- return l(
833
- _t,
834
- [
835
- n("feature_list", "2-0-0", s),
836
- n("session", "1-0-4", i),
837
- a ? n("step", "1-0-0", a) : void 0,
838
- o ? n("experience", "1-0-1", o) : void 0
839
- ],
840
- e
841
- );
842
- }
843
- const He = p(_t, Ae), Oe = 5, je = 500, qe = 500;
844
- let et = { x: 0 }, y = [], nt = 0;
845
- const Fe = O(
846
- (t, e) => {
847
- He(t, e), L("mouse_shake", t, e);
848
- },
849
- je
850
- );
851
- function Re(t, e) {
852
- const s = Date.now(), i = t.event.clientX - et.x, o = Math.sign(i);
853
- s - nt > qe && (y = []), o !== 0 && (y.length === 0 || y.at(-1) !== o) && y.push(o), et = { x: t.event.clientX, y: t.event.clientY }, y.length >= Oe && (Fe(t, e), y = []), nt = s;
854
- }
855
- const We = k("mousemove", Re), kt = "page_visible";
856
- function Ie(t, e) {
857
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
858
- return l(
859
- kt,
860
- [
861
- n("feature_list", "2-0-0", s),
862
- n("session", "1-0-4", i),
863
- a ? n("step", "1-0-0", a) : void 0,
864
- o ? n("experience", "1-0-1", o) : void 0
865
- ],
866
- e
867
- );
868
- }
869
- const ze = p(kt, Ie), bt = "page_hidden";
870
- function Ue(t, e) {
871
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
872
- return l(
873
- bt,
874
- [
875
- n("feature_list", "2-0-0", s),
876
- n("session", "1-0-4", i),
877
- a ? n("step", "1-0-0", a) : void 0,
878
- o ? n("experience", "1-0-1", o) : void 0
879
- ],
880
- e
881
- );
882
- }
883
- const Ge = p(bt, Ue);
884
- function Ke(t, e) {
885
- if (document.visibilityState === "visible") {
886
- ze(t, e);
887
- return;
888
- }
889
- Ge(t, e);
890
- }
891
- const Me = zt("visibilitychange", Ke), z = "backspace";
892
- function Xe(t, e) {
893
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
894
- if (!D(r)) {
895
- const E = {
896
- node_type: "unknown"
897
- };
898
- return l(
899
- z,
900
- [
901
- n("feature_list", "2-0-0", s),
902
- n("session", "1-0-4", i),
903
- n("element", "1-0-0", E),
904
- a ? n("step", "1-0-0", a) : void 0,
905
- o ? n("experience", "1-0-1", o) : void 0
906
- ],
907
- e
908
- );
909
- }
910
- const c = T(r) || r, m = {
911
- id: c.id || null,
912
- node_type: c.nodeName.toLowerCase(),
913
- label: C(b(c)),
914
- text: C(v(c))
915
- };
916
- return l(
917
- z,
918
- [
919
- n("feature_list", "2-0-0", s),
920
- n("session", "1-0-4", i),
921
- n("element", "1-0-0", m),
922
- a ? n("step", "1-0-0", a) : void 0,
923
- o ? n("experience", "1-0-1", o) : void 0
924
- ],
925
- e
926
- );
927
- }
928
- const Je = p(z, Xe);
929
- function Qe(t, e) {
930
- t.event.key === "Backspace" && Je(t, e);
931
- }
932
- const Ze = k("keydown", Qe), Tt = "page_hide";
933
- function tn(t, e) {
934
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
935
- return l(
936
- Tt,
937
- [
938
- n("feature_list", "2-0-0", s),
939
- n("session", "1-0-4", i),
940
- a ? n("step", "1-0-0", a) : void 0,
941
- o ? n("experience", "1-0-1", o) : void 0
942
- ],
943
- e
944
- );
945
- }
946
- const en = p(Tt, tn);
947
- function nn(t, e) {
948
- en(t, e);
949
- }
950
- const sn = h("pagehide", nn), $t = "page_show";
951
- function on(t, e) {
952
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
953
- return l(
954
- $t,
955
- [
956
- n("feature_list", "2-0-0", s),
957
- n("session", "1-0-4", i),
958
- a ? n("step", "1-0-0", a) : void 0,
959
- o ? n("experience", "1-0-1", o) : void 0
960
- ],
961
- e
962
- );
963
- }
964
- const an = p($t, on);
965
- function rn(t, e) {
966
- an(t, e);
967
- }
968
- const cn = h("pageshow", rn), gt = "offline";
969
- function ln(t, e) {
970
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
971
- return l(
972
- gt,
973
- [
974
- n("feature_list", "2-0-0", s),
975
- n("session", "1-0-4", i),
976
- a ? n("step", "1-0-0", a) : void 0,
977
- o ? n("experience", "1-0-1", o) : void 0
978
- ],
979
- e
980
- );
981
- }
982
- const un = p(gt, ln);
983
- function fn(t, e) {
984
- un(t, e);
985
- }
986
- const dn = h("offline", fn), U = "scroll";
987
- function xn(t, e) {
988
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
989
- if (!D(r))
990
- return l(
991
- U,
992
- [
993
- n("feature_list", "2-0-0", s),
994
- n("session", "1-0-4", i),
995
- a ? n("step", "1-0-0", a) : void 0,
996
- o ? n("experience", "1-0-1", o) : void 0
997
- ],
998
- e
999
- );
1000
- const c = T(r) || r, m = {
1001
- id: c.id || null,
1002
- node_type: c.nodeName.toLowerCase(),
1003
- label: C(b(c)),
1004
- text: C(v(c))
1005
- };
1006
- return l(
1007
- U,
1008
- [
1009
- n("feature_list", "2-0-0", s),
1010
- n("session", "1-0-4", i),
1011
- a ? n("step", "1-0-0", a) : void 0,
1012
- o ? n("experience", "1-0-1", o) : void 0,
1013
- n("element", "1-0-0", m)
1014
- ],
1015
- e
1016
- );
1017
- }
1018
- const pn = p(U, xn), mn = O(
1019
- (t, e) => {
1020
- pn(t, e), L("scroll", t, e);
1021
- },
1022
- 500
1023
- ), Cn = k("scroll", mn, !0), Lt = "online";
1024
- function En(t, e) {
1025
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
1026
- return l(
1027
- Lt,
1028
- [
1029
- n("feature_list", "2-0-0", s),
1030
- n("session", "1-0-4", i),
1031
- a ? n("step", "1-0-0", a) : void 0,
1032
- o ? n("experience", "1-0-1", o) : void 0
1033
- ],
1034
- e
1035
- );
1036
- }
1037
- const vn = p(Lt, En);
1038
- function Dn(t, e) {
1039
- vn(t, e);
1040
- }
1041
- const _n = h("online", Dn), yt = "resize";
1042
- function kn(t, e) {
1043
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
1044
- return l(
1045
- yt,
1046
- [
1047
- n("feature_list", "2-0-0", s),
1048
- n("session", "1-0-4", i),
1049
- a ? n("step", "1-0-0", a) : void 0,
1050
- o ? n("experience", "1-0-1", o) : void 0
1051
- ],
1052
- e
1053
- );
1054
- }
1055
- const st = p(yt, kn);
1056
- let q = 0;
1057
- const bn = O(
1058
- (t, e) => {
1059
- const s = window.innerWidth;
1060
- s !== q ? (st(t, e), q = s) : "ontouchstart" in window || st(t, e), q = s;
1061
- },
1062
- 300
1063
- ), Tn = h("resize", bn), ht = "unload";
1064
- function $n(t, e) {
1065
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext);
1066
- return l(
1067
- ht,
1068
- [
1069
- n("feature_list", "2-0-0", s),
1070
- n("session", "1-0-4", i),
1071
- a ? n("step", "1-0-0", a) : void 0,
1072
- o ? n("experience", "1-0-1", o) : void 0
1073
- ],
1074
- e
1075
- );
1076
- }
1077
- const gn = p(ht, $n);
1078
- function Ln(t, e) {
1079
- gn(t, e);
1080
- }
1081
- const yn = h("unload", Ln);
1082
- function hn(t, e) {
1083
- Ce(t, e), L("click", t, e);
1084
- }
1085
- const Nn = k("click", hn), G = "paste";
1086
- function wn(t, e) {
1087
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1088
- if (!D(r))
1089
- return l(
1090
- G,
1091
- [
1092
- n("feature_list", "2-0-0", s),
1093
- n("session", "1-0-4", i),
1094
- a ? n("step", "1-0-0", a) : void 0,
1095
- o ? n("experience", "1-0-1", o) : void 0
1096
- ],
1097
- e
1098
- );
1099
- const c = T(r) || r, m = {
1100
- id: c.id || null,
1101
- node_type: c.nodeName.toLowerCase(),
1102
- label: C(b(c)),
1103
- text: C(v(c))
1104
- };
1105
- return l(
1106
- G,
1107
- [
1108
- n("feature_list", "2-0-0", s),
1109
- n("session", "1-0-4", i),
1110
- a ? n("step", "1-0-0", a) : void 0,
1111
- o ? n("experience", "1-0-1", o) : void 0,
1112
- n("element", "1-0-0", m)
1113
- ],
1114
- e
1115
- );
1116
- }
1117
- const Pn = p(G, wn);
1118
- function Vn(t, e) {
1119
- Pn(t, e);
1120
- }
1121
- const Sn = k("paste", Vn), K = "copy";
1122
- function Yn(t, e) {
1123
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1124
- if (!D(r))
1125
- return l(
1126
- K,
1127
- [
1128
- n("feature_list", "2-0-0", s),
1129
- n("session", "1-0-4", i),
1130
- a ? n("step", "1-0-0", a) : void 0,
1131
- o ? n("experience", "1-0-1", o) : void 0
1132
- ],
1133
- e
1134
- );
1135
- const c = T(r) || r, m = {
1136
- id: c.id || null,
1137
- node_type: c.nodeName.toLowerCase(),
1138
- label: C(b(c)),
1139
- text: C(v(c))
1140
- };
1141
- return l(
1142
- K,
1143
- [
1144
- n("feature_list", "2-0-0", s),
1145
- n("session", "1-0-4", i),
1146
- a ? n("step", "1-0-0", a) : void 0,
1147
- o ? n("experience", "1-0-1", o) : void 0,
1148
- n("element", "1-0-0", m)
1149
- ],
1150
- e
1151
- );
1152
- }
1153
- const Bn = p(K, Yn);
1154
- function An(t, e) {
1155
- Bn(t, e);
1156
- }
1157
- const Hn = k("copy", An), M = "drag";
1158
- function On(t, e) {
1159
- const s = u(t.analyticsContext), i = f(t.analyticsContext), o = x(t.analyticsContext), a = d(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1160
- if (!D(r))
1161
- return l(
1162
- M,
1163
- [
1164
- n("feature_list", "2-0-0", s),
1165
- n("session", "1-0-4", i),
1166
- a ? n("step", "1-0-0", a) : void 0,
1167
- o ? n("experience", "1-0-1", o) : void 0
1168
- ],
1169
- e
1170
- );
1171
- const c = T(r) || r, m = {
1172
- id: c.id || null,
1173
- node_type: c.nodeName.toLowerCase(),
1174
- label: C(b(c)),
1175
- text: C(v(c))
1176
- };
1177
- return l(
1178
- M,
1179
- [
1180
- n("feature_list", "2-0-0", s),
1181
- n("session", "1-0-4", i),
1182
- a ? n("step", "1-0-0", a) : void 0,
1183
- o ? n("experience", "1-0-1", o) : void 0,
1184
- n("element", "1-0-0", m)
1185
- ],
1186
- e
1187
- );
1188
- }
1189
- const jn = p(M, On);
1190
- function Nt(t, e) {
1191
- const s = t.event.currentTarget;
1192
- if (!s || !(s instanceof HTMLElement))
1193
- return;
1194
- function i(o) {
1195
- Nt({ event: o, analyticsContext: t.analyticsContext });
1196
- }
1197
- s.removeEventListener("drag", i), s.addEventListener(
1198
- "dragend",
1199
- () => wt(s, () => t.analyticsContext)
1200
- ), jn(t, e), L("drag", t, e);
1201
- }
1202
- const wt = k("drag", Nt);
1203
- function is(t, e) {
1204
- e && (Nn(e, t), Pe(e, t), Be(e, t), Hn(e, t), Sn(e, t), wt(e, t), Ze(e, t), Cn(e, t), ge(e, t), We(e, t));
1205
- }
1206
- function rs(t) {
1207
- Me(t), sn(t), cn(t), dn(t), _n(t), Tn(t), yn(t);
1208
- }
1209
- export {
1210
- ss as A,
1211
- as as B,
1212
- Zn as C,
1213
- ts as D,
1214
- es as E,
1215
- f as a,
1216
- x as b,
1217
- p as c,
1218
- d,
1219
- X as e,
1220
- u as f,
1221
- H as g,
1222
- l as h,
1223
- n as i,
1224
- J as j,
1225
- Ut as k,
1226
- Gt as l,
1227
- Kt as m,
1228
- rs as n,
1229
- is as o,
1230
- Un as p,
1231
- Kn as q,
1232
- Mn as r,
1233
- Xn as s,
1234
- Gn as t,
1235
- L as u,
1236
- Ce as v,
1237
- Jn as w,
1238
- Qn as x,
1239
- ns as y,
1240
- os as z
1241
- };