@rakutenanalytics/rat-react 0.3.3-rel.0 → 0.4.0-rel.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +530 -372
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,192 +1,192 @@
1
- import { useState as F, useEffect as R, createContext as se, useContext as ce, useRef as K, useCallback as _e } from "react";
2
- import { jsx as z } from "react/jsx-runtime";
3
- var ue = Object.defineProperty, pe = (a, e, s) => e in a ? ue(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s, P = (a, e, s) => pe(a, typeof e != "symbol" ? e + "" : e, s), k, X = -1, S = function(a) {
1
+ import { useState as B, useEffect as v, createContext as se, useContext as ce, useRef as M, useCallback as _e } from "react";
2
+ import { jsx as X } from "react/jsx-runtime";
3
+ var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s, g = (n, e, s) => pe(n, typeof e != "symbol" ? e + "" : e, s), D, J = -1, P = function(n) {
4
4
  addEventListener("pageshow", function(e) {
5
- e.persisted && (X = e.timeStamp, a(e));
5
+ e.persisted && (J = e.timeStamp, n(e));
6
6
  }, !0);
7
- }, D = function() {
8
- var a = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
9
- if (a && a.responseStart > 0 && a.responseStart < performance.now()) return a;
10
- }, O = function() {
11
- var a = D();
12
- return a && a.activationStart || 0;
13
- }, T = function(a, e) {
14
- var s = D(), _ = "navigate";
15
- return X >= 0 ? _ = "back-forward-cache" : s && (document.prerendering || O() > 0 ? _ = "prerender" : document.wasDiscarded ? _ = "restore" : s.type && (_ = s.type.replace(/_/g, "-"))), { name: a, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: _ };
16
- }, v = function(a, e, s) {
7
+ }, H = function() {
8
+ var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
9
+ if (n && n.responseStart > 0 && n.responseStart < performance.now()) return n;
10
+ }, N = function() {
11
+ var n = H();
12
+ return n && n.activationStart || 0;
13
+ }, T = function(n, e) {
14
+ var s = H(), _ = "navigate";
15
+ return J >= 0 ? _ = "back-forward-cache" : s && (document.prerendering || N() > 0 ? _ = "prerender" : document.wasDiscarded ? _ = "restore" : s.type && (_ = s.type.replace(/_/g, "-"))), { name: n, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: _ };
16
+ }, C = function(n, e, s) {
17
17
  try {
18
- if (PerformanceObserver.supportedEntryTypes.includes(a)) {
18
+ if (PerformanceObserver.supportedEntryTypes.includes(n)) {
19
19
  var _ = new PerformanceObserver(function(t) {
20
20
  Promise.resolve().then(function() {
21
21
  e(t.getEntries());
22
22
  });
23
23
  });
24
- return _.observe(Object.assign({ type: a, buffered: !0 }, s || {})), _;
24
+ return _.observe(Object.assign({ type: n, buffered: !0 }, s || {})), _;
25
25
  }
26
26
  } catch {
27
27
  }
28
- }, d = function(a, e, s, _) {
28
+ }, f = function(n, e, s, _) {
29
29
  var t, r;
30
- return function(n) {
31
- e.value >= 0 && (n || _) && ((r = e.value - (t || 0)) || t === void 0) && (t = e.value, e.delta = r, e.rating = (function(i, o) {
30
+ return function(a) {
31
+ e.value >= 0 && (a || _) && ((r = e.value - (t || 0)) || t === void 0) && (t = e.value, e.delta = r, e.rating = (function(i, o) {
32
32
  return i > o[1] ? "poor" : i > o[0] ? "needs-improvement" : "good";
33
- })(e.value, s), a(e));
33
+ })(e.value, s), n(e));
34
34
  };
35
- }, B = function(a) {
35
+ }, K = function(n) {
36
36
  requestAnimationFrame(function() {
37
37
  return requestAnimationFrame(function() {
38
- return a();
38
+ return n();
39
39
  });
40
40
  });
41
- }, N = function(a) {
41
+ }, b = function(n) {
42
42
  document.addEventListener("visibilitychange", function() {
43
- document.visibilityState === "hidden" && a();
43
+ document.visibilityState === "hidden" && n();
44
44
  });
45
- }, H = function(a) {
45
+ }, W = function(n) {
46
46
  var e = !1;
47
47
  return function() {
48
- e || (a(), e = !0);
48
+ e || (n(), e = !0);
49
49
  };
50
- }, E = -1, W = function() {
50
+ }, S = -1, G = function() {
51
51
  return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
52
- }, L = function(a) {
53
- document.visibilityState === "hidden" && E > -1 && (E = a.type === "visibilitychange" ? a.timeStamp : 0, le());
54
- }, G = function() {
55
- addEventListener("visibilitychange", L, !0), addEventListener("prerenderingchange", L, !0);
52
+ }, O = function(n) {
53
+ document.visibilityState === "hidden" && S > -1 && (S = n.type === "visibilitychange" ? n.timeStamp : 0, le());
54
+ }, j = function() {
55
+ addEventListener("visibilitychange", O, !0), addEventListener("prerenderingchange", O, !0);
56
56
  }, le = function() {
57
- removeEventListener("visibilitychange", L, !0), removeEventListener("prerenderingchange", L, !0);
58
- }, J = function() {
59
- return E < 0 && (E = W(), G(), S(function() {
57
+ removeEventListener("visibilitychange", O, !0), removeEventListener("prerenderingchange", O, !0);
58
+ }, $ = function() {
59
+ return S < 0 && (S = G(), j(), P(function() {
60
60
  setTimeout(function() {
61
- E = W(), G();
61
+ S = G(), j();
62
62
  }, 0);
63
63
  })), { get firstHiddenTime() {
64
- return E;
64
+ return S;
65
65
  } };
66
- }, b = function(a) {
66
+ }, U = function(n) {
67
67
  document.prerendering ? addEventListener("prerenderingchange", function() {
68
- return a();
69
- }, !0) : a();
70
- }, j = [1800, 3e3], $ = function(a, e) {
71
- e = e || {}, b(function() {
72
- var s, _ = J(), t = T("FCP"), r = v("paint", function(n) {
73
- n.forEach(function(i) {
74
- i.name === "first-contentful-paint" && (r.disconnect(), i.startTime < _.firstHiddenTime && (t.value = Math.max(i.startTime - O(), 0), t.entries.push(i), s(!0)));
68
+ return n();
69
+ }, !0) : n();
70
+ }, Y = [1800, 3e3], Z = function(n, e) {
71
+ e = e || {}, U(function() {
72
+ var s, _ = $(), t = T("FCP"), r = C("paint", function(a) {
73
+ a.forEach(function(i) {
74
+ i.name === "first-contentful-paint" && (r.disconnect(), i.startTime < _.firstHiddenTime && (t.value = Math.max(i.startTime - N(), 0), t.entries.push(i), s(!0)));
75
75
  });
76
76
  });
77
- r && (s = d(a, t, j, e.reportAllChanges), S(function(n) {
78
- t = T("FCP"), s = d(a, t, j, e.reportAllChanges), B(function() {
79
- t.value = performance.now() - n.timeStamp, s(!0);
77
+ r && (s = f(n, t, Y, e.reportAllChanges), P(function(a) {
78
+ t = T("FCP"), s = f(n, t, Y, e.reportAllChanges), K(function() {
79
+ t.value = performance.now() - a.timeStamp, s(!0);
80
80
  });
81
81
  }));
82
82
  });
83
- }, Y = [0.1, 0.25], me = function(a, e) {
84
- e = e || {}, $(H(function() {
85
- var s, _ = T("CLS", 0), t = 0, r = [], n = function(o) {
83
+ }, Q = [0.1, 0.25], he = function(n, e) {
84
+ e = e || {}, Z(W(function() {
85
+ var s, _ = T("CLS", 0), t = 0, r = [], a = function(o) {
86
86
  o.forEach(function(c) {
87
87
  if (!c.hadRecentInput) {
88
88
  var u = r[0], l = r[r.length - 1];
89
89
  t && c.startTime - l.startTime < 1e3 && c.startTime - u.startTime < 5e3 ? (t += c.value, r.push(c)) : (t = c.value, r = [c]);
90
90
  }
91
91
  }), t > _.value && (_.value = t, _.entries = r, s());
92
- }, i = v("layout-shift", n);
93
- i && (s = d(a, _, Y, e.reportAllChanges), N(function() {
94
- n(i.takeRecords()), s(!0);
95
- }), S(function() {
96
- t = 0, _ = T("CLS", 0), s = d(a, _, Y, e.reportAllChanges), B(function() {
92
+ }, i = C("layout-shift", a);
93
+ i && (s = f(n, _, Q, e.reportAllChanges), b(function() {
94
+ a(i.takeRecords()), s(!0);
95
+ }), P(function() {
96
+ t = 0, _ = T("CLS", 0), s = f(n, _, Q, e.reportAllChanges), K(function() {
97
97
  return s();
98
98
  });
99
99
  }), setTimeout(s, 0));
100
100
  }));
101
- }, Z = 0, w = 1 / 0, C = 0, he = function(a) {
102
- a.forEach(function(e) {
103
- e.interactionId && (w = Math.min(w, e.interactionId), C = Math.max(C, e.interactionId), Z = C ? (C - w) / 7 + 1 : 0);
101
+ }, ee = 0, V = 1 / 0, L = 0, me = function(n) {
102
+ n.forEach(function(e) {
103
+ e.interactionId && (V = Math.min(V, e.interactionId), L = Math.max(L, e.interactionId), ee = L ? (L - V) / 7 + 1 : 0);
104
104
  });
105
- }, ee = function() {
106
- return k ? Z : performance.interactionCount || 0;
105
+ }, te = function() {
106
+ return D ? ee : performance.interactionCount || 0;
107
107
  }, ge = function() {
108
- "interactionCount" in performance || k || (k = v("event", he, { type: "event", buffered: !0, durationThreshold: 0 }));
109
- }, g = [], A = /* @__PURE__ */ new Map(), te = 0, Te = function() {
110
- var a = Math.min(g.length - 1, Math.floor((ee() - te) / 50));
111
- return g[a];
112
- }, de = [], fe = function(a) {
113
- if (de.forEach(function(t) {
114
- return t(a);
115
- }), a.interactionId || a.entryType === "first-input") {
116
- var e = g[g.length - 1], s = A.get(a.interactionId);
117
- if (s || g.length < 10 || a.duration > e.latency) {
118
- if (s) a.duration > s.latency ? (s.entries = [a], s.latency = a.duration) : a.duration === s.latency && a.startTime === s.entries[0].startTime && s.entries.push(a);
108
+ "interactionCount" in performance || D || (D = C("event", me, { type: "event", buffered: !0, durationThreshold: 0 }));
109
+ }, d = [], R = /* @__PURE__ */ new Map(), re = 0, de = function() {
110
+ var n = Math.min(d.length - 1, Math.floor((te() - re) / 50));
111
+ return d[n];
112
+ }, Te = [], fe = function(n) {
113
+ if (Te.forEach(function(t) {
114
+ return t(n);
115
+ }), n.interactionId || n.entryType === "first-input") {
116
+ var e = d[d.length - 1], s = R.get(n.interactionId);
117
+ if (s || d.length < 10 || n.duration > e.latency) {
118
+ if (s) n.duration > s.latency ? (s.entries = [n], s.latency = n.duration) : n.duration === s.latency && n.startTime === s.entries[0].startTime && s.entries.push(n);
119
119
  else {
120
- var _ = { id: a.interactionId, latency: a.duration, entries: [a] };
121
- A.set(_.id, _), g.push(_);
120
+ var _ = { id: n.interactionId, latency: n.duration, entries: [n] };
121
+ R.set(_.id, _), d.push(_);
122
122
  }
123
- g.sort(function(t, r) {
123
+ d.sort(function(t, r) {
124
124
  return r.latency - t.latency;
125
- }), g.length > 10 && g.splice(10).forEach(function(t) {
126
- return A.delete(t.id);
125
+ }), d.length > 10 && d.splice(10).forEach(function(t) {
126
+ return R.delete(t.id);
127
127
  });
128
128
  }
129
129
  }
130
- }, re = function(a) {
130
+ }, ne = function(n) {
131
131
  var e = self.requestIdleCallback || self.setTimeout, s = -1;
132
- return a = H(a), document.visibilityState === "hidden" ? a() : (s = e(a), N(a)), s;
133
- }, Q = [200, 500], ye = function(a, e) {
134
- "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, b(function() {
132
+ return n = W(n), document.visibilityState === "hidden" ? n() : (s = e(n), b(n)), s;
133
+ }, x = [200, 500], ye = function(n, e) {
134
+ "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, U(function() {
135
135
  var s;
136
136
  ge();
137
137
  var _, t = T("INP"), r = function(i) {
138
- re(function() {
138
+ ne(function() {
139
139
  i.forEach(fe);
140
- var o = Te();
140
+ var o = de();
141
141
  o && o.latency !== t.value && (t.value = o.latency, t.entries = o.entries, _());
142
142
  });
143
- }, n = v("event", r, { durationThreshold: (s = e.durationThreshold) !== null && s !== void 0 ? s : 40 });
144
- _ = d(a, t, Q, e.reportAllChanges), n && (n.observe({ type: "first-input", buffered: !0 }), N(function() {
145
- r(n.takeRecords()), _(!0);
146
- }), S(function() {
147
- te = ee(), g.length = 0, A.clear(), t = T("INP"), _ = d(a, t, Q, e.reportAllChanges);
143
+ }, a = C("event", r, { durationThreshold: (s = e.durationThreshold) !== null && s !== void 0 ? s : 40 });
144
+ _ = f(n, t, x, e.reportAllChanges), a && (a.observe({ type: "first-input", buffered: !0 }), b(function() {
145
+ r(a.takeRecords()), _(!0);
146
+ }), P(function() {
147
+ re = te(), d.length = 0, R.clear(), t = T("INP"), _ = f(n, t, x, e.reportAllChanges);
148
148
  }));
149
149
  }));
150
- }, x = [2500, 4e3], V = {}, Ee = function(a, e) {
151
- e = e || {}, b(function() {
152
- var s, _ = J(), t = T("LCP"), r = function(o) {
150
+ }, q = [2500, 4e3], k = {}, Ee = function(n, e) {
151
+ e = e || {}, U(function() {
152
+ var s, _ = $(), t = T("LCP"), r = function(o) {
153
153
  e.reportAllChanges || (o = o.slice(-1)), o.forEach(function(c) {
154
- c.startTime < _.firstHiddenTime && (t.value = Math.max(c.startTime - O(), 0), t.entries = [c], s());
154
+ c.startTime < _.firstHiddenTime && (t.value = Math.max(c.startTime - N(), 0), t.entries = [c], s());
155
155
  });
156
- }, n = v("largest-contentful-paint", r);
157
- if (n) {
158
- s = d(a, t, x, e.reportAllChanges);
159
- var i = H(function() {
160
- V[t.id] || (r(n.takeRecords()), n.disconnect(), V[t.id] = !0, s(!0));
156
+ }, a = C("largest-contentful-paint", r);
157
+ if (a) {
158
+ s = f(n, t, q, e.reportAllChanges);
159
+ var i = W(function() {
160
+ k[t.id] || (r(a.takeRecords()), a.disconnect(), k[t.id] = !0, s(!0));
161
161
  });
162
162
  ["keydown", "click"].forEach(function(o) {
163
163
  addEventListener(o, function() {
164
- return re(i);
164
+ return ne(i);
165
165
  }, { once: !0, capture: !0 });
166
- }), N(i), S(function(o) {
167
- t = T("LCP"), s = d(a, t, x, e.reportAllChanges), B(function() {
168
- t.value = performance.now() - o.timeStamp, V[t.id] = !0, s(!0);
166
+ }), b(i), P(function(o) {
167
+ t = T("LCP"), s = f(n, t, q, e.reportAllChanges), K(function() {
168
+ t.value = performance.now() - o.timeStamp, k[t.id] = !0, s(!0);
169
169
  });
170
170
  });
171
171
  }
172
172
  });
173
- }, q = [800, 1800], Se = function a(e) {
174
- document.prerendering ? b(function() {
175
- return a(e);
173
+ }, z = [800, 1800], Se = function n(e) {
174
+ document.prerendering ? U(function() {
175
+ return n(e);
176
176
  }) : document.readyState !== "complete" ? addEventListener("load", function() {
177
- return a(e);
177
+ return n(e);
178
178
  }, !0) : setTimeout(e, 0);
179
- }, Pe = function(a, e) {
179
+ }, ve = function(n, e) {
180
180
  e = e || {};
181
- var s = T("TTFB"), _ = d(a, s, q, e.reportAllChanges);
181
+ var s = T("TTFB"), _ = f(n, s, z, e.reportAllChanges);
182
182
  Se(function() {
183
- var t = D();
184
- t && (s.value = Math.max(t.responseStart - O(), 0), s.entries = [t], _(!0), S(function() {
185
- s = T("TTFB", 0), (_ = d(a, s, q, e.reportAllChanges))(!0);
183
+ var t = H();
184
+ t && (s.value = Math.max(t.responseStart - N(), 0), s.entries = [t], _(!0), P(function() {
185
+ s = T("TTFB", 0), (_ = f(n, s, z, e.reportAllChanges))(!0);
186
186
  }));
187
187
  });
188
188
  };
189
- function ve(a = []) {
189
+ function Pe(n = []) {
190
190
  const e = {};
191
191
  e.ParameterTypes = {
192
192
  /** Account ID. */
@@ -360,10 +360,10 @@ function ve(a = []) {
360
360
  get: function() {
361
361
  return t.__uach_full_version_list;
362
362
  },
363
- set: function(n) {
364
- if (Array.isArray(n))
363
+ set: function(a) {
364
+ if (Array.isArray(a))
365
365
  try {
366
- t.__uach_full_version_list = n.reduce(function(i, o, c) {
366
+ t.__uach_full_version_list = a.reduce(function(i, o, c) {
367
367
  return i += (c ? ", " : "") + '"' + o.brand + '";v="' + o.version + '"', i;
368
368
  }, "");
369
369
  } catch (i) {
@@ -376,14 +376,14 @@ function ve(a = []) {
376
376
  get: function() {
377
377
  return t.__uach_wow64;
378
378
  },
379
- set: function(n) {
380
- t.__uach_wow64 = (!!n).toString();
379
+ set: function(a) {
380
+ t.__uach_wow64 = (!!a).toString();
381
381
  }
382
382
  }
383
383
  });
384
384
  var r = function() {
385
- var n = navigator.userAgentData.getHighEntropyValues;
386
- n = n.call(navigator.userAgentData, [
385
+ var a = navigator.userAgentData.getHighEntropyValues;
386
+ a = a.call(navigator.userAgentData, [
387
387
  "architecture",
388
388
  "bitness",
389
389
  "model",
@@ -392,7 +392,7 @@ function ve(a = []) {
392
392
  "wow64"
393
393
  ]).then(function(i) {
394
394
  i && (t[e.ParameterTypes.UACH_ARCHITECTURE] = i.architecture, t[e.ParameterTypes.UACH_BITNESS] = i.bitness, t[e.ParameterTypes.UACH_FULL_VERSION_LIST] = i.fullVersionList, t[e.ParameterTypes.UACH_MODEL] = i.model, t[e.ParameterTypes.UACH_PLATFORM_VERSION] = i.platformVersion, t[e.ParameterTypes.UACH_WOW64] = i.wow64), e._asyncDelaysFlag = !1;
395
- }), n.catch(function() {
395
+ }), a.catch(function() {
396
396
  e._asyncDelaysFlag = !1;
397
397
  });
398
398
  };
@@ -413,14 +413,14 @@ function ve(a = []) {
413
413
  return !!t && Object.prototype.toString.call(t) === "[object Object]";
414
414
  }, e._mergeDictionaries = function(t, r) {
415
415
  if (t && typeof t == "object" && r && typeof r == "object") {
416
- for (var n in r)
417
- t[n] = r[n];
416
+ for (var a in r)
417
+ t[a] = r[a];
418
418
  return !0;
419
419
  }
420
420
  return !1;
421
421
  }, e._getCookie = function(t, r) {
422
- var n = e._trimString(t);
423
- if (n === null)
422
+ var a = e._trimString(t);
423
+ if (a === null)
424
424
  return e._log("Empty cookie name!"), null;
425
425
  r === void 0 && (r = document.cookie);
426
426
  var i = r ? r.split(";") : "", o;
@@ -428,18 +428,18 @@ function ve(a = []) {
428
428
  var c = i[o].indexOf("=");
429
429
  if (c > 0) {
430
430
  var u = e._trimString(i[o].substr(0, c));
431
- if (u === n)
431
+ if (u === a)
432
432
  return i[o].substr(c + 1);
433
433
  }
434
434
  }
435
435
  return null;
436
- }, e._setCookie = function(t, r, n, i) {
437
- var o = e._trimString(t), c = e._trimString(r), u = parseInt(n, 10);
436
+ }, e._setCookie = function(t, r, a, i) {
437
+ var o = e._trimString(t), c = e._trimString(r), u = parseInt(a, 10);
438
438
  if (o !== null && c !== null && !isNaN(u)) {
439
439
  var l = /* @__PURE__ */ new Date();
440
440
  u <= 0 ? l.setTime(0) : l.setDate(l.getDate() + u);
441
- var h = location.protocol === "https:";
442
- u <= 0 ? e._log('Clearing cookie "' + o + '"') : e._log("Setting " + (h ? "secure " : "") + 'cookie "' + o + '" with value "' + c + '" valid for ' + u + " days"), document.cookie = o + "=" + c + "; Expires=" + l.toGMTString() + ";" + (i ? " Domain=." + i + ";" : "") + " Path=/;" + (h ? " Secure;" : "");
441
+ var m = location.protocol === "https:";
442
+ u <= 0 ? e._log('Clearing cookie "' + o + '"') : e._log("Setting " + (m ? "secure " : "") + 'cookie "' + o + '" with value "' + c + '" valid for ' + u + " days"), document.cookie = o + "=" + c + "; Expires=" + l.toGMTString() + ";" + (i ? " Domain=." + i + ";" : "") + " Path=/;" + (m ? " Secure;" : "");
443
443
  } else
444
444
  e._log("Cannot set cookie with empty name or value");
445
445
  }, e._removeCookie = function(t) {
@@ -450,36 +450,36 @@ function ve(a = []) {
450
450
  }, e._testCookieSupport = function(t) {
451
451
  var r = e._KEY_PREFIX_MARKER + "TEST";
452
452
  e._setCookie(r, r, 1, t);
453
- var n = e._getCookie(r);
454
- return e._setCookie(r, "", 0, t), n === r;
453
+ var a = e._getCookie(r);
454
+ return e._setCookie(r, "", 0, t), a === r;
455
455
  }, e._getQueryParam = function(t, r) {
456
456
  t = e._trimString(t);
457
- var n = RegExp("^" + t + "=");
457
+ var a = RegExp("^" + t + "=");
458
458
  if (r = r || document.location.search, r) {
459
459
  for (var i = r.replace(/^\?/, "").split("&"), o = 0; o < i.length; o++)
460
- if (n.test(i[o]))
460
+ if (a.test(i[o]))
461
461
  return decodeURIComponent(i[o].substring(t.length + 1));
462
462
  }
463
463
  return null;
464
464
  }, e._hash = function(t, r) {
465
465
  if (!e._isString(t))
466
466
  return "0000";
467
- var n, i = [0, 0, 0, 0];
468
- for (n = 0; n < t.length; ++n)
469
- i[n % 4] += t.charCodeAt(n);
467
+ var a, i = [0, 0, 0, 0];
468
+ for (a = 0; a < t.length; ++a)
469
+ i[a % 4] += t.charCodeAt(a);
470
470
  var o = 0;
471
- for (n = 0; n < 4; ++n)
472
- o = (o << 4) + i[n] % 16;
471
+ for (a = 0; a < 4; ++a)
472
+ o = (o << 4) + i[a] % 16;
473
473
  return r && (o = o ^ Math.floor(Math.random() * 65536)), ("0000" + o.toString(16)).slice(-4);
474
474
  }, e._triggerCustomEvent = function(t, r) {
475
475
  try {
476
- var n;
476
+ var a;
477
477
  if (window.CustomEvent && typeof window.CustomEvent == "function")
478
- n = new CustomEvent(t, { detail: r }), document.dispatchEvent(n);
478
+ a = new CustomEvent(t, { detail: r }), document.dispatchEvent(a);
479
479
  else if (document.createEvent)
480
- n = document.createEvent("CustomEvent"), n.initCustomEvent(t, !0, !0, r), document.dispatchEvent(n);
480
+ a = document.createEvent("CustomEvent"), a.initCustomEvent(t, !0, !0, r), document.dispatchEvent(a);
481
481
  else if (document.createEventObject && document.fireEvent)
482
- n = document.createEventObject(), n.detail = r, document.fireEvent("onpropertychange", n);
482
+ a = document.createEventObject(), a.detail = r, document.fireEvent("onpropertychange", a);
483
483
  else
484
484
  throw new Error("Cannot instantiate event for " + t);
485
485
  e._log("Event dispatched: " + t);
@@ -488,11 +488,11 @@ function ve(a = []) {
488
488
  }
489
489
  }, e._loadWebVitals = function() {
490
490
  return {
491
- onCLS: me,
491
+ onCLS: he,
492
492
  onINP: ye,
493
493
  onLCP: Ee,
494
- onFCP: $,
495
- onTTFB: Pe
494
+ onFCP: Z,
495
+ onTTFB: ve
496
496
  };
497
497
  }, e.Transport = function(t) {
498
498
  if (e._isArray(t))
@@ -519,8 +519,8 @@ function ve(a = []) {
519
519
  !e._isString(t) || t.length === 0 || this._targetUrls.forEach(function(r) {
520
520
  try {
521
521
  window.navigator.sendBeacon(r, e._POST_RAW_REQUEST_PARAMETER + t);
522
- } catch (n) {
523
- e._log("Error in sending data: " + n.toString());
522
+ } catch (a) {
523
+ e._log("Error in sending data: " + a.toString());
524
524
  }
525
525
  });
526
526
  }, e.XHRTransport = function(t) {
@@ -528,8 +528,8 @@ function ve(a = []) {
528
528
  }, Object.setPrototypeOf(e.XHRTransport.prototype, e.Transport.prototype), e.XHRTransport.prototype._getXHRProvider = function() {
529
529
  return window.XMLHttpRequest ? (e._log("Using W3C XMLHttpRequest"), new XMLHttpRequest()) : (e._log("No XMLHttpRequest providers found!"), null);
530
530
  }, e.XHRTransport.prototype.send = function(t, r) {
531
- var n = this, i = n._getXHRProvider();
532
- i ? n._targetUrls.forEach(function(o) {
531
+ var a = this, i = a._getXHRProvider();
532
+ i ? a._targetUrls.forEach(function(o) {
533
533
  r === "POST" ? (i.open("POST", o, !0), i.withCredentials = !0, i.send(e._POST_RAW_REQUEST_PARAMETER + t), e._log("Upload performed successfully")) : r === "GET" ? (i.open("GET", o + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t), !0), i.withCredentials = !0, i.send("")) : e._log("Invalid XMLHttpRequest method");
534
534
  }) : e._log("No XMLHttpRequest support, removing data");
535
535
  }, e.ParametersContainer = function(t) {
@@ -539,12 +539,12 @@ function ve(a = []) {
539
539
  }, e.ParametersContainer.prototype._isValid = function(t) {
540
540
  return t == null ? !1 : e._isString(t) ? e._trimString(t) !== "" : typeof t == "number" ? !isNaN(t) && isFinite(t) : !0;
541
541
  }, e.ParametersContainer.prototype.insert = function(t, r) {
542
- var n = e._trimString(t);
543
- if (n === null || n === "") {
542
+ var a = e._trimString(t);
543
+ if (a === null || a === "") {
544
544
  e._log("Empty key!");
545
545
  return;
546
546
  }
547
- n in this._parameters && e._log("Overwriting " + n), this._isValid(r) ? this._parameters[n] = typeof r == "string" ? e._trimString(r) : r : e._log("Invalid value for " + n);
547
+ a in this._parameters && e._log("Overwriting " + a), this._isValid(r) ? this._parameters[a] = typeof r == "string" ? e._trimString(r) : r : e._log("Invalid value for " + a);
548
548
  }, e.ParametersContainer.prototype.remove = function(t) {
549
549
  var r = e._trimString(t);
550
550
  if (r === null || r === "") {
@@ -557,8 +557,8 @@ function ve(a = []) {
557
557
  e._log("Invalid object type");
558
558
  return;
559
559
  }
560
- for (var n in t)
561
- this.insert(n, t[n]), r && (this._noMergeParameters[n] = !0);
560
+ for (var a in t)
561
+ this.insert(a, t[a]), r && (this._noMergeParameters[a] = !0);
562
562
  }, e.ParametersContainer.prototype.mergeParameters = function(t) {
563
563
  if (!e._isObject(t)) {
564
564
  e._log("Invalid object type");
@@ -568,8 +568,8 @@ function ve(a = []) {
568
568
  if (!this.hasKey(r) || this._noMergeParameters[r])
569
569
  this.insert(r, t[r]);
570
570
  else {
571
- var n = this.get(r);
572
- e._isArray(n) && e._isArray(t[r]) ? this.insert(r, n.concat(t[r])) : e._isObject(n) && e._isObject(t[r]) ? e._mergeDictionaries(n, t[r]) : this.insert(r, t[r]);
571
+ var a = this.get(r);
572
+ e._isArray(a) && e._isArray(t[r]) ? this.insert(r, a.concat(t[r])) : e._isObject(a) && e._isObject(t[r]) ? e._mergeDictionaries(a, t[r]) : this.insert(r, t[r]);
573
573
  }
574
574
  }, e.ParametersContainer.prototype.serialize = function() {
575
575
  return JSON.stringify(this._parameters);
@@ -599,8 +599,8 @@ function ve(a = []) {
599
599
  if (r.length > 1e3)
600
600
  return !1;
601
601
  e._setCookie(this._marker + t, encodeURIComponent(String(r)), 365);
602
- var n = e._getCookie(this._marker + t);
603
- return n !== null && decodeURIComponent(n) === r;
602
+ var a = e._getCookie(this._marker + t);
603
+ return a !== null && decodeURIComponent(a) === r;
604
604
  }, e.CookieStorage.prototype.getForKey = function(t) {
605
605
  var r = e._getCookie(this._marker + t);
606
606
  return r == null ? null : decodeURIComponent(r);
@@ -609,9 +609,9 @@ function ve(a = []) {
609
609
  }, e.CookieStorage.prototype.clear = function() {
610
610
  var t = document.cookie && document.cookie.split(";"), r;
611
611
  for (r = 0; r < t.length; r++) {
612
- var n = t[r].indexOf("=");
613
- if (n > 0) {
614
- var i = e._trimString(t[r].substr(0, n)) || "";
612
+ var a = t[r].indexOf("=");
613
+ if (a > 0) {
614
+ var i = e._trimString(t[r].substr(0, a)) || "";
615
615
  i.indexOf(this._marker) === 0 && this.removeKey(i.substring(this._marker.length));
616
616
  }
617
617
  }
@@ -622,8 +622,8 @@ function ve(a = []) {
622
622
  }, e.LocalStorage.prototype.setForKey = function(t, r) {
623
623
  try {
624
624
  return window.localStorage.setItem(this._marker + t, r), !0;
625
- } catch (n) {
626
- e._log("Could not write to local storage: " + n.toString());
625
+ } catch (a) {
626
+ e._log("Could not write to local storage: " + a.toString());
627
627
  }
628
628
  return !1;
629
629
  }, e.LocalStorage.prototype.getForKey = function(t) {
@@ -662,34 +662,34 @@ function ve(a = []) {
662
662
  this._container = {};
663
663
  }, e.RamStorage.prototype.hasKey = function(t) {
664
664
  return t in this._container;
665
- }, e.Library = function(t, r, n) {
665
+ }, e.Library = function(t, r, a) {
666
666
  this._startTime = /* @__PURE__ */ new Date();
667
667
  var i = e._trimString(t);
668
668
  if (!i)
669
669
  throw "Missing URL!";
670
- this._targetUrls = [i], this._tabName = void 0, this._pageId = void 0, this._pageViewId = "pv", this._sessionCookieName = "Rp", this._persistentCookieName = "Rz", this._isOnline = navigator && "onLine" in navigator ? navigator.onLine : !0, this._parameters = new e.ParametersContainer(), this._storage = this._getStorageProvider(), this._currentLocation = null, this._reportingInterval = e._DEFAULT_ANALYTICS_INTERVAL, this._storageKey = r || e._OFFLINE_STORAGE_KEY, this._vacuumCallback = n || function(y) {
670
+ this._targetUrls = [i], this._tabName = void 0, this._pageId = void 0, this._pageViewId = "pv", this._sessionCookieName = "Rp", this._persistentCookieName = "Rz", this._isOnline = navigator && "onLine" in navigator ? navigator.onLine : !0, this._parameters = new e.ParametersContainer(), this._storage = this._getStorageProvider(), this._currentLocation = null, this._reportingInterval = e._DEFAULT_ANALYTICS_INTERVAL, this._storageKey = r || e._OFFLINE_STORAGE_KEY, this._vacuumCallback = a || function(E) {
671
671
  return !0;
672
672
  }, this._allowXHR = !0, this._eventQueue = [], this._requestCount = 0;
673
673
  var o = this;
674
674
  window.addEventListener ? (window.addEventListener("online", o._callbackBinder(this._onlineListener, o, [o]), !1), window.addEventListener("offline", o._callbackBinder(this._onlineListener, o, [o]), !1)) : document.body && (document.body.ononline = o._callbackBinder(this._onlineListener, o, [o]), document.body.onoffline = o._callbackBinder(this._onlineListener, o, [o]));
675
675
  var c = e._getQueryParam(e._DEFAULT_ANALYTICS_COOKIE) || e._getCookie(e._DEFAULT_ANALYTICS_COOKIE) || "";
676
676
  /^([0-9]+\|[0-9a-f-]+|amp\-[0-9a-zA-Z\_\-]+)+$/.test(c) || (c = [(/* @__PURE__ */ new Date()).getTime(), e._createUUID()].join("|"));
677
- for (var u, l = (document.location.hostname || "").split("."), h = 2; h <= 3 && !u; h++) {
678
- var m = l.slice(-h).join(".");
679
- e._testCookieSupport(m) && (u = m);
677
+ for (var u, l = (document.location.hostname || "").split("."), m = 2; m <= 3 && !u; m++) {
678
+ var h = l.slice(-m).join(".");
679
+ e._testCookieSupport(h) && (u = h);
680
680
  }
681
681
  if (e._setCookie(e._DEFAULT_ANALYTICS_COOKIE, c, e._DEFAULT_COOKIE_DURATION_DAYS, u), e._triggerCustomEvent("RA_PUBLISH", null), window === window.parent) {
682
682
  "webVitals" in window && typeof window.webVitals.onFCP == "function" && typeof window.webVitals.onLCP == "function" && typeof window.webVitals.onINP == "function" && typeof window.webVitals.onCLS == "function" && typeof window.webVitals.onTTFB == "function" ? (e._WEB_VITALS = window.webVitals, e._WEB_VITALS_SCRIPT_VERSION = "*.*.*") : e._WEB_VITALS = e._loadWebVitals();
683
683
  try {
684
684
  e.Library.prototype.webVitals.initialize(this);
685
- } catch (y) {
685
+ } catch (E) {
686
686
  e._log(`Web-Vitals: Failed to initialize WebVitals API
687
- ` + y.message);
687
+ ` + E.message);
688
688
  }
689
689
  }
690
690
  }, e.Library.prototype._getMaxQueryStringSize = function() {
691
- var t = this._targetUrls.reduce(function(r, n) {
692
- return Math.max(n.length, r);
691
+ var t = this._targetUrls.reduce(function(r, a) {
692
+ return Math.max(a.length, r);
693
693
  }, 0);
694
694
  return 2048 - (t + e._GET_RAW_REQUEST_PARAMETER.length);
695
695
  }, e.Library.prototype.setMainReceiver = function(t) {
@@ -713,18 +713,18 @@ function ve(a = []) {
713
713
  }, e.Library.prototype._normalizeScheme = function(t) {
714
714
  var r = t.match(/^(?:https?:)?(?:\/\/)?(.*)$/);
715
715
  return "https://" + r[1];
716
- }, e.Library.prototype._callbackBinder = function(t, r, n) {
716
+ }, e.Library.prototype._callbackBinder = function(t, r, a) {
717
717
  var i = t;
718
718
  return function() {
719
- var o = n || arguments;
720
- return o = Array.prototype.slice.call(arguments[0] ? arguments : [window.event], 0), o = o.concat(n), i.apply(r || window, o);
719
+ var o = a || arguments;
720
+ return o = Array.prototype.slice.call(arguments[0] ? arguments : [window.event], 0), o = o.concat(a), i.apply(r || window, o);
721
721
  };
722
722
  }, e.Library.prototype._vacuum = function(t) {
723
723
  if (!this._vacuumCallback || !e._isArray(t) || t.length === 0)
724
724
  return null;
725
- var r = [], n;
726
- for (n = 0; n < t.length; n++) {
727
- var i = t[n];
725
+ var r = [], a;
726
+ for (a = 0; a < t.length; a++) {
727
+ var i = t[a];
728
728
  this._vacuumCallback(JSON.parse(i)) && r.push(i);
729
729
  }
730
730
  return r;
@@ -734,8 +734,8 @@ function ve(a = []) {
734
734
  return !1;
735
735
  var t = "ral_localstorage_test", r = "ral_localstorage_test_item";
736
736
  window.localStorage.setItem(t, r);
737
- var n = window.localStorage.getItem(t) === r;
738
- return window.localStorage.removeItem(t), n;
737
+ var a = window.localStorage.getItem(t) === r;
738
+ return window.localStorage.removeItem(t), a;
739
739
  } catch {
740
740
  return !1;
741
741
  }
@@ -816,8 +816,8 @@ function ve(a = []) {
816
816
  }, e.Library.prototype.setRequestResult = function(t) {
817
817
  this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.REQUEST_RESULT, t);
818
818
  }, e.Library.prototype._formatTimestamp = function(t) {
819
- var r = t.getMonth() + 1, n = t.getDate(), i = t.getHours(), o = t.getMinutes(), c = t.getSeconds();
820
- return t.getFullYear() + "-" + (r < 10 ? "0" : "") + r + "-" + (n < 10 ? "0" : "") + n + " " + (i < 10 ? "0" : "") + i + ":" + (o < 10 ? "0" : "") + o + ":" + (c < 10 ? "0" : "") + c;
819
+ var r = t.getMonth() + 1, a = t.getDate(), i = t.getHours(), o = t.getMinutes(), c = t.getSeconds();
820
+ return t.getFullYear() + "-" + (r < 10 ? "0" : "") + r + "-" + (a < 10 ? "0" : "") + a + " " + (i < 10 ? "0" : "") + i + ":" + (o < 10 ? "0" : "") + o + ":" + (c < 10 ? "0" : "") + c;
821
821
  }, e.Library.prototype.setPageName = function(t) {
822
822
  this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.PAGE_NAME, t);
823
823
  }, e.Library.prototype.setPageType = function(t) {
@@ -828,8 +828,8 @@ function ve(a = []) {
828
828
  if (t) {
829
829
  var r = t;
830
830
  if (this._parameters.hasKey(e.ParameterTypes.CUSTOM)) {
831
- var n = this._parameters.get(e.ParameterTypes.CUSTOM);
832
- e._mergeDictionaries(n, t) && (r = n);
831
+ var a = this._parameters.get(e.ParameterTypes.CUSTOM);
832
+ e._mergeDictionaries(a, t) && (r = a);
833
833
  }
834
834
  this._parameters.insert(e.ParameterTypes.CUSTOM, r);
835
835
  }
@@ -844,23 +844,23 @@ function ve(a = []) {
844
844
  }
845
845
  for (var r in t)
846
846
  if (this._parameters.hasKey(r)) {
847
- var n = this._parameters.get(r);
848
- typeof n != "object" && (n = []), this._parameters.insert(r, [].concat(n).concat(t[r]));
847
+ var a = this._parameters.get(r);
848
+ typeof a != "object" && (a = []), this._parameters.insert(r, [].concat(a).concat(t[r]));
849
849
  } else
850
850
  typeof t[r] == "object" ? this._parameters.insert(r, t[r]) : this._parameters.insert(r, [t[r]]);
851
851
  }, e.Library.prototype.setOptions = function(t) {
852
852
  if (e._isArray(t)) {
853
- for (var r = {}, n = 0, i = t.length; n < i; ++n)
854
- r[t[n]] = !0;
853
+ for (var r = {}, a = 0, i = t.length; a < i; ++a)
854
+ r[t[a]] = !0;
855
855
  this._setAutoParameters(r);
856
856
  }
857
857
  }, e.Library.prototype._isRequestInternal = function() {
858
858
  return window.navigator.userAgent !== void 0 && window.navigator.userAgent.search(/RAL/i) !== -1;
859
859
  }, e.Library.prototype.detectFlashVersion = function() {
860
860
  if (document.images) {
861
- var t = null, r = !1, n = "application/x-shockwave-flash";
862
- if (navigator.mimeTypes && navigator.mimeTypes[n]) {
863
- var i = navigator.mimeTypes[n];
861
+ var t = null, r = !1, a = "application/x-shockwave-flash";
862
+ if (navigator.mimeTypes && navigator.mimeTypes[a]) {
863
+ var i = navigator.mimeTypes[a];
864
864
  i.enabledPlugin && i.enabledPlugin.description && (t = i.enabledPlugin.description, r = !0);
865
865
  } else if (navigator.plugins && "Shockwave Flash" in navigator.plugins) {
866
866
  var o = navigator.plugins["Shockwave Flash"];
@@ -910,8 +910,8 @@ function ve(a = []) {
910
910
  if (t = r.toString(16) + (r * 17 & 65535).toString(16), window.sessionStorage)
911
911
  try {
912
912
  window.sessionStorage.setItem(e._KEY_PREFIX_MARKER + e._TAB_ID_KEY, t);
913
- } catch (n) {
914
- e._log("Could not write to session storage: " + n.toString()), this._tabName = t;
913
+ } catch (a) {
914
+ e._log("Could not write to session storage: " + a.toString()), this._tabName = t;
915
915
  }
916
916
  else
917
917
  this._tabName = t;
@@ -920,8 +920,8 @@ function ve(a = []) {
920
920
  }, e.Library.prototype._getPageId = function() {
921
921
  var t = this._pageId;
922
922
  if (!t) {
923
- var r = e._hash(document.location.href, !0), n = e._hash(document.referrer, !0), i = e._hash(navigator.userAgent, !0), o = e._hash((/* @__PURE__ */ new Date()).getTime().toString(), !0);
924
- t = r + n + i + o, this._pageId = t;
923
+ var r = e._hash(document.location.href, !0), a = e._hash(document.referrer, !0), i = e._hash(navigator.userAgent, !0), o = e._hash((/* @__PURE__ */ new Date()).getTime().toString(), !0);
924
+ t = r + a + i + o, this._pageId = t;
925
925
  }
926
926
  return t;
927
927
  }, e.Library.prototype.resetPageId = function() {
@@ -956,10 +956,10 @@ function ve(a = []) {
956
956
  }
957
957
  }, e.Library.prototype._getBrowserTimings = function() {
958
958
  if ("performance" in window) {
959
- var t, r, n = !1;
959
+ var t, r, a = !1;
960
960
  if (window.performance.getEntriesByType("navigation")) {
961
961
  var i = window.performance.getEntriesByType("navigation").length;
962
- t = window.performance.getEntriesByType("navigation")[i - 1], n = !0;
962
+ t = window.performance.getEntriesByType("navigation")[i - 1], a = !0;
963
963
  }
964
964
  if (window.performance.timing && (r = window.performance.timing), !(window.performance.timing || window.performance.getEntriesByType("navigation")))
965
965
  return;
@@ -975,7 +975,7 @@ function ve(a = []) {
975
975
  c = !0;
976
976
  }
977
977
  try {
978
- o[e.ParameterTypes.TOTAL_PAGE_LOAD_TIME] = n ? this._getTotalPageLoadTime(t, n) : this._getTotalPageLoadTime(r, n);
978
+ o[e.ParameterTypes.TOTAL_PAGE_LOAD_TIME] = a ? this._getTotalPageLoadTime(t, a) : this._getTotalPageLoadTime(r, a);
979
979
  } catch {
980
980
  c = !0;
981
981
  }
@@ -1015,8 +1015,8 @@ function ve(a = []) {
1015
1015
  }, e.Library.prototype._getFingerPrint = function() {
1016
1016
  var t, r = e._KEY_PREFIX_MARKER + e._FPRINT_KEY;
1017
1017
  if (window.sessionStorage && (t = window.sessionStorage.getItem(r), !t)) {
1018
- var n = document.createElement("script");
1019
- n.type = "text/javascript", n.src = "//a.ichiba.jp.rakuten-static.com/com/rat/js/common/fingerprint2.min.js", n.onload = function() {
1018
+ var a = document.createElement("script");
1019
+ a.type = "text/javascript", a.src = "//a.ichiba.jp.rakuten-static.com/com/rat/js/common/fingerprint2.min.js", a.onload = function() {
1020
1020
  try {
1021
1021
  new Fingerprint2().get(function(o) {
1022
1022
  try {
@@ -1030,7 +1030,7 @@ function ve(a = []) {
1030
1030
  }
1031
1031
  };
1032
1032
  var i = document.getElementsByTagName("script")[0];
1033
- i.parentNode.insertBefore(n, i);
1033
+ i.parentNode.insertBefore(a, i);
1034
1034
  }
1035
1035
  return t;
1036
1036
  }, e.Library.prototype.webVitals = {
@@ -1038,13 +1038,13 @@ function ve(a = []) {
1038
1038
  _cache: {},
1039
1039
  _isSendPerf: !1,
1040
1040
  _sentMetrics: [],
1041
- sendPerfListener: function(t, r, n) {
1041
+ sendPerfListener: function(t, r, a) {
1042
1042
  var i = this;
1043
- i._isSendPerf && i.sendWebVitalsPerf(t, r, n);
1043
+ i._isSendPerf && i.sendWebVitalsPerf(t, r, a);
1044
1044
  },
1045
1045
  initialize: function(t) {
1046
1046
  if (!(!e._WEB_VITALS || this._initialized) && "sendBeacon" in window.navigator) {
1047
- var r = new e.SendBeaconTransport(t._targetUrls), n = t._getBrowserTimings.bind(t), i = t._parameters, o = this, c = o._cache, u = document.getElementById("ratAccountId"), l = document.getElementById("ratServiceId");
1047
+ var r = new e.SendBeaconTransport(t._targetUrls), a = t._getBrowserTimings.bind(t), i = t._parameters, o = this, c = o._cache, u = document.getElementById("ratAccountId"), l = document.getElementById("ratServiceId");
1048
1048
  this._isSendPerf = Math.random() < e._WEB_VITALS_SAMPLING_RATIO, u ? c.acc = u.getAttribute("value") : e._log("webVitals.initialize: ratAccountId input tag not found"), l && (c.aid = l.getAttribute("value")), c.SCRIPT_VER = e._WEB_VITALS_SCRIPT_VERSION, c.UID = e._createUUID(), Object.defineProperties(o, {
1049
1049
  FCP: {
1050
1050
  get: function() {
@@ -1103,25 +1103,25 @@ function ve(a = []) {
1103
1103
  }
1104
1104
  }
1105
1105
  });
1106
- var h = e._WEB_VITALS.onFCP;
1106
+ var m = e._WEB_VITALS.onFCP;
1107
+ m(function(p) {
1108
+ o._cache.FCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
1109
+ });
1110
+ var h = e._WEB_VITALS.onLCP;
1107
1111
  h(function(p) {
1108
- o._cache.FCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
1112
+ o._cache.LCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
1109
1113
  });
1110
- var m = e._WEB_VITALS.onLCP;
1111
- m(function(p) {
1112
- o._cache.LCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
1114
+ var E = e._WEB_VITALS.onCLS;
1115
+ E(function(p) {
1116
+ o._cache.CLS = p.value.toFixed(3), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
1113
1117
  });
1114
- var y = e._WEB_VITALS.onCLS;
1118
+ var y = e._WEB_VITALS.onTTFB;
1115
1119
  y(function(p) {
1116
- o._cache.CLS = p.value.toFixed(3), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
1120
+ o._cache.TTFB = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
1117
1121
  });
1118
- var f = e._WEB_VITALS.onTTFB;
1119
- f(function(p) {
1120
- o._cache.TTFB = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
1121
- });
1122
- var I = e._WEB_VITALS.onINP;
1123
- I(function(p) {
1124
- o._cache.INP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
1122
+ var A = e._WEB_VITALS.onINP;
1123
+ A(function(p) {
1124
+ o._cache.INP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
1125
1125
  }), o._initialized = !0;
1126
1126
  }
1127
1127
  },
@@ -1134,12 +1134,12 @@ function ve(a = []) {
1134
1134
  * @param {Object} transport used to send events (SendBeaconTransport instance)
1135
1135
  * @private
1136
1136
  */
1137
- sendWebVitalsPerf: function(t, r, n) {
1137
+ sendWebVitalsPerf: function(t, r, a) {
1138
1138
  var i = this.needsToSendMetric(this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP) && this.needsToSendMetric(this._cache.LCP, e.ParameterTypes.WEB_VITALS_LCP) && this.needsToSendMetric(this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB), o = this.needsToSendMetric(this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS) || this.needsToSendMetric(this._cache.INP, e.ParameterTypes.WEB_VITALS_INP);
1139
1139
  if (!(!i && !o) && this._cache.acc && (this._cache.acc = parseInt(this._cache.acc, 10), !isNaN(parseInt(this._cache.acc, 10)))) {
1140
1140
  this._cache.aid || (this._cache.aid = e._DEFAULT_SERVICE_ID), e.callQueue = e.callQueue || [];
1141
1141
  var c = this.buildPerfData(t, r());
1142
- n.send(JSON.stringify(c)), [
1142
+ a.send(JSON.stringify(c)), [
1143
1143
  e.ParameterTypes.WEB_VITALS_FCP,
1144
1144
  e.ParameterTypes.WEB_VITALS_LCP,
1145
1145
  e.ParameterTypes.WEB_VITALS_CLS,
@@ -1158,7 +1158,7 @@ function ve(a = []) {
1158
1158
  * @private
1159
1159
  */
1160
1160
  buildPerfData: function(t, r) {
1161
- var n = {};
1161
+ var a = {};
1162
1162
  return [
1163
1163
  e.ParameterTypes.URL,
1164
1164
  e.ParameterTypes.USER_AGENT,
@@ -1174,7 +1174,7 @@ function ve(a = []) {
1174
1174
  e.ParameterTypes.SESSION_COOKIE_FLAG,
1175
1175
  e.ParameterTypes.SESSION_COOKIE_2
1176
1176
  ].forEach(function(i) {
1177
- t.hasKey(i) && (n[i] = t.get(i));
1177
+ t.hasKey(i) && (a[i] = t.get(i));
1178
1178
  }), [
1179
1179
  [this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP],
1180
1180
  [this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS],
@@ -1182,15 +1182,15 @@ function ve(a = []) {
1182
1182
  [this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB],
1183
1183
  [this._cache.INP, e.ParameterTypes.WEB_VITALS_INP]
1184
1184
  ].forEach(function(i) {
1185
- this.needsToSendMetric(i[0], i[1]) && (n[i[1]] = i[0]);
1186
- }, this), n[e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION] = e._WEB_VITALS_SCRIPT_VERSION, n[e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER] = this._cache.UID, [
1185
+ this.needsToSendMetric(i[0], i[1]) && (a[i[1]] = i[0]);
1186
+ }, this), a[e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION] = e._WEB_VITALS_SCRIPT_VERSION, a[e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER] = this._cache.UID, [
1187
1187
  e.ParameterTypes.TOTAL_PAGE_LOAD_TIME,
1188
1188
  e.ParameterTypes.ASYNC_TIMING,
1189
1189
  e.ParameterTypes.LOAD_TIMING,
1190
1190
  e.ParameterTypes.REQUEST_TIMING
1191
1191
  ].forEach(function(i) {
1192
- r.hasOwnProperty(i) && (n[i] = r[i]);
1193
- }), n[e.ParameterTypes.EVENT_TYPE] = "perf", n;
1192
+ r.hasOwnProperty(i) && (a[i] = r[i]);
1193
+ }), a[e.ParameterTypes.EVENT_TYPE] = "perf", a;
1194
1194
  },
1195
1195
  /**
1196
1196
  * Checks whether metric needs to be sent.
@@ -1201,8 +1201,8 @@ function ve(a = []) {
1201
1201
  * @private
1202
1202
  */
1203
1203
  needsToSendMetric: function(t, r) {
1204
- var n = t !== void 0, i = this._sentMetrics.indexOf(r) === -1;
1205
- return n && i;
1204
+ var a = t !== void 0, i = this._sentMetrics.indexOf(r) === -1;
1205
+ return a && i;
1206
1206
  }
1207
1207
  }, e.Library.prototype._setAutoParameters = function(t) {
1208
1208
  (!t || t[e.ParameterTypes.SCRIPT_START_TIME]) && this._parameters.insert(e.ParameterTypes.SCRIPT_START_TIME, this._formatTimestamp(this._startTime)), (!t || t[e.ParameterTypes.URL]) && (this._parameters.hasKey(e.ParameterTypes.URL) || this._parameters.insert(e.ParameterTypes.URL, this._getURL())), (!t || t[e.ParameterTypes.REFERRER]) && (this._parameters.hasKey(e.ParameterTypes.REFERRER) || this._parameters.insert(e.ParameterTypes.REFERRER, this._getReferrer())), (!t || t[e.ParameterTypes.TAB_ID]) && this._parameters.insert(e.ParameterTypes.TAB_ID, this._getTabName()), (!t || t[e.ParameterTypes.TIMEZONE]) && this._parameters.insert(e.ParameterTypes.TIMEZONE, this._getTimezone()), (!t || t[e.ParameterTypes.RESOLUTION]) && this._parameters.insert(e.ParameterTypes.RESOLUTION, this._getScreenResolution()), (!t || t[e.ParameterTypes.JAVA_PRESENT]) && this._parameters.insert(e.ParameterTypes.JAVA_PRESENT, this._isJavaEnabled()), (!t || t[e.ParameterTypes.BROWSER_LANGUAGE]) && this._parameters.insert(e.ParameterTypes.BROWSER_LANGUAGE, this._getBrowserLanguage()), (!t || t[e.ParameterTypes.USER_AGENT]) && (this._parameters.hasKey(e.ParameterTypes.USER_AGENT) || this._parameters.insert(e.ParameterTypes.USER_AGENT, this._getUserAgent())), (!t || t[e.ParameterTypes.ONLINE_STATUS]) && this._parameters.insert(e.ParameterTypes.ONLINE_STATUS, this._isOnline), (!t || t[e.ParameterTypes.VERSION]) && this._parameters.insert(e.ParameterTypes.VERSION, e._sdkVersion), (!t || t[e.ParameterTypes.SDK_SOURCE]) && this._parameters.insert(e.ParameterTypes.SDK_SOURCE, e._sdkSource), (!t || t[e.ParameterTypes.LOCATION]) && (this._currentLocation === null ? this._parameters.remove(e.ParameterTypes.LOCATION) : this._parameters.insert(e.ParameterTypes.LOCATION, this._currentLocation)), (!t || t.perf) && this._parameters.mergeParameters(this._getBrowserTimings()), (!t || t[e.ParameterTypes.NAV_TYPE]) && this._parameters.insert(e.ParameterTypes.NAV_TYPE, this._getNavigationType()), (!t || t[e.ParameterTypes.IFRAME_STATUS]) && this._parameters.insert(e.ParameterTypes.IFRAME_STATUS, this._isFrame()), (!t || t[e.ParameterTypes.UACH_ARCHITECTURE]) && (this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture())), (!t || t[e.ParameterTypes.UACH_BITNESS]) && (this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness())), (!t || t[e.ParameterTypes.UACH_FULL_VERSION_LIST]) && (this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList())), (!t || t[e.ParameterTypes.UACH_MODEL]) && (this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel())), (!t || t[e.ParameterTypes.UACH_PLATFORM_VERSION]) && (this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion())), (!t || t[e.ParameterTypes.UACH_WOW64]) && (this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64())), t && t[e.ParameterTypes.WEB_VITALS_LCP] && this._parameters.insert(
@@ -1241,8 +1241,8 @@ function ve(a = []) {
1241
1241
  e._log("Using img transport");
1242
1242
  try {
1243
1243
  for (var r = 0; r < this._targetUrls.length; ++r) {
1244
- var n = document.createElement("img");
1245
- n.src = this._targetUrls[r] + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t) + "&t=" + (/* @__PURE__ */ new Date()).getTime();
1244
+ var a = document.createElement("img");
1245
+ a.src = this._targetUrls[r] + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t) + "&t=" + (/* @__PURE__ */ new Date()).getTime();
1246
1246
  }
1247
1247
  } catch (i) {
1248
1248
  return e._log("Single item upload failed: " + i.toString()), !1;
@@ -1254,8 +1254,8 @@ function ve(a = []) {
1254
1254
  return !0;
1255
1255
  var r = t.length === 1 ? t[0] : "[" + t.join(",") + "]";
1256
1256
  e._activeTransport.send(r, "POST");
1257
- } catch (n) {
1258
- return e._log("Bulk upload failed: " + n.toString()), !1;
1257
+ } catch (a) {
1258
+ return e._log("Bulk upload failed: " + a.toString()), !1;
1259
1259
  }
1260
1260
  return !0;
1261
1261
  }, e.Library.prototype._sendRecords = function(t) {
@@ -1264,7 +1264,7 @@ function ve(a = []) {
1264
1264
  var r = !0;
1265
1265
  return t.length === 1 ? encodeURIComponent(t[0]).length < this._getMaxQueryStringSize() ? r = !this._allowXHR && e._transportMethod !== "beacon" ? this._sendSingleRecordImg(t[0]) : this._sendSingleRecord(t[0]) : (e._log("Record too big to send via GET (" + encodeURIComponent(t[0]).length + " characters vs. " + this._getMaxQueryStringSize() + " characters max)"), r = this._sendMultipleRecords(t)) : (this._allowXHR || e._transportMethod === "beacon" ? r = this._sendMultipleRecords(t) : r = !1, r && e._log("All items successfully sent")), r;
1266
1266
  }, e.Library.prototype._spoolData = function(t, r) {
1267
- var n = null;
1267
+ var a = null;
1268
1268
  if (t.hasKey(e.ParameterTypes.ACCOUNT_ID)) {
1269
1269
  var i;
1270
1270
  if (/\bsplash\b/i.test(navigator.userAgent) ? i = "splash_agent" : i = this._getSessionCookie(), t.insert(e.ParameterTypes.SESSION_COOKIE, i), /\bra_uid\b/.test(document.cookie)) {
@@ -1279,39 +1279,39 @@ function ve(a = []) {
1279
1279
  l && t.insert(e.ParameterTypes.AD_COOKIE, l);
1280
1280
  }
1281
1281
  }
1282
- var h = e._getCookie(e._DEFAULT_ANALYTICS_COOKIE);
1283
- t.insert(e.ParameterTypes.ANALYTICS_COOKIE, h), t.hasKey(e.ParameterTypes.SESSION_COOKIE) ? (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !0), t.insert(e.ParameterTypes.SESSION_COOKIE_2, t.get(e.ParameterTypes.SESSION_COOKIE))) : (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !1), t.insert(e.ParameterTypes.SESSION_COOKIE_2, h)), t.insert(e.ParameterTypes.PERSISTENT_COOKIE, this._getPersistentCookie()), this._setCookies(t, ["Rg", "Rt", "BTA001"]), n = t.serialize();
1284
- var m = this._getOfflineEvents();
1285
- m.length >= e._RECORDS_LIMIT_COUNT && (e._log("Too many records, vacuuming"), m = this._vacuum(m) || m), n.length + m.join().length > e._RECORDS_LIMIT_TOTAL_SIZE && (e._log("Data block too large, vacuuming"), m = this._vacuum(m) || m);
1286
- var y = this._addOfflineEvent(n);
1287
- if (y) {
1288
- if (n = null, r)
1282
+ var m = e._getCookie(e._DEFAULT_ANALYTICS_COOKIE);
1283
+ t.insert(e.ParameterTypes.ANALYTICS_COOKIE, m), t.hasKey(e.ParameterTypes.SESSION_COOKIE) ? (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !0), t.insert(e.ParameterTypes.SESSION_COOKIE_2, t.get(e.ParameterTypes.SESSION_COOKIE))) : (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !1), t.insert(e.ParameterTypes.SESSION_COOKIE_2, m)), t.insert(e.ParameterTypes.PERSISTENT_COOKIE, this._getPersistentCookie()), this._setCookies(t, ["Rg", "Rt", "BTA001"]), a = t.serialize();
1284
+ var h = this._getOfflineEvents();
1285
+ h.length >= e._RECORDS_LIMIT_COUNT && (e._log("Too many records, vacuuming"), h = this._vacuum(h) || h), a.length + h.join().length > e._RECORDS_LIMIT_TOTAL_SIZE && (e._log("Data block too large, vacuuming"), h = this._vacuum(h) || h);
1286
+ var E = this._addOfflineEvent(a);
1287
+ if (E) {
1288
+ if (a = null, r)
1289
1289
  return;
1290
1290
  } else
1291
1291
  e._log("Unable to save data to offline storage");
1292
1292
  }
1293
1293
  if (this._isOnline) {
1294
- var f = this._getOfflineEvents();
1295
- n && f.push(n);
1296
- var I = Math.min(f.length, e._RECORDS_CHUNK_LENGTH);
1297
- I != f.length ? e._log("Too many records to send in one single operation (" + f.length + " vs " + e._RECORDS_CHUNK_LENGTH + " maximum)") : e._log("Record count threshold not crossed, sending all records in one go");
1298
- var p = f.splice(0, I), ie = this._sendRecords(p);
1294
+ var y = this._getOfflineEvents();
1295
+ a && y.push(a);
1296
+ var A = Math.min(y.length, e._RECORDS_CHUNK_LENGTH);
1297
+ A != y.length ? e._log("Too many records to send in one single operation (" + y.length + " vs " + e._RECORDS_CHUNK_LENGTH + " maximum)") : e._log("Record count threshold not crossed, sending all records in one go");
1298
+ var p = y.splice(0, A), ie = this._sendRecords(p);
1299
1299
  if (ie) {
1300
1300
  this._requestCount++;
1301
- for (var U = 0; U < p.length; ++U)
1301
+ for (var w = 0; w < p.length; ++w)
1302
1302
  try {
1303
- e.eventLog.push(JSON.parse(p[U]));
1303
+ e.eventLog.push(JSON.parse(p[w]));
1304
1304
  } catch (oe) {
1305
1305
  e._log("Error while writing to event log: " + oe.toString());
1306
1306
  }
1307
- e._triggerCustomEvent("RAT_REQUEST_DONE", null), this._setOfflineEvents(f) ? e._log("Old data successfully removed") : e._log("Unable to save data to offline storage");
1307
+ e._triggerCustomEvent("RAT_REQUEST_DONE", null), this._setOfflineEvents(y) ? e._log("Old data successfully removed") : e._log("Unable to save data to offline storage");
1308
1308
  } else
1309
1309
  e._log("Data transfer failed!");
1310
1310
  }
1311
1311
  }, e.Library.prototype._setCookies = function(t, r) {
1312
1312
  if (e._isArray(r))
1313
- for (var n, i, o = 0; o < r.length; o++)
1314
- n = r[o], i = e._getCookie(n), i !== null && t.insert(n, decodeURIComponent(i));
1313
+ for (var a, i, o = 0; o < r.length; o++)
1314
+ a = r[o], i = e._getCookie(a), i !== null && t.insert(a, decodeURIComponent(i));
1315
1315
  }, e.Library.prototype._onlineListener = function(t) {
1316
1316
  t = t || window.event, this._isOnline = t.type === "online", e._log("Online status change: " + (this._isOnline ? "Online" : "Offline"));
1317
1317
  }, e.Library.prototype._hasOfflineEvents = function() {
@@ -1332,8 +1332,8 @@ function ve(a = []) {
1332
1332
  }, e.Library.prototype._addOfflineEvent = function(t) {
1333
1333
  var r = !1;
1334
1334
  if (t) {
1335
- var n = this._getOfflineEvents();
1336
- n.push(t), r = this._storage.setForKey(this._storageKey, n.join(" "));
1335
+ var a = this._getOfflineEvents();
1336
+ a.push(t), r = this._storage.setForKey(this._storageKey, a.join(" "));
1337
1337
  }
1338
1338
  return r;
1339
1339
  }, e.Library.prototype._setPosition = function(t) {
@@ -1367,8 +1367,8 @@ function ve(a = []) {
1367
1367
  this._parameters.hasKey(e.ParameterTypes.ACCOUNT_ID) && (this._parameters.insert(e.ParameterTypes.PAGE_ID, this._getPageId()), (!this._parameters.hasKey(e.ParameterTypes.SERVICE_ID) || this._parameters.get(e.ParameterTypes.SERVICE_ID) == null) && this._parameters.insert(e.ParameterTypes.SERVICE_ID, e._DEFAULT_SERVICE_ID), this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture()), this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness()), this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList()), this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel()), this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion()), this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64()), this._eventQueue.push(this._parameters), this._parameters = new e.ParametersContainer());
1368
1368
  }, e.Library.prototype._normalizeEvents = function() {
1369
1369
  this._queueEvent();
1370
- for (var t = 0, r = 1, n, i; r < this._eventQueue.length; )
1371
- n = this._eventQueue[t], i = this._eventQueue[r], n.get(e.ParameterTypes.ACCOUNT_ID) === i.get(e.ParameterTypes.ACCOUNT_ID) && n.get(e.ParameterTypes.SERVICE_ID) === i.get(e.ParameterTypes.SERVICE_ID) && n.get(e.ParameterTypes.EVENT_TYPE) === i.get(e.ParameterTypes.EVENT_TYPE) && n.shouldMergeSeries() ? (n.mergeParameters(i.clone()), this._eventQueue.splice(r, 1)) : (t++, r++);
1370
+ for (var t = 0, r = 1, a, i; r < this._eventQueue.length; )
1371
+ a = this._eventQueue[t], i = this._eventQueue[r], a.get(e.ParameterTypes.ACCOUNT_ID) === i.get(e.ParameterTypes.ACCOUNT_ID) && a.get(e.ParameterTypes.SERVICE_ID) === i.get(e.ParameterTypes.SERVICE_ID) && a.get(e.ParameterTypes.EVENT_TYPE) === i.get(e.ParameterTypes.EVENT_TYPE) && a.shouldMergeSeries() ? (a.mergeParameters(i.clone()), this._eventQueue.splice(r, 1)) : (t++, r++);
1372
1372
  }, e.Library.prototype.processQueue = function(t) {
1373
1373
  var r = this;
1374
1374
  if (!e._isArray(e.callQueue))
@@ -1376,10 +1376,10 @@ function ve(a = []) {
1376
1376
  else {
1377
1377
  e.callQueue.length && e._log(e.callQueue.length + " elements to process in the queue");
1378
1378
  try {
1379
- for (var n; e.callQueue.length > 0; ) {
1380
- n = e.callQueue.shift();
1381
- var i = n[0];
1382
- i in this && this[i].apply(this, n.slice(1));
1379
+ for (var a; e.callQueue.length > 0; ) {
1380
+ a = e.callQueue.shift();
1381
+ var i = a[0];
1382
+ i in this && this[i].apply(this, a.slice(1));
1383
1383
  }
1384
1384
  for (this._normalizeEvents(); this._eventQueue.length > 0; ) {
1385
1385
  var o = this._eventQueue.length == 1;
@@ -1406,12 +1406,12 @@ function ve(a = []) {
1406
1406
  _.processQueue(!1);
1407
1407
  }, e.resetPageId = function() {
1408
1408
  return _.resetPageId();
1409
- }, e.callQueue = a, setTimeout(function() {
1409
+ }, e.callQueue = n, setTimeout(function() {
1410
1410
  _.processQueue(!0);
1411
1411
  }, 1), e.live = !0, e;
1412
1412
  }
1413
- var ae = /* @__PURE__ */ ((a) => (a.XHR = "xhr", a.BEACON = "beacon", a))(ae || {});
1414
- const Je = {
1413
+ var I = /* @__PURE__ */ ((n) => (n.XHR = "xhr", n.BEACON = "beacon", n))(I || {});
1414
+ const $e = {
1415
1415
  /** Japan production endpoint */
1416
1416
  JP: "rat.rakuten.co.jp",
1417
1417
  /** Japan secure production endpoint */
@@ -1433,7 +1433,7 @@ const Je = {
1433
1433
  /** Japan secure testing endpoint */
1434
1434
  CHECK_JP_SEC: "check.secure.rat.rakuten.co.jp"
1435
1435
  };
1436
- var Ie = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Ie || {}), Ce = /* @__PURE__ */ ((a) => (a[a.TEN = 10] = "TEN", a[a.TWENTY = 20] = "TWENTY", a[a.THIRTY = 30] = "THIRTY", a[a.FORTY = 40] = "FORTY", a[a.FIFTY = 50] = "FIFTY", a))(Ce || {}), Ae = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Ae || {}), Le = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Le || {}), Re = /* @__PURE__ */ ((a) => (a[a.V1 = 1] = "V1", a[a.V2 = 2] = "V2", a[a.V3 = 3] = "V3", a[a.V4 = 4] = "V4", a))(Re || {}), Oe = /* @__PURE__ */ ((a) => (a[a.V1 = 1] = "V1", a[a.V2 = 2] = "V2", a))(Oe || {}), Ne = /* @__PURE__ */ ((a) => (a[a.TYPE0 = 0] = "TYPE0", a[a.TYPE1 = 1] = "TYPE1", a[a.TYPE2 = 2] = "TYPE2", a[a.TYPE3 = 3] = "TYPE3", a[a.TYPE255 = 255] = "TYPE255", a))(Ne || {}), be = /* @__PURE__ */ ((a) => (a.OR = "o", a.AND = "a", a.NO = "x", a))(be || {}), Ue = /* @__PURE__ */ ((a) => (a.PC = "PC", a.PC_LOWER = "pc", a.SP = "SP", a.SP_LOWER = "sp", a.TB = "TB", a.TB_LOWER = "tb", a.RESP = "RESP", a.RESP_LOWER = "resp", a))(Ue || {}), we = /* @__PURE__ */ ((a) => (a.TOP = "top", a.SEARCH = "search", a.SHOP_ITEM = "shop_item", a.CART_MODIFY = "cart_modify", a.CART_CHECKOUT = "cart_checkout", a))(we || {}), Ve = /* @__PURE__ */ ((a) => (a[a.V0 = 0] = "V0", a[a.V1 = 1] = "V1", a))(Ve || {}), ke = /* @__PURE__ */ ((a) => (a.NONE = "none", a.OR = "or", a.GENRE = "genre", a.NGRAM = "ngram", a))(ke || {});
1436
+ var Ie = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Ie || {}), Ce = /* @__PURE__ */ ((n) => (n[n.TEN = 10] = "TEN", n[n.TWENTY = 20] = "TWENTY", n[n.THIRTY = 30] = "THIRTY", n[n.FORTY = 40] = "FORTY", n[n.FIFTY = 50] = "FIFTY", n))(Ce || {}), Ae = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Ae || {}), Le = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Le || {}), Re = /* @__PURE__ */ ((n) => (n[n.V_1 = -1] = "V_1", n[n.V1 = 1] = "V1", n[n.V2 = 2] = "V2", n[n.V3 = 3] = "V3", n[n.V4 = 4] = "V4", n[n.V5 = 5] = "V5", n))(Re || {}), Oe = /* @__PURE__ */ ((n) => (n[n.V1 = 1] = "V1", n[n.V2 = 2] = "V2", n))(Oe || {}), Ne = /* @__PURE__ */ ((n) => (n[n.TYPE0 = 0] = "TYPE0", n[n.TYPE1 = 1] = "TYPE1", n[n.TYPE2 = 2] = "TYPE2", n[n.TYPE3 = 3] = "TYPE3", n[n.TYPE255 = 255] = "TYPE255", n))(Ne || {}), be = /* @__PURE__ */ ((n) => (n.OR = "o", n.AND = "a", n.NO = "x", n))(be || {}), Ue = /* @__PURE__ */ ((n) => (n.PC = "PC", n.PC_LOWER = "pc", n.SP = "SP", n.SP_LOWER = "sp", n.TB = "TB", n.TB_LOWER = "tb", n.RESP = "RESP", n.RESP_LOWER = "resp", n))(Ue || {}), we = /* @__PURE__ */ ((n) => (n.TOP = "top", n.SEARCH = "search", n.SHOP_ITEM = "shop_item", n.CART_MODIFY = "cart_modify", n.CART_CHECKOUT = "cart_checkout", n))(we || {}), Ve = /* @__PURE__ */ ((n) => (n[n.V0 = 0] = "V0", n[n.V1 = 1] = "V1", n))(Ve || {}), ke = /* @__PURE__ */ ((n) => (n.NONE = "none", n.OR = "or", n.GENRE = "genre", n.NGRAM = "ngram", n))(ke || {});
1437
1437
  const Me = {
1438
1438
  rpCookie: "Rp",
1439
1439
  rzCookie: "Rz",
@@ -1456,6 +1456,7 @@ const Me = {
1456
1456
  idfaCookie: "cka",
1457
1457
  persistentCookie: "ckp",
1458
1458
  sessionCookie: "cks",
1459
+ sessionCookieV2: "cks2",
1459
1460
  contentLanguage: "cntln",
1460
1461
  componentId: "compid",
1461
1462
  countryCode: "country",
@@ -1489,8 +1490,9 @@ const Me = {
1489
1490
  batteryUsage: "mbat",
1490
1491
  mobileCarrierName: "mcn",
1491
1492
  mobileCarrierNameForDualSim: "mcnd",
1493
+ media: "media",
1494
+ eventName: "event_name",
1492
1495
  mobileNavigationTime: "mnavtime",
1493
- mobileNetworkType: "mnetw",
1494
1496
  mobileDeviceBrandModel: "model",
1495
1497
  mobileOrientation: "mori",
1496
1498
  mobileOs: "mos",
@@ -1517,6 +1519,7 @@ const Me = {
1517
1519
  reservedDate: "resdate",
1518
1520
  reservationId: "reservation_id",
1519
1521
  resultLayout: "reslayout",
1522
+ rgCookie: "Rg",
1520
1523
  searchCondition: "scond",
1521
1524
  searchEntity: "search_entity",
1522
1525
  serviceType: "service",
@@ -1535,20 +1538,43 @@ const Me = {
1535
1538
  siteSection: "ssc",
1536
1539
  tag: "tag",
1537
1540
  targetElement: "target_ele",
1541
+ targetPosition: "target_pos",
1538
1542
  totalPrice: "total_price",
1539
1543
  clientProvidedTimestamp: "ts1",
1540
1544
  userId: "userid",
1541
1545
  variantid: "variantid",
1542
1546
  itemVariation: "variation",
1543
- widowbirdPattern: "wb_pattern"
1547
+ widowbirdPattern: "wb_pattern",
1548
+ userCookieJs: "_ra"
1544
1549
  };
1550
+ class De {
1551
+ constructor(e) {
1552
+ g(this, "lifecycleWindow"), g(this, "lifecycleDocument"), g(this, "handleVisibilityChange", () => {
1553
+ var s, _;
1554
+ (((s = this.lifecycleDocument) == null ? void 0 : s.visibilityState) === "hidden" || (_ = this.lifecycleDocument) != null && _.hidden) && this.flush();
1555
+ }), this.flush = e;
1556
+ }
1557
+ register() {
1558
+ typeof window > "u" || typeof document > "u" || this.lifecycleWindow && this.lifecycleDocument || (this.lifecycleWindow = window, this.lifecycleDocument = document, this.lifecycleWindow.addEventListener("pagehide", this.flush), this.lifecycleDocument.addEventListener(
1559
+ "visibilitychange",
1560
+ this.handleVisibilityChange
1561
+ ));
1562
+ }
1563
+ destroy() {
1564
+ var e, s;
1565
+ (e = this.lifecycleWindow) == null || e.removeEventListener("pagehide", this.flush), (s = this.lifecycleDocument) == null || s.removeEventListener(
1566
+ "visibilitychange",
1567
+ this.handleVisibilityChange
1568
+ ), this.lifecycleWindow = void 0, this.lifecycleDocument = void 0;
1569
+ }
1570
+ }
1545
1571
  class Fe {
1546
1572
  constructor({
1547
1573
  ral: e,
1548
1574
  accountId: s,
1549
1575
  serviceId: _
1550
1576
  }) {
1551
- P(this, "ral"), P(this, "accountId"), P(this, "serviceId"), this.ral = e, this.accountId = s, this.serviceId = _;
1577
+ g(this, "ral"), g(this, "accountId"), g(this, "serviceId"), g(this, "transportMethod", I.BEACON), this.ral = e, this.accountId = s, this.serviceId = _;
1552
1578
  }
1553
1579
  /**
1554
1580
  * Set the main receiver for the RAL instance.
@@ -1563,23 +1589,26 @@ class Fe {
1563
1589
  this.ral.callQueue.push(["setMainReceiver", e]);
1564
1590
  }
1565
1591
  setTransportMethod(e) {
1566
- this.ral.callQueue.push(["setTransportMethod", e]);
1592
+ this.transportMethod = e, this.ral.callQueue.push(["setTransportMethod", e]);
1593
+ }
1594
+ getTransportMethod() {
1595
+ return this.transportMethod;
1567
1596
  }
1568
1597
  setCustomCookies(e) {
1569
1598
  this.ral.callQueue.push(["setCookieNames", JSON.stringify(e)]);
1570
1599
  }
1571
1600
  }
1572
- function De(a) {
1601
+ function Be(n) {
1573
1602
  const e = {};
1574
- for (const s in a)
1575
- if (Object.prototype.hasOwnProperty.call(a, s)) {
1603
+ for (const s in n)
1604
+ if (Object.prototype.hasOwnProperty.call(n, s)) {
1576
1605
  const _ = Me[s];
1577
- _ && (e[_] = a[s]);
1606
+ _ ? e[_] = n[s] : e[s] = n[s];
1578
1607
  }
1579
1608
  return e;
1580
1609
  }
1581
- const Be = () => {
1582
- const a = navigator.userAgent, e = a.toLowerCase();
1610
+ const He = () => {
1611
+ const n = navigator.userAgent, e = n.toLowerCase();
1583
1612
  if (e.search(/ipod|iphone/) > -1)
1584
1613
  return "iPhone";
1585
1614
  if (e.search("ipad") > -1)
@@ -1603,24 +1632,24 @@ const Be = () => {
1603
1632
  return "Symbian";
1604
1633
  if (e.search(/docomo|foma|kddi|softbank|vodafone|j-phone|willcom/) > -1)
1605
1634
  return "Feature phone";
1606
- if (a.search(/Win|Mac/) != -1)
1635
+ if (n.search(/Win|Mac/) != -1)
1607
1636
  return "PC";
1608
1637
  }
1609
1638
  return "Others";
1610
- }, He = "0.6.3";
1611
- class Ke {
1639
+ }, Ke = "0.7.0-rel.0";
1640
+ class We {
1612
1641
  /**
1613
1642
  * Creates a new Tracker instance.
1614
- *
1643
+ *
1615
1644
  * @param options - Configuration options for the tracker
1616
1645
  * @param options.accountId - Your Rakuten Analytics account ID
1617
- * @param options.serviceId - Your Rakuten Analytics service ID
1646
+ * @param options.serviceId - Your Rakuten Analytics service ID
1618
1647
  * @param options.transportMethod - Method for sending data (beacon or xhr)
1619
1648
  * @param options.mainReceiver - The endpoint to send analytics data to
1620
1649
  * @param options.customCookies - Optional custom cookies to include with requests
1621
1650
  * @param options.sdkSource - SDK source identifier (defaults to 'rat-ts')
1622
1651
  * @param options.sdkVersion - SDK version (defaults to rat-ts package version)
1623
- *
1652
+ *
1624
1653
  * @example Basic initialization
1625
1654
  * ```typescript
1626
1655
  * const tracker = new Tracker({
@@ -1631,7 +1660,7 @@ class Ke {
1631
1660
  * customCookies: { 'custom_param': 'value' }
1632
1661
  * });
1633
1662
  * ```
1634
- *
1663
+ *
1635
1664
  * @example With custom SDK identification (for wrapper libraries)
1636
1665
  * ```typescript
1637
1666
  * const tracker = new Tracker({
@@ -1643,23 +1672,26 @@ class Ke {
1643
1672
  * ```
1644
1673
  */
1645
1674
  constructor(e) {
1646
- P(this, "ral"), P(this, "ralConfig"), this.ral = ve();
1647
- const s = e.sdkSource ?? "rat-ts", _ = e.sdkVersion ?? He;
1648
- this.ral.callQueue.push(["setSdkSource", s]), this.ral.callQueue.push(["setSdkVersion", _]), this.ralConfig = new Fe({ ral: this.ral, ...e }), this.ralConfig.setTransportMethod(e.transportMethod ?? ae.BEACON), e.mainReceiver && this.ralConfig.setMainReceiver(e.mainReceiver), e.customCookies && this.ralConfig.setCustomCookies(e.customCookies);
1675
+ g(this, "ral"), g(this, "ralConfig"), g(this, "beaconLifecycle", new De(() => this.processImmediate())), g(this, "plugins", /* @__PURE__ */ new Map()), this.ral = Pe();
1676
+ const s = e.sdkSource ?? "rat-ts", _ = e.sdkVersion ?? Ke;
1677
+ this.ral.callQueue.push(["setSdkSource", s]), this.ral.callQueue.push(["setSdkVersion", _]), this.ralConfig = new Fe({ ral: this.ral, ...e });
1678
+ const t = e.transportMethod ?? I.BEACON;
1679
+ this.ralConfig.setTransportMethod(t), e.mainReceiver && this.ralConfig.setMainReceiver(e.mainReceiver), e.customCookies && this.ralConfig.setCustomCookies(e.customCookies), t === I.BEACON && this.beaconLifecycle.register(), e.plugins && e.plugins.length > 0 && e.plugins.forEach((r) => this.use(r));
1649
1680
  }
1650
1681
  /**
1651
1682
  * Sends a generic analytics event.
1652
- *
1683
+ *
1653
1684
  * This is the base method for sending any type of event. Most users should prefer
1654
1685
  * the more specific methods like `sendPageviewEvent()` or `sendClickEvent()`.
1655
- *
1686
+ *
1656
1687
  * @param event - The event object containing type, parameters, and custom data
1657
- * @param event.type - The type of event ('pv', 'click', 'appear', 'async', 'scroll')
1688
+ * @param event.type - The type of event ('pv', 'click', 'appear', 'async', 'scroll', 'media')
1658
1689
  * @param event.params - Standard analytics parameters
1690
+ * @param event.params.media - Core Phase media parameters for media events
1659
1691
  * @param event.customParams - Custom parameters specific to your implementation
1660
1692
  * @param event.cvEvents - Conversion events for tracking business metrics
1661
1693
  * @param event.autoCollectedParams - Array of auto-collected parameter names to include (e.g., ['url', 'ua', 'ref'])
1662
- *
1694
+ *
1663
1695
  * @example
1664
1696
  * ```typescript
1665
1697
  * tracker.sendEvent({
@@ -1672,26 +1704,31 @@ class Ke {
1672
1704
  * ```
1673
1705
  */
1674
1706
  sendEvent(e) {
1675
- const { type: s, params: _, customParams: t, cvEvents: r, autoCollectedParams: n } = e, { accountId: i, serviceId: o } = this.ralConfig;
1676
- if (this.ral.callQueue.push(["setAccountId", i]), this.ral.callQueue.push(["setServiceId", o]), this.ral.callQueue.push([
1677
- "setParameters",
1678
- { js_ua: navigator.userAgent }
1679
- ]), this.ral.callQueue.push([
1680
- "setParameters",
1681
- { js_devtype: Be() }
1682
- ]), _) {
1683
- const c = De(_);
1684
- this.ral.callQueue.push(["setParameters", c]);
1707
+ const {
1708
+ type: s,
1709
+ params: _,
1710
+ customParams: t,
1711
+ cvEvents: r,
1712
+ autoCollectedParams: a,
1713
+ options: i
1714
+ } = e, o = this.ralConfig.getTransportMethod();
1715
+ i != null && i.transportMethod && (this.ral.processImmediate(), this.ralConfig.setTransportMethod(i.transportMethod), i.transportMethod === I.BEACON && this.beaconLifecycle.register());
1716
+ const { accountId: c, serviceId: u } = this.ralConfig;
1717
+ if (this.ral.callQueue.push(["setAccountId", c]), this.ral.callQueue.push(["setServiceId", u]), this.ral.callQueue.push(["setParameters", { js_ua: navigator.userAgent }]), this.ral.callQueue.push(["setParameters", { js_devtype: He() }]), _) {
1718
+ const l = Be(
1719
+ _
1720
+ );
1721
+ this.ral.callQueue.push(["setParameters", l]);
1685
1722
  }
1686
- t && this.ral.callQueue.push(["setCustomParameters", t]), r && this.ral.callQueue.push(["setParameters", { cv: r }]), n && n.length > 0 && this.ral.callQueue.push(["setOptions", n]), this.ral.callQueue.push(["setEvent", s]);
1723
+ t && this.ral.callQueue.push(["setCustomParameters", t]), r && this.ral.callQueue.push(["setParameters", { cv: r }]), a && a.length > 0 && this.ral.callQueue.push(["setOptions", a]), this.ral.callQueue.push(["setEvent", s]), i != null && i.transportMethod && (this.ral.processImmediate(), this.ralConfig.setTransportMethod(o));
1687
1724
  }
1688
1725
  /**
1689
1726
  * Sends a pageview event to track page visits.
1690
- *
1727
+ *
1691
1728
  * This method should be called when a user views a page on your website.
1692
1729
  * It includes built-in compatibility logic for certain account/service combinations
1693
1730
  * and automatically sets default values for pageName and siteSection if not provided.
1694
- *
1731
+ *
1695
1732
  * @param options - Pageview event parameters
1696
1733
  * @param options.params - Standard analytics parameters for the pageview
1697
1734
  * @param options.params.pageName - Name of the page being viewed
@@ -1699,7 +1736,7 @@ class Ke {
1699
1736
  * @param options.customParams - Custom parameters for additional tracking data
1700
1737
  * @param options.cvEvents - Conversion events to track with this pageview
1701
1738
  * @param options.autoCollectedParams - Array of auto-collected parameter names to include (e.g., ['url', 'ref'])
1702
- *
1739
+ *
1703
1740
  * @example Basic pageview
1704
1741
  * ```typescript
1705
1742
  * tracker.sendPageviewEvent({
@@ -1709,18 +1746,18 @@ class Ke {
1709
1746
  * }
1710
1747
  * });
1711
1748
  * ```
1712
- *
1749
+ *
1713
1750
  * @example Pageview with conversion tracking
1714
1751
  * ```typescript
1715
1752
  * tracker.sendPageviewEvent({
1716
1753
  * params: { pageName: 'checkout-complete' },
1717
- * cvEvents: {
1754
+ * cvEvents: {
1718
1755
  * 'purchase_gms': 3400,
1719
- * 'purchase_order': 1
1756
+ * 'purchase_order': 1
1720
1757
  * }
1721
1758
  * });
1722
1759
  * ```
1723
- *
1760
+ *
1724
1761
  * @example Pageview with auto-collected params
1725
1762
  * ```typescript
1726
1763
  * tracker.sendPageviewEvent({
@@ -1729,30 +1766,43 @@ class Ke {
1729
1766
  * });
1730
1767
  * ```
1731
1768
  */
1732
- sendPageviewEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
1769
+ sendPageviewEvent({
1770
+ params: e,
1771
+ customParams: s,
1772
+ cvEvents: _,
1773
+ autoCollectedParams: t,
1774
+ options: r
1775
+ }) {
1733
1776
  if (e) {
1734
- const { accountId: r, serviceId: n } = this.ralConfig;
1735
- if (!e.pageName && r === 7 && n === 12) {
1736
- let i = location.pathname.replace(".html", "").replace("index", "");
1737
- i == "/" && (i = "top"), e.pageName = i;
1777
+ const { accountId: a, serviceId: i } = this.ralConfig;
1778
+ if (!e.pageName && a === 7 && i === 12) {
1779
+ let o = location.pathname.replace(".html", "").replace("index", "");
1780
+ o == "/" && (o = "top"), e.pageName = o;
1738
1781
  }
1739
1782
  if (!e.pageName || !e.siteSection) {
1740
- const i = (document.location.href || "").match(
1783
+ const o = (document.location.href || "").match(
1741
1784
  /https?:\/\/[^/$#?]+(\/[^$#?]+)?/
1742
1785
  );
1743
- i && (e.pageName || (e.pageName = i[1] || "top"), e.siteSection || (e.siteSection = i[1] && i[1].split("/")[1] ? "/" + i[1].split("/")[1] : "top"));
1786
+ o && (e.pageName || (e.pageName = o[1] || "top"), e.siteSection || (e.siteSection = o[1] && o[1].split("/")[1] ? "/" + o[1].split("/")[1] : "top"));
1744
1787
  }
1745
- r === 1 && n === 1 && document.getElementById("sc_betaInfo") && (e.testTargeting = e.testTargeting || {}, typeof e.testTargeting == "object" && e.testTargeting !== null && (e.testTargeting.ichiba_top = document.getElementById("sc_betaInfo").value));
1788
+ a === 1 && i === 1 && document.getElementById("sc_betaInfo") && (e.testTargeting = e.testTargeting || {}, typeof e.testTargeting == "object" && e.testTargeting !== null && (e.testTargeting.ichiba_top = document.getElementById("sc_betaInfo").value));
1746
1789
  }
1747
- this.sendEvent({ type: "pv", params: e, customParams: s, cvEvents: _, autoCollectedParams: t });
1790
+ this.sendEvent({
1791
+ type: "pv",
1792
+ params: e,
1793
+ customParams: s,
1794
+ cvEvents: _,
1795
+ autoCollectedParams: t,
1796
+ options: r
1797
+ });
1748
1798
  }
1749
1799
  /**
1750
1800
  * Sends a click event to track user interactions.
1751
- *
1801
+ *
1752
1802
  * This method should be called when a user clicks on tracked elements like buttons,
1753
1803
  * links, or other interactive components. By default, it automatically captures
1754
1804
  * URL and user agent information (['url', 'ua']).
1755
- *
1805
+ *
1756
1806
  * @param options - Click event parameters
1757
1807
  * @param options.params - Standard analytics parameters for the click
1758
1808
  * @param options.params.pageType - Type of page where the click occurred
@@ -1760,7 +1810,7 @@ class Ke {
1760
1810
  * @param options.customParams.clktgt - Click target identifier
1761
1811
  * @param options.cvEvents - Conversion events triggered by this click
1762
1812
  * @param options.autoCollectedParams - Additional auto-collected params to combine with defaults ['url', 'ua']
1763
- *
1813
+ *
1764
1814
  * @example Basic click tracking (uses default ['url', 'ua'])
1765
1815
  * ```typescript
1766
1816
  * tracker.sendClickEvent({
@@ -1768,7 +1818,7 @@ class Ke {
1768
1818
  * customParams: { clktgt: 'search-result-item' }
1769
1819
  * });
1770
1820
  * ```
1771
- *
1821
+ *
1772
1822
  * @example Click with conversion
1773
1823
  * ```typescript
1774
1824
  * tracker.sendClickEvent({
@@ -1777,7 +1827,7 @@ class Ke {
1777
1827
  * cvEvents: { 'cart_add': 1 }
1778
1828
  * });
1779
1829
  * ```
1780
- *
1830
+ *
1781
1831
  * @example Click with additional auto-collected params (combined with defaults)
1782
1832
  * ```typescript
1783
1833
  * // This will collect ['url', 'ua', 'ref'] - the 'ref' is added to defaults
@@ -1788,14 +1838,27 @@ class Ke {
1788
1838
  * });
1789
1839
  * ```
1790
1840
  */
1791
- sendClickEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
1841
+ sendClickEvent({
1842
+ params: e,
1843
+ customParams: s,
1844
+ cvEvents: _,
1845
+ autoCollectedParams: t,
1846
+ options: r
1847
+ }) {
1792
1848
  e && e.pageType && this.ral.callQueue.push(["setPageType", e.pageType]);
1793
- const r = ["url", "ua"], n = t ? [.../* @__PURE__ */ new Set([...r, ...t])] : r;
1794
- this.sendEvent({ type: "click", params: e, customParams: s, cvEvents: _, autoCollectedParams: n });
1849
+ const a = ["url", "ua"], i = t ? [.../* @__PURE__ */ new Set([...a, ...t])] : a;
1850
+ this.sendEvent({
1851
+ type: "click",
1852
+ params: e,
1853
+ customParams: s,
1854
+ cvEvents: _,
1855
+ autoCollectedParams: i,
1856
+ options: r
1857
+ });
1795
1858
  }
1796
1859
  /**
1797
1860
  * Resets the page ID in the RAL instance.
1798
- *
1861
+ *
1799
1862
  * This method delegates to the underlying RAL's resetPageId method.
1800
1863
  */
1801
1864
  resetPageId() {
@@ -1803,61 +1866,156 @@ class Ke {
1803
1866
  }
1804
1867
  /**
1805
1868
  * Processes events in the queue immediately.
1806
- *
1869
+ *
1807
1870
  * This method delegates to the underlying RAL's processImmediate method.
1808
1871
  */
1809
1872
  processImmediate() {
1810
1873
  this.ral.processImmediate();
1811
1874
  }
1875
+ /**
1876
+ * Cleans up tracker-owned resources.
1877
+ */
1878
+ destroy() {
1879
+ this.beaconLifecycle.destroy();
1880
+ }
1881
+ /**
1882
+ * Register a plugin with the tracker.
1883
+ *
1884
+ * Plugins extend the tracker's functionality by implementing the TrackerPlugin interface.
1885
+ * Each plugin must have a unique name. Attempting to register a plugin with a name
1886
+ * that's already registered will log a warning and be ignored.
1887
+ *
1888
+ * @param plugin - The plugin instance to register
1889
+ * @returns This tracker instance for method chaining
1890
+ *
1891
+ * @example Register a video tracking plugin
1892
+ * ```typescript
1893
+ * import { Tracker } from '@rakutenanalytics/rat-ts';
1894
+ * import { VideoTrackingPlugin } from '@rakutenanalytics/rat-ts/plugins/video';
1895
+ *
1896
+ * const tracker = new Tracker({ accountId: 123, serviceId: 456 });
1897
+ * tracker.use(new VideoTrackingPlugin({
1898
+ * autoDetect: true,
1899
+ * progressMilestones: [25, 50, 75, 100]
1900
+ * }));
1901
+ * ```
1902
+ *
1903
+ * @example Chain multiple plugin registrations
1904
+ * ```typescript
1905
+ * tracker
1906
+ * .use(new VideoTrackingPlugin())
1907
+ * .use(new FormTrackingPlugin())
1908
+ * .use(new ScrollTrackingPlugin());
1909
+ * ```
1910
+ */
1911
+ use(e) {
1912
+ return this.plugins.has(e.name) ? this : (this.plugins.set(e.name, e), e.initialize(this), this);
1913
+ }
1914
+ /**
1915
+ * Remove a plugin from the tracker.
1916
+ *
1917
+ * Removes a plugin by its name and calls its destroy method to clean up resources.
1918
+ * If the plugin is not found, returns false.
1919
+ *
1920
+ * @param pluginName - The name of the plugin to remove
1921
+ * @returns True if the plugin was found and removed, false otherwise
1922
+ *
1923
+ * @example Remove a plugin
1924
+ * ```typescript
1925
+ * const wasRemoved = tracker.removePlugin('video-tracking');
1926
+ * if (wasRemoved) {
1927
+ * console.log('Video tracking plugin removed');
1928
+ * }
1929
+ * ```
1930
+ */
1931
+ removePlugin(e) {
1932
+ const s = this.plugins.get(e);
1933
+ return s ? (s.destroy(), this.plugins.delete(e), !0) : !1;
1934
+ }
1935
+ /**
1936
+ * Get a registered plugin by name.
1937
+ *
1938
+ * Retrieves a plugin instance that has been registered with the tracker.
1939
+ * Returns undefined if no plugin with the given name is found.
1940
+ *
1941
+ * @template T - The type of the plugin (must extend TrackerPlugin)
1942
+ * @param name - The name of the plugin to retrieve
1943
+ * @returns The plugin instance or undefined if not found
1944
+ *
1945
+ * @example Get video tracking plugin
1946
+ * ```typescript
1947
+ * const videoPlugin = tracker.getPlugin<VideoTrackingPlugin>('video-tracking');
1948
+ * if (videoPlugin) {
1949
+ * videoPlugin.trackVideo(videoElement, { id: 'my-video' });
1950
+ * }
1951
+ * ```
1952
+ *
1953
+ * @example Type-safe plugin access
1954
+ * ```typescript
1955
+ * const formPlugin = tracker.getPlugin<FormTrackingPlugin>('form-tracking');
1956
+ * formPlugin?.trackForm(formElement);
1957
+ * ```
1958
+ */
1959
+ getPlugin(e) {
1960
+ return this.plugins.get(e);
1961
+ }
1812
1962
  }
1813
- const We = "0.3.3-rel.0", Ge = "rat-react", je = We;
1814
- function M(a) {
1815
- return new Ke({
1816
- ...a,
1817
- sdkSource: Ge,
1818
- sdkVersion: je
1963
+ const Ge = "0.4.0-rel.0", je = "rat-react", Ye = Ge;
1964
+ function F(n) {
1965
+ return new We({
1966
+ ...n,
1967
+ sdkSource: je,
1968
+ sdkVersion: Ye
1819
1969
  });
1820
1970
  }
1821
- const $e = (a) => {
1822
- const { accountId: e, serviceId: s } = a, [_, t] = F(null);
1823
- return R(() => {
1824
- const r = M(a);
1825
- t(r);
1971
+ const Ze = (n) => {
1972
+ const { accountId: e, serviceId: s } = n, [_, t] = B(null);
1973
+ return v(() => {
1974
+ const r = F(n);
1975
+ return t(r), () => {
1976
+ r.destroy();
1977
+ };
1826
1978
  }, [e, s]), _;
1827
- }, Ye = "useTrackerContext must be used within a TrackerProvider";
1828
- function Qe(a) {
1829
- if (!a)
1830
- throw new Error(Ye);
1831
- return a;
1979
+ }, Qe = "useTrackerContext must be used within a TrackerProvider";
1980
+ function xe(n) {
1981
+ if (!n)
1982
+ throw new Error(Qe);
1983
+ return n;
1832
1984
  }
1833
- const ne = se(
1985
+ const ae = se(
1834
1986
  void 0
1835
- ), Ze = () => {
1836
- const a = ce(ne);
1837
- return Qe(a);
1987
+ ), et = () => {
1988
+ const n = ce(ae);
1989
+ return xe(n);
1838
1990
  };
1839
- function xe(a, e) {
1991
+ function qe(n, e) {
1840
1992
  const s = {};
1841
- return a.forEach(({ key: _, options: t }) => {
1993
+ return n.forEach(({ key: _, options: t }) => {
1842
1994
  s[_] = e(t);
1843
1995
  }), s;
1844
1996
  }
1845
- const et = ({
1846
- children: a,
1997
+ const tt = ({
1998
+ children: n,
1847
1999
  defaultTrackers: e = []
1848
2000
  }) => {
1849
- const [s, _] = F({});
1850
- R(() => {
1851
- _(xe(e, M));
2001
+ const [s, _] = B({}), t = M(s);
2002
+ v(() => {
2003
+ t.current = s;
2004
+ }, [s]), v(() => {
2005
+ _(qe(e, F));
1852
2006
  }, [e]);
1853
- const t = (n, i) => {
1854
- const o = M(i);
1855
- _((c) => ({ ...c, [n]: o }));
1856
- }, r = (n) => s[n];
1857
- return /* @__PURE__ */ z(ne.Provider, { value: { getTracker: r, addTracker: t }, children: a });
2007
+ const r = (i, o) => {
2008
+ const c = F(o);
2009
+ _((u) => ({ ...u, [i]: c }));
2010
+ }, a = (i) => s[i];
2011
+ return v(() => () => {
2012
+ Object.values(t.current).forEach((i) => {
2013
+ i.destroy();
2014
+ });
2015
+ }, []), /* @__PURE__ */ X(ae.Provider, { value: { getTracker: a, addTracker: r }, children: n });
1858
2016
  };
1859
- function qe(a) {
1860
- const { onChange: e, once: s = !0 } = a, [_, t] = F(!1), r = K(null), n = K(null), i = _e(
2017
+ function ze(n) {
2018
+ const { onChange: e, once: s = !0 } = n, [_, t] = B(!1), r = M(null), a = M(null), i = _e(
1861
2019
  (o) => {
1862
2020
  o.forEach((c) => {
1863
2021
  var u;
@@ -1866,33 +2024,33 @@ function qe(a) {
1866
2024
  },
1867
2025
  [e, s]
1868
2026
  );
1869
- return R(() => {
2027
+ return v(() => {
1870
2028
  r.current = new IntersectionObserver(i, {
1871
2029
  root: null,
1872
2030
  rootMargin: "0px",
1873
2031
  threshold: 0.1
1874
2032
  // always partial visibility
1875
2033
  });
1876
- const o = n.current;
2034
+ const o = a.current;
1877
2035
  return o && r.current.observe(o), () => {
1878
2036
  r.current && r.current.disconnect();
1879
2037
  };
1880
- }, [i]), { isVisible: _, containerRef: n };
2038
+ }, [i]), { isVisible: _, containerRef: a };
1881
2039
  }
1882
- const tt = ({
1883
- children: a,
2040
+ const rt = ({
2041
+ children: n,
1884
2042
  tracker: e,
1885
2043
  id: s,
1886
2044
  onChange: _,
1887
2045
  once: t = !0,
1888
2046
  style: r,
1889
- ...n
2047
+ ...a
1890
2048
  }) => {
1891
- const { isVisible: i, containerRef: o } = qe({
2049
+ const { isVisible: i, containerRef: o } = ze({
1892
2050
  onChange: _,
1893
2051
  once: t
1894
2052
  });
1895
- return R(() => {
2053
+ return v(() => {
1896
2054
  i && e && typeof e.sendEvent == "function" && e.sendEvent({
1897
2055
  type: "appear",
1898
2056
  params: {
@@ -1900,13 +2058,13 @@ const tt = ({
1900
2058
  }
1901
2059
  // Add any required params here
1902
2060
  });
1903
- }, [i, e, s]), /* @__PURE__ */ z(
2061
+ }, [i, e, s]), /* @__PURE__ */ X(
1904
2062
  "div",
1905
2063
  {
1906
2064
  ref: o,
1907
2065
  style: { overflow: "auto", ...r },
1908
- ...n,
1909
- children: a
2066
+ ...a,
2067
+ children: n
1910
2068
  }
1911
2069
  );
1912
2070
  };
@@ -1922,11 +2080,11 @@ export {
1922
2080
  Ue as PglEnum,
1923
2081
  we as PgtEnum,
1924
2082
  Ve as PowerstatusEnum,
1925
- Je as ReceiverEndpoint,
2083
+ $e as ReceiverEndpoint,
1926
2084
  ke as SrtEnum,
1927
- et as TrackerProvider,
1928
- ae as TransportMethod,
1929
- tt as VisibilityTracker,
1930
- $e as useTracker,
1931
- Ze as useTrackerContext
2085
+ tt as TrackerProvider,
2086
+ I as TransportMethod,
2087
+ rt as VisibilityTracker,
2088
+ Ze as useTracker,
2089
+ et as useTrackerContext
1932
2090
  };