@sailfish-ai/sf-veritas 0.1.21 → 0.1.23

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,77 +1,78 @@
1
- var E = Object.defineProperty;
2
- var L = (r, e, i) => e in r ? E(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
3
- var c = (r, e, i) => L(r, typeof e != "symbol" ? e + "" : e, i);
4
- import { AsyncLocalStorage as R } from "async_hooks";
5
- import { Worker as $ } from "worker_threads";
6
- const A = [];
7
- for (let r = 0; r < 256; ++r) A.push((r + 256).toString(16).slice(1));
8
- let H;
9
- const F = new Uint8Array(16), D = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
10
- function f(r, e, i) {
11
- if (D.randomUUID && !r) return D.randomUUID();
12
- const t = (r = r || {}).random ?? r.rng?.() ?? function() {
13
- if (!H) {
1
+ var He = Object.defineProperty;
2
+ var Ye = (s, r, g) => r in s ? He(s, r, { enumerable: !0, configurable: !0, writable: !0, value: g }) : s[r] = g;
3
+ var b = (s, r, g) => Ye(s, typeof r != "symbol" ? r + "" : r, g);
4
+ import { AsyncLocalStorage as Se } from "async_hooks";
5
+ import { readFileSync as Be } from "fs";
6
+ import { Worker as _e } from "worker_threads";
7
+ const G = [];
8
+ for (let s = 0; s < 256; ++s) G.push((s + 256).toString(16).slice(1));
9
+ let j;
10
+ const Xe = new Uint8Array(16), ae = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
11
+ function X(s, r, g) {
12
+ if (ae.randomUUID && !s) return ae.randomUUID();
13
+ const u = (s = s || {}).random ?? s.rng?.() ?? function() {
14
+ if (!j) {
14
15
  if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
15
- H = crypto.getRandomValues.bind(crypto);
16
+ j = crypto.getRandomValues.bind(crypto);
16
17
  }
17
- return H(F);
18
+ return j(Xe);
18
19
  }();
19
- if (t.length < 16) throw new Error("Random bytes length must be >= 16");
20
- return t[6] = 15 & t[6] | 64, t[8] = 63 & t[8] | 128, function(n, s = 0) {
21
- return (A[n[s + 0]] + A[n[s + 1]] + A[n[s + 2]] + A[n[s + 3]] + "-" + A[n[s + 4]] + A[n[s + 5]] + "-" + A[n[s + 6]] + A[n[s + 7]] + "-" + A[n[s + 8]] + A[n[s + 9]] + "-" + A[n[s + 10]] + A[n[s + 11]] + A[n[s + 12]] + A[n[s + 13]] + A[n[s + 14]] + A[n[s + 15]]).toLowerCase();
22
- }(t);
23
- }
24
- class T {
25
- constructor(e) {
26
- c(this, "apiKey");
27
- c(this, "apiGraphqlEndpoint");
28
- c(this, "sfDebug");
29
- c(this, "serviceIdentifier");
30
- c(this, "serviceVersion");
31
- c(this, "serviceUUID");
32
- c(this, "serviceAdditionalMetadata");
33
- c(this, "profilingModeEnabled");
34
- c(this, "profilingMaxDepth");
35
- c(this, "profilingMaxVariableSizeKb");
36
- c(this, "domainsToNotPropagateHeadersTo");
37
- c(this, "nodeModulesToCollectLocalVariablesOn");
38
- c(this, "printConfigurationStatuses");
39
- c(this, "logLevel");
40
- c(this, "stackDepthLocals");
41
- c(this, "stackDepthCodeTraceDepth");
42
- c(this, "packageLibraryType");
43
- c(this, "version");
44
- c(this, "_serviceIdentificationReceived", !1);
45
- this.apiKey = e.apiKey, this.apiGraphqlEndpoint = e?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = e?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = e?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = f(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.serviceAdditionalMetadata = e?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = e?.profilingModeEnabled ?? !1, this.profilingMaxDepth = e?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = e?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = e?.domainsToNotPropagateHeadersTo || [], this.nodeModulesToCollectLocalVariablesOn = e?.nodeModulesToCollectLocalVariablesOn || [], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "NEXT JS/TS", this.version = this.getPackageVersion();
20
+ if (u.length < 16) throw new Error("Random bytes length must be >= 16");
21
+ return u[6] = 15 & u[6] | 64, u[8] = 63 & u[8] | 128, function(o, n = 0) {
22
+ return (G[o[n + 0]] + G[o[n + 1]] + G[o[n + 2]] + G[o[n + 3]] + "-" + G[o[n + 4]] + G[o[n + 5]] + "-" + G[o[n + 6]] + G[o[n + 7]] + "-" + G[o[n + 8]] + G[o[n + 9]] + "-" + G[o[n + 10]] + G[o[n + 11]] + G[o[n + 12]] + G[o[n + 13]] + G[o[n + 14]] + G[o[n + 15]]).toLowerCase();
23
+ }(u);
24
+ }
25
+ class Je {
26
+ constructor(r) {
27
+ b(this, "apiKey");
28
+ b(this, "apiGraphqlEndpoint");
29
+ b(this, "sfDebug");
30
+ b(this, "serviceIdentifier");
31
+ b(this, "serviceVersion");
32
+ b(this, "serviceUUID");
33
+ b(this, "serviceAdditionalMetadata");
34
+ b(this, "profilingModeEnabled");
35
+ b(this, "profilingMaxDepth");
36
+ b(this, "profilingMaxVariableSizeKb");
37
+ b(this, "domainsToNotPropagateHeadersTo");
38
+ b(this, "nodeModulesToCollectLocalVariablesOn");
39
+ b(this, "printConfigurationStatuses");
40
+ b(this, "logLevel");
41
+ b(this, "stackDepthLocals");
42
+ b(this, "stackDepthCodeTraceDepth");
43
+ b(this, "packageLibraryType");
44
+ b(this, "version");
45
+ b(this, "_serviceIdentificationReceived", !1);
46
+ this.apiKey = r.apiKey, this.apiGraphqlEndpoint = r?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = r?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = r?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = X(), this.serviceVersion = r?.serviceVersion || process.env.SERVICE_VERSION, this.serviceAdditionalMetadata = r?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = r?.profilingModeEnabled ?? !1, this.profilingMaxDepth = r?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = r?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = r?.domainsToNotPropagateHeadersTo || [], this.nodeModulesToCollectLocalVariablesOn = r?.nodeModulesToCollectLocalVariablesOn || ["_all_"], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "JS/TS BACKEND", this.version = this.getPackageVersion();
46
47
  }
47
48
  getPackageVersion() {
48
- return "0.1.14";
49
+ return "0.1.15";
49
50
  }
50
51
  get serviceIdentificationReceived() {
51
52
  return this._serviceIdentificationReceived;
52
53
  }
53
- setServiceIdentificationReceived(e) {
54
- this._serviceIdentificationReceived = e;
54
+ setServiceIdentificationReceived(r) {
55
+ this._serviceIdentificationReceived = r;
55
56
  }
56
57
  }
57
- let V;
58
- function o() {
59
- if (!V) throw new Error("Configuration has not been initialized.");
60
- return V;
58
+ let z;
59
+ function A() {
60
+ if (!z) throw new Error("Configuration has not been initialized.");
61
+ return z;
61
62
  }
62
- new R();
63
- const J = new R(), X = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1 }, y = class y {
63
+ new Se();
64
+ const Q = new Se(), ce = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1 }, V = class V {
64
65
  constructor() {
65
66
  }
66
67
  static getInstance() {
67
- return y.instance || (y.instance = new y()), y.instance;
68
+ return V.instance || (V.instance = new V()), V.instance;
68
69
  }
69
70
  getCurrentContext() {
70
- return J.getStore() || X;
71
+ return Q.getStore() || ce;
71
72
  }
72
- setCurrentContext(e) {
73
- const i = J.getStore() || X;
74
- J.enterWith({ ...i, ...e });
73
+ setCurrentContext(r) {
74
+ const g = Q.getStore() || ce;
75
+ Q.enterWith({ ...g, ...r });
75
76
  }
76
77
  getTraceId() {
77
78
  return this.getCurrentContext().traceId;
@@ -79,106 +80,106 @@ const J = new R(), X = { handledExceptions: /* @__PURE__ */ new Set(), reentranc
79
80
  getPageVisitUUID() {
80
81
  return this.getCurrentContext().pageVisitUUID;
81
82
  }
82
- setTraceId(e) {
83
- this.setCurrentContext({ traceId: e });
83
+ setTraceId(r) {
84
+ this.setCurrentContext({ traceId: r });
84
85
  }
85
- setPageVisitUUID(e) {
86
- this.setCurrentContext({ pageVisitUUID: e });
86
+ setPageVisitUUID(r) {
87
+ this.setCurrentContext({ pageVisitUUID: r });
87
88
  }
88
- getOrSetSfTraceId(e, i = !1) {
89
- let t = this.getTraceId();
90
- return t || (t = e || (i ? f() : `nonsession-applogs-v3/${o().apiKey}/${f()}`), this.setTraceId(t), o().sfDebug && console.log(" Created new trace ID:", t), t);
89
+ getOrSetSfTraceId(r, g = !1) {
90
+ let u = this.getTraceId();
91
+ return u || (u = r || (g ? X() : `nonsession-applogs-v3/${A().apiKey}/${X()}`), this.setTraceId(u), A().sfDebug && console.log(" Created new trace ID:", u), u);
91
92
  }
92
93
  getOrSetPageVisitUUID() {
93
- let e = this.getPageVisitUUID();
94
- return e || (e = f(), this.setPageVisitUUID(e), o().sfDebug && console.log(" Created new page visit UUID:", e), e);
94
+ let r = this.getPageVisitUUID();
95
+ return r || (r = X(), this.setPageVisitUUID(r), A().sfDebug && console.log(" Created new page visit UUID:", r), r);
95
96
  }
96
97
  getHandledExceptions() {
97
98
  return this.getCurrentContext().handledExceptions;
98
99
  }
99
- markExceptionHandled(e) {
100
- const i = this.getHandledExceptions();
101
- i.add(e), this.setCurrentContext({ handledExceptions: i });
100
+ markExceptionHandled(r) {
101
+ const g = this.getHandledExceptions();
102
+ g.add(r), this.setCurrentContext({ handledExceptions: g });
102
103
  }
103
- hasHandledException(e) {
104
- return this.getHandledExceptions().has(e);
104
+ hasHandledException(r) {
105
+ return this.getHandledExceptions().has(r);
105
106
  }
106
107
  resetHandledExceptions() {
107
108
  this.setCurrentContext({ handledExceptions: /* @__PURE__ */ new Set() });
108
109
  }
109
110
  };
110
- c(y, "instance");
111
- let W = y;
112
- class S {
111
+ b(V, "instance");
112
+ let O = V;
113
+ class L {
113
114
  constructor() {
114
- c(this, "apiKey");
115
- c(this, "endpoint");
116
- c(this, "queryType", "mutation");
117
- c(this, "operationName", "");
118
- c(this, "serviceUUID", o().serviceUUID);
119
- c(this, "contextManager");
120
- this.apiKey = o().apiKey, this.endpoint = o().apiGraphqlEndpoint, this.contextManager = W.getInstance();
115
+ b(this, "apiKey");
116
+ b(this, "endpoint");
117
+ b(this, "queryType", "mutation");
118
+ b(this, "operationName", "");
119
+ b(this, "serviceUUID", A().serviceUUID);
120
+ b(this, "contextManager");
121
+ this.apiKey = A().apiKey, this.endpoint = A().apiGraphqlEndpoint, this.contextManager = O.getInstance();
121
122
  }
122
123
  get queryName() {
123
124
  return this.operationName ? this.operationName.charAt(0).toLowerCase() + this.operationName.slice(1) : "";
124
125
  }
125
126
  getDefaultVariables() {
126
- const e = Date.now().toString(), i = this.contextManager.getOrSetSfTraceId();
127
- return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId: i, timestampMs: e };
127
+ const r = Date.now().toString(), g = this.contextManager.getOrSetSfTraceId();
128
+ return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId: g, timestampMs: r };
128
129
  }
129
- getVariables(e = {}) {
130
- return { ...this.getDefaultVariables(), ...e };
130
+ getVariables(r = {}) {
131
+ return { ...this.getDefaultVariables(), ...r };
131
132
  }
132
- setOperationName(e) {
133
- this.operationName = e;
133
+ setOperationName(r) {
134
+ this.operationName = r;
134
135
  }
135
- setEndpoint(e) {
136
- this.endpoint = e;
136
+ setEndpoint(r) {
137
+ this.endpoint = r;
137
138
  }
138
- setServiceUUID(e) {
139
- this.serviceUUID = e;
139
+ setServiceUUID(r) {
140
+ this.serviceUUID = r;
140
141
  }
141
142
  }
142
- const z = fetch;
143
- async function Z(r, e, i, t) {
143
+ const Ke = fetch;
144
+ async function R(s, r, g, u) {
144
145
  try {
145
- const n = o();
146
- let s;
146
+ const o = A();
147
+ let n;
147
148
  try {
148
- s = JSON.stringify({ query: i, variables: t, operationName: e });
149
+ n = JSON.stringify({ query: g, variables: u, operationName: r });
149
150
  } catch {
150
- s = JSON.stringify({ query: i, operationName: e });
151
- }
152
- z(r, { method: "POST", headers: { "Content-Type": "application/json" }, body: s }).then(async (a) => {
153
- if (!a.ok) return void (n.sfDebug && console.error(`GraphQL request failed with status ${a.status} for ${e}`));
154
- const d = await a.json();
155
- d.errors?.length ? function(I, C, l) {
156
- const g = I && typeof I == "object" && !Array.isArray(I) ? Object.keys(I)[0] : void 0;
157
- console.error(g === "identifyServiceDetails" ? `IdentifyServiceDetails NOT sent successfully for service: UUID=${l.serviceUUID}` : `GraphQL request failed with errors: ${JSON.stringify(C)} for operation key ${g}`);
158
- }(d.data, d.errors, n) : n.sfDebug && function(I, C, l) {
159
- const g = I && typeof I == "object" && !Array.isArray(I) ? Object.keys(I)[0] : void 0, p = I[g] || !1;
160
- g === "identifyServiceDetails" && (l.setServiceIdentificationReceived(p), o().sfDebug && console.log(`IdentifyServiceDetails sent successfully for service: UUID=${l.serviceUUID}; serviceIdentificationReceived=${g === "identifyServiceDetails" ? p : "N/A"}`));
161
- }(d.data, 0, n);
162
- }).catch((a) => {
163
- n.sfDebug && console.error("Fetch error:", a);
151
+ n = JSON.stringify({ query: g, operationName: r });
152
+ }
153
+ Ke(s, { method: "POST", headers: { "Content-Type": "application/json" }, body: n }).then(async (i) => {
154
+ if (!i.ok) return void (o.sfDebug && console.error(`GraphQL request failed with status ${i.status} for ${r}`));
155
+ const l = await i.json();
156
+ l.errors?.length ? function(p, C, h) {
157
+ const a = p && typeof p == "object" && !Array.isArray(p) ? Object.keys(p)[0] : void 0;
158
+ console.error(a === "identifyServiceDetails" ? `IdentifyServiceDetails NOT sent successfully for service: UUID=${h.serviceUUID}` : `GraphQL request failed with errors: ${JSON.stringify(C)} for operation key ${a}`);
159
+ }(l.data, l.errors, o) : o.sfDebug && function(p, C, h) {
160
+ const a = p && typeof p == "object" && !Array.isArray(p) ? Object.keys(p)[0] : void 0, d = p[a] || !1;
161
+ a === "identifyServiceDetails" && (h.setServiceIdentificationReceived(d), A().sfDebug && console.log(`IdentifyServiceDetails sent successfully for service: UUID=${h.serviceUUID}; serviceIdentificationReceived=${a === "identifyServiceDetails" ? d : "N/A"}`));
162
+ }(l.data, 0, o);
163
+ }).catch((i) => {
164
+ o.sfDebug && console.error("Fetch error:", i);
164
165
  });
165
- } catch (n) {
166
- o().sfDebug && console.error("Error sending data to GraphQL server:", n);
166
+ } catch (o) {
167
+ A().sfDebug && console.error("Error sending data to GraphQL server:", o);
167
168
  }
168
169
  }
169
- class w extends S {
170
+ class k extends L {
170
171
  constructor() {
171
172
  super(), this.setOperationName("IdentifyServiceDetails");
172
173
  }
173
- async doSend(e) {
174
- if (!o().serviceIdentificationReceived) try {
174
+ async doSend(r) {
175
+ if (!A().serviceIdentificationReceived) try {
175
176
  this.send();
176
- } catch (i) {
177
- o().sfDebug && console.error(" Error during service identification:", i);
177
+ } catch (g) {
178
+ A().sfDebug && console.error(" Error during service identification:", g);
178
179
  }
179
180
  }
180
181
  async send() {
181
- const e = `
182
+ const r = `
182
183
  ${this.queryType} ${this.operationName}(
183
184
  $apiKey: String!,
184
185
  $timestampMs: String!,
@@ -200,42 +201,42 @@ class w extends S {
200
201
  version: $version,
201
202
  )
202
203
  }
203
- `, i = this.getVariables({ serviceIdentifier: o().serviceIdentifier, serviceVersion: o().serviceVersion, library: o().packageLibraryType, version: o().version, serviceAdditionalMetadata: o().serviceAdditionalMetadata });
204
- Z(this.endpoint, this.operationName, e, i);
204
+ `, g = this.getVariables({ serviceIdentifier: A().serviceIdentifier, serviceVersion: A().serviceVersion, library: A().packageLibraryType, version: A().version, serviceAdditionalMetadata: A().serviceAdditionalMetadata });
205
+ R(this.endpoint, this.operationName, r, g);
205
206
  }
206
207
  }
207
- function O(r) {
208
+ function Le(s) {
208
209
  try {
209
- return JSON.stringify(r), !0;
210
+ return JSON.stringify(s), !0;
210
211
  } catch {
211
212
  return !1;
212
213
  }
213
214
  }
214
- class k extends S {
215
+ class Ue extends L {
215
216
  constructor() {
216
217
  super();
217
- c(this, "serviceIdentifier", new w());
218
+ b(this, "serviceIdentifier", new k());
218
219
  this.setOperationName("CollectMetadata");
219
220
  }
220
221
  async sendAppIdentifier() {
221
222
  this.serviceIdentifier.doSend({});
222
223
  }
223
- async doSend(i, t, n, s) {
224
- this.sendAppIdentifier(), this.send(i, t, n, s);
225
- }
226
- async send(i, t, n, s) {
227
- if (!t && !s) throw new Error('Must pass in either traits or traits_json to "add_or_update_traits"');
228
- let a = [];
229
- if (!s) {
230
- const I = function(C) {
231
- const l = {}, g = [];
232
- if (C) for (const [p, h] of Object.entries(C)) O(h) ? l[p] = h : g.push(p);
233
- return { traitsJson: JSON.stringify(l), excludedFields: g };
234
- }(t);
235
- s = I.traitsJson, a = I.excludedFields;
224
+ async doSend(g, u, o, n) {
225
+ this.sendAppIdentifier(), this.send(g, u, o, n);
226
+ }
227
+ async send(g, u, o, n) {
228
+ if (!u && !n) throw new Error('Must pass in either traits or traits_json to "add_or_update_traits"');
229
+ let i = [];
230
+ if (!n) {
231
+ const p = function(C) {
232
+ const h = {}, a = [];
233
+ if (C) for (const [d, e] of Object.entries(C)) Le(e) ? h[d] = e : a.push(d);
234
+ return { traitsJson: JSON.stringify(h), excludedFields: a };
235
+ }(u);
236
+ n = p.traitsJson, i = p.excludedFields;
236
237
  }
237
- const d = this.getVariables({ userId: i, traitsJson: s, excludedFields: a, override: n, library: o().packageLibraryType, version: o().version });
238
- Z(this.endpoint, this.operationName, this.getQuery(), d);
238
+ const l = this.getVariables({ userId: g, traitsJson: n, excludedFields: i, override: o, library: A().packageLibraryType, version: A().version });
239
+ R(this.endpoint, this.operationName, this.getQuery(), l);
239
240
  }
240
241
  getQuery() {
241
242
  return `
@@ -245,36 +246,36 @@ class k extends S {
245
246
  `;
246
247
  }
247
248
  }
248
- class U {
249
- constructor(e) {
250
- c(this, "metadataTransmitter");
251
- this.apiKey = e, this.metadataTransmitter = new k();
249
+ class We {
250
+ constructor(r) {
251
+ b(this, "metadataTransmitter");
252
+ this.apiKey = r, this.metadataTransmitter = new Ue();
252
253
  }
253
- identify(e, i, t, n = !1) {
254
- i || t ? this.addOrUpdateMetadata(e, i, t, n) : this.addOrUpdateMetadata(e, {}, void 0, n);
254
+ identify(r, g, u, o = !1) {
255
+ g || u ? this.addOrUpdateMetadata(r, g, u, o) : this.addOrUpdateMetadata(r, {}, void 0, o);
255
256
  }
256
- addOrUpdateMetadata(e, i = {}, t, n = !1) {
257
- if (!i && !t) throw new Error('Must pass in either traits or traitsJson to "addOrUpdateMetadata"');
258
- o().sfDebug && console.log(" [[DEBUG - addOrUpdateMetadata]] Starting operation"), o().sfDebug && console.log(" addOrUpdateMetadata...SENDING DATA...", e, i, t), this.metadataTransmitter.doSend(e, i, n, t);
257
+ addOrUpdateMetadata(r, g = {}, u, o = !1) {
258
+ if (!g && !u) throw new Error('Must pass in either traits or traitsJson to "addOrUpdateMetadata"');
259
+ A().sfDebug && console.log(" [[DEBUG - addOrUpdateMetadata]] Starting operation"), A().sfDebug && console.log(" addOrUpdateMetadata...SENDING DATA...", r, g, u), this.metadataTransmitter.doSend(r, g, o, u);
259
260
  }
260
261
  }
261
- class K extends S {
262
+ class se extends L {
262
263
  constructor() {
263
264
  super();
264
- c(this, "serviceIdentifier", new w());
265
+ b(this, "serviceIdentifier", new k());
265
266
  }
266
267
  async sendAppIdentifier() {
267
268
  this.serviceIdentifier.doSend({});
268
269
  }
269
- async doSend(i) {
270
- this.sendAppIdentifier(), this.send(i);
270
+ async doSend(g) {
271
+ this.sendAppIdentifier(), this.send(g);
271
272
  }
272
- async send(i) {
273
+ async send(g) {
273
274
  try {
274
- const t = Array.isArray(i) ? i : [i, "default"], n = this.getVariables({ contents: t[0], level: t[1] });
275
- Z(this.endpoint, this.operationName, this.getQuery(), n);
276
- } catch (t) {
277
- o().sfDebug && console.error("🚨 Error in send():", t);
275
+ const u = Array.isArray(g) ? g : [g, "default"], o = this.getVariables({ contents: u[0], level: u[1] });
276
+ R(this.endpoint, this.operationName, this.getQuery(), o);
277
+ } catch (u) {
278
+ A().sfDebug && console.error("🚨 Error in send():", u);
278
279
  }
279
280
  }
280
281
  getQuery() {
@@ -285,123 +286,791 @@ class K extends S {
285
286
  `;
286
287
  }
287
288
  }
288
- class N {
289
- constructor({ file: e, line: i, function: t, code: n, locals: s = {}, offender: a = !1 }) {
290
- c(this, "file");
291
- c(this, "line");
292
- c(this, "function");
293
- c(this, "code");
294
- c(this, "locals");
295
- c(this, "offender");
296
- this.file = e, this.line = i, this.function = t, this.code = n, this.locals = s, this.offender = a;
289
+ var le, ge, F = {}, q = {}, M = {}, D = {};
290
+ function Ee() {
291
+ if (le) return D;
292
+ le = 1;
293
+ var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
294
+ return D.encode = function(r) {
295
+ if (0 <= r && r < s.length) return s[r];
296
+ throw new TypeError("Must be between 0 and 63: " + r);
297
+ }, D.decode = function(r) {
298
+ return 65 <= r && r <= 90 ? r - 65 : 97 <= r && r <= 122 ? r - 97 + 26 : 48 <= r && r <= 57 ? r - 48 + 52 : r == 43 ? 62 : r == 47 ? 63 : -1;
299
+ }, D;
300
+ }
301
+ function we() {
302
+ if (ge) return M;
303
+ ge = 1;
304
+ var s = Ee();
305
+ return M.encode = function(r) {
306
+ var g, u = "", o = function(n) {
307
+ return n < 0 ? 1 + (-n << 1) : 0 + (n << 1);
308
+ }(r);
309
+ do
310
+ g = 31 & o, (o >>>= 5) > 0 && (g |= 32), u += s.encode(g);
311
+ while (o > 0);
312
+ return u;
313
+ }, M.decode = function(r, g, u) {
314
+ var o, n, i, l, p = r.length, C = 0, h = 0;
315
+ do {
316
+ if (g >= p) throw new Error("Expected more digits in base 64 VLQ value.");
317
+ if ((n = s.decode(r.charCodeAt(g++))) === -1) throw new Error("Invalid base64 digit: " + r.charAt(g - 1));
318
+ o = !!(32 & n), C += (n &= 31) << h, h += 5;
319
+ } while (o);
320
+ u.value = (l = (i = C) >> 1, 1 & ~i ? l : -l), u.rest = g;
321
+ }, M;
322
+ }
323
+ var ue, de = {};
324
+ function K() {
325
+ return ue || (ue = 1, function(s) {
326
+ s.getArg = function(e, t, I) {
327
+ if (t in e) return e[t];
328
+ if (arguments.length === 3) return I;
329
+ throw new Error('"' + t + '" is a required argument.');
330
+ };
331
+ var r = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, g = /^data:.+\,.+$/;
332
+ function u(e) {
333
+ var t = e.match(r);
334
+ return t ? { scheme: t[1], auth: t[2], host: t[3], port: t[4], path: t[5] } : null;
335
+ }
336
+ function o(e) {
337
+ var t = "";
338
+ return e.scheme && (t += e.scheme + ":"), t += "//", e.auth && (t += e.auth + "@"), e.host && (t += e.host), e.port && (t += ":" + e.port), e.path && (t += e.path), t;
339
+ }
340
+ s.urlParse = u, s.urlGenerate = o;
341
+ var n, i, l = (n = function(e) {
342
+ var t = e, I = u(e);
343
+ if (I) {
344
+ if (!I.path) return e;
345
+ t = I.path;
346
+ }
347
+ for (var c = s.isAbsolute(t), m = [], f = 0, y = 0; ; ) {
348
+ if (f = y, (y = t.indexOf("/", f)) === -1) {
349
+ m.push(t.slice(f));
350
+ break;
351
+ }
352
+ for (m.push(t.slice(f, y)); y < t.length && t[y] === "/"; ) y++;
353
+ }
354
+ var Z, v = 0;
355
+ for (y = m.length - 1; y >= 0; y--) (Z = m[y]) === "." ? m.splice(y, 1) : Z === ".." ? v++ : v > 0 && (Z === "" ? (m.splice(y + 1, v), v = 0) : (m.splice(y, 2), v--));
356
+ return (t = m.join("/")) === "" && (t = c ? "/" : "."), I ? (I.path = t, o(I)) : t;
357
+ }, i = [], function(e) {
358
+ for (var t = 0; t < i.length; t++) if (i[t].input === e) {
359
+ var I = i[0];
360
+ return i[0] = i[t], i[t] = I, i[0].result;
361
+ }
362
+ var c = n(e);
363
+ return i.unshift({ input: e, result: c }), i.length > 32 && i.pop(), c;
364
+ });
365
+ function p(e, t) {
366
+ e === "" && (e = "."), t === "" && (t = ".");
367
+ var I = u(t), c = u(e);
368
+ if (c && (e = c.path || "/"), I && !I.scheme) return c && (I.scheme = c.scheme), o(I);
369
+ if (I || t.match(g)) return t;
370
+ if (c && !c.host && !c.path) return c.host = t, o(c);
371
+ var m = t.charAt(0) === "/" ? t : l(e.replace(/\/+$/, "") + "/" + t);
372
+ return c ? (c.path = m, o(c)) : m;
373
+ }
374
+ s.normalize = l, s.join = p, s.isAbsolute = function(e) {
375
+ return e.charAt(0) === "/" || r.test(e);
376
+ }, s.relative = function(e, t) {
377
+ e === "" && (e = "."), e = e.replace(/\/$/, "");
378
+ for (var I = 0; t.indexOf(e + "/") !== 0; ) {
379
+ var c = e.lastIndexOf("/");
380
+ if (c < 0 || (e = e.slice(0, c)).match(/^([^\/]+:\/)?\/*$/)) return t;
381
+ ++I;
382
+ }
383
+ return Array(I + 1).join("../") + t.substr(e.length + 1);
384
+ };
385
+ var C = !("__proto__" in /* @__PURE__ */ Object.create(null));
386
+ function h(e) {
387
+ return e;
388
+ }
389
+ function a(e) {
390
+ if (!e) return !1;
391
+ var t = e.length;
392
+ if (t < 9 || e.charCodeAt(t - 1) !== 95 || e.charCodeAt(t - 2) !== 95 || e.charCodeAt(t - 3) !== 111 || e.charCodeAt(t - 4) !== 116 || e.charCodeAt(t - 5) !== 111 || e.charCodeAt(t - 6) !== 114 || e.charCodeAt(t - 7) !== 112 || e.charCodeAt(t - 8) !== 95 || e.charCodeAt(t - 9) !== 95) return !1;
393
+ for (var I = t - 10; I >= 0; I--) if (e.charCodeAt(I) !== 36) return !1;
394
+ return !0;
395
+ }
396
+ function d(e, t) {
397
+ return e === t ? 0 : e === null ? 1 : t === null ? -1 : e > t ? 1 : -1;
398
+ }
399
+ s.toSetString = C ? h : function(e) {
400
+ return a(e) ? "$" + e : e;
401
+ }, s.fromSetString = C ? h : function(e) {
402
+ return a(e) ? e.slice(1) : e;
403
+ }, s.compareByOriginalPositions = function(e, t, I) {
404
+ var c = d(e.source, t.source);
405
+ return c !== 0 || (c = e.originalLine - t.originalLine) !== 0 || (c = e.originalColumn - t.originalColumn) !== 0 || I || (c = e.generatedColumn - t.generatedColumn) !== 0 || (c = e.generatedLine - t.generatedLine) !== 0 ? c : d(e.name, t.name);
406
+ }, s.compareByOriginalPositionsNoSource = function(e, t, I) {
407
+ var c;
408
+ return (c = e.originalLine - t.originalLine) !== 0 || (c = e.originalColumn - t.originalColumn) !== 0 || I || (c = e.generatedColumn - t.generatedColumn) !== 0 || (c = e.generatedLine - t.generatedLine) !== 0 ? c : d(e.name, t.name);
409
+ }, s.compareByGeneratedPositionsDeflated = function(e, t, I) {
410
+ var c = e.generatedLine - t.generatedLine;
411
+ return c !== 0 || (c = e.generatedColumn - t.generatedColumn) !== 0 || I || (c = d(e.source, t.source)) !== 0 || (c = e.originalLine - t.originalLine) !== 0 || (c = e.originalColumn - t.originalColumn) !== 0 ? c : d(e.name, t.name);
412
+ }, s.compareByGeneratedPositionsDeflatedNoLine = function(e, t, I) {
413
+ var c = e.generatedColumn - t.generatedColumn;
414
+ return c !== 0 || I || (c = d(e.source, t.source)) !== 0 || (c = e.originalLine - t.originalLine) !== 0 || (c = e.originalColumn - t.originalColumn) !== 0 ? c : d(e.name, t.name);
415
+ }, s.compareByGeneratedPositionsInflated = function(e, t) {
416
+ var I = e.generatedLine - t.generatedLine;
417
+ return I !== 0 || (I = e.generatedColumn - t.generatedColumn) !== 0 || (I = d(e.source, t.source)) !== 0 || (I = e.originalLine - t.originalLine) !== 0 || (I = e.originalColumn - t.originalColumn) !== 0 ? I : d(e.name, t.name);
418
+ }, s.parseSourceMapInput = function(e) {
419
+ return JSON.parse(e.replace(/^\)]}'[^\n]*\n/, ""));
420
+ }, s.computeSourceURL = function(e, t, I) {
421
+ if (t = t || "", e && (e[e.length - 1] !== "/" && t[0] !== "/" && (e += "/"), t = e + t), I) {
422
+ var c = u(I);
423
+ if (!c) throw new Error("sourceMapURL could not be parsed");
424
+ if (c.path) {
425
+ var m = c.path.lastIndexOf("/");
426
+ m >= 0 && (c.path = c.path.substring(0, m + 1));
427
+ }
428
+ t = p(o(c), t);
429
+ }
430
+ return l(t);
431
+ };
432
+ }(de)), de;
433
+ }
434
+ var Ie, ee = {};
435
+ function Ne() {
436
+ if (Ie) return ee;
437
+ Ie = 1;
438
+ var s = K(), r = Object.prototype.hasOwnProperty, g = typeof Map < "u";
439
+ function u() {
440
+ this._array = [], this._set = g ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
441
+ }
442
+ return u.fromArray = function(o, n) {
443
+ for (var i = new u(), l = 0, p = o.length; l < p; l++) i.add(o[l], n);
444
+ return i;
445
+ }, u.prototype.size = function() {
446
+ return g ? this._set.size : Object.getOwnPropertyNames(this._set).length;
447
+ }, u.prototype.add = function(o, n) {
448
+ var i = g ? o : s.toSetString(o), l = g ? this.has(o) : r.call(this._set, i), p = this._array.length;
449
+ l && !n || this._array.push(o), l || (g ? this._set.set(o, p) : this._set[i] = p);
450
+ }, u.prototype.has = function(o) {
451
+ if (g) return this._set.has(o);
452
+ var n = s.toSetString(o);
453
+ return r.call(this._set, n);
454
+ }, u.prototype.indexOf = function(o) {
455
+ if (g) {
456
+ var n = this._set.get(o);
457
+ if (n >= 0) return n;
458
+ } else {
459
+ var i = s.toSetString(o);
460
+ if (r.call(this._set, i)) return this._set[i];
461
+ }
462
+ throw new Error('"' + o + '" is not in the set.');
463
+ }, u.prototype.at = function(o) {
464
+ if (o >= 0 && o < this._array.length) return this._array[o];
465
+ throw new Error("No element indexed by " + o);
466
+ }, u.prototype.toArray = function() {
467
+ return this._array.slice();
468
+ }, ee.ArraySet = u, ee;
469
+ }
470
+ var pe, Ce, ne = {};
471
+ function Fe() {
472
+ if (pe) return ne;
473
+ pe = 1;
474
+ var s = K();
475
+ function r() {
476
+ this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
477
+ }
478
+ return r.prototype.unsortedForEach = function(g, u) {
479
+ this._array.forEach(g, u);
480
+ }, r.prototype.add = function(g) {
481
+ var u, o, n, i, l, p;
482
+ u = this._last, o = g, n = u.generatedLine, i = o.generatedLine, l = u.generatedColumn, p = o.generatedColumn, i > n || i == n && p >= l || s.compareByGeneratedPositionsInflated(u, o) <= 0 ? (this._last = g, this._array.push(g)) : (this._sorted = !1, this._array.push(g));
483
+ }, r.prototype.toArray = function() {
484
+ return this._sorted || (this._array.sort(s.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
485
+ }, ne.MappingList = r, ne;
486
+ }
487
+ function he() {
488
+ if (Ce) return q;
489
+ Ce = 1;
490
+ var s = we(), r = K(), g = Ne().ArraySet, u = Fe().MappingList;
491
+ function o(n) {
492
+ n || (n = {}), this._file = r.getArg(n, "file", null), this._sourceRoot = r.getArg(n, "sourceRoot", null), this._skipValidation = r.getArg(n, "skipValidation", !1), this._ignoreInvalidMapping = r.getArg(n, "ignoreInvalidMapping", !1), this._sources = new g(), this._names = new g(), this._mappings = new u(), this._sourcesContents = null;
493
+ }
494
+ return o.prototype._version = 3, o.fromSourceMap = function(n, i) {
495
+ var l = n.sourceRoot, p = new o(Object.assign(i || {}, { file: n.file, sourceRoot: l }));
496
+ return n.eachMapping(function(C) {
497
+ var h = { generated: { line: C.generatedLine, column: C.generatedColumn } };
498
+ C.source != null && (h.source = C.source, l != null && (h.source = r.relative(l, h.source)), h.original = { line: C.originalLine, column: C.originalColumn }, C.name != null && (h.name = C.name)), p.addMapping(h);
499
+ }), n.sources.forEach(function(C) {
500
+ var h = C;
501
+ l !== null && (h = r.relative(l, C)), p._sources.has(h) || p._sources.add(h);
502
+ var a = n.sourceContentFor(C);
503
+ a != null && p.setSourceContent(C, a);
504
+ }), p;
505
+ }, o.prototype.addMapping = function(n) {
506
+ var i = r.getArg(n, "generated"), l = r.getArg(n, "original", null), p = r.getArg(n, "source", null), C = r.getArg(n, "name", null);
507
+ (this._skipValidation || this._validateMapping(i, l, p, C) !== !1) && (p != null && (p = String(p), this._sources.has(p) || this._sources.add(p)), C != null && (C = String(C), this._names.has(C) || this._names.add(C)), this._mappings.add({ generatedLine: i.line, generatedColumn: i.column, originalLine: l != null && l.line, originalColumn: l != null && l.column, source: p, name: C }));
508
+ }, o.prototype.setSourceContent = function(n, i) {
509
+ var l = n;
510
+ this._sourceRoot != null && (l = r.relative(this._sourceRoot, l)), i != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[r.toSetString(l)] = i) : this._sourcesContents && (delete this._sourcesContents[r.toSetString(l)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
511
+ }, o.prototype.applySourceMap = function(n, i, l) {
512
+ var p = i;
513
+ if (i == null) {
514
+ if (n.file == null) throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
515
+ p = n.file;
516
+ }
517
+ var C = this._sourceRoot;
518
+ C != null && (p = r.relative(C, p));
519
+ var h = new g(), a = new g();
520
+ this._mappings.unsortedForEach(function(d) {
521
+ if (d.source === p && d.originalLine != null) {
522
+ var e = n.originalPositionFor({ line: d.originalLine, column: d.originalColumn });
523
+ e.source != null && (d.source = e.source, l != null && (d.source = r.join(l, d.source)), C != null && (d.source = r.relative(C, d.source)), d.originalLine = e.line, d.originalColumn = e.column, e.name != null && (d.name = e.name));
524
+ }
525
+ var t = d.source;
526
+ t == null || h.has(t) || h.add(t);
527
+ var I = d.name;
528
+ I == null || a.has(I) || a.add(I);
529
+ }, this), this._sources = h, this._names = a, n.sources.forEach(function(d) {
530
+ var e = n.sourceContentFor(d);
531
+ e != null && (l != null && (d = r.join(l, d)), C != null && (d = r.relative(C, d)), this.setSourceContent(d, e));
532
+ }, this);
533
+ }, o.prototype._validateMapping = function(n, i, l, p) {
534
+ if (i && typeof i.line != "number" && typeof i.column != "number") {
535
+ var C = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
536
+ if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(C), !1;
537
+ throw new Error(C);
538
+ }
539
+ if ((!(n && "line" in n && "column" in n && n.line > 0 && n.column >= 0) || i || l || p) && !(n && "line" in n && "column" in n && i && "line" in i && "column" in i && n.line > 0 && n.column >= 0 && i.line > 0 && i.column >= 0 && l)) {
540
+ if (C = "Invalid mapping: " + JSON.stringify({ generated: n, source: l, original: i, name: p }), this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(C), !1;
541
+ throw new Error(C);
542
+ }
543
+ }, o.prototype._serializeMappings = function() {
544
+ for (var n, i, l, p, C = 0, h = 1, a = 0, d = 0, e = 0, t = 0, I = "", c = this._mappings.toArray(), m = 0, f = c.length; m < f; m++) {
545
+ if (n = "", (i = c[m]).generatedLine !== h) for (C = 0; i.generatedLine !== h; ) n += ";", h++;
546
+ else if (m > 0) {
547
+ if (!r.compareByGeneratedPositionsInflated(i, c[m - 1])) continue;
548
+ n += ",";
549
+ }
550
+ n += s.encode(i.generatedColumn - C), C = i.generatedColumn, i.source != null && (p = this._sources.indexOf(i.source), n += s.encode(p - t), t = p, n += s.encode(i.originalLine - 1 - d), d = i.originalLine - 1, n += s.encode(i.originalColumn - a), a = i.originalColumn, i.name != null && (l = this._names.indexOf(i.name), n += s.encode(l - e), e = l)), I += n;
551
+ }
552
+ return I;
553
+ }, o.prototype._generateSourcesContent = function(n, i) {
554
+ return n.map(function(l) {
555
+ if (!this._sourcesContents) return null;
556
+ i != null && (l = r.relative(i, l));
557
+ var p = r.toSetString(l);
558
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, p) ? this._sourcesContents[p] : null;
559
+ }, this);
560
+ }, o.prototype.toJSON = function() {
561
+ var n = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() };
562
+ return this._file != null && (n.file = this._file), this._sourceRoot != null && (n.sourceRoot = this._sourceRoot), this._sourcesContents && (n.sourcesContent = this._generateSourcesContent(n.sources, n.sourceRoot)), n;
563
+ }, o.prototype.toString = function() {
564
+ return JSON.stringify(this.toJSON());
565
+ }, q.SourceMapGenerator = o, q;
566
+ }
567
+ var me, Y = {}, Ae = {};
568
+ function Me() {
569
+ return me || (me = 1, function(s) {
570
+ function r(g, u, o, n, i, l) {
571
+ var p = Math.floor((u - g) / 2) + g, C = i(o, n[p], !0);
572
+ return C === 0 ? p : C > 0 ? u - p > 1 ? r(p, u, o, n, i, l) : l == s.LEAST_UPPER_BOUND ? u < n.length ? u : -1 : p : p - g > 1 ? r(g, p, o, n, i, l) : l == s.LEAST_UPPER_BOUND ? p : g < 0 ? -1 : g;
573
+ }
574
+ s.GREATEST_LOWER_BOUND = 1, s.LEAST_UPPER_BOUND = 2, s.search = function(g, u, o, n) {
575
+ if (u.length === 0) return -1;
576
+ var i = r(-1, u.length, g, u, o, n || s.GREATEST_LOWER_BOUND);
577
+ if (i < 0) return -1;
578
+ for (; i - 1 >= 0 && o(u[i], u[i - 1], !0) === 0; ) --i;
579
+ return i;
580
+ };
581
+ }(Ae)), Ae;
582
+ }
583
+ var fe, be, te = {};
584
+ function De() {
585
+ if (fe) return te;
586
+ function s(g) {
587
+ function u(o, n, i) {
588
+ var l = o[n];
589
+ o[n] = o[i], o[i] = l;
590
+ }
591
+ return function o(n, i, l, p) {
592
+ if (l < p) {
593
+ var C = l - 1;
594
+ u(n, (e = l, t = p, Math.round(e + Math.random() * (t - e))), p);
595
+ for (var h = n[p], a = l; a < p; a++) i(n[a], h, !1) <= 0 && u(n, C += 1, a);
596
+ u(n, C + 1, a);
597
+ var d = C + 1;
598
+ o(n, i, l, d - 1), o(n, i, d + 1, p);
599
+ }
600
+ var e, t;
601
+ };
602
+ }
603
+ fe = 1;
604
+ let r = /* @__PURE__ */ new WeakMap();
605
+ return te.quickSort = function(g, u, o = 0) {
606
+ let n = r.get(u);
607
+ n === void 0 && (n = function(i) {
608
+ let l = s.toString();
609
+ return new Function(`return ${l}`)()(i);
610
+ }(u), r.set(u, n)), n(g, u, o, g.length - 1);
611
+ }, te;
612
+ }
613
+ var ye, ve, ie = {}, Ve = (ve || (ve = 1, F.SourceMapGenerator = he().SourceMapGenerator, F.SourceMapConsumer = function() {
614
+ if (be) return Y;
615
+ be = 1;
616
+ var s = K(), r = Me(), g = Ne().ArraySet, u = we(), o = De().quickSort;
617
+ function n(a, d) {
618
+ var e = a;
619
+ return typeof a == "string" && (e = s.parseSourceMapInput(a)), e.sections != null ? new h(e, d) : new i(e, d);
620
+ }
621
+ function i(a, d) {
622
+ var e = a;
623
+ typeof a == "string" && (e = s.parseSourceMapInput(a));
624
+ var t = s.getArg(e, "version"), I = s.getArg(e, "sources"), c = s.getArg(e, "names", []), m = s.getArg(e, "sourceRoot", null), f = s.getArg(e, "sourcesContent", null), y = s.getArg(e, "mappings"), Z = s.getArg(e, "file", null);
625
+ if (t != this._version) throw new Error("Unsupported version: " + t);
626
+ m && (m = s.normalize(m)), I = I.map(String).map(s.normalize).map(function(v) {
627
+ return m && s.isAbsolute(m) && s.isAbsolute(v) ? s.relative(m, v) : v;
628
+ }), this._names = g.fromArray(c.map(String), !0), this._sources = g.fromArray(I, !0), this._absoluteSources = this._sources.toArray().map(function(v) {
629
+ return s.computeSourceURL(m, v, d);
630
+ }), this.sourceRoot = m, this.sourcesContent = f, this._mappings = y, this._sourceMapURL = d, this.file = Z;
631
+ }
632
+ function l() {
633
+ this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null;
634
+ }
635
+ n.fromSourceMap = function(a, d) {
636
+ return i.fromSourceMap(a, d);
637
+ }, n.prototype._version = 3, n.prototype.__generatedMappings = null, Object.defineProperty(n.prototype, "_generatedMappings", { configurable: !0, enumerable: !0, get: function() {
638
+ return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings;
639
+ } }), n.prototype.__originalMappings = null, Object.defineProperty(n.prototype, "_originalMappings", { configurable: !0, enumerable: !0, get: function() {
640
+ return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings;
641
+ } }), n.prototype._charIsMappingSeparator = function(a, d) {
642
+ var e = a.charAt(d);
643
+ return e === ";" || e === ",";
644
+ }, n.prototype._parseMappings = function(a, d) {
645
+ throw new Error("Subclasses must implement _parseMappings");
646
+ }, n.GENERATED_ORDER = 1, n.ORIGINAL_ORDER = 2, n.GREATEST_LOWER_BOUND = 1, n.LEAST_UPPER_BOUND = 2, n.prototype.eachMapping = function(a, d, e) {
647
+ var t, I = d || null;
648
+ switch (e || n.GENERATED_ORDER) {
649
+ case n.GENERATED_ORDER:
650
+ t = this._generatedMappings;
651
+ break;
652
+ case n.ORIGINAL_ORDER:
653
+ t = this._originalMappings;
654
+ break;
655
+ default:
656
+ throw new Error("Unknown order of iteration.");
657
+ }
658
+ for (var c = this.sourceRoot, m = a.bind(I), f = this._names, y = this._sources, Z = this._sourceMapURL, v = 0, B = t.length; v < B; v++) {
659
+ var W = t[v], S = W.source === null ? null : y.at(W.source);
660
+ S !== null && (S = s.computeSourceURL(c, S, Z)), m({ source: S, generatedLine: W.generatedLine, generatedColumn: W.generatedColumn, originalLine: W.originalLine, originalColumn: W.originalColumn, name: W.name === null ? null : f.at(W.name) });
661
+ }
662
+ }, n.prototype.allGeneratedPositionsFor = function(a) {
663
+ var d = s.getArg(a, "line"), e = { source: s.getArg(a, "source"), originalLine: d, originalColumn: s.getArg(a, "column", 0) };
664
+ if (e.source = this._findSourceIndex(e.source), e.source < 0) return [];
665
+ var t = [], I = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", s.compareByOriginalPositions, r.LEAST_UPPER_BOUND);
666
+ if (I >= 0) {
667
+ var c = this._originalMappings[I];
668
+ if (a.column === void 0) for (var m = c.originalLine; c && c.originalLine === m; ) t.push({ line: s.getArg(c, "generatedLine", null), column: s.getArg(c, "generatedColumn", null), lastColumn: s.getArg(c, "lastGeneratedColumn", null) }), c = this._originalMappings[++I];
669
+ else for (var f = c.originalColumn; c && c.originalLine === d && c.originalColumn == f; ) t.push({ line: s.getArg(c, "generatedLine", null), column: s.getArg(c, "generatedColumn", null), lastColumn: s.getArg(c, "lastGeneratedColumn", null) }), c = this._originalMappings[++I];
670
+ }
671
+ return t;
672
+ }, Y.SourceMapConsumer = n, i.prototype = Object.create(n.prototype), i.prototype.consumer = n, i.prototype._findSourceIndex = function(a) {
673
+ var d, e = a;
674
+ if (this.sourceRoot != null && (e = s.relative(this.sourceRoot, e)), this._sources.has(e)) return this._sources.indexOf(e);
675
+ for (d = 0; d < this._absoluteSources.length; ++d) if (this._absoluteSources[d] == a) return d;
676
+ return -1;
677
+ }, i.fromSourceMap = function(a, d) {
678
+ var e = Object.create(i.prototype), t = e._names = g.fromArray(a._names.toArray(), !0), I = e._sources = g.fromArray(a._sources.toArray(), !0);
679
+ e.sourceRoot = a._sourceRoot, e.sourcesContent = a._generateSourcesContent(e._sources.toArray(), e.sourceRoot), e.file = a._file, e._sourceMapURL = d, e._absoluteSources = e._sources.toArray().map(function(W) {
680
+ return s.computeSourceURL(e.sourceRoot, W, d);
681
+ });
682
+ for (var c = a._mappings.toArray().slice(), m = e.__generatedMappings = [], f = e.__originalMappings = [], y = 0, Z = c.length; y < Z; y++) {
683
+ var v = c[y], B = new l();
684
+ B.generatedLine = v.generatedLine, B.generatedColumn = v.generatedColumn, v.source && (B.source = I.indexOf(v.source), B.originalLine = v.originalLine, B.originalColumn = v.originalColumn, v.name && (B.name = t.indexOf(v.name)), f.push(B)), m.push(B);
685
+ }
686
+ return o(e.__originalMappings, s.compareByOriginalPositions), e;
687
+ }, i.prototype._version = 3, Object.defineProperty(i.prototype, "sources", { get: function() {
688
+ return this._absoluteSources.slice();
689
+ } });
690
+ const p = s.compareByGeneratedPositionsDeflatedNoLine;
691
+ function C(a, d) {
692
+ let e = a.length, t = a.length - d;
693
+ if (!(t <= 1)) if (t == 2) {
694
+ let I = a[d], c = a[d + 1];
695
+ p(I, c) > 0 && (a[d] = c, a[d + 1] = I);
696
+ } else if (t < 20) for (let I = d; I < e; I++) for (let c = I; c > d; c--) {
697
+ let m = a[c - 1], f = a[c];
698
+ if (p(m, f) <= 0) break;
699
+ a[c - 1] = f, a[c] = m;
700
+ }
701
+ else o(a, p, d);
702
+ }
703
+ function h(a, d) {
704
+ var e = a;
705
+ typeof a == "string" && (e = s.parseSourceMapInput(a));
706
+ var t = s.getArg(e, "version"), I = s.getArg(e, "sections");
707
+ if (t != this._version) throw new Error("Unsupported version: " + t);
708
+ this._sources = new g(), this._names = new g();
709
+ var c = { line: -1, column: 0 };
710
+ this._sections = I.map(function(m) {
711
+ if (m.url) throw new Error("Support for url field in sections not implemented.");
712
+ var f = s.getArg(m, "offset"), y = s.getArg(f, "line"), Z = s.getArg(f, "column");
713
+ if (y < c.line || y === c.line && Z < c.column) throw new Error("Section offsets must be ordered and non-overlapping.");
714
+ return c = f, { generatedOffset: { generatedLine: y + 1, generatedColumn: Z + 1 }, consumer: new n(s.getArg(m, "map"), d) };
715
+ });
716
+ }
717
+ return i.prototype._parseMappings = function(a, d) {
718
+ var e, t, I, c, m = 1, f = 0, y = 0, Z = 0, v = 0, B = 0, W = a.length, S = 0, P = {}, w = [], H = [];
719
+ let $ = 0;
720
+ for (; S < W; ) if (a.charAt(S) === ";") m++, S++, f = 0, C(H, $), $ = H.length;
721
+ else if (a.charAt(S) === ",") S++;
722
+ else {
723
+ for ((e = new l()).generatedLine = m, I = S; I < W && !this._charIsMappingSeparator(a, I); I++) ;
724
+ for (a.slice(S, I), t = []; S < I; ) u.decode(a, S, P), c = P.value, S = P.rest, t.push(c);
725
+ if (t.length === 2) throw new Error("Found a source, but no line and column");
726
+ if (t.length === 3) throw new Error("Found a source and line, but no column");
727
+ if (e.generatedColumn = f + t[0], f = e.generatedColumn, t.length > 1 && (e.source = v + t[1], v += t[1], e.originalLine = y + t[2], y = e.originalLine, e.originalLine += 1, e.originalColumn = Z + t[3], Z = e.originalColumn, t.length > 4 && (e.name = B + t[4], B += t[4])), H.push(e), typeof e.originalLine == "number") {
728
+ let E = e.source;
729
+ for (; w.length <= E; ) w.push(null);
730
+ w[E] === null && (w[E] = []), w[E].push(e);
731
+ }
732
+ }
733
+ C(H, $), this.__generatedMappings = H;
734
+ for (var U = 0; U < w.length; U++) w[U] != null && o(w[U], s.compareByOriginalPositionsNoSource);
735
+ this.__originalMappings = [].concat(...w);
736
+ }, i.prototype._findMapping = function(a, d, e, t, I, c) {
737
+ if (a[e] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + a[e]);
738
+ if (a[t] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + a[t]);
739
+ return r.search(a, d, I, c);
740
+ }, i.prototype.computeColumnSpans = function() {
741
+ for (var a = 0; a < this._generatedMappings.length; ++a) {
742
+ var d = this._generatedMappings[a];
743
+ if (a + 1 < this._generatedMappings.length) {
744
+ var e = this._generatedMappings[a + 1];
745
+ if (d.generatedLine === e.generatedLine) {
746
+ d.lastGeneratedColumn = e.generatedColumn - 1;
747
+ continue;
748
+ }
749
+ }
750
+ d.lastGeneratedColumn = 1 / 0;
751
+ }
752
+ }, i.prototype.originalPositionFor = function(a) {
753
+ var d = { generatedLine: s.getArg(a, "line"), generatedColumn: s.getArg(a, "column") }, e = this._findMapping(d, this._generatedMappings, "generatedLine", "generatedColumn", s.compareByGeneratedPositionsDeflated, s.getArg(a, "bias", n.GREATEST_LOWER_BOUND));
754
+ if (e >= 0) {
755
+ var t = this._generatedMappings[e];
756
+ if (t.generatedLine === d.generatedLine) {
757
+ var I = s.getArg(t, "source", null);
758
+ I !== null && (I = this._sources.at(I), I = s.computeSourceURL(this.sourceRoot, I, this._sourceMapURL));
759
+ var c = s.getArg(t, "name", null);
760
+ return c !== null && (c = this._names.at(c)), { source: I, line: s.getArg(t, "originalLine", null), column: s.getArg(t, "originalColumn", null), name: c };
761
+ }
762
+ }
763
+ return { source: null, line: null, column: null, name: null };
764
+ }, i.prototype.hasContentsOfAllSources = function() {
765
+ return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(a) {
766
+ return a == null;
767
+ });
768
+ }, i.prototype.sourceContentFor = function(a, d) {
769
+ if (!this.sourcesContent) return null;
770
+ var e = this._findSourceIndex(a);
771
+ if (e >= 0) return this.sourcesContent[e];
772
+ var t, I = a;
773
+ if (this.sourceRoot != null && (I = s.relative(this.sourceRoot, I)), this.sourceRoot != null && (t = s.urlParse(this.sourceRoot))) {
774
+ var c = I.replace(/^file:\/\//, "");
775
+ if (t.scheme == "file" && this._sources.has(c)) return this.sourcesContent[this._sources.indexOf(c)];
776
+ if ((!t.path || t.path == "/") && this._sources.has("/" + I)) return this.sourcesContent[this._sources.indexOf("/" + I)];
777
+ }
778
+ if (d) return null;
779
+ throw new Error('"' + I + '" is not in the SourceMap.');
780
+ }, i.prototype.generatedPositionFor = function(a) {
781
+ var d = s.getArg(a, "source");
782
+ if ((d = this._findSourceIndex(d)) < 0) return { line: null, column: null, lastColumn: null };
783
+ var e = { source: d, originalLine: s.getArg(a, "line"), originalColumn: s.getArg(a, "column") }, t = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", s.compareByOriginalPositions, s.getArg(a, "bias", n.GREATEST_LOWER_BOUND));
784
+ if (t >= 0) {
785
+ var I = this._originalMappings[t];
786
+ if (I.source === e.source) return { line: s.getArg(I, "generatedLine", null), column: s.getArg(I, "generatedColumn", null), lastColumn: s.getArg(I, "lastGeneratedColumn", null) };
787
+ }
788
+ return { line: null, column: null, lastColumn: null };
789
+ }, Y.BasicSourceMapConsumer = i, h.prototype = Object.create(n.prototype), h.prototype.constructor = n, h.prototype._version = 3, Object.defineProperty(h.prototype, "sources", { get: function() {
790
+ for (var a = [], d = 0; d < this._sections.length; d++) for (var e = 0; e < this._sections[d].consumer.sources.length; e++) a.push(this._sections[d].consumer.sources[e]);
791
+ return a;
792
+ } }), h.prototype.originalPositionFor = function(a) {
793
+ var d = { generatedLine: s.getArg(a, "line"), generatedColumn: s.getArg(a, "column") }, e = r.search(d, this._sections, function(I, c) {
794
+ return I.generatedLine - c.generatedOffset.generatedLine || I.generatedColumn - c.generatedOffset.generatedColumn;
795
+ }), t = this._sections[e];
796
+ return t ? t.consumer.originalPositionFor({ line: d.generatedLine - (t.generatedOffset.generatedLine - 1), column: d.generatedColumn - (t.generatedOffset.generatedLine === d.generatedLine ? t.generatedOffset.generatedColumn - 1 : 0), bias: a.bias }) : { source: null, line: null, column: null, name: null };
797
+ }, h.prototype.hasContentsOfAllSources = function() {
798
+ return this._sections.every(function(a) {
799
+ return a.consumer.hasContentsOfAllSources();
800
+ });
801
+ }, h.prototype.sourceContentFor = function(a, d) {
802
+ for (var e = 0; e < this._sections.length; e++) {
803
+ var t = this._sections[e].consumer.sourceContentFor(a, !0);
804
+ if (t || t === "") return t;
805
+ }
806
+ if (d) return null;
807
+ throw new Error('"' + a + '" is not in the SourceMap.');
808
+ }, h.prototype.generatedPositionFor = function(a) {
809
+ for (var d = 0; d < this._sections.length; d++) {
810
+ var e = this._sections[d];
811
+ if (e.consumer._findSourceIndex(s.getArg(a, "source")) !== -1) {
812
+ var t = e.consumer.generatedPositionFor(a);
813
+ if (t) return { line: t.line + (e.generatedOffset.generatedLine - 1), column: t.column + (e.generatedOffset.generatedLine === t.line ? e.generatedOffset.generatedColumn - 1 : 0) };
814
+ }
815
+ }
816
+ return { line: null, column: null };
817
+ }, h.prototype._parseMappings = function(a, d) {
818
+ this.__generatedMappings = [], this.__originalMappings = [];
819
+ for (var e = 0; e < this._sections.length; e++) for (var t = this._sections[e], I = t.consumer._generatedMappings, c = 0; c < I.length; c++) {
820
+ var m = I[c], f = t.consumer._sources.at(m.source);
821
+ f !== null && (f = s.computeSourceURL(t.consumer.sourceRoot, f, this._sourceMapURL)), this._sources.add(f), f = this._sources.indexOf(f);
822
+ var y = null;
823
+ m.name && (y = t.consumer._names.at(m.name), this._names.add(y), y = this._names.indexOf(y));
824
+ var Z = { source: f, generatedLine: m.generatedLine + (t.generatedOffset.generatedLine - 1), generatedColumn: m.generatedColumn + (t.generatedOffset.generatedLine === m.generatedLine ? t.generatedOffset.generatedColumn - 1 : 0), originalLine: m.originalLine, originalColumn: m.originalColumn, name: y };
825
+ this.__generatedMappings.push(Z), typeof Z.originalLine == "number" && this.__originalMappings.push(Z);
826
+ }
827
+ o(this.__generatedMappings, s.compareByGeneratedPositionsDeflated), o(this.__originalMappings, s.compareByOriginalPositions);
828
+ }, Y.IndexedSourceMapConsumer = h, Y;
829
+ }().SourceMapConsumer, F.SourceNode = function() {
830
+ if (ye) return ie;
831
+ ye = 1;
832
+ var s = he().SourceMapGenerator, r = K(), g = /(\r?\n)/, u = "$$$isSourceNode$$$";
833
+ function o(n, i, l, p, C) {
834
+ this.children = [], this.sourceContents = {}, this.line = n ?? null, this.column = i ?? null, this.source = l ?? null, this.name = C ?? null, this[u] = !0, p != null && this.add(p);
835
+ }
836
+ return o.fromStringWithSourceMap = function(n, i, l) {
837
+ var p = new o(), C = n.split(g), h = 0, a = function() {
838
+ return c() + (c() || "");
839
+ function c() {
840
+ return h < C.length ? C[h++] : void 0;
841
+ }
842
+ }, d = 1, e = 0, t = null;
843
+ return i.eachMapping(function(c) {
844
+ if (t !== null) {
845
+ if (!(d < c.generatedLine)) {
846
+ var m = (f = C[h] || "").substr(0, c.generatedColumn - e);
847
+ return C[h] = f.substr(c.generatedColumn - e), e = c.generatedColumn, I(t, m), void (t = c);
848
+ }
849
+ I(t, a()), d++, e = 0;
850
+ }
851
+ for (; d < c.generatedLine; ) p.add(a()), d++;
852
+ if (e < c.generatedColumn) {
853
+ var f = C[h] || "";
854
+ p.add(f.substr(0, c.generatedColumn)), C[h] = f.substr(c.generatedColumn), e = c.generatedColumn;
855
+ }
856
+ t = c;
857
+ }, this), h < C.length && (t && I(t, a()), p.add(C.splice(h).join(""))), i.sources.forEach(function(c) {
858
+ var m = i.sourceContentFor(c);
859
+ m != null && (l != null && (c = r.join(l, c)), p.setSourceContent(c, m));
860
+ }), p;
861
+ function I(c, m) {
862
+ if (c === null || c.source === void 0) p.add(m);
863
+ else {
864
+ var f = l ? r.join(l, c.source) : c.source;
865
+ p.add(new o(c.originalLine, c.originalColumn, f, m, c.name));
866
+ }
867
+ }
868
+ }, o.prototype.add = function(n) {
869
+ if (Array.isArray(n)) n.forEach(function(i) {
870
+ this.add(i);
871
+ }, this);
872
+ else {
873
+ if (!n[u] && typeof n != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + n);
874
+ n && this.children.push(n);
875
+ }
876
+ return this;
877
+ }, o.prototype.prepend = function(n) {
878
+ if (Array.isArray(n)) for (var i = n.length - 1; i >= 0; i--) this.prepend(n[i]);
879
+ else {
880
+ if (!n[u] && typeof n != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + n);
881
+ this.children.unshift(n);
882
+ }
883
+ return this;
884
+ }, o.prototype.walk = function(n) {
885
+ for (var i, l = 0, p = this.children.length; l < p; l++) (i = this.children[l])[u] ? i.walk(n) : i !== "" && n(i, { source: this.source, line: this.line, column: this.column, name: this.name });
886
+ }, o.prototype.join = function(n) {
887
+ var i, l, p = this.children.length;
888
+ if (p > 0) {
889
+ for (i = [], l = 0; l < p - 1; l++) i.push(this.children[l]), i.push(n);
890
+ i.push(this.children[l]), this.children = i;
891
+ }
892
+ return this;
893
+ }, o.prototype.replaceRight = function(n, i) {
894
+ var l = this.children[this.children.length - 1];
895
+ return l[u] ? l.replaceRight(n, i) : typeof l == "string" ? this.children[this.children.length - 1] = l.replace(n, i) : this.children.push("".replace(n, i)), this;
896
+ }, o.prototype.setSourceContent = function(n, i) {
897
+ this.sourceContents[r.toSetString(n)] = i;
898
+ }, o.prototype.walkSourceContents = function(n) {
899
+ for (var i = 0, l = this.children.length; i < l; i++) this.children[i][u] && this.children[i].walkSourceContents(n);
900
+ var p = Object.keys(this.sourceContents);
901
+ for (i = 0, l = p.length; i < l; i++) n(r.fromSetString(p[i]), this.sourceContents[p[i]]);
902
+ }, o.prototype.toString = function() {
903
+ var n = "";
904
+ return this.walk(function(i) {
905
+ n += i;
906
+ }), n;
907
+ }, o.prototype.toStringWithSourceMap = function(n) {
908
+ var i = { code: "", line: 1, column: 0 }, l = new s(n), p = !1, C = null, h = null, a = null, d = null;
909
+ return this.walk(function(e, t) {
910
+ i.code += e, t.source !== null && t.line !== null && t.column !== null ? (C === t.source && h === t.line && a === t.column && d === t.name || l.addMapping({ source: t.source, original: { line: t.line, column: t.column }, generated: { line: i.line, column: i.column }, name: t.name }), C = t.source, h = t.line, a = t.column, d = t.name, p = !0) : p && (l.addMapping({ generated: { line: i.line, column: i.column } }), C = null, p = !1);
911
+ for (var I = 0, c = e.length; I < c; I++) e.charCodeAt(I) === 10 ? (i.line++, i.column = 0, I + 1 === c ? (C = null, p = !1) : p && l.addMapping({ source: t.source, original: { line: t.line, column: t.column }, generated: { line: i.line, column: i.column }, name: t.name })) : i.column++;
912
+ }), this.walkSourceContents(function(e, t) {
913
+ l.setSourceContent(e, t);
914
+ }), { code: i.code, map: l };
915
+ }, ie.SourceNode = o, ie;
916
+ }().SourceNode), F);
917
+ class J {
918
+ constructor({ file: r, line: g, function: u, code: o, locals: n = {}, offender: i = !1, column: l }) {
919
+ b(this, "file");
920
+ b(this, "line");
921
+ b(this, "function");
922
+ b(this, "code");
923
+ b(this, "locals");
924
+ b(this, "offender");
925
+ b(this, "column");
926
+ this.file = r, this.line = g, this.function = u, this.code = o, this.locals = n, this.offender = i, this.column = l;
297
927
  }
298
928
  toDict() {
299
- const e = { file: this.file, line: this.line, function: this.function, code: this.code, locals: Object.fromEntries(Object.entries(this.locals).map(([i, t]) => [i, String(t)])) };
300
- return this.offender && (e.offender = this.offender), e;
929
+ const r = { file: this.file, line: this.line, function: this.function, code: this.code, locals: Object.fromEntries(Object.entries(this.locals).map(([g, u]) => [g, String(u)])) };
930
+ return this.offender && (r.offender = this.offender), this.column !== void 0 && (r.column = this.column), r;
301
931
  }
302
932
  toJson() {
303
933
  return JSON.stringify(this.toDict());
304
934
  }
305
935
  }
306
- class B {
307
- static encode(e) {
308
- return e instanceof N ? e.toDict() : Array.isArray(e) ? e.map((i) => B.encode(i)) : typeof e == "object" && e !== null ? JSON.stringify(e) : e;
309
- }
310
- static stringify(e) {
311
- return JSON.stringify(B.encode(e), (i, t) => t instanceof N ? t.toDict() : t);
312
- }
313
- }
314
- let v = 0;
315
- function M(r) {
316
- o().sfDebug && console.log("Initializing Exception Interceptor...");
317
- const e = new $(new URL("data:application/javascript;base64,aW1wb3J0IHsgU2Vzc2lvbiB9IGZyb20gImluc3BlY3Rvci9wcm9taXNlcyI7CmltcG9ydCB7IHBhcmVudFBvcnQsIHdvcmtlckRhdGEgfSBmcm9tICJ3b3JrZXJfdGhyZWFkcyI7CgpnbG9iYWwuc2ZEZWJ1ZyA9IHVuZGVmaW5lZDsKZ2xvYmFsLnN0YWNrRGVwdGhMb2NhbHMgPSB1bmRlZmluZWQ7Cmdsb2JhbC5lcnJvcklkID0gdW5kZWZpbmVkOwpnbG9iYWwubm9kZU1vZHVsZXNUb0NvbGxlY3RMb2NhbFZhcmlhYmxlc09uID0gdW5kZWZpbmVkOwoKLyoqCiAqIEhhbmRsZXMgdGhlICJwYXVzZWQiIHN0YXRlIG9mIHRoZSBkZWJ1Z2dlciBhbmQgcHJvY2Vzc2VzIGV4Y2VwdGlvbnMgb3IgcHJvbWlzZSByZWplY3Rpb25zLgogKiBAcGFyYW0ge1Nlc3Npb259IHNlc3Npb24gLSBUaGUgZGVidWdnaW5nIHNlc3Npb24gaW5zdGFuY2UuCiAqIEBwYXJhbSB7b2JqZWN0fSBwYXJhbXMgLSBQYXJhbWV0ZXJzIGZyb20gdGhlICJwYXVzZWQiIGV2ZW50LgogKi8KYXN5bmMgZnVuY3Rpb24gaGFuZGxlUGF1c2VkKHNlc3Npb24sIHBhcmFtcykgewogIGNvbnN0IHsgcmVhc29uLCBkYXRhLCBjYWxsRnJhbWV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CJcbiIpOwogICAgICAgICAgICBjb2RlID0gc291cmNlTGluZXNbbG9jYXRpb24ubGluZU51bWJlcl0gfHwgIjxub3QgY2FwdHVyZWQ+IjsKICAgICAgICAgIH0gY2F0Y2ggKGVycikgewogICAgICAgICAgICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCJbV29ya2VyXSBGYWlsZWQgdG8gZmV0Y2ggc2NyaXB0IHNvdXJjZToiLCBlcnIpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBjb25zdCBsb2NhbHMgPSBsb2NhbFNjb3BlPy5vYmplY3Q/Lm9iamVjdElkCiAgICAgICAgICA/IGF3YWl0IGZldGNoTG9jYWxWYXJpYWJsZXMoc2Vzc2lvbiwgbG9jYWxTY29wZS5vYmplY3Qub2JqZWN0SWQpCiAgICAgICAgICA6IHt9OwoKICAgICAgICByZXR1cm4gewogICAgICAgICAgZnVuY3Rpb246IGZ1bmN0aW9uTmFtZSB8fCAiPGFub255bW91cz4iLAogICAgICAgICAgbG9jYWxzLAogICAgICAgICAgZmlsZSwKICAgICAgICAgIGxpbmU6IGxvY2F0aW9uPy5saW5lTnVtYmVyIHx8IDAsCiAgICAgICAgICBjb2RlLAogICAgICAgIH07CiAgICAgIH0gY2F0Y2ggKGVycm9yKSB7CiAgICAgICAgaWYgKGdsb2JhbC5zZkRlYnVnKSB7CiAgICAgICAgICBjb25zb2xlLmVycm9yKCJbV29ya2VyXSBFcnJvciBwcm9jZXNzaW5nIGNhbGwgZnJhbWU6IiwgZXJyb3IpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gewogICAgICAgICAgZnVuY3Rpb246ICI8ZXJyb3I+IiwKICAgICAgICAgIGxvY2Fsczoge30sCiAgICAgICAgICBmaWxlOiAiPHVua25vd24+IiwKICAgICAgICAgIGxpbmU6IDAsCiAgICAgICAgICBjb2RlOiAiPG5vdCBjYXB0dXJlZD4iLAogICA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RlYnVnZ2VyOiIsIGVycm9yKTsKICB9Cn0pOwoKLy8gS2VlcCB0aGUgd29ya2VyIGFsaXZlCnNldEludGVydmFsKCgpID0+IHt9LCAxMDAwMCk7Cg=="), { workerData: { captureAllExceptions: !0 } });
318
- let i = null;
319
- e.on("message", (a) => {
320
- if (typeof a == "string" && o().sfDebug && console.log(`[Worker] ${a}`), a.readyToGetParameters && e.postMessage({ sfDebug: o().sfDebug, stackDepthLocals: o().stackDepthLocals, nodeModulesToCollectLocalVariablesOn: o().nodeModulesToCollectLocalVariablesOn }), a.type === "exception") {
321
- const { frames: d } = a, I = i;
322
- if (!I) return;
323
- const C = function(l, g) {
324
- const p = [];
325
- let h = -1, G = -1;
326
- for (let u = 0; u < l.length; u++) {
327
- const m = P(l[u].file);
328
- if (G = u, m !== "<unknown>") {
329
- for (let b = 0; b < g.length; b++) {
330
- const Y = g[b];
331
- if (x(Y, m) || typeof Y.file == "string" && Y.file.includes(m)) {
332
- h = b, v = 0, o().sfDebug && console.log(`✅ Matched Frame Found: ${m} @ Debugger Frame ${b}`);
936
+ class x {
937
+ static encode(r) {
938
+ return r instanceof J ? r.toDict() : Array.isArray(r) ? r.map((g) => x.encode(g)) : typeof r == "object" && r !== null ? JSON.stringify(r) : r;
939
+ }
940
+ static stringify(r) {
941
+ return JSON.stringify(x.encode(r), (g, u) => u instanceof J ? u.toDict() : u);
942
+ }
943
+ }
944
+ let _ = 0;
945
+ function Te(s) {
946
+ A().sfDebug && console.log("Initializing Exception Interceptor...");
947
+ const r = new _e(new URL("data:application/javascript;base64,aW1wb3J0IHsgU2Vzc2lvbiB9IGZyb20gImluc3BlY3Rvci9wcm9taXNlcyI7CmltcG9ydCB7IHBhcmVudFBvcnQsIHdvcmtlckRhdGEgfSBmcm9tICJ3b3JrZXJfdGhyZWFkcyI7CgpnbG9iYWwuc2ZEZWJ1ZyA9IHVuZGVmaW5lZDsKZ2xvYmFsLnN0YWNrRGVwdGhMb2NhbHMgPSB1bmRlZmluZW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0gPSBhd2FpdCBzZXNzaW9uLnBvc3QoCiAgICAgICAgICAgICAgIkRlYnVnZ2VyLmdldFNjcmlwdFNvdXJjZSIsCiAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc2NyaXB0SWQsCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgKTsKICAgICAgICAgICAgY29uc3Qgc291cmNlTGluZXMgPSBzY3JpcHRTb3VyY2Uuc3BsaXQoIlxuIik7CiAgICAgICAgICAgIGNvZGUgPSBzb3VyY2VMaW5lc1tsb2NhdGlvbi5saW5lTnVtYmVyXSB8fCAiPG5vdCBjYXB0dXJlZD4iOwogICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBzY3JpcHQgc291cmNlOiIsIGVycik7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIC8vIEZldGNoIGxvY2FsIHZhcmlhYmxlcyBpZiB0aGVyZSdzIGFuIG9iamVjdElkCiAgICAgICAgY29uc3QgbG9jYWxzID0gbG9jYWxTY29wZT8ub2JqZWN0Py5vYmplY3RJZAogICAgICAgICAgPyBhd2FpdCBmZXRjaExvY2FsVmFyaWFibGVzKHNlc3Npb24sIGxvY2FsU2NvcGUub2JqZWN0Lm9iamVjdElkKQogICAgICAgICAgOiB7fTsKCiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiBmdW5jdGlvbk5hbWUgfHwgIjxhbm9ueW1vdXM+IiwKICAgICAgICAgIGxvY2FscywKICAgICAgICAgIGZpbGUsCiAgICAgICAgICBsaW5lOiBsb2NhdGlvbj8ubGluZU51bWJlciB8fCAwLAogICAgICAgICAgY29kZSwKICAgICAgICB9OwogICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgIGlmIChnbG9iYWwu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gICBjb25zdCBpc0Zyb21BbGxvd2VkTm9kZU1vZHVsZSA9IG5vZGVNb2R1bGVzTGlzdC5zb21lKChtb2R1bGVOYW1lKSA9PgogICAgICAgICAgZmlyc3RGcmFtZUxpbmUuaW5jbHVkZXMoYCR7bW9kdWxlTmFtZX1gKSwKICAgICAgICApOwoKICAgICAgICBpZiAoIWlzRnJvbUFsbG93ZWROb2RlTW9kdWxlKSB7CiAgICAgICAgICAvLyBOb3QgZnJvbSBhbiBhbGxvd2VkIG5vZGUgbW9kdWxlID0+IHJldHVybiBlYXJseQogICAgICAgICAgaWYgKGdsb2JhbC5zZkRlYnVnKSB7CiAgICAgICAgICAgIGNvbnNvbGUubG9nKAogICAgICAgICAgICAgICJbV29ya2VyXSBFcnJvciBhcHBlYXJzIHRvIGJlIHRyaWdnZXJlZCBmcm9tIG5vbi1hcHBsaWNhdGlvbiBzb3VyY2VzOyBpZ25vcmluZy4iLAogICAgICAgICAgICApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICAvLyBPdGhlcndpc2UsIGl0J3MgZnJvbSBhbiBhbGxvd2VkIG5vZGUgbW9kdWxlLCBzbyBjb250aW51ZQogICAgICB9IGVsc2UgewogICAgICAgIC8vIElmIHRoZSBsaXN0IGlzIGVtcHR5LCBwcmVzZXJ2ZSBleGlzdGluZyBiZWhhdmlvciBhbmQgaWdub3JlIG5vbi1hcHBsaWNhdGlvbiBlcnJvcnMKICAgICAgICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgICAgICAgIGNvbnNvbGUubG9nKAogICAgICAgICAgICAiW1dvcmtlcl0gRXJyb3IgYXBwZWFycyB0byBiZSB0cmlnZ2VyZWQgZnJvbSBub24tYXBwbGljYXRpb24gc291cmNlczsgaWdub3JpbmcuIiwKICAgICAgICAgICk7CiAgICAgICAgfQogICAgICAgIHJldHVybjsKICAgICAgfQogICAgfQoKICAgIC8vIElmIHdlIHJlYWNoIHRoaXMgcG9pbn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H0KICAgIHJldHVybiB7fTsKICB9Cn0KCnN0YXJ0RGVidWdnZXIoKS5jYXRjaCgoZXJyb3IpID0+IHsKICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlcjoiLCBlcnJvcik7CiAgfQp9KTsKCi8vIEtlZXAgdGhlIHdvcmtlciBhbGl2ZQpzZXRJbnRlcnZhbCgoKSA9PiB7fSwgMTAwMDApOwo="), { workerData: { captureAllExceptions: !0 } });
948
+ let g = null;
949
+ r.on("message", (i) => {
950
+ if (typeof i == "string" && A().sfDebug && console.log(`[Worker] ${i}`), i.readyToGetParameters && r.postMessage({ sfDebug: A().sfDebug, stackDepthLocals: A().stackDepthLocals, nodeModulesToCollectLocalVariablesOn: A().nodeModulesToCollectLocalVariablesOn }), i.type === "exception") {
951
+ const { frames: l } = i, p = g;
952
+ if (!p) return;
953
+ const C = function(a) {
954
+ return a ? a.split(`
955
+ `).slice(1).map((d) => {
956
+ const e = /at (.+?) \((.+):(\d+):(\d+)\)/.exec(d) || /at (.+):(\d+):(\d+)/.exec(d);
957
+ if (e) {
958
+ const [, t, I, c, m] = e;
959
+ return new J({ function: t || "<anonymous>", locals: {}, file: I || "<unknown>", line: parseInt(c, 10) || 0, code: "<not captured>", column: parseInt(m) || 0 });
960
+ }
961
+ return new J({ function: "<unknown>", locals: {}, file: "<unknown>", line: 0, code: "<not captured>", column: 0 });
962
+ }) : [];
963
+ }(p.stack), h = function(a, d) {
964
+ const e = [];
965
+ let t = -1, I = -1;
966
+ for (let c = 0; c < a.length; c++) {
967
+ const m = Oe(a[c].file);
968
+ if (I = c, m !== "<unknown>") {
969
+ for (let f = 0; f < d.length; f++) {
970
+ const y = d[f];
971
+ if (Re(y, m) || typeof y.file == "string" && y.file.includes(m)) {
972
+ t = f, _ = 0, A().sfDebug && console.log(`✅ Matched Frame Found: ${m} @ Debugger Frame ${f}`);
333
973
  break;
334
974
  }
335
975
  }
336
- if (h !== -1) break;
976
+ if (t !== -1) break;
337
977
  }
338
978
  }
339
- if (h === -1) return v === 10 ? (v = 0, l) : (++v, o().sfDebug && console.log(`"❌ No matching frame found. Checking once again, Attempt N ${v}"`), []);
340
- o().sfDebug && console.log(`🔄 Merging from matched index ${h} onward...`);
341
- for (let u = 0; u < g.length; u++) {
342
- const m = l[G + u], b = g[h + u];
343
- p.push(new N({ function: b?.function || m?.function || "<anonymous>", locals: b?.locals || m?.locals || {}, file: m?.file || b?.file || "<unknown>", line: b?.line || m?.line || 0, code: m?.code || b?.code || "<not captured>" }));
979
+ if (t === -1) return _ === 10 ? (_ = 0, a) : (++_, A().sfDebug && console.log(`"❌ No matching frame found. Checking once again, Attempt N ${_}"`), []);
980
+ A().sfDebug && console.log(`🔄 Merging from matched index ${t} onward...`);
981
+ for (let c = 0; c < d.length; c++) {
982
+ const m = a[I + c], f = d[t + c];
983
+ e.push(new J({ function: f?.function || m?.function || "<anonymous>", locals: f?.locals || m?.locals || {}, file: m?.file || f?.file || "<unknown>", line: f?.line || m?.line || 0, code: f?.code || m?.code || "<not captured>" }));
344
984
  }
345
- return p;
346
- }(function(l) {
347
- return l ? l.split(`
348
- `).slice(1).map((g) => {
349
- const p = /at (.+?) \((.+):(\d+):(\d+)\)/.exec(g) || /at (.+):(\d+):(\d+)/.exec(g);
350
- if (p) {
351
- const [, h, G, u] = p;
352
- return new N({ function: h || "<anonymous>", locals: {}, file: G || "<unknown>", line: parseInt(u, 10) || 0, code: "<not captured>" });
353
- }
354
- return new N({ function: "<unknown>", locals: {}, file: "<unknown>", line: 0, code: "<not captured>" });
355
- }) : [];
356
- }(I.stack), d || []);
357
- if (C.length !== 0) {
358
- i = null;
359
- const l = o().stackDepthCodeTraceDepth, g = l === -1 ? C : C.slice(0, l + 1);
360
- r.setOperationName("CollectExceptions");
361
- const p = I.message ? `${I.name}: ${I.message}` : I.name;
362
- o().sfDebug && console.log("error message is : ", p), r.doSend(p, g);
985
+ return e;
986
+ }(C, l || []);
987
+ if (h.length !== 0) {
988
+ g = null;
989
+ const a = A().stackDepthCodeTraceDepth, d = a === -1 ? h : h.slice(0, a + 1), e = Math.min(d.length, C.length);
990
+ for (let I = 0; I < e; I++) (async () => {
991
+ const c = ze(d[I].file, C[I].line, C[I].column);
992
+ c && (c.content != null && (d[I].code = c.content), c.file != null && (d[I].file = c.file));
993
+ })();
994
+ s.setOperationName("CollectExceptions");
995
+ const t = p.message ? `${p.name}: ${p.message}` : p.name;
996
+ A().sfDebug && console.log("error message is : ", t), s.doSend(t, d);
363
997
  }
364
998
  }
365
- }), e.on("error", (a) => {
366
- console.error("[Worker Error]", a);
367
- }), e.on("exit", (a) => {
368
- console.error(`[Worker] Exited with code ${a}`);
369
- }), e.unref();
370
- const t = Error, n = /* @__PURE__ */ new Set();
371
- function s(...a) {
372
- const d = Reflect.construct(t, a);
373
- Reflect.setPrototypeOf(d, s.prototype), t.captureStackTrace && t.captureStackTrace(d, s);
374
- const I = `${d.message}:${d.stack?.split(`
999
+ }), r.on("error", (i) => {
1000
+ console.error("[Worker Error]", i);
1001
+ }), r.on("exit", (i) => {
1002
+ console.error(`[Worker] Exited with code ${i}`);
1003
+ }), r.unref();
1004
+ const u = Error, o = /* @__PURE__ */ new Set();
1005
+ function n(...i) {
1006
+ const l = Reflect.construct(u, i);
1007
+ Reflect.setPrototypeOf(l, n.prototype), u.captureStackTrace && u.captureStackTrace(l, n);
1008
+ const p = `${l.message}:${l.stack?.split(`
375
1009
  `)[1]?.trim()}`;
376
- return n.has(I) || (n.add(I), i = d, e.postMessage({ type: "processException", error: d.message })), d;
1010
+ return o.has(p) || (o.add(p), g = l, r.postMessage({ type: "processException", error: l.message })), l;
377
1011
  }
378
- s.prototype = Object.create(t.prototype, { constructor: { value: s, enumerable: !1, writable: !0, configurable: !0 } }), Object.setPrototypeOf(s, t), globalThis.Error = s;
1012
+ n.prototype = Object.create(u.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), Object.setPrototypeOf(n, u), globalThis.Error = n;
379
1013
  }
380
- function P(r) {
381
- return r?.split("/").pop() || "<unknown>";
1014
+ function Ze(s) {
1015
+ return s = (s = (s = s.replace(/^webpack:\/\/[^\/]+\/\.?\//, "")).replace(/^.*\/pages\//, "pages/")).replace(/\.(js|ts)$/, "");
382
1016
  }
383
- function x(r, e) {
384
- if (!r || typeof r != "object") return !1;
385
- for (const i of Object.values(r))
386
- if (typeof i == "string" && i.includes(e) || typeof i == "object" && x(i, e)) return !0;
1017
+ function ze(s, r, g) {
1018
+ const u = function(n) {
1019
+ n.startsWith("at ") && (n = n.slice(3).trim());
1020
+ const i = n.match(/^(.*?)(:\d+)+(\.map)?$/);
1021
+ return i ? i[1] : n;
1022
+ }(s);
1023
+ if (!u || u === "<unknown>") return null;
1024
+ const o = u + ".map";
1025
+ try {
1026
+ const n = Be(o, "utf-8");
1027
+ if (n) {
1028
+ const i = JSON.parse(n);
1029
+ let l = new Ve.SourceMapConsumer(i).originalPositionFor({ line: r, column: g });
1030
+ if (u && l.source) {
1031
+ const p = Ze(u), C = i.sources.findIndex((h) => Ze(h) === p);
1032
+ if (C === -1) A().sfDebug && console.log(`Source file "${u}" not found in the source map.`);
1033
+ else {
1034
+ const h = i.sourcesContent[C], a = i.names.join(",");
1035
+ if (h)
1036
+ return { content: h.split(`
1037
+ `).slice(l.line - 1, l.line + 20).join(`
1038
+ `), name: a, file: l.source };
1039
+ A().sfDebug && console.log(`No source content available for file "${u}".`);
1040
+ }
1041
+ }
1042
+ return { content: i.sourcesContent[0], name: i.names[0], file: i.file };
1043
+ }
1044
+ } catch (n) {
1045
+ A().sfDebug && console.log(`Cant read/parse "${o}: Error - ".`, n);
1046
+ }
1047
+ return null;
1048
+ }
1049
+ function Oe(s) {
1050
+ return s?.split("/").pop() || "<unknown>";
1051
+ }
1052
+ function Re(s, r) {
1053
+ if (!s || typeof s != "object") return !1;
1054
+ for (const g of Object.values(s))
1055
+ if (typeof g == "string" && g.includes(r) || typeof g == "object" && Re(g, r)) return !0;
387
1056
  return !1;
388
1057
  }
389
- class j extends S {
1058
+ class xe extends L {
390
1059
  constructor() {
391
1060
  super();
392
- c(this, "serviceIdentifier", new w());
1061
+ b(this, "serviceIdentifier", new k());
393
1062
  this.setOperationName("CollectExceptions");
394
1063
  }
395
1064
  async sendAppIdentifier() {
396
1065
  this.serviceIdentifier.doSend({});
397
1066
  }
398
- async doSend(i, t) {
399
- this.sendAppIdentifier(), this.send(i, t);
1067
+ async doSend(g, u) {
1068
+ this.sendAppIdentifier(), this.send(g, u);
400
1069
  }
401
- async send(i, t) {
402
- o().sfDebug && console.log(" SENDING EXCEPTION...");
403
- const n = JSON.stringify(B.encode(t)), s = this.getVariables({ exceptionMessage: i, traceJson: n, reentrancyGuardPreactive: !1, library: o().packageLibraryType, version: o().version });
404
- Z(this.endpoint, this.operationName, this.getQuery(), s);
1070
+ async send(g, u) {
1071
+ A().sfDebug && console.log(" SENDING EXCEPTION...");
1072
+ const o = JSON.stringify(x.encode(u)), n = this.getVariables({ exceptionMessage: g, traceJson: o, reentrancyGuardPreactive: !1, library: A().packageLibraryType, version: A().version });
1073
+ R(this.endpoint, this.operationName, this.getQuery(), n);
405
1074
  }
406
1075
  getQuery() {
407
1076
  return `
@@ -411,15 +1080,18 @@ class j extends S {
411
1080
  `;
412
1081
  }
413
1082
  }
414
- class Q extends K {
1083
+ const N = {}, Ge = "getting request source code";
1084
+ var T = ((s) => (s.UNKNOWN = "unknown", s.ANONYMOUS = "anonymous", s.NOT_CAPTURED = "not captured", s))(T || {});
1085
+ const re = "http:", oe = "https:";
1086
+ class ke extends se {
415
1087
  constructor() {
416
1088
  super(), this.setOperationName("DomainsToNotPassHeaderTo");
417
1089
  }
418
- async doSend(e) {
419
- this.sendAppIdentifier(), this.send(e);
1090
+ async doSend(r) {
1091
+ this.sendAppIdentifier(), this.send(r);
420
1092
  }
421
- async send(e) {
422
- const i = `
1093
+ async send(r) {
1094
+ const g = `
423
1095
  ${this.queryType} ${this.operationName}(
424
1096
  $apiKey: String!,
425
1097
  $serviceUuid: String!,
@@ -431,55 +1103,178 @@ class Q extends K {
431
1103
  domains: $domains
432
1104
  )
433
1105
  }
434
- `, t = { apiKey: this.apiKey, serviceUuid: this.serviceUUID, domains: e };
435
- Z(this.endpoint, this.operationName, i, t);
436
- }
437
- }
438
- const q = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"];
439
- class _ {
440
- constructor(e = []) {
441
- c(this, "HEADER_TRACING", "X-Sf3-Rid");
442
- c(this, "HEADER_LOG_GUARD", "reentrancy_guard_logging_preactive");
443
- c(this, "HEADER_PRINT_GUARD", "reentrancy_guard_print_preactive");
444
- c(this, "HEADER_EXCEPTION_GUARD", "reentrancy_guard_exception_preactive");
445
- c(this, "contextManager");
446
- c(this, "excludedDomains");
447
- this.contextManager = W.getInstance(), this.excludedDomains = [...q, ...e].map((i) => i.toLowerCase()), o().sfDebug && console.log("[RequestInterceptor] Initialized.");
448
- }
449
- addReentrancyGuardHeaders(e) {
450
- e.set(this.HEADER_LOG_GUARD, "true"), e.set(this.HEADER_PRINT_GUARD, "true"), e.set(this.HEADER_EXCEPTION_GUARD, "true");
451
- }
452
- shouldPropagateHeaders(e) {
453
- return !this.excludedDomains.some((i) => new RegExp(`^${i.replace(/\*/g, ".*")}$`).test(e));
454
- }
455
- addTracingHeaders(e, i) {
456
- const t = new URL(i).hostname;
457
- if (this.shouldPropagateHeaders(t)) {
458
- const n = this.contextManager.getOrSetSfTraceId(), s = this.contextManager.getOrSetPageVisitUUID(), a = f();
459
- e.set(this.HEADER_TRACING, `${n}/${s}/${a}`), o().sfDebug && console.log(`[RequestInterceptor] Added tracing header for ${i}`);
460
- } else o().sfDebug && console.error(`[RequestInterceptor] Excluded domain: ${t}`);
461
- this.addReentrancyGuardHeaders(e);
462
- }
463
- patchFetch() {
464
- const e = globalThis.fetch;
465
- typeof e == "function" ? globalThis.fetch = async (i, t) => {
466
- const n = Date.now(), s = new Headers(t?.headers);
467
- let a;
468
- typeof i == "string" || i instanceof URL ? a = i.toString() : i instanceof Request ? (a = i.url, i.headers.forEach((I, C) => {
469
- s.set(C, I);
470
- })) : o().sfDebug && console.error("[Sailfish RequestInterceptor] Invalid fetch input."), o().sfDebug && console.log("[RequestInterceptor] Fetching request to:", a), this.addTracingHeaders(s, a);
471
- const d = { ...t, headers: s };
1106
+ `, u = { apiKey: this.apiKey, serviceUuid: this.serviceUUID, domains: r };
1107
+ R(this.endpoint, this.operationName, g, u);
1108
+ }
1109
+ }
1110
+ class Pe extends L {
1111
+ constructor() {
1112
+ super();
1113
+ b(this, "serviceIdentifier", new k());
1114
+ this.setOperationName("CollectNetworkHops");
1115
+ }
1116
+ async sendAppIdentifier() {
1117
+ this.serviceIdentifier.doSend({});
1118
+ }
1119
+ async doSend(g, u) {
1120
+ this.sendAppIdentifier(), this.send(u, g);
1121
+ }
1122
+ async send(g, u) {
1123
+ const o = this.getVariables({ requestDetails: g, entrypoint: u });
1124
+ R(this.endpoint, this.operationName, this.getQuery(), o);
1125
+ }
1126
+ getQuery() {
1127
+ return `
1128
+ mutation ${this.operationName}(
1129
+ $apiKey: String!,
1130
+ $sessionId: String!,
1131
+ $timestampMs: String!,
1132
+ $requestDetails: String!,
1133
+ $entrypoint: String!,
1134
+ $serviceUuid: String,
1135
+ ) {
1136
+ ${this.queryName}(
1137
+ apiKey: $apiKey,
1138
+ sessionId: $sessionId,
1139
+ timestampMs: $timestampMs,
1140
+ requestDetails: $requestDetails,
1141
+ entrypoint: $entrypoint,
1142
+ serviceUuid: $serviceUuid
1143
+ )
1144
+ }
1145
+ `;
1146
+ }
1147
+ }
1148
+ const $e = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"];
1149
+ class je {
1150
+ constructor(r = []) {
1151
+ b(this, "HEADER_TRACING", "X-Sf3-Rid");
1152
+ b(this, "HEADER_LOG_GUARD", "reentrancy_guard_logging_preactive");
1153
+ b(this, "HEADER_PRINT_GUARD", "reentrancy_guard_print_preactive");
1154
+ b(this, "HEADER_EXCEPTION_GUARD", "reentrancy_guard_exception_preactive");
1155
+ b(this, "contextManager");
1156
+ b(this, "excludedDomains");
1157
+ this.contextManager = O.getInstance(), this.excludedDomains = [...$e, ...r].map((g) => g.toLowerCase()), A().sfDebug && console.log("[RequestInterceptor] Initialized.");
1158
+ }
1159
+ parseStackFrame(r) {
1160
+ const g = /\((.*):(\d+):(\d+)\)$/.exec(r.trim());
1161
+ if (!g) return null;
1162
+ const [, u, o, n] = g;
1163
+ return { filePath: u, line: parseInt(o, 10), column: parseInt(n, 10) };
1164
+ }
1165
+ async getOriginalPosition(r, g, u) {
1166
+ let o = { source: r, line: g, column: u, name: null };
1167
+ const n = r + ".map";
1168
+ try {
1169
+ const i = JSON.parse(Be(n, "utf-8"));
1170
+ let l = (await new Ve.SourceMapConsumer(i)).originalPositionFor({ line: g, column: u });
1171
+ l.source && (o = l);
1172
+ } catch (i) {
1173
+ A().sfDebug && console.error(`Could not read/parse map file at ${n}:`, i);
1174
+ }
1175
+ return { originalPos: o };
1176
+ }
1177
+ captureFirstUserLines(r, g = 10) {
1178
+ const u = A().sfDebug ? 10 : g, o = Error.stackTraceLimit;
1179
+ Error.stackTraceLimit = Math.max(o, u);
1180
+ const n = new Error(Ge);
1181
+ Ge in Error && Error.captureStackTrace(n, this.captureFirstUserLines);
1182
+ const i = n.stack || "";
1183
+ Error.stackTraceLimit = o;
1184
+ const l = i.split(`
1185
+ `).slice(1), p = [];
1186
+ for (const C of l)
1187
+ if (!(C.includes("node:internal") || C.includes("internal/modules") || C.includes("internal/process") || C.includes("node_modules") || C.includes(".next/server/chunks") || C.includes("RequestInterceptor") || C.includes("contextManager") || C.includes("setupConfig")) && (p.push(C.trim()), p.length >= g)) break;
1188
+ for (const C of p) {
1189
+ const h = this.parseStackFrame(C);
1190
+ h ? (async () => {
1191
+ const { originalPos: a } = await this.getOriginalPosition(h.filePath, h.line, h.column);
1192
+ if (a) {
1193
+ A().sfDebug && console.log("[RequestInterceptor] First user code line:", a);
1194
+ const d = `line=${a.line?.toString() || T.UNKNOWN},column=${a.column?.toString() || T.NOT_CAPTURED},name=${a.name || T.NOT_CAPTURED}`;
1195
+ r.doSend(a.source, d);
1196
+ }
1197
+ })() : A().sfDebug && console.error("Could not parse stack line:", C);
1198
+ }
1199
+ }
1200
+ addReentrancyGuardHeaders(r) {
1201
+ r.set(this.HEADER_LOG_GUARD, "true"), r.set(this.HEADER_PRINT_GUARD, "true"), r.set(this.HEADER_EXCEPTION_GUARD, "true");
1202
+ }
1203
+ shouldPropagateHeaders(r) {
1204
+ return !this.excludedDomains.some((g) => new RegExp(`^${g.replace(/\*/g, ".*")}$`).test(r));
1205
+ }
1206
+ addTracingHeaders(r, g) {
1207
+ const u = new URL(g).hostname;
1208
+ if (this.shouldPropagateHeaders(u)) {
1209
+ const o = this.contextManager.getOrSetSfTraceId(), n = this.contextManager.getOrSetPageVisitUUID(), i = X();
1210
+ r.set(this.HEADER_TRACING, `${o}/${n}/${i}`), A().sfDebug && console.log(`[RequestInterceptor] Added tracing header for ${g}`);
1211
+ } else A().sfDebug && console.error(`[RequestInterceptor] Excluded domain: ${u}`);
1212
+ this.addReentrancyGuardHeaders(r);
1213
+ }
1214
+ patchFetch(r) {
1215
+ A().sfDebug && console.log("[RequestInterceptor] Initializing Fetch request patch...");
1216
+ const g = globalThis.fetch;
1217
+ typeof g == "function" ? globalThis.fetch = async (u, o) => {
1218
+ this.captureFirstUserLines(r);
1219
+ const n = Date.now(), i = new Headers(o?.headers);
1220
+ let l;
1221
+ typeof u == "string" || u instanceof URL ? l = u.toString() : u instanceof Request ? (l = u.url, u.headers.forEach((C, h) => {
1222
+ i.set(h, C);
1223
+ })) : A().sfDebug && console.error("[Sailfish RequestInterceptor] Invalid fetch input."), A().sfDebug && console.log("[RequestInterceptor] Fetching request to:", l), this.addTracingHeaders(i, l);
1224
+ const p = { ...o, headers: i };
472
1225
  try {
473
- const I = await e(a, d), C = Date.now();
474
- return o().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${a}, Status: ${I.status}, Duration: ${C - n}ms`), I;
475
- } catch (I) {
476
- const C = Date.now();
477
- o().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${a}, Error: ${I}, Duration: ${C - n}ms`);
1226
+ const C = await g(l, p), h = Date.now();
1227
+ return A().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${l}, Status: ${C.status}, Duration: ${h - n}ms`), C;
1228
+ } catch (C) {
1229
+ const h = Date.now();
1230
+ A().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${l}, Error: ${C}, Duration: ${h - n}ms`);
478
1231
  }
479
- } : o().sfDebug && console.error("[RequestInterceptor] Fetch not available.");
1232
+ } : A().sfDebug && console.error("[RequestInterceptor] Fetch not available.");
1233
+ }
1234
+ patchHttp(r) {
1235
+ if (A().sfDebug && console.log("[RequestInterceptor] Initializing HTTP/HTTPS request patch..."), !N || typeof N.request != "function") return void (A().sfDebug && console.log("[RequestInterceptor] HTTP/HTTPS not available."));
1236
+ const g = N.request.bind(N), u = N.request.bind(N);
1237
+ N.request = function(o, n) {
1238
+ let i;
1239
+ try {
1240
+ if (typeof o == "string") {
1241
+ const l = new URL(o);
1242
+ i = { protocol: l.protocol || re, hostname: l.hostname, path: l.pathname + l.search, headers: {} };
1243
+ } else o instanceof URL ? i = { protocol: o.protocol || re, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (i = { ...o }, i.protocol || (i.protocol = re));
1244
+ if (i.headers) {
1245
+ const l = `${i.protocol}//${i.hostname}`;
1246
+ this.addTracingHeaders(i.headers, l), this.captureFirstUserLines(r);
1247
+ } else A().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTP request options. Skipping header addition.");
1248
+ } catch (l) {
1249
+ throw A().sfDebug && console.error("[RequestInterceptor] Error while processing HTTP request options:", l), l;
1250
+ }
1251
+ return g(i, n);
1252
+ }, N.request = function(o, n) {
1253
+ let i;
1254
+ try {
1255
+ if (typeof o == "string") {
1256
+ const l = new URL(o);
1257
+ i = { protocol: l.protocol || oe, hostname: l.hostname, path: l.pathname + l.search, headers: {} };
1258
+ } else o instanceof URL ? i = { protocol: o.protocol || oe, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (i = { ...o }, i.protocol || (i.protocol = oe));
1259
+ if (i.headers) {
1260
+ const l = `${i.protocol}//${i.hostname}`;
1261
+ this.addTracingHeaders(i.headers, l);
1262
+ } else A().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTPS request options. Skipping header addition.");
1263
+ } catch (l) {
1264
+ throw A().sfDebug && console.error("[RequestInterceptor] Error while processing HTTPS request options:", l), l;
1265
+ }
1266
+ return u(i, n);
1267
+ }, A().sfDebug && console.log("✅ HTTP and HTTPS request methods patched globally.");
1268
+ }
1269
+ tryPatch(r, g) {
1270
+ try {
1271
+ require.resolve(g), r(), console.log(`[RequestInterceptor] Patched ${g}`);
1272
+ } catch (u) {
1273
+ console.warn(`[RequestInterceptor] Could not patch ${g}: ${u.message}`);
1274
+ }
480
1275
  }
481
1276
  }
482
- class ee extends K {
1277
+ class Qe extends se {
483
1278
  constructor() {
484
1279
  super(), this.setOperationName("UpdateServiceDetails");
485
1280
  }
@@ -487,7 +1282,7 @@ class ee extends K {
487
1282
  this.sendAppIdentifier(), this.send();
488
1283
  }
489
1284
  async send() {
490
- const e = `
1285
+ const r = `
491
1286
  ${this.queryType} ${this.operationName}(
492
1287
  $apiKey: String!,
493
1288
  $serviceUuid: String!,
@@ -507,56 +1302,58 @@ class ee extends K {
507
1302
 
508
1303
  )
509
1304
  }
510
- `, i = this.getVariables({ serviceIdentifier: o().serviceIdentifier, serviceVersion: o().serviceVersion, serviceAdditionalMetadata: o().serviceAdditionalMetadata });
511
- Z(this.endpoint, this.operationName, e, i);
512
- }
513
- }
514
- function se(r) {
515
- if (!r || !r.apiKey) {
516
- const n = `The required API Key is not provided: ${JSON.stringify(r)}`;
517
- console.error(n);
518
- }
519
- const { config: e } = function(n) {
520
- return V = new T(n), { config: V };
521
- }(r);
522
- if (e.sfDebug && console.log("Updated configuration after applying options:", e), !e.apiKey || !e.apiGraphqlEndpoint) {
523
- const n = `The required config is not provided: ${JSON.stringify(e)}`;
524
- throw console.error(n), new Error(n);
525
- }
526
- const i = new K();
527
- i.setServiceUUID(e.serviceUUID), function(n) {
528
- function s(g, p) {
529
- n.setOperationName("CollectLogs"), n.doSend([p, g]);
530
- }
531
- const a = console.log.bind(console), d = console.error.bind(console), I = console.warn.bind(console), C = console.info.bind(console), l = console.debug.bind(console);
532
- console.log = (...g) => {
533
- s("INFO", g.join(" ")), a(...g);
534
- }, console.error = (...g) => {
535
- s("ERROR", g.join(" ")), d(...g);
536
- }, console.warn = (...g) => {
537
- s("WARN", g.join(" ")), I(...g);
538
- }, console.info = (...g) => {
539
- s("INFO", g.join(" ")), C(...g);
540
- }, o().logLevel === "DEBUG" && (console.debug = (...g) => {
541
- s("DEBUG", g.join(" ")), l(...g);
1305
+ `, g = this.getVariables({ serviceIdentifier: A().serviceIdentifier, serviceVersion: A().serviceVersion, serviceAdditionalMetadata: A().serviceAdditionalMetadata });
1306
+ R(this.endpoint, this.operationName, r, g);
1307
+ }
1308
+ }
1309
+ function rn(s) {
1310
+ if (!s || !s.apiKey) {
1311
+ const o = `The required API Key is not provided: ${JSON.stringify(s)}`;
1312
+ console.error(o);
1313
+ }
1314
+ const { config: r } = function(o) {
1315
+ return z = new Je(o), { config: z };
1316
+ }(s);
1317
+ if (r.sfDebug && console.log("Updated configuration after applying options:", r), !r.apiKey || !r.apiGraphqlEndpoint) {
1318
+ const o = `The required config is not provided: ${JSON.stringify(r)}`;
1319
+ throw console.error(o), new Error(o);
1320
+ }
1321
+ const g = new se();
1322
+ g.setServiceUUID(r.serviceUUID), function(o) {
1323
+ function n(a, d) {
1324
+ o.setOperationName("CollectLogs"), o.doSend([d, a]);
1325
+ }
1326
+ const i = console.log.bind(console), l = console.error.bind(console), p = console.warn.bind(console), C = console.info.bind(console), h = console.debug.bind(console);
1327
+ console.log = (...a) => {
1328
+ n("INFO", a.join(" ")), i(...a);
1329
+ }, console.error = (...a) => {
1330
+ n("ERROR", a.join(" ")), l(...a);
1331
+ }, console.warn = (...a) => {
1332
+ n("WARN", a.join(" ")), p(...a);
1333
+ }, console.info = (...a) => {
1334
+ n("INFO", a.join(" ")), C(...a);
1335
+ }, A().logLevel === "DEBUG" && (console.debug = (...a) => {
1336
+ n("DEBUG", a.join(" ")), h(...a);
542
1337
  });
543
- }(i), function(n = []) {
544
- const s = new _(n);
545
- new Q().doSend(s.excludedDomains), s.patchFetch();
546
- }(e.domainsToNotPropagateHeadersTo);
547
- const t = new j();
548
- t.setServiceUUID(e.serviceUUID), M(t), new ee().send();
1338
+ }(g), function(o = []) {
1339
+ const n = new je(o);
1340
+ new ke().doSend(n.excludedDomains);
1341
+ const i = new Pe();
1342
+ n.patchFetch(i), n.patchHttp(i);
1343
+ }(r.domainsToNotPropagateHeadersTo);
1344
+ const u = new xe();
1345
+ u.setServiceUUID(r.serviceUUID), Te(u), new Qe().send();
549
1346
  }
550
- function oe(r, e, i, t = !1) {
551
- const n = o();
552
- new U(n.apiKey).identify(r, e, i, t);
1347
+ function on(s, r, g, u = !1) {
1348
+ const o = A();
1349
+ new We(o.apiKey).identify(s, r, g, u);
553
1350
  }
554
- function re(r, e = {}, i, t = !1) {
555
- const n = o();
556
- new U(n.apiKey).addOrUpdateMetadata(r, e, i, t);
1351
+ function sn(s, r = {}, g, u = !1) {
1352
+ const o = A();
1353
+ new We(o.apiKey).addOrUpdateMetadata(s, r, g, u);
557
1354
  }
558
1355
  export {
559
- re as addOrUpdateMetadata,
560
- oe as identify,
561
- se as setupInterceptors
1356
+ sn as addOrUpdateMetadata,
1357
+ on as identify,
1358
+ rn as setupInterceptors
562
1359
  };