@cloudflare/vite-plugin 0.0.0-00cf67c53

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.
@@ -0,0 +1,2334 @@
1
+ // ../workers-shared/dist/asset-worker.mjs
2
+ import { WorkerEntrypoint as Us } from "cloudflare:workers";
3
+ var ee = class {
4
+ constructor(e) {
5
+ this.performanceTimer = e;
6
+ }
7
+ now() {
8
+ return this.performanceTimer ? this.performanceTimer.timeOrigin + this.performanceTimer.now() : Date.now();
9
+ }
10
+ };
11
+ var _e = class extends Response {
12
+ constructor(e, n) {
13
+ super(e, { ...n, status: 200 });
14
+ }
15
+ };
16
+ var te = class extends Response {
17
+ constructor(...[e, n]) {
18
+ super(e, { ...n, status: 404, statusText: "Not Found" });
19
+ }
20
+ };
21
+ var Ee = class extends Response {
22
+ constructor(...[e, n]) {
23
+ super(e, { ...n, status: 405, statusText: "Method Not Allowed" });
24
+ }
25
+ };
26
+ var $ = class extends Response {
27
+ constructor(e, n) {
28
+ super(null, { ...n, status: 500 });
29
+ }
30
+ };
31
+ var Se = class extends Response {
32
+ constructor(...[e, n]) {
33
+ super(null, { ...n, status: 304, statusText: "Not Modified" });
34
+ }
35
+ };
36
+ var ye = class extends Response {
37
+ constructor(e, n) {
38
+ super(null, { ...n, status: 307, statusText: "Temporary Redirect", headers: { ...n?.headers, Location: e } });
39
+ }
40
+ };
41
+ var Gt = Object.prototype.toString;
42
+ function B(t) {
43
+ switch (Gt.call(t)) {
44
+ case "[object Error]":
45
+ case "[object Exception]":
46
+ case "[object DOMException]":
47
+ return true;
48
+ default:
49
+ return v(t, Error);
50
+ }
51
+ }
52
+ function Ze(t, e) {
53
+ return Gt.call(t) === `[object ${e}]`;
54
+ }
55
+ function Xe(t) {
56
+ return Ze(t, "ErrorEvent");
57
+ }
58
+ function Qe(t) {
59
+ return Ze(t, "String");
60
+ }
61
+ function J(t) {
62
+ return typeof t == "object" && t !== null && "__sentry_template_string__" in t && "__sentry_template_values__" in t;
63
+ }
64
+ function Te(t) {
65
+ return t === null || J(t) || typeof t != "object" && typeof t != "function";
66
+ }
67
+ function R(t) {
68
+ return Ze(t, "Object");
69
+ }
70
+ function et(t) {
71
+ return typeof Event < "u" && v(t, Event);
72
+ }
73
+ function tt(t) {
74
+ return typeof Element < "u" && v(t, Element);
75
+ }
76
+ function O(t) {
77
+ return !!(t && t.then && typeof t.then == "function");
78
+ }
79
+ function nt(t) {
80
+ return R(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t;
81
+ }
82
+ function v(t, e) {
83
+ try {
84
+ return t instanceof e;
85
+ } catch {
86
+ return false;
87
+ }
88
+ }
89
+ function rt(t) {
90
+ return !!(typeof t == "object" && t !== null && (t.__isVue || t._isVue));
91
+ }
92
+ function D(t, e = 0) {
93
+ return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.slice(0, e)}...`;
94
+ }
95
+ var M = "8.9.2";
96
+ var m = globalThis;
97
+ function V(t, e, n) {
98
+ let r = n || m, s = r.__SENTRY__ = r.__SENTRY__ || {}, o = s[M] = s[M] || {};
99
+ return o[t] || (o[t] = e());
100
+ }
101
+ var Zn = m;
102
+ var Xn = 80;
103
+ function qt(t, e = {}) {
104
+ if (!t) return "<unknown>";
105
+ try {
106
+ let n = t, r = 5, s = [], o = 0, i = 0, a = " > ", c = a.length, u, p = Array.isArray(e) ? e : e.keyAttrs, l = !Array.isArray(e) && e.maxStringLength || Xn;
107
+ for (; n && o++ < r && (u = Qn(n, p), !(u === "html" || o > 1 && i + s.length * c + u.length >= l)); ) s.push(u), i += u.length, n = n.parentNode;
108
+ return s.reverse().join(a);
109
+ } catch {
110
+ return "<unknown>";
111
+ }
112
+ }
113
+ function Qn(t, e) {
114
+ let n = t, r = [], s, o, i, a, c;
115
+ if (!n || !n.tagName) return "";
116
+ if (Zn.HTMLElement && n instanceof HTMLElement && n.dataset) {
117
+ if (n.dataset.sentryComponent) return n.dataset.sentryComponent;
118
+ if (n.dataset.sentryElement) return n.dataset.sentryElement;
119
+ }
120
+ r.push(n.tagName.toLowerCase());
121
+ let u = e && e.length ? e.filter((l) => n.getAttribute(l)).map((l) => [l, n.getAttribute(l)]) : null;
122
+ if (u && u.length) u.forEach((l) => {
123
+ r.push(`[${l[0]}="${l[1]}"]`);
124
+ });
125
+ else if (n.id && r.push(`#${n.id}`), s = n.className, s && Qe(s)) for (o = s.split(/\s+/), c = 0; c < o.length; c++) r.push(`.${o[c]}`);
126
+ let p = ["aria-label", "type", "name", "title", "alt"];
127
+ for (c = 0; c < p.length; c++) i = p[c], a = n.getAttribute(i), a && r.push(`[${i}="${a}"]`);
128
+ return r.join("");
129
+ }
130
+ var P = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__;
131
+ var er = "Sentry Logger ";
132
+ var st = ["debug", "info", "warn", "error", "log", "assert", "trace"];
133
+ var ot = {};
134
+ function Ie(t) {
135
+ if (!("console" in m)) return t();
136
+ let e = m.console, n = {}, r = Object.keys(ot);
137
+ r.forEach((s) => {
138
+ let o = ot[s];
139
+ n[s] = e[s], e[s] = o;
140
+ });
141
+ try {
142
+ return t();
143
+ } finally {
144
+ r.forEach((s) => {
145
+ e[s] = n[s];
146
+ });
147
+ }
148
+ }
149
+ function tr() {
150
+ let t = false, e = { enable: () => {
151
+ t = true;
152
+ }, disable: () => {
153
+ t = false;
154
+ }, isEnabled: () => t };
155
+ return P ? st.forEach((n) => {
156
+ e[n] = (...r) => {
157
+ t && Ie(() => {
158
+ m.console[n](`${er}[${n}]:`, ...r);
159
+ });
160
+ };
161
+ }) : st.forEach((n) => {
162
+ e[n] = () => {
163
+ };
164
+ }), e;
165
+ }
166
+ var d = tr();
167
+ var nr = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
168
+ function rr(t) {
169
+ return t === "http" || t === "https";
170
+ }
171
+ function k(t, e = false) {
172
+ let { host: n, path: r, pass: s, port: o, projectId: i, protocol: a, publicKey: c } = t;
173
+ return `${a}://${c}${e && s ? `:${s}` : ""}@${n}${o ? `:${o}` : ""}/${r && `${r}/`}${i}`;
174
+ }
175
+ function zt(t) {
176
+ let e = nr.exec(t);
177
+ if (!e) {
178
+ Ie(() => {
179
+ console.error(`Invalid Sentry Dsn: ${t}`);
180
+ });
181
+ return;
182
+ }
183
+ let [n, r, s = "", o, i = "", a] = e.slice(1), c = "", u = a, p = u.split("/");
184
+ if (p.length > 1 && (c = p.slice(0, -1).join("/"), u = p.pop()), u) {
185
+ let l = u.match(/^\d+/);
186
+ l && (u = l[0]);
187
+ }
188
+ return Yt({ host: o, pass: s, path: c, projectId: u, port: i, protocol: n, publicKey: r });
189
+ }
190
+ function Yt(t) {
191
+ return { protocol: t.protocol, publicKey: t.publicKey || "", pass: t.pass || "", host: t.host, port: t.port || "", path: t.path || "", projectId: t.projectId };
192
+ }
193
+ function sr(t) {
194
+ if (!P) return true;
195
+ let { port: e, projectId: n, protocol: r } = t;
196
+ return ["protocol", "publicKey", "host", "projectId"].find((i) => t[i] ? false : (d.error(`Invalid Sentry Dsn: ${i} missing`), true)) ? false : n.match(/^\d+$/) ? rr(r) ? e && isNaN(parseInt(e, 10)) ? (d.error(`Invalid Sentry Dsn: Invalid port ${e}`), false) : true : (d.error(`Invalid Sentry Dsn: Invalid protocol ${r}`), false) : (d.error(`Invalid Sentry Dsn: Invalid projectId ${n}`), false);
197
+ }
198
+ function xe(t) {
199
+ let e = typeof t == "string" ? zt(t) : Yt(t);
200
+ if (!(!e || !sr(e))) return e;
201
+ }
202
+ var x = class extends Error {
203
+ constructor(e, n = "warn") {
204
+ super(e), this.message = e, this.name = new.target.prototype.constructor.name, Object.setPrototypeOf(this, new.target.prototype), this.logLevel = n;
205
+ }
206
+ };
207
+ function H(t, e, n) {
208
+ try {
209
+ Object.defineProperty(t, e, { value: n, writable: true, configurable: true });
210
+ } catch {
211
+ P && d.log(`Failed to add non-enumerable property "${e}" to object`, t);
212
+ }
213
+ }
214
+ function at(t) {
215
+ return Object.keys(t).map((e) => `${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&");
216
+ }
217
+ function Ae(t) {
218
+ if (B(t)) return { message: t.message, name: t.name, stack: t.stack, ...Vt(t) };
219
+ if (et(t)) {
220
+ let e = { type: t.type, target: Jt(t.target), currentTarget: Jt(t.currentTarget), ...Vt(t) };
221
+ return typeof CustomEvent < "u" && v(t, CustomEvent) && (e.detail = t.detail), e;
222
+ } else return t;
223
+ }
224
+ function Jt(t) {
225
+ try {
226
+ return tt(t) ? qt(t) : Object.prototype.toString.call(t);
227
+ } catch {
228
+ return "<unknown>";
229
+ }
230
+ }
231
+ function Vt(t) {
232
+ if (typeof t == "object" && t !== null) {
233
+ let e = {};
234
+ for (let n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
235
+ return e;
236
+ } else return {};
237
+ }
238
+ function ne(t, e = 40) {
239
+ let n = Object.keys(Ae(t));
240
+ if (n.sort(), !n.length) return "[object has no keys]";
241
+ if (n[0].length >= e) return D(n[0], e);
242
+ for (let r = n.length; r > 0; r--) {
243
+ let s = n.slice(0, r).join(", ");
244
+ if (!(s.length > e)) return r === n.length ? s : D(s, e);
245
+ }
246
+ return "";
247
+ }
248
+ function S(t) {
249
+ return it(t, /* @__PURE__ */ new Map());
250
+ }
251
+ function it(t, e) {
252
+ if (or(t)) {
253
+ let n = e.get(t);
254
+ if (n !== void 0) return n;
255
+ let r = {};
256
+ e.set(t, r);
257
+ for (let s of Object.keys(t)) typeof t[s] < "u" && (r[s] = it(t[s], e));
258
+ return r;
259
+ }
260
+ if (Array.isArray(t)) {
261
+ let n = e.get(t);
262
+ if (n !== void 0) return n;
263
+ let r = [];
264
+ return e.set(t, r), t.forEach((s) => {
265
+ r.push(it(s, e));
266
+ }), r;
267
+ }
268
+ return t;
269
+ }
270
+ function or(t) {
271
+ if (!R(t)) return false;
272
+ try {
273
+ let e = Object.getPrototypeOf(t).constructor.name;
274
+ return !e || e === "Object";
275
+ } catch {
276
+ return true;
277
+ }
278
+ }
279
+ var be = "?";
280
+ var Wt = /\(error: (.*)\)/;
281
+ var Kt = /captureMessage|captureException/;
282
+ function Ce(...t) {
283
+ let e = t.sort((n, r) => n[0] - r[0]).map((n) => n[1]);
284
+ return (n, r = 0, s = 0) => {
285
+ let o = [], i = n.split(`
286
+ `);
287
+ for (let a = r; a < i.length; a++) {
288
+ let c = i[a];
289
+ if (c.length > 1024) continue;
290
+ let u = Wt.test(c) ? c.replace(Wt, "$1") : c;
291
+ if (!u.match(/\S*Error: /)) {
292
+ for (let p of e) {
293
+ let l = p(u);
294
+ if (l) {
295
+ o.push(l);
296
+ break;
297
+ }
298
+ }
299
+ if (o.length >= 50 + s) break;
300
+ }
301
+ }
302
+ return Zt(o.slice(s));
303
+ };
304
+ }
305
+ function ut(t) {
306
+ return Array.isArray(t) ? Ce(...t) : t;
307
+ }
308
+ function Zt(t) {
309
+ if (!t.length) return [];
310
+ let e = Array.from(t);
311
+ return /sentryWrapped/.test(e[e.length - 1].function || "") && e.pop(), e.reverse(), Kt.test(e[e.length - 1].function || "") && (e.pop(), Kt.test(e[e.length - 1].function || "") && e.pop()), e.slice(0, 50).map((n) => ({ ...n, filename: n.filename || e[e.length - 1].filename, function: n.function || be }));
312
+ }
313
+ var ct = "<anonymous>";
314
+ function re(t) {
315
+ try {
316
+ return !t || typeof t != "function" ? ct : t.name || ct;
317
+ } catch {
318
+ return ct;
319
+ }
320
+ }
321
+ var Re = {};
322
+ var Xt = {};
323
+ function Ne(t, e) {
324
+ Re[t] = Re[t] || [], Re[t].push(e);
325
+ }
326
+ function Oe(t, e) {
327
+ Xt[t] || (e(), Xt[t] = true);
328
+ }
329
+ function ve(t, e) {
330
+ let n = t && Re[t];
331
+ if (n) for (let r of n) try {
332
+ r(e);
333
+ } catch (s) {
334
+ P && d.error(`Error while triggering instrumentation handler.
335
+ Type: ${t}
336
+ Name: ${re(r)}
337
+ Error:`, s);
338
+ }
339
+ }
340
+ var Qt = 1e3;
341
+ function W() {
342
+ return Date.now() / Qt;
343
+ }
344
+ function ir() {
345
+ let { performance: t } = m;
346
+ if (!t || !t.now) return W;
347
+ let e = Date.now() - t.now(), n = t.timeOrigin == null ? e : t.timeOrigin;
348
+ return () => (n + t.now()) / Qt;
349
+ }
350
+ var oe = ir();
351
+ var se;
352
+ var ar = (() => {
353
+ let { performance: t } = m;
354
+ if (!t || !t.now) {
355
+ se = "none";
356
+ return;
357
+ }
358
+ let e = 3600 * 1e3, n = t.now(), r = Date.now(), s = t.timeOrigin ? Math.abs(t.timeOrigin + n - r) : e, o = s < e, i = t.timing && t.timing.navigationStart, c = typeof i == "number" ? Math.abs(i + n - r) : e, u = c < e;
359
+ return o || u ? s <= c ? (se = "timeOrigin", t.timeOrigin) : (se = "navigationStart", i) : (se = "dateNow", r);
360
+ })();
361
+ var we = null;
362
+ function lt(t) {
363
+ let e = "error";
364
+ Ne(e, t), Oe(e, cr);
365
+ }
366
+ function cr() {
367
+ we = m.onerror, m.onerror = function(t, e, n, r, s) {
368
+ return ve("error", { column: r, error: s, line: n, msg: t, url: e }), we && !we.__SENTRY_LOADER__ ? we.apply(this, arguments) : false;
369
+ }, m.onerror.__SENTRY_INSTRUMENTED__ = true;
370
+ }
371
+ var De = null;
372
+ function pt(t) {
373
+ let e = "unhandledrejection";
374
+ Ne(e, t), Oe(e, ur);
375
+ }
376
+ function ur() {
377
+ De = m.onunhandledrejection, m.onunhandledrejection = function(t) {
378
+ return ve("unhandledrejection", t), De && !De.__SENTRY_LOADER__ ? De.apply(this, arguments) : true;
379
+ }, m.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
380
+ }
381
+ function en() {
382
+ let t = typeof WeakSet == "function", e = t ? /* @__PURE__ */ new WeakSet() : [];
383
+ function n(s) {
384
+ if (t) return e.has(s) ? true : (e.add(s), false);
385
+ for (let o = 0; o < e.length; o++) if (e[o] === s) return true;
386
+ return e.push(s), false;
387
+ }
388
+ function r(s) {
389
+ if (t) e.delete(s);
390
+ else for (let o = 0; o < e.length; o++) if (e[o] === s) {
391
+ e.splice(o, 1);
392
+ break;
393
+ }
394
+ }
395
+ return [n, r];
396
+ }
397
+ function T() {
398
+ let t = m, e = t.crypto || t.msCrypto, n = () => Math.random() * 16;
399
+ try {
400
+ if (e && e.randomUUID) return e.randomUUID().replace(/-/g, "");
401
+ e && e.getRandomValues && (n = () => {
402
+ let r = new Uint8Array(1);
403
+ return e.getRandomValues(r), r[0];
404
+ });
405
+ } catch {
406
+ }
407
+ return ("10000000100040008000" + 1e11).replace(/[018]/g, (r) => (r ^ (n() & 15) >> r / 4).toString(16));
408
+ }
409
+ function lr(t) {
410
+ return t.exception && t.exception.values ? t.exception.values[0] : void 0;
411
+ }
412
+ function ie(t, e, n) {
413
+ let r = t.exception = t.exception || {}, s = r.values = r.values || [], o = s[0] = s[0] || {};
414
+ o.value || (o.value = e || ""), o.type || (o.type = n || "Error");
415
+ }
416
+ function j(t, e) {
417
+ let n = lr(t);
418
+ if (!n) return;
419
+ let r = { type: "generic", handled: true }, s = n.mechanism;
420
+ if (n.mechanism = { ...r, ...s, ...e }, e && "data" in e) {
421
+ let o = { ...s && s.data, ...e.data };
422
+ n.mechanism.data = o;
423
+ }
424
+ }
425
+ function Me(t) {
426
+ if (t && t.__sentry_captured__) return true;
427
+ try {
428
+ H(t, "__sentry_captured__", true);
429
+ } catch {
430
+ }
431
+ return false;
432
+ }
433
+ function ae(t) {
434
+ return Array.isArray(t) ? t : [t];
435
+ }
436
+ function N(t, e = 100, n = 1 / 0) {
437
+ try {
438
+ return dt("", t, e, n);
439
+ } catch (r) {
440
+ return { ERROR: `**non-serializable** (${r})` };
441
+ }
442
+ }
443
+ function K(t, e = 3, n = 100 * 1024) {
444
+ let r = N(t, e);
445
+ return mr(r) > n ? K(t, e - 1, n) : r;
446
+ }
447
+ function dt(t, e, n = 1 / 0, r = 1 / 0, s = en()) {
448
+ let [o, i] = s;
449
+ if (e == null || ["number", "boolean", "string"].includes(typeof e) && !Number.isNaN(e)) return e;
450
+ let a = pr(t, e);
451
+ if (!a.startsWith("[object ")) return a;
452
+ if (e.__sentry_skip_normalization__) return e;
453
+ let c = typeof e.__sentry_override_normalization_depth__ == "number" ? e.__sentry_override_normalization_depth__ : n;
454
+ if (c === 0) return a.replace("object ", "");
455
+ if (o(e)) return "[Circular ~]";
456
+ let u = e;
457
+ if (u && typeof u.toJSON == "function") try {
458
+ let f = u.toJSON();
459
+ return dt("", f, c - 1, r, s);
460
+ } catch {
461
+ }
462
+ let p = Array.isArray(e) ? [] : {}, l = 0, g = Ae(e);
463
+ for (let f in g) {
464
+ if (!Object.prototype.hasOwnProperty.call(g, f)) continue;
465
+ if (l >= r) {
466
+ p[f] = "[MaxProperties ~]";
467
+ break;
468
+ }
469
+ let h = g[f];
470
+ p[f] = dt(f, h, c - 1, r, s), l++;
471
+ }
472
+ return i(e), p;
473
+ }
474
+ function pr(t, e) {
475
+ try {
476
+ if (t === "domain" && e && typeof e == "object" && e._events) return "[Domain]";
477
+ if (t === "domainEmitter") return "[DomainEmitter]";
478
+ if (typeof global < "u" && e === global) return "[Global]";
479
+ if (typeof window < "u" && e === window) return "[Window]";
480
+ if (typeof document < "u" && e === document) return "[Document]";
481
+ if (rt(e)) return "[VueViewModel]";
482
+ if (nt(e)) return "[SyntheticEvent]";
483
+ if (typeof e == "number" && e !== e) return "[NaN]";
484
+ if (typeof e == "function") return `[Function: ${re(e)}]`;
485
+ if (typeof e == "symbol") return `[${String(e)}]`;
486
+ if (typeof e == "bigint") return `[BigInt: ${String(e)}]`;
487
+ let n = dr(e);
488
+ return /^HTML(\w*)Element$/.test(n) ? `[HTMLElement: ${n}]` : `[object ${n}]`;
489
+ } catch (n) {
490
+ return `**non-serializable** (${n})`;
491
+ }
492
+ }
493
+ function dr(t) {
494
+ let e = Object.getPrototypeOf(t);
495
+ return e ? e.constructor.name : "null prototype";
496
+ }
497
+ function fr(t) {
498
+ return ~-encodeURI(t).split(/%..|./).length;
499
+ }
500
+ function mr(t) {
501
+ return fr(JSON.stringify(t));
502
+ }
503
+ function gr(t, e) {
504
+ let n = 0;
505
+ for (let r = t.length - 1; r >= 0; r--) {
506
+ let s = t[r];
507
+ s === "." ? t.splice(r, 1) : s === ".." ? (t.splice(r, 1), n++) : n && (t.splice(r, 1), n--);
508
+ }
509
+ if (e) for (; n--; n) t.unshift("..");
510
+ return t;
511
+ }
512
+ var hr = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;
513
+ function _r(t) {
514
+ let e = t.length > 1024 ? `<truncated>${t.slice(-1024)}` : t, n = hr.exec(e);
515
+ return n ? n.slice(1) : [];
516
+ }
517
+ function ft(...t) {
518
+ let e = "", n = false;
519
+ for (let r = t.length - 1; r >= -1 && !n; r--) {
520
+ let s = r >= 0 ? t[r] : "/";
521
+ s && (e = `${s}/${e}`, n = s.charAt(0) === "/");
522
+ }
523
+ return e = gr(e.split("/").filter((r) => !!r), !n).join("/"), (n ? "/" : "") + e || ".";
524
+ }
525
+ function tn(t) {
526
+ let e = 0;
527
+ for (; e < t.length && t[e] === ""; e++) ;
528
+ let n = t.length - 1;
529
+ for (; n >= 0 && t[n] === ""; n--) ;
530
+ return e > n ? [] : t.slice(e, n - e + 1);
531
+ }
532
+ function mt(t, e) {
533
+ t = ft(t).slice(1), e = ft(e).slice(1);
534
+ let n = tn(t.split("/")), r = tn(e.split("/")), s = Math.min(n.length, r.length), o = s;
535
+ for (let a = 0; a < s; a++) if (n[a] !== r[a]) {
536
+ o = a;
537
+ break;
538
+ }
539
+ let i = [];
540
+ for (let a = o; a < n.length; a++) i.push("..");
541
+ return i = i.concat(r.slice(o)), i.join("/");
542
+ }
543
+ function ce(t, e) {
544
+ let n = _r(t)[2];
545
+ return e && n.slice(e.length * -1) === e && (n = n.slice(0, n.length - e.length)), n;
546
+ }
547
+ var w;
548
+ (function(t) {
549
+ t[t.PENDING = 0] = "PENDING";
550
+ let n = 1;
551
+ t[t.RESOLVED = n] = "RESOLVED";
552
+ let r = 2;
553
+ t[t.REJECTED = r] = "REJECTED";
554
+ })(w || (w = {}));
555
+ function b(t) {
556
+ return new I((e) => {
557
+ e(t);
558
+ });
559
+ }
560
+ function G(t) {
561
+ return new I((e, n) => {
562
+ n(t);
563
+ });
564
+ }
565
+ var I = class {
566
+ constructor(e) {
567
+ I.prototype.__init.call(this), I.prototype.__init2.call(this), I.prototype.__init3.call(this), I.prototype.__init4.call(this), this._state = w.PENDING, this._handlers = [];
568
+ try {
569
+ e(this._resolve, this._reject);
570
+ } catch (n) {
571
+ this._reject(n);
572
+ }
573
+ }
574
+ then(e, n) {
575
+ return new I((r, s) => {
576
+ this._handlers.push([false, (o) => {
577
+ if (!e) r(o);
578
+ else try {
579
+ r(e(o));
580
+ } catch (i) {
581
+ s(i);
582
+ }
583
+ }, (o) => {
584
+ if (!n) s(o);
585
+ else try {
586
+ r(n(o));
587
+ } catch (i) {
588
+ s(i);
589
+ }
590
+ }]), this._executeHandlers();
591
+ });
592
+ }
593
+ catch(e) {
594
+ return this.then((n) => n, e);
595
+ }
596
+ finally(e) {
597
+ return new I((n, r) => {
598
+ let s, o;
599
+ return this.then((i) => {
600
+ o = false, s = i, e && e();
601
+ }, (i) => {
602
+ o = true, s = i, e && e();
603
+ }).then(() => {
604
+ if (o) {
605
+ r(s);
606
+ return;
607
+ }
608
+ n(s);
609
+ });
610
+ });
611
+ }
612
+ __init() {
613
+ this._resolve = (e) => {
614
+ this._setResult(w.RESOLVED, e);
615
+ };
616
+ }
617
+ __init2() {
618
+ this._reject = (e) => {
619
+ this._setResult(w.REJECTED, e);
620
+ };
621
+ }
622
+ __init3() {
623
+ this._setResult = (e, n) => {
624
+ if (this._state === w.PENDING) {
625
+ if (O(n)) {
626
+ n.then(this._resolve, this._reject);
627
+ return;
628
+ }
629
+ this._state = e, this._value = n, this._executeHandlers();
630
+ }
631
+ };
632
+ }
633
+ __init4() {
634
+ this._executeHandlers = () => {
635
+ if (this._state === w.PENDING) return;
636
+ let e = this._handlers.slice();
637
+ this._handlers = [], e.forEach((n) => {
638
+ n[0] || (this._state === w.RESOLVED && n[1](this._value), this._state === w.REJECTED && n[2](this._value), n[0] = true);
639
+ });
640
+ };
641
+ }
642
+ };
643
+ function gt(t) {
644
+ let e = [];
645
+ function n() {
646
+ return t === void 0 || e.length < t;
647
+ }
648
+ function r(i) {
649
+ return e.splice(e.indexOf(i), 1)[0];
650
+ }
651
+ function s(i) {
652
+ if (!n()) return G(new x("Not adding Promise because buffer limit was reached."));
653
+ let a = i();
654
+ return e.indexOf(a) === -1 && e.push(a), a.then(() => r(a)).then(null, () => r(a).then(null, () => {
655
+ })), a;
656
+ }
657
+ function o(i) {
658
+ return new I((a, c) => {
659
+ let u = e.length;
660
+ if (!u) return a(true);
661
+ let p = setTimeout(() => {
662
+ i && i > 0 && a(false);
663
+ }, i);
664
+ e.forEach((l) => {
665
+ b(l).then(() => {
666
+ --u || (clearTimeout(p), a(true));
667
+ }, c);
668
+ });
669
+ });
670
+ }
671
+ return { $: e, add: s, drain: o };
672
+ }
673
+ function nn(t, e = false) {
674
+ return !(e || t && !t.startsWith("/") && !t.match(/^[A-Z]:/) && !t.startsWith(".") && !t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//)) && t !== void 0 && !t.includes("node_modules/");
675
+ }
676
+ function rn(t) {
677
+ let e = /^\s*[-]{4,}$/, n = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
678
+ return (r) => {
679
+ let s = r.match(n);
680
+ if (s) {
681
+ let o, i, a, c, u;
682
+ if (s[1]) {
683
+ a = s[1];
684
+ let g = a.lastIndexOf(".");
685
+ if (a[g - 1] === "." && g--, g > 0) {
686
+ o = a.slice(0, g), i = a.slice(g + 1);
687
+ let f = o.indexOf(".Module");
688
+ f > 0 && (a = a.slice(f + 1), o = o.slice(0, f));
689
+ }
690
+ c = void 0;
691
+ }
692
+ i && (c = o, u = i), i === "<anonymous>" && (u = void 0, a = void 0), a === void 0 && (u = u || be, a = c ? `${c}.${u}` : u);
693
+ let p = s[2] && s[2].startsWith("file://") ? s[2].slice(7) : s[2], l = s[5] === "native";
694
+ return p && p.match(/\/[A-Z]:/) && (p = p.slice(1)), !p && s[5] && !l && (p = s[5]), { filename: p, module: t ? t(p) : void 0, function: a, lineno: parseInt(s[3], 10) || void 0, colno: parseInt(s[4], 10) || void 0, in_app: nn(p, l) };
695
+ }
696
+ if (r.match(e)) return { filename: r };
697
+ };
698
+ }
699
+ function ht(t) {
700
+ return [90, rn(t)];
701
+ }
702
+ function L(t, e = []) {
703
+ return [t, e];
704
+ }
705
+ function Et(t, e) {
706
+ let [n, r] = t;
707
+ return [n, [...r, e]];
708
+ }
709
+ function Pe(t, e) {
710
+ let n = t[1];
711
+ for (let r of n) {
712
+ let s = r[0].type;
713
+ if (e(r, s)) return true;
714
+ }
715
+ return false;
716
+ }
717
+ function _t(t) {
718
+ return m.__SENTRY__ && m.__SENTRY__.encodePolyfill ? m.__SENTRY__.encodePolyfill(t) : new TextEncoder().encode(t);
719
+ }
720
+ function St(t) {
721
+ let [e, n] = t, r = JSON.stringify(e);
722
+ function s(o) {
723
+ typeof r == "string" ? r = typeof o == "string" ? r + o : [_t(r), o] : r.push(typeof o == "string" ? _t(o) : o);
724
+ }
725
+ for (let o of n) {
726
+ let [i, a] = o;
727
+ if (s(`
728
+ ${JSON.stringify(i)}
729
+ `), typeof a == "string" || a instanceof Uint8Array) s(a);
730
+ else {
731
+ let c;
732
+ try {
733
+ c = JSON.stringify(a);
734
+ } catch {
735
+ c = JSON.stringify(N(a));
736
+ }
737
+ s(c);
738
+ }
739
+ }
740
+ return typeof r == "string" ? r : Er(r);
741
+ }
742
+ function Er(t) {
743
+ let e = t.reduce((s, o) => s + o.length, 0), n = new Uint8Array(e), r = 0;
744
+ for (let s of t) n.set(s, r), r += s.length;
745
+ return n;
746
+ }
747
+ function yt(t) {
748
+ let e = typeof t.data == "string" ? _t(t.data) : t.data;
749
+ return [S({ type: "attachment", length: e.length, filename: t.filename, content_type: t.contentType, attachment_type: t.attachmentType }), e];
750
+ }
751
+ var Sr = { session: "session", sessions: "session", attachment: "attachment", transaction: "transaction", event: "error", client_report: "internal", user_report: "default", profile: "profile", profile_chunk: "profile", replay_event: "replay", replay_recording: "replay", check_in: "monitor", feedback: "feedback", span: "span", statsd: "metric_bucket" };
752
+ function ke(t) {
753
+ return Sr[t];
754
+ }
755
+ function Le(t) {
756
+ if (!t || !t.sdk) return;
757
+ let { name: e, version: n } = t.sdk;
758
+ return { name: e, version: n };
759
+ }
760
+ function Tt(t, e, n, r) {
761
+ let s = t.sdkProcessingMetadata && t.sdkProcessingMetadata.dynamicSamplingContext;
762
+ return { event_id: t.event_id, sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...e && { sdk: e }, ...!!n && r && { dsn: k(r) }, ...s && { trace: S({ ...s }) } };
763
+ }
764
+ function sn(t, e = Date.now()) {
765
+ let n = parseInt(`${t}`, 10);
766
+ if (!isNaN(n)) return n * 1e3;
767
+ let r = Date.parse(`${t}`);
768
+ return isNaN(r) ? 6e4 : r - e;
769
+ }
770
+ function on(t, e) {
771
+ return t[e] || t.all || 0;
772
+ }
773
+ function It(t, e, n = Date.now()) {
774
+ return on(t, e) > n;
775
+ }
776
+ function xt(t, { statusCode: e, headers: n }, r = Date.now()) {
777
+ let s = { ...t }, o = n && n["x-sentry-rate-limits"], i = n && n["retry-after"];
778
+ if (o) for (let a of o.trim().split(",")) {
779
+ let [c, u, , , p] = a.split(":", 5), l = parseInt(c, 10), g = (isNaN(l) ? 60 : l) * 1e3;
780
+ if (!u) s.all = r + g;
781
+ else for (let f of u.split(";")) f === "metric_bucket" ? (!p || p.split(";").includes("custom")) && (s[f] = r + g) : s[f] = r + g;
782
+ }
783
+ else i ? s.all = r + sn(i, r) : e === 429 && (s.all = r + 60 * 1e3);
784
+ return s;
785
+ }
786
+ function At(t, e) {
787
+ return t(e.stack || "", 1);
788
+ }
789
+ function an(t, e) {
790
+ let n = { type: e.name || e.constructor.name, value: e.message }, r = At(t, e);
791
+ return r.length && (n.stacktrace = { frames: r }), n;
792
+ }
793
+ function yr(t) {
794
+ for (let e in t) if (Object.prototype.hasOwnProperty.call(t, e)) {
795
+ let n = t[e];
796
+ if (n instanceof Error) return n;
797
+ }
798
+ }
799
+ function Tr(t) {
800
+ if ("name" in t && typeof t.name == "string") {
801
+ let r = `'${t.name}' captured as exception`;
802
+ return "message" in t && typeof t.message == "string" && (r += ` with message '${t.message}'`), r;
803
+ } else if ("message" in t && typeof t.message == "string") return t.message;
804
+ let e = ne(t);
805
+ if (Xe(t)) return `Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;
806
+ let n = Ir(t);
807
+ return `${n && n !== "Object" ? `'${n}'` : "Object"} captured as exception with keys: ${e}`;
808
+ }
809
+ function Ir(t) {
810
+ try {
811
+ let e = Object.getPrototypeOf(t);
812
+ return e ? e.constructor.name : void 0;
813
+ } catch {
814
+ }
815
+ }
816
+ function xr(t, e, n, r) {
817
+ if (B(n)) return [n, void 0];
818
+ if (e.synthetic = true, R(n)) {
819
+ let o = t && t.getOptions().normalizeDepth, i = { __serialized__: K(n, o) }, a = yr(n);
820
+ if (a) return [a, i];
821
+ let c = Tr(n), u = r && r.syntheticException || new Error(c);
822
+ return u.message = c, [u, i];
823
+ }
824
+ let s = r && r.syntheticException || new Error(n);
825
+ return s.message = `${n}`, [s, void 0];
826
+ }
827
+ function bt(t, e, n, r) {
828
+ let o = r && r.data && r.data.mechanism || { handled: true, type: "generic" }, [i, a] = xr(t, o, n, r), c = { exception: { values: [an(e, i)] } };
829
+ return a && (c.extra = a), ie(c, void 0, void 0), j(c, o), { ...c, event_id: r && r.event_id };
830
+ }
831
+ function Ct(t, e, n = "info", r, s) {
832
+ let o = { event_id: r && r.event_id, level: n };
833
+ if (s && r && r.syntheticException) {
834
+ let i = At(t, r.syntheticException);
835
+ i.length && (o.exception = { values: [{ value: e, stacktrace: { frames: i } }] });
836
+ }
837
+ if (J(e)) {
838
+ let { __sentry_template_string__: i, __sentry_template_values__: a } = e;
839
+ return o.logentry = { message: i, params: a }, o;
840
+ }
841
+ return o.message = e, o;
842
+ }
843
+ function Fe() {
844
+ return { traceId: T(), spanId: T().substring(16) };
845
+ }
846
+ var _ = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__;
847
+ function F() {
848
+ return ue(m), m;
849
+ }
850
+ function ue(t) {
851
+ let e = t.__SENTRY__ = t.__SENTRY__ || {};
852
+ return e.version = e.version || M, e[M] = e[M] || {};
853
+ }
854
+ function le(t, e = {}) {
855
+ if (e.user && (!t.ipAddress && e.user.ip_address && (t.ipAddress = e.user.ip_address), !t.did && !e.did && (t.did = e.user.id || e.user.email || e.user.username)), t.timestamp = e.timestamp || oe(), e.abnormal_mechanism && (t.abnormal_mechanism = e.abnormal_mechanism), e.ignoreDuration && (t.ignoreDuration = e.ignoreDuration), e.sid && (t.sid = e.sid.length === 32 ? e.sid : T()), e.init !== void 0 && (t.init = e.init), !t.did && e.did && (t.did = `${e.did}`), typeof e.started == "number" && (t.started = e.started), t.ignoreDuration) t.duration = void 0;
856
+ else if (typeof e.duration == "number") t.duration = e.duration;
857
+ else {
858
+ let n = t.timestamp - t.started;
859
+ t.duration = n >= 0 ? n : 0;
860
+ }
861
+ e.release && (t.release = e.release), e.environment && (t.environment = e.environment), !t.ipAddress && e.ipAddress && (t.ipAddress = e.ipAddress), !t.userAgent && e.userAgent && (t.userAgent = e.userAgent), typeof e.errors == "number" && (t.errors = e.errors), e.status && (t.status = e.status);
862
+ }
863
+ var Rt = "_sentrySpan";
864
+ function Nt(t, e) {
865
+ e ? H(t, Rt, e) : delete t[Rt];
866
+ }
867
+ function q(t) {
868
+ return t[Rt];
869
+ }
870
+ var br = 100;
871
+ var pe = class {
872
+ constructor() {
873
+ this._notifyingListeners = false, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}, this._propagationContext = Fe();
874
+ }
875
+ clone() {
876
+ let e = new pe();
877
+ return e._breadcrumbs = [...this._breadcrumbs], e._tags = { ...this._tags }, e._extra = { ...this._extra }, e._contexts = { ...this._contexts }, e._user = this._user, e._level = this._level, e._session = this._session, e._transactionName = this._transactionName, e._fingerprint = this._fingerprint, e._eventProcessors = [...this._eventProcessors], e._requestSession = this._requestSession, e._attachments = [...this._attachments], e._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }, e._propagationContext = { ...this._propagationContext }, e._client = this._client, e._lastEventId = this._lastEventId, Nt(e, q(this)), e;
878
+ }
879
+ setClient(e) {
880
+ this._client = e;
881
+ }
882
+ setLastEventId(e) {
883
+ this._lastEventId = e;
884
+ }
885
+ getClient() {
886
+ return this._client;
887
+ }
888
+ lastEventId() {
889
+ return this._lastEventId;
890
+ }
891
+ addScopeListener(e) {
892
+ this._scopeListeners.push(e);
893
+ }
894
+ addEventProcessor(e) {
895
+ return this._eventProcessors.push(e), this;
896
+ }
897
+ setUser(e) {
898
+ return this._user = e || { email: void 0, id: void 0, ip_address: void 0, username: void 0 }, this._session && le(this._session, { user: e }), this._notifyScopeListeners(), this;
899
+ }
900
+ getUser() {
901
+ return this._user;
902
+ }
903
+ getRequestSession() {
904
+ return this._requestSession;
905
+ }
906
+ setRequestSession(e) {
907
+ return this._requestSession = e, this;
908
+ }
909
+ setTags(e) {
910
+ return this._tags = { ...this._tags, ...e }, this._notifyScopeListeners(), this;
911
+ }
912
+ setTag(e, n) {
913
+ return this._tags = { ...this._tags, [e]: n }, this._notifyScopeListeners(), this;
914
+ }
915
+ setExtras(e) {
916
+ return this._extra = { ...this._extra, ...e }, this._notifyScopeListeners(), this;
917
+ }
918
+ setExtra(e, n) {
919
+ return this._extra = { ...this._extra, [e]: n }, this._notifyScopeListeners(), this;
920
+ }
921
+ setFingerprint(e) {
922
+ return this._fingerprint = e, this._notifyScopeListeners(), this;
923
+ }
924
+ setLevel(e) {
925
+ return this._level = e, this._notifyScopeListeners(), this;
926
+ }
927
+ setTransactionName(e) {
928
+ return this._transactionName = e, this._notifyScopeListeners(), this;
929
+ }
930
+ setContext(e, n) {
931
+ return n === null ? delete this._contexts[e] : this._contexts[e] = n, this._notifyScopeListeners(), this;
932
+ }
933
+ setSession(e) {
934
+ return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this;
935
+ }
936
+ getSession() {
937
+ return this._session;
938
+ }
939
+ update(e) {
940
+ if (!e) return this;
941
+ let n = typeof e == "function" ? e(this) : e, [r, s] = n instanceof C ? [n.getScopeData(), n.getRequestSession()] : R(n) ? [e, e.requestSession] : [], { tags: o, extra: i, user: a, contexts: c, level: u, fingerprint: p = [], propagationContext: l } = r || {};
942
+ return this._tags = { ...this._tags, ...o }, this._extra = { ...this._extra, ...i }, this._contexts = { ...this._contexts, ...c }, a && Object.keys(a).length && (this._user = a), u && (this._level = u), p.length && (this._fingerprint = p), l && (this._propagationContext = l), s && (this._requestSession = s), this;
943
+ }
944
+ clear() {
945
+ return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._requestSession = void 0, this._session = void 0, Nt(this, void 0), this._attachments = [], this._propagationContext = Fe(), this._notifyScopeListeners(), this;
946
+ }
947
+ addBreadcrumb(e, n) {
948
+ let r = typeof n == "number" ? n : br;
949
+ if (r <= 0) return this;
950
+ let s = { timestamp: W(), ...e }, o = this._breadcrumbs;
951
+ return o.push(s), this._breadcrumbs = o.length > r ? o.slice(-r) : o, this._notifyScopeListeners(), this;
952
+ }
953
+ getLastBreadcrumb() {
954
+ return this._breadcrumbs[this._breadcrumbs.length - 1];
955
+ }
956
+ clearBreadcrumbs() {
957
+ return this._breadcrumbs = [], this._notifyScopeListeners(), this;
958
+ }
959
+ addAttachment(e) {
960
+ return this._attachments.push(e), this;
961
+ }
962
+ clearAttachments() {
963
+ return this._attachments = [], this;
964
+ }
965
+ getScopeData() {
966
+ return { breadcrumbs: this._breadcrumbs, attachments: this._attachments, contexts: this._contexts, tags: this._tags, extra: this._extra, user: this._user, level: this._level, fingerprint: this._fingerprint || [], eventProcessors: this._eventProcessors, propagationContext: this._propagationContext, sdkProcessingMetadata: this._sdkProcessingMetadata, transactionName: this._transactionName, span: q(this) };
967
+ }
968
+ setSDKProcessingMetadata(e) {
969
+ return this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...e }, this;
970
+ }
971
+ setPropagationContext(e) {
972
+ return this._propagationContext = e, this;
973
+ }
974
+ getPropagationContext() {
975
+ return this._propagationContext;
976
+ }
977
+ captureException(e, n) {
978
+ let r = n && n.event_id ? n.event_id : T();
979
+ if (!this._client) return d.warn("No client configured on scope - will not capture exception!"), r;
980
+ let s = new Error("Sentry syntheticException");
981
+ return this._client.captureException(e, { originalException: e, syntheticException: s, ...n, event_id: r }, this), r;
982
+ }
983
+ captureMessage(e, n, r) {
984
+ let s = r && r.event_id ? r.event_id : T();
985
+ if (!this._client) return d.warn("No client configured on scope - will not capture message!"), s;
986
+ let o = new Error(e);
987
+ return this._client.captureMessage(e, n, { originalException: e, syntheticException: o, ...r, event_id: s }, this), s;
988
+ }
989
+ captureEvent(e, n) {
990
+ let r = n && n.event_id ? n.event_id : T();
991
+ return this._client ? (this._client.captureEvent(e, { ...n, event_id: r }, this), r) : (d.warn("No client configured on scope - will not capture event!"), r);
992
+ }
993
+ _notifyScopeListeners() {
994
+ this._notifyingListeners || (this._notifyingListeners = true, this._scopeListeners.forEach((e) => {
995
+ e(this);
996
+ }), this._notifyingListeners = false);
997
+ }
998
+ };
999
+ var C = pe;
1000
+ function cn() {
1001
+ return V("defaultCurrentScope", () => new C());
1002
+ }
1003
+ function un() {
1004
+ return V("defaultIsolationScope", () => new C());
1005
+ }
1006
+ var Ot = class {
1007
+ constructor(e, n) {
1008
+ let r;
1009
+ e ? r = e : r = new C();
1010
+ let s;
1011
+ n ? s = n : s = new C(), this._stack = [{ scope: r }], this._isolationScope = s;
1012
+ }
1013
+ withScope(e) {
1014
+ let n = this._pushScope(), r;
1015
+ try {
1016
+ r = e(n);
1017
+ } catch (s) {
1018
+ throw this._popScope(), s;
1019
+ }
1020
+ return O(r) ? r.then((s) => (this._popScope(), s), (s) => {
1021
+ throw this._popScope(), s;
1022
+ }) : (this._popScope(), r);
1023
+ }
1024
+ getClient() {
1025
+ return this.getStackTop().client;
1026
+ }
1027
+ getScope() {
1028
+ return this.getStackTop().scope;
1029
+ }
1030
+ getIsolationScope() {
1031
+ return this._isolationScope;
1032
+ }
1033
+ getStack() {
1034
+ return this._stack;
1035
+ }
1036
+ getStackTop() {
1037
+ return this._stack[this._stack.length - 1];
1038
+ }
1039
+ _pushScope() {
1040
+ let e = this.getScope().clone();
1041
+ return this.getStack().push({ client: this.getClient(), scope: e }), e;
1042
+ }
1043
+ _popScope() {
1044
+ return this.getStack().length <= 1 ? false : !!this.getStack().pop();
1045
+ }
1046
+ };
1047
+ function Z() {
1048
+ let t = F(), e = ue(t);
1049
+ return e.stack = e.stack || new Ot(cn(), un());
1050
+ }
1051
+ function Cr(t) {
1052
+ return Z().withScope(t);
1053
+ }
1054
+ function Rr(t, e) {
1055
+ let n = Z();
1056
+ return n.withScope(() => (n.getStackTop().scope = t, e(t)));
1057
+ }
1058
+ function ln(t) {
1059
+ return Z().withScope(() => t(Z().getIsolationScope()));
1060
+ }
1061
+ function pn() {
1062
+ return { withIsolationScope: ln, withScope: Cr, withSetScope: Rr, withSetIsolationScope: (t, e) => ln(e), getCurrentScope: () => Z().getScope(), getIsolationScope: () => Z().getIsolationScope() };
1063
+ }
1064
+ function de(t) {
1065
+ let e = ue(t);
1066
+ return e.acs ? e.acs : pn();
1067
+ }
1068
+ function vt() {
1069
+ let t = F();
1070
+ return de(t).getCurrentScope();
1071
+ }
1072
+ function z() {
1073
+ let t = F();
1074
+ return de(t).getIsolationScope();
1075
+ }
1076
+ function dn() {
1077
+ return V("globalScope", () => new C());
1078
+ }
1079
+ function fn() {
1080
+ return vt().getClient();
1081
+ }
1082
+ var Nr = "_sentryMetrics";
1083
+ function mn(t) {
1084
+ let e = t[Nr];
1085
+ if (!e) return;
1086
+ let n = {};
1087
+ for (let [, [r, s]] of e) n[r] || (n[r] = []), n[r].push(S(s));
1088
+ return n;
1089
+ }
1090
+ var gn = "sentry.source";
1091
+ var hn = "sentry.sample_rate";
1092
+ var _n = "sentry.op";
1093
+ var En = "sentry.origin";
1094
+ var Or = 1;
1095
+ function Ue(t) {
1096
+ let { spanId: e, traceId: n } = t.spanContext(), { parent_span_id: r } = X(t);
1097
+ return S({ parent_span_id: r, span_id: e, trace_id: n });
1098
+ }
1099
+ function Sn(t) {
1100
+ return typeof t == "number" ? yn(t) : Array.isArray(t) ? t[0] + t[1] / 1e9 : t instanceof Date ? yn(t.getTime()) : oe();
1101
+ }
1102
+ function yn(t) {
1103
+ return t > 9999999999 ? t / 1e3 : t;
1104
+ }
1105
+ function X(t) {
1106
+ if (wr(t)) return t.getSpanJSON();
1107
+ try {
1108
+ let { spanId: e, traceId: n } = t.spanContext();
1109
+ if (vr(t)) {
1110
+ let { attributes: r, startTime: s, name: o, endTime: i, parentSpanId: a, status: c } = t;
1111
+ return S({ span_id: e, trace_id: n, data: r, description: o, parent_span_id: a, start_timestamp: Sn(s), timestamp: Sn(i) || void 0, status: Dr(c), op: r[_n], origin: r[En], _metrics_summary: mn(t) });
1112
+ }
1113
+ return { span_id: e, trace_id: n };
1114
+ } catch {
1115
+ return {};
1116
+ }
1117
+ }
1118
+ function vr(t) {
1119
+ let e = t;
1120
+ return !!e.attributes && !!e.startTime && !!e.name && !!e.endTime && !!e.status;
1121
+ }
1122
+ function wr(t) {
1123
+ return typeof t.getSpanJSON == "function";
1124
+ }
1125
+ function Tn(t) {
1126
+ let { traceFlags: e } = t.spanContext();
1127
+ return e === Or;
1128
+ }
1129
+ function Dr(t) {
1130
+ if (!(!t || t.code === 0)) return t.code === 1 ? "ok" : t.message || "unknown_error";
1131
+ }
1132
+ var Mr = "_sentryRootSpan";
1133
+ function U(t) {
1134
+ return t[Mr] || t;
1135
+ }
1136
+ function In() {
1137
+ let t = F(), e = de(t);
1138
+ return e.getActiveSpan ? e.getActiveSpan() : q(vt());
1139
+ }
1140
+ var xn = false;
1141
+ function An() {
1142
+ xn || (xn = true, lt(wt), pt(wt));
1143
+ }
1144
+ function wt() {
1145
+ let t = In(), e = t && U(t);
1146
+ if (e) {
1147
+ let n = "internal_error";
1148
+ _ && d.log(`[Tracing] Root span: ${n} -> Global error occured`), e.setStatus({ code: 2, message: n });
1149
+ }
1150
+ }
1151
+ wt.tag = "sentry_tracingErrorCallback";
1152
+ var $e = "production";
1153
+ var Pr = "_frozenDsc";
1154
+ function fe(t, e) {
1155
+ let n = e.getOptions(), { publicKey: r } = e.getDsn() || {}, s = S({ environment: n.environment || $e, release: n.release, public_key: r, trace_id: t });
1156
+ return e.emit("createDsc", s), s;
1157
+ }
1158
+ function Be(t) {
1159
+ let e = fn();
1160
+ if (!e) return {};
1161
+ let n = fe(X(t).trace_id || "", e), r = U(t);
1162
+ if (!r) return n;
1163
+ let s = r[Pr];
1164
+ if (s) return s;
1165
+ let o = X(r), i = o.data || {}, a = i[hn];
1166
+ a != null && (n.sample_rate = `${a}`);
1167
+ let c = i[gn];
1168
+ return c && c !== "url" && (n.transaction = o.description), n.sampled = String(Tn(r)), e.emit("createDsc", n), n;
1169
+ }
1170
+ function bn(t) {
1171
+ if (typeof t == "boolean") return Number(t);
1172
+ let e = typeof t == "string" ? parseFloat(t) : t;
1173
+ if (typeof e != "number" || isNaN(e) || e < 0 || e > 1) {
1174
+ _ && d.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);
1175
+ return;
1176
+ }
1177
+ return e;
1178
+ }
1179
+ function kr(t, e) {
1180
+ return e && (t.sdk = t.sdk || {}, t.sdk.name = t.sdk.name || e.name, t.sdk.version = t.sdk.version || e.version, t.sdk.integrations = [...t.sdk.integrations || [], ...e.integrations || []], t.sdk.packages = [...t.sdk.packages || [], ...e.packages || []]), t;
1181
+ }
1182
+ function Cn(t, e, n, r) {
1183
+ let s = Le(n), o = { sent_at: (/* @__PURE__ */ new Date()).toISOString(), ...s && { sdk: s }, ...!!r && e && { dsn: k(e) } }, i = "aggregates" in t ? [{ type: "sessions" }, t] : [{ type: "session" }, t.toJSON()];
1184
+ return L(o, [i]);
1185
+ }
1186
+ function Rn(t, e, n, r) {
1187
+ let s = Le(n), o = t.type && t.type !== "replay_event" ? t.type : "event";
1188
+ kr(t, n && n.sdk);
1189
+ let i = Tt(t, s, r, e);
1190
+ return delete t.sdkProcessingMetadata, L(i, [[{ type: o }, t]]);
1191
+ }
1192
+ function He(t, e, n, r = 0) {
1193
+ return new I((s, o) => {
1194
+ let i = t[r];
1195
+ if (e === null || typeof i != "function") s(e);
1196
+ else {
1197
+ let a = i({ ...e }, n);
1198
+ _ && i.id && a === null && d.log(`Event processor "${i.id}" dropped event`), O(a) ? a.then((c) => He(t, c, n, r + 1).then(s)).then(null, o) : He(t, a, n, r + 1).then(s).then(null, o);
1199
+ }
1200
+ });
1201
+ }
1202
+ function Nn(t, e) {
1203
+ let { fingerprint: n, span: r, breadcrumbs: s, sdkProcessingMetadata: o } = e;
1204
+ Lr(t, e), r && $r(t, r), Br(t, n), Fr(t, s), Ur(t, o);
1205
+ }
1206
+ function Dt(t, e) {
1207
+ let { extra: n, tags: r, user: s, contexts: o, level: i, sdkProcessingMetadata: a, breadcrumbs: c, fingerprint: u, eventProcessors: p, attachments: l, propagationContext: g, transactionName: f, span: h } = e;
1208
+ me(t, "extra", n), me(t, "tags", r), me(t, "user", s), me(t, "contexts", o), me(t, "sdkProcessingMetadata", a), i && (t.level = i), f && (t.transactionName = f), h && (t.span = h), c.length && (t.breadcrumbs = [...t.breadcrumbs, ...c]), u.length && (t.fingerprint = [...t.fingerprint, ...u]), p.length && (t.eventProcessors = [...t.eventProcessors, ...p]), l.length && (t.attachments = [...t.attachments, ...l]), t.propagationContext = { ...t.propagationContext, ...g };
1209
+ }
1210
+ function me(t, e, n) {
1211
+ if (n && Object.keys(n).length) {
1212
+ t[e] = { ...t[e] };
1213
+ for (let r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[e][r] = n[r]);
1214
+ }
1215
+ }
1216
+ function Lr(t, e) {
1217
+ let { extra: n, tags: r, user: s, contexts: o, level: i, transactionName: a } = e, c = S(n);
1218
+ c && Object.keys(c).length && (t.extra = { ...c, ...t.extra });
1219
+ let u = S(r);
1220
+ u && Object.keys(u).length && (t.tags = { ...u, ...t.tags });
1221
+ let p = S(s);
1222
+ p && Object.keys(p).length && (t.user = { ...p, ...t.user });
1223
+ let l = S(o);
1224
+ l && Object.keys(l).length && (t.contexts = { ...l, ...t.contexts }), i && (t.level = i), a && t.type !== "transaction" && (t.transaction = a);
1225
+ }
1226
+ function Fr(t, e) {
1227
+ let n = [...t.breadcrumbs || [], ...e];
1228
+ t.breadcrumbs = n.length ? n : void 0;
1229
+ }
1230
+ function Ur(t, e) {
1231
+ t.sdkProcessingMetadata = { ...t.sdkProcessingMetadata, ...e };
1232
+ }
1233
+ function $r(t, e) {
1234
+ t.contexts = { trace: Ue(e), ...t.contexts }, t.sdkProcessingMetadata = { dynamicSamplingContext: Be(e), ...t.sdkProcessingMetadata };
1235
+ let n = U(e), r = X(n).description;
1236
+ r && !t.transaction && t.type === "transaction" && (t.transaction = r);
1237
+ }
1238
+ function Br(t, e) {
1239
+ t.fingerprint = t.fingerprint ? ae(t.fingerprint) : [], e && (t.fingerprint = t.fingerprint.concat(e)), t.fingerprint && !t.fingerprint.length && delete t.fingerprint;
1240
+ }
1241
+ function vn(t, e, n, r, s, o) {
1242
+ let { normalizeDepth: i = 3, normalizeMaxBreadth: a = 1e3 } = t, c = { ...e, event_id: e.event_id || n.event_id || T(), timestamp: e.timestamp || W() }, u = n.integrations || t.integrations.map((y) => y.name);
1243
+ Hr(c, t), qr(c, u), e.type === void 0 && jr(c, t.stackParser);
1244
+ let p = Yr(r, n.captureContext);
1245
+ n.mechanism && j(c, n.mechanism);
1246
+ let l = s ? s.getEventProcessors() : [], g = dn().getScopeData();
1247
+ if (o) {
1248
+ let y = o.getScopeData();
1249
+ Dt(g, y);
1250
+ }
1251
+ if (p) {
1252
+ let y = p.getScopeData();
1253
+ Dt(g, y);
1254
+ }
1255
+ let f = [...n.attachments || [], ...g.attachments];
1256
+ f.length && (n.attachments = f), Nn(c, g);
1257
+ let h = [...l, ...g.eventProcessors];
1258
+ return He(h, c, n).then((y) => (y && Gr(y), typeof i == "number" && i > 0 ? zr(y, i, a) : y));
1259
+ }
1260
+ function Hr(t, e) {
1261
+ let { environment: n, release: r, dist: s, maxValueLength: o = 250 } = e;
1262
+ "environment" in t || (t.environment = "environment" in e ? n : $e), t.release === void 0 && r !== void 0 && (t.release = r), t.dist === void 0 && s !== void 0 && (t.dist = s), t.message && (t.message = D(t.message, o));
1263
+ let i = t.exception && t.exception.values && t.exception.values[0];
1264
+ i && i.value && (i.value = D(i.value, o));
1265
+ let a = t.request;
1266
+ a && a.url && (a.url = D(a.url, o));
1267
+ }
1268
+ var On = /* @__PURE__ */ new WeakMap();
1269
+ function jr(t, e) {
1270
+ let n = m._sentryDebugIds;
1271
+ if (!n) return;
1272
+ let r, s = On.get(e);
1273
+ s ? r = s : (r = /* @__PURE__ */ new Map(), On.set(e, r));
1274
+ let o = Object.keys(n).reduce((i, a) => {
1275
+ let c, u = r.get(a);
1276
+ u ? c = u : (c = e(a), r.set(a, c));
1277
+ for (let p = c.length - 1; p >= 0; p--) {
1278
+ let l = c[p];
1279
+ if (l.filename) {
1280
+ i[l.filename] = n[a];
1281
+ break;
1282
+ }
1283
+ }
1284
+ return i;
1285
+ }, {});
1286
+ try {
1287
+ t.exception.values.forEach((i) => {
1288
+ i.stacktrace.frames.forEach((a) => {
1289
+ a.filename && (a.debug_id = o[a.filename]);
1290
+ });
1291
+ });
1292
+ } catch {
1293
+ }
1294
+ }
1295
+ function Gr(t) {
1296
+ let e = {};
1297
+ try {
1298
+ t.exception.values.forEach((r) => {
1299
+ r.stacktrace.frames.forEach((s) => {
1300
+ s.debug_id && (s.abs_path ? e[s.abs_path] = s.debug_id : s.filename && (e[s.filename] = s.debug_id), delete s.debug_id);
1301
+ });
1302
+ });
1303
+ } catch {
1304
+ }
1305
+ if (Object.keys(e).length === 0) return;
1306
+ t.debug_meta = t.debug_meta || {}, t.debug_meta.images = t.debug_meta.images || [];
1307
+ let n = t.debug_meta.images;
1308
+ Object.keys(e).forEach((r) => {
1309
+ n.push({ type: "sourcemap", code_file: r, debug_id: e[r] });
1310
+ });
1311
+ }
1312
+ function qr(t, e) {
1313
+ e.length > 0 && (t.sdk = t.sdk || {}, t.sdk.integrations = [...t.sdk.integrations || [], ...e]);
1314
+ }
1315
+ function zr(t, e, n) {
1316
+ if (!t) return null;
1317
+ let r = { ...t, ...t.breadcrumbs && { breadcrumbs: t.breadcrumbs.map((s) => ({ ...s, ...s.data && { data: N(s.data, e, n) } })) }, ...t.user && { user: N(t.user, e, n) }, ...t.contexts && { contexts: N(t.contexts, e, n) }, ...t.extra && { extra: N(t.extra, e, n) } };
1318
+ return t.contexts && t.contexts.trace && r.contexts && (r.contexts.trace = t.contexts.trace, t.contexts.trace.data && (r.contexts.trace.data = N(t.contexts.trace.data, e, n))), t.spans && (r.spans = t.spans.map((s) => ({ ...s, ...s.data && { data: N(s.data, e, n) } }))), r;
1319
+ }
1320
+ function Yr(t, e) {
1321
+ if (!e) return t;
1322
+ let n = t ? t.clone() : new C();
1323
+ return n.update(e), n;
1324
+ }
1325
+ var je = class {
1326
+ constructor(e, n) {
1327
+ this._client = e, this.flushTimeout = 60, this._pendingAggregates = {}, this._isEnabled = true, this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3), this._intervalId.unref && this._intervalId.unref(), this._sessionAttrs = n;
1328
+ }
1329
+ flush() {
1330
+ let e = this.getSessionAggregates();
1331
+ e.aggregates.length !== 0 && (this._pendingAggregates = {}, this._client.sendSession(e));
1332
+ }
1333
+ getSessionAggregates() {
1334
+ let e = Object.keys(this._pendingAggregates).map((r) => this._pendingAggregates[parseInt(r)]), n = { attrs: this._sessionAttrs, aggregates: e };
1335
+ return S(n);
1336
+ }
1337
+ close() {
1338
+ clearInterval(this._intervalId), this._isEnabled = false, this.flush();
1339
+ }
1340
+ incrementSessionStatusCount() {
1341
+ if (!this._isEnabled) return;
1342
+ let e = z(), n = e.getRequestSession();
1343
+ n && n.status && (this._incrementSessionStatusCount(n.status, /* @__PURE__ */ new Date()), e.setRequestSession(void 0));
1344
+ }
1345
+ _incrementSessionStatusCount(e, n) {
1346
+ let r = new Date(n).setSeconds(0, 0);
1347
+ this._pendingAggregates[r] = this._pendingAggregates[r] || {};
1348
+ let s = this._pendingAggregates[r];
1349
+ switch (s.started || (s.started = new Date(r).toISOString()), e) {
1350
+ case "errored":
1351
+ return s.errored = (s.errored || 0) + 1, s.errored;
1352
+ case "ok":
1353
+ return s.exited = (s.exited || 0) + 1, s.exited;
1354
+ default:
1355
+ return s.crashed = (s.crashed || 0) + 1, s.crashed;
1356
+ }
1357
+ }
1358
+ };
1359
+ var Jr = "7";
1360
+ function Vr(t) {
1361
+ let e = t.protocol ? `${t.protocol}:` : "", n = t.port ? `:${t.port}` : "";
1362
+ return `${e}//${t.host}${n}${t.path ? `/${t.path}` : ""}/api/`;
1363
+ }
1364
+ function Wr(t) {
1365
+ return `${Vr(t)}${t.projectId}/envelope/`;
1366
+ }
1367
+ function Kr(t, e) {
1368
+ return at({ sentry_key: t.publicKey, sentry_version: Jr, ...e && { sentry_client: `${e.name}/${e.version}` } });
1369
+ }
1370
+ function wn(t, e, n) {
1371
+ return e || `${Wr(t)}?${Kr(t, n)}`;
1372
+ }
1373
+ var Dn = [];
1374
+ function Zr(t) {
1375
+ let e = {};
1376
+ return t.forEach((n) => {
1377
+ let { name: r } = n, s = e[r];
1378
+ s && !s.isDefaultInstance && n.isDefaultInstance || (e[r] = n);
1379
+ }), Object.keys(e).map((n) => e[n]);
1380
+ }
1381
+ function Mt(t) {
1382
+ let e = t.defaultIntegrations || [], n = t.integrations;
1383
+ e.forEach((i) => {
1384
+ i.isDefaultInstance = true;
1385
+ });
1386
+ let r;
1387
+ Array.isArray(n) ? r = [...e, ...n] : typeof n == "function" ? r = ae(n(e)) : r = e;
1388
+ let s = Zr(r), o = Xr(s, (i) => i.name === "Debug");
1389
+ if (o !== -1) {
1390
+ let [i] = s.splice(o, 1);
1391
+ s.push(i);
1392
+ }
1393
+ return s;
1394
+ }
1395
+ function Mn(t, e) {
1396
+ let n = {};
1397
+ return e.forEach((r) => {
1398
+ r && kt(t, r, n);
1399
+ }), n;
1400
+ }
1401
+ function Pt(t, e) {
1402
+ for (let n of e) n && n.afterAllSetup && n.afterAllSetup(t);
1403
+ }
1404
+ function kt(t, e, n) {
1405
+ if (n[e.name]) {
1406
+ _ && d.log(`Integration skipped because it was already installed: ${e.name}`);
1407
+ return;
1408
+ }
1409
+ if (n[e.name] = e, Dn.indexOf(e.name) === -1 && typeof e.setupOnce == "function" && (e.setupOnce(), Dn.push(e.name)), e.setup && typeof e.setup == "function" && e.setup(t), typeof e.preprocessEvent == "function") {
1410
+ let r = e.preprocessEvent.bind(e);
1411
+ t.on("preprocessEvent", (s, o) => r(s, o, t));
1412
+ }
1413
+ if (typeof e.processEvent == "function") {
1414
+ let r = e.processEvent.bind(e), s = Object.assign((o, i) => r(o, i, t), { id: e.name });
1415
+ t.addEventProcessor(s);
1416
+ }
1417
+ _ && d.log(`Integration installed: ${e.name}`);
1418
+ }
1419
+ function Xr(t, e) {
1420
+ for (let n = 0; n < t.length; n++) if (e(t[n]) === true) return n;
1421
+ return -1;
1422
+ }
1423
+ var Pn = "Not capturing exception because it's already been captured.";
1424
+ var Ge = class {
1425
+ constructor(e) {
1426
+ if (this._options = e, this._integrations = {}, this._numProcessing = 0, this._outcomes = {}, this._hooks = {}, this._eventProcessors = [], e.dsn ? this._dsn = xe(e.dsn) : _ && d.warn("No DSN provided, client will not send events."), this._dsn) {
1427
+ let n = wn(this._dsn, e.tunnel, e._metadata ? e._metadata.sdk : void 0);
1428
+ this._transport = e.transport({ tunnel: this._options.tunnel, recordDroppedEvent: this.recordDroppedEvent.bind(this), ...e.transportOptions, url: n });
1429
+ }
1430
+ }
1431
+ captureException(e, n, r) {
1432
+ let s = T();
1433
+ if (Me(e)) return _ && d.log(Pn), s;
1434
+ let o = { event_id: s, ...n };
1435
+ return this._process(this.eventFromException(e, o).then((i) => this._captureEvent(i, o, r))), o.event_id;
1436
+ }
1437
+ captureMessage(e, n, r, s) {
1438
+ let o = { event_id: T(), ...r }, i = J(e) ? e : String(e), a = Te(e) ? this.eventFromMessage(i, n, o) : this.eventFromException(e, o);
1439
+ return this._process(a.then((c) => this._captureEvent(c, o, s))), o.event_id;
1440
+ }
1441
+ captureEvent(e, n, r) {
1442
+ let s = T();
1443
+ if (n && n.originalException && Me(n.originalException)) return _ && d.log(Pn), s;
1444
+ let o = { event_id: s, ...n }, a = (e.sdkProcessingMetadata || {}).capturedSpanScope;
1445
+ return this._process(this._captureEvent(e, o, a || r)), o.event_id;
1446
+ }
1447
+ captureSession(e) {
1448
+ typeof e.release != "string" ? _ && d.warn("Discarded session because of missing or non-string release") : (this.sendSession(e), le(e, { init: false }));
1449
+ }
1450
+ getDsn() {
1451
+ return this._dsn;
1452
+ }
1453
+ getOptions() {
1454
+ return this._options;
1455
+ }
1456
+ getSdkMetadata() {
1457
+ return this._options._metadata;
1458
+ }
1459
+ getTransport() {
1460
+ return this._transport;
1461
+ }
1462
+ flush(e) {
1463
+ let n = this._transport;
1464
+ return n ? (this.emit("flush"), this._isClientDoneProcessing(e).then((r) => n.flush(e).then((s) => r && s))) : b(true);
1465
+ }
1466
+ close(e) {
1467
+ return this.flush(e).then((n) => (this.getOptions().enabled = false, this.emit("close"), n));
1468
+ }
1469
+ getEventProcessors() {
1470
+ return this._eventProcessors;
1471
+ }
1472
+ addEventProcessor(e) {
1473
+ this._eventProcessors.push(e);
1474
+ }
1475
+ init() {
1476
+ this._isEnabled() && this._setupIntegrations();
1477
+ }
1478
+ getIntegrationByName(e) {
1479
+ return this._integrations[e];
1480
+ }
1481
+ addIntegration(e) {
1482
+ let n = this._integrations[e.name];
1483
+ kt(this, e, this._integrations), n || Pt(this, [e]);
1484
+ }
1485
+ sendEvent(e, n = {}) {
1486
+ this.emit("beforeSendEvent", e, n);
1487
+ let r = Rn(e, this._dsn, this._options._metadata, this._options.tunnel);
1488
+ for (let o of n.attachments || []) r = Et(r, yt(o));
1489
+ let s = this.sendEnvelope(r);
1490
+ s && s.then((o) => this.emit("afterSendEvent", e, o), null);
1491
+ }
1492
+ sendSession(e) {
1493
+ let n = Cn(e, this._dsn, this._options._metadata, this._options.tunnel);
1494
+ this.sendEnvelope(n);
1495
+ }
1496
+ recordDroppedEvent(e, n, r) {
1497
+ if (this._options.sendClientReports) {
1498
+ let s = `${e}:${n}`;
1499
+ _ && d.log(`Adding outcome: "${s}"`), this._outcomes[s] = this._outcomes[s] + 1 || 1;
1500
+ }
1501
+ }
1502
+ on(e, n) {
1503
+ this._hooks[e] || (this._hooks[e] = []), this._hooks[e].push(n);
1504
+ }
1505
+ emit(e, ...n) {
1506
+ this._hooks[e] && this._hooks[e].forEach((r) => r(...n));
1507
+ }
1508
+ sendEnvelope(e) {
1509
+ return this.emit("beforeEnvelope", e), this._isEnabled() && this._transport ? this._transport.send(e).then(null, (n) => (_ && d.error("Error while sending event:", n), n)) : (_ && d.error("Transport disabled"), b({}));
1510
+ }
1511
+ _setupIntegrations() {
1512
+ let { integrations: e } = this._options;
1513
+ this._integrations = Mn(this, e), Pt(this, e);
1514
+ }
1515
+ _updateSessionFromEvent(e, n) {
1516
+ let r = false, s = false, o = n.exception && n.exception.values;
1517
+ if (o) {
1518
+ s = true;
1519
+ for (let c of o) {
1520
+ let u = c.mechanism;
1521
+ if (u && u.handled === false) {
1522
+ r = true;
1523
+ break;
1524
+ }
1525
+ }
1526
+ }
1527
+ let i = e.status === "ok";
1528
+ (i && e.errors === 0 || i && r) && (le(e, { ...r && { status: "crashed" }, errors: e.errors || Number(s || r) }), this.captureSession(e));
1529
+ }
1530
+ _isClientDoneProcessing(e) {
1531
+ return new I((n) => {
1532
+ let r = 0, s = 1, o = setInterval(() => {
1533
+ this._numProcessing == 0 ? (clearInterval(o), n(true)) : (r += s, e && r >= e && (clearInterval(o), n(false)));
1534
+ }, s);
1535
+ });
1536
+ }
1537
+ _isEnabled() {
1538
+ return this.getOptions().enabled !== false && this._transport !== void 0;
1539
+ }
1540
+ _prepareEvent(e, n, r, s = z()) {
1541
+ let o = this.getOptions(), i = Object.keys(this._integrations);
1542
+ return !n.integrations && i.length > 0 && (n.integrations = i), this.emit("preprocessEvent", e, n), e.type || s.setLastEventId(e.event_id || n.event_id), vn(o, e, n, r, this, s).then((a) => {
1543
+ if (a === null) return a;
1544
+ let c = { ...s.getPropagationContext(), ...r ? r.getPropagationContext() : void 0 };
1545
+ if (!(a.contexts && a.contexts.trace) && c) {
1546
+ let { traceId: p, spanId: l, parentSpanId: g, dsc: f } = c;
1547
+ a.contexts = { trace: S({ trace_id: p, span_id: l, parent_span_id: g }), ...a.contexts };
1548
+ let h = f || fe(p, this);
1549
+ a.sdkProcessingMetadata = { dynamicSamplingContext: h, ...a.sdkProcessingMetadata };
1550
+ }
1551
+ return a;
1552
+ });
1553
+ }
1554
+ _captureEvent(e, n = {}, r) {
1555
+ return this._processEvent(e, n, r).then((s) => s.event_id, (s) => {
1556
+ if (_) {
1557
+ let o = s;
1558
+ o.logLevel === "log" ? d.log(o.message) : d.warn(o);
1559
+ }
1560
+ });
1561
+ }
1562
+ _processEvent(e, n, r) {
1563
+ let s = this.getOptions(), { sampleRate: o } = s, i = Ln(e), a = kn(e), c = e.type || "error", u = `before send for type \`${c}\``, p = typeof o > "u" ? void 0 : bn(o);
1564
+ if (a && typeof p == "number" && Math.random() > p) return this.recordDroppedEvent("sample_rate", "error", e), G(new x(`Discarding event because it's not included in the random sample (sampling rate = ${o})`, "log"));
1565
+ let l = c === "replay_event" ? "replay" : c, f = (e.sdkProcessingMetadata || {}).capturedSpanIsolationScope;
1566
+ return this._prepareEvent(e, n, r, f).then((h) => {
1567
+ if (h === null) throw this.recordDroppedEvent("event_processor", l, e), new x("An event processor returned `null`, will not send event.", "log");
1568
+ if (n.data && n.data.__sentry__ === true) return h;
1569
+ let y = es(s, h, n);
1570
+ return Qr(y, u);
1571
+ }).then((h) => {
1572
+ if (h === null) throw this.recordDroppedEvent("before_send", l, e), new x(`${u} returned \`null\`, will not send event.`, "log");
1573
+ let Y = r && r.getSession();
1574
+ !i && Y && this._updateSessionFromEvent(Y, h);
1575
+ let y = h.transaction_info;
1576
+ if (i && y && h.transaction !== e.transaction) {
1577
+ let A = "custom";
1578
+ h.transaction_info = { ...y, source: A };
1579
+ }
1580
+ return this.sendEvent(h, n), h;
1581
+ }).then(null, (h) => {
1582
+ throw h instanceof x ? h : (this.captureException(h, { data: { __sentry__: true }, originalException: h }), new x(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
1583
+ Reason: ${h}`));
1584
+ });
1585
+ }
1586
+ _process(e) {
1587
+ this._numProcessing++, e.then((n) => (this._numProcessing--, n), (n) => (this._numProcessing--, n));
1588
+ }
1589
+ _clearOutcomes() {
1590
+ let e = this._outcomes;
1591
+ return this._outcomes = {}, Object.keys(e).map((n) => {
1592
+ let [r, s] = n.split(":");
1593
+ return { reason: r, category: s, quantity: e[n] };
1594
+ });
1595
+ }
1596
+ };
1597
+ function Qr(t, e) {
1598
+ let n = `${e} must return \`null\` or a valid event.`;
1599
+ if (O(t)) return t.then((r) => {
1600
+ if (!R(r) && r !== null) throw new x(n);
1601
+ return r;
1602
+ }, (r) => {
1603
+ throw new x(`${e} rejected with ${r}`);
1604
+ });
1605
+ if (!R(t) && t !== null) throw new x(n);
1606
+ return t;
1607
+ }
1608
+ function es(t, e, n) {
1609
+ let { beforeSend: r, beforeSendTransaction: s, beforeSendSpan: o } = t;
1610
+ if (kn(e) && r) return r(e, n);
1611
+ if (Ln(e)) {
1612
+ if (e.spans && o) {
1613
+ let i = [];
1614
+ for (let a of e.spans) {
1615
+ let c = o(a);
1616
+ c && i.push(c);
1617
+ }
1618
+ e.spans = i;
1619
+ }
1620
+ if (s) return s(e, n);
1621
+ }
1622
+ return e;
1623
+ }
1624
+ function kn(t) {
1625
+ return t.type === void 0;
1626
+ }
1627
+ function Ln(t) {
1628
+ return t.type === "transaction";
1629
+ }
1630
+ function Fn(t, e, n, r, s) {
1631
+ let o = { sent_at: (/* @__PURE__ */ new Date()).toISOString() };
1632
+ n && n.sdk && (o.sdk = { name: n.sdk.name, version: n.sdk.version }), r && s && (o.dsn = k(s)), e && (o.trace = S(e));
1633
+ let i = ts(t);
1634
+ return L(o, [i]);
1635
+ }
1636
+ function ts(t) {
1637
+ return [{ type: "check_in" }, t];
1638
+ }
1639
+ var ge = class extends Ge {
1640
+ constructor(e) {
1641
+ An(), super(e);
1642
+ }
1643
+ eventFromException(e, n) {
1644
+ return b(bt(this, this._options.stackParser, e, n));
1645
+ }
1646
+ eventFromMessage(e, n = "info", r) {
1647
+ return b(Ct(this._options.stackParser, e, n, r, this._options.attachStacktrace));
1648
+ }
1649
+ captureException(e, n, r) {
1650
+ if (this._options.autoSessionTracking && this._sessionFlusher) {
1651
+ let s = z().getRequestSession();
1652
+ s && s.status === "ok" && (s.status = "errored");
1653
+ }
1654
+ return super.captureException(e, n, r);
1655
+ }
1656
+ captureEvent(e, n, r) {
1657
+ if (this._options.autoSessionTracking && this._sessionFlusher && (e.type || "exception") === "exception" && e.exception && e.exception.values && e.exception.values.length > 0) {
1658
+ let i = z().getRequestSession();
1659
+ i && i.status === "ok" && (i.status = "errored");
1660
+ }
1661
+ return super.captureEvent(e, n, r);
1662
+ }
1663
+ close(e) {
1664
+ return this._sessionFlusher && this._sessionFlusher.close(), super.close(e);
1665
+ }
1666
+ initSessionFlusher() {
1667
+ let { release: e, environment: n } = this._options;
1668
+ e ? this._sessionFlusher = new je(this, { release: e, environment: n }) : _ && d.warn("Cannot initialise an instance of SessionFlusher if no release is provided!");
1669
+ }
1670
+ captureCheckIn(e, n, r) {
1671
+ let s = "checkInId" in e && e.checkInId ? e.checkInId : T();
1672
+ if (!this._isEnabled()) return _ && d.warn("SDK not enabled, will not capture checkin."), s;
1673
+ let o = this.getOptions(), { release: i, environment: a, tunnel: c } = o, u = { check_in_id: s, monitor_slug: e.monitorSlug, status: e.status, release: i, environment: a };
1674
+ "duration" in e && (u.duration = e.duration), n && (u.monitor_config = { schedule: n.schedule, checkin_margin: n.checkinMargin, max_runtime: n.maxRuntime, timezone: n.timezone, failure_issue_threshold: n.failureIssueThreshold, recovery_threshold: n.recoveryThreshold });
1675
+ let [p, l] = this._getTraceInfoFromScope(r);
1676
+ l && (u.contexts = { trace: l });
1677
+ let g = Fn(u, p, this.getSdkMetadata(), c, this.getDsn());
1678
+ return _ && d.info("Sending checkin:", e.monitorSlug, e.status), this.sendEnvelope(g), s;
1679
+ }
1680
+ _captureRequestSession() {
1681
+ this._sessionFlusher ? this._sessionFlusher.incrementSessionStatusCount() : _ && d.warn("Discarded request mode session because autoSessionTracking option was disabled");
1682
+ }
1683
+ _prepareEvent(e, n, r, s) {
1684
+ return this._options.platform && (e.platform = e.platform || this._options.platform), this._options.runtime && (e.contexts = { ...e.contexts, runtime: (e.contexts || {}).runtime || this._options.runtime }), this._options.serverName && (e.server_name = e.server_name || this._options.serverName), super._prepareEvent(e, n, r, s);
1685
+ }
1686
+ _getTraceInfoFromScope(e) {
1687
+ if (!e) return [void 0, void 0];
1688
+ let n = q(e);
1689
+ if (n) {
1690
+ let c = U(n);
1691
+ return [Be(c), Ue(c)];
1692
+ }
1693
+ let { traceId: r, spanId: s, parentSpanId: o, dsc: i } = e.getPropagationContext(), a = { trace_id: r, span_id: s, parent_span_id: o };
1694
+ return i ? [i, a] : [fe(r, this), a];
1695
+ }
1696
+ };
1697
+ var ns = 64;
1698
+ function Lt(t, e, n = gt(t.bufferSize || ns)) {
1699
+ let r = {}, s = (i) => n.drain(i);
1700
+ function o(i) {
1701
+ let a = [];
1702
+ if (Pe(i, (l, g) => {
1703
+ let f = ke(g);
1704
+ if (It(r, f)) {
1705
+ let h = Un(l, g);
1706
+ t.recordDroppedEvent("ratelimit_backoff", f, h);
1707
+ } else a.push(l);
1708
+ }), a.length === 0) return b({});
1709
+ let c = L(i[0], a), u = (l) => {
1710
+ Pe(c, (g, f) => {
1711
+ let h = Un(g, f);
1712
+ t.recordDroppedEvent(l, ke(f), h);
1713
+ });
1714
+ }, p = () => e({ body: St(c) }).then((l) => (l.statusCode !== void 0 && (l.statusCode < 200 || l.statusCode >= 300) && _ && d.warn(`Sentry responded with status code ${l.statusCode} to sent event.`), r = xt(r, l), l), (l) => {
1715
+ throw u("network_error"), l;
1716
+ });
1717
+ return n.add(p).then((l) => l, (l) => {
1718
+ if (l instanceof x) return _ && d.error("Skipped sending event because buffer is full."), u("queue_overflow"), b({});
1719
+ throw l;
1720
+ });
1721
+ }
1722
+ return { send: o, flush: s };
1723
+ }
1724
+ function Un(t, e) {
1725
+ if (!(e !== "event" && e !== "transaction")) return Array.isArray(t) ? t[1] : void 0;
1726
+ }
1727
+ var rs = "RewriteFrames";
1728
+ var qe = (t = {}) => {
1729
+ let e = t.root, n = t.prefix || "app:///", r = "window" in m && m.window !== void 0, s = t.iteratee || ss({ isBrowser: r, root: e, prefix: n });
1730
+ function o(a) {
1731
+ try {
1732
+ return { ...a, exception: { ...a.exception, values: a.exception.values.map((c) => ({ ...c, ...c.stacktrace && { stacktrace: i(c.stacktrace) } })) } };
1733
+ } catch {
1734
+ return a;
1735
+ }
1736
+ }
1737
+ function i(a) {
1738
+ return { ...a, frames: a && a.frames && a.frames.map((c) => s(c)) };
1739
+ }
1740
+ return { name: rs, processEvent(a) {
1741
+ let c = a;
1742
+ return a.exception && Array.isArray(a.exception.values) && (c = o(c)), c;
1743
+ } };
1744
+ };
1745
+ function ss({ isBrowser: t, root: e, prefix: n }) {
1746
+ return (r) => {
1747
+ if (!r.filename) return r;
1748
+ let s = /^[a-zA-Z]:\\/.test(r.filename) || r.filename.includes("\\") && !r.filename.includes("/"), o = /^\//.test(r.filename);
1749
+ if (t) {
1750
+ if (e) {
1751
+ let i = r.filename;
1752
+ i.indexOf(e) === 0 && (r.filename = i.replace(e, n));
1753
+ }
1754
+ } else if (s || o) {
1755
+ let i = s ? r.filename.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/") : r.filename, a = e ? mt(e, i) : ce(i);
1756
+ r.filename = `${n}${a}`;
1757
+ }
1758
+ return r;
1759
+ };
1760
+ }
1761
+ function Bn(t) {
1762
+ return typeof t == "object" && t !== null;
1763
+ }
1764
+ function is(t) {
1765
+ return Bn(t) && "handled" in t && typeof t.handled == "boolean" && "type" in t && typeof t.type == "string";
1766
+ }
1767
+ function as(t) {
1768
+ return Bn(t) && "mechanism" in t && is(t.mechanism);
1769
+ }
1770
+ function cs() {
1771
+ if (m.SENTRY_RELEASE && m.SENTRY_RELEASE.id) return m.SENTRY_RELEASE.id;
1772
+ }
1773
+ function $n(t, e) {
1774
+ return t !== void 0 ? (t[e[0]] = e[1], t) : { [e[0]]: e[1] };
1775
+ }
1776
+ function Hn(t, e) {
1777
+ return t(e.stack || "", 1);
1778
+ }
1779
+ function us(t) {
1780
+ let e = t && t.message;
1781
+ return e ? e.error && typeof e.error.message == "string" ? e.error.message : e : "No error message";
1782
+ }
1783
+ function jn(t, e) {
1784
+ let n = { type: e.name || e.constructor.name, value: us(e) }, r = Hn(t, e);
1785
+ return r.length && (n.stacktrace = { frames: r }), n.type === void 0 && n.value === "" && (n.value = "Unrecoverable error caught"), n;
1786
+ }
1787
+ function ls(t, e, n, r) {
1788
+ let s, i = (r && r.data && as(r.data) ? r.data.mechanism : void 0) ?? { handled: true, type: "generic" };
1789
+ if (B(n)) s = n;
1790
+ else {
1791
+ if (R(n)) {
1792
+ let c = `Non-Error exception captured with keys: ${ne(n)}`, u = t?.getClient(), p = u && u.getOptions().normalizeDepth;
1793
+ t?.setExtra("__serialized__", K(n, p)), s = r && r.syntheticException || new Error(c), s.message = c;
1794
+ } else s = r && r.syntheticException || new Error(n), s.message = n;
1795
+ i.synthetic = true;
1796
+ }
1797
+ let a = { exception: { values: [jn(e, s)] } };
1798
+ return ie(a, void 0, void 0), j(a, i), { ...a, event_id: r && r.event_id };
1799
+ }
1800
+ function ps(t, e, n = "info", r, s) {
1801
+ let o = { event_id: r && r.event_id, level: n, message: e };
1802
+ if (s && r && r.syntheticException) {
1803
+ let i = Hn(t, r.syntheticException);
1804
+ i.length && (o.exception = { values: [{ value: e, stacktrace: { frames: i } }] });
1805
+ }
1806
+ return o;
1807
+ }
1808
+ var ds = 5;
1809
+ var fs = (t = { limit: ds }) => ({ name: "LinkedErrors", processEvent: (e, n, r) => ms(r.getOptions().stackParser, t.limit, e, n) });
1810
+ function ms(t, e, n, r) {
1811
+ if (!n.exception || !n.exception.values || !r || !v(r.originalException, Error)) return n;
1812
+ let s = Gn(t, e, r.originalException);
1813
+ return n.exception.values = [...s, ...n.exception.values], n;
1814
+ }
1815
+ function Gn(t, e, n, r = []) {
1816
+ if (!v(n.cause, Error) || r.length + 1 >= e) return r;
1817
+ let s = jn(t, n.cause);
1818
+ return Gn(t, e, n.cause, [s, ...r]);
1819
+ }
1820
+ var gs = { allowedHeaders: ["CF-RAY", "CF-Worker"] };
1821
+ var hs = (t = {}) => {
1822
+ let e = { ...gs, ...t };
1823
+ return { name: "RequestData", preprocessEvent: (n) => {
1824
+ let { sdkProcessingMetadata: r } = n;
1825
+ return r && ("request" in r && r.request instanceof Request && (n.request = Es(r.request, e), n.user = _s(n.user ?? {}, r.request, e)), "requestData" in r && (n.request ? n.request.data = r.requestData : n.request = { data: r.requestData })), n;
1826
+ } };
1827
+ };
1828
+ function _s(t, e, n) {
1829
+ let r = e.headers.get("CF-Connecting-IP"), { allowedIps: s } = n, o = { ...t };
1830
+ return !("ip_address" in t) && r && s !== void 0 && Ss(r, s) && (o.ip_address = r), Object.keys(o).length > 0 ? o : void 0;
1831
+ }
1832
+ function Es(t, e) {
1833
+ let n = t.headers.get("cookie"), r;
1834
+ if (n) try {
1835
+ r = ys(n);
1836
+ } catch {
1837
+ }
1838
+ let s = {};
1839
+ for (let [u, p] of t.headers.entries()) u !== "cookie" && (s[u] = p);
1840
+ let o = { method: t.method, cookies: r, headers: s };
1841
+ try {
1842
+ let u = new URL(t.url);
1843
+ o.url = `${u.protocol}//${u.hostname}${u.pathname}`, o.query_string = u.search;
1844
+ } catch {
1845
+ let p = t.url.indexOf("?");
1846
+ p < 0 ? o.url = t.url : (o.url = t.url.substr(0, p), o.query_string = t.url.substr(p + 1));
1847
+ }
1848
+ let { allowedHeaders: i, allowedCookies: a, allowedSearchParams: c } = e;
1849
+ if (i !== void 0 && o.headers ? (o.headers = Ft(o.headers, i), Object.keys(o.headers).length === 0 && delete o.headers) : delete o.headers, a !== void 0 && o.cookies ? (o.cookies = Ft(o.cookies, a), Object.keys(o.cookies).length === 0 && delete o.cookies) : delete o.cookies, c !== void 0) {
1850
+ let u = Object.fromEntries(new URLSearchParams(o.query_string)), p = new URLSearchParams();
1851
+ Object.keys(Ft(u, c)).forEach((l) => {
1852
+ p.set(l, u[l]);
1853
+ }), o.query_string = p.toString();
1854
+ } else delete o.query_string;
1855
+ return o;
1856
+ }
1857
+ function Ss(t, e) {
1858
+ return typeof e == "boolean" ? e : e instanceof RegExp ? e.test(t) : Array.isArray(e) ? e.map((r) => r.toLowerCase()).includes(t) : false;
1859
+ }
1860
+ function Ft(t, e) {
1861
+ let n = () => false;
1862
+ if (typeof e == "boolean") return e ? t : {};
1863
+ if (e instanceof RegExp) n = (r) => e.test(r);
1864
+ else if (Array.isArray(e)) {
1865
+ let r = e.map((s) => s.toLowerCase());
1866
+ n = (s) => r.includes(s.toLowerCase());
1867
+ } else return {};
1868
+ return Object.keys(t).filter(n).reduce((r, s) => (r[s] = t[s], r), {});
1869
+ }
1870
+ function ys(t) {
1871
+ if (typeof t != "string") return {};
1872
+ try {
1873
+ return t.split(";").map((e) => e.split("=")).reduce((e, [n, r]) => (e[decodeURIComponent(n.trim())] = decodeURIComponent(r.trim()), e), {});
1874
+ } catch {
1875
+ return {};
1876
+ }
1877
+ }
1878
+ function Ts(t, e) {
1879
+ let n = {};
1880
+ return t.forEach((r) => {
1881
+ n[r.name] = r, typeof r.setupOnce == "function" && r.setupOnce();
1882
+ let s = e.getClient();
1883
+ if (s) {
1884
+ if (typeof r.setup == "function" && r.setup(s), typeof r.preprocessEvent == "function") {
1885
+ let o = r.preprocessEvent.bind(r);
1886
+ s.on("preprocessEvent", (i, a) => o(i, a, s));
1887
+ }
1888
+ if (typeof r.processEvent == "function") {
1889
+ let o = r.processEvent.bind(r), i = Object.assign((a, c) => o(a, c, s), { id: r.name });
1890
+ s.addEventProcessor(i);
1891
+ }
1892
+ }
1893
+ }), n;
1894
+ }
1895
+ var Ut = class extends ge {
1896
+ #e = null;
1897
+ #t = false;
1898
+ constructor(e) {
1899
+ e._metadata = e._metadata || {}, e._metadata.sdk = e._metadata.sdk || { name: "toucan-js", packages: [{ name: "npm:toucan-js", version: "4.0.0" }], version: "4.0.0" }, super(e);
1900
+ }
1901
+ setupIntegrations() {
1902
+ this._isEnabled() && !this.#t && this.#e && (this._integrations = Ts(this._options.integrations, this.#e), this.#t = true);
1903
+ }
1904
+ eventFromException(e, n) {
1905
+ return b(ls(this.#e, this._options.stackParser, e, n));
1906
+ }
1907
+ eventFromMessage(e, n = "info", r) {
1908
+ return b(ps(this._options.stackParser, e, n, r, this._options.attachStacktrace));
1909
+ }
1910
+ _prepareEvent(e, n, r) {
1911
+ return e.platform = e.platform || "javascript", this.getOptions().request && (e.sdkProcessingMetadata = $n(e.sdkProcessingMetadata, ["request", this.getOptions().request])), this.getOptions().requestData && (e.sdkProcessingMetadata = $n(e.sdkProcessingMetadata, ["requestData", this.getOptions().requestData])), super._prepareEvent(e, n, r);
1912
+ }
1913
+ getSdk() {
1914
+ return this.#e;
1915
+ }
1916
+ setSdk(e) {
1917
+ this.#e = e;
1918
+ }
1919
+ setRequestBody(e) {
1920
+ this.getOptions().requestData = e;
1921
+ }
1922
+ setEnabled(e) {
1923
+ this.getOptions().enabled = e;
1924
+ }
1925
+ };
1926
+ function Is(t) {
1927
+ let [e, n] = ht(t);
1928
+ return [e, (s) => {
1929
+ let o = n(s);
1930
+ if (o) {
1931
+ let i = o.filename;
1932
+ o.abs_path = i !== void 0 && !i.startsWith("/") ? `/${i}` : i, o.in_app = i !== void 0;
1933
+ }
1934
+ return o;
1935
+ }];
1936
+ }
1937
+ function xs(t) {
1938
+ if (t) return ce(t, ".js");
1939
+ }
1940
+ var As = Ce(Is(xs));
1941
+ function bs(t) {
1942
+ function e({ body: n }) {
1943
+ try {
1944
+ let s = (t.fetcher ?? fetch)(t.url, { method: "POST", headers: t.headers, body: n }).then((o) => ({ statusCode: o.status, headers: { "retry-after": o.headers.get("Retry-After"), "x-sentry-rate-limits": o.headers.get("X-Sentry-Rate-Limits") } }));
1945
+ return t.context && t.context.waitUntil(s), s;
1946
+ } catch (r) {
1947
+ return G(r);
1948
+ }
1949
+ }
1950
+ return Lt(t, e);
1951
+ }
1952
+ var Q = class extends C {
1953
+ #e;
1954
+ constructor(e) {
1955
+ if (super(), e.defaultIntegrations = e.defaultIntegrations === false ? [] : [...Array.isArray(e.defaultIntegrations) ? e.defaultIntegrations : [hs(e.requestDataOptions), fs()]], e.release === void 0) {
1956
+ let n = cs();
1957
+ n !== void 0 && (e.release = n);
1958
+ }
1959
+ this.#e = e, this.attachNewClient();
1960
+ }
1961
+ attachNewClient() {
1962
+ let e = new Ut({ ...this.#e, transport: bs, integrations: Mt(this.#e), stackParser: ut(this.#e.stackParser || As), transportOptions: { ...this.#e.transportOptions, context: this.#e.context } });
1963
+ this.setClient(e), e.setSdk(this), e.setupIntegrations();
1964
+ }
1965
+ setRequestBody(e) {
1966
+ this.getClient()?.setRequestBody(e);
1967
+ }
1968
+ setEnabled(e) {
1969
+ this.getClient()?.setEnabled(e);
1970
+ }
1971
+ captureCheckIn(e, n, r) {
1972
+ return e.status === "in_progress" && this.setContext("monitor", { slug: e.monitorSlug }), this.getClient().captureCheckIn(e, n, r);
1973
+ }
1974
+ addBreadcrumb(e, n = 100) {
1975
+ let s = this.getClient().getOptions().maxBreadcrumbs || n;
1976
+ return super.addBreadcrumb(e, s);
1977
+ }
1978
+ clone() {
1979
+ let e = new Q({ ...this.#e });
1980
+ return e._breadcrumbs = [...this._breadcrumbs], e._tags = { ...this._tags }, e._extra = { ...this._extra }, e._contexts = { ...this._contexts }, e._user = this._user, e._level = this._level, e._session = this._session, e._transactionName = this._transactionName, e._fingerprint = this._fingerprint, e._eventProcessors = [...this._eventProcessors], e._requestSession = this._requestSession, e._attachments = [...this._attachments], e._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }, e._propagationContext = { ...this._propagationContext }, e._lastEventId = this._lastEventId, e;
1981
+ }
1982
+ withScope(e) {
1983
+ let n = this.clone();
1984
+ return e(n);
1985
+ }
1986
+ };
1987
+ function qn(t, e, n, r, s, o, i, a, c) {
1988
+ if (!(n && r && s)) return;
1989
+ let u = new Q({ dsn: n, request: t, context: e, sampleRate: 1, release: i?.tag, integrations: [qe({ iteratee(p) {
1990
+ return p.filename = "/index.js", p;
1991
+ } })], requestDataOptions: { allowedHeaders: ["user-agent", "cf-challenge", "accept-encoding", "accept-language", "cf-ray", "content-length", "content-type", "host"], allowedSearchParams: /(.*)/ }, transportOptions: { headers: { "CF-Access-Client-ID": r, "CF-Access-Client-Secret": s } } });
1992
+ return o && (u.setTag("colo", o.coloId), u.setTag("metal", o.metalId)), a && c && (u.setTag("accountId", a), u.setTag("scriptId", c)), u.setUser({ id: a?.toString() }), u;
1993
+ }
1994
+ function Cs() {
1995
+ return { addLogs: () => {
1996
+ }, setTags: () => {
1997
+ }, end: () => {
1998
+ }, isRecording: true };
1999
+ }
2000
+ function zn() {
2001
+ return { enterSpan: (t, e, ...n) => e(Cs(), ...n), getSpanContext: () => ({ traceId: "test-trace", spanId: "test-span", parentSpanId: "test-parent-span", traceFlags: 0 }), runWithSpanContext: (t, e, ...n) => e(...n), traceId: "test-trace", spanId: "test-span", parentSpanId: "test-parent-span", cfTraceIdHeader: "test-trace:test-span:0" };
2002
+ }
2003
+ var ze = class {
2004
+ constructor(e) {
2005
+ this.data = {};
2006
+ this.readyAnalytics = e;
2007
+ }
2008
+ setData(e) {
2009
+ this.data = { ...this.data, ...e };
2010
+ }
2011
+ getData(e) {
2012
+ return this.data[e];
2013
+ }
2014
+ write() {
2015
+ this.readyAnalytics && this.readyAnalytics.logEvent({ version: 1, accountId: this.data.accountId, indexId: this.data.scriptId?.toString(), doubles: [this.data.requestTime ?? -1, this.data.coloId ?? -1, this.data.metalId ?? -1, this.data.coloTier ?? -1, this.data.status ?? -1], blobs: [this.data.hostname?.substring(0, 256), this.data.userAgent?.substring(0, 256), this.data.htmlHandling, this.data.notFoundHandling, this.data.error?.substring(0, 256), this.data.version, this.data.coloRegion] });
2016
+ }
2017
+ };
2018
+ var Je = class {
2019
+ constructor(e) {
2020
+ this.data = e;
2021
+ }
2022
+ async get(e) {
2023
+ let n = await Os(e), r = $t(new Uint8Array(this.data, 20), n);
2024
+ return r ? ws(r) : null;
2025
+ }
2026
+ };
2027
+ var Os = async (t) => {
2028
+ let n = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", n.buffer);
2029
+ return new Uint8Array(r, 0, 16);
2030
+ };
2031
+ var $t = (t, e) => {
2032
+ if (t.byteLength === 0) return false;
2033
+ let n = t.byteOffset + (t.byteLength / 40 >> 1) * 40, r = new Uint8Array(t.buffer, n, 16);
2034
+ if (r.byteLength !== e.byteLength) throw new TypeError("Search value and current value are of different lengths");
2035
+ let s = vs(e, r);
2036
+ if (s < 0) {
2037
+ let o = t.byteOffset, i = n - t.byteOffset;
2038
+ return $t(new Uint8Array(t.buffer, o, i), e);
2039
+ } else if (s > 0) {
2040
+ let o = n + 40, i = t.buffer.byteLength - n - 40;
2041
+ return $t(new Uint8Array(t.buffer, o, i), e);
2042
+ } else return new Uint8Array(t.buffer, n, 40);
2043
+ };
2044
+ var vs = (t, e) => {
2045
+ if (t.byteLength < e.byteLength) return -1;
2046
+ if (t.byteLength > e.byteLength) return 1;
2047
+ for (let [n, r] of t.entries()) {
2048
+ if (r < e[n]) return -1;
2049
+ if (r > e[n]) return 1;
2050
+ }
2051
+ return 0;
2052
+ };
2053
+ var ws = (t) => [...t.slice(16, 16 + 16)].map((n) => n.toString(16).padStart(2, "0")).join("");
2054
+ var Bt = (t) => {
2055
+ let e;
2056
+ return t?.run_worker_first !== void 0 ? e = t?.run_worker_first : t?.serve_directly !== void 0 ? e = !t.serve_directly : e = false, { html_handling: t?.html_handling ?? "auto-trailing-slash", not_found_handling: t?.not_found_handling ?? "none", run_worker_first: e, serve_directly: !e };
2057
+ };
2058
+ var Ve = class {
2059
+ constructor(e) {
2060
+ this.data = {};
2061
+ this.readyAnalytics = e;
2062
+ }
2063
+ setData(e) {
2064
+ this.data = { ...this.data, ...e };
2065
+ }
2066
+ getData(e) {
2067
+ return this.data[e];
2068
+ }
2069
+ write() {
2070
+ this.readyAnalytics && this.readyAnalytics.logEvent({ version: 1, accountId: this.data.accountId, indexId: this.data.experimentName, doubles: [this.data.manifestReadTime ?? -1], blobs: [] });
2071
+ }
2072
+ };
2073
+ var Yn = "public, max-age=0, must-revalidate";
2074
+ function Jn(t, e, n) {
2075
+ let r = new Headers({ ETag: `"${t}"` });
2076
+ return e !== void 0 && r.append("Content-Type", e), Ds(n) && r.append("Cache-Control", Yn), r;
2077
+ }
2078
+ function Ds(t) {
2079
+ return !t.headers.has("Authorization") && !t.headers.has("Range");
2080
+ }
2081
+ var Vn = async (t, e, n, r, s) => {
2082
+ let { pathname: o, search: i } = new URL(t.url), a = Ht(o);
2083
+ a = a.replace(/\/+/g, "/");
2084
+ let c = await We(a, n, r);
2085
+ if (!c) return e.JAEGER.enterSpan("no_intent", (A) => (A.setTags({ decodedPathname: a, configuration: JSON.stringify(n), status: 404 }), new te()));
2086
+ let u = t.method.toUpperCase();
2087
+ if (!["GET", "HEAD"].includes(u)) return e.JAEGER.enterSpan("method_not_allowed", (A) => (A.setTags({ method: u, status: 405 }), new Ee()));
2088
+ let p = c.redirect ?? a, l = Fs(p);
2089
+ if (l !== o && c.asset || c.redirect) return e.JAEGER.enterSpan("redirect", (A) => (A.setTags({ originalPath: o, location: l !== o ? l : c.redirect ?? "<unknown>", status: 307 }), new ye(l + i)));
2090
+ if (!c.asset) return e.JAEGER.enterSpan("unknown_action", (A) => (A.setTags({ pathname: o, status: 500 }), new $(new Error("Unknown action"))));
2091
+ let g = await e.JAEGER.enterSpan("getByETag", async (A) => (A.setTags({ pathname: o, eTag: c.asset.eTag, status: c.asset.status }), await s(c.asset.eTag))), f = Jn(c.asset.eTag, g.contentType, t), h = `"${c.asset.eTag}"`, Y = `W/${h}`, y = t.headers.get("If-None-Match") || "";
2092
+ return [Y, h].includes(y) ? e.JAEGER.enterSpan("matched_etag", (A) => (A.setTags({ matchedEtag: y, status: 304 }), new Se(null, { headers: f }))) : e.JAEGER.enterSpan("response", (A) => {
2093
+ A.setTags({ etag: c.asset.eTag, status: c.asset.status, head: u === "HEAD" });
2094
+ let jt = u === "HEAD" ? null : g.readableStream;
2095
+ switch (c.asset.status) {
2096
+ case 404:
2097
+ return new te(jt, { headers: f });
2098
+ case 200:
2099
+ return new _e(jt, { headers: f });
2100
+ }
2101
+ });
2102
+ };
2103
+ var We = async (t, e, n, r = false) => {
2104
+ switch (e.html_handling) {
2105
+ case "auto-trailing-slash":
2106
+ return Ms(t, e, n, r);
2107
+ case "force-trailing-slash":
2108
+ return Ps(t, e, n, r);
2109
+ case "drop-trailing-slash":
2110
+ return ks(t, e, n, r);
2111
+ case "none":
2112
+ return Ls(t, e, n);
2113
+ }
2114
+ };
2115
+ var Ms = async (t, e, n, r) => {
2116
+ let s = null, o = null, i = await n(t);
2117
+ if (t.endsWith("/index")) {
2118
+ if (i) return { asset: { eTag: i, status: 200 }, redirect: null };
2119
+ if (s = await E(`${t}.html`, t.slice(0, -5), e, n, r)) return s;
2120
+ if (s = await E(`${t.slice(0, -6)}.html`, t.slice(0, -6), e, n, r)) return s;
2121
+ } else if (t.endsWith("/index.html")) {
2122
+ if (s = await E(t, t.slice(0, -10), e, n, r)) return s;
2123
+ if (s = await E(`${t.slice(0, -11)}.html`, t.slice(0, -11), e, n, r)) return s;
2124
+ } else if (t.endsWith("/")) {
2125
+ if (o = await n(`${t}index.html`)) return { asset: { eTag: o, status: 200 }, redirect: null };
2126
+ if (s = await E(`${t.slice(0, -1)}.html`, t.slice(0, -1), e, n, r)) return s;
2127
+ } else if (t.endsWith(".html")) {
2128
+ if (s = await E(t, t.slice(0, -5), e, n, r)) return s;
2129
+ if (s = await E(`${t.slice(0, -5)}/index.html`, `${t.slice(0, -5)}/`, e, n, r)) return s;
2130
+ }
2131
+ return i ? { asset: { eTag: i, status: 200 }, redirect: null } : (o = await n(`${t}.html`)) ? { asset: { eTag: o, status: 200 }, redirect: null } : (s = await E(`${t}/index.html`, `${t}/`, e, n, r)) ? s : Ke(t, e, n);
2132
+ };
2133
+ var Ps = async (t, e, n, r) => {
2134
+ let s = null, o = null, i = await n(t);
2135
+ if (t.endsWith("/index")) {
2136
+ if (i) return { asset: { eTag: i, status: 200 }, redirect: null };
2137
+ if (s = await E(`${t}.html`, t.slice(0, -5), e, n, r)) return s;
2138
+ if (s = await E(`${t.slice(0, -6)}.html`, t.slice(0, -5), e, n, r)) return s;
2139
+ } else if (t.endsWith("/index.html")) {
2140
+ if (s = await E(t, t.slice(0, -10), e, n, r)) return s;
2141
+ if (s = await E(`${t.slice(0, -11)}.html`, t.slice(0, -10), e, n, r)) return s;
2142
+ } else if (t.endsWith("/")) {
2143
+ if (o = await n(`${t}index.html`)) return { asset: { eTag: o, status: 200 }, redirect: null };
2144
+ if (o = await n(`${t.slice(0, -1)}.html`)) return { asset: { eTag: o, status: 200 }, redirect: null };
2145
+ } else if (t.endsWith(".html")) {
2146
+ if (s = await E(t, `${t.slice(0, -5)}/`, e, n, r)) return s;
2147
+ if (i) return { asset: { eTag: i, status: 200 }, redirect: null };
2148
+ if (s = await E(`${t.slice(0, -5)}/index.html`, `${t.slice(0, -5)}/`, e, n, r)) return s;
2149
+ }
2150
+ return i ? { asset: { eTag: i, status: 200 }, redirect: null } : (s = await E(`${t}.html`, `${t}/`, e, n, r)) || (s = await E(`${t}/index.html`, `${t}/`, e, n, r)) ? s : Ke(t, e, n);
2151
+ };
2152
+ var ks = async (t, e, n, r) => {
2153
+ let s = null, o = null, i = await n(t);
2154
+ if (t.endsWith("/index")) {
2155
+ if (i) return { asset: { eTag: i, status: 200 }, redirect: null };
2156
+ if (t === "/index") {
2157
+ if (s = await E("/index.html", "/", e, n, r)) return s;
2158
+ } else {
2159
+ if (s = await E(`${t.slice(0, -6)}.html`, t.slice(0, -6), e, n, r)) return s;
2160
+ if (s = await E(`${t}.html`, t.slice(0, -6), e, n, r)) return s;
2161
+ }
2162
+ } else if (t.endsWith("/index.html")) if (t === "/index.html") {
2163
+ if (s = await E("/index.html", "/", e, n, r)) return s;
2164
+ } else {
2165
+ if (s = await E(t, t.slice(0, -11), e, n, r)) return s;
2166
+ if (i) return { asset: { eTag: i, status: 200 }, redirect: null };
2167
+ if (s = await E(`${t.slice(0, -11)}.html`, t.slice(0, -11), e, n, r)) return s;
2168
+ }
2169
+ else if (t.endsWith("/")) if (t === "/") {
2170
+ if (o = await n("/index.html")) return { asset: { eTag: o, status: 200 }, redirect: null };
2171
+ } else {
2172
+ if (s = await E(`${t.slice(0, -1)}.html`, t.slice(0, -1), e, n, r)) return s;
2173
+ if (s = await E(`${t.slice(0, -1)}/index.html`, t.slice(0, -1), e, n, r)) return s;
2174
+ }
2175
+ else if (t.endsWith(".html")) {
2176
+ if (s = await E(t, t.slice(0, -5), e, n, r)) return s;
2177
+ if (s = await E(`${t.slice(0, -5)}/index.html`, t.slice(0, -5), e, n, r)) return s;
2178
+ }
2179
+ return i ? { asset: { eTag: i, status: 200 }, redirect: null } : (o = await n(`${t}.html`)) ? { asset: { eTag: o, status: 200 }, redirect: null } : (o = await n(`${t}/index.html`)) ? { asset: { eTag: o, status: 200 }, redirect: null } : Ke(t, e, n);
2180
+ };
2181
+ var Ls = async (t, e, n) => {
2182
+ let r = await n(t);
2183
+ return r ? { asset: { eTag: r, status: 200 }, redirect: null } : Ke(t, e, n);
2184
+ };
2185
+ var Ke = async (t, e, n) => {
2186
+ switch (e.not_found_handling) {
2187
+ case "single-page-application": {
2188
+ let r = await n("/index.html");
2189
+ return r ? { asset: { eTag: r, status: 200 }, redirect: null } : null;
2190
+ }
2191
+ case "404-page": {
2192
+ let r = t;
2193
+ for (; r; ) {
2194
+ r = r.slice(0, r.lastIndexOf("/"));
2195
+ let s = await n(`${r}/404.html`);
2196
+ if (s) return { asset: { eTag: s, status: 404 }, redirect: null };
2197
+ }
2198
+ return null;
2199
+ }
2200
+ case "none":
2201
+ default:
2202
+ return null;
2203
+ }
2204
+ };
2205
+ var E = async (t, e, n, r, s) => {
2206
+ if (s) return null;
2207
+ if (!await r(e)) {
2208
+ let o = await We(e, n, r, true);
2209
+ if (o?.asset && o.asset.eTag === await r(t)) return { asset: null, redirect: e };
2210
+ }
2211
+ return null;
2212
+ };
2213
+ var Ht = (t) => t.split("/").map((e) => {
2214
+ try {
2215
+ return decodeURIComponent(e);
2216
+ } catch {
2217
+ return e;
2218
+ }
2219
+ }).join("/");
2220
+ var Fs = (t) => t.split("/").map((e) => {
2221
+ try {
2222
+ return encodeURIComponent(e);
2223
+ } catch {
2224
+ return e;
2225
+ }
2226
+ }).join("/");
2227
+ async function Wn(t, e, n, r = 1) {
2228
+ let s = 0;
2229
+ for (; s <= r; ) try {
2230
+ let o = await t.getWithMetadata(e, { type: "stream", cacheTtl: 31536e3 });
2231
+ if (o.value === null) {
2232
+ let i = await t.getWithMetadata(e, { type: "stream", cacheTtl: 60 });
2233
+ return i.value !== null && n && n.captureException(new Error(`Initial request for asset ${e} failed, but subsequent request succeeded.`)), i;
2234
+ }
2235
+ return o;
2236
+ } catch (o) {
2237
+ if (s >= r) {
2238
+ let i = `KV GET ${e} failed.`;
2239
+ throw o instanceof Error && (i = `KV GET ${e} failed: ${o.message}`), new Error(i);
2240
+ }
2241
+ await new Promise((i) => setTimeout(i, Math.pow(2, s++) * 1e3));
2242
+ }
2243
+ }
2244
+ var Kn = class extends Us {
2245
+ async fetch(t) {
2246
+ let e, n = new ze(this.env.ANALYTICS), r = new ee(this.env.UNSAFE_PERFORMANCE), s = r.now();
2247
+ try {
2248
+ this.env.JAEGER || (this.env.JAEGER = zn()), e = qn(t, this.ctx, this.env.SENTRY_DSN, this.env.SENTRY_ACCESS_CLIENT_ID, this.env.SENTRY_ACCESS_CLIENT_SECRET, this.env.COLO_METADATA, this.env.VERSION_METADATA, this.env.CONFIG?.account_id, this.env.CONFIG?.script_id);
2249
+ let o = Bt(this.env.CONFIG), i = t.headers.get("user-agent") ?? "UA UNKNOWN", a = new URL(t.url);
2250
+ return this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && n.setData({ accountId: this.env.CONFIG.account_id, scriptId: this.env.CONFIG.script_id, coloId: this.env.COLO_METADATA.coloId, metalId: this.env.COLO_METADATA.metalId, coloTier: this.env.COLO_METADATA.coloTier, coloRegion: this.env.COLO_METADATA.coloRegion, version: this.env.VERSION_METADATA.tag, hostname: a.hostname, htmlHandling: o.html_handling, notFoundHandling: o.not_found_handling, userAgent: i }), await this.env.JAEGER.enterSpan("handleRequest", async (c) => {
2251
+ c.setTags({ hostname: a.hostname, eyeballPath: a.pathname, env: this.env.ENVIRONMENT, version: this.env.VERSION_METADATA?.id });
2252
+ let u = await Vn(t, this.env, o, this.unstable_exists.bind(this), this.unstable_getByETag.bind(this));
2253
+ return n.setData({ status: u.status }), u;
2254
+ });
2255
+ } catch (o) {
2256
+ return this.handleError(e, n, o);
2257
+ } finally {
2258
+ this.submitMetrics(n, r, s);
2259
+ }
2260
+ }
2261
+ handleError(t, e, n) {
2262
+ try {
2263
+ let r = new $(n);
2264
+ return t && t.captureException(n), n instanceof Error && e.setData({ error: n.message }), r;
2265
+ } catch (r) {
2266
+ return console.error("Error handling error", r), new $(r);
2267
+ }
2268
+ }
2269
+ submitMetrics(t, e, n) {
2270
+ try {
2271
+ t.setData({ requestTime: e.now() - n }), t.write();
2272
+ } catch (r) {
2273
+ console.error("Error submitting metrics", r);
2274
+ }
2275
+ }
2276
+ async unstable_canFetch(t) {
2277
+ let e = new URL(t.url), n = Ht(e.pathname);
2278
+ return await We(n, { ...Bt(this.env.CONFIG), not_found_handling: "none" }, this.unstable_exists.bind(this)) !== null;
2279
+ }
2280
+ async unstable_getByETag(t) {
2281
+ let e = await Wn(this.env.ASSETS_KV_NAMESPACE, t);
2282
+ if (!e || !e.value) throw new Error(`Requested asset ${t} exists in the asset manifest but not in the KV namespace.`);
2283
+ return { readableStream: e.value, contentType: e.metadata?.contentType };
2284
+ }
2285
+ async unstable_getByPathname(t) {
2286
+ let e = await this.unstable_exists(t);
2287
+ return e ? this.unstable_getByETag(e) : null;
2288
+ }
2289
+ async unstable_exists(t) {
2290
+ let e = new Ve(this.env.EXPERIMENT_ANALYTICS), n = new ee(this.env.UNSAFE_PERFORMANCE);
2291
+ this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && e.setData({ accountId: this.env.CONFIG.account_id, experimentName: "manifest-read-timing" });
2292
+ let r = n.now();
2293
+ try {
2294
+ return await new Je(this.env.ASSETS_MANIFEST).get(t);
2295
+ } finally {
2296
+ e.setData({ manifestReadTime: n.now() - r }), e.write();
2297
+ }
2298
+ }
2299
+ };
2300
+
2301
+ // src/constants.ts
2302
+ var MODULE_TYPES = ["CompiledWasm"];
2303
+
2304
+ // src/shared.ts
2305
+ var UNKNOWN_HOST = "http://localhost";
2306
+ var MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${MODULE_TYPES.join("|")})__(.*?)__`;
2307
+
2308
+ // src/asset-workers/asset-worker.ts
2309
+ var CustomAssetWorker = class extends Kn {
2310
+ async fetch(request) {
2311
+ const response = await super.fetch(request);
2312
+ const modifiedResponse = new Response(response.body, response);
2313
+ modifiedResponse.headers.delete("ETag");
2314
+ modifiedResponse.headers.delete("Cache-Control");
2315
+ return modifiedResponse;
2316
+ }
2317
+ async unstable_getByETag(eTag) {
2318
+ const url = new URL(eTag, UNKNOWN_HOST);
2319
+ const response = await this.env.__VITE_FETCH_ASSET__.fetch(url);
2320
+ if (!response.body) {
2321
+ throw new Error(`Unexpected error. No HTML found for ${eTag}.`);
2322
+ }
2323
+ return { readableStream: response.body, contentType: "text/html" };
2324
+ }
2325
+ async unstable_exists(pathname) {
2326
+ const url = new URL(pathname.replace(/^\/{2,}/, "/"), UNKNOWN_HOST);
2327
+ const response = await this.env.__VITE_ASSET_EXISTS__.fetch(url);
2328
+ const exists = await response.json();
2329
+ return exists ? pathname : null;
2330
+ }
2331
+ };
2332
+ export {
2333
+ CustomAssetWorker as default
2334
+ };