@usermaven/sdk-js 1.5.5-rc.97 → 1.5.6-rc.101

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,5 +1,5 @@
1
- var p = /* @__PURE__ */ ((i) => (i[i.DEBUG = 0] = "DEBUG", i[i.INFO = 1] = "INFO", i[i.WARN = 2] = "WARN", i[i.ERROR = 3] = "ERROR", i))(p || {});
2
- class Z {
1
+ var p = /* @__PURE__ */ ((n) => (n[n.DEBUG = 0] = "DEBUG", n[n.INFO = 1] = "INFO", n[n.WARN = 2] = "WARN", n[n.ERROR = 3] = "ERROR", n))(p || {});
2
+ class G {
3
3
  constructor(e) {
4
4
  this.level = e;
5
5
  }
@@ -16,8 +16,8 @@ class Z {
16
16
  this.level <= 3 && console.error("[Usermaven Error]:", e, ...t);
17
17
  }
18
18
  }
19
- function d(i = 0) {
20
- return new Z(i);
19
+ function d(n = 0) {
20
+ return new G(n);
21
21
  }
22
22
  const q = {
23
23
  logLevel: p.ERROR,
@@ -27,7 +27,7 @@ const q = {
27
27
  autocapture: !1,
28
28
  rageClick: !1,
29
29
  formTracking: !1,
30
- autoPageview: !1,
30
+ autoPageview: !0,
31
31
  disableEventPersistence: !1,
32
32
  gaHook: !1,
33
33
  segmentHook: !1,
@@ -49,16 +49,16 @@ class j {
49
49
  constructor(e) {
50
50
  this.domain = e, this.cookieDomain = this.getCookieDomain();
51
51
  }
52
- set(e, t, s = 365, n = !0, r = !1) {
52
+ set(e, t, i = 365, s = !0, r = !1) {
53
53
  const o = /* @__PURE__ */ new Date();
54
- o.setTime(o.getTime() + s * 24 * 60 * 60 * 1e3);
55
- const c = `expires=${o.toUTCString()}`, l = n ? "; Secure" : "", a = r ? "; HttpOnly" : "";
54
+ o.setTime(o.getTime() + i * 24 * 60 * 60 * 1e3);
55
+ const c = `expires=${o.toUTCString()}`, l = s ? "; Secure" : "", a = r ? "; HttpOnly" : "";
56
56
  document.cookie = `${e}=${t};${c};path=/;domain=${this.cookieDomain}${l}${a}`;
57
57
  }
58
58
  get(e) {
59
- const t = e + "=", s = document.cookie.split(";");
60
- for (let n = 0; n < s.length; n++) {
61
- let r = s[n].trim();
59
+ const t = e + "=", i = document.cookie.split(";");
60
+ for (let s = 0; s < i.length; s++) {
61
+ let r = i[s].trim();
62
62
  if (r.indexOf(t) === 0)
63
63
  return decodeURIComponent(r.substring(t.length));
64
64
  }
@@ -78,7 +78,7 @@ class j {
78
78
  }
79
79
  isIpAddress(e) {
80
80
  const t = e.split(".");
81
- return t.length === 4 && t.every((s) => !isNaN(Number(s)));
81
+ return t.length === 4 && t.every((i) => !isNaN(Number(i)));
82
82
  }
83
83
  extractHostname(e) {
84
84
  let t;
@@ -86,110 +86,110 @@ class j {
86
86
  }
87
87
  extractRootDomain(e) {
88
88
  let t = this.extractHostname(e);
89
- const s = t.split("."), n = s.length;
90
- return n > 2 && (s[n - 1].length == 2 ? (t = s[n - 2] + "." + s[n - 1], s[n - 2].length == 2 && (t = s[n - 3] + "." + t)) : t = s[n - 2] + "." + s[n - 1]), t;
89
+ const i = t.split("."), s = i.length;
90
+ return s > 2 && (i[s - 1].length == 2 ? (t = i[s - 2] + "." + i[s - 1], i[s - 2].length == 2 && (t = i[s - 3] + "." + t)) : t = i[s - 2] + "." + i[s - 1]), t;
91
91
  }
92
92
  extractTopLevelDomain(e) {
93
- const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, s = e.match(t);
94
- return s ? s[0] : "";
93
+ const t = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i, i = e.match(t);
94
+ return i ? i[0] : "";
95
95
  }
96
96
  }
97
- const ee = Object.prototype, te = ee.hasOwnProperty, ie = Array.prototype, E = ie.forEach, N = {};
98
- function se(i, e, t) {
99
- if (Array.isArray(i)) {
100
- if (E && i.forEach === E)
101
- i.forEach(e, t);
102
- else if ("length" in i && i.length === +i.length) {
103
- for (let s = 0, n = i.length; s < n; s++)
104
- if (s in i && e.call(t, i[s], s) === N)
97
+ const ee = Object.prototype, te = ee.hasOwnProperty, ie = Array.prototype, P = ie.forEach, N = {};
98
+ function ne(n, e, t) {
99
+ if (Array.isArray(n)) {
100
+ if (P && n.forEach === P)
101
+ n.forEach(e, t);
102
+ else if ("length" in n && n.length === +n.length) {
103
+ for (let i = 0, s = n.length; i < s; i++)
104
+ if (i in n && e.call(t, n[i], i) === N)
105
105
  return;
106
106
  }
107
107
  }
108
108
  }
109
- const O = function(i) {
110
- return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
111
- }, ne = function(i) {
112
- for (const e in i)
113
- typeof i[e] == "function" && (i[e] = i[e].bind(i));
109
+ const R = function(n) {
110
+ return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
111
+ }, se = function(n) {
112
+ for (const e in n)
113
+ typeof n[e] == "function" && (n[e] = n[e].bind(n));
114
114
  };
115
- function g(i, e, t) {
116
- if (i != null) {
117
- if (E && Array.isArray(i) && i.forEach === E)
118
- i.forEach(e, t);
119
- else if ("length" in i && i.length === +i.length) {
120
- for (let s = 0, n = i.length; s < n; s++)
121
- if (s in i && e.call(t, i[s], s) === N)
115
+ function g(n, e, t) {
116
+ if (n != null) {
117
+ if (P && Array.isArray(n) && n.forEach === P)
118
+ n.forEach(e, t);
119
+ else if ("length" in n && n.length === +n.length) {
120
+ for (let i = 0, s = n.length; i < s; i++)
121
+ if (i in n && e.call(t, n[i], i) === N)
122
122
  return;
123
123
  } else
124
- for (const s in i)
125
- if (te.call(i, s) && e.call(t, i[s], s) === N)
124
+ for (const i in n)
125
+ if (te.call(n, i) && e.call(t, n[i], i) === N)
126
126
  return;
127
127
  }
128
128
  }
129
- const re = function(i, ...e) {
130
- return se(e, function(t) {
131
- for (const s in t)
132
- t[s] !== void 0 && (i[s] = t[s]);
133
- }), i;
129
+ const re = function(n, ...e) {
130
+ return ne(e, function(t) {
131
+ for (const i in t)
132
+ t[i] !== void 0 && (n[i] = t[i]);
133
+ }), n;
134
134
  };
135
- function _(i, e) {
136
- return i.indexOf(e) !== -1;
135
+ function _(n, e) {
136
+ return n.indexOf(e) !== -1;
137
137
  }
138
- const oe = function(i) {
138
+ const oe = function(n) {
139
139
  try {
140
- return /^\s*\bfunction\b/.test(i);
140
+ return /^\s*\bfunction\b/.test(n);
141
141
  } catch {
142
142
  return !1;
143
143
  }
144
- }, ae = function(i) {
145
- return i === void 0;
144
+ }, ae = function(n) {
145
+ return n === void 0;
146
146
  }, y = function() {
147
- const i = function(s, n, r, o, c) {
148
- if (!s) {
147
+ const n = function(i, s, r, o, c) {
148
+ if (!i) {
149
149
  d().error("No valid element provided to register_event");
150
150
  return;
151
151
  }
152
- if (s.addEventListener && !o)
153
- s.addEventListener(n, r, !!c);
152
+ if (i.addEventListener && !o)
153
+ i.addEventListener(s, r, !!c);
154
154
  else {
155
- const l = "on" + n, a = s[l];
156
- s[l] = e(s, r, a);
155
+ const l = "on" + s, a = i[l];
156
+ i[l] = e(i, r, a);
157
157
  }
158
158
  };
159
- function e(s, n, r) {
159
+ function e(i, s, r) {
160
160
  return function(o) {
161
161
  if (o = o || t(window.event), !o)
162
162
  return;
163
163
  let c = !0, l;
164
164
  oe(r) && (l = r(o));
165
- const a = n.call(s, o);
165
+ const a = s.call(i, o);
166
166
  return (l === !1 || a === !1) && (c = !1), c;
167
167
  };
168
168
  }
169
- function t(s) {
170
- return s && (s.preventDefault = t.preventDefault, s.stopPropagation = t.stopPropagation), s;
169
+ function t(i) {
170
+ return i && (i.preventDefault = t.preventDefault, i.stopPropagation = t.stopPropagation), i;
171
171
  }
172
172
  return t.preventDefault = function() {
173
173
  this.returnValue = !1;
174
174
  }, t.stopPropagation = function() {
175
175
  this.cancelBubble = !0;
176
- }, i;
177
- }(), ce = function(i) {
176
+ }, n;
177
+ }(), ce = function(n) {
178
178
  return function(...e) {
179
179
  try {
180
- return i.apply(this, e);
180
+ return n.apply(this, e);
181
181
  } catch (t) {
182
182
  d().error("Implementation error. Please turn on debug and contact support@usermaven.com.", t);
183
183
  }
184
184
  };
185
- }, V = function(i) {
186
- for (const e in i)
187
- typeof i[e] == "function" && (i[e] = ce(i[e]));
185
+ }, V = function(n) {
186
+ for (const e in n)
187
+ typeof n[e] == "function" && (n[e] = ce(n[e]));
188
188
  };
189
- function D(i) {
190
- for (let e in i)
191
- (i[e] === "" || i[e] === null || i[e] === void 0 || typeof i[e] == "object" && Object.keys(i[e]).length === 0) && delete i[e];
192
- return i;
189
+ function U(n) {
190
+ for (let e in n)
191
+ (n[e] === "" || n[e] === null || n[e] === void 0 || typeof n[e] == "object" && Object.keys(n[e]).length === 0) && delete n[e];
192
+ return n;
193
193
  }
194
194
  function u() {
195
195
  try {
@@ -198,80 +198,80 @@ function u() {
198
198
  return d().warn("window is not available"), !1;
199
199
  }
200
200
  }
201
- function m(i = 5) {
202
- const e = new Uint8Array(i);
203
- return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, i);
201
+ function m(n = 5) {
202
+ const e = new Uint8Array(n);
203
+ return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(36).padStart(2, "0")).join("").slice(0, n);
204
204
  }
205
- function le(i) {
206
- return i.replace(
205
+ function le(n) {
206
+ return n.replace(
207
207
  /([-_][a-z])/g,
208
208
  (e) => e.toUpperCase().replace("-", "").replace("_", "")
209
209
  );
210
210
  }
211
- function R(i) {
212
- return typeof i != "object" || i === null ? i : Array.isArray(i) ? i.map(R) : Object.keys(i).reduce((e, t) => {
213
- const s = le(t);
214
- return e[s] = R(i[t]), e;
211
+ function I(n) {
212
+ return typeof n != "object" || n === null ? n : Array.isArray(n) ? n.map(I) : Object.keys(n).reduce((e, t) => {
213
+ const i = le(t);
214
+ return e[i] = I(n[t]), e;
215
215
  }, {});
216
216
  }
217
- function $(i) {
218
- switch (typeof i.className) {
217
+ function A(n) {
218
+ switch (typeof n.className) {
219
219
  case "string":
220
- return i.className;
220
+ return n.className;
221
221
  case "object":
222
- return ("baseVal" in i.className ? i.className.baseVal : null) || i.getAttribute("class") || "";
222
+ return ("baseVal" in n.className ? n.className.baseVal : null) || n.getAttribute("class") || "";
223
223
  default:
224
224
  return "";
225
225
  }
226
226
  }
227
- function U(i) {
227
+ function D(n) {
228
228
  let e = "";
229
- return L(i) && !W(i) && i.childNodes && i.childNodes.length && g(i.childNodes, function(t) {
230
- Q(t) && t.textContent && (e += O(t.textContent).split(/(\s+)/).filter(P).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
231
- }), O(e);
229
+ return L(n) && !W(n) && n.childNodes && n.childNodes.length && g(n.childNodes, function(t) {
230
+ Q(t) && t.textContent && (e += R(t.textContent).split(/(\s+)/).filter(E).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
231
+ }), R(e);
232
232
  }
233
- function J(i) {
234
- return !!i && i.nodeType === 1;
233
+ function J(n) {
234
+ return !!n && n.nodeType === 1;
235
235
  }
236
- function f(i, e) {
237
- return !!i && !!i.tagName && i.tagName.toLowerCase() === e.toLowerCase();
236
+ function f(n, e) {
237
+ return !!n && !!n.tagName && n.tagName.toLowerCase() === e.toLowerCase();
238
238
  }
239
- function Q(i) {
240
- return !!i && i.nodeType === 3;
239
+ function Q(n) {
240
+ return !!n && n.nodeType === 3;
241
241
  }
242
- function I(i) {
243
- return !!i && i.nodeType === 11;
242
+ function O(n) {
243
+ return !!n && n.nodeType === 11;
244
244
  }
245
245
  const b = ["a", "button", "form", "input", "select", "textarea", "label"];
246
- function ue(i, e) {
247
- if (!i || f(i, "html") || !J(i))
246
+ function ue(n, e) {
247
+ if (!n || f(n, "html") || !J(n))
248
248
  return !1;
249
- let t = i;
249
+ let t = n;
250
250
  for (; t && !f(t, "body"); ) {
251
251
  if (t.classList && t.classList.contains("um-no-capture"))
252
252
  return !1;
253
- t.parentNode && I(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
253
+ t.parentNode && O(t.parentNode) ? t = t.parentNode.host : t = t.parentNode;
254
254
  }
255
- let s = !1;
256
- for (t = i; t && !f(t, "body"); ) {
257
- if (t.parentNode && I(t.parentNode)) {
258
- t = t.parentNode.host, t && b.indexOf(t.tagName.toLowerCase()) > -1 && (s = !0);
255
+ let i = !1;
256
+ for (t = n; t && !f(t, "body"); ) {
257
+ if (t.parentNode && O(t.parentNode)) {
258
+ t = t.parentNode.host, t && b.indexOf(t.tagName.toLowerCase()) > -1 && (i = !0);
259
259
  continue;
260
260
  }
261
261
  const o = t.parentNode;
262
262
  if (!o) break;
263
263
  if (b.indexOf(o.tagName.toLowerCase()) > -1)
264
- s = !0;
264
+ i = !0;
265
265
  else {
266
266
  const c = window.getComputedStyle(o);
267
- c && c.getPropertyValue("cursor") === "pointer" && (s = !0);
267
+ c && c.getPropertyValue("cursor") === "pointer" && (i = !0);
268
268
  }
269
269
  t = o;
270
270
  }
271
- const n = window.getComputedStyle(i);
272
- if (n && n.getPropertyValue("cursor") === "pointer" && e.type === "click")
271
+ const s = window.getComputedStyle(n);
272
+ if (s && s.getPropertyValue("cursor") === "pointer" && e.type === "click")
273
273
  return !0;
274
- const r = i.tagName.toLowerCase();
274
+ const r = n.tagName.toLowerCase();
275
275
  switch (r) {
276
276
  case "html":
277
277
  return !1;
@@ -283,18 +283,18 @@ function ue(i, e) {
283
283
  case "textarea":
284
284
  return e.type === "change" || e.type === "click";
285
285
  default:
286
- return s ? e.type === "click" : e.type === "click" && (b.indexOf(r) > -1 || i.getAttribute("contenteditable") === "true");
286
+ return i ? e.type === "click" : e.type === "click" && (b.indexOf(r) > -1 || n.getAttribute("contenteditable") === "true");
287
287
  }
288
288
  }
289
- function L(i) {
290
- for (let s = i; s.parentNode && !f(s, "body"); s = s.parentNode) {
291
- const n = $(s).split(" ");
292
- if (_(n, "ph-sensitive") || _(n, "ph-no-capture"))
289
+ function L(n) {
290
+ for (let i = n; i.parentNode && !f(i, "body"); i = i.parentNode) {
291
+ const s = A(i).split(" ");
292
+ if (_(s, "ph-sensitive") || _(s, "ph-no-capture"))
293
293
  return !1;
294
294
  }
295
- if (_($(i).split(" "), "ph-include"))
295
+ if (_(A(n).split(" "), "ph-include"))
296
296
  return !0;
297
- const e = i.type || "";
297
+ const e = n.type || "";
298
298
  if (typeof e == "string")
299
299
  switch (e.toLowerCase()) {
300
300
  case "hidden":
@@ -302,57 +302,57 @@ function L(i) {
302
302
  case "password":
303
303
  return !1;
304
304
  }
305
- const t = i.name || i.id || "";
305
+ const t = n.name || n.id || "";
306
306
  return !(typeof t == "string" && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(t.replace(/[^a-zA-Z0-9]/g, "")));
307
307
  }
308
- function W(i) {
308
+ function W(n) {
309
309
  const e = ["button", "checkbox", "submit", "reset"];
310
- return !!(f(i, "input") && !e.includes(i.type) || f(i, "select") || f(i, "textarea") || i.getAttribute("contenteditable") === "true");
310
+ return !!(f(n, "input") && !e.includes(n.type) || f(n, "select") || f(n, "textarea") || n.getAttribute("contenteditable") === "true");
311
311
  }
312
- function P(i) {
313
- return !(i === null || ae(i) || typeof i == "string" && (i = O(i), /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((i || "").replace(/[- ]/g, "")) || /(^\d{3}-?\d{2}-?\d{4}$)/.test(i)));
312
+ function E(n) {
313
+ return !(n === null || ae(n) || typeof n == "string" && (n = R(n), /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((n || "").replace(/[- ]/g, "")) || /(^\d{3}-?\d{2}-?\d{4}$)/.test(n)));
314
314
  }
315
- function he(i) {
316
- return typeof i == "string" ? i.substring(0, 10) === "_ngcontent" || i.substring(0, 7) === "_nghost" : !1;
315
+ function he(n) {
316
+ return typeof n == "string" ? n.substring(0, 10) === "_ngcontent" || n.substring(0, 7) === "_nghost" : !1;
317
317
  }
318
318
  function x() {
319
319
  return m(10);
320
320
  }
321
- function de(i) {
322
- return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(i).toLowerCase());
321
+ function de(n) {
322
+ return /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(n).toLowerCase());
323
323
  }
324
- function fe(i, e) {
324
+ function fe(n, e) {
325
325
  let t;
326
- return function(...s) {
327
- const n = () => {
328
- clearTimeout(t), i(...s);
326
+ return function(...i) {
327
+ const s = () => {
328
+ clearTimeout(t), n(...i);
329
329
  };
330
- clearTimeout(t), t = setTimeout(n, e);
330
+ clearTimeout(t), t = setTimeout(s, e);
331
331
  };
332
332
  }
333
- function ge(i) {
334
- const e = {}, t = i.replace(/^\?/, "").split("&");
335
- for (let s = 0; s < t.length; s++) {
336
- const n = t[s].split("=");
337
- n[0] !== "" && (e[decodeURIComponent(n[0])] = decodeURIComponent(n[1] || ""));
333
+ function ge(n) {
334
+ const e = {}, t = n.replace(/^\?/, "").split("&");
335
+ for (let i = 0; i < t.length; i++) {
336
+ const s = t[i].split("=");
337
+ s[0] !== "" && (e[decodeURIComponent(s[0])] = decodeURIComponent(s[1] || ""));
338
338
  }
339
339
  return e;
340
340
  }
341
- function F(i) {
342
- return typeof i == "string" || i instanceof String;
341
+ function F(n) {
342
+ return typeof n == "string" || n instanceof String;
343
343
  }
344
- function v(i) {
345
- return i !== null && typeof i == "object" && i.constructor === Object;
344
+ function v(n) {
345
+ return n !== null && typeof n == "object" && n.constructor === Object;
346
346
  }
347
- function pe(i) {
348
- if (i === null)
347
+ function pe(n) {
348
+ if (n === null)
349
349
  return p.ERROR;
350
- const e = i.toUpperCase(), t = p[e];
350
+ const e = n.toUpperCase(), t = p[e];
351
351
  return t || t === 0 ? t : p.ERROR;
352
352
  }
353
353
  const me = () => {
354
- let i = "false";
355
- return typeof window < "u" && window.localStorage && (i = localStorage.getItem("um_exclusion")), !(i == null || i === "false");
354
+ let n = "false";
355
+ return typeof window < "u" && window.localStorage && (n = localStorage.getItem("um_exclusion")), !(n == null || n === "false");
356
356
  };
357
357
  class ye {
358
358
  constructor(e) {
@@ -380,8 +380,8 @@ class ye {
380
380
  this.track();
381
381
  }
382
382
  getScrollDepth() {
383
- const e = this.getWindowHeight(), t = this.getDocumentHeight(), s = this.getScrollDistance(), n = t - e;
384
- return Math.min(100, Math.floor(s / n * 100));
383
+ const e = this.getWindowHeight(), t = this.getDocumentHeight(), i = this.getScrollDistance(), s = t - e;
384
+ return Math.min(100, Math.floor(i / s * 100));
385
385
  }
386
386
  getWindowHeight() {
387
387
  return window.innerHeight || this.documentElement.clientHeight || document.body.clientHeight || 0;
@@ -400,21 +400,32 @@ class ye {
400
400
  return window.pageYOffset || this.documentElement.scrollTop || document.body.scrollTop || 0;
401
401
  }
402
402
  checkMilestones(e) {
403
- this.milestones.filter((s) => e >= s).forEach((s) => {
404
- this.send(), this.milestones = this.milestones.filter((n) => n !== s);
403
+ this.milestones.filter((i) => e >= i).forEach((i) => {
404
+ this.send(), this.milestones = this.milestones.filter((s) => s !== i);
405
405
  });
406
406
  }
407
407
  }
408
- const A = class A {
409
- constructor(e, t, s = d()) {
410
- this.logger = s, this.scrollDepth = null, this.customProperties = [], this.client = e, this.options = t, this.scrollDepth = new ye(e), ne(this), V(this);
408
+ const T = class T {
409
+ constructor(e, t, i = d()) {
410
+ this.logger = i, this.scrollDepth = null, this.customProperties = [], this.domHandlersAttached = !1, this.client = e, this.options = t, this.scrollDepth = new ye(e), se(this), V(this);
411
+ }
412
+ isBrowserSupported() {
413
+ return typeof document < "u" && typeof document.addEventListener == "function";
411
414
  }
412
415
  init() {
416
+ if (!this.isBrowserSupported()) {
417
+ this.logger.debug("Browser not supported for autocapture");
418
+ return;
419
+ }
420
+ if (this.domHandlersAttached) {
421
+ this.logger.debug("Autocapture already initialized.");
422
+ return;
423
+ }
413
424
  if (!(document && document.body)) {
414
425
  this.logger.debug("Document not ready yet, trying again in 500 milliseconds..."), setTimeout(() => this.init(), 500);
415
426
  return;
416
427
  }
417
- this.addDomEventHandlers();
428
+ this.addDomEventHandlers(), this.domHandlersAttached = !0;
418
429
  }
419
430
  addDomEventHandlers() {
420
431
  const e = (t) => {
@@ -431,17 +442,17 @@ const A = class A {
431
442
  return performance.navigation && performance.navigation.type === 1;
432
443
  }
433
444
  captureEvent(e) {
434
- var s, n;
445
+ var i, s;
435
446
  let t = this.getEventTarget(e);
436
447
  if (Q(t) && (t = t.parentNode || null), e.type === "scroll")
437
- return (s = this.scrollDepth) == null || s.track(), !0;
448
+ return (i = this.scrollDepth) == null || i.track(), !0;
438
449
  if (e.type === "visibilitychange" && document.visibilityState === "hidden" || e.type === "popstate")
439
- return this.isPageRefresh() || (n = this.scrollDepth) == null || n.send(), !0;
450
+ return this.isPageRefresh() || (s = this.scrollDepth) == null || s.send(), !0;
440
451
  if (t && ue(t, e)) {
441
452
  const r = [t];
442
453
  let o = t;
443
454
  for (; o.parentNode && !f(o, "body"); ) {
444
- if (I(o.parentNode)) {
455
+ if (O(o.parentNode)) {
445
456
  r.push(o.parentNode.host), o = o.parentNode.host;
446
457
  continue;
447
458
  }
@@ -450,9 +461,9 @@ const A = class A {
450
461
  const c = [];
451
462
  let l, a = !1;
452
463
  if (g(r, (k) => {
453
- const G = L(k);
454
- k.tagName.toLowerCase() === "a" && (l = k.getAttribute("href"), l = G && P(l) && l);
455
- const Y = $(k).split(" ");
464
+ const Z = L(k);
465
+ k.tagName.toLowerCase() === "a" && (l = k.getAttribute("href"), l = Z && E(l) && l);
466
+ const Y = A(k).split(" ");
456
467
  _(Y, "ph-no-capture") && (a = !0), c.push(
457
468
  this.getPropertiesFromElement(
458
469
  k,
@@ -460,7 +471,7 @@ const A = class A {
460
471
  this.options.maskAllText ?? !1
461
472
  )
462
473
  );
463
- }), this.options.maskAllText || (c[0].$el_text = U(t)), l && (c[0].attr__href = l), a)
474
+ }), this.options.maskAllText || (c[0].$el_text = D(t)), l && (c[0].attr__href = l), a)
464
475
  return !1;
465
476
  const h = re(
466
477
  this.getDefaultProperties(e.type),
@@ -474,36 +485,36 @@ const A = class A {
474
485
  }
475
486
  getCustomProperties(e) {
476
487
  const t = {};
477
- return g(this.customProperties, (s) => {
478
- g(s.event_selectors, (n) => {
479
- const r = document.querySelectorAll(n);
488
+ return g(this.customProperties, (i) => {
489
+ g(i.event_selectors, (s) => {
490
+ const r = document.querySelectorAll(s);
480
491
  g(r, (o) => {
481
- _(e, o) && L(o) && (t[s.name] = this.extractCustomPropertyValue(s));
492
+ _(e, o) && L(o) && (t[i.name] = this.extractCustomPropertyValue(i));
482
493
  });
483
494
  });
484
495
  }), t;
485
496
  }
486
497
  extractCustomPropertyValue(e) {
487
498
  const t = [];
488
- return g(document.querySelectorAll(e.css_selector), function(s) {
489
- let n;
490
- ["input", "select"].indexOf(s.tagName.toLowerCase()) > -1 ? n = s.value : s.textContent && (n = s.textContent), P(n) && t.push(n);
499
+ return g(document.querySelectorAll(e.css_selector), function(i) {
500
+ let s;
501
+ ["input", "select"].indexOf(i.tagName.toLowerCase()) > -1 ? s = i.value : i.textContent && (s = i.textContent), E(s) && t.push(s);
491
502
  }), t.join(", ");
492
503
  }
493
504
  getEventTarget(e) {
494
505
  var t;
495
506
  return typeof e.target > "u" ? e.srcElement || null : (t = e.target) != null && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
496
507
  }
497
- getPropertiesFromElement(e, t, s) {
498
- const n = e.tagName.toLowerCase(), r = {
499
- tag_name: n
508
+ getPropertiesFromElement(e, t, i) {
509
+ const s = e.tagName.toLowerCase(), r = {
510
+ tag_name: s
500
511
  };
501
- b.indexOf(n) > -1 && !s && (r.$el_text = U(e));
502
- const o = $(e);
512
+ b.indexOf(s) > -1 && !i && (r.$el_text = D(e));
513
+ const o = A(e);
503
514
  o.length > 0 && (r.classes = o.split(" ").filter(function(h) {
504
515
  return h !== "";
505
516
  })), g(e.attributes, function(h) {
506
- W(e) && ["name", "id", "class"].indexOf(h.name) === -1 || !t && P(h.value) && !he(h.name) && (r["attr__" + h.name] = h.value);
517
+ W(e) && ["name", "id", "class"].indexOf(h.name) === -1 || !t && E(h.value) && !he(h.name) && (r["attr__" + h.name] = h.value);
507
518
  });
508
519
  let c = 1, l = 1, a = e;
509
520
  for (; a = this.previousElementSibling(a); )
@@ -530,17 +541,17 @@ const A = class A {
530
541
  encodeHtml(e) {
531
542
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
532
543
  }
533
- static enabledForProject(e, t = 10, s = 10) {
544
+ static enabledForProject(e, t = 10, i = 10) {
534
545
  if (!e)
535
546
  return !1;
536
- let n = 0;
547
+ let s = 0;
537
548
  for (let r = 0; r < e.length; r++)
538
- n += e.charCodeAt(r);
539
- return n % t < s;
549
+ s += e.charCodeAt(r);
550
+ return s % t < i;
540
551
  }
541
552
  };
542
- A.FORCE_CAPTURE_ATTR = "data-um-force-capture", A.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
543
- let S = A;
553
+ T.FORCE_CAPTURE_ATTR = "data-um-force-capture", T.PREVENT_CAPTURE_ATTR = "data-um-no-capture";
554
+ let $ = T;
544
555
  class we {
545
556
  constructor(e) {
546
557
  this.client = e, this.lastPageUrl = window.location.href, this.trackInitialPageview(), this.initializePageviewTracking();
@@ -571,43 +582,43 @@ class we {
571
582
  }
572
583
  }
573
584
  class ke {
574
- constructor(e, t, s = d()) {
575
- this.trackingHost = e, this.logger = s, this.config = t;
585
+ constructor(e, t, i = d()) {
586
+ this.trackingHost = e, this.logger = i, this.config = t;
576
587
  }
577
588
  async send(e) {
578
- const t = this.config.key, s = this.constructUrl(t), n = new Blob([JSON.stringify(e)], { type: "application/json" });
579
- if (navigator.sendBeacon(s, n))
589
+ const t = this.config.key, i = this.constructUrl(t), s = new Blob([JSON.stringify(e)], { type: "application/json" });
590
+ if (navigator.sendBeacon(i, s))
580
591
  this.logger.debug(`Successfully queued ${e.length} event(s) via Beacon API`);
581
592
  else
582
593
  throw new Error("Failed to queue events via Beacon API");
583
594
  }
584
595
  constructUrl(e) {
585
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
586
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
596
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
597
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
587
598
  }
588
599
  // Note: Beacon API doesn't support custom headers, so we can't use them here.
589
600
  // If custom headers are crucial, you might want to fall back to XHR or Fetch in those cases.
590
601
  }
591
602
  class z {
592
- constructor(e, t, s = d()) {
593
- this.trackingHost = e, this.logger = s, this.config = t;
603
+ constructor(e, t, i = d()) {
604
+ this.trackingHost = e, this.logger = i, this.config = t;
594
605
  }
595
606
  async send(e) {
596
- const t = this.config.key, s = this.constructUrl(t), n = JSON.stringify(e), r = {
607
+ const t = this.config.key, i = this.constructUrl(t), s = JSON.stringify(e), r = {
597
608
  "Content-Type": "application/json",
598
609
  ...this.getCustomHeaders()
599
- }, o = await fetch(s, {
610
+ }, o = await fetch(i, {
600
611
  method: "POST",
601
612
  headers: r,
602
- body: n
613
+ body: s
603
614
  });
604
615
  if (!o.ok)
605
616
  throw new Error(`HTTP error! status: ${o.status}`);
606
617
  this.logger.debug(`Successfully sent ${e.length} event(s)`), this.postHandle(o.status, await o.text());
607
618
  }
608
619
  constructUrl(e) {
609
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
610
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
620
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
621
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
611
622
  }
612
623
  getCustomHeaders() {
613
624
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
@@ -617,26 +628,26 @@ class z {
617
628
  }
618
629
  }
619
630
  class ve {
620
- constructor(e, t, s = d()) {
621
- this.trackingHost = e, this.logger = s, this.config = t;
631
+ constructor(e, t, i = d()) {
632
+ this.trackingHost = e, this.logger = i, this.config = t;
622
633
  }
623
634
  send(e) {
624
- return new Promise((t, s) => {
625
- const n = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
626
- n.open("POST", o, !0), n.setRequestHeader("Content-Type", "application/json");
635
+ return new Promise((t, i) => {
636
+ const s = new XMLHttpRequest(), r = this.config.key, o = this.constructUrl(r);
637
+ s.open("POST", o, !0), s.setRequestHeader("Content-Type", "application/json");
627
638
  const c = this.getCustomHeaders();
628
639
  Object.keys(c).forEach((l) => {
629
- n.setRequestHeader(l, c[l]);
630
- }), n.onload = () => {
631
- n.status >= 200 && n.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : s(new Error(`HTTP error! status: ${n.status}`));
632
- }, n.onerror = () => {
633
- s(new Error("Network error"));
634
- }, n.send(JSON.stringify(e));
640
+ s.setRequestHeader(l, c[l]);
641
+ }), s.onload = () => {
642
+ s.status >= 200 && s.status < 300 ? (this.logger.debug(`Successfully sent ${e.length} event(s)`), t()) : i(new Error(`HTTP error! status: ${s.status}`));
643
+ }, s.onerror = () => {
644
+ i(new Error("Network error"));
645
+ }, s.send(JSON.stringify(e));
635
646
  });
636
647
  }
637
648
  constructUrl(e) {
638
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", n = u() ? "/api/v1/event" : "/api/v1/s2s/event";
639
- return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${s}` : `${this.trackingHost}${n}?token=${e}${t}${s}`;
649
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "", s = u() ? "/api/v1/event" : "/api/v1/s2s/event";
650
+ return this.config.randomizeUrl ? `${this.trackingHost}/api.${m()}?p_${m()}=${e}${t}${i}` : `${this.trackingHost}${s}?token=${e}${t}${i}`;
640
651
  }
641
652
  getCustomHeaders() {
642
653
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
@@ -645,7 +656,7 @@ class ve {
645
656
  this.logger.debug(`Response received. Status: ${e}, Body: ${t}`);
646
657
  }
647
658
  }
648
- class X {
659
+ class K {
649
660
  constructor(e, t) {
650
661
  this.storage = {}, this.prefix = `usermaven_${e}_`, this.load(), this.logger = t || d();
651
662
  }
@@ -704,10 +715,10 @@ class _e {
704
715
  this.storage = {};
705
716
  }
706
717
  }
707
- class M {
718
+ class B {
708
719
  // Default to true for server-side
709
- constructor(e, t = 3, s = 1e3, n = 10, r = 1e3, o = d(), c = "default") {
710
- this.transport = e, this.maxRetries = t, this.retryInterval = s, this.batchSize = n, this.batchInterval = r, this.logger = o, this.queue = [], this.processing = !1, this.batchTimeoutId = null, this.isOnline = !0, this.persistence = new X(`offline_queue_${c}`), u() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
720
+ constructor(e, t = 3, i = 1e3, s = 10, r = 1e3, o = d(), c = "default") {
721
+ this.transport = e, this.maxRetries = t, this.retryInterval = i, this.batchSize = s, this.batchInterval = r, this.logger = o, this.queue = [], this.processing = !1, this.batchTimeoutId = null, this.isOnline = !0, this.persistence = new K(`offline_queue_${c}`), u() && (this.isOnline = navigator.onLine, this.loadQueueFromStorage(), this.initNetworkListeners(), this.scheduleBatch());
711
722
  }
712
723
  add(e) {
713
724
  const t = { payload: e, retries: 0, timestamp: Date.now() };
@@ -726,11 +737,11 @@ class M {
726
737
  async processBatch() {
727
738
  if ((!u() || this.isOnline) && !this.processing && this.queue.length > 0) {
728
739
  this.processing = !0;
729
- const e = this.queue.splice(0, this.batchSize), t = e.map((s) => s.payload);
740
+ const e = this.queue.splice(0, this.batchSize), t = e.map((i) => i.payload);
730
741
  try {
731
742
  await this.transport.send(t), this.logger.debug(`Successfully sent batch of ${e.length} payloads`), u() && this.saveQueueToStorage();
732
- } catch (s) {
733
- this.logger.error("Failed to send batch", s), await this.handleBatchFailure(e);
743
+ } catch (i) {
744
+ this.logger.error("Failed to send batch", i), await this.handleBatchFailure(e);
734
745
  }
735
746
  this.processing = !1;
736
747
  }
@@ -765,17 +776,17 @@ class be {
765
776
  shouldCaptureElement(e) {
766
777
  return !e.closest(".um-no-capture");
767
778
  }
768
- click(e, t, s) {
769
- const n = { x: e, y: t, timestamp: s };
770
- this.clicks.push(n), this.clicks = this.clicks.filter((r) => s - r.timestamp < this.timeWindow), this.clicks.length >= this.threshold && this.checkRageClick();
779
+ click(e, t, i) {
780
+ const s = { x: e, y: t, timestamp: i };
781
+ this.clicks.push(s), this.clicks = this.clicks.filter((r) => i - r.timestamp < this.timeWindow), this.clicks.length >= this.threshold && this.checkRageClick();
771
782
  }
772
783
  checkRageClick() {
773
- const e = this.clicks[0], s = (this.clicks[this.clicks.length - 1].timestamp - e.timestamp) / 1e3;
784
+ const e = this.clicks[0], i = (this.clicks[this.clicks.length - 1].timestamp - e.timestamp) / 1e3;
774
785
  this.clicks.every((r, o) => {
775
786
  if (o === 0) return !0;
776
787
  const c = this.clicks[o - 1];
777
788
  return Math.sqrt(Math.pow(r.x - c.x, 2) + Math.pow(r.y - c.y, 2)) < this.distanceThreshold;
778
- }) && this.sendRageClickEvent(s);
789
+ }) && this.sendRageClickEvent(i);
779
790
  }
780
791
  sendRageClickEvent(e) {
781
792
  const t = this.clicks[this.clicks.length - 1];
@@ -785,15 +796,15 @@ class be {
785
796
  }), this.clicks = [];
786
797
  }
787
798
  }
788
- class Pe {
789
- constructor(e, t, s = d()) {
790
- this.trackingHost = e, this.logger = s, this.config = t;
799
+ class Ee {
800
+ constructor(e, t, i = d()) {
801
+ this.trackingHost = e, this.logger = i, this.config = t;
791
802
  }
792
803
  async send(e) {
793
- const t = this.config.key, s = new (void 0)(this.constructUrl(t)), n = {
794
- hostname: s.hostname,
804
+ const t = this.config.key, i = new (void 0)(this.constructUrl(t)), s = {
805
+ hostname: i.hostname,
795
806
  port: 443,
796
- path: `${s.pathname}${s.search}`,
807
+ path: `${i.pathname}${i.search}`,
797
808
  method: "POST",
798
809
  headers: {
799
810
  "Content-Type": "application/json",
@@ -801,7 +812,7 @@ class Pe {
801
812
  }
802
813
  };
803
814
  return new Promise((r, o) => {
804
- const c = (void 0)(n, (l) => {
815
+ const c = (void 0)(s, (l) => {
805
816
  l.on("data", (a) => {
806
817
  }), l.on("end", () => {
807
818
  const a = l.statusCode || 0;
@@ -814,16 +825,16 @@ class Pe {
814
825
  });
815
826
  }
816
827
  constructUrl(e) {
817
- const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", s = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "";
818
- return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${s}`;
828
+ const t = this.config.cookiePolicy !== "keep" ? `&cookie_policy=${this.config.cookiePolicy}` : "", i = this.config.ipPolicy !== "keep" ? `&ip_policy=${this.config.ipPolicy}` : "";
829
+ return `${this.trackingHost}/api/v1/s2s/event?token=${e}${t}${i}`;
819
830
  }
820
831
  getCustomHeaders() {
821
832
  return typeof this.config.customHeaders == "function" ? this.config.customHeaders() : this.config.customHeaders ? this.config.customHeaders : {};
822
833
  }
823
834
  }
824
835
  class w {
825
- constructor(e, t = "all", s = {}) {
826
- this.instance = e, this.trackingType = t, this.options = s, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
836
+ constructor(e, t = "all", i = {}) {
837
+ this.instance = e, this.trackingType = t, this.options = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", this.initialize.bind(this)) : this.initialize();
827
838
  }
828
839
  initialize() {
829
840
  this.trackingType !== "none" && this.setupFormTracking();
@@ -835,19 +846,19 @@ class w {
835
846
  });
836
847
  }
837
848
  handleFormSubmit(e) {
838
- const t = e.target, s = this._getFormDetails(t);
839
- this.instance.track("$form", D(s)), this.options.trackFieldChanges && this.trackFieldChanges(t);
849
+ const t = e.target, i = this._getFormDetails(t);
850
+ this.instance.track("$form", U(i)), this.options.trackFieldChanges && this.trackFieldChanges(t);
840
851
  }
841
852
  trackFieldChanges(e) {
842
- e.querySelectorAll("input, select, textarea").forEach((s) => {
843
- s.addEventListener("change", (n) => {
844
- const r = this._getFieldProps(n.target, 0);
845
- this.instance.track("$form_field_change", D(r));
853
+ e.querySelectorAll("input, select, textarea").forEach((i) => {
854
+ i.addEventListener("change", (s) => {
855
+ const r = this._getFieldProps(s.target, 0);
856
+ this.instance.track("$form_field_change", U(r));
846
857
  });
847
858
  });
848
859
  }
849
- static getInstance(e, t = "all", s = {}) {
850
- return w.instance || (w.instance = new w(e, t, s)), w.instance;
860
+ static getInstance(e, t = "all", i = {}) {
861
+ return w.instance || (w.instance = new w(e, t, i)), w.instance;
851
862
  }
852
863
  _getFormDetails(e) {
853
864
  const t = {
@@ -857,20 +868,20 @@ class w {
857
868
  form_method: e.method,
858
869
  form_class: e.className,
859
870
  form_attributes: this._getElementAttributes(e)
860
- }, s = e.querySelectorAll("input, select, textarea");
861
- return Array.from(s).filter((r) => !r.classList.contains("um-no-capture")).forEach((r, o) => {
871
+ }, i = e.querySelectorAll("input, select, textarea");
872
+ return Array.from(i).filter((r) => !r.classList.contains("um-no-capture")).forEach((r, o) => {
862
873
  const c = this._getFieldProps(r, o);
863
874
  Object.assign(t, c);
864
875
  }), t;
865
876
  }
866
877
  _getFieldProps(e, t) {
867
- const s = Object.keys(e.dataset).length ? JSON.stringify(e.dataset) : void 0, n = this.getSafeText(e);
878
+ const i = Object.keys(e.dataset).length ? JSON.stringify(e.dataset) : void 0, s = this.getSafeText(e);
868
879
  return {
869
880
  [`field_${t + 1}_tag`]: e.tagName.toLowerCase(),
870
881
  [`field_${t + 1}_type`]: e instanceof HTMLInputElement ? e.type : void 0,
871
- [`field_${t + 1}_data_attributes`]: s,
882
+ [`field_${t + 1}_data_attributes`]: i,
872
883
  [`field_${t + 1}_id`]: e.id,
873
- [`field_${t + 1}_value`]: n,
884
+ [`field_${t + 1}_value`]: s,
874
885
  [`field_${t + 1}_class`]: e.className,
875
886
  [`field_${t + 1}_name`]: e.name,
876
887
  [`field_${t + 1}_attributes`]: this._getElementAttributes(e)
@@ -882,8 +893,8 @@ class w {
882
893
  getSafeText(e) {
883
894
  let t = "";
884
895
  return "value" in e && e.type !== "password" ? t = e.value : e.hasChildNodes() ? t = Array.from(e.childNodes).filter(
885
- (n) => n.nodeType === Node.TEXT_NODE
886
- ).map((n) => n.textContent).join("") : t = e.textContent || "", this._scrubPotentiallySensitiveValues(t);
896
+ (s) => s.nodeType === Node.TEXT_NODE
897
+ ).map((s) => s.textContent).join("") : t = e.textContent || "", this._scrubPotentiallySensitiveValues(t);
887
898
  }
888
899
  _scrubPotentiallySensitiveValues(e) {
889
900
  return this._shouldCaptureValue(e) ? e : "<redacted>";
@@ -900,8 +911,8 @@ class w {
900
911
  _trim(e) {
901
912
  if (typeof String.prototype.trim == "function")
902
913
  return e.trim();
903
- let t = 0, s = e.length - 1;
904
- const n = [
914
+ let t = 0, i = e.length - 1;
915
+ const s = [
905
916
  " ",
906
917
  `
907
918
  `,
@@ -928,16 +939,16 @@ class w {
928
939
  " ",
929
940
  " "
930
941
  ].join("");
931
- for (; t <= s && n.indexOf(e[t]) > -1; )
942
+ for (; t <= i && s.indexOf(e[t]) > -1; )
932
943
  t++;
933
- for (; s >= t && n.indexOf(e[s]) > -1; )
934
- s--;
935
- return e.slice(t, s + 1);
944
+ for (; i >= t && s.indexOf(e[i]) > -1; )
945
+ i--;
946
+ return e.slice(t, i + 1);
936
947
  }
937
948
  }
938
- class C {
949
+ class S {
939
950
  constructor(e) {
940
- this.config = this.mergeConfig(e, q), this.logger = d(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new M(
951
+ this.config = this.mergeConfig(e, q), this.logger = d(this.config.logLevel), this.namespace = e.namespace || "default", this.transport = this.initializeTransport(this.config), this.persistence = this.initializePersistence(), this.retryQueue = new B(
941
952
  this.transport,
942
953
  this.config.maxSendAttempts || 3,
943
954
  this.config.minSendTimeout || 1e3,
@@ -949,7 +960,7 @@ class C {
949
960
  ), u() && this.initializeBrowserFeatures(), this.anonymousId = this.getOrCreateAnonymousId(), this.logger.info(`Usermaven client initialized for namespace: ${this.namespace}`);
950
961
  }
951
962
  initializeBrowserFeatures() {
952
- if (this.cookieManager = new j(this.config.cookieDomain), this.config.autocapture && S.enabledForProject(this.config.key) && (this.autoCapture = new S(this, this.config, this.logger), this.autoCapture.init()), this.config.formTracking) {
963
+ if (this.cookieManager = new j(this.config.cookieDomain), this.config.autocapture && $.enabledForProject(this.config.key) && !this.config.disableAutocaptureListenerRegistration && (this.autoCapture = new $(this, this.config, this.logger), this.autoCapture.init()), this.config.formTracking) {
953
964
  const e = this.config.formTracking === !0 ? "all" : this.config.formTracking;
954
965
  this.formTracking = w.getInstance(this, e || "none", {
955
966
  trackFieldChanges: !1
@@ -963,14 +974,14 @@ class C {
963
974
  * @param defaultConfig
964
975
  */
965
976
  mergeConfig(e, t) {
966
- const s = JSON.parse(JSON.stringify(e));
967
- let n = { ...t, ...s };
977
+ const i = JSON.parse(JSON.stringify(e));
978
+ let s = { ...t, ...i };
968
979
  return Object.keys(t).forEach((r) => {
969
- v(t[r]) && (n[r] = this.mergeConfig(e[r], t[r]));
970
- }), n;
980
+ v(t[r]) && (s[r] = this.mergeConfig(e[r], t[r]));
981
+ }), s;
971
982
  }
972
983
  init(e) {
973
- this.config = { ...this.config, ...e }, this.logger = d(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new M(
984
+ this.config = { ...this.config, ...e }, this.logger = d(this.config.logLevel), this.namespace = e.namespace || this.namespace, this.transport = this.initializeTransport(e), this.persistence = this.initializePersistence(), this.retryQueue = new B(
974
985
  this.transport,
975
986
  this.config.maxSendAttempts || 3,
976
987
  this.config.minSendTimeout || 1e3,
@@ -984,17 +995,17 @@ class C {
984
995
  manageCrossDomainLinking() {
985
996
  if (!this.config.crossDomainLinking || !this.config.domains)
986
997
  return;
987
- const e = this.config.domains.split(",").map((s) => s.trim()), t = this.config.cookieName || `__eventn_id_${this.config.key}`;
988
- document.addEventListener("click", (s) => {
998
+ const e = this.config.domains.split(",").map((i) => i.trim()), t = this.config.cookieName || `__eventn_id_${this.config.key}`;
999
+ document.addEventListener("click", (i) => {
989
1000
  var c;
990
- const n = this.findClosestLink(s.target);
991
- if (!n) return;
992
- const r = n.getAttribute("href");
1001
+ const s = this.findClosestLink(i.target);
1002
+ if (!s) return;
1003
+ const r = s.getAttribute("href");
993
1004
  if (!r || !r.startsWith("http")) return;
994
1005
  const o = new URL(r);
995
1006
  if (o.hostname !== window.location.hostname && e.includes(o.hostname)) {
996
1007
  const l = (c = this.cookieManager) == null ? void 0 : c.get(t);
997
- l && (o.searchParams.append("_um", l), n.setAttribute("href", o.toString()));
1008
+ l && (o.searchParams.append("_um", l), s.setAttribute("href", o.toString()));
998
1009
  }
999
1010
  }), this.logger.debug("Cross-domain linking initialized");
1000
1011
  }
@@ -1006,29 +1017,29 @@ class C {
1006
1017
  initializeTransport(e) {
1007
1018
  const t = "https://events.usermaven.com";
1008
1019
  if (!u())
1009
- return new Pe(e.trackingHost || t, e);
1010
- const s = "XMLHttpRequest" in window, n = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
1020
+ return new Ee(e.trackingHost || t, e);
1021
+ const i = "XMLHttpRequest" in window, s = typeof fetch < "u", r = typeof navigator < "u" && "sendBeacon" in navigator;
1011
1022
  if (e.useBeaconApi && r)
1012
1023
  return new ke(e.trackingHost || t, e, this.logger);
1013
- if (e.forceUseFetch && n)
1024
+ if (e.forceUseFetch && s)
1014
1025
  return new z(e.trackingHost || t, e, this.logger);
1015
- if (s)
1026
+ if (i)
1016
1027
  return new ve(e.trackingHost || t, e, this.logger);
1017
- if (n)
1028
+ if (s)
1018
1029
  return new z(e.trackingHost || t, e, this.logger);
1019
1030
  throw new Error("No suitable transport method available");
1020
1031
  }
1021
1032
  initializePersistence() {
1022
- return this.config.disableEventPersistence || !u() ? new _e() : new X(`${this.namespace}_${this.config.key}`, this.logger);
1033
+ return this.config.disableEventPersistence || !u() ? new _e() : new K(`${this.namespace}_${this.config.key}`, this.logger);
1023
1034
  }
1024
1035
  getOrCreateAnonymousId() {
1025
- var s, n;
1036
+ var i, s;
1026
1037
  if (!u())
1027
1038
  return x();
1028
1039
  if (this.config.privacyPolicy === "strict" || this.config.cookiePolicy === "strict")
1029
1040
  return "";
1030
1041
  const e = this.config.cookieName || `__eventn_id_${this.config.key}`;
1031
- let t = (s = this.cookieManager) == null ? void 0 : s.get(e);
1042
+ let t = (i = this.cookieManager) == null ? void 0 : i.get(e);
1032
1043
  if (!t) {
1033
1044
  if (this.config.crossDomainLinking) {
1034
1045
  const c = new URLSearchParams(window.location.search).get("_um"), a = window.location.hash.substring(1).split("~"), h = a.length > 1 ? a[1] : void 0;
@@ -1036,7 +1047,7 @@ class C {
1036
1047
  }
1037
1048
  t || (t = x());
1038
1049
  const r = 365 * 10;
1039
- (n = this.cookieManager) == null || n.set(e, t, r, document.location.protocol !== "http:", !1);
1050
+ (s = this.cookieManager) == null || s.set(e, t, r, document.location.protocol !== "http:", !1);
1040
1051
  }
1041
1052
  return t;
1042
1053
  }
@@ -1047,20 +1058,20 @@ class C {
1047
1058
  throw new Error("Invalid email provided");
1048
1059
  if (!e.id || !F(e.id))
1049
1060
  throw new Error("User ID must be a string");
1050
- const s = e.id;
1051
- if (this.persistence.set("userId", s), this.persistence.set("userProps", e), !t) {
1052
- const n = {
1061
+ const i = e.id;
1062
+ if (this.persistence.set("userId", i), this.persistence.set("userProps", e), !t) {
1063
+ const s = {
1053
1064
  ...e,
1054
1065
  anonymous_id: this.anonymousId
1055
1066
  };
1056
- await this.track("user_identify", n);
1067
+ await this.track("user_identify", s);
1057
1068
  }
1058
1069
  this.logger.info("User identified:", e);
1059
1070
  }
1060
- track(e, t, s = !1) {
1061
- this.trackInternal(e, t, s);
1071
+ track(e, t, i = !1) {
1072
+ this.trackInternal(e, t, i);
1062
1073
  }
1063
- trackInternal(e, t, s = !1) {
1074
+ trackInternal(e, t, i = !1) {
1064
1075
  if (me()) {
1065
1076
  this.logger.debug("Tracking disabled due to um_exclusion setting");
1066
1077
  return;
@@ -1071,7 +1082,7 @@ class C {
1071
1082
  throw new Error("Event payload must be a non-null object and not an array");
1072
1083
  const r = this.createEventPayload(e, t);
1073
1084
  try {
1074
- if (s) {
1085
+ if (i) {
1075
1086
  this.transport.send(r), this.logger.debug(`Event sent: ${e}`, [r]);
1076
1087
  return;
1077
1088
  }
@@ -1093,16 +1104,16 @@ class C {
1093
1104
  this.persistence.set("companyProps", e), t || await this.track("group", e), this.logger.info("Company identified:", e);
1094
1105
  }
1095
1106
  createEventPayload(e, t) {
1096
- const s = this.persistence.get("userProps") || {}, n = this.persistence.get("companyProps") || (s == null ? void 0 : s.company) || {}, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, c = this.persistence.get(`props_${e}`) || {};
1107
+ const i = this.persistence.get("userProps") || {}, s = this.persistence.get("companyProps") || (i == null ? void 0 : i.company) || {}, r = this.persistence.get("userId"), o = this.persistence.get("global_props") || {}, c = this.persistence.get(`props_${e}`) || {};
1097
1108
  let l = t || {};
1098
1109
  const a = {
1099
1110
  event_id: "",
1100
1111
  user: {
1101
1112
  anonymous_id: this.anonymousId,
1102
1113
  id: r,
1103
- ...s
1114
+ ...i
1104
1115
  },
1105
- ...n && { company: n },
1116
+ ...s && { company: s },
1106
1117
  ids: this.getThirdPartyIds(),
1107
1118
  utc_time: (/* @__PURE__ */ new Date()).toISOString(),
1108
1119
  local_tz_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
@@ -1123,9 +1134,9 @@ class C {
1123
1134
  }
1124
1135
  processAutocaptureAttributes(e) {
1125
1136
  let t = {};
1126
- const s = e.$elements || [];
1127
- return s.length && (t = { ...s[0] }), t.el_text = t.$el_text || "", t.event_type = e.$event_type || "", ["$ce_version", "$event_type", "$initial_referrer", "$initial_referring_domain", "$referrer", "$referring_domain", "$elements"].forEach((n) => {
1128
- delete t[n];
1137
+ const i = e.$elements || [];
1138
+ return i.length && (t = { ...i[0] }), t.el_text = t.$el_text || "", t.event_type = e.$event_type || "", ["$ce_version", "$event_type", "$initial_referrer", "$initial_referring_domain", "$referrer", "$referring_domain", "$elements"].forEach((s) => {
1139
+ delete t[s];
1129
1140
  }), delete t.$el_text, delete t.nth_child, delete t.nth_of_type, t;
1130
1141
  }
1131
1142
  getCookie(e) {
@@ -1142,8 +1153,8 @@ class C {
1142
1153
  }
1143
1154
  getUtmParams() {
1144
1155
  const e = {}, t = ge(window.location.search);
1145
- return ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"].forEach((n) => {
1146
- t[n] && (e[n.replace("utm_", "")] = t[n]);
1156
+ return ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"].forEach((s) => {
1157
+ t[s] && (e[s.replace("utm_", "")] = t[s]);
1147
1158
  }), e;
1148
1159
  }
1149
1160
  pageview() {
@@ -1156,7 +1167,7 @@ class C {
1156
1167
  setupPageLeaveTracking() {
1157
1168
  if (!u()) return;
1158
1169
  let e = !1, t = !1;
1159
- const s = () => {
1170
+ const i = () => {
1160
1171
  !e && !t && (e = !0, this.track("$pageleave", {
1161
1172
  url: window.location.href,
1162
1173
  referrer: document.referrer,
@@ -1168,12 +1179,12 @@ class C {
1168
1179
  t = !1;
1169
1180
  }, 100);
1170
1181
  }), document.addEventListener("visibilitychange", () => {
1171
- document.visibilityState === "hidden" && !t && s();
1182
+ document.visibilityState === "hidden" && !t && i();
1172
1183
  });
1173
- const n = history.pushState;
1184
+ const s = history.pushState;
1174
1185
  history.pushState = function() {
1175
- return s(), n.apply(this, arguments);
1176
- }, window.addEventListener("popstate", s);
1186
+ return i(), s.apply(this, arguments);
1187
+ }, window.addEventListener("popstate", i);
1177
1188
  }
1178
1189
  getConfig() {
1179
1190
  return this.config;
@@ -1191,18 +1202,18 @@ class C {
1191
1202
  set(e, t) {
1192
1203
  if (!v(e))
1193
1204
  throw new Error("Properties must be an object");
1194
- const s = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1195
- if (s) {
1196
- let r = this.persistence.get(`props_${s}`) || {};
1197
- r = { ...r, ...e }, this.persistence.set(`props_${s}`, r);
1205
+ const i = t == null ? void 0 : t.eventType, s = (t == null ? void 0 : t.persist) ?? !0;
1206
+ if (i) {
1207
+ let r = this.persistence.get(`props_${i}`) || {};
1208
+ r = { ...r, ...e }, this.persistence.set(`props_${i}`, r);
1198
1209
  } else {
1199
1210
  let r = this.persistence.get("global_props") || {};
1200
1211
  r = { ...r, ...e }, this.persistence.set("global_props", r);
1201
1212
  }
1202
- n && this.persistence.save(), this.logger.debug("Properties set", {
1213
+ s && this.persistence.save(), this.logger.debug("Properties set", {
1203
1214
  properties: e,
1204
- eventType: s || "global",
1205
- persist: n
1215
+ eventType: i || "global",
1216
+ persist: s
1206
1217
  });
1207
1218
  }
1208
1219
  setUserId(e) {
@@ -1211,127 +1222,129 @@ class C {
1211
1222
  t.id = e, this.persistence.set("userProps", t), this.persistence.save();
1212
1223
  }
1213
1224
  unset(e, t) {
1214
- const s = t == null ? void 0 : t.eventType, n = (t == null ? void 0 : t.persist) ?? !0;
1215
- if (s) {
1216
- let r = this.persistence.get(`props_${s}`) || {};
1217
- delete r[e], this.persistence.set(`props_${s}`, r);
1225
+ const i = t == null ? void 0 : t.eventType, s = (t == null ? void 0 : t.persist) ?? !0;
1226
+ if (i) {
1227
+ let r = this.persistence.get(`props_${i}`) || {};
1228
+ delete r[e], this.persistence.set(`props_${i}`, r);
1218
1229
  } else {
1219
1230
  let r = this.persistence.get("global_props") || {};
1220
1231
  delete r[e], this.persistence.set("global_props", r);
1221
1232
  }
1222
- n && this.persistence.save(), this.logger.debug(`Property unset: ${e}`, `Event type: ${s || "global"}`);
1233
+ s && this.persistence.save(), this.logger.debug(`Property unset: ${e}`, `Event type: ${i || "global"}`);
1223
1234
  }
1224
1235
  }
1225
- function K() {
1236
+ function X() {
1226
1237
  return typeof window < "u" && typeof window.define == "function" && window.define.amd;
1227
1238
  }
1228
- function Ee() {
1229
- return K() ? window.define : void 0;
1239
+ function Pe() {
1240
+ return X() ? window.define : void 0;
1230
1241
  }
1231
- function T(i) {
1232
- const e = JSON.parse(JSON.stringify(i)), t = R(e), s = { ...q, ...t };
1233
- if (!s.key)
1242
+ const Ae = "__USERMAVEN_AUTOCAPTURE_INITIALIZED__";
1243
+ function C(n) {
1244
+ const e = JSON.parse(JSON.stringify(n)), t = I(e), i = { ...q, ...t };
1245
+ if (!i.key)
1234
1246
  throw new Error("API key is required!");
1235
- if (!s.trackingHost)
1247
+ if (!i.trackingHost)
1236
1248
  throw new Error("Tracking host is required!");
1237
- return new C(s);
1249
+ const s = i.key || "", r = `${Ae}${s}`;
1250
+ return u() && i.autocapture && window[r] && (console.warn("Usermaven: Autocapture already initialized in another instance, skipping duplicate initialization."), i.disableAutocaptureListenerRegistration = !0), u() && i.autocapture && !i.disableAutocaptureListenerRegistration && (window[r] = !0), new S(i);
1238
1251
  }
1239
- function $e(i) {
1240
- var n;
1252
+ function $e(n) {
1253
+ var s;
1241
1254
  const e = {
1242
- key: i.getAttribute("data-key") || void 0,
1243
- trackingHost: i.getAttribute("data-tracking-host") || "https://events.usermaven.com",
1244
- logLevel: pe(i.getAttribute("data-log-level")),
1245
- autocapture: i.getAttribute("data-autocapture") === "true",
1246
- formTracking: i.getAttribute("data-form-tracking") === "false" ? !1 : i.getAttribute("data-form-tracking") === "true" ? "all" : i.getAttribute("data-form-tracking"),
1247
- autoPageview: i.getAttribute("data-auto-pageview") === "true",
1248
- useBeaconApi: i.getAttribute("data-use-beacon-api") === "true",
1249
- forceUseFetch: i.getAttribute("data-force-use-fetch") === "true",
1250
- gaHook: i.getAttribute("data-ga-hook") === "true",
1251
- segmentHook: i.getAttribute("data-segment-hook") === "true",
1252
- randomizeUrl: i.getAttribute("data-randomize-url") === "true",
1253
- capture3rdPartyCookies: i.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
1254
- idMethod: i.getAttribute("data-id-method") || void 0,
1255
- privacyPolicy: i.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
1256
- ipPolicy: i.getAttribute("data-ip-policy") || void 0,
1257
- cookiePolicy: i.getAttribute("data-cookie-policy") || void 0,
1258
- minSendTimeout: parseInt(i.getAttribute("data-min-send-timeout") || "", 10) || void 0,
1259
- maxSendTimeout: parseInt(i.getAttribute("data-max-send-timeout") || "", 10) || void 0,
1260
- maxSendAttempts: parseInt(i.getAttribute("data-max-send-attempts") || "", 10) || void 0,
1261
- propertiesStringMaxLength: parseInt(i.getAttribute("data-properties-string-max-length") || "", 10) || null,
1262
- propertyBlacklist: ((n = i.getAttribute("data-property-blacklist")) == null ? void 0 : n.split(",")) || void 0,
1263
- exclude: i.getAttribute("data-exclude") || void 0,
1264
- namespace: i.getAttribute("data-namespace") || void 0,
1265
- crossDomainLinking: i.getAttribute("data-cross-domain-linking") !== "false",
1266
- domains: i.getAttribute("data-domains") || void 0,
1267
- maskAllText: i.getAttribute("data-mask-all-text") === "true",
1268
- maskAllElementAttributes: i.getAttribute("data-mask-all-element-attributes") === "true"
1255
+ key: n.getAttribute("data-key") || void 0,
1256
+ trackingHost: n.getAttribute("data-tracking-host") || "https://events.usermaven.com",
1257
+ logLevel: pe(n.getAttribute("data-log-level")),
1258
+ autocapture: n.getAttribute("data-autocapture") === "true",
1259
+ formTracking: n.getAttribute("data-form-tracking") === "false" ? !1 : n.getAttribute("data-form-tracking") === "true" ? "all" : n.getAttribute("data-form-tracking"),
1260
+ autoPageview: n.getAttribute("data-auto-pageview") === "true",
1261
+ useBeaconApi: n.getAttribute("data-use-beacon-api") === "true",
1262
+ forceUseFetch: n.getAttribute("data-force-use-fetch") === "true",
1263
+ gaHook: n.getAttribute("data-ga-hook") === "true",
1264
+ segmentHook: n.getAttribute("data-segment-hook") === "true",
1265
+ randomizeUrl: n.getAttribute("data-randomize-url") === "true",
1266
+ capture3rdPartyCookies: n.getAttribute("data-capture-3rd-party-cookies") === "false" ? !1 : void 0,
1267
+ idMethod: n.getAttribute("data-id-method") || void 0,
1268
+ privacyPolicy: n.getAttribute("data-privacy-policy") === "strict" ? "strict" : void 0,
1269
+ ipPolicy: n.getAttribute("data-ip-policy") || void 0,
1270
+ cookiePolicy: n.getAttribute("data-cookie-policy") || void 0,
1271
+ minSendTimeout: parseInt(n.getAttribute("data-min-send-timeout") || "", 10) || void 0,
1272
+ maxSendTimeout: parseInt(n.getAttribute("data-max-send-timeout") || "", 10) || void 0,
1273
+ maxSendAttempts: parseInt(n.getAttribute("data-max-send-attempts") || "", 10) || void 0,
1274
+ propertiesStringMaxLength: parseInt(n.getAttribute("data-properties-string-max-length") || "", 10) || null,
1275
+ propertyBlacklist: ((s = n.getAttribute("data-property-blacklist")) == null ? void 0 : s.split(",")) || void 0,
1276
+ exclude: n.getAttribute("data-exclude") || void 0,
1277
+ namespace: n.getAttribute("data-namespace") || void 0,
1278
+ crossDomainLinking: n.getAttribute("data-cross-domain-linking") !== "false",
1279
+ domains: n.getAttribute("data-domains") || void 0,
1280
+ maskAllText: n.getAttribute("data-mask-all-text") === "true",
1281
+ maskAllElementAttributes: n.getAttribute("data-mask-all-element-attributes") === "true"
1269
1282
  };
1270
1283
  e.privacyPolicy === "strict" && (e.cookiePolicy = "strict", e.ipPolicy = "strict"), e.cookiePolicy === "comply" && e.useBeaconApi && (e.cookiePolicy = "strict");
1271
- const t = T(e), s = e.namespace || "usermaven";
1272
- return u() && e.autoPageview !== !1 && t.pageview(), Se(s, t), t;
1284
+ const t = C(e), i = e.namespace || "usermaven";
1285
+ return u() && e.autoPageview !== !1 && t.pageview(), Se(i, t), t;
1273
1286
  }
1274
- function Se(i, e) {
1287
+ function Se(n, e) {
1275
1288
  let t = !1;
1276
- const s = [], n = [];
1289
+ const i = [], s = [];
1277
1290
  function r() {
1278
- for (; s.length > 0; ) {
1279
- const a = s.shift();
1280
- a && window[i].apply(null, a);
1291
+ for (; i.length > 0; ) {
1292
+ const a = i.shift();
1293
+ a && window[n].apply(null, a);
1281
1294
  }
1282
1295
  }
1283
1296
  function o() {
1284
- n.forEach((a) => a()), n.length = 0;
1297
+ s.forEach((a) => a()), s.length = 0;
1285
1298
  }
1286
- window[i] = function(...a) {
1299
+ window[n] = function(...a) {
1287
1300
  const h = a[0];
1288
1301
  if (h === "onLoad") {
1289
- typeof a[1] == "function" && (t ? a[1]() : n.push(a[1]));
1302
+ typeof a[1] == "function" && (t ? a[1]() : s.push(a[1]));
1290
1303
  return;
1291
1304
  }
1292
1305
  if (!t) {
1293
- s.push(a);
1306
+ i.push(a);
1294
1307
  return;
1295
1308
  }
1296
1309
  if (typeof e[h] == "function")
1297
1310
  return e[h].apply(e, a.slice(1));
1298
1311
  console.error(`Method ${h} not found on UsermavenClient`);
1299
1312
  };
1300
- const c = `${i}Q`, l = window[c] || [];
1313
+ const c = `${n}Q`, l = window[c] || [];
1301
1314
  for (window[c] = l, l.push = function(...a) {
1302
- return window[i].apply(null, a), Array.prototype.push.apply(this, a);
1315
+ return window[n].apply(null, a), Array.prototype.push.apply(this, a);
1303
1316
  }, setTimeout(() => {
1304
- t = !0, r(), o(), console.log(`Usermaven client for namespace ${i} is ready`);
1317
+ t = !0, r(), o(), console.log(`Usermaven client for namespace ${n} is ready`);
1305
1318
  }, 0); l.length > 0; ) {
1306
1319
  const a = l.shift();
1307
- a && s.push(a);
1320
+ a && i.push(a);
1308
1321
  }
1309
1322
  }
1310
- let B = !1, H = null;
1323
+ let M = !1, H = null;
1311
1324
  if (u()) {
1312
- const i = Ee();
1313
- i && i("usermaven", [], function() {
1325
+ const n = Pe();
1326
+ n && n("usermaven", [], function() {
1314
1327
  return {
1315
- usermavenClient: T,
1316
- UsermavenClient: C,
1328
+ usermavenClient: C,
1329
+ UsermavenClient: S,
1317
1330
  LogLevel: p,
1318
1331
  // Expose the script tag client if it exists
1319
1332
  getScriptTagClient: () => H
1320
1333
  };
1321
- }), typeof window < "u" && (window.usermavenClient = T, window.UsermavenClient = C, window.usermavenScriptTagClient = () => H), function(e, t) {
1322
- const s = e.currentScript;
1323
- function n() {
1324
- return B || !s || !s.hasAttribute("data-key") || s.getAttribute("data-no-auto-init") === "true" ? !1 : s.src.includes("lib.js");
1334
+ }), typeof window < "u" && (window.usermavenClient = C, window.UsermavenClient = S, window.usermavenScriptTagClient = () => H), function(e, t) {
1335
+ const i = e.currentScript;
1336
+ function s() {
1337
+ return M || !i || !i.hasAttribute("data-key") || i.getAttribute("data-no-auto-init") === "true" ? !1 : i.src.includes("lib.js");
1325
1338
  }
1326
1339
  function r() {
1327
- n() && (console.log("[Usermaven] Auto-initializing from script tag"), H = $e(s), B = !0);
1340
+ s() && (console.log("[Usermaven] Auto-initializing from script tag"), H = $e(i), M = !0);
1328
1341
  }
1329
- typeof t < "u" && s && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
1342
+ typeof t < "u" && i && (e.readyState === "loading" ? e.addEventListener("DOMContentLoaded", r) : r());
1330
1343
  }(document, window);
1331
1344
  }
1332
- typeof module < "u" && module.exports && !K() && (module.exports = {
1333
- usermavenClient: T,
1334
- UsermavenClient: C,
1345
+ typeof module < "u" && module.exports && !X() && (module.exports = {
1346
+ usermavenClient: C,
1347
+ UsermavenClient: S,
1335
1348
  Config: void 0,
1336
1349
  UserProps: void 0,
1337
1350
  EventPayload: void 0,
@@ -1340,6 +1353,6 @@ typeof module < "u" && module.exports && !K() && (module.exports = {
1340
1353
  });
1341
1354
  export {
1342
1355
  p as LogLevel,
1343
- C as UsermavenClient,
1344
- T as usermavenClient
1356
+ S as UsermavenClient,
1357
+ C as usermavenClient
1345
1358
  };