leesto-connect 0.1.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,194 +1,218 @@
1
- var J = {
2
- 50: "#f0fdf4",
3
- 100: "#dcfce7",
4
- 200: "#bbf7d0",
5
- 300: "#86efac",
6
- 400: "#4ade80",
7
- 500: "#22c55e",
8
- 600: "#16a34a",
9
- 700: "#15803d",
10
- 800: "#166534",
11
- 900: "#14532d",
12
- 950: "#052e16"
13
- }, Q = {
14
- primary: "#08783f",
15
- hover: "#066633",
16
- foreground: "#f3fff7"
17
- }, ee = {
18
- primary: "#46c383",
19
- hover: "#65d49b",
20
- foreground: "#082315"
21
- }, te = {
22
- palette: J,
23
- light: Q,
24
- dark: ee
25
- };
26
- function ne(e) {
1
+ var Qe = "login", et = "rrweb-buffer", tt = 6e3;
2
+ function nt(e) {
27
3
  return typeof e == "object" && e !== null && typeof e.type == "string" && e.type.startsWith("leesto:");
28
4
  }
29
- var re = "leesto_diag", oe = "leesto_run", F = "X-Leesto-Run-Id", se = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
30
- function G(e) {
31
- return typeof e == "string" && se.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);
32
12
  }
33
- function ie() {
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);
20
+ }
21
+ function it() {
34
22
  try {
35
23
  const e = globalThis.crypto, t = e?.randomUUID?.();
36
- if (G(t)) return t;
24
+ if (Z(t)) return t;
37
25
  if (!e?.getRandomValues) return;
38
- const r = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
39
- r[6] = (r[6] ?? 0) & 15 | 64, r[8] = (r[8] ?? 0) & 63 | 128;
40
- const a = Array.from(r, (s) => s.toString(16).padStart(2, "0")).join(""), l = `${a.slice(0, 8)}-${a.slice(8, 12)}-${a.slice(12, 16)}-${a.slice(16, 20)}-${a.slice(20)}`;
41
- return G(l) ? l : void 0;
26
+ const n = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
27
+ n[6] = (n[6] ?? 0) & 15 | 64, n[8] = (n[8] ?? 0) & 63 | 128;
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;
42
30
  } catch {
43
31
  return;
44
32
  }
45
33
  }
46
- function ae(e) {
34
+ function at(e) {
47
35
  try {
48
- const t = new URLSearchParams(e).get(oe);
49
- return G(t) ? t : void 0;
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) {
43
+ try {
44
+ const t = new URLSearchParams(e).get(xe);
45
+ return Z(t) ? t : void 0;
50
46
  } catch {
51
47
  return;
52
48
  }
53
49
  }
54
50
  function ce(e) {
55
51
  try {
56
- return new URLSearchParams(e).get(re) === "1";
52
+ return new URLSearchParams(e).get(Pe) === "1";
57
53
  } catch {
58
54
  return !1;
59
55
  }
60
56
  }
61
- var W = "leesto/console", B = "leesto/network", le = "leesto/network-ring", ue = "leesto/console-ring", de = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g, fe = /\b\d{3}-\d{2}-\d{4}\b/g, pe = /\d(?:[ -]?\d){12,18}/g;
62
- function he(e) {
63
- let t = 0, r = !1;
64
- for (let a = e.length - 1; a >= 0; a--) {
65
- let l = e.charCodeAt(a) - 48;
66
- if (l < 0 || l > 9) return !1;
67
- r && (l *= 2, l > 9 && (l -= 9)), t += l, r = !r;
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 = {
74
+ primary: "#08783f",
75
+ hover: "#066633",
76
+ foreground: "#f3fff7"
77
+ }, ht = {
78
+ primary: "#46c383",
79
+ hover: "#65d49b",
80
+ foreground: "#082315"
81
+ }, mt = {
82
+ light: pt,
83
+ dark: ht
84
+ };
85
+ function X(e) {
86
+ const t = [];
87
+ return {
88
+ push(n) {
89
+ t.push(n), t.length > e && t.shift();
90
+ },
91
+ snapshot() {
92
+ return t.slice();
93
+ }
94
+ };
95
+ }
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) {
98
+ let t = 0, n = !1;
99
+ for (let r = e.length - 1; r >= 0; r--) {
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;
68
103
  }
69
104
  return t % 10 === 0;
70
105
  }
71
- function O(e) {
106
+ function U(e) {
72
107
  if (!e) return e;
73
- let t = e.replace(de, "[email masqué]");
74
- return t = t.replace(fe, "[id masqué]"), t = t.replace(pe, (r) => {
75
- const a = r.replace(/[ -]/g, "");
76
- return a.length >= 13 && a.length <= 19 && he(a) ? "[carte masquée]" : r;
108
+ let t = e.replace(gt, "[email masqué]");
109
+ return t = t.replace(yt, "[id masqué]"), t = t.replace(vt, (n) => {
110
+ const r = n.replace(/[ -]/g, "");
111
+ return r.length >= 13 && r.length <= 19 && wt(r) ? "[carte masquée]" : n;
77
112
  }), t;
78
113
  }
79
- function I(e) {
114
+ function H(e) {
80
115
  const t = typeof e == "string" ? e : e instanceof URL ? e.href : e instanceof Request ? e.url : String(e);
81
116
  try {
82
- const r = new URL(t, typeof location < "u" ? location.href : void 0);
83
- return r.origin + O(r.pathname);
117
+ const n = new URL(t, typeof location < "u" ? location.href : void 0);
118
+ return n.origin + U(n.pathname);
84
119
  } catch {
85
- return O(t.split("?")[0] ?? t);
120
+ return U(t.split("?")[0] ?? t);
86
121
  }
87
122
  }
88
- var ge = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), me = ["deprecation", "intervention"], ye = { teardown: () => {
123
+ var bt = /* @__PURE__ */ new Set(["fetch", "xmlhttprequest"]), Et = ["deprecation", "intervention"], St = { teardown: () => {
89
124
  } };
90
- function we(e) {
125
+ function Rt(e) {
91
126
  const t = typeof performance < "u" ? performance.timeOrigin : 0;
92
127
  return Math.round(t + e);
93
128
  }
94
- function ve(e) {
129
+ function Lt(e) {
95
130
  const t = e.responseStatus;
96
131
  return typeof t == "number" && t > 0 ? t : void 0;
97
132
  }
98
- function Re(e) {
99
- if (ge.has(e.initiatorType)) return null;
100
- const t = ve(e), r = 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;
101
136
  return {
102
137
  method: "GET",
103
- url: I(e.name),
138
+ url: H(e.name),
104
139
  ...t !== void 0 ? { status: t } : {},
105
140
  durationMs: Math.round(e.duration),
106
- ...r ? { responseSize: r } : {},
107
- startedAt: we(e.startTime),
141
+ ...n ? { responseSize: n } : {},
142
+ startedAt: Rt(e.startTime),
108
143
  ...t !== void 0 && t >= 400 ? { failed: !0 } : {},
109
144
  initiatorType: e.initiatorType
110
145
  };
111
146
  }
112
- function Se(e) {
113
- if (typeof window > "u") return ye;
147
+ function kt(e) {
148
+ if (typeof window > "u") return St;
114
149
  const t = [];
115
150
  if (typeof PerformanceObserver < "u") try {
116
- const s = new PerformanceObserver((u) => {
117
- for (const d of u.getEntries()) try {
118
- const h = Re(d);
119
- h && e.onResource(h);
151
+ const o = new PerformanceObserver((l) => {
152
+ for (const u of l.getEntries()) try {
153
+ const i = _t(u);
154
+ i && e.onResource(i);
120
155
  } catch {
121
156
  }
122
157
  });
123
- s.observe({
158
+ o.observe({
124
159
  type: "resource",
125
160
  buffered: !0
126
- }), t.push(() => s.disconnect());
161
+ }), t.push(() => o.disconnect());
127
162
  } catch {
128
163
  }
129
- const r = window.ReportingObserver;
130
- if (r) try {
131
- const s = new r(((u) => {
132
- for (const d of u) {
133
- const h = typeof d.body?.message == "string" ? d.body.message : d.type;
134
- e.onReport("warn", `Navigateur (${d.type}) : ${h}`);
164
+ const n = window.ReportingObserver;
165
+ if (n) try {
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}`);
135
170
  }
136
171
  }), {
137
- types: me,
172
+ types: Et,
138
173
  buffered: !0
139
174
  });
140
- s.observe(), t.push(() => s.disconnect());
175
+ o.observe(), t.push(() => o.disconnect());
141
176
  } catch {
142
177
  }
143
- const a = (s) => {
144
- const u = s;
145
- e.onReport("error", `CSP : ${u.blockedURI || "ressource"} bloqué par « ${u.violatedDirective} »`);
178
+ const r = (o) => {
179
+ const l = o;
180
+ e.onReport("error", `CSP : ${l.blockedURI || "ressource"} bloqué par « ${l.violatedDirective} »`);
146
181
  };
147
- window.addEventListener("securitypolicyviolation", a), t.push(() => window.removeEventListener("securitypolicyviolation", a));
148
- let l = !1;
182
+ window.addEventListener("securitypolicyviolation", r), t.push(() => window.removeEventListener("securitypolicyviolation", r));
183
+ let s = !1;
149
184
  return { teardown: () => {
150
- if (!l) {
151
- l = !0;
152
- for (const s of t) try {
153
- s();
185
+ if (!s) {
186
+ s = !0;
187
+ for (const o of t) try {
188
+ o();
154
189
  } catch {
155
190
  }
156
191
  }
157
192
  } };
158
193
  }
159
- function x(e) {
160
- const t = [];
161
- return {
162
- push(r) {
163
- t.push(r), t.length > e && t.shift();
164
- },
165
- snapshot() {
166
- return t.slice();
167
- }
168
- };
169
- }
170
- var Ee = 50, be = 30, ke = 100, Le = 50, N = 500, Oe = 8e3;
171
- function j(e) {
194
+ var At = 50, Ot = 30, Tt = 100, Ct = 50, z = 500, It = 8e3;
195
+ function se(e) {
172
196
  const t = e instanceof Error ? e.stack : void 0;
173
197
  if (t)
174
- return O(t).slice(0, Oe);
198
+ return U(t).slice(0, It);
175
199
  }
176
- function X(e) {
200
+ function ie(e) {
177
201
  if (e instanceof Error) return `${e.name}: ${e.message}`;
178
202
  if (typeof e == "string") return e;
179
203
  if (typeof e == "object" && e !== null) try {
180
- return JSON.stringify(e, (t, r) => /^(authorization|cookie|set-cookie|token|access_token|refresh_token|password|secret|api[-_]?key)$/i.test(t) ? "[masqué]" : r).slice(0, 500);
204
+ return JSON.stringify(e, (t, n) => /^(authorization|cookie|set-cookie|token|access_token|refresh_token|password|secret|api[-_]?key)$/i.test(t) ? "[masqué]" : n).slice(0, 500);
181
205
  } catch {
182
206
  return "[objet]";
183
207
  }
184
208
  return String(e);
185
209
  }
186
- function V(e) {
210
+ function Se(e) {
187
211
  if (!e) return;
188
212
  const t = Number(e);
189
213
  return Number.isFinite(t) && t >= 0 ? t : void 0;
190
214
  }
191
- var _e = {
215
+ var Nt = {
192
216
  snapshot: () => ({
193
217
  errors: [],
194
218
  logs: [],
@@ -201,217 +225,667 @@ var _e = {
201
225
  teardown: () => {
202
226
  }
203
227
  };
204
- function Z(e) {
205
- if (typeof window > "u") return _e;
206
- const t = x(Ee), r = x(be), a = x(ke), l = x(Le), s = G(e.runId) ? e.runId : void 0, u = (o) => {
207
- if (!s) return !1;
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) => {
231
+ if (!o) return !1;
208
232
  try {
209
- const n = new URL(String(o), location.href);
210
- return n.origin === location.origin || (e.runIdOrigins ?? []).includes(n.origin);
233
+ const p = new URL(String(f), location.href);
234
+ return p.origin === location.origin || (e.runIdOrigins ?? []).includes(p.origin);
211
235
  } catch {
212
236
  return !1;
213
237
  }
214
238
  };
215
- let d = e.sink ?? null;
216
- const h = (o, n) => {
217
- d?.(o, n);
218
- }, m = (o) => {
219
- e.captureNetwork && t.push(o);
220
- }, w = (o, n, i, c = {}) => {
221
- if (!n) return;
222
- const g = {
223
- level: o,
224
- message: n,
225
- ...i ? { stack: i } : {},
226
- ...c,
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,
227
251
  at: Date.now()
228
252
  };
229
- l.push(g), h(W, g);
230
- }, _ = (o, n) => {
253
+ s.push(k), i(Ee, k);
254
+ }, d = (f, p) => {
231
255
  try {
232
- const i = O(n.map(X).join(" ")).slice(0, N), c = n.find((g) => g instanceof Error);
233
- w(o, i, j(c), {
256
+ const m = U(p.map(ie).join(" ")).slice(0, z), E = p.find((k) => k instanceof Error);
257
+ a(f, m, se(E), {
234
258
  mechanism: "console",
235
- ...c instanceof Error && c.name ? { name: c.name } : {}
259
+ ...E instanceof Error && E.name ? { name: E.name } : {}
236
260
  });
237
261
  } catch {
238
262
  }
239
- }, E = (o, n) => {
263
+ }, y = (f, p) => {
240
264
  try {
241
- const i = O(n.map(X).join(" ")).slice(0, N);
242
- i && a.push({
243
- level: o,
244
- message: i,
265
+ const m = U(p.map(ie).join(" ")).slice(0, z);
266
+ m && r.push({
267
+ level: f,
268
+ message: m,
245
269
  at: Date.now()
246
270
  });
247
271
  } catch {
248
272
  }
249
- }, R = console.error, v = console.warn, y = console.log, b = console.info;
250
- console.error = (...o) => (_("error", o), R.apply(console, o)), console.warn = (...o) => (_("warn", o), v.apply(console, o)), console.log = (...o) => (E("log", o), y.apply(console, o)), console.info = (...o) => (E("info", o), b.apply(console, o));
251
- const A = (o) => {
252
- const n = o.target;
253
- if (n instanceof Element) {
254
- const c = n.src || n.href || "";
255
- if (!c) return;
256
- w("error", `Ressource non chargée : <${n.tagName.toLowerCase()}> ${I(c)}`.slice(0, N), 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, {
257
281
  mechanism: "resource",
258
- sourceUrl: I(c)
282
+ sourceUrl: H(E)
259
283
  });
260
284
  return;
261
285
  }
262
- const i = o;
263
- w("error", O(`Erreur non gérée : ${i.message}`).slice(0, N), j(i.error), {
286
+ const m = f;
287
+ a("error", U(`Erreur non gérée : ${m.message}`).slice(0, z), se(m.error), {
264
288
  mechanism: "window.error",
265
- ...typeof i.error?.name == "string" ? { name: i.error.name } : {},
266
- ...typeof i.filename == "string" && i.filename ? { sourceUrl: I(i.filename) } : {},
267
- ...typeof i.lineno == "number" && i.lineno > 0 ? { line: i.lineno } : {},
268
- ...typeof i.colno == "number" && i.colno > 0 ? { column: i.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 } : {}
269
293
  });
270
- }, T = (o) => {
271
- w("error", O(`Promesse rejetée : ${X(o.reason)}`).slice(0, N), j(o.reason), {
294
+ }, C = (f) => {
295
+ a("error", U(`Promesse rejetée : ${ie(f.reason)}`).slice(0, z), se(f.reason), {
272
296
  mechanism: "unhandledrejection",
273
- ...o.reason instanceof Error && o.reason.name ? { name: o.reason.name } : {}
297
+ ...f.reason instanceof Error && f.reason.name ? { name: f.reason.name } : {}
274
298
  });
275
299
  };
276
- window.addEventListener("error", A, !0), window.addEventListener("unhandledrejection", T);
277
- const k = typeof window.fetch == "function" ? window.fetch.bind(window) : null;
278
- k && (window.fetch = (async (o, n) => {
279
- const i = Date.now(), c = (n?.method ?? (o instanceof Request ? o.method : "GET") ?? "GET").toUpperCase(), g = I(o);
280
- let L = n;
281
- if (s && u(o)) {
282
- const p = new Headers(o instanceof Request ? o.headers : void 0);
283
- for (const [f, C] of new Headers(n?.headers)) p.set(f, C);
284
- p.set(F, s), L = {
285
- ...n,
286
- headers: p
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: _
287
311
  };
288
312
  }
289
313
  try {
290
- const p = await k(o, L);
314
+ const _ = await T(f, x);
291
315
  try {
292
- const f = p.headers.get("x-request-id"), C = p.headers.get("traceparent");
293
- m({
294
- method: c,
295
- url: g,
296
- status: p.status,
297
- durationMs: Date.now() - i,
298
- responseSize: V(p.headers.get("content-length")),
299
- contentType: p.headers.get("content-type") ?? void 0,
300
- startedAt: i,
301
- ...f ? { requestId: f.slice(0, 200) } : {},
302
- ...C ? { traceparent: C.slice(0, 200) } : {},
303
- ...s ? { runId: s } : {}
304
- }), p.ok || h(B, {
305
- method: c,
306
- url: g,
307
- status: p.status,
308
- durationMs: Date.now() - i
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) } : {},
327
+ ...o ? { runId: o } : {}
328
+ }), _.ok || i(oe, {
329
+ method: E,
330
+ url: k,
331
+ status: _.status,
332
+ durationMs: Date.now() - m
309
333
  });
310
334
  } catch {
311
335
  }
312
- return p;
313
- } catch (p) {
336
+ return _;
337
+ } catch (_) {
314
338
  try {
315
- const f = Date.now() - i;
316
- m({
317
- method: c,
318
- url: g,
339
+ const D = Date.now() - m;
340
+ c({
341
+ method: E,
342
+ url: k,
319
343
  status: 0,
320
- durationMs: f,
321
- startedAt: i,
344
+ durationMs: D,
345
+ startedAt: m,
322
346
  failed: !0,
323
- ...s ? { runId: s } : {}
324
- }), h(B, {
325
- method: c,
326
- url: g,
347
+ ...o ? { runId: o } : {}
348
+ }), i(oe, {
349
+ method: E,
350
+ url: k,
327
351
  status: 0,
328
- durationMs: f
352
+ durationMs: D
329
353
  });
330
354
  } catch {
331
355
  }
332
- throw p;
356
+ throw _;
333
357
  }
334
358
  }));
335
- const M = XMLHttpRequest.prototype.open, q = XMLHttpRequest.prototype.send, S = "__echoNet";
336
- XMLHttpRequest.prototype.open = function(o, n, ...i) {
337
- return this[S] = {
338
- method: (o || "GET").toUpperCase(),
339
- url: I(n),
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),
340
364
  start: 0,
341
- propagate: u(n)
342
- }, M.apply(this, [
343
- o,
344
- n,
345
- ...i
365
+ propagate: l(p)
366
+ }, q.apply(this, [
367
+ f,
368
+ p,
369
+ ...m
346
370
  ]);
347
- }, XMLHttpRequest.prototype.send = function(...o) {
348
- const n = this[S];
349
- if (n) {
350
- if (n.start = Date.now(), s && n.propagate) try {
351
- this.setRequestHeader(F, s);
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);
352
376
  } catch {
353
377
  }
354
378
  this.addEventListener("loadend", () => {
355
379
  try {
356
- const i = Date.now() - n.start, c = this.status, g = c === 0, L = this.getResponseHeader("x-request-id"), p = this.getResponseHeader("traceparent");
357
- m({
358
- method: n.method,
359
- url: n.url,
360
- status: c,
361
- durationMs: i,
362
- responseSize: V(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")),
363
387
  contentType: this.getResponseHeader("content-type") ?? void 0,
364
- startedAt: n.start,
365
- ...g ? { failed: !0 } : {},
366
- ...s ? { runId: s } : {},
367
- ...L ? { requestId: L.slice(0, 200) } : {},
368
- ...p ? { traceparent: p.slice(0, 200) } : {}
369
- }), (g || c >= 400) && h(B, {
370
- method: n.method,
371
- url: n.url,
372
- status: c,
373
- durationMs: i
388
+ startedAt: p.start,
389
+ ...k ? { failed: !0 } : {},
390
+ ...o ? { runId: o } : {},
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
374
398
  });
375
399
  } catch {
376
400
  }
377
401
  }, { once: !0 });
378
402
  }
379
- return q.apply(this, o);
403
+ return F.apply(this, f);
380
404
  };
381
- const D = Se({
382
- onResource: (o) => {
383
- e.captureNetwork && r.push(s ? {
384
- ...o,
385
- runId: s
386
- } : o);
405
+ const B = kt({
406
+ onResource: (f) => {
407
+ e.captureNetwork && n.push(o ? {
408
+ ...f,
409
+ runId: o
410
+ } : f);
387
411
  },
388
- onReport: (o, n) => w(o, O(n).slice(0, N), void 0, { mechanism: "report" })
389
- }), $ = () => e.captureNetwork ? [...t.snapshot(), ...r.snapshot()].sort((o, n) => o.startedAt - n.startedAt) : [];
390
- let P = !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;
391
415
  return {
392
416
  snapshot: () => ({
393
- errors: l.snapshot(),
394
- logs: a.snapshot(),
417
+ errors: s.snapshot(),
418
+ logs: r.snapshot(),
395
419
  network: $(),
396
- ...s ? { runId: s } : {}
420
+ ...o ? { runId: o } : {}
397
421
  }),
398
- setSink: (o) => {
399
- d = o;
422
+ setSink: (f) => {
423
+ u = f;
400
424
  },
401
425
  flushRings: () => {
402
- const o = $();
403
- o.length > 0 && h(le, { entries: o });
404
- const n = a.snapshot();
405
- n.length > 0 && h(ue, { entries: n });
406
- const i = l.snapshot();
407
- i.length > 0 && h(W, { entries: i });
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 });
408
432
  },
409
433
  teardown: () => {
410
- P || (P = !0, d = null, D.teardown(), console.error = R, console.warn = v, console.log = y, console.info = b, window.removeEventListener("error", A, !0), window.removeEventListener("unhandledrejection", T), k && (window.fetch = k), XMLHttpRequest.prototype.open = M, XMLHttpRequest.prototype.send = q);
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);
435
+ }
436
+ };
437
+ }
438
+ var Mt = 100, Pt = [
439
+ "hidden",
440
+ "class",
441
+ "style",
442
+ "type",
443
+ "disabled",
444
+ "aria-hidden"
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) {
447
+ return (e ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[’‘]/g, "'").replace(/\s+/g, " ").trim().toLowerCase();
448
+ }
449
+ function ne(e) {
450
+ let t = e;
451
+ for (; t; ) {
452
+ if (t.hasAttribute("hidden") || t.getAttribute("aria-hidden") === "true" || t instanceof HTMLInputElement && t.type === "hidden") return !1;
453
+ const n = t.ownerDocument.defaultView?.getComputedStyle(t);
454
+ if (n && (n.display === "none" || n.visibility === "hidden")) return !1;
455
+ t = t.parentElement;
456
+ }
457
+ return !0;
458
+ }
459
+ function V(e, t) {
460
+ return Array.from(e.querySelectorAll(t)).filter(ne);
461
+ }
462
+ function Bt(e) {
463
+ return e ? e instanceof HTMLInputElement ? e.value : e.textContent ?? "" : "";
464
+ }
465
+ function Be(e, t) {
466
+ return !e.outsideForms || !t.closest("form");
467
+ }
468
+ function K(e, t) {
469
+ return Array.from(e.scope.querySelectorAll(t)).filter((n) => ne(n) && Be(e, n));
470
+ }
471
+ function Q(e) {
472
+ return W(e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent);
473
+ }
474
+ function $t(e) {
475
+ const t = Q(e);
476
+ return Dt.test(t) || Ft.test(t);
477
+ }
478
+ function Gt(e, t) {
479
+ if (e.getAttribute("type") === "submit" || !t) return !1;
480
+ const n = e.parentElement;
481
+ return !n || V(n, te).length === 0 ? !1 : !n.contains(t);
482
+ }
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);
486
+ }
487
+ function Vt(e, t) {
488
+ let n = e.parentElement;
489
+ for (; n && !n.contains(t); ) {
490
+ if (Ht(n)) return !0;
491
+ n = n.parentElement;
492
+ }
493
+ return !1;
494
+ }
495
+ function jt(e) {
496
+ const t = [
497
+ e.getAttribute("name"),
498
+ e.getAttribute("id"),
499
+ e.getAttribute("placeholder"),
500
+ e.getAttribute("aria-label"),
501
+ e.closest("label")?.textContent ?? null
502
+ ], n = e.getAttribute("id");
503
+ if (n) {
504
+ const r = e.ownerDocument.querySelector(`label[for="${CSS.escape(n)}"]`);
505
+ r && t.push(r.textContent);
506
+ }
507
+ return W(t.filter(Boolean).join(" "));
508
+ }
509
+ function zt(e, t) {
510
+ const n = e.parentElement;
511
+ if (!n) return null;
512
+ const r = e.ownerDocument.body, s = (a) => t ? $e({
513
+ scope: a,
514
+ outsideForms: !0
515
+ }, t) : e, o = (a) => fe({
516
+ scope: a,
517
+ outsideForms: !0
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);
523
+ };
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);
532
+ }
533
+ return {
534
+ scope: l(u) ? u : i ?? n,
535
+ outsideForms: !0
536
+ };
537
+ }
538
+ function Re(e, t, n) {
539
+ return e ? {
540
+ scope: e,
541
+ outsideForms: !1
542
+ } : zt(t, n);
543
+ }
544
+ function Wt(e, t) {
545
+ let n = e.parentElement;
546
+ for (; n && n !== t.scope; ) {
547
+ if (V(n, te).length === 1) return !0;
548
+ n = n.parentElement;
549
+ }
550
+ return !1;
551
+ }
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);
557
+ return [
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
563
+ ];
564
+ };
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);
572
+ return;
573
+ }
574
+ }
575
+ }), l;
576
+ }
577
+ function Le(e) {
578
+ return e.querySelectorAll("form").length + (V(e, te).some((t) => !t.closest("form")) ? 1 : 0) === 1;
579
+ }
580
+ function Xt(e, t) {
581
+ if (e) {
582
+ const n = e.getAttribute("aria-label");
583
+ if (n) return n;
584
+ const r = e.getAttribute("aria-labelledby");
585
+ if (r) {
586
+ const u = e.ownerDocument.getElementById(r);
587
+ if (u) return u.textContent ?? "";
411
588
  }
589
+ const s = e.querySelector("h1, h2, h3, legend");
590
+ if (s) return s.textContent ?? "";
591
+ let o = e.previousElementSibling;
592
+ for (; o; ) {
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 ?? "" : "";
597
+ }
598
+ o = o.previousElementSibling;
599
+ }
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 ?? "" : "";
605
+ }
606
+ return "";
607
+ }
608
+ return (t instanceof Document ? t.body : t)?.querySelector("h1, h2, h3")?.textContent ?? "";
609
+ }
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([
612
+ e?.id,
613
+ e?.getAttribute("name"),
614
+ e?.className,
615
+ o
616
+ ].filter(Boolean).join(" "));
617
+ return {
618
+ positive: J.test(r) || J.test(s),
619
+ negative: ue.test(r) || ue.test(s) || xt.test(l)
620
+ };
621
+ }
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];
624
+ if (n) return n;
625
+ if (!t) return null;
626
+ const r = K(e, 'input[type="text"], input:not([type])').filter((s) => s.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
627
+ return r[r.length - 1] ?? null;
628
+ }
629
+ function ae(e, t) {
630
+ if (t.querySelector('input[autocomplete="new-password"]')) return null;
631
+ const n = V(t, ee);
632
+ if (n.length > 1) return null;
633
+ if (n.length === 1) {
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 : {
638
+ kind: "password",
639
+ form: e,
640
+ identifier: a,
641
+ password: i,
642
+ submit: d
643
+ };
644
+ }
645
+ const r = V(t, Fe);
646
+ if (r.length !== 1) return null;
647
+ const s = r[0], o = Re(e, s, null);
648
+ if (!o) return null;
649
+ const l = fe(o, s, s), u = _e(e, t, l);
650
+ return !(s.autocomplete === "username" || u.positive) || u.negative ? null : {
651
+ kind: "identifier",
652
+ form: e,
653
+ identifier: s,
654
+ password: null,
655
+ submit: l
656
+ };
657
+ }
658
+ function ke(e = document) {
659
+ const t = Array.from(e.querySelectorAll("form"));
660
+ for (const n of t) {
661
+ const r = ae(n, n);
662
+ if (r) return r;
663
+ }
664
+ return t.length === 0 || V(e, ee).find((n) => !n.closest("form")) ? ae(null, e) : null;
665
+ }
666
+ function Ae(e, t) {
667
+ const n = Object.getPrototypeOf(e), r = Object.getOwnPropertyDescriptor(n, "value")?.set ?? Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
668
+ r ? r.call(e, t) : e.value = t, e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
669
+ }
670
+ function Kt(e) {
671
+ return !!e.form || !!e.submit;
672
+ }
673
+ function Yt(e) {
674
+ const t = e.form, n = t?.noValidate;
675
+ t && (t.noValidate = !0);
676
+ try {
677
+ return t && typeof t.requestSubmit == "function" ? (t.requestSubmit(), !0) : e.submit ? (e.submit.click(), !0) : t ? (t.submit(), !0) : !1;
678
+ } finally {
679
+ t && (t.noValidate = n ?? !1);
680
+ }
681
+ }
682
+ var Zt = {
683
+ identifier: null,
684
+ password: null
685
+ };
686
+ function Oe(e, t) {
687
+ return !e || e.disabled || e.readOnly ? !1 : e.value === "" || t !== null && e.value === t;
688
+ }
689
+ function Ge(e, t, n) {
690
+ return {
691
+ identifier: Oe(e.identifier, n.identifier) && !t.identifier,
692
+ password: Oe(e.password, n.password) && !t.password
412
693
  };
413
694
  }
414
- var Ae = 6e5, Ce = 1e3, Ne = {
695
+ function Jt(e, t, n) {
696
+ const r = e.identifier;
697
+ return !r || n.identifier ? !1 : r.value !== "" && r.value !== t.login;
698
+ }
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" };
702
+ }
703
+ function en(e) {
704
+ if (typeof window > "u" || typeof MutationObserver > "u") return {
705
+ watch() {
706
+ },
707
+ fill() {
708
+ },
709
+ cancel() {
710
+ },
711
+ teardown() {
712
+ }
713
+ };
714
+ let t = null, n = {
715
+ identifier: !1,
716
+ password: !1
717
+ }, r = {
718
+ identifier: null,
719
+ password: null
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 = {
729
+ identifier: null,
730
+ password: null
731
+ }, i();
732
+ return;
733
+ }
734
+ if (!t)
735
+ s || (s = !0, e.onDetected());
736
+ else {
737
+ const b = Ge(g, n, r), S = Qt(g, t, n, r);
738
+ if ("error" in S || (b.identifier && (n = {
739
+ ...n,
740
+ identifier: !0
741
+ }, r = {
742
+ ...r,
743
+ identifier: t.login
744
+ }), b.password && (n = {
745
+ ...n,
746
+ password: !0
747
+ }, r = {
748
+ ...r,
749
+ password: t.password
750
+ })), "error" in S) {
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());
753
+ } else
754
+ e.onFilled(S.step), n.password && (t = null, i(), u = setTimeout(() => {
755
+ u = null, ke(document) && (s = !0, e.onDetected());
756
+ }, tt));
757
+ }
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, {
764
+ childList: !0,
765
+ subtree: !0,
766
+ attributes: !0,
767
+ attributeFilter: Pt
768
+ }));
769
+ };
770
+ return {
771
+ watch() {
772
+ o || (s = !1, y()), a();
773
+ },
774
+ fill(g) {
775
+ t = g, y(), a();
776
+ },
777
+ cancel() {
778
+ t = null, n = {
779
+ identifier: !1,
780
+ password: !1
781
+ }, s = !1, c();
782
+ },
783
+ teardown() {
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());
820
+ }
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
+ }
887
+ }
888
+ var Ce = {
415
889
  maskAllInputs: !0,
416
890
  maskInputOptions: {
417
891
  password: !0,
@@ -419,37 +893,214 @@ var Ae = 6e5, Ce = 1e3, Ne = {
419
893
  tel: !0,
420
894
  text: !0
421
895
  },
422
- blockClass: "leesto-mask",
423
- blockSelector: "[data-leesto-block]",
424
- maskTextClass: "leesto-mask-text",
425
- maskTextSelector: "[data-private]"
896
+ blockClass: an,
897
+ maskTextClass: Ue
426
898
  };
427
- async function Ie(e) {
428
- const { record: t, addCustomEvent: r } = await import("./chunks/rrweb-qwppqH_c.js"), a = Date.now();
429
- let l = [], s = !1, u = 0;
430
- const d = () => {
431
- if (l.length === 0) return;
432
- const y = l;
433
- l = [], e.onBatch(y);
434
- }, h = t({
435
- emit(y) {
436
- l.push(y);
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)));
437
999
  },
438
- ...Ne
439
- }), m = e.diagnostics ?? null, w = h ? m ?? Z({ captureNetwork: e.captureNetwork !== !1 }) : null, _ = w !== null && m === null;
440
- w?.setSink((y, b) => {
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) => {
441
1003
  try {
442
- r(y, b);
1004
+ n(R, L);
443
1005
  } catch {
444
1006
  }
445
1007
  });
446
- const E = setInterval(d, Ce), R = { timer: null }, v = () => (s || (s = !0, clearInterval(E), clearTimeout(R.timer ?? void 0), w?.flushRings(), w?.setSink(null), _ && w?.teardown(), h?.(), d(), u = Date.now() - a), u);
447
- return R.timer = setTimeout(() => {
448
- v(), e.onCap();
449
- }, Ae), { stop: v };
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 };
450
1012
  }
451
- var Te = ["https://lab.leesto.app", "https://lab-dev.leesto.app"], Me = ["http://localhost:3505", "http://127.0.0.1:3505"];
452
- function qe(e) {
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
+ };
1101
+ }
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) {
453
1104
  try {
454
1105
  const t = new URL(e).hostname;
455
1106
  return t === "localhost" || t.endsWith(".localhost") || t === "127.0.0.1" || t === "[::1]";
@@ -457,43 +1108,43 @@ function qe(e) {
457
1108
  return !1;
458
1109
  }
459
1110
  }
460
- function $e(e) {
1111
+ function kn(e) {
461
1112
  const t = e.trim();
462
1113
  if (!t) return null;
463
1114
  try {
464
- const { origin: r } = new URL(t);
465
- return r === "null" ? null : r;
1115
+ const { origin: n } = new URL(t);
1116
+ return n === "null" ? null : n;
466
1117
  } catch {
467
1118
  return null;
468
1119
  }
469
1120
  }
470
- function Pe(e) {
471
- const t = (e.explicit ?? []).map($e).filter((a) => a !== null);
1121
+ function An(e) {
1122
+ const t = (e.explicit ?? []).map(kn).filter((r) => r !== null);
472
1123
  if (t.length > 0) return [...new Set(t)];
473
- const r = [...Te];
474
- return qe(e.pageOrigin) && r.push(...Me), [...new Set(r)];
1124
+ const n = [...Rn];
1125
+ return _n(e.pageOrigin) && n.push(...Ln), [...new Set(n)];
475
1126
  }
476
- function K(e, t) {
1127
+ function le(e, t) {
477
1128
  return !e || e === "*" || e === "null" ? !1 : t.includes(e);
478
1129
  }
479
- function z() {
1130
+ function Y() {
480
1131
  return typeof navigator < "u" && navigator.globalPrivacyControl === !0;
481
1132
  }
482
- function De(e) {
483
- const t = (u) => {
484
- const d = typeof u == "string" ? u.trim() : "";
485
- return d.length > 0 ? d : void 0;
486
- }, r = (u) => {
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) => {
487
1138
  if (!(typeof document > "u"))
488
- return t(document.querySelector(`meta[name="${u}"]`)?.getAttribute("content"));
489
- }, a = typeof window < "u" ? window.__LEESTO_APP_BUILD__ : void 0, l = t(e?.version) ?? t(a?.version) ?? r("app-version"), s = t(e?.environment) ?? t(a?.environment) ?? r("app-environment");
490
- if (!(!l && !s))
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))
491
1142
  return {
492
- ...l ? { version: l } : {},
493
- ...s ? { environment: s } : {}
1143
+ ...s ? { version: s } : {},
1144
+ ...o ? { environment: o } : {}
494
1145
  };
495
1146
  }
496
- function He() {
1147
+ function Tn() {
497
1148
  if (typeof document > "u") return;
498
1149
  const e = document.querySelector('link[rel~="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]');
499
1150
  if (e?.href)
@@ -503,232 +1154,362 @@ function He() {
503
1154
  return;
504
1155
  }
505
1156
  }
506
- function Ue() {
507
- const e = (a) => !!a && a !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(a), t = getComputedStyle(document.body).backgroundColor;
1157
+ function Cn() {
1158
+ const e = (r) => !!r && r !== "transparent" && !/^rgba\(\s*0,\s*0,\s*0,\s*0\s*\)$/.test(r), t = getComputedStyle(document.body).backgroundColor;
508
1159
  if (e(t)) return t;
509
- const r = getComputedStyle(document.documentElement).backgroundColor;
510
- return e(r) ? r : "#ffffff";
1160
+ const n = getComputedStyle(document.documentElement).backgroundColor;
1161
+ return e(n) ? n : "#ffffff";
511
1162
  }
512
- async function xe() {
513
- const { domToPng: e } = await import("./chunks/dist-BTlWkbvW.js"), t = document.documentElement, r = window.scrollX, a = window.scrollY, l = [];
514
- for (const s of t.querySelectorAll("*")) {
515
- const u = getComputedStyle(s).position;
1163
+ async function Ne(e) {
1164
+ const { domToPng: t } = await import("./chunks/dist-BTlWkbvW.js");
1165
+ if (e) {
1166
+ const l = document.querySelector(e);
1167
+ if (!l) throw new Error("element_not_found");
1168
+ return t(l, { quality: 0.92 });
1169
+ }
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;
516
1173
  if (u === "fixed" || u === "sticky") {
517
- const d = s.style.transform;
518
- l.push([s, d]), s.style.transform = `translate(${r}px, ${a}px)${d ? ` ${d}` : ""}`;
1174
+ const i = l.style.transform;
1175
+ o.push([l, i]), l.style.transform = `translate(${r}px, ${s}px)${i ? ` ${i}` : ""}`;
519
1176
  }
520
1177
  }
521
1178
  try {
522
- return await e(t, {
1179
+ return await t(n, {
523
1180
  quality: 0.92,
524
- backgroundColor: Ue(),
525
- width: t.clientWidth,
526
- height: t.clientHeight,
1181
+ backgroundColor: Cn(),
1182
+ width: n.clientWidth,
1183
+ height: n.clientHeight,
527
1184
  style: {
528
- transform: `translate(${-r}px, ${-a}px)`,
1185
+ transform: `translate(${-r}px, ${-s}px)`,
529
1186
  transformOrigin: "top left"
530
1187
  }
531
1188
  });
532
1189
  } finally {
533
- for (const [s, u] of l) s.style.transform = u;
1190
+ for (const [l, u] of o) l.style.transform = u;
534
1191
  }
535
1192
  }
536
- function Ge(e) {
1193
+ function In(e) {
537
1194
  if (e.id) return `#${CSS.escape(e.id)}`;
538
1195
  const t = [];
539
- let r = e;
540
- for (; r && r.nodeType === 1 && r !== document.body && t.length < 4; ) {
541
- if (r.id) {
542
- t.unshift(`#${CSS.escape(r.id)}`);
1196
+ let n = e;
1197
+ for (; n && n.nodeType === 1 && n !== document.body && t.length < 4; ) {
1198
+ if (n.id) {
1199
+ t.unshift(`#${CSS.escape(n.id)}`);
543
1200
  break;
544
1201
  }
545
- let a = r.tagName.toLowerCase();
546
- const l = typeof r.className == "string" ? r.className.trim().split(/\s+/).filter(Boolean)[0] : null;
547
- l && (a += `.${CSS.escape(l)}`);
548
- const s = r.parentElement;
549
- if (s) {
550
- const u = Array.from(s.children).filter((d) => d.tagName === r?.tagName);
551
- u.length > 1 && (a += `:nth-of-type(${u.indexOf(r) + 1})`);
1202
+ let r = n.tagName.toLowerCase();
1203
+ const s = typeof n.className == "string" ? n.className.trim().split(/\s+/).filter(Boolean)[0] : null;
1204
+ s && (r += `.${CSS.escape(s)}`);
1205
+ const o = n.parentElement;
1206
+ if (o) {
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})`);
552
1209
  }
553
- t.unshift(a), r = s;
1210
+ t.unshift(r), n = o;
554
1211
  }
555
1212
  return t.join(" > ");
556
1213
  }
557
- function Be(e) {
558
- const t = e.tagName.toLowerCase(), r = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
559
- return r ? `${t} · ${r}` : t;
1214
+ function Nn(e) {
1215
+ const t = e.tagName.toLowerCase(), n = (e.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 40);
1216
+ return n ? `${t} · ${n}` : t;
560
1217
  }
561
- function Y(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 = {}) {
562
1240
  if (typeof window > "u" || window.parent === window) return () => {
563
1241
  };
564
- const t = window.parent, r = e.highlightColor ?? te.light.primary, a = Pe({
1242
+ const t = window.parent, n = e.highlightColor ?? mt.light.primary, r = An({
565
1243
  explicit: e.shellOrigins,
566
1244
  pageOrigin: location.origin
567
1245
  });
568
- let l = null;
1246
+ let s = null;
569
1247
  try {
570
- const n = document.referrer ? new URL(document.referrer).origin : "";
571
- K(n, a) && (l = n);
1248
+ const h = document.referrer ? new URL(document.referrer).origin : "";
1249
+ le(h, r) && (s = h);
572
1250
  } catch {
573
1251
  }
574
- const s = (n) => {
575
- if (l) {
576
- t.postMessage(n, l);
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);
577
1259
  return;
578
1260
  }
579
- for (const i of a) t.postMessage(n, i);
1261
+ for (const v of r) t.postMessage(h, v);
580
1262
  };
581
- let u = null, d = "";
582
- const h = () => {
583
- u && (u.style.outline = d), u = null;
1263
+ let l = null, u = "";
1264
+ const i = () => {
1265
+ l && (l.style.outline = u), l = null;
584
1266
  };
585
- let m = null;
586
- const w = () => {
587
- if (m) return;
588
- let n = null, i = "";
589
- const c = (f) => {
590
- n !== f && (n && (n.style.outline = i), n = f, f && (i = f.style.outline, f.style.outline = `2px dashed ${r}`, f.style.outlineOffset = "1px"));
591
- }, g = (f) => c(f.target instanceof HTMLElement ? f.target : null), L = (f) => {
592
- f.preventDefault(), f.stopPropagation();
593
- const C = f.target, H = C instanceof HTMLElement ? C : null;
594
- if (m?.(), H) {
595
- const U = H.getBoundingClientRect();
596
- s({
597
- type: "leesto:element-picked",
598
- selector: Ge(H),
599
- label: Be(H),
600
- rect: {
601
- x: U.x,
602
- y: U.y,
603
- width: U.width,
604
- height: U.height
605
- }
606
- });
607
- }
608
- }, p = (f) => {
609
- f.key === "Escape" && (m?.(), s({ type: "leesto:pick-cancelled" }));
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, {
1272
+ position: "fixed",
1273
+ pointerEvents: "none",
1274
+ zIndex: "2147483647",
1275
+ boxSizing: "border-box",
1276
+ border: `2px solid ${n}`,
1277
+ borderRadius: "4px",
1278
+ display: "none"
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({
1286
+ type: "leesto:element-picked",
1287
+ selector: In(O),
1288
+ label: Nn(O),
1289
+ rect: {
1290
+ x: G.x,
1291
+ y: G.y,
1292
+ width: G.width,
1293
+ height: G.height
1294
+ }
1295
+ }) : Object.assign(h.style, {
1296
+ display: "block",
1297
+ left: `${G.x}px`,
1298
+ top: `${G.y}px`,
1299
+ width: `${G.width}px`,
1300
+ height: `${G.height}px`
1301
+ });
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" }));
610
1310
  };
611
- m = () => {
612
- n && (n.style.outline = i), n = null, document.removeEventListener("mousemove", g, !0), document.removeEventListener("click", L, !0), document.removeEventListener("keydown", p, !0), document.body.style.cursor = "", m = null;
613
- }, document.body.style.cursor = "crosshair", document.addEventListener("mousemove", g, !0), document.addEventListener("click", L, !0), document.addEventListener("keydown", p, !0);
614
- }, _ = ce(location.search) && !z(), E = _ ? ae(location.search) ?? ie() : void 0, R = _ ? Z({
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({
615
1315
  captureNetwork: e.captureNetwork !== !1,
616
- runId: E,
1316
+ runId: b,
617
1317
  runIdOrigins: e.runIdOrigins
618
1318
  }) : null;
619
- let v = null, y = !1, b = !1;
620
- const A = () => {
621
- if (v) {
622
- const n = v.stop();
623
- v = null, s({
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({
624
1329
  type: "leesto:rec-stopped",
625
- durationMs: n
1330
+ durationMs: h
626
1331
  });
627
- } else y && (b = !0);
628
- }, T = De(e.build);
629
- let k = location.href;
630
- const M = () => {
631
- k = location.href;
632
- const n = He();
633
- s({
1332
+ } else T && (q = !0);
1333
+ }, N = en({
1334
+ onDetected: () => o({ type: "leesto:login-form-detected" }),
1335
+ onFilled: (h) => o({
1336
+ type: "leesto:login-filled",
1337
+ step: h
1338
+ }),
1339
+ onError: (h) => o({
1340
+ type: "leesto:login-error",
1341
+ reason: h
1342
+ })
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();
1352
+ o({
634
1353
  type: "leesto:ready",
635
1354
  url: location.href,
636
1355
  bridgeVersion: 1,
637
- ...n ? { favicon: n } : {},
638
- ...T ? { build: T } : {},
639
- ...E ? { diagnosticRunId: E } : {},
640
- ...z() ? { 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 } : {}
641
1367
  });
642
- }, q = (n) => {
643
- if (n.source !== t || !K(n.origin, a) || !ne(n.data)) return;
644
- l || (l = n.origin);
645
- const i = n.data;
646
- if (i.type === "leesto:ping")
647
- s({ type: "leesto:pong" }), M();
648
- else if (i.type === "leesto:highlight") {
649
- if (h(), i.selector) {
650
- let c = null;
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(() => {
1378
+ }).finally(() => {
1379
+ f = !1, R || A();
1380
+ });
1381
+ } else if (v.type === "leesto:highlight") {
1382
+ if (i(), v.selector) {
1383
+ let w = null;
651
1384
  try {
652
- c = document.querySelector(i.selector);
1385
+ w = document.querySelector(v.selector);
653
1386
  } catch {
654
- c = null;
1387
+ w = null;
655
1388
  }
656
- c && (u = c, d = c.style.outline, c.style.outline = `2px solid ${r}`, c.style.outlineOffset = "2px", c.scrollIntoView({
1389
+ w && (l = w, u = w.style.outline, w.style.outline = `2px solid ${n}`, w.style.outlineOffset = "2px", w.scrollIntoView({
657
1390
  block: "center",
658
1391
  behavior: "smooth"
659
1392
  }));
660
1393
  }
661
- } else if (i.type === "leesto:pick-start") w();
662
- else if (i.type === "leesto:pick-stop") m?.();
663
- else if (i.type === "leesto:capture-request") (e.capture ?? xe)().then((c) => s({
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({
664
1397
  type: "leesto:screenshot",
665
- dataUrl: c
666
- })).catch((c) => s({
1398
+ dataUrl: w,
1399
+ ...v.selector ? { selector: v.selector } : {}
1400
+ })).catch((w) => o({
667
1401
  type: "leesto:capture-failed",
668
- reason: c instanceof Error ? c.message : "capture_error"
1402
+ reason: w instanceof Error ? w.message : "capture_error"
669
1403
  }));
670
- else if (i.type === "leesto:rec-start") {
671
- if (v || y) return;
672
- if (z()) {
673
- s({
1404
+ else if (v.type === "leesto:rec-start") {
1405
+ if (C || T) return;
1406
+ if (Y()) {
1407
+ o({
674
1408
  type: "leesto:rec-blocked",
675
1409
  reason: "gpc"
676
1410
  });
677
1411
  return;
678
1412
  }
679
- y = !0, b = !1, Ie({
680
- onBatch: (c) => s({
681
- type: "leesto:rec-batch",
682
- events: c
683
- }),
684
- onCap: () => A(),
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,
685
1420
  captureNetwork: e.captureNetwork,
686
- diagnostics: R
687
- }).then((c) => {
688
- y = !1, v = c, b && A();
689
- }).catch((c) => {
690
- y = !1, s({
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({
691
1431
  type: "leesto:rec-error",
692
- reason: c instanceof Error ? c.message : "rec_error"
1432
+ reason: I instanceof Error ? I.message : "rec_error"
1433
+ });
1434
+ });
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
693
1462
  });
694
1463
  });
695
- } else i.type === "leesto:rec-stop" ? A() : i.type === "leesto:diagnostics-request" && s({
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({
696
1465
  type: "leesto:diagnostics",
697
- snapshot: R?.snapshot() ?? {
1466
+ snapshot: S?.snapshot() ?? {
698
1467
  errors: [],
699
1468
  logs: [],
700
1469
  network: []
701
1470
  }
702
- });
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();
703
1475
  };
704
- window.addEventListener("message", q), M();
705
- const S = () => {
706
- location.href !== k && (k = location.href, s({
707
- type: "leesto:location",
708
- url: location.href
709
- }));
710
- }, D = history.pushState, $ = history.replaceState, P = (...n) => {
711
- D.apply(history, n), S();
712
- }, o = (...n) => {
713
- $.apply(history, n), S();
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");
714
1495
  };
715
- return history.pushState = P, history.replaceState = o, window.addEventListener("popstate", S), window.addEventListener("hashchange", S), () => {
716
- A(), R?.teardown(), h(), m?.(), window.removeEventListener("message", q), window.removeEventListener("popstate", S), window.removeEventListener("hashchange", S), history.pushState === P && (history.pushState = D), history.replaceState === o && (history.replaceState = $);
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);
717
1498
  };
718
1499
  }
719
- function je() {
1500
+ function Dn() {
720
1501
  return typeof document > "u" ? null : document.currentScript ?? document.querySelector("script[data-leesto-connect]");
721
1502
  }
722
- function Xe(e) {
723
- const t = {}, r = e?.dataset.highlightColor;
724
- r && (t.highlightColor = r);
725
- const a = (e?.dataset.shellOrigin ?? "").split(",").map((l) => l.trim()).filter(Boolean);
726
- return a.length > 0 && (t.shellOrigins = a), t;
1503
+ function qn(e) {
1504
+ const t = {}, n = e?.dataset.highlightColor;
1505
+ n && (t.highlightColor = n);
1506
+ const r = (e?.dataset.shellOrigin ?? "").split(",").map((s) => s.trim()).filter(Boolean);
1507
+ return r.length > 0 && (t.shellOrigins = r), t;
727
1508
  }
728
1509
  if (typeof window < "u") {
729
- window.LeestoConnect = { connect: (t) => Y(t) };
730
- const e = je();
731
- (!e || e.dataset.leestoManual === void 0) && Y(Xe(e));
1510
+ window.LeestoConnect = { connect: (t) => Me(t) };
1511
+ const e = Dn();
1512
+ (!e || e.dataset.leestoManual === void 0) && Me(qn(e));
732
1513
  }
733
1514
 
734
1515
  //# sourceMappingURL=leesto-connect.js.map