leesto-connect 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +1,88 @@
1
- var Ce = "login", Ie = 6e3;
2
- function _e(e) {
1
+ var Qe = "login", et = "rrweb-buffer", tt = 6e3;
2
+ function nt(e) {
3
3
  return typeof e == "object" && e !== null && typeof e.type == "string" && e.type.startsWith("leesto:");
4
4
  }
5
- var Ne = "leesto_diag", Te = "leesto_run", ue = "X-Leesto-Run-Id", qe = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6
- function W(e) {
7
- return typeof e == "string" && qe.test(e);
5
+ var rt = [
6
+ "mask_all",
7
+ "labels_visible",
8
+ "inputs_only"
9
+ ], re = "mask_all";
10
+ function ot(e) {
11
+ return typeof e == "string" && rt.includes(e);
12
+ }
13
+ var Pe = "leesto_diag", xe = "leesto_run", we = "X-Leesto-Run-Id", De = "leesto_mask", be = [
14
+ Pe,
15
+ xe,
16
+ De
17
+ ], st = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
18
+ function Z(e) {
19
+ return typeof e == "string" && st.test(e);
8
20
  }
9
- function De() {
21
+ function it() {
10
22
  try {
11
23
  const e = globalThis.crypto, t = e?.randomUUID?.();
12
- if (W(t)) return t;
24
+ if (Z(t)) return t;
13
25
  if (!e?.getRandomValues) return;
14
26
  const n = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
15
27
  n[6] = (n[6] ?? 0) & 15 | 64, n[8] = (n[8] ?? 0) & 63 | 128;
16
- const r = Array.from(n, (o) => o.toString(16).padStart(2, "0")).join(""), i = `${r.slice(0, 8)}-${r.slice(8, 12)}-${r.slice(12, 16)}-${r.slice(16, 20)}-${r.slice(20)}`;
17
- return W(i) ? i : void 0;
28
+ const r = Array.from(n, (o) => o.toString(16).padStart(2, "0")).join(""), s = `${r.slice(0, 8)}-${r.slice(8, 12)}-${r.slice(12, 16)}-${r.slice(16, 20)}-${r.slice(20)}`;
29
+ return Z(s) ? s : void 0;
18
30
  } catch {
19
31
  return;
20
32
  }
21
33
  }
22
- function xe(e) {
34
+ function at(e) {
35
+ try {
36
+ const t = new URLSearchParams(e).getAll(De), [n] = t;
37
+ return t.some((r) => r !== n) ? re : ot(n) ? n : re;
38
+ } catch {
39
+ return re;
40
+ }
41
+ }
42
+ function lt(e) {
23
43
  try {
24
- const t = new URLSearchParams(e).get(Te);
25
- return W(t) ? t : void 0;
44
+ const t = new URLSearchParams(e).get(xe);
45
+ return Z(t) ? t : void 0;
26
46
  } catch {
27
47
  return;
28
48
  }
29
49
  }
30
- function Me(e) {
50
+ function ce(e) {
31
51
  try {
32
- return new URLSearchParams(e).get(Ne) === "1";
52
+ return new URLSearchParams(e).get(Pe) === "1";
33
53
  } catch {
34
54
  return !1;
35
55
  }
36
56
  }
37
- var de = "leesto/console", Q = "leesto/network", Pe = "leesto/network-ring", $e = "leesto/console-ring", Fe = {
57
+ function ct(e, t) {
58
+ if (ce(e)) return e;
59
+ if (typeof t != "string" || !t.startsWith("leesto-arming?")) return "";
60
+ const n = `?${t.slice(14)}`;
61
+ return ce(n) ? n : "";
62
+ }
63
+ function ut(e) {
64
+ try {
65
+ const t = new URL(e);
66
+ if (!be.some((n) => t.searchParams.has(n))) return e;
67
+ for (const n of be) t.searchParams.delete(n);
68
+ return t.href;
69
+ } catch {
70
+ return e;
71
+ }
72
+ }
73
+ var Ee = "leesto/console", oe = "leesto/network", ft = "leesto/network-ring", dt = "leesto/console-ring", pt = {
38
74
  primary: "#08783f",
39
75
  hover: "#066633",
40
76
  foreground: "#f3fff7"
41
- }, Ge = {
77
+ }, ht = {
42
78
  primary: "#46c383",
43
79
  hover: "#65d49b",
44
80
  foreground: "#082315"
45
- }, He = {
46
- light: Fe,
47
- dark: Ge
81
+ }, mt = {
82
+ light: pt,
83
+ dark: ht
48
84
  };
49
- function j(e) {
85
+ function X(e) {
50
86
  const t = [];
51
87
  return {
52
88
  push(n) {
@@ -57,65 +93,65 @@ function j(e) {
57
93
  }
58
94
  };
59
95
  }
60
- var Ue = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, Be = /\b\d{3}-\d{2}-\d{4}\b/g, ze = /\d(?:[ -]?\d){12,18}/g;
61
- function je(e) {
96
+ var gt = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, yt = /\b\d{3}-\d{2}-\d{4}\b/g, vt = /\d(?:[ -]?\d){12,18}/g;
97
+ function wt(e) {
62
98
  let t = 0, n = !1;
63
99
  for (let r = e.length - 1; r >= 0; r--) {
64
- let i = e.charCodeAt(r) - 48;
65
- if (i < 0 || i > 9) return !1;
66
- n && (i *= 2, i > 9 && (i -= 9)), t += i, n = !n;
100
+ let s = e.charCodeAt(r) - 48;
101
+ if (s < 0 || s > 9) return !1;
102
+ n && (s *= 2, s > 9 && (s -= 9)), t += s, n = !n;
67
103
  }
68
104
  return t % 10 === 0;
69
105
  }
70
- function D(e) {
106
+ function U(e) {
71
107
  if (!e) return e;
72
- let t = e.replace(Ue, "[email masqué]");
73
- return t = t.replace(Be, "[id masqué]"), t = t.replace(ze, (n) => {
108
+ let t = e.replace(gt, "[email masqué]");
109
+ return t = t.replace(yt, "[id masqué]"), t = t.replace(vt, (n) => {
74
110
  const r = n.replace(/[ -]/g, "");
75
- return r.length >= 13 && r.length <= 19 && je(r) ? "[carte masquée]" : n;
111
+ return r.length >= 13 && r.length <= 19 && wt(r) ? "[carte masquée]" : n;
76
112
  }), t;
77
113
  }
78
114
  function H(e) {
79
115
  const t = typeof e == "string" ? e : e instanceof URL ? e.href : e instanceof Request ? e.url : String(e);
80
116
  try {
81
117
  const n = new URL(t, typeof location < "u" ? location.href : void 0);
82
- return n.origin + D(n.pathname);
118
+ return n.origin + U(n.pathname);
83
119
  } catch {
84
- return D(t.split("?")[0] ?? t);
120
+ return U(t.split("?")[0] ?? t);
85
121
  }
86
122
  }
87
- var Ve = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), We = ["deprecation", "intervention"], Xe = { teardown: () => {
123
+ var bt = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), Et = ["deprecation", "intervention"], St = { teardown: () => {
88
124
  } };
89
- function Ke(e) {
125
+ function Rt(e) {
90
126
  const t = typeof performance < "u" ? performance.timeOrigin : 0;
91
127
  return Math.round(t + e);
92
128
  }
93
- function Ye(e) {
129
+ function Lt(e) {
94
130
  const t = e.responseStatus;
95
131
  return typeof t == "number" && t > 0 ? t : void 0;
96
132
  }
97
- function Ze(e) {
98
- if (Ve.has(e.initiatorType)) return null;
99
- const t = Ye(e), n = e.transferSize || e.encodedBodySize || void 0;
133
+ function _t(e) {
134
+ if (bt.has(e.initiatorType)) return null;
135
+ const t = Lt(e), n = e.transferSize || e.encodedBodySize || void 0;
100
136
  return {
101
137
  method: "GET",
102
138
  url: H(e.name),
103
139
  ...t !== void 0 ? { status: t } : {},
104
140
  durationMs: Math.round(e.duration),
105
141
  ...n ? { responseSize: n } : {},
106
- startedAt: Ke(e.startTime),
142
+ startedAt: Rt(e.startTime),
107
143
  ...t !== void 0 && t >= 400 ? { failed: !0 } : {},
108
144
  initiatorType: e.initiatorType
109
145
  };
110
146
  }
111
- function Je(e) {
112
- if (typeof window > "u") return Xe;
147
+ function kt(e) {
148
+ if (typeof window > "u") return St;
113
149
  const t = [];
114
150
  if (typeof PerformanceObserver < "u") try {
115
- const o = new PerformanceObserver((s) => {
116
- for (const c of s.getEntries()) try {
117
- const l = Ze(c);
118
- l && e.onResource(l);
151
+ const o = new PerformanceObserver((l) => {
152
+ for (const u of l.getEntries()) try {
153
+ const i = _t(u);
154
+ i && e.onResource(i);
119
155
  } catch {
120
156
  }
121
157
  });
@@ -127,27 +163,27 @@ function Je(e) {
127
163
  }
128
164
  const n = window.ReportingObserver;
129
165
  if (n) try {
130
- const o = new n(((s) => {
131
- for (const c of s) {
132
- const l = typeof c.body?.message == "string" ? c.body.message : c.type;
133
- e.onReport("warn", `Navigateur (${c.type}) : ${l}`);
166
+ const o = new n(((l) => {
167
+ for (const u of l) {
168
+ const i = typeof u.body?.message == "string" ? u.body.message : u.type;
169
+ e.onReport("warn", `Navigateur (${u.type}) : ${i}`);
134
170
  }
135
171
  }), {
136
- types: We,
172
+ types: Et,
137
173
  buffered: !0
138
174
  });
139
175
  o.observe(), t.push(() => o.disconnect());
140
176
  } catch {
141
177
  }
142
178
  const r = (o) => {
143
- const s = o;
144
- e.onReport("error", `CSP : ${s.blockedURI || "ressource"} bloqué par « ${s.violatedDirective} »`);
179
+ const l = o;
180
+ e.onReport("error", `CSP : ${l.blockedURI || "ressource"} bloqué par « ${l.violatedDirective} »`);
145
181
  };
146
182
  window.addEventListener("securitypolicyviolation", r), t.push(() => window.removeEventListener("securitypolicyviolation", r));
147
- let i = !1;
183
+ let s = !1;
148
184
  return { teardown: () => {
149
- if (!i) {
150
- i = !0;
185
+ if (!s) {
186
+ s = !0;
151
187
  for (const o of t) try {
152
188
  o();
153
189
  } catch {
@@ -155,13 +191,13 @@ function Je(e) {
155
191
  }
156
192
  } };
157
193
  }
158
- var Qe = 50, et = 30, tt = 100, nt = 50, G = 500, rt = 8e3;
159
- function ee(e) {
194
+ var At = 50, Ot = 30, Tt = 100, Ct = 50, z = 500, It = 8e3;
195
+ function se(e) {
160
196
  const t = e instanceof Error ? e.stack : void 0;
161
197
  if (t)
162
- return D(t).slice(0, rt);
198
+ return U(t).slice(0, It);
163
199
  }
164
- function te(e) {
200
+ function ie(e) {
165
201
  if (e instanceof Error) return `${e.name}: ${e.message}`;
166
202
  if (typeof e == "string") return e;
167
203
  if (typeof e == "object" && e !== null) try {
@@ -171,12 +207,12 @@ function te(e) {
171
207
  }
172
208
  return String(e);
173
209
  }
174
- function fe(e) {
210
+ function Se(e) {
175
211
  if (!e) return;
176
212
  const t = Number(e);
177
213
  return Number.isFinite(t) && t >= 0 ? t : void 0;
178
214
  }
179
- var ot = {
215
+ var Nt = {
180
216
  snapshot: () => ({
181
217
  errors: [],
182
218
  logs: [],
@@ -189,228 +225,228 @@ var ot = {
189
225
  teardown: () => {
190
226
  }
191
227
  };
192
- function Se(e) {
193
- if (typeof window > "u") return ot;
194
- const t = j(Qe), n = j(et), r = j(tt), i = j(nt), o = W(e.runId) ? e.runId : void 0, s = (a) => {
228
+ function qe(e) {
229
+ if (typeof window > "u") return Nt;
230
+ const t = X(At), n = X(Ot), r = X(Tt), s = X(Ct), o = Z(e.runId) ? e.runId : void 0, l = (f) => {
195
231
  if (!o) return !1;
196
232
  try {
197
- const u = new URL(String(a), location.href);
198
- return u.origin === location.origin || (e.runIdOrigins ?? []).includes(u.origin);
233
+ const p = new URL(String(f), location.href);
234
+ return p.origin === location.origin || (e.runIdOrigins ?? []).includes(p.origin);
199
235
  } catch {
200
236
  return !1;
201
237
  }
202
238
  };
203
- let c = e.sink ?? null;
204
- const l = (a, u) => {
205
- c?.(a, u);
206
- }, g = (a) => {
207
- e.captureNetwork && t.push(a);
208
- }, d = (a, u, f, h = {}) => {
209
- if (!u) return;
210
- const O = {
211
- level: a,
212
- message: u,
213
- ...f ? { stack: f } : {},
214
- ...h,
239
+ let u = e.sink ?? null;
240
+ const i = (f, p) => {
241
+ u?.(f, p);
242
+ }, c = (f) => {
243
+ e.captureNetwork && t.push(f);
244
+ }, a = (f, p, m, E = {}) => {
245
+ if (!p) return;
246
+ const k = {
247
+ level: f,
248
+ message: p,
249
+ ...m ? { stack: m } : {},
250
+ ...E,
215
251
  at: Date.now()
216
252
  };
217
- i.push(O), l(de, O);
218
- }, w = (a, u) => {
253
+ s.push(k), i(Ee, k);
254
+ }, d = (f, p) => {
219
255
  try {
220
- const f = D(u.map(te).join(" ")).slice(0, G), h = u.find((O) => O instanceof Error);
221
- d(a, f, ee(h), {
256
+ const m = U(p.map(ie).join(" ")).slice(0, z), E = p.find((k) => k instanceof Error);
257
+ a(f, m, se(E), {
222
258
  mechanism: "console",
223
- ...h instanceof Error && h.name ? { name: h.name } : {}
259
+ ...E instanceof Error && E.name ? { name: E.name } : {}
224
260
  });
225
261
  } catch {
226
262
  }
227
- }, v = (a, u) => {
263
+ }, y = (f, p) => {
228
264
  try {
229
- const f = D(u.map(te).join(" ")).slice(0, G);
230
- f && r.push({
231
- level: a,
232
- message: f,
265
+ const m = U(p.map(ie).join(" ")).slice(0, z);
266
+ m && r.push({
267
+ level: f,
268
+ message: m,
233
269
  at: Date.now()
234
270
  });
235
271
  } catch {
236
272
  }
237
- }, E = console.error, b = console.warn, S = console.log, A = console.info;
238
- console.error = (...a) => (w("error", a), E.apply(console, a)), console.warn = (...a) => (w("warn", a), b.apply(console, a)), console.log = (...a) => (v("log", a), S.apply(console, a)), console.info = (...a) => (v("info", a), A.apply(console, a));
239
- const x = (a) => {
240
- const u = a.target;
241
- if (u instanceof Element) {
242
- const h = u.src || u.href || "";
243
- if (!h) return;
244
- d("error", `Ressource non chargée : <${u.tagName.toLowerCase()}> ${H(h)}`.slice(0, G), void 0, {
273
+ }, g = console.error, b = console.warn, S = console.log, R = console.info;
274
+ console.error = (...f) => (d("error", f), g.apply(console, f)), console.warn = (...f) => (d("warn", f), b.apply(console, f)), console.log = (...f) => (y("log", f), S.apply(console, f)), console.info = (...f) => (y("info", f), R.apply(console, f));
275
+ const L = (f) => {
276
+ const p = f.target;
277
+ if (p instanceof Element) {
278
+ const E = p.src || p.href || "";
279
+ if (!E) return;
280
+ a("error", `Ressource non chargée : <${p.tagName.toLowerCase()}> ${H(E)}`.slice(0, z), void 0, {
245
281
  mechanism: "resource",
246
- sourceUrl: H(h)
282
+ sourceUrl: H(E)
247
283
  });
248
284
  return;
249
285
  }
250
- const f = a;
251
- d("error", D(`Erreur non gérée : ${f.message}`).slice(0, G), ee(f.error), {
286
+ const m = f;
287
+ a("error", U(`Erreur non gérée : ${m.message}`).slice(0, z), se(m.error), {
252
288
  mechanism: "window.error",
253
- ...typeof f.error?.name == "string" ? { name: f.error.name } : {},
254
- ...typeof f.filename == "string" && f.filename ? { sourceUrl: H(f.filename) } : {},
255
- ...typeof f.lineno == "number" && f.lineno > 0 ? { line: f.lineno } : {},
256
- ...typeof f.colno == "number" && f.colno > 0 ? { column: f.colno } : {}
289
+ ...typeof m.error?.name == "string" ? { name: m.error.name } : {},
290
+ ...typeof m.filename == "string" && m.filename ? { sourceUrl: H(m.filename) } : {},
291
+ ...typeof m.lineno == "number" && m.lineno > 0 ? { line: m.lineno } : {},
292
+ ...typeof m.colno == "number" && m.colno > 0 ? { column: m.colno } : {}
257
293
  });
258
- }, I = (a) => {
259
- d("error", D(`Promesse rejetée : ${te(a.reason)}`).slice(0, G), ee(a.reason), {
294
+ }, C = (f) => {
295
+ a("error", U(`Promesse rejetée : ${ie(f.reason)}`).slice(0, z), se(f.reason), {
260
296
  mechanism: "unhandledrejection",
261
- ...a.reason instanceof Error && a.reason.name ? { name: a.reason.name } : {}
297
+ ...f.reason instanceof Error && f.reason.name ? { name: f.reason.name } : {}
262
298
  });
263
299
  };
264
- window.addEventListener("error", x, !0), window.addEventListener("unhandledrejection", I);
265
- const M = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
266
- M && (window.fetch = (async (a, u) => {
267
- const f = Date.now(), h = (u?.method ?? (a instanceof Request ? a.method : "GET") ?? "GET").toUpperCase(), O = H(a);
268
- let T = u;
269
- if (o && s(a)) {
270
- const R = new Headers(a instanceof Request ? a.headers : void 0);
271
- for (const [k, p] of new Headers(u?.headers)) R.set(k, p);
272
- R.set(ue, o), T = {
273
- ...u,
274
- headers: R
300
+ window.addEventListener("error", L, !0), window.addEventListener("unhandledrejection", C);
301
+ const T = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
302
+ T && (window.fetch = (async (f, p) => {
303
+ const m = Date.now(), E = (p?.method ?? (f instanceof Request ? f.method : "GET") ?? "GET").toUpperCase(), k = H(f);
304
+ let x = p;
305
+ if (o && l(f)) {
306
+ const _ = new Headers(f instanceof Request ? f.headers : void 0);
307
+ for (const [D, A] of new Headers(p?.headers)) _.set(D, A);
308
+ _.set(we, o), x = {
309
+ ...p,
310
+ headers: _
275
311
  };
276
312
  }
277
313
  try {
278
- const R = await M(a, T);
314
+ const _ = await T(f, x);
279
315
  try {
280
- const k = R.headers.get("x-request-id"), p = R.headers.get("traceparent");
281
- g({
282
- method: h,
283
- url: O,
284
- status: R.status,
285
- durationMs: Date.now() - f,
286
- responseSize: fe(R.headers.get("content-length")),
287
- contentType: R.headers.get("content-type") ?? void 0,
288
- startedAt: f,
289
- ...k ? { requestId: k.slice(0, 200) } : {},
290
- ...p ? { traceparent: p.slice(0, 200) } : {},
316
+ const D = _.headers.get("x-request-id"), A = _.headers.get("traceparent");
317
+ c({
318
+ method: E,
319
+ url: k,
320
+ status: _.status,
321
+ durationMs: Date.now() - m,
322
+ responseSize: Se(_.headers.get("content-length")),
323
+ contentType: _.headers.get("content-type") ?? void 0,
324
+ startedAt: m,
325
+ ...D ? { requestId: D.slice(0, 200) } : {},
326
+ ...A ? { traceparent: A.slice(0, 200) } : {},
291
327
  ...o ? { runId: o } : {}
292
- }), R.ok || l(Q, {
293
- method: h,
294
- url: O,
295
- status: R.status,
296
- durationMs: Date.now() - f
328
+ }), _.ok || i(oe, {
329
+ method: E,
330
+ url: k,
331
+ status: _.status,
332
+ durationMs: Date.now() - m
297
333
  });
298
334
  } catch {
299
335
  }
300
- return R;
301
- } catch (R) {
336
+ return _;
337
+ } catch (_) {
302
338
  try {
303
- const k = Date.now() - f;
304
- g({
305
- method: h,
306
- url: O,
339
+ const D = Date.now() - m;
340
+ c({
341
+ method: E,
342
+ url: k,
307
343
  status: 0,
308
- durationMs: k,
309
- startedAt: f,
344
+ durationMs: D,
345
+ startedAt: m,
310
346
  failed: !0,
311
347
  ...o ? { runId: o } : {}
312
- }), l(Q, {
313
- method: h,
314
- url: O,
348
+ }), i(oe, {
349
+ method: E,
350
+ url: k,
315
351
  status: 0,
316
- durationMs: k
352
+ durationMs: D
317
353
  });
318
354
  } catch {
319
355
  }
320
- throw R;
356
+ throw _;
321
357
  }
322
358
  }));
323
- const U = XMLHttpRequest.prototype.open, C = XMLHttpRequest.prototype.send, $ = "__echoNet";
324
- XMLHttpRequest.prototype.open = function(a, u, ...f) {
325
- return this[$] = {
326
- method: (a || "GET").toUpperCase(),
327
- url: H(u),
359
+ const q = XMLHttpRequest.prototype.open, F = XMLHttpRequest.prototype.send, N = "__echoNet";
360
+ XMLHttpRequest.prototype.open = function(f, p, ...m) {
361
+ return this[N] = {
362
+ method: (f || "GET").toUpperCase(),
363
+ url: H(p),
328
364
  start: 0,
329
- propagate: s(u)
330
- }, U.apply(this, [
331
- a,
332
- u,
333
- ...f
365
+ propagate: l(p)
366
+ }, q.apply(this, [
367
+ f,
368
+ p,
369
+ ...m
334
370
  ]);
335
- }, XMLHttpRequest.prototype.send = function(...a) {
336
- const u = this[$];
337
- if (u) {
338
- if (u.start = Date.now(), o && u.propagate) try {
339
- this.setRequestHeader(ue, o);
371
+ }, XMLHttpRequest.prototype.send = function(...f) {
372
+ const p = this[N];
373
+ if (p) {
374
+ if (p.start = Date.now(), o && p.propagate) try {
375
+ this.setRequestHeader(we, o);
340
376
  } catch {
341
377
  }
342
378
  this.addEventListener("loadend", () => {
343
379
  try {
344
- const f = Date.now() - u.start, h = this.status, O = h === 0, T = this.getResponseHeader("x-request-id"), R = this.getResponseHeader("traceparent");
345
- g({
346
- method: u.method,
347
- url: u.url,
348
- status: h,
349
- durationMs: f,
350
- responseSize: fe(this.getResponseHeader("content-length")),
380
+ const m = Date.now() - p.start, E = this.status, k = E === 0, x = this.getResponseHeader("x-request-id"), _ = this.getResponseHeader("traceparent");
381
+ c({
382
+ method: p.method,
383
+ url: p.url,
384
+ status: E,
385
+ durationMs: m,
386
+ responseSize: Se(this.getResponseHeader("content-length")),
351
387
  contentType: this.getResponseHeader("content-type") ?? void 0,
352
- startedAt: u.start,
353
- ...O ? { failed: !0 } : {},
388
+ startedAt: p.start,
389
+ ...k ? { failed: !0 } : {},
354
390
  ...o ? { runId: o } : {},
355
- ...T ? { requestId: T.slice(0, 200) } : {},
356
- ...R ? { traceparent: R.slice(0, 200) } : {}
357
- }), (O || h >= 400) && l(Q, {
358
- method: u.method,
359
- url: u.url,
360
- status: h,
361
- durationMs: f
391
+ ...x ? { requestId: x.slice(0, 200) } : {},
392
+ ..._ ? { traceparent: _.slice(0, 200) } : {}
393
+ }), (k || E >= 400) && i(oe, {
394
+ method: p.method,
395
+ url: p.url,
396
+ status: E,
397
+ durationMs: m
362
398
  });
363
399
  } catch {
364
400
  }
365
401
  }, { once: !0 });
366
402
  }
367
- return C.apply(this, a);
403
+ return F.apply(this, f);
368
404
  };
369
- const z = Je({
370
- onResource: (a) => {
405
+ const B = kt({
406
+ onResource: (f) => {
371
407
  e.captureNetwork && n.push(o ? {
372
- ...a,
408
+ ...f,
373
409
  runId: o
374
- } : a);
410
+ } : f);
375
411
  },
376
- onReport: (a, u) => d(a, D(u).slice(0, G), void 0, { mechanism: "report" })
377
- }), _ = () => e.captureNetwork ? [...t.snapshot(), ...n.snapshot()].sort((a, u) => a.startedAt - u.startedAt) : [];
378
- let N = !1;
412
+ onReport: (f, p) => a(f, U(p).slice(0, z), void 0, { mechanism: "report" })
413
+ }), $ = () => e.captureNetwork ? [...t.snapshot(), ...n.snapshot()].sort((f, p) => f.startedAt - p.startedAt) : [];
414
+ let M = !1;
379
415
  return {
380
416
  snapshot: () => ({
381
- errors: i.snapshot(),
417
+ errors: s.snapshot(),
382
418
  logs: r.snapshot(),
383
- network: _(),
419
+ network: $(),
384
420
  ...o ? { runId: o } : {}
385
421
  }),
386
- setSink: (a) => {
387
- c = a;
422
+ setSink: (f) => {
423
+ u = f;
388
424
  },
389
425
  flushRings: () => {
390
- const a = _();
391
- a.length > 0 && l(Pe, { entries: a });
392
- const u = r.snapshot();
393
- u.length > 0 && l($e, { entries: u });
394
- const f = i.snapshot();
395
- f.length > 0 && l(de, { entries: f });
426
+ const f = $();
427
+ f.length > 0 && i(ft, { entries: f });
428
+ const p = r.snapshot();
429
+ p.length > 0 && i(dt, { entries: p });
430
+ const m = s.snapshot();
431
+ m.length > 0 && i(Ee, { entries: m });
396
432
  },
397
433
  teardown: () => {
398
- N || (N = !0, c = null, z.teardown(), console.error = E, console.warn = b, console.log = S, console.info = A, window.removeEventListener("error", x, !0), window.removeEventListener("unhandledrejection", I), M && (window.fetch = M), XMLHttpRequest.prototype.open = U, XMLHttpRequest.prototype.send = C);
434
+ M || (M = !0, u = null, B.teardown(), console.error = g, console.warn = b, console.log = S, console.info = R, window.removeEventListener("error", L, !0), window.removeEventListener("unhandledrejection", C), T && (window.fetch = T), XMLHttpRequest.prototype.open = q, XMLHttpRequest.prototype.send = F);
399
435
  }
400
436
  };
401
437
  }
402
- var it = 100, st = [
438
+ var Mt = 100, Pt = [
403
439
  "hidden",
404
440
  "class",
405
441
  "style",
406
442
  "type",
407
443
  "disabled",
408
444
  "aria-hidden"
409
- ], Y = 'input[type="password"]', Re = 'input[autocomplete="username"], input[autocomplete="email"], input[type="email"]', Z = `${Y}, ${Re}`, X = /\b(connexion|se connecter|connectez[- ]vous|s'identifier|identifiez[- ]vous|login|log ?in|sign ?in)\b/, oe = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|register|create (an |your )?account|mot de passe oublie|oublie|reinitialiser|forgot|reset|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|code|newsletter|abonner|subscribe|enregistrer|sauvegarder|mettre a jour|save|update|confirmer|confirm|supprimer mon compte|delete account|payer|pay)\b/, at = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|create (an |your )?account|mot de passe oublie|reinitialiser|forgot|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|newsletter|abonner|subscribe)\b/, lt = /\b(afficher|masquer|voir|show|hide|toggle)\b/, ct = /\b(effacer|vider|supprimer|clear|reset)\b/, ut = /[\u{1F441}\u{1F576}\u{1F440}]/u;
410
- function B(e) {
445
+ ], ee = 'input[type="password"]', Fe = 'input[autocomplete="username"], input[autocomplete="email"], input[type="email"]', te = `${ee}, ${Fe}`, J = /\b(connexion|se connecter|connectez[- ]vous|s'identifier|identifiez[- ]vous|login|log ?in|sign ?in)\b/, ue = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|register|create (an |your )?account|mot de passe oublie|oublie|reinitialiser|forgot|reset|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|code|newsletter|abonner|subscribe|enregistrer|sauvegarder|mettre a jour|save|update|confirmer|confirm|supprimer mon compte|delete account|payer|pay)\b/, xt = /\b(inscription|s'inscrire|inscrivez|creer (un|votre|mon) compte|sign ?up|create (an |your )?account|mot de passe oublie|reinitialiser|forgot|lien de connexion|magic link|envoyer (un|le) lien|send (me )?(a |the )?link|newsletter|abonner|subscribe)\b/, Dt = /\b(afficher|masquer|voir|show|hide|toggle)\b/, qt = /\b(effacer|vider|supprimer|clear|reset)\b/, Ft = /[\u{1F441}\u{1F576}\u{1F440}]/u;
446
+ function W(e) {
411
447
  return (e ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[’‘]/g, "'").replace(/\s+/g, " ").trim().toLowerCase();
412
448
  }
413
- function J(e) {
449
+ function ne(e) {
414
450
  let t = e;
415
451
  for (; t; ) {
416
452
  if (t.hasAttribute("hidden") || t.getAttribute("aria-hidden") === "true" || t instanceof HTMLInputElement && t.type === "hidden") return !1;
@@ -420,43 +456,43 @@ function J(e) {
420
456
  }
421
457
  return !0;
422
458
  }
423
- function P(e, t) {
424
- return Array.from(e.querySelectorAll(t)).filter(J);
459
+ function V(e, t) {
460
+ return Array.from(e.querySelectorAll(t)).filter(ne);
425
461
  }
426
- function dt(e) {
462
+ function Bt(e) {
427
463
  return e ? e instanceof HTMLInputElement ? e.value : e.textContent ?? "" : "";
428
464
  }
429
- function Oe(e, t) {
465
+ function Be(e, t) {
430
466
  return !e.outsideForms || !t.closest("form");
431
467
  }
432
- function V(e, t) {
433
- return Array.from(e.scope.querySelectorAll(t)).filter((n) => J(n) && Oe(e, n));
468
+ function K(e, t) {
469
+ return Array.from(e.scope.querySelectorAll(t)).filter((n) => ne(n) && Be(e, n));
434
470
  }
435
- function K(e) {
436
- return B(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
471
+ function Q(e) {
472
+ return W(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
437
473
  }
438
- function ft(e) {
439
- const t = K(e);
440
- return lt.test(t) || ut.test(t);
474
+ function $t(e) {
475
+ const t = Q(e);
476
+ return Dt.test(t) || Ft.test(t);
441
477
  }
442
- function pt(e, t) {
478
+ function Gt(e, t) {
443
479
  if (e.getAttribute("type") === "submit" || !t) return !1;
444
480
  const n = e.parentElement;
445
- return !n || P(n, Z).length === 0 ? !1 : !n.contains(t);
481
+ return !n || V(n, te).length === 0 ? !1 : !n.contains(t);
446
482
  }
447
- var ht = 'button, input[type="submit"], input[type="button"], input[type="image"], a[href]';
448
- function gt(e) {
449
- return Array.from(e.querySelectorAll(ht)).some(J);
483
+ var Ut = 'button, input[type="submit"], input[type="button"], input[type="image"], a[href]';
484
+ function Ht(e) {
485
+ return Array.from(e.querySelectorAll(Ut)).some(ne);
450
486
  }
451
- function mt(e, t) {
487
+ function Vt(e, t) {
452
488
  let n = e.parentElement;
453
489
  for (; n && !n.contains(t); ) {
454
- if (gt(n)) return !0;
490
+ if (Ht(n)) return !0;
455
491
  n = n.parentElement;
456
492
  }
457
493
  return !1;
458
494
  }
459
- function yt(e) {
495
+ function jt(e) {
460
496
  const t = [
461
497
  e.getAttribute("name"),
462
498
  e.getAttribute("id"),
@@ -468,173 +504,173 @@ function yt(e) {
468
504
  const r = e.ownerDocument.querySelector(`label[for="${CSS.escape(n)}"]`);
469
505
  r && t.push(r.textContent);
470
506
  }
471
- return B(t.filter(Boolean).join(" "));
507
+ return W(t.filter(Boolean).join(" "));
472
508
  }
473
- function wt(e, t) {
509
+ function zt(e, t) {
474
510
  const n = e.parentElement;
475
511
  if (!n) return null;
476
- const r = e.ownerDocument.body, i = (d) => t ? Le({
477
- scope: d,
512
+ const r = e.ownerDocument.body, s = (a) => t ? $e({
513
+ scope: a,
478
514
  outsideForms: !0
479
- }, t) : e, o = (d) => ie({
480
- scope: d,
515
+ }, t) : e, o = (a) => fe({
516
+ scope: a,
481
517
  outsideForms: !0
482
- }, e, i(d)), s = (d) => !!i(d) && !!o(d);
483
- let c = n, l = null;
484
- const g = (d) => {
485
- const w = o(d);
486
- w && !l && X.test(K(w)) && (l = d);
518
+ }, e, s(a)), l = (a) => !!s(a) && !!o(a);
519
+ let u = n, i = null;
520
+ const c = (a) => {
521
+ const d = o(a);
522
+ d && !i && J.test(Q(d)) && (i = a);
487
523
  };
488
- for (g(n); c !== r && !s(c); ) {
489
- const d = c.parentElement;
490
- if (!d || d.querySelector("form")) break;
491
- const w = [e], v = i(c);
492
- v && v !== e && w.push(v);
493
- const E = !!v;
494
- if (P(d, Z).filter((b) => !b.closest("form") && !w.includes(b)).some((b) => b.matches(Y) || E || oe.test(yt(b)) ? !0 : mt(b, e))) break;
495
- c = d, g(d);
524
+ for (c(n); u !== r && !l(u); ) {
525
+ const a = u.parentElement;
526
+ if (!a || a.querySelector("form")) break;
527
+ const d = [e], y = s(u);
528
+ y && y !== e && d.push(y);
529
+ const g = !!y;
530
+ if (V(a, te).filter((b) => !b.closest("form") && !d.includes(b)).some((b) => b.matches(ee) || g || ue.test(jt(b)) ? !0 : Vt(b, e))) break;
531
+ u = a, c(a);
496
532
  }
497
533
  return {
498
- scope: s(c) ? c : l ?? n,
534
+ scope: l(u) ? u : i ?? n,
499
535
  outsideForms: !0
500
536
  };
501
537
  }
502
- function pe(e, t, n) {
538
+ function Re(e, t, n) {
503
539
  return e ? {
504
540
  scope: e,
505
541
  outsideForms: !1
506
- } : wt(t, n);
542
+ } : zt(t, n);
507
543
  }
508
- function vt(e, t) {
544
+ function Wt(e, t) {
509
545
  let n = e.parentElement;
510
546
  for (; n && n !== t.scope; ) {
511
- if (P(n, Z).length === 1) return !0;
547
+ if (V(n, te).length === 1) return !0;
512
548
  n = n.parentElement;
513
549
  }
514
550
  return !1;
515
551
  }
516
- function ie(e, t, n) {
517
- const r = (l) => !!(t.compareDocumentPosition(l) & Node.DOCUMENT_POSITION_FOLLOWING), i = Array.from(e.scope.querySelectorAll('button, input[type="submit"]')).filter((l) => J(l) && Oe(e, l) && (l.getAttribute("type") === "submit" || r(l)) && !ft(l) && !ct.test(K(l)) && !pt(l, n));
518
- if (i.length === 0) return null;
519
- const o = (l, g) => {
520
- const d = r(l);
552
+ function fe(e, t, n) {
553
+ const r = (i) => !!(t.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_FOLLOWING), s = Array.from(e.scope.querySelectorAll('button, input[type="submit"]')).filter((i) => ne(i) && Be(e, i) && (i.getAttribute("type") === "submit" || r(i)) && !$t(i) && !qt.test(Q(i)) && !Gt(i, n));
554
+ if (s.length === 0) return null;
555
+ const o = (i, c) => {
556
+ const a = r(i);
521
557
  return [
522
- vt(l, e) ? 1 : 0,
523
- X.test(K(l)) ? 0 : 1,
524
- l.getAttribute("type") === "submit" ? 0 : 1,
525
- d ? 0 : 1,
526
- d ? g : -g
558
+ Wt(i, e) ? 1 : 0,
559
+ J.test(Q(i)) ? 0 : 1,
560
+ i.getAttribute("type") === "submit" ? 0 : 1,
561
+ a ? 0 : 1,
562
+ a ? c : -c
527
563
  ];
528
564
  };
529
- let s = i[0], c = o(s, 0);
530
- return i.forEach((l, g) => {
531
- const d = o(l, g);
532
- for (let w = 0; w < d.length; w++) {
533
- const v = d[w], E = c[w];
534
- if (v !== E) {
535
- v < E && (s = l, c = d);
565
+ let l = s[0], u = o(l, 0);
566
+ return s.forEach((i, c) => {
567
+ const a = o(i, c);
568
+ for (let d = 0; d < a.length; d++) {
569
+ const y = a[d], g = u[d];
570
+ if (y !== g) {
571
+ y < g && (l = i, u = a);
536
572
  return;
537
573
  }
538
574
  }
539
- }), s;
575
+ }), l;
540
576
  }
541
- function he(e) {
542
- return e.querySelectorAll("form").length + (P(e, Z).some((t) => !t.closest("form")) ? 1 : 0) === 1;
577
+ function Le(e) {
578
+ return e.querySelectorAll("form").length + (V(e, te).some((t) => !t.closest("form")) ? 1 : 0) === 1;
543
579
  }
544
- function bt(e, t) {
580
+ function Xt(e, t) {
545
581
  if (e) {
546
582
  const n = e.getAttribute("aria-label");
547
583
  if (n) return n;
548
584
  const r = e.getAttribute("aria-labelledby");
549
585
  if (r) {
550
- const c = e.ownerDocument.getElementById(r);
551
- if (c) return c.textContent ?? "";
586
+ const u = e.ownerDocument.getElementById(r);
587
+ if (u) return u.textContent ?? "";
552
588
  }
553
- const i = e.querySelector("h1, h2, h3, legend");
554
- if (i) return i.textContent ?? "";
589
+ const s = e.querySelector("h1, h2, h3, legend");
590
+ if (s) return s.textContent ?? "";
555
591
  let o = e.previousElementSibling;
556
592
  for (; o; ) {
557
- const c = /^(h1|h2|h3|legend)$/i.test(o.tagName) ? o : o.querySelector("h1, h2, h3, legend");
558
- if (c) {
559
- const l = e.parentElement;
560
- return l && he(l) ? c.textContent ?? "" : "";
593
+ const u = /^(h1|h2|h3|legend)$/i.test(o.tagName) ? o : o.querySelector("h1, h2, h3, legend");
594
+ if (u) {
595
+ const i = e.parentElement;
596
+ return i && Le(i) ? u.textContent ?? "" : "";
561
597
  }
562
598
  o = o.previousElementSibling;
563
599
  }
564
- const s = e.closest("section, article, aside, dialog, fieldset, [role='dialog'], [role='region']");
565
- if (s && s !== e) {
566
- const c = s.querySelector("h1, h2, h3, legend");
567
- if (c)
568
- return he(s) ? c.textContent ?? "" : "";
600
+ const l = e.closest("section, article, aside, dialog, fieldset, [role='dialog'], [role='region']");
601
+ if (l && l !== e) {
602
+ const u = l.querySelector("h1, h2, h3, legend");
603
+ if (u)
604
+ return Le(l) ? u.textContent ?? "" : "";
569
605
  }
570
606
  return "";
571
607
  }
572
608
  return (t instanceof Document ? t.body : t)?.querySelector("h1, h2, h3")?.textContent ?? "";
573
609
  }
574
- function ge(e, t, n) {
575
- const r = B(dt(n)), i = B(bt(e, t)), o = (e?.getAttribute("action") ?? "").split("?")[0], s = B([
610
+ function _e(e, t, n) {
611
+ const r = W(Bt(n)), s = W(Xt(e, t)), o = (e?.getAttribute("action") ?? "").split("?")[0], l = W([
576
612
  e?.id,
577
613
  e?.getAttribute("name"),
578
614
  e?.className,
579
615
  o
580
616
  ].filter(Boolean).join(" "));
581
617
  return {
582
- positive: X.test(r) || X.test(i),
583
- negative: oe.test(r) || oe.test(i) || at.test(s)
618
+ positive: J.test(r) || J.test(s),
619
+ negative: ue.test(r) || ue.test(s) || xt.test(l)
584
620
  };
585
621
  }
586
- function Le(e, t) {
587
- const n = V(e, 'input[autocomplete="username"]')[0] ?? V(e, 'input[autocomplete="email"]')[0] ?? V(e, 'input[type="email"]')[0];
622
+ function $e(e, t) {
623
+ const n = K(e, 'input[autocomplete="username"]')[0] ?? K(e, 'input[autocomplete="email"]')[0] ?? K(e, 'input[type="email"]')[0];
588
624
  if (n) return n;
589
625
  if (!t) return null;
590
- const r = V(e, 'input[type="text"], input:not([type])').filter((i) => i.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
626
+ const r = K(e, 'input[type="text"], input:not([type])').filter((s) => s.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
591
627
  return r[r.length - 1] ?? null;
592
628
  }
593
- function ne(e, t) {
629
+ function ae(e, t) {
594
630
  if (t.querySelector('input[autocomplete="new-password"]')) return null;
595
- const n = P(t, Y);
631
+ const n = V(t, ee);
596
632
  if (n.length > 1) return null;
597
633
  if (n.length === 1) {
598
- const l = n[0], g = pe(e, l, l);
599
- if (!g) return null;
600
- const d = Le(g, l), w = ie(g, l, d), v = ge(e, t, w);
601
- return !(l.autocomplete === "current-password" || v.positive) || v.negative ? null : {
634
+ const i = n[0], c = Re(e, i, i);
635
+ if (!c) return null;
636
+ const a = $e(c, i), d = fe(c, i, a), y = _e(e, t, d);
637
+ return !(i.autocomplete === "current-password" || y.positive) || y.negative ? null : {
602
638
  kind: "password",
603
639
  form: e,
604
- identifier: d,
605
- password: l,
606
- submit: w
640
+ identifier: a,
641
+ password: i,
642
+ submit: d
607
643
  };
608
644
  }
609
- const r = P(t, Re);
645
+ const r = V(t, Fe);
610
646
  if (r.length !== 1) return null;
611
- const i = r[0], o = pe(e, i, null);
647
+ const s = r[0], o = Re(e, s, null);
612
648
  if (!o) return null;
613
- const s = ie(o, i, i), c = ge(e, t, s);
614
- return !(i.autocomplete === "username" || c.positive) || c.negative ? null : {
649
+ const l = fe(o, s, s), u = _e(e, t, l);
650
+ return !(s.autocomplete === "username" || u.positive) || u.negative ? null : {
615
651
  kind: "identifier",
616
652
  form: e,
617
- identifier: i,
653
+ identifier: s,
618
654
  password: null,
619
- submit: s
655
+ submit: l
620
656
  };
621
657
  }
622
- function me(e = document) {
658
+ function ke(e = document) {
623
659
  const t = Array.from(e.querySelectorAll("form"));
624
660
  for (const n of t) {
625
- const r = ne(n, n);
661
+ const r = ae(n, n);
626
662
  if (r) return r;
627
663
  }
628
- return t.length === 0 || P(e, Y).find((n) => !n.closest("form")) ? ne(null, e) : null;
664
+ return t.length === 0 || V(e, ee).find((n) => !n.closest("form")) ? ae(null, e) : null;
629
665
  }
630
- function ye(e, t) {
666
+ function Ae(e, t) {
631
667
  const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value")?.set ?? Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
632
668
  r ? r.call(e, t) : e.value = t, e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
633
669
  }
634
- function Et(e) {
670
+ function Kt(e) {
635
671
  return !!e.form || !!e.submit;
636
672
  }
637
- function St(e) {
673
+ function Yt(e) {
638
674
  const t = e.form, n = t?.noValidate;
639
675
  t && (t.noValidate = !0);
640
676
  try {
@@ -643,28 +679,28 @@ function St(e) {
643
679
  t && (t.noValidate = n ?? !1);
644
680
  }
645
681
  }
646
- var Rt = {
682
+ var Zt = {
647
683
  identifier: null,
648
684
  password: null
649
685
  };
650
- function we(e, t) {
686
+ function Oe(e, t) {
651
687
  return !e || e.disabled || e.readOnly ? !1 : e.value === "" || t !== null && e.value === t;
652
688
  }
653
- function Ae(e, t, n) {
689
+ function Ge(e, t, n) {
654
690
  return {
655
- identifier: we(e.identifier, n.identifier) && !t.identifier,
656
- password: we(e.password, n.password) && !t.password
691
+ identifier: Oe(e.identifier, n.identifier) && !t.identifier,
692
+ password: Oe(e.password, n.password) && !t.password
657
693
  };
658
694
  }
659
- function Ot(e, t, n) {
695
+ function Jt(e, t, n) {
660
696
  const r = e.identifier;
661
697
  return !r || n.identifier ? !1 : r.value !== "" && r.value !== t.login;
662
698
  }
663
- function Lt(e, t, n, r = Rt) {
664
- const i = Ae(e, n, r);
665
- return !i.identifier && !i.password ? { error: "nothing-to-fill" } : Ot(e, t, i) ? { error: "identifier-mismatch" } : Et(e) ? (i.identifier && ye(e.identifier, t.login), i.password && ye(e.password, t.password), St(e) ? { step: i.identifier && i.password ? "both" : i.password ? "password" : "identifier" } : { error: "no-submit" }) : { error: "no-submit" };
699
+ function Qt(e, t, n, r = Zt) {
700
+ const s = Ge(e, n, r);
701
+ return !s.identifier && !s.password ? { error: "nothing-to-fill" } : Jt(e, t, s) ? { error: "identifier-mismatch" } : Kt(e) ? (s.identifier && Ae(e.identifier, t.login), s.password && Ae(e.password, t.password), Yt(e) ? { step: s.identifier && s.password ? "both" : s.password ? "password" : "identifier" } : { error: "no-submit" }) : { error: "no-submit" };
666
702
  }
667
- function At(e) {
703
+ function en(e) {
668
704
  if (typeof window > "u" || typeof MutationObserver > "u") return {
669
705
  watch() {
670
706
  },
@@ -681,24 +717,24 @@ function At(e) {
681
717
  }, r = {
682
718
  identifier: null,
683
719
  password: null
684
- }, i = !1, o = null, s = null, c = null;
685
- const l = () => {
686
- c && clearTimeout(c), c = null;
687
- }, g = () => {
688
- o?.disconnect(), o = null, l(), s && clearTimeout(s), s = null;
689
- }, d = () => {
690
- const E = me(document);
691
- if (!E) {
692
- i = !1, r = {
720
+ }, s = !1, o = null, l = null, u = null;
721
+ const i = () => {
722
+ u && clearTimeout(u), u = null;
723
+ }, c = () => {
724
+ o?.disconnect(), o = null, i(), l && clearTimeout(l), l = null;
725
+ }, a = () => {
726
+ const g = ke(document);
727
+ if (!g) {
728
+ s = !1, r = {
693
729
  identifier: null,
694
730
  password: null
695
- }, l();
731
+ }, i();
696
732
  return;
697
733
  }
698
734
  if (!t)
699
- i || (i = !0, e.onDetected());
735
+ s || (s = !0, e.onDetected());
700
736
  else {
701
- const b = Ae(E, n, r), S = Lt(E, t, n, r);
737
+ const b = Ge(g, n, r), S = Qt(g, t, n, r);
702
738
  if ("error" in S || (b.identifier && (n = {
703
739
  ...n,
704
740
  identifier: !0
@@ -712,44 +748,144 @@ function At(e) {
712
748
  ...r,
713
749
  password: t.password
714
750
  })), "error" in S) {
715
- const A = S.error !== "nothing-to-fill" ? S.error : !n.identifier && !n.password ? "already-filled" : null;
716
- A && (e.onError(A), t = null, g());
751
+ const R = S.error !== "nothing-to-fill" ? S.error : !n.identifier && !n.password ? "already-filled" : null;
752
+ R && (e.onError(R), t = null, c());
717
753
  } else
718
- e.onFilled(S.step), n.password && (t = null, l(), c = setTimeout(() => {
719
- c = null, me(document) && (i = !0, e.onDetected());
720
- }, Ie));
754
+ e.onFilled(S.step), n.password && (t = null, i(), u = setTimeout(() => {
755
+ u = null, ke(document) && (s = !0, e.onDetected());
756
+ }, tt));
721
757
  }
722
- }, w = () => {
723
- s && clearTimeout(s), s = setTimeout(() => {
724
- s = null, d();
725
- }, it);
726
- }, v = () => {
727
- o || (o = new MutationObserver(w), o.observe(document.body, {
758
+ }, d = () => {
759
+ l && clearTimeout(l), l = setTimeout(() => {
760
+ l = null, a();
761
+ }, Mt);
762
+ }, y = () => {
763
+ o || (o = new MutationObserver(d), o.observe(document.body, {
728
764
  childList: !0,
729
765
  subtree: !0,
730
766
  attributes: !0,
731
- attributeFilter: st
767
+ attributeFilter: Pt
732
768
  }));
733
769
  };
734
770
  return {
735
771
  watch() {
736
- o || (i = !1, v()), d();
772
+ o || (s = !1, y()), a();
737
773
  },
738
- fill(E) {
739
- t = E, v(), d();
774
+ fill(g) {
775
+ t = g, y(), a();
740
776
  },
741
777
  cancel() {
742
778
  t = null, n = {
743
779
  identifier: !1,
744
780
  password: !1
745
- }, i = !1, g();
781
+ }, s = !1, c();
746
782
  },
747
783
  teardown() {
748
- t = null, g();
784
+ t = null, c();
785
+ }
786
+ };
787
+ }
788
+ var tn = "leesto/navigation";
789
+ function nn(e) {
790
+ const t = e?.timestamp;
791
+ return typeof t == "number" ? t : void 0;
792
+ }
793
+ function rn(e) {
794
+ return e?.type === 4;
795
+ }
796
+ function on(e) {
797
+ try {
798
+ return JSON.stringify(e)?.length ?? 0;
799
+ } catch {
800
+ return 0;
801
+ }
802
+ }
803
+ function sn(e) {
804
+ const t = e.now ?? Date.now, n = e.measure ?? on;
805
+ let r = [], s = 0, o = !1, l = Number.NEGATIVE_INFINITY;
806
+ const u = () => {
807
+ const c = r.shift();
808
+ c && (s -= c.bytes);
809
+ }, i = () => {
810
+ if (!o) {
811
+ const d = t() - e.windowMs;
812
+ for (; r.length > 1 && (r[1]?.start ?? Number.POSITIVE_INFINITY) <= d; ) u();
813
+ }
814
+ const c = o ? e.heldMaxBytes : e.maxBytes;
815
+ for (; s > c && r.length > 1; ) u();
816
+ const a = r[r.length - 1];
817
+ if (s > c && e.requestCheckout && (a?.events.length ?? 0) > 2) {
818
+ const d = t();
819
+ d - l >= e.minCheckoutIntervalMs && (l = d, e.requestCheckout());
749
820
  }
750
821
  };
822
+ return {
823
+ push(c) {
824
+ const a = n(c);
825
+ if (rn(c)) r.push({
826
+ start: nn(c) ?? t(),
827
+ events: [c],
828
+ bytes: a
829
+ });
830
+ else {
831
+ const d = r[r.length - 1];
832
+ if (!d) return;
833
+ d.events.push(c), d.bytes += a;
834
+ }
835
+ s += a, i();
836
+ },
837
+ snapshot() {
838
+ const c = [];
839
+ for (const a of r) for (const d of a.events) c.push(d);
840
+ return c;
841
+ },
842
+ hold() {
843
+ i(), o = !0;
844
+ },
845
+ release() {
846
+ o = !1, i();
847
+ },
848
+ stats() {
849
+ let c = 0;
850
+ for (const a of r) c += a.events.length;
851
+ return {
852
+ segments: r.length,
853
+ events: c,
854
+ bytes: s,
855
+ held: o
856
+ };
857
+ },
858
+ clear() {
859
+ r = [], s = 0;
860
+ }
861
+ };
862
+ }
863
+ var an = "leesto-mask", Te = "[data-leesto-block]", Ue = "leesto-mask-text", He = "[data-private]", ln = `.${Ue}, ${He}`, cn = 'img, picture, video, canvas, object, embed, svg image, input[type="image"]', un = 'button, a, [role="button"], [role="link"], input[type="button"], input[type="submit"], input[type="reset"]';
864
+ var Ve = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select';
865
+ function je(e) {
866
+ return e.replace(/\S/g, "*");
867
+ }
868
+ function fn(e, t) {
869
+ try {
870
+ return e.closest(t);
871
+ } catch {
872
+ return null;
873
+ }
874
+ }
875
+ function ze(e) {
876
+ return fn(e, ln) !== null;
877
+ }
878
+ function We(e) {
879
+ if (!e || typeof e.closest != "function") return !1;
880
+ try {
881
+ if (ze(e) || e.matches(Ve)) return !1;
882
+ const t = e.closest(un);
883
+ return t ? (t.textContent ?? "").trim().length <= 80 : !1;
884
+ } catch {
885
+ return !1;
886
+ }
751
887
  }
752
- var kt = 6e5, Ct = 1e3, It = {
888
+ var Ce = {
753
889
  maskAllInputs: !0,
754
890
  maskInputOptions: {
755
891
  password: !0,
@@ -757,37 +893,214 @@ var kt = 6e5, Ct = 1e3, It = {
757
893
  tel: !0,
758
894
  text: !0
759
895
  },
760
- blockClass: "leesto-mask",
761
- blockSelector: "[data-leesto-block]",
762
- maskTextClass: "leesto-mask-text",
763
- maskTextSelector: "[data-private]"
896
+ blockClass: an,
897
+ maskTextClass: Ue
764
898
  };
765
- async function _t(e) {
766
- const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = Date.now();
767
- let i = [], o = !1, s = 0;
768
- const c = () => {
769
- if (i.length === 0) return;
770
- const S = i;
771
- i = [], e.onBatch(S);
772
- }, l = t({
773
- emit(S) {
774
- i.push(S);
899
+ function Xe(e) {
900
+ if (e === "inputs_only") return {
901
+ ...Ce,
902
+ blockSelector: Te,
903
+ maskTextSelector: He
904
+ };
905
+ const t = {
906
+ ...Ce,
907
+ blockSelector: `${Te}, ${cn}`,
908
+ maskTextSelector: "*"
909
+ };
910
+ return e === "labels_visible" ? {
911
+ ...t,
912
+ maskTextFn: (n, r) => We(r) ? n : je(n)
913
+ } : t;
914
+ }
915
+ var Ie = /* @__PURE__ */ new Set([
916
+ "placeholder",
917
+ "title",
918
+ "alt",
919
+ "label",
920
+ "aria-label",
921
+ "aria-description",
922
+ "aria-placeholder",
923
+ "aria-roledescription",
924
+ "aria-valuetext"
925
+ ]), dn = 2, pn = 3, hn = 4, mn = 0, gn = 2;
926
+ function yn(e, t, n) {
927
+ if (e) try {
928
+ return e.matches(Ve);
929
+ } catch {
930
+ return !0;
931
+ }
932
+ const r = t.toLowerCase();
933
+ if (r === "textarea" || r === "select") return !0;
934
+ if (r !== "input") return !1;
935
+ const s = String(n.type ?? "").toLowerCase();
936
+ return s !== "button" && s !== "submit" && s !== "reset";
937
+ }
938
+ function Ke(e, t, n) {
939
+ const r = e;
940
+ if (!r || typeof r != "object" || !r.data) return e;
941
+ const s = (c) => {
942
+ if (typeof c != "number") return null;
943
+ try {
944
+ const a = n(c);
945
+ return a && a.nodeType === 1 ? a : null;
946
+ } catch {
947
+ return null;
948
+ }
949
+ }, o = (c, a, d, y) => {
950
+ if (a === "value") {
951
+ if (yn(c, d, y)) return !1;
952
+ } else if (!Ie.has(a)) return !0;
953
+ return !c || ze(c) ? !1 : t === "inputs_only" ? !0 : t === "labels_visible" ? We(c) : !1;
954
+ }, l = (c, a, d) => {
955
+ if (d)
956
+ for (const y of Object.keys(d)) {
957
+ const g = d[y];
958
+ typeof g != "string" || !g || y !== "value" && !Ie.has(y) || o(c, y, a, d) || (d[y] = je(g));
959
+ }
960
+ }, u = (c) => {
961
+ const a = c ? [c] : [];
962
+ for (; a.length > 0; ) {
963
+ const d = a.pop();
964
+ d.type === gn && d.attributes && l(s(d.id), String(d.tagName ?? ""), d.attributes), Array.isArray(d.childNodes) && a.push(...d.childNodes);
965
+ }
966
+ }, i = r.data;
967
+ if (r.type === hn && typeof i.href == "string") i.href = ut(i.href);
968
+ else if (r.type === dn) u(i.node);
969
+ else if (r.type === pn && i.source === mn) {
970
+ for (const c of i.adds ?? []) u(c.node);
971
+ for (const c of i.attributes ?? []) {
972
+ const a = s(c.id);
973
+ l(a, a?.tagName ?? "", c.attributes);
974
+ }
975
+ }
976
+ return e;
977
+ }
978
+ var Ye = 6e5, Ze = 1e3, vn = {
979
+ mousemove: 100,
980
+ scroll: 150
981
+ }, wn = {
982
+ windowMs: 12e4,
983
+ checkoutEveryNms: 6e4,
984
+ maxBytes: 8388608,
985
+ heldMaxBytes: 33554432,
986
+ minCheckoutIntervalMs: 15e3,
987
+ sampling: vn
988
+ }, bn = 5;
989
+ async function En(e) {
990
+ const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = e.maskPolicy ?? "mask_all", s = Date.now();
991
+ let o = [], l = !1, u = 0;
992
+ const i = () => {
993
+ if (o.length === 0) return;
994
+ const R = o;
995
+ o = [], e.onBatch(R);
996
+ }, c = t({
997
+ emit(R) {
998
+ o.push(Ke(R, r, (L) => t.mirror.getNode(L)));
775
999
  },
776
- ...It
777
- }), g = e.diagnostics ?? null, d = l ? g ?? Se({ captureNetwork: e.captureNetwork !== !1 }) : null, w = d !== null && g === null;
778
- d?.setSink((S, A) => {
1000
+ ...Xe(r)
1001
+ }), a = e.diagnostics ?? null, d = c ? a ?? qe({ captureNetwork: e.captureNetwork !== !1 }) : null, y = d !== null && a === null;
1002
+ d?.setSink((R, L) => {
779
1003
  try {
780
- n(S, A);
1004
+ n(R, L);
781
1005
  } catch {
782
1006
  }
783
1007
  });
784
- const v = setInterval(c, Ct), E = { timer: null }, b = () => (o || (o = !0, clearInterval(v), clearTimeout(E.timer ?? void 0), d?.flushRings(), d?.setSink(null), w && d?.teardown(), l?.(), c(), s = Date.now() - r), s);
785
- return E.timer = setTimeout(() => {
786
- b(), e.onCap();
787
- }, kt), { stop: b };
1008
+ const g = setInterval(i, Ze), b = { timer: null }, S = () => (l || (l = !0, clearInterval(g), clearTimeout(b.timer ?? void 0), d?.flushRings(), d?.setSink(null), y && d?.teardown(), c?.(), i(), u = Date.now() - s), u);
1009
+ return b.timer = setTimeout(() => {
1010
+ S(), e.onCap();
1011
+ }, Ye), { stop: S };
1012
+ }
1013
+ async function Sn(e) {
1014
+ const { record: t, addCustomEvent: n } = await import("./chunks/rrweb-qwppqH_c.js"), r = {
1015
+ ...wn,
1016
+ ...e.config
1017
+ }, { diagnostics: s } = e, o = e.maskPolicy ?? "mask_all";
1018
+ let l = !1, u = null, i = null;
1019
+ const c = () => {
1020
+ try {
1021
+ t.takeFullSnapshot(!0);
1022
+ } catch {
1023
+ }
1024
+ }, a = sn({
1025
+ windowMs: r.windowMs,
1026
+ maxBytes: r.maxBytes,
1027
+ heldMaxBytes: r.heldMaxBytes,
1028
+ minCheckoutIntervalMs: r.minCheckoutIntervalMs,
1029
+ requestCheckout: () => queueMicrotask(() => {
1030
+ l || c();
1031
+ })
1032
+ }), d = t({
1033
+ emit(g) {
1034
+ const b = Ke(g, o, (S) => t.mirror.getNode(S));
1035
+ a.push(b), u?.(b);
1036
+ },
1037
+ checkoutEveryNms: r.checkoutEveryNms,
1038
+ sampling: r.sampling,
1039
+ ...Xe(o)
1040
+ });
1041
+ if (!d) return null;
1042
+ const y = (g, b) => {
1043
+ try {
1044
+ n(g, b);
1045
+ } catch {
1046
+ }
1047
+ };
1048
+ return s.setSink(y), {
1049
+ snapshot() {
1050
+ const g = a.snapshot(), b = Date.now();
1051
+ s.setSink((R, L) => {
1052
+ g.push({
1053
+ type: bn,
1054
+ data: {
1055
+ tag: R,
1056
+ payload: L
1057
+ },
1058
+ timestamp: b
1059
+ });
1060
+ });
1061
+ try {
1062
+ s.flushRings();
1063
+ } finally {
1064
+ s.setSink(l ? null : y);
1065
+ }
1066
+ const S = g[0]?.timestamp;
1067
+ return {
1068
+ events: g,
1069
+ durationMs: typeof S == "number" ? Math.max(0, b - S) : 0
1070
+ };
1071
+ },
1072
+ hold: () => a.hold(),
1073
+ release: () => a.release(),
1074
+ markNavigation(g) {
1075
+ l || y(tn, { href: H(g) });
1076
+ },
1077
+ stats: () => a.stats(),
1078
+ stream({ onBatch: g, onCap: b }) {
1079
+ i?.stop();
1080
+ const S = Date.now();
1081
+ let R = [], L = !1, C = 0;
1082
+ const T = () => {
1083
+ if (R.length === 0) return;
1084
+ const $ = R;
1085
+ R = [], g($);
1086
+ }, q = ($) => {
1087
+ R.push($);
1088
+ };
1089
+ u = q, c();
1090
+ const F = setInterval(T, Ze), N = { timer: null }, B = { stop() {
1091
+ return L || (L = !0, clearInterval(F), clearTimeout(N.timer ?? void 0), s.flushRings(), u === q && (u = null), i === B && (i = null), T(), C = Date.now() - S), C;
1092
+ } };
1093
+ return N.timer = setTimeout(() => {
1094
+ B.stop(), b();
1095
+ }, Ye), i = B, B;
1096
+ },
1097
+ stop() {
1098
+ l || (l = !0, i?.stop(), s.setSink(null), d(), a.clear());
1099
+ }
1100
+ };
788
1101
  }
789
- var Nt = ["https://lab.leesto.app", "https://lab-dev.leesto.app"], Tt = ["http://localhost:3505", "http://127.0.0.1:3505"];
790
- function qt(e) {
1102
+ var Rn = ["https://lab.leesto.app", "https://lab-dev.leesto.app"], Ln = ["http://localhost:3505", "http://127.0.0.1:3505"];
1103
+ function _n(e) {
791
1104
  try {
792
1105
  const t = new URL(e).hostname;
793
1106
  return t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "[::1]";
@@ -795,7 +1108,7 @@ function qt(e) {
795
1108
  return !1;
796
1109
  }
797
1110
  }
798
- function Dt(e) {
1111
+ function kn(e) {
799
1112
  const t = e.trim();
800
1113
  if (!t) return null;
801
1114
  try {
@@ -805,33 +1118,33 @@ function Dt(e) {
805
1118
  return null;
806
1119
  }
807
1120
  }
808
- function xt(e) {
809
- const t = (e.explicit ?? []).map(Dt).filter((r) => r !== null);
1121
+ function An(e) {
1122
+ const t = (e.explicit ?? []).map(kn).filter((r) => r !== null);
810
1123
  if (t.length > 0) return [...new Set(t)];
811
- const n = [...Nt];
812
- return qt(e.pageOrigin) && n.push(...Tt), [...new Set(n)];
1124
+ const n = [...Rn];
1125
+ return _n(e.pageOrigin) && n.push(...Ln), [...new Set(n)];
813
1126
  }
814
- function ve(e, t) {
1127
+ function le(e, t) {
815
1128
  return !e || e === "*" || e === "null" ? !1 : t.includes(e);
816
1129
  }
817
- function re() {
1130
+ function Y() {
818
1131
  return typeof navigator < "u" && navigator.globalPrivacyControl === !0;
819
1132
  }
820
- function Mt(e) {
821
- const t = (s) => {
822
- const c = typeof s == "string" ? s.trim() : "";
823
- return c.length > 0 ? c : void 0;
824
- }, n = (s) => {
1133
+ function On(e) {
1134
+ const t = (l) => {
1135
+ const u = typeof l == "string" ? l.trim() : "";
1136
+ return u.length > 0 ? u : void 0;
1137
+ }, n = (l) => {
825
1138
  if (!(typeof document > "u"))
826
- return t(document.querySelector(`meta[name="${s}"]`)?.getAttribute("content"));
827
- }, r = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, i = t(e?.version) ?? t(r?.version) ?? n("app-version"), o = t(e?.environment) ?? t(r?.environment) ?? n("app-environment");
828
- if (!(!i && !o))
1139
+ return t(document.querySelector(`meta[name="${l}"]`)?.getAttribute("content"));
1140
+ }, r = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, s = t(e?.version) ?? t(r?.version) ?? n("app-version"), o = t(e?.environment) ?? t(r?.environment) ?? n("app-environment");
1141
+ if (!(!s && !o))
829
1142
  return {
830
- ...i ? { version: i } : {},
1143
+ ...s ? { version: s } : {},
831
1144
  ...o ? { environment: o } : {}
832
1145
  };
833
1146
  }
834
- function Pt() {
1147
+ function Tn() {
835
1148
  if (typeof document > "u") return;
836
1149
  const e = document.querySelector('link[rel~="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]');
837
1150
  if (e?.href)
@@ -841,43 +1154,43 @@ function Pt() {
841
1154
  return;
842
1155
  }
843
1156
  }
844
- function $t() {
1157
+ function Cn() {
845
1158
  const e = (r) => !!r && r !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(r), t = getComputedStyle(document.body).backgroundColor;
846
1159
  if (e(t)) return t;
847
1160
  const n = getComputedStyle(document.documentElement).backgroundColor;
848
1161
  return e(n) ? n : "#ffffff";
849
1162
  }
850
- async function be(e) {
1163
+ async function Ne(e) {
851
1164
  const { domToPng: t } = await import("./chunks/dist-BTlWkbvW.js");
852
1165
  if (e) {
853
- const s = document.querySelector(e);
854
- if (!s) throw new Error("element_not_found");
855
- return t(s, { quality: 0.92 });
1166
+ const l = document.querySelector(e);
1167
+ if (!l) throw new Error("element_not_found");
1168
+ return t(l, { quality: 0.92 });
856
1169
  }
857
- const n = document.documentElement, r = window.scrollX, i = window.scrollY, o = [];
858
- for (const s of n.querySelectorAll("*")) {
859
- const c = getComputedStyle(s).position;
860
- if (c === "fixed" || c === "sticky") {
861
- const l = s.style.transform;
862
- o.push([s, l]), s.style.transform = `translate(${r}px, ${i}px)${l ? ` ${l}` : ""}`;
1170
+ const n = document.documentElement, r = window.scrollX, s = window.scrollY, o = [];
1171
+ for (const l of n.querySelectorAll("*")) {
1172
+ const u = getComputedStyle(l).position;
1173
+ if (u === "fixed" || u === "sticky") {
1174
+ const i = l.style.transform;
1175
+ o.push([l, i]), l.style.transform = `translate(${r}px, ${s}px)${i ? ` ${i}` : ""}`;
863
1176
  }
864
1177
  }
865
1178
  try {
866
1179
  return await t(n, {
867
1180
  quality: 0.92,
868
- backgroundColor: $t(),
1181
+ backgroundColor: Cn(),
869
1182
  width: n.clientWidth,
870
1183
  height: n.clientHeight,
871
1184
  style: {
872
- transform: `translate(${-r}px, ${-i}px)`,
1185
+ transform: `translate(${-r}px, ${-s}px)`,
873
1186
  transformOrigin: "top left"
874
1187
  }
875
1188
  });
876
1189
  } finally {
877
- for (const [s, c] of o) s.style.transform = c;
1190
+ for (const [l, u] of o) l.style.transform = u;
878
1191
  }
879
1192
  }
880
- function Ft(e) {
1193
+ function In(e) {
881
1194
  if (e.id) return `#${CSS.escape(e.id)}`;
882
1195
  const t = [];
883
1196
  let n = e;
@@ -887,50 +1200,75 @@ function Ft(e) {
887
1200
  break;
888
1201
  }
889
1202
  let r = n.tagName.toLowerCase();
890
- const i = typeof n.className == "string" ? n.className.trim().split(/\s+/).filter(Boolean)[0] : null;
891
- i && (r += `.${CSS.escape(i)}`);
1203
+ const s = typeof n.className == "string" ? n.className.trim().split(/\s+/).filter(Boolean)[0] : null;
1204
+ s && (r += `.${CSS.escape(s)}`);
892
1205
  const o = n.parentElement;
893
1206
  if (o) {
894
- const s = Array.from(o.children).filter((c) => c.tagName === n?.tagName);
895
- s.length > 1 && (r += `:nth-of-type(${s.indexOf(n) + 1})`);
1207
+ const l = Array.from(o.children).filter((u) => u.tagName === n?.tagName);
1208
+ l.length > 1 && (r += `:nth-of-type(${l.indexOf(n) + 1})`);
896
1209
  }
897
1210
  t.unshift(r), n = o;
898
1211
  }
899
1212
  return t.join(" > ");
900
1213
  }
901
- function Gt(e) {
1214
+ function Nn(e) {
902
1215
  const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
903
1216
  return n ? `${t} · ${n}` : t;
904
1217
  }
905
- function Ee(e = {}) {
1218
+ var Je = "leesto:shell-origin";
1219
+ function Mn() {
1220
+ try {
1221
+ return sessionStorage.getItem(Je);
1222
+ } catch {
1223
+ return null;
1224
+ }
1225
+ }
1226
+ function Pn(e) {
1227
+ try {
1228
+ sessionStorage.setItem(Je, e);
1229
+ } catch {
1230
+ }
1231
+ }
1232
+ function xn() {
1233
+ try {
1234
+ return typeof window.name == "string" ? window.name : "";
1235
+ } catch {
1236
+ return "";
1237
+ }
1238
+ }
1239
+ function Me(e = {}) {
906
1240
  if (typeof window > "u" || window.parent === window) return () => {
907
1241
  };
908
- const t = window.parent, n = e.highlightColor ?? He.light.primary, r = xt({
1242
+ const t = window.parent, n = e.highlightColor ?? mt.light.primary, r = An({
909
1243
  explicit: e.shellOrigins,
910
1244
  pageOrigin: location.origin
911
1245
  });
912
- let i = null;
1246
+ let s = null;
913
1247
  try {
914
- const p = document.referrer ? new URL(document.referrer).origin : "";
915
- ve(p, r) && (i = p);
1248
+ const h = document.referrer ? new URL(document.referrer).origin : "";
1249
+ le(h, r) && (s = h);
916
1250
  } catch {
917
1251
  }
918
- const o = (p) => {
919
- if (i) {
920
- t.postMessage(p, i);
1252
+ if (!s) {
1253
+ const h = Mn();
1254
+ h && le(h, r) && (s = h);
1255
+ }
1256
+ const o = (h) => {
1257
+ if (s) {
1258
+ t.postMessage(h, s);
921
1259
  return;
922
1260
  }
923
- for (const m of r) t.postMessage(p, m);
1261
+ for (const v of r) t.postMessage(h, v);
924
1262
  };
925
- let s = null, c = "";
926
- const l = () => {
927
- s && (s.style.outline = c), s = null;
1263
+ let l = null, u = "";
1264
+ const i = () => {
1265
+ l && (l.style.outline = u), l = null;
928
1266
  };
929
- let g = null;
930
- const d = () => {
931
- g?.(), l(), document.querySelector("[data-leesto-picker-outline]")?.remove();
932
- const p = document.createElement("div");
933
- p.dataset.leestoPickerOutline = "", p.setAttribute("aria-hidden", "true"), Object.assign(p.style, {
1267
+ let c = null;
1268
+ const a = () => {
1269
+ c?.(), i(), document.querySelector("[data-leesto-picker-outline]")?.remove();
1270
+ const h = document.createElement("div");
1271
+ h.dataset.leestoPickerOutline = "", h.setAttribute("aria-hidden", "true"), Object.assign(h.style, {
934
1272
  position: "fixed",
935
1273
  pointerEvents: "none",
936
1274
  zIndex: "2147483647",
@@ -938,186 +1276,240 @@ function Ee(e = {}) {
938
1276
  border: `2px solid ${n}`,
939
1277
  borderRadius: "4px",
940
1278
  display: "none"
941
- }), document.documentElement.append(p);
942
- let m = null, y = null;
943
- const ke = document.body.style.cursor, F = () => {
944
- const L = y ?? m;
945
- if (!L) return;
946
- const q = L.getBoundingClientRect();
947
- y ? o({
1279
+ }), document.documentElement.append(h);
1280
+ let v = null, w = null;
1281
+ const j = document.body.style.cursor, P = () => {
1282
+ const O = w ?? v;
1283
+ if (!O) return;
1284
+ const G = O.getBoundingClientRect();
1285
+ w ? o({
948
1286
  type: "leesto:element-picked",
949
- selector: Ft(L),
950
- label: Gt(L),
1287
+ selector: In(O),
1288
+ label: Nn(O),
951
1289
  rect: {
952
- x: q.x,
953
- y: q.y,
954
- width: q.width,
955
- height: q.height
1290
+ x: G.x,
1291
+ y: G.y,
1292
+ width: G.width,
1293
+ height: G.height
956
1294
  }
957
- }) : Object.assign(p.style, {
1295
+ }) : Object.assign(h.style, {
958
1296
  display: "block",
959
- left: `${q.x}px`,
960
- top: `${q.y}px`,
961
- width: `${q.width}px`,
962
- height: `${q.height}px`
1297
+ left: `${G.x}px`,
1298
+ top: `${G.y}px`,
1299
+ width: `${G.width}px`,
1300
+ height: `${G.height}px`
963
1301
  });
964
- }, se = (L) => {
965
- m = L.target instanceof Element ? L.target : null, F();
966
- }, ae = () => {
967
- p.remove(), document.removeEventListener("mousemove", se, !0), document.removeEventListener("click", le, !0), document.body.style.cursor = ke;
968
- }, le = (L) => {
969
- L.preventDefault(), L.stopPropagation(), y = L.target instanceof Element ? L.target : null, ae(), F();
970
- }, ce = (L) => {
971
- L.key === "Escape" && (g?.(), o({ type: "leesto:pick-cancelled" }));
1302
+ }, I = (O) => {
1303
+ v = O.target instanceof Element ? O.target : null, P();
1304
+ }, ge = () => {
1305
+ h.remove(), document.removeEventListener("mousemove", I, !0), document.removeEventListener("click", ye, !0), document.body.style.cursor = j;
1306
+ }, ye = (O) => {
1307
+ O.preventDefault(), O.stopPropagation(), w = O.target instanceof Element ? O.target : null, ge(), P();
1308
+ }, ve = (O) => {
1309
+ O.key === "Escape" && (c?.(), o({ type: "leesto:pick-cancelled" }));
972
1310
  };
973
- g = () => {
974
- ae(), document.removeEventListener("keydown", ce, !0), document.removeEventListener("scroll", F, !0), window.removeEventListener("resize", F), g = null;
975
- }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", se, !0), document.addEventListener("click", le, !0), document.addEventListener("keydown", ce, !0), document.addEventListener("scroll", F, !0), window.addEventListener("resize", F);
976
- }, w = Me(location.search) && !re(), v = w ? xe(location.search) ?? De() : void 0, E = w ? Se({
1311
+ c = () => {
1312
+ ge(), document.removeEventListener("keydown", ve, !0), document.removeEventListener("scroll", P, !0), window.removeEventListener("resize", P), c = null;
1313
+ }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", I, !0), document.addEventListener("click", ye, !0), document.addEventListener("keydown", ve, !0), document.addEventListener("scroll", P, !0), window.addEventListener("resize", P);
1314
+ }, d = ct(location.search, xn()), y = ce(d) && !Y(), g = at(d), b = y ? lt(d) ?? it() : void 0, S = y ? qe({
977
1315
  captureNetwork: e.captureNetwork !== !1,
978
- runId: v,
1316
+ runId: b,
979
1317
  runIdOrigins: e.runIdOrigins
980
1318
  }) : null;
981
- let b = null, S = !1, A = !1;
982
- const x = () => {
983
- if (b) {
984
- const p = b.stop();
985
- b = null, o({
1319
+ let R = !1;
1320
+ const L = S ? Sn({
1321
+ diagnostics: S,
1322
+ maskPolicy: g
1323
+ }).then((h) => h && R ? (h.stop(), null) : h).catch(() => null) : null;
1324
+ let C = null, T = !1, q = !1;
1325
+ const F = () => {
1326
+ if (C) {
1327
+ const h = C.stop();
1328
+ C = null, o({
986
1329
  type: "leesto:rec-stopped",
987
- durationMs: p
1330
+ durationMs: h
988
1331
  });
989
- } else S && (A = !0);
990
- }, I = At({
1332
+ } else T && (q = !0);
1333
+ }, N = en({
991
1334
  onDetected: () => o({ type: "leesto:login-form-detected" }),
992
- onFilled: (p) => o({
1335
+ onFilled: (h) => o({
993
1336
  type: "leesto:login-filled",
994
- step: p
1337
+ step: h
995
1338
  }),
996
- onError: (p) => o({
1339
+ onError: (h) => o({
997
1340
  type: "leesto:login-error",
998
- reason: p
1341
+ reason: h
999
1342
  })
1000
- }), M = () => I.cancel();
1001
- window.addEventListener("pagehide", M);
1002
- const U = Mt(e.build), C = window.navigation;
1003
- let $ = !1, z = !1;
1004
- const _ = () => !$ && C?.canGoBack === !0;
1005
- let N = _(), a = location.href;
1006
- const u = () => {
1007
- a = location.href, N = _();
1008
- const p = Pt();
1343
+ }), B = () => N.cancel();
1344
+ window.addEventListener("pagehide", B);
1345
+ const $ = On(e.build), M = window.navigation;
1346
+ let f = !1;
1347
+ const p = () => !f && M?.canGoBack === !0, m = () => !f && M?.canGoForward === !0;
1348
+ let E = m(), k = p(), x = location.href;
1349
+ const _ = () => {
1350
+ x = location.href, k = p(), E = m();
1351
+ const h = Tn();
1009
1352
  o({
1010
1353
  type: "leesto:ready",
1011
1354
  url: location.href,
1012
1355
  bridgeVersion: 1,
1013
- capabilities: [Ce, ...C ? ["navigation"] : []],
1014
- canGoBack: N,
1015
- ...p ? { favicon: p } : {},
1016
- ...U ? { build: U } : {},
1017
- ...v ? { diagnosticRunId: v } : {},
1018
- ...re() ? { gpc: !0 } : {}
1356
+ capabilities: [
1357
+ Qe,
1358
+ ...M ? ["navigation", "navigation-forward"] : [],
1359
+ ...L ? [et] : []
1360
+ ],
1361
+ canGoBack: k,
1362
+ canGoForward: E,
1363
+ ...h ? { favicon: h } : {},
1364
+ ...$ ? { build: $ } : {},
1365
+ ...b ? { diagnosticRunId: b } : {},
1366
+ ...Y() ? { gpc: !0 } : {}
1019
1367
  });
1020
- }, f = (p) => {
1021
- if (p.source !== t || !ve(p.origin, r) || !_e(p.data)) return;
1022
- i || (i = p.origin);
1023
- const m = p.data;
1024
- if (m.type === "leesto:ping")
1025
- o({ type: "leesto:pong" }), u();
1026
- else if (m.type === "leesto:navigate-back") {
1027
- if (!C || !_()) return;
1028
- $ = !0, h(), Promise.resolve(C.back().finished).catch(() => {
1368
+ }, D = (h) => {
1369
+ if (h.source !== t || !le(h.origin, r) || !nt(h.data)) return;
1370
+ s !== h.origin && (s = h.origin, Pn(h.origin));
1371
+ const v = h.data;
1372
+ if (v.type === "leesto:ping")
1373
+ o({ type: "leesto:pong" }), _();
1374
+ else if (v.type === "leesto:navigate-back" || v.type === "leesto:navigate-forward") {
1375
+ const w = v.type === "leesto:navigate-forward";
1376
+ if (!M || !(w ? m() : p())) return;
1377
+ f = !0, A(), Promise.resolve((w ? M.forward() : M.back()).finished).catch(() => {
1029
1378
  }).finally(() => {
1030
- $ = !1, z || h();
1379
+ f = !1, R || A();
1031
1380
  });
1032
- } else if (m.type === "leesto:highlight") {
1033
- if (l(), m.selector) {
1034
- let y = null;
1381
+ } else if (v.type === "leesto:highlight") {
1382
+ if (i(), v.selector) {
1383
+ let w = null;
1035
1384
  try {
1036
- y = document.querySelector(m.selector);
1385
+ w = document.querySelector(v.selector);
1037
1386
  } catch {
1038
- y = null;
1387
+ w = null;
1039
1388
  }
1040
- y && (s = y, c = y.style.outline, y.style.outline = `2px solid ${n}`, y.style.outlineOffset = "2px", y.scrollIntoView({
1389
+ w && (l = w, u = w.style.outline, w.style.outline = `2px solid ${n}`, w.style.outlineOffset = "2px", w.scrollIntoView({
1041
1390
  block: "center",
1042
1391
  behavior: "smooth"
1043
1392
  }));
1044
1393
  }
1045
- } else if (m.type === "leesto:pick-start") d();
1046
- else if (m.type === "leesto:pick-stop") g?.();
1047
- else if (m.type === "leesto:capture-request") (m.selector ? be(m.selector) : (e.capture ?? be)()).then((y) => o({
1394
+ } else if (v.type === "leesto:pick-start") a();
1395
+ else if (v.type === "leesto:pick-stop") c?.();
1396
+ else if (v.type === "leesto:capture-request") (v.selector ? Ne(v.selector) : (e.capture ?? Ne)()).then((w) => o({
1048
1397
  type: "leesto:screenshot",
1049
- dataUrl: y,
1050
- ...m.selector ? { selector: m.selector } : {}
1051
- })).catch((y) => o({
1398
+ dataUrl: w,
1399
+ ...v.selector ? { selector: v.selector } : {}
1400
+ })).catch((w) => o({
1052
1401
  type: "leesto:capture-failed",
1053
- reason: y instanceof Error ? y.message : "capture_error"
1402
+ reason: w instanceof Error ? w.message : "capture_error"
1054
1403
  }));
1055
- else if (m.type === "leesto:rec-start") {
1056
- if (b || S) return;
1057
- if (re()) {
1404
+ else if (v.type === "leesto:rec-start") {
1405
+ if (C || T) return;
1406
+ if (Y()) {
1058
1407
  o({
1059
1408
  type: "leesto:rec-blocked",
1060
1409
  reason: "gpc"
1061
1410
  });
1062
1411
  return;
1063
1412
  }
1064
- S = !0, A = !1, _t({
1065
- onBatch: (y) => o({
1066
- type: "leesto:rec-batch",
1067
- events: y
1068
- }),
1069
- onCap: () => x(),
1413
+ T = !0, q = !1;
1414
+ const w = (I) => o({
1415
+ type: "leesto:rec-batch",
1416
+ events: I
1417
+ }), j = () => F(), P = () => En({
1418
+ onBatch: w,
1419
+ onCap: j,
1070
1420
  captureNetwork: e.captureNetwork,
1071
- diagnostics: E
1072
- }).then((y) => {
1073
- S = !1, b = y, A && x();
1074
- }).catch((y) => {
1075
- S = !1, o({
1421
+ maskPolicy: g,
1422
+ diagnostics: S
1423
+ });
1424
+ (L ? L.then((I) => I ? I.stream({
1425
+ onBatch: w,
1426
+ onCap: j
1427
+ }) : P()) : P()).then((I) => {
1428
+ T = !1, C = I, q && F();
1429
+ }).catch((I) => {
1430
+ T = !1, o({
1076
1431
  type: "leesto:rec-error",
1077
- reason: y instanceof Error ? y.message : "rec_error"
1432
+ reason: I instanceof Error ? I.message : "rec_error"
1078
1433
  });
1079
1434
  });
1080
- } else m.type === "leesto:rec-stop" ? x() : m.type === "leesto:diagnostics-request" ? o({
1435
+ } else if (v.type === "leesto:rec-stop") F();
1436
+ else if (v.type === "leesto:rec-buffer-request") {
1437
+ if (!L) {
1438
+ o({
1439
+ type: "leesto:rec-buffer",
1440
+ events: [],
1441
+ durationMs: 0,
1442
+ unavailable: Y() ? "gpc" : "not-armed"
1443
+ });
1444
+ return;
1445
+ }
1446
+ L.then((w) => {
1447
+ if (R) return;
1448
+ if (!w) {
1449
+ o({
1450
+ type: "leesto:rec-buffer",
1451
+ events: [],
1452
+ durationMs: 0,
1453
+ unavailable: "error"
1454
+ });
1455
+ return;
1456
+ }
1457
+ const { events: j, durationMs: P } = w.snapshot();
1458
+ o({
1459
+ type: "leesto:rec-buffer",
1460
+ events: j,
1461
+ durationMs: P
1462
+ });
1463
+ });
1464
+ } else v.type === "leesto:rec-buffer-hold" ? L?.then((w) => w?.hold()) : v.type === "leesto:rec-buffer-release" ? L?.then((w) => w?.release()) : v.type === "leesto:diagnostics-request" ? o({
1081
1465
  type: "leesto:diagnostics",
1082
- snapshot: E?.snapshot() ?? {
1466
+ snapshot: S?.snapshot() ?? {
1083
1467
  errors: [],
1084
1468
  logs: [],
1085
1469
  network: []
1086
1470
  }
1087
- }) : m.type === "leesto:login-watch" ? I.watch() : m.type === "leesto:login-fill" ? I.fill({
1088
- login: m.login,
1089
- password: m.password
1090
- }) : m.type === "leesto:login-cancel" && I.cancel();
1471
+ }) : v.type === "leesto:login-watch" ? N.watch() : v.type === "leesto:login-fill" ? N.fill({
1472
+ login: v.login,
1473
+ password: v.password
1474
+ }) : v.type === "leesto:login-cancel" && N.cancel();
1091
1475
  };
1092
- window.addEventListener("message", f), u();
1093
- const h = () => {
1094
- location.href === a && _() === N || (a = location.href, N = _(), o({
1095
- type: "leesto:location",
1096
- url: location.href,
1097
- canGoBack: N
1098
- }));
1099
- }, O = history.pushState, T = history.replaceState, R = (...p) => {
1100
- O.apply(history, p), h();
1101
- }, k = (...p) => {
1102
- T.apply(history, p), h();
1476
+ window.addEventListener("message", D), _();
1477
+ const A = (h) => {
1478
+ if (!(location.href === x && p() === k && m() === E)) {
1479
+ if (location.href !== x) {
1480
+ const v = location.href;
1481
+ L?.then((w) => w?.markNavigation(v));
1482
+ }
1483
+ x = location.href, k = p(), E = m(), o({
1484
+ type: "leesto:location",
1485
+ url: location.href,
1486
+ canGoBack: k,
1487
+ canGoForward: E,
1488
+ navigationType: typeof h == "string" ? h : "traverse"
1489
+ });
1490
+ }
1491
+ }, de = history.pushState, pe = history.replaceState, he = (...h) => {
1492
+ de.apply(history, h), A("push");
1493
+ }, me = (...h) => {
1494
+ pe.apply(history, h), A("replace");
1103
1495
  };
1104
- return history.pushState = R, history.replaceState = k, C?.addEventListener("currententrychange", h), window.addEventListener("popstate", h), window.addEventListener("hashchange", h), () => {
1105
- z = !0, C?.removeEventListener("currententrychange", h), x(), E?.teardown(), l(), g?.(), I.teardown(), window.removeEventListener("pagehide", M), window.removeEventListener("message", f), window.removeEventListener("popstate", h), window.removeEventListener("hashchange", h), history.pushState === R && (history.pushState = O), history.replaceState === k && (history.replaceState = T);
1496
+ return history.pushState = he, history.replaceState = me, M?.addEventListener("currententrychange", A), window.addEventListener("popstate", A), window.addEventListener("hashchange", A), () => {
1497
+ R = !0, M?.removeEventListener("currententrychange", A), F(), L?.then((h) => h?.stop()), S?.teardown(), i(), c?.(), N.teardown(), window.removeEventListener("pagehide", B), window.removeEventListener("message", D), window.removeEventListener("popstate", A), window.removeEventListener("hashchange", A), history.pushState === he && (history.pushState = de), history.replaceState === me && (history.replaceState = pe);
1106
1498
  };
1107
1499
  }
1108
- function Ht() {
1500
+ function Dn() {
1109
1501
  return typeof document > "u" ? null : document.currentScript ?? document.querySelector("script[data-leesto-connect]");
1110
1502
  }
1111
- function Ut(e) {
1503
+ function qn(e) {
1112
1504
  const t = {}, n = e?.dataset.highlightColor;
1113
1505
  n && (t.highlightColor = n);
1114
- const r = (e?.dataset.shellOrigin ?? "").split(",").map((i) => i.trim()).filter(Boolean);
1506
+ const r = (e?.dataset.shellOrigin ?? "").split(",").map((s) => s.trim()).filter(Boolean);
1115
1507
  return r.length > 0 && (t.shellOrigins = r), t;
1116
1508
  }
1117
1509
  if (typeof window < "u") {
1118
- window.LeestoConnect = { connect: (t) => Ee(t) };
1119
- const e = Ht();
1120
- (!e || e.dataset.leestoManual === void 0) && Ee(Ut(e));
1510
+ window.LeestoConnect = { connect: (t) => Me(t) };
1511
+ const e = Dn();
1512
+ (!e || e.dataset.leestoManual === void 0) && Me(qn(e));
1121
1513
  }
1122
1514
 
1123
1515
  //# sourceMappingURL=leesto-connect.js.map