@pixelmatters/markup 1.9.0 → 1.11.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.
package/dist/widget.js CHANGED
@@ -302,26 +302,33 @@ function _e(e, t, n) {
302
302
  context: n?.context
303
303
  });
304
304
  }
305
+ var ve = null;
306
+ function ye(e) {
307
+ ve = e;
308
+ }
309
+ function F(e, t) {
310
+ ve && _e(ve, e, t);
311
+ }
305
312
  //#endregion
306
313
  //#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/hooks/dist/hooks.module.js
307
- var ve, F, ye, be, xe = 0, Se = [], I = t, L = I.__b, Ce = I.__r, we = I.diffed, Te = I.__c, Ee = I.unmount, De = I.__;
308
- function Oe(e, t) {
309
- I.__h && I.__h(F, e, xe || t), xe = 0;
310
- var n = F.__H ||= {
314
+ var be, I, xe, Se, L = 0, Ce = [], R = t, we = R.__b, Te = R.__r, Ee = R.diffed, De = R.__c, Oe = R.unmount, ke = R.__;
315
+ function Ae(e, t) {
316
+ R.__h && R.__h(I, e, L || t), L = 0;
317
+ var n = I.__H ||= {
311
318
  __: [],
312
319
  __h: []
313
320
  };
314
321
  return e >= n.__.length && n.__.push({}), n.__[e];
315
322
  }
316
- function R(e) {
317
- return xe = 1, ke(Le, e);
323
+ function z(e) {
324
+ return L = 1, je(ze, e);
318
325
  }
319
- function ke(e, t, n) {
320
- var r = Oe(ve++, 2);
321
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Le(void 0, t), function(e) {
326
+ function je(e, t, n) {
327
+ var r = Ae(be++, 2);
328
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ze(void 0, t), function(e) {
322
329
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
323
330
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
324
- }], r.__c = F, !F.__f)) {
331
+ }], r.__c = I, !I.__f)) {
325
332
  var i = function(e, t, n) {
326
333
  if (!r.__c.__H) return !0;
327
334
  var i = r.__c.__H.__.filter(function(e) {
@@ -338,111 +345,111 @@ function ke(e, t, n) {
338
345
  }
339
346
  }), a && a.call(this, e, t, n) || o;
340
347
  };
341
- F.__f = !0;
342
- var a = F.shouldComponentUpdate, o = F.componentWillUpdate;
343
- F.componentWillUpdate = function(e, t, n) {
348
+ I.__f = !0;
349
+ var a = I.shouldComponentUpdate, o = I.componentWillUpdate;
350
+ I.componentWillUpdate = function(e, t, n) {
344
351
  if (this.__e) {
345
352
  var r = a;
346
353
  a = void 0, i(e, t, n), a = r;
347
354
  }
348
355
  o && o.call(this, e, t, n);
349
- }, F.shouldComponentUpdate = i;
356
+ }, I.shouldComponentUpdate = i;
350
357
  }
351
358
  return r.__N || r.__;
352
359
  }
353
- function z(e, t) {
354
- var n = Oe(ve++, 3);
355
- !I.__s && Ie(n.__H, t) && (n.__ = e, n.u = t, F.__H.__h.push(n));
360
+ function B(e, t) {
361
+ var n = Ae(be++, 3);
362
+ !R.__s && Re(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
356
363
  }
357
- function B(e) {
358
- return xe = 5, Ae(function() {
364
+ function V(e) {
365
+ return L = 5, Me(function() {
359
366
  return { current: e };
360
367
  }, []);
361
368
  }
362
- function Ae(e, t) {
363
- var n = Oe(ve++, 7);
364
- return Ie(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
369
+ function Me(e, t) {
370
+ var n = Ae(be++, 7);
371
+ return Re(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
365
372
  }
366
- function V(e, t) {
367
- return xe = 8, Ae(function() {
373
+ function H(e, t) {
374
+ return L = 8, Me(function() {
368
375
  return e;
369
376
  }, t);
370
377
  }
371
- function je() {
372
- for (var e; e = Se.shift();) {
378
+ function Ne() {
379
+ for (var e; e = Ce.shift();) {
373
380
  var t = e.__H;
374
381
  if (e.__P && t) try {
375
- t.__h.some(Pe), t.__h.some(Fe), t.__h = [];
382
+ t.__h.some(Ie), t.__h.some(Le), t.__h = [];
376
383
  } catch (n) {
377
- t.__h = [], I.__e(n, e.__v);
384
+ t.__h = [], R.__e(n, e.__v);
378
385
  }
379
386
  }
380
387
  }
381
- I.__b = function(e) {
382
- F = null, L && L(e);
383
- }, I.__ = function(e, t) {
384
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), De && De(e, t);
385
- }, I.__r = function(e) {
386
- Ce && Ce(e), ve = 0;
387
- var t = (F = e.__c).__H;
388
- t && (ye === F ? (t.__h = [], F.__h = [], t.__.some(function(e) {
388
+ R.__b = function(e) {
389
+ I = null, we && we(e);
390
+ }, R.__ = function(e, t) {
391
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ke && ke(e, t);
392
+ }, R.__r = function(e) {
393
+ Te && Te(e), be = 0;
394
+ var t = (I = e.__c).__H;
395
+ t && (xe === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
389
396
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
390
- })) : (t.__h.some(Pe), t.__h.some(Fe), t.__h = [], ve = 0)), ye = F;
391
- }, I.diffed = function(e) {
392
- we && we(e);
397
+ })) : (t.__h.some(Ie), t.__h.some(Le), t.__h = [], be = 0)), xe = I;
398
+ }, R.diffed = function(e) {
399
+ Ee && Ee(e);
393
400
  var t = e.__c;
394
- t && t.__H && (t.__H.__h.length && (Se.push(t) !== 1 && be === I.requestAnimationFrame || ((be = I.requestAnimationFrame) || Ne)(je)), t.__H.__.some(function(e) {
401
+ t && t.__H && (t.__H.__h.length && (Ce.push(t) !== 1 && Se === R.requestAnimationFrame || ((Se = R.requestAnimationFrame) || Fe)(Ne)), t.__H.__.some(function(e) {
395
402
  e.u && (e.__H = e.u), e.u = void 0;
396
- })), ye = F = null;
397
- }, I.__c = function(e, t) {
403
+ })), xe = I = null;
404
+ }, R.__c = function(e, t) {
398
405
  t.some(function(e) {
399
406
  try {
400
- e.__h.some(Pe), e.__h = e.__h.filter(function(e) {
401
- return !e.__ || Fe(e);
407
+ e.__h.some(Ie), e.__h = e.__h.filter(function(e) {
408
+ return !e.__ || Le(e);
402
409
  });
403
410
  } catch (n) {
404
411
  t.some(function(e) {
405
412
  e.__h &&= [];
406
- }), t = [], I.__e(n, e.__v);
413
+ }), t = [], R.__e(n, e.__v);
407
414
  }
408
- }), Te && Te(e, t);
409
- }, I.unmount = function(e) {
410
- Ee && Ee(e);
415
+ }), De && De(e, t);
416
+ }, R.unmount = function(e) {
417
+ Oe && Oe(e);
411
418
  var t, n = e.__c;
412
419
  n && n.__H && (n.__H.__.some(function(e) {
413
420
  try {
414
- Pe(e);
421
+ Ie(e);
415
422
  } catch (e) {
416
423
  t = e;
417
424
  }
418
- }), n.__H = void 0, t && I.__e(t, n.__v));
425
+ }), n.__H = void 0, t && R.__e(t, n.__v));
419
426
  };
420
- var Me = typeof requestAnimationFrame == "function";
421
- function Ne(e) {
427
+ var Pe = typeof requestAnimationFrame == "function";
428
+ function Fe(e) {
422
429
  var t, n = function() {
423
- clearTimeout(r), Me && cancelAnimationFrame(t), setTimeout(e);
430
+ clearTimeout(r), Pe && cancelAnimationFrame(t), setTimeout(e);
424
431
  }, r = setTimeout(n, 35);
425
- Me && (t = requestAnimationFrame(n));
432
+ Pe && (t = requestAnimationFrame(n));
426
433
  }
427
- function Pe(e) {
428
- var t = F, n = e.__c;
429
- typeof n == "function" && (e.__c = void 0, n()), F = t;
434
+ function Ie(e) {
435
+ var t = I, n = e.__c;
436
+ typeof n == "function" && (e.__c = void 0, n()), I = t;
430
437
  }
431
- function Fe(e) {
432
- var t = F;
433
- e.__c = e.__(), F = t;
438
+ function Le(e) {
439
+ var t = I;
440
+ e.__c = e.__(), I = t;
434
441
  }
435
- function Ie(e, t) {
442
+ function Re(e, t) {
436
443
  return !e || e.length !== t.length || t.some(function(t, n) {
437
444
  return t !== e[n];
438
445
  });
439
446
  }
440
- function Le(e, t) {
447
+ function ze(e, t) {
441
448
  return typeof t == "function" ? t(e) : t;
442
449
  }
443
- for (var Re = "1.38.0", H = [], U = [], ze = Uint8Array, Be = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ve = 0, He = Be.length; Ve < He; ++Ve) H[Ve] = Be[Ve], U[Be.charCodeAt(Ve)] = Ve;
444
- U[45] = 62, U[95] = 63;
445
- function Ue(e) {
450
+ for (var Be = "1.38.0", U = [], W = [], Ve = Uint8Array, He = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = 0, We = He.length; Ue < We; ++Ue) U[Ue] = He[Ue], W[He.charCodeAt(Ue)] = Ue;
451
+ W[45] = 62, W[95] = 63;
452
+ function Ge(e) {
446
453
  var t = e.length;
447
454
  if (t % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
448
455
  var n = e.indexOf("=");
@@ -450,33 +457,33 @@ function Ue(e) {
450
457
  var r = n === t ? 0 : 4 - n % 4;
451
458
  return [n, r];
452
459
  }
453
- function We(e, t, n) {
460
+ function Ke(e, t, n) {
454
461
  return (t + n) * 3 / 4 - n;
455
462
  }
456
- function Ge(e) {
457
- var t, n = Ue(e), r = n[0], i = n[1], a = new ze(We(e, r, i)), o = 0, s = i > 0 ? r - 4 : r, c;
458
- for (c = 0; c < s; c += 4) t = U[e.charCodeAt(c)] << 18 | U[e.charCodeAt(c + 1)] << 12 | U[e.charCodeAt(c + 2)] << 6 | U[e.charCodeAt(c + 3)], a[o++] = t >> 16 & 255, a[o++] = t >> 8 & 255, a[o++] = t & 255;
459
- return i === 2 && (t = U[e.charCodeAt(c)] << 2 | U[e.charCodeAt(c + 1)] >> 4, a[o++] = t & 255), i === 1 && (t = U[e.charCodeAt(c)] << 10 | U[e.charCodeAt(c + 1)] << 4 | U[e.charCodeAt(c + 2)] >> 2, a[o++] = t >> 8 & 255, a[o++] = t & 255), a;
463
+ function qe(e) {
464
+ var t, n = Ge(e), r = n[0], i = n[1], a = new Ve(Ke(e, r, i)), o = 0, s = i > 0 ? r - 4 : r, c;
465
+ for (c = 0; c < s; c += 4) t = W[e.charCodeAt(c)] << 18 | W[e.charCodeAt(c + 1)] << 12 | W[e.charCodeAt(c + 2)] << 6 | W[e.charCodeAt(c + 3)], a[o++] = t >> 16 & 255, a[o++] = t >> 8 & 255, a[o++] = t & 255;
466
+ return i === 2 && (t = W[e.charCodeAt(c)] << 2 | W[e.charCodeAt(c + 1)] >> 4, a[o++] = t & 255), i === 1 && (t = W[e.charCodeAt(c)] << 10 | W[e.charCodeAt(c + 1)] << 4 | W[e.charCodeAt(c + 2)] >> 2, a[o++] = t >> 8 & 255, a[o++] = t & 255), a;
460
467
  }
461
- function Ke(e) {
462
- return H[e >> 18 & 63] + H[e >> 12 & 63] + H[e >> 6 & 63] + H[e & 63];
468
+ function Je(e) {
469
+ return U[e >> 18 & 63] + U[e >> 12 & 63] + U[e >> 6 & 63] + U[e & 63];
463
470
  }
464
- function qe(e, t, n) {
465
- for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(Ke(r));
471
+ function Ye(e, t, n) {
472
+ for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(Je(r));
466
473
  return i.join("");
467
474
  }
468
- function Je(e) {
469
- for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(qe(e, o, o + a > s ? s : o + a));
470
- return r === 1 ? (t = e[n - 1], i.push(H[t >> 2] + H[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(H[t >> 10] + H[t >> 4 & 63] + H[t << 2 & 63] + "=")), i.join("");
475
+ function Xe(e) {
476
+ for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(Ye(e, o, o + a > s ? s : o + a));
477
+ return r === 1 ? (t = e[n - 1], i.push(U[t >> 2] + U[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(U[t >> 10] + U[t >> 4 & 63] + U[t << 2 & 63] + "=")), i.join("");
471
478
  }
472
479
  //#endregion
473
480
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/common/index.js
474
- function W(e) {
481
+ function Ze(e) {
475
482
  if (e === void 0) return {};
476
- if (!Xe(e)) throw Error(`The arguments to a Convex function must be an object. Received: ${e}`);
483
+ if (!$e(e)) throw Error(`The arguments to a Convex function must be an object. Received: ${e}`);
477
484
  return e;
478
485
  }
479
- function Ye(e) {
486
+ function Qe(e) {
480
487
  if (e === void 0) throw Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");
481
488
  if (typeof e != "string") throw Error(`Invalid deployment address: found ${e}".`);
482
489
  if (!(e.startsWith("http:") || e.startsWith("https:"))) throw Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);
@@ -487,146 +494,146 @@ function Ye(e) {
487
494
  }
488
495
  if (e.endsWith(".convex.site")) throw Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`);
489
496
  }
490
- function Xe(e) {
497
+ function $e(e) {
491
498
  let t = typeof e == "object", n = Object.getPrototypeOf(e), r = n === null || n === Object.prototype || n?.constructor?.name === "Object";
492
499
  return t && r;
493
500
  }
494
501
  //#endregion
495
502
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/values/value.js
496
- var Ze = !0, Qe = BigInt("-9223372036854775808"), $e = BigInt("9223372036854775807"), et = BigInt("0"), tt = BigInt("8"), nt = BigInt("256");
497
- function rt(e) {
503
+ var et = !0, tt = BigInt("-9223372036854775808"), nt = BigInt("9223372036854775807"), rt = BigInt("0"), it = BigInt("8"), at = BigInt("256");
504
+ function ot(e) {
498
505
  return Number.isNaN(e) || !Number.isFinite(e) || Object.is(e, -0);
499
506
  }
500
- function it(e) {
501
- e < et && (e -= Qe + Qe);
507
+ function st(e) {
508
+ e < rt && (e -= tt + tt);
502
509
  let t = e.toString(16);
503
510
  t.length % 2 == 1 && (t = "0" + t);
504
511
  let n = new Uint8Array(/* @__PURE__ */ new ArrayBuffer(8)), r = 0;
505
- for (let i of t.match(/.{2}/g).reverse()) n.set([parseInt(i, 16)], r++), e >>= tt;
506
- return Je(n);
512
+ for (let i of t.match(/.{2}/g).reverse()) n.set([parseInt(i, 16)], r++), e >>= it;
513
+ return Xe(n);
507
514
  }
508
- function at(e) {
509
- let t = Ge(e);
515
+ function ct(e) {
516
+ let t = qe(e);
510
517
  if (t.byteLength !== 8) throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);
511
- let n = et, r = et;
512
- for (let e of t) n += BigInt(e) * nt ** r, r++;
513
- return n > $e && (n += Qe + Qe), n;
518
+ let n = rt, r = rt;
519
+ for (let e of t) n += BigInt(e) * at ** r, r++;
520
+ return n > nt && (n += tt + tt), n;
514
521
  }
515
- function ot(e) {
516
- if (e < Qe || $e < e) throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);
522
+ function lt(e) {
523
+ if (e < tt || nt < e) throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);
517
524
  let t = /* @__PURE__ */ new ArrayBuffer(8);
518
- return new DataView(t).setBigInt64(0, e, !0), Je(new Uint8Array(t));
525
+ return new DataView(t).setBigInt64(0, e, !0), Xe(new Uint8Array(t));
519
526
  }
520
- function st(e) {
521
- let t = Ge(e);
527
+ function ut(e) {
528
+ let t = qe(e);
522
529
  if (t.byteLength !== 8) throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);
523
530
  return new DataView(t.buffer).getBigInt64(0, !0);
524
531
  }
525
- var ct = DataView.prototype.setBigInt64 ? ot : it, lt = DataView.prototype.getBigInt64 ? st : at, ut = 1024;
526
- function dt(e) {
527
- if (e.length > ut) throw Error(`Field name ${e} exceeds maximum field name length ${ut}.`);
532
+ var dt = DataView.prototype.setBigInt64 ? lt : st, ft = DataView.prototype.getBigInt64 ? ut : ct, pt = 1024;
533
+ function mt(e) {
534
+ if (e.length > pt) throw Error(`Field name ${e} exceeds maximum field name length ${pt}.`);
528
535
  if (e.startsWith("$")) throw Error(`Field name ${e} starts with a '$', which is reserved.`);
529
536
  for (let t = 0; t < e.length; t += 1) {
530
537
  let n = e.charCodeAt(t);
531
538
  if (n < 32 || n >= 127) throw Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`);
532
539
  }
533
540
  }
534
- function ft(e) {
541
+ function ht(e) {
535
542
  if (e === null || typeof e == "boolean" || typeof e == "number" || typeof e == "string") return e;
536
- if (Array.isArray(e)) return e.map((e) => ft(e));
543
+ if (Array.isArray(e)) return e.map((e) => ht(e));
537
544
  if (typeof e != "object") throw Error(`Unexpected type of ${e}`);
538
545
  let t = Object.entries(e);
539
546
  if (t.length === 1) {
540
547
  let n = t[0][0];
541
548
  if (n === "$bytes") {
542
549
  if (typeof e.$bytes != "string") throw Error(`Malformed $bytes field on ${e}`);
543
- return Ge(e.$bytes).buffer;
550
+ return qe(e.$bytes).buffer;
544
551
  }
545
552
  if (n === "$integer") {
546
553
  if (typeof e.$integer != "string") throw Error(`Malformed $integer field on ${e}`);
547
- return lt(e.$integer);
554
+ return ft(e.$integer);
548
555
  }
549
556
  if (n === "$float") {
550
557
  if (typeof e.$float != "string") throw Error(`Malformed $float field on ${e}`);
551
- let t = Ge(e.$float);
558
+ let t = qe(e.$float);
552
559
  if (t.byteLength !== 8) throw Error(`Received ${t.byteLength} bytes, expected 8 for $float`);
553
- let n = new DataView(t.buffer).getFloat64(0, Ze);
554
- if (!rt(n)) throw Error(`Float ${n} should be encoded as a number`);
560
+ let n = new DataView(t.buffer).getFloat64(0, et);
561
+ if (!ot(n)) throw Error(`Float ${n} should be encoded as a number`);
555
562
  return n;
556
563
  }
557
564
  if (n === "$set") throw Error("Received a Set which is no longer supported as a Convex type.");
558
565
  if (n === "$map") throw Error("Received a Map which is no longer supported as a Convex type.");
559
566
  }
560
567
  let n = {};
561
- for (let [t, r] of Object.entries(e)) dt(t), n[t] = ft(r);
568
+ for (let [t, r] of Object.entries(e)) mt(t), n[t] = ht(r);
562
569
  return n;
563
570
  }
564
- var pt = 16384;
565
- function mt(e) {
571
+ var gt = 16384;
572
+ function _t(e) {
566
573
  let t = JSON.stringify(e, (e, t) => t === void 0 ? "undefined" : typeof t == "bigint" ? `${t.toString()}n` : t);
567
- if (t.length > pt) {
568
- let e = pt - 14, n = t.codePointAt(e - 1);
574
+ if (t.length > gt) {
575
+ let e = gt - 14, n = t.codePointAt(e - 1);
569
576
  return n !== void 0 && n > 65535 && --e, t.substring(0, e) + "[...truncated]";
570
577
  }
571
578
  return t;
572
579
  }
573
- function ht(e, t, n, r) {
580
+ function vt(e, t, n, r) {
574
581
  if (e === void 0) {
575
- let e = n && ` (present at path ${n} in original object ${mt(t)})`;
582
+ let e = n && ` (present at path ${n} in original object ${_t(t)})`;
576
583
  throw Error(`undefined is not a valid Convex value${e}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`);
577
584
  }
578
585
  if (e === null) return e;
579
586
  if (typeof e == "bigint") {
580
- if (e < Qe || $e < e) throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);
581
- return { $integer: ct(e) };
587
+ if (e < tt || nt < e) throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);
588
+ return { $integer: dt(e) };
582
589
  }
583
- if (typeof e == "number") if (rt(e)) {
590
+ if (typeof e == "number") if (ot(e)) {
584
591
  let t = /* @__PURE__ */ new ArrayBuffer(8);
585
- return new DataView(t).setFloat64(0, e, Ze), { $float: Je(new Uint8Array(t)) };
592
+ return new DataView(t).setFloat64(0, e, et), { $float: Xe(new Uint8Array(t)) };
586
593
  } else return e;
587
594
  if (typeof e == "boolean" || typeof e == "string") return e;
588
- if (e instanceof ArrayBuffer) return { $bytes: Je(new Uint8Array(e)) };
589
- if (Array.isArray(e)) return e.map((e, r) => ht(e, t, n + `[${r}]`, !1));
590
- if (e instanceof Set) throw Error(gt(n, "Set", [...e], t));
591
- if (e instanceof Map) throw Error(gt(n, "Map", [...e], t));
592
- if (!Xe(e)) {
595
+ if (e instanceof ArrayBuffer) return { $bytes: Xe(new Uint8Array(e)) };
596
+ if (Array.isArray(e)) return e.map((e, r) => vt(e, t, n + `[${r}]`, !1));
597
+ if (e instanceof Set) throw Error(yt(n, "Set", [...e], t));
598
+ if (e instanceof Map) throw Error(yt(n, "Map", [...e], t));
599
+ if (!$e(e)) {
593
600
  let r = e?.constructor?.name, i = r ? `${r} ` : "";
594
- throw Error(gt(n, i, e, t));
601
+ throw Error(yt(n, i, e, t));
595
602
  }
596
603
  let i = {}, a = Object.entries(e);
597
604
  a.sort(([e, t], [n, r]) => e === n ? 0 : e < n ? -1 : 1);
598
- for (let [e, o] of a) o === void 0 ? r && (dt(e), i[e] = _t(o, t, n + `.${e}`)) : (dt(e), i[e] = ht(o, t, n + `.${e}`, !1));
605
+ for (let [e, o] of a) o === void 0 ? r && (mt(e), i[e] = bt(o, t, n + `.${e}`)) : (mt(e), i[e] = vt(o, t, n + `.${e}`, !1));
599
606
  return i;
600
607
  }
601
- function gt(e, t, n, r) {
602
- return e ? `${t}${mt(n)} is not a supported Convex type (present at path ${e} in original object ${mt(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.` : `${t}${mt(n)} is not a supported Convex type.`;
608
+ function yt(e, t, n, r) {
609
+ return e ? `${t}${_t(n)} is not a supported Convex type (present at path ${e} in original object ${_t(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.` : `${t}${_t(n)} is not a supported Convex type.`;
603
610
  }
604
- function _t(e, t, n) {
611
+ function bt(e, t, n) {
605
612
  if (e === void 0) return { $undefined: null };
606
- if (t === void 0) throw Error(`Programming error. Current value is ${mt(e)} but original value is undefined`);
607
- return ht(e, t, n, !1);
613
+ if (t === void 0) throw Error(`Programming error. Current value is ${_t(e)} but original value is undefined`);
614
+ return vt(e, t, n, !1);
608
615
  }
609
- function vt(e) {
610
- return ht(e, e, "", !1);
616
+ function xt(e) {
617
+ return vt(e, e, "", !1);
611
618
  }
612
619
  //#endregion
613
620
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/values/errors.js
614
- var yt = Object.defineProperty, bt = (e, t, n) => t in e ? yt(e, t, {
621
+ var St = Object.defineProperty, Ct = (e, t, n) => t in e ? St(e, t, {
615
622
  enumerable: !0,
616
623
  configurable: !0,
617
624
  writable: !0,
618
625
  value: n
619
- }) : e[t] = n, xt = (e, t, n) => bt(e, typeof t == "symbol" ? t : t + "", n), St, Ct, wt = Symbol.for("ConvexError"), Tt = class extends (Ct = Error, St = wt, Ct) {
626
+ }) : e[t] = n, wt = (e, t, n) => Ct(e, typeof t == "symbol" ? t : t + "", n), Tt, Et, Dt = Symbol.for("ConvexError"), Ot = class extends (Et = Error, Tt = Dt, Et) {
620
627
  constructor(e) {
621
- super(typeof e == "string" ? e : mt(e)), xt(this, "name", "ConvexError"), xt(this, "data"), xt(this, St, !0), this.data = e;
628
+ super(typeof e == "string" ? e : _t(e)), wt(this, "name", "ConvexError"), wt(this, "data"), wt(this, Tt, !0), this.data = e;
622
629
  }
623
- }, Et = Object.defineProperty, Dt = (e, t, n) => t in e ? Et(e, t, {
630
+ }, kt = Object.defineProperty, At = (e, t, n) => t in e ? kt(e, t, {
624
631
  enumerable: !0,
625
632
  configurable: !0,
626
633
  writable: !0,
627
634
  value: n
628
- }) : e[t] = n, Ot = (e, t, n) => Dt(e, typeof t == "symbol" ? t : t + "", n), kt = "color:rgb(0, 145, 255)";
629
- function At(e) {
635
+ }) : e[t] = n, jt = (e, t, n) => At(e, typeof t == "symbol" ? t : t + "", n), Mt = "color:rgb(0, 145, 255)";
636
+ function Nt(e) {
630
637
  switch (e) {
631
638
  case "query": return "Q";
632
639
  case "mutation": return "M";
@@ -634,9 +641,9 @@ function At(e) {
634
641
  case "any": return "?";
635
642
  }
636
643
  }
637
- var jt = class {
644
+ var Pt = class {
638
645
  constructor(e) {
639
- Ot(this, "_onLogLineFuncs"), Ot(this, "_verbose"), this._onLogLineFuncs = {}, this._verbose = e.verbose;
646
+ jt(this, "_onLogLineFuncs"), jt(this, "_verbose"), this._onLogLineFuncs = {}, this._verbose = e.verbose;
640
647
  }
641
648
  addLogLineListener(e) {
642
649
  let t = Math.random().toString(36).substring(2, 15);
@@ -658,8 +665,8 @@ var jt = class {
658
665
  for (let t of Object.values(this._onLogLineFuncs)) t("error", ...e);
659
666
  }
660
667
  };
661
- function Mt(e) {
662
- let t = new jt(e);
668
+ function Ft(e) {
669
+ let t = new Pt(e);
663
670
  return t.addLogLineListener((e, ...t) => {
664
671
  switch (e) {
665
672
  case "debug":
@@ -678,11 +685,11 @@ function Mt(e) {
678
685
  }
679
686
  }), t;
680
687
  }
681
- function Nt(e) {
682
- return new jt(e);
688
+ function It(e) {
689
+ return new Pt(e);
683
690
  }
684
- function Pt(e, t, n, r, i) {
685
- let a = At(n);
691
+ function Lt(e, t, n, r, i) {
692
+ let a = Nt(n);
686
693
  if (typeof i == "object" && (i = `ConvexError ${JSON.stringify(i.errorData, null, 2)}`), t === "info") {
687
694
  let t = i.match(/^\[.*?\] /);
688
695
  if (t === null) {
@@ -690,55 +697,55 @@ function Pt(e, t, n, r, i) {
690
697
  return;
691
698
  }
692
699
  let n = i.slice(1, t[0].length - 2), o = i.slice(t[0].length);
693
- e.log(`%c[CONVEX ${a}(${r})] [${n}]`, kt, o);
700
+ e.log(`%c[CONVEX ${a}(${r})] [${n}]`, Mt, o);
694
701
  } else e.error(`[CONVEX ${a}(${r})] ${i}`);
695
702
  }
696
- function Ft(e, t) {
703
+ function Rt(e, t) {
697
704
  let n = `[CONVEX FATAL ERROR] ${t}`;
698
705
  return e.error(n), Error(n);
699
706
  }
700
- function It(e, t, n) {
701
- return `[CONVEX ${At(e)}(${t})] ${n.errorMessage}
707
+ function zt(e, t, n) {
708
+ return `[CONVEX ${Nt(e)}(${t})] ${n.errorMessage}
702
709
  Called by client`;
703
710
  }
704
- function Lt(e, t) {
711
+ function Bt(e, t) {
705
712
  return t.data = e.errorData, t;
706
713
  }
707
714
  //#endregion
708
715
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/udf_path_utils.js
709
- function Rt(e) {
716
+ function Vt(e) {
710
717
  let t = e.split(":"), n, r;
711
718
  return t.length === 1 ? (n = t[0], r = "default") : (n = t.slice(0, t.length - 1).join(":"), r = t[t.length - 1]), n.endsWith(".js") && (n = n.slice(0, -3)), `${n}:${r}`;
712
719
  }
713
- function zt(e, t) {
720
+ function Ht(e, t) {
714
721
  return JSON.stringify({
715
- udfPath: Rt(e),
716
- args: vt(t)
722
+ udfPath: Vt(e),
723
+ args: xt(t)
717
724
  });
718
725
  }
719
- function Bt(e, t, n) {
726
+ function Ut(e, t, n) {
720
727
  let { initialNumItems: r, id: i } = n;
721
728
  return JSON.stringify({
722
729
  type: "paginated",
723
- udfPath: Rt(e),
724
- args: vt(t),
725
- options: vt({
730
+ udfPath: Vt(e),
731
+ args: xt(t),
732
+ options: xt({
726
733
  initialNumItems: r,
727
734
  id: i
728
735
  })
729
736
  });
730
737
  }
731
- function Vt(e) {
738
+ function Wt(e) {
732
739
  return JSON.parse(e).type === "paginated";
733
740
  }
734
741
  //#endregion
735
742
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/local_state.js
736
- var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
743
+ var Gt = Object.defineProperty, Kt = (e, t, n) => t in e ? Gt(e, t, {
737
744
  enumerable: !0,
738
745
  configurable: !0,
739
746
  writable: !0,
740
747
  value: n
741
- }) : e[t] = n, G = (e, t, n) => Ut(e, typeof t == "symbol" ? t : t + "", n), Wt = class {
748
+ }) : e[t] = n, G = (e, t, n) => Kt(e, typeof t == "symbol" ? t : t + "", n), qt = class {
742
749
  constructor() {
743
750
  G(this, "nextQueryId"), G(this, "querySetVersion"), G(this, "querySet"), G(this, "queryIdToToken"), G(this, "identityVersion"), G(this, "auth"), G(this, "outstandingQueriesOlderThanRestart"), G(this, "outstandingAuthOlderThanRestart"), G(this, "paused"), G(this, "pendingQuerySetModifications"), this.nextQueryId = 0, this.querySetVersion = 0, this.identityVersion = 0, this.querySet = /* @__PURE__ */ new Map(), this.queryIdToToken = /* @__PURE__ */ new Map(), this.outstandingQueriesOlderThanRestart = /* @__PURE__ */ new Set(), this.outstandingAuthOlderThanRestart = !1, this.paused = !1, this.pendingQuerySetModifications = /* @__PURE__ */ new Map();
744
751
  }
@@ -749,7 +756,7 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
749
756
  this.outstandingAuthOlderThanRestart = !1;
750
757
  }
751
758
  subscribe(e, t, n, r) {
752
- let i = Rt(e), a = zt(i, t), o = this.querySet.get(a);
759
+ let i = Vt(e), a = Ht(i, t), o = this.querySet.get(a);
753
760
  if (o !== void 0) return o.numSubscribers += 1, {
754
761
  queryToken: a,
755
762
  modification: null,
@@ -769,7 +776,7 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
769
776
  type: "Add",
770
777
  queryId: e,
771
778
  udfPath: i,
772
- args: [vt(t)],
779
+ args: [xt(t)],
773
780
  journal: n,
774
781
  componentPath: r
775
782
  };
@@ -804,7 +811,7 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
804
811
  }
805
812
  }
806
813
  queryId(e, t) {
807
- let n = zt(Rt(e), t), r = this.querySet.get(n);
814
+ let n = Ht(Vt(e), t), r = this.querySet.get(n);
808
815
  return r === void 0 ? null : r.id;
809
816
  }
810
817
  isCurrentOrNewerAuthVersion(e) {
@@ -876,7 +883,7 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
876
883
  type: "Add",
877
884
  queryId: t.id,
878
885
  udfPath: t.canonicalizedUdfPath,
879
- args: [vt(t.args)],
886
+ args: [xt(t.args)],
880
887
  journal: t.journal,
881
888
  componentPath: t.componentPath
882
889
  };
@@ -934,14 +941,14 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
934
941
  };
935
942
  }
936
943
  }
937
- }, Gt = Object.defineProperty, Kt = (e, t, n) => t in e ? Gt(e, t, {
944
+ }, Jt = Object.defineProperty, Yt = (e, t, n) => t in e ? Jt(e, t, {
938
945
  enumerable: !0,
939
946
  configurable: !0,
940
947
  writable: !0,
941
948
  value: n
942
- }) : e[t] = n, qt = (e, t, n) => Kt(e, typeof t == "symbol" ? t : t + "", n), Jt = class {
949
+ }) : e[t] = n, Xt = (e, t, n) => Yt(e, typeof t == "symbol" ? t : t + "", n), Zt = class {
943
950
  constructor(e, t) {
944
- this.logger = e, this.markConnectionStateDirty = t, qt(this, "inflightRequests"), qt(this, "requestsOlderThanRestart"), qt(this, "inflightMutationsCount", 0), qt(this, "inflightActionsCount", 0), this.inflightRequests = /* @__PURE__ */ new Map(), this.requestsOlderThanRestart = /* @__PURE__ */ new Set();
951
+ this.logger = e, this.markConnectionStateDirty = t, Xt(this, "inflightRequests"), Xt(this, "requestsOlderThanRestart"), Xt(this, "inflightMutationsCount", 0), Xt(this, "inflightActionsCount", 0), this.inflightRequests = /* @__PURE__ */ new Map(), this.requestsOlderThanRestart = /* @__PURE__ */ new Set();
945
952
  }
946
953
  request(e, t) {
947
954
  let n = new Promise((n) => {
@@ -961,19 +968,19 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
961
968
  let t = this.inflightRequests.get(e.requestId);
962
969
  if (t === void 0 || t.status.status === "Completed") return null;
963
970
  let n = t.message.type === "Mutation" ? "mutation" : "action", r = t.message.udfPath;
964
- for (let t of e.logLines) Pt(this.logger, "info", n, r, t);
971
+ for (let t of e.logLines) Lt(this.logger, "info", n, r, t);
965
972
  let i = t.status, a, o;
966
973
  if (e.success) a = {
967
974
  success: !0,
968
975
  logLines: e.logLines,
969
- value: ft(e.result)
976
+ value: ht(e.result)
970
977
  }, o = () => i.onResult(a);
971
978
  else {
972
979
  let t = e.result, { errorData: s } = e;
973
- Pt(this.logger, "error", n, r, t), a = {
980
+ Lt(this.logger, "error", n, r, t), a = {
974
981
  success: !1,
975
982
  errorMessage: t,
976
- errorData: s === void 0 ? void 0 : ft(s),
983
+ errorData: s === void 0 ? void 0 : ht(s),
977
984
  logLines: e.logLines
978
985
  }, o = () => i.onResult(a);
979
986
  }
@@ -1045,19 +1052,19 @@ var Ht = Object.defineProperty, Ut = (e, t, n) => t in e ? Ht(e, t, {
1045
1052
  inflightActions() {
1046
1053
  return this.inflightActionsCount;
1047
1054
  }
1048
- }, Yt = Symbol.for("functionName"), Xt = Symbol.for("toReferencePath");
1049
- function Zt(e) {
1050
- return e[Xt] ?? null;
1055
+ }, Qt = Symbol.for("functionName"), $t = Symbol.for("toReferencePath");
1056
+ function en(e) {
1057
+ return e[$t] ?? null;
1051
1058
  }
1052
- function Qt(e) {
1059
+ function tn(e) {
1053
1060
  return e.startsWith("function://");
1054
1061
  }
1055
- function $t(e) {
1062
+ function nn(e) {
1056
1063
  let t;
1057
- if (typeof e == "string") t = Qt(e) ? { functionHandle: e } : { name: e };
1058
- else if (e[Yt]) t = { name: e[Yt] };
1064
+ if (typeof e == "string") t = tn(e) ? { functionHandle: e } : { name: e };
1065
+ else if (e[Qt]) t = { name: e[Qt] };
1059
1066
  else {
1060
- let n = Zt(e);
1067
+ let n = en(e);
1061
1068
  if (!n) throw Error(`${e} is not a functionReference`);
1062
1069
  t = { reference: n };
1063
1070
  }
@@ -1066,20 +1073,20 @@ function $t(e) {
1066
1073
  //#endregion
1067
1074
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/server/api.js
1068
1075
  function K(e) {
1069
- let t = $t(e);
1076
+ let t = nn(e);
1070
1077
  if (t.name === void 0) throw t.functionHandle === void 0 ? t.reference === void 0 ? Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`) : Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`) : Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`);
1071
1078
  if (typeof e == "string") return e;
1072
- let n = e[Yt];
1079
+ let n = e[Qt];
1073
1080
  if (!n) throw Error(`${e} is not a functionReference`);
1074
1081
  return n;
1075
1082
  }
1076
- function en(e) {
1077
- return { [Yt]: e };
1083
+ function rn(e) {
1084
+ return { [Qt]: e };
1078
1085
  }
1079
- function tn(e = []) {
1086
+ function an(e = []) {
1080
1087
  return new Proxy({}, { get(t, n) {
1081
- if (typeof n == "string") return tn([...e, n]);
1082
- if (n === Yt) {
1088
+ if (typeof n == "string") return an([...e, n]);
1089
+ if (n === Qt) {
1083
1090
  if (e.length < 2) {
1084
1091
  let t = ["api", ...e].join(".");
1085
1092
  throw Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${t}\``);
@@ -1090,32 +1097,32 @@ function tn(e = []) {
1090
1097
  else return;
1091
1098
  } });
1092
1099
  }
1093
- tn();
1100
+ an();
1094
1101
  //#endregion
1095
1102
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/optimistic_updates_impl.js
1096
- var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1103
+ var on = Object.defineProperty, sn = (e, t, n) => t in e ? on(e, t, {
1097
1104
  enumerable: !0,
1098
1105
  configurable: !0,
1099
1106
  writable: !0,
1100
1107
  value: n
1101
- }) : e[t] = n, an = (e, t, n) => rn(e, typeof t == "symbol" ? t : t + "", n), on = class e {
1108
+ }) : e[t] = n, cn = (e, t, n) => sn(e, typeof t == "symbol" ? t : t + "", n), ln = class e {
1102
1109
  constructor(e) {
1103
- an(this, "queryResults"), an(this, "modifiedQueries"), this.queryResults = e, this.modifiedQueries = [];
1110
+ cn(this, "queryResults"), cn(this, "modifiedQueries"), this.queryResults = e, this.modifiedQueries = [];
1104
1111
  }
1105
1112
  getQuery(t, ...n) {
1106
- let r = W(n[0]), i = K(t), a = this.queryResults.get(zt(i, r));
1113
+ let r = Ze(n[0]), i = K(t), a = this.queryResults.get(Ht(i, r));
1107
1114
  if (a !== void 0) return e.queryValue(a.result);
1108
1115
  }
1109
1116
  getAllQueries(t) {
1110
1117
  let n = [], r = K(t);
1111
- for (let t of this.queryResults.values()) t.udfPath === Rt(r) && n.push({
1118
+ for (let t of this.queryResults.values()) t.udfPath === Vt(r) && n.push({
1112
1119
  args: t.args,
1113
1120
  value: e.queryValue(t.result)
1114
1121
  });
1115
1122
  return n;
1116
1123
  }
1117
1124
  setQuery(e, t, n) {
1118
- let r = W(t), i = K(e), a = zt(i, r), o;
1125
+ let r = Ze(t), i = K(e), a = Ht(i, r), o;
1119
1126
  o = n === void 0 ? void 0 : {
1120
1127
  success: !0,
1121
1128
  value: n,
@@ -1131,15 +1138,15 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1131
1138
  static queryValue(e) {
1132
1139
  if (e !== void 0 && e.success) return e.value;
1133
1140
  }
1134
- }, sn = class {
1141
+ }, un = class {
1135
1142
  constructor() {
1136
- an(this, "queryResults"), an(this, "optimisticUpdates"), this.queryResults = /* @__PURE__ */ new Map(), this.optimisticUpdates = [];
1143
+ cn(this, "queryResults"), cn(this, "optimisticUpdates"), this.queryResults = /* @__PURE__ */ new Map(), this.optimisticUpdates = [];
1137
1144
  }
1138
1145
  ingestQueryResultsFromServer(e, t) {
1139
1146
  this.optimisticUpdates = this.optimisticUpdates.filter((e) => !t.has(e.mutationId));
1140
1147
  let n = this.queryResults;
1141
1148
  this.queryResults = new Map(e);
1142
- let r = new on(this.queryResults);
1149
+ let r = new ln(this.queryResults);
1143
1150
  for (let e of this.optimisticUpdates) e.update(r);
1144
1151
  let i = [];
1145
1152
  for (let [e, t] of this.queryResults) {
@@ -1153,7 +1160,7 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1153
1160
  update: e,
1154
1161
  mutationId: t
1155
1162
  });
1156
- let n = new on(this.queryResults);
1163
+ let n = new ln(this.queryResults);
1157
1164
  return e(n), n.modifiedQueries;
1158
1165
  }
1159
1166
  rawQueryResult(e) {
@@ -1166,7 +1173,7 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1166
1173
  let n = t.result;
1167
1174
  if (n !== void 0) {
1168
1175
  if (n.success) return n.value;
1169
- throw n.errorData === void 0 ? Error(It("query", t.udfPath, n)) : Lt(n, new Tt(It("query", t.udfPath, n)));
1176
+ throw n.errorData === void 0 ? Error(zt("query", t.udfPath, n)) : Bt(n, new Ot(zt("query", t.udfPath, n)));
1170
1177
  }
1171
1178
  }
1172
1179
  hasQueryResult(e) {
@@ -1175,14 +1182,14 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1175
1182
  queryLogs(e) {
1176
1183
  return this.queryResults.get(e)?.result?.logLines;
1177
1184
  }
1178
- }, cn = Object.defineProperty, ln = (e, t, n) => t in e ? cn(e, t, {
1185
+ }, dn = Object.defineProperty, fn = (e, t, n) => t in e ? dn(e, t, {
1179
1186
  enumerable: !0,
1180
1187
  configurable: !0,
1181
1188
  writable: !0,
1182
1189
  value: n
1183
- }) : e[t] = n, un = (e, t, n) => ln(e, typeof t == "symbol" ? t : t + "", n), dn = class e {
1190
+ }) : e[t] = n, pn = (e, t, n) => fn(e, typeof t == "symbol" ? t : t + "", n), mn = class e {
1184
1191
  constructor(e, t) {
1185
- un(this, "low"), un(this, "high"), un(this, "__isUnsignedLong__"), this.low = e | 0, this.high = t | 0, this.__isUnsignedLong__ = !0;
1192
+ pn(this, "low"), pn(this, "high"), pn(this, "__isUnsignedLong__"), this.low = e | 0, this.high = t | 0, this.__isUnsignedLong__ = !0;
1186
1193
  }
1187
1194
  static isLong(e) {
1188
1195
  return (e && e.__isUnsignedLong__) === !0;
@@ -1204,10 +1211,10 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1204
1211
  ];
1205
1212
  }
1206
1213
  static fromNumber(t) {
1207
- return isNaN(t) || t < 0 ? fn : t >= hn ? gn : new e(t % mn | 0, t / mn | 0);
1214
+ return isNaN(t) || t < 0 ? hn : t >= vn ? yn : new e(t % _n | 0, t / _n | 0);
1208
1215
  }
1209
1216
  toString() {
1210
- return (BigInt(this.high) * BigInt(mn) + BigInt(this.low)).toString();
1217
+ return (BigInt(this.high) * BigInt(_n) + BigInt(this.low)).toString();
1211
1218
  }
1212
1219
  equals(t) {
1213
1220
  return e.isLong(t) || (t = e.fromValue(t)), this.high >>> 31 == 1 && t.high >>> 31 == 1 ? !1 : this.high === t.high && this.low === t.low;
@@ -1224,16 +1231,16 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1224
1231
  static fromValue(t) {
1225
1232
  return typeof t == "number" ? e.fromNumber(t) : new e(t.low, t.high);
1226
1233
  }
1227
- }, fn = new dn(0, 0), pn = 65536, mn = pn * pn, hn = mn * mn, gn = new dn(-1, -1), _n = Object.defineProperty, vn = (e, t, n) => t in e ? _n(e, t, {
1234
+ }, hn = new mn(0, 0), gn = 65536, _n = gn * gn, vn = _n * _n, yn = new mn(-1, -1), bn = Object.defineProperty, xn = (e, t, n) => t in e ? bn(e, t, {
1228
1235
  enumerable: !0,
1229
1236
  configurable: !0,
1230
1237
  writable: !0,
1231
1238
  value: n
1232
- }) : e[t] = n, yn = (e, t, n) => vn(e, typeof t == "symbol" ? t : t + "", n), bn = class {
1239
+ }) : e[t] = n, Sn = (e, t, n) => xn(e, typeof t == "symbol" ? t : t + "", n), Cn = class {
1233
1240
  constructor(e, t) {
1234
- yn(this, "version"), yn(this, "remoteQuerySet"), yn(this, "queryPath"), yn(this, "logger"), this.version = {
1241
+ Sn(this, "version"), Sn(this, "remoteQuerySet"), Sn(this, "queryPath"), Sn(this, "logger"), this.version = {
1235
1242
  querySet: 0,
1236
- ts: dn.fromNumber(0),
1243
+ ts: mn.fromNumber(0),
1237
1244
  identity: 0
1238
1245
  }, this.remoteQuerySet = /* @__PURE__ */ new Map(), this.queryPath = e, this.logger = t;
1239
1246
  }
@@ -1243,8 +1250,8 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1243
1250
  for (let t of e.modifications) switch (t.type) {
1244
1251
  case "QueryUpdated": {
1245
1252
  let e = this.queryPath(t.queryId);
1246
- if (e) for (let n of t.logLines) Pt(this.logger, "info", "query", e, n);
1247
- let n = ft(t.value ?? null);
1253
+ if (e) for (let n of t.logLines) Lt(this.logger, "info", "query", e, n);
1254
+ let n = ht(t.value ?? null);
1248
1255
  this.remoteQuerySet.set(t.queryId, {
1249
1256
  success: !0,
1250
1257
  value: n,
@@ -1254,12 +1261,12 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1254
1261
  }
1255
1262
  case "QueryFailed": {
1256
1263
  let e = this.queryPath(t.queryId);
1257
- if (e) for (let n of t.logLines) Pt(this.logger, "info", "query", e, n);
1264
+ if (e) for (let n of t.logLines) Lt(this.logger, "info", "query", e, n);
1258
1265
  let { errorData: n } = t;
1259
1266
  this.remoteQuerySet.set(t.queryId, {
1260
1267
  success: !1,
1261
1268
  errorMessage: t.errorMessage,
1262
- errorData: n === void 0 ? void 0 : ft(n),
1269
+ errorData: n === void 0 ? void 0 : ht(n),
1263
1270
  logLines: t.logLines
1264
1271
  });
1265
1272
  break;
@@ -1280,14 +1287,14 @@ var nn = Object.defineProperty, rn = (e, t, n) => t in e ? nn(e, t, {
1280
1287
  };
1281
1288
  //#endregion
1282
1289
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/protocol.js
1283
- function xn(e) {
1284
- let t = Ge(e);
1285
- return dn.fromBytesLE(Array.from(t));
1290
+ function wn(e) {
1291
+ let t = qe(e);
1292
+ return mn.fromBytesLE(Array.from(t));
1286
1293
  }
1287
- function Sn(e) {
1288
- return Je(new Uint8Array(e.toBytesLE()));
1294
+ function Tn(e) {
1295
+ return Xe(new Uint8Array(e.toBytesLE()));
1289
1296
  }
1290
- function Cn(e) {
1297
+ function En(e) {
1291
1298
  switch (e.type) {
1292
1299
  case "FatalError":
1293
1300
  case "AuthError":
@@ -1296,23 +1303,23 @@ function Cn(e) {
1296
1303
  case "Ping": return { ...e };
1297
1304
  case "MutationResponse": return e.success ? {
1298
1305
  ...e,
1299
- ts: xn(e.ts)
1306
+ ts: wn(e.ts)
1300
1307
  } : { ...e };
1301
1308
  case "Transition": return {
1302
1309
  ...e,
1303
1310
  startVersion: {
1304
1311
  ...e.startVersion,
1305
- ts: xn(e.startVersion.ts)
1312
+ ts: wn(e.startVersion.ts)
1306
1313
  },
1307
1314
  endVersion: {
1308
1315
  ...e.endVersion,
1309
- ts: xn(e.endVersion.ts)
1316
+ ts: wn(e.endVersion.ts)
1310
1317
  }
1311
1318
  };
1312
1319
  default:
1313
1320
  }
1314
1321
  }
1315
- function wn(e) {
1322
+ function Dn(e) {
1316
1323
  switch (e.type) {
1317
1324
  case "Authenticate":
1318
1325
  case "ModifyQuerySet":
@@ -1324,26 +1331,26 @@ function wn(e) {
1324
1331
  maxObservedTimestamp: void 0
1325
1332
  } : {
1326
1333
  ...e,
1327
- maxObservedTimestamp: Sn(e.maxObservedTimestamp)
1334
+ maxObservedTimestamp: Tn(e.maxObservedTimestamp)
1328
1335
  };
1329
1336
  default:
1330
1337
  }
1331
1338
  }
1332
1339
  //#endregion
1333
1340
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/web_socket_manager.js
1334
- var Tn = Object.defineProperty, En = (e, t, n) => t in e ? Tn(e, t, {
1341
+ var On = Object.defineProperty, kn = (e, t, n) => t in e ? On(e, t, {
1335
1342
  enumerable: !0,
1336
1343
  configurable: !0,
1337
1344
  writable: !0,
1338
1345
  value: n
1339
- }) : e[t] = n, q = (e, t, n) => En(e, typeof t == "symbol" ? t : t + "", n), Dn = 1e3, On = 1001, kn = 1005, An = 4040, jn;
1340
- function Mn() {
1341
- return jn === void 0 && (jn = Date.now()), typeof performance > "u" || !performance.now ? Date.now() : Math.round(jn + performance.now());
1346
+ }) : e[t] = n, q = (e, t, n) => kn(e, typeof t == "symbol" ? t : t + "", n), An = 1e3, jn = 1001, Mn = 1005, Nn = 4040, Pn;
1347
+ function Fn() {
1348
+ return Pn === void 0 && (Pn = Date.now()), typeof performance > "u" || !performance.now ? Date.now() : Math.round(Pn + performance.now());
1342
1349
  }
1343
- function Nn() {
1344
- return `t=${Math.round((Mn() - jn) / 100) / 10}s`;
1350
+ function In() {
1351
+ return `t=${Math.round((Fn() - Pn) / 100) / 10}s`;
1345
1352
  }
1346
- var Pn = {
1353
+ var Ln = {
1347
1354
  InternalServerError: { timeout: 1e3 },
1348
1355
  SubscriptionsWorkerFullError: { timeout: 3e3 },
1349
1356
  TooManyConcurrentRequests: { timeout: 3e3 },
@@ -1359,12 +1366,12 @@ var Pn = {
1359
1366
  SearchIndexTooLarge: { timeout: 3e3 },
1360
1367
  TooManyWritesInTimePeriod: { timeout: 3e3 }
1361
1368
  };
1362
- function Fn(e) {
1369
+ function Rn(e) {
1363
1370
  if (e === void 0) return "Unknown";
1364
- for (let t of Object.keys(Pn)) if (e.startsWith(t)) return t;
1371
+ for (let t of Object.keys(Ln)) if (e.startsWith(t)) return t;
1365
1372
  return "Unknown";
1366
1373
  }
1367
- var In = class {
1374
+ var zn = class {
1368
1375
  constructor(e, t, n, r, i, a) {
1369
1376
  this.markConnectionStateDirty = i, this.debug = a, q(this, "socket"), q(this, "connectionCount"), q(this, "_hasEverConnected", !1), q(this, "lastCloseReason"), q(this, "transitionChunkBuffer", null), q(this, "defaultInitialBackoff"), q(this, "maxBackoff"), q(this, "retries"), q(this, "serverInactivityThreshold"), q(this, "reconnectDueToServerInactivityTimeout"), q(this, "scheduledReconnect", null), q(this, "networkOnlineHandler", null), q(this, "pendingNetworkRecoveryInfo", null), q(this, "uri"), q(this, "onOpen"), q(this, "onResume"), q(this, "onMessage"), q(this, "webSocketConstructor"), q(this, "logger"), q(this, "onServerDisconnectError"), this.webSocketConstructor = n, this.socket = { state: "disconnected" }, this.connectionCount = 0, this.lastCloseReason = "InitialConnect", this.defaultInitialBackoff = 1e3, this.maxBackoff = 16e3, this.retries = 0, this.serverInactivityThreshold = 6e4, this.reconnectDueToServerInactivityTimeout = null, this.uri = e, this.onOpen = t.onOpen, this.onResume = t.onResume, this.onMessage = t.onMessage, this.onServerDisconnectError = t.onServerDisconnectError, this.logger = r, this.setupNetworkListener(), this.connect();
1370
1377
  }
@@ -1392,7 +1399,7 @@ var In = class {
1392
1399
  if (this.transitionChunkBuffer.chunks.push(e.chunk), this.transitionChunkBuffer.chunks.length === e.totalParts) {
1393
1400
  let e = this.transitionChunkBuffer.chunks.join("");
1394
1401
  this.transitionChunkBuffer = null;
1395
- let t = Cn(JSON.parse(e));
1402
+ let t = En(JSON.parse(e));
1396
1403
  if (t.type !== "Transition") throw Error(`Expected Transition, got ${t.type} after assembling chunks`);
1397
1404
  return t;
1398
1405
  }
@@ -1415,8 +1422,8 @@ var In = class {
1415
1422
  }), this.resetServerInactivityTimeout(), this.socket.paused === "no" && (this._hasEverConnected = !0, this.onOpen({
1416
1423
  connectionCount: this.connectionCount,
1417
1424
  lastCloseReason: this.lastCloseReason,
1418
- clientTs: Mn()
1419
- })), this.lastCloseReason !== "InitialConnect" && (this.lastCloseReason ? this.logger.log("WebSocket reconnected at", Nn(), "after disconnect due to", this.lastCloseReason) : this.logger.log("WebSocket reconnected at", Nn())), this.connectionCount += 1, this.lastCloseReason = null, this.pendingNetworkRecoveryInfo !== null) {
1425
+ clientTs: Fn()
1426
+ })), this.lastCloseReason !== "InitialConnect" && (this.lastCloseReason ? this.logger.log("WebSocket reconnected at", In(), "after disconnect due to", this.lastCloseReason) : this.logger.log("WebSocket reconnected at", In())), this.connectionCount += 1, this.lastCloseReason = null, this.pendingNetworkRecoveryInfo !== null) {
1420
1427
  let { timeSavedMs: e } = this.pendingNetworkRecoveryInfo;
1421
1428
  this.pendingNetworkRecoveryInfo = null, this.sendMessage({
1422
1429
  type: "Event",
@@ -1430,7 +1437,7 @@ var In = class {
1430
1437
  t && this.logger.log(`WebSocket error message: ${t}`);
1431
1438
  }, e.onmessage = (e) => {
1432
1439
  this.resetServerInactivityTimeout();
1433
- let t = e.data.length, n = Cn(JSON.parse(e.data));
1440
+ let t = e.data.length, n = En(JSON.parse(e.data));
1434
1441
  if (this._logVerbose(`received ws message with type ${n.type}`), n.type !== "Ping") {
1435
1442
  if (n.type === "TransitionChunk") {
1436
1443
  let e = this.assembleTransition(n);
@@ -1443,11 +1450,11 @@ var In = class {
1443
1450
  }), this.onMessage(n).hasSyncedPastLastReconnect && (this.retries = 0, this.markConnectionStateDirty());
1444
1451
  }
1445
1452
  }, e.onclose = (e) => {
1446
- if (this._logVerbose("begin ws.onclose"), this.transitionChunkBuffer = null, this.lastCloseReason === null && (this.lastCloseReason = e.reason || `closed with code ${e.code}`), e.code !== Dn && e.code !== On && e.code !== kn && e.code !== An) {
1453
+ if (this._logVerbose("begin ws.onclose"), this.transitionChunkBuffer = null, this.lastCloseReason === null && (this.lastCloseReason = e.reason || `closed with code ${e.code}`), e.code !== An && e.code !== jn && e.code !== Mn && e.code !== Nn) {
1447
1454
  let t = `WebSocket closed with code ${e.code}`;
1448
1455
  e.reason && (t += `: ${e.reason}`), this.logger.log(t), this.onServerDisconnectError && e.reason && this.onServerDisconnectError(t);
1449
1456
  }
1450
- let t = Fn(e.reason);
1457
+ let t = Rn(e.reason);
1451
1458
  this.scheduleReconnect(t);
1452
1459
  };
1453
1460
  }
@@ -1460,7 +1467,7 @@ var In = class {
1460
1467
  ...e.type === "Authenticate" && e.tokenType === "User" ? { value: `...${e.value.slice(-7)}` } : {}
1461
1468
  };
1462
1469
  if (this.socket.state === "ready" && this.socket.paused === "no") {
1463
- let n = wn(e), r = JSON.stringify(n), i = !1;
1470
+ let n = Dn(e), r = JSON.stringify(n), i = !1;
1464
1471
  try {
1465
1472
  this.socket.ws.send(r), i = !0;
1466
1473
  } catch (e) {
@@ -1479,7 +1486,7 @@ var In = class {
1479
1486
  this.scheduledReconnect &&= (clearTimeout(this.scheduledReconnect.timeout), null), this.socket = { state: "disconnected" };
1480
1487
  let t = this.nextBackoff(e);
1481
1488
  this.markConnectionStateDirty(), this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);
1482
- let n = Mn(), r = setTimeout(() => {
1489
+ let n = Fn(), r = setTimeout(() => {
1483
1490
  this.scheduledReconnect?.timeout === r && (this.scheduledReconnect = null, this.connect());
1484
1491
  }, t);
1485
1492
  this.scheduledReconnect = {
@@ -1597,7 +1604,7 @@ var In = class {
1597
1604
  }
1598
1605
  let e = null;
1599
1606
  if (this.scheduledReconnect) {
1600
- let t = Mn() - this.scheduledReconnect.scheduledAt;
1607
+ let t = Fn() - this.scheduledReconnect.scheduledAt;
1601
1608
  e = Math.max(0, this.scheduledReconnect.backoffMs - t), this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`), clearTimeout(this.scheduledReconnect.timeout), this.scheduledReconnect = null, this._logVerbose("canceled scheduled reconnect");
1602
1609
  }
1603
1610
  this.logger.log("Network recovery detected, reconnecting immediately"), this.pendingNetworkRecoveryInfo = e === null ? null : { timeSavedMs: e }, this.connect();
@@ -1617,7 +1624,7 @@ var In = class {
1617
1624
  }, this._hasEverConnected = !0, this.onOpen({
1618
1625
  connectionCount: this.connectionCount,
1619
1626
  lastCloseReason: this.lastCloseReason,
1620
- clientTs: Mn()
1627
+ clientTs: Fn()
1621
1628
  })) : this.socket.paused === "yes" && (this.socket = {
1622
1629
  ...this.socket,
1623
1630
  paused: "no"
@@ -1642,14 +1649,14 @@ var In = class {
1642
1649
  this.logger.logVerbose(e);
1643
1650
  }
1644
1651
  nextBackoff(e) {
1645
- let t = (e === "client" ? 100 : e === "Unknown" ? this.defaultInitialBackoff : Pn[e].timeout) * 2 ** this.retries;
1652
+ let t = (e === "client" ? 100 : e === "Unknown" ? this.defaultInitialBackoff : Ln[e].timeout) * 2 ** this.retries;
1646
1653
  this.retries += 1;
1647
1654
  let n = Math.min(t, this.maxBackoff);
1648
1655
  return n + n * (Math.random() - .5);
1649
1656
  }
1650
1657
  reportLargeTransition({ transition: e, messageLength: t }) {
1651
1658
  if (e.clientClockSkew === void 0 || e.serverTs === void 0) return;
1652
- let n = Mn() - e.clientClockSkew - e.serverTs / 1e6, r = `${Math.round(n)}ms`, i = `${Math.round(t / 1e4) / 100}MB`, a = t / (n / 1e3), o = `${Math.round(a / 1e4) / 100}MB per second`;
1659
+ let n = Fn() - e.clientClockSkew - e.serverTs / 1e6, r = `${Math.round(n)}ms`, i = `${Math.round(t / 1e4) / 100}MB`, a = t / (n / 1e3), o = `${Math.round(a / 1e4) / 100}MB per second`;
1653
1660
  this._logVerbose(`received ${i} transition in ${r} at ${o}`), t > 2e7 ? this.logger.log(`received query results totaling more that 20MB (${i}) which will take a long time to download on slower connections`) : n > 2e4 && this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${r})`), this.debug && this.sendMessage({
1654
1661
  type: "Event",
1655
1662
  eventType: "ClientReceivedTransition",
@@ -1662,10 +1669,10 @@ var In = class {
1662
1669
  };
1663
1670
  //#endregion
1664
1671
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/session.js
1665
- function Ln() {
1666
- return Rn();
1672
+ function Bn() {
1673
+ return Vn();
1667
1674
  }
1668
- function Rn() {
1675
+ function Vn() {
1669
1676
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
1670
1677
  let t = Math.random() * 16 | 0;
1671
1678
  return (e === "x" ? t : t & 3 | 8).toString(16);
@@ -1673,15 +1680,15 @@ function Rn() {
1673
1680
  }
1674
1681
  //#endregion
1675
1682
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/vendor/jwt-decode/index.js
1676
- var zn = class extends Error {};
1677
- zn.prototype.name = "InvalidTokenError";
1678
- function Bn(e) {
1683
+ var Hn = class extends Error {};
1684
+ Hn.prototype.name = "InvalidTokenError";
1685
+ function Un(e) {
1679
1686
  return decodeURIComponent(atob(e).replace(/(.)/g, (e, t) => {
1680
1687
  let n = t.charCodeAt(0).toString(16).toUpperCase();
1681
1688
  return n.length < 2 && (n = "0" + n), "%" + n;
1682
1689
  }));
1683
1690
  }
1684
- function Vn(e) {
1691
+ function Wn(e) {
1685
1692
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
1686
1693
  switch (t.length % 4) {
1687
1694
  case 0: break;
@@ -1694,36 +1701,36 @@ function Vn(e) {
1694
1701
  default: throw Error("base64 string is not of the correct length");
1695
1702
  }
1696
1703
  try {
1697
- return Bn(t);
1704
+ return Un(t);
1698
1705
  } catch {
1699
1706
  return atob(t);
1700
1707
  }
1701
1708
  }
1702
- function Hn(e, t) {
1703
- if (typeof e != "string") throw new zn("Invalid token specified: must be a string");
1709
+ function Gn(e, t) {
1710
+ if (typeof e != "string") throw new Hn("Invalid token specified: must be a string");
1704
1711
  t ||= {};
1705
1712
  let n = t.header === !0 ? 0 : 1, r = e.split(".")[n];
1706
- if (typeof r != "string") throw new zn(`Invalid token specified: missing part #${n + 1}`);
1713
+ if (typeof r != "string") throw new Hn(`Invalid token specified: missing part #${n + 1}`);
1707
1714
  let i;
1708
1715
  try {
1709
- i = Vn(r);
1716
+ i = Wn(r);
1710
1717
  } catch (e) {
1711
- throw new zn(`Invalid token specified: invalid base64 for part #${n + 1} (${e.message})`);
1718
+ throw new Hn(`Invalid token specified: invalid base64 for part #${n + 1} (${e.message})`);
1712
1719
  }
1713
1720
  try {
1714
1721
  return JSON.parse(i);
1715
1722
  } catch (e) {
1716
- throw new zn(`Invalid token specified: invalid json for part #${n + 1} (${e.message})`);
1723
+ throw new Hn(`Invalid token specified: invalid json for part #${n + 1} (${e.message})`);
1717
1724
  }
1718
1725
  }
1719
1726
  //#endregion
1720
1727
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/authentication_manager.js
1721
- var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
1728
+ var Kn = Object.defineProperty, qn = (e, t, n) => t in e ? Kn(e, t, {
1722
1729
  enumerable: !0,
1723
1730
  configurable: !0,
1724
1731
  writable: !0,
1725
1732
  value: n
1726
- }) : e[t] = n, J = (e, t, n) => Wn(e, typeof t == "symbol" ? t : t + "", n), Gn = 480 * 60 * 60 * 1e3, Kn = 2, qn = class {
1733
+ }) : e[t] = n, J = (e, t, n) => qn(e, typeof t == "symbol" ? t : t + "", n), Jn = 480 * 60 * 60 * 1e3, Yn = 2, Xn = class {
1727
1734
  constructor(e, t, n) {
1728
1735
  J(this, "authState", { state: "noAuth" }), J(this, "configVersion", 0), J(this, "syncState"), J(this, "authenticate"), J(this, "stopSocket"), J(this, "tryRestartSocket"), J(this, "pauseSocket"), J(this, "resumeSocket"), J(this, "clearAuth"), J(this, "logger"), J(this, "refreshTokenLeewaySeconds"), J(this, "tokenConfirmationAttempts", 0), this.syncState = e, this.authenticate = t.authenticate, this.stopSocket = t.stopSocket, this.tryRestartSocket = t.tryRestartSocket, this.pauseSocket = t.pauseSocket, this.resumeSocket = t.resumeSocket, this.clearAuth = t.clearAuth, this.logger = n.logger, this.refreshTokenLeewaySeconds = n.refreshTokenLeewaySeconds;
1729
1736
  }
@@ -1767,11 +1774,11 @@ var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
1767
1774
  this.tryToReauthenticate(e);
1768
1775
  }
1769
1776
  async tryToReauthenticate(e) {
1770
- if (this._logVerbose(`attempting to reauthenticate: ${e.error}`), this.authState.state === "noAuth" || this.authState.state === "waitingForServerConfirmationOfFreshToken" && this.tokenConfirmationAttempts >= Kn) {
1777
+ if (this._logVerbose(`attempting to reauthenticate: ${e.error}`), this.authState.state === "noAuth" || this.authState.state === "waitingForServerConfirmationOfFreshToken" && this.tokenConfirmationAttempts >= Yn) {
1771
1778
  this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`), this.syncState.hasAuth() && this.syncState.clearAuth(), this.authState.state !== "noAuth" && this.setAndReportAuthFailed(this.authState.config.onAuthChange);
1772
1779
  return;
1773
1780
  }
1774
- this.authState.state === "waitingForServerConfirmationOfFreshToken" && (this.tokenConfirmationAttempts++, this._logVerbose(`retrying reauthentication, ${Kn - this.tokenConfirmationAttempts} attempts remaining`)), await this.stopSocket();
1781
+ this.authState.state === "waitingForServerConfirmationOfFreshToken" && (this.tokenConfirmationAttempts++, this._logVerbose(`retrying reauthentication, ${Yn - this.tokenConfirmationAttempts} attempts remaining`)), await this.stopSocket();
1775
1782
  let t = await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken, { forceRefreshToken: !0 });
1776
1783
  t.isFromOutdatedConfig || (t.value && this.syncState.isNewAuth(t.value) ? (this.authenticate(t.value), this.setAuthState({
1777
1784
  state: "waitingForServerConfirmationOfFreshToken",
@@ -1811,7 +1818,7 @@ var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
1811
1818
  this.logger.error("Auth token does not live long enough, cannot refetch the token");
1812
1819
  return;
1813
1820
  }
1814
- let a = Math.min(Gn, (i - this.refreshTokenLeewaySeconds) * 1e3);
1821
+ let a = Math.min(Jn, (i - this.refreshTokenLeewaySeconds) * 1e3);
1815
1822
  a <= 0 && (this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${i}s`), a = 0);
1816
1823
  let o = setTimeout(() => {
1817
1824
  this._logVerbose("running scheduled token refetch"), this.refetchToken();
@@ -1861,7 +1868,7 @@ var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
1861
1868
  }
1862
1869
  decodeToken(e) {
1863
1870
  try {
1864
- return Hn(e);
1871
+ return Gn(e);
1865
1872
  } catch (e) {
1866
1873
  return this._logVerbose(`Error decoding token: ${e instanceof Error ? e.message : "Unknown error"}`), null;
1867
1874
  }
@@ -1869,39 +1876,39 @@ var Un = Object.defineProperty, Wn = (e, t, n) => t in e ? Un(e, t, {
1869
1876
  _logVerbose(e) {
1870
1877
  this.logger.logVerbose(`${e} [v${this.configVersion}]`);
1871
1878
  }
1872
- }, Jn = [
1879
+ }, Zn = [
1873
1880
  "convexClientConstructed",
1874
1881
  "convexWebSocketOpen",
1875
1882
  "convexFirstMessageReceived"
1876
1883
  ];
1877
- function Yn(e, t) {
1884
+ function Qn(e, t) {
1878
1885
  let n = { sessionId: t };
1879
1886
  typeof performance > "u" || !performance.mark || performance.mark(e, { detail: n });
1880
1887
  }
1881
- function Xn(e) {
1888
+ function $n(e) {
1882
1889
  let t = e.name.slice(6);
1883
1890
  return t = t.charAt(0).toLowerCase() + t.slice(1), {
1884
1891
  name: t,
1885
1892
  startTime: e.startTime
1886
1893
  };
1887
1894
  }
1888
- function Zn(e) {
1895
+ function er(e) {
1889
1896
  if (typeof performance > "u" || !performance.getEntriesByName) return [];
1890
1897
  let t = [];
1891
- for (let n of Jn) {
1898
+ for (let n of Zn) {
1892
1899
  let r = performance.getEntriesByName(n).filter((e) => e.entryType === "mark").filter((t) => t.detail.sessionId === e);
1893
1900
  t.push(...r);
1894
1901
  }
1895
- return t.map(Xn);
1902
+ return t.map($n);
1896
1903
  }
1897
1904
  //#endregion
1898
1905
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/client.js
1899
- var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
1906
+ var tr = Object.defineProperty, nr = (e, t, n) => t in e ? tr(e, t, {
1900
1907
  enumerable: !0,
1901
1908
  configurable: !0,
1902
1909
  writable: !0,
1903
1910
  value: n
1904
- }) : e[t] = n, Y = (e, t, n) => $n(e, typeof t == "symbol" ? t : t + "", n), er = class {
1911
+ }) : e[t] = n, Y = (e, t, n) => nr(e, typeof t == "symbol" ? t : t + "", n), rr = class {
1905
1912
  constructor(e, t, n) {
1906
1913
  if (Y(this, "address"), Y(this, "state"), Y(this, "requestManager"), Y(this, "webSocketManager"), Y(this, "authenticationManager"), Y(this, "remoteQuerySet"), Y(this, "optimisticQueryResults"), Y(this, "_transitionHandlerCounter", 0), Y(this, "_nextRequestId"), Y(this, "_onTransitionFns", /* @__PURE__ */ new Map()), Y(this, "_sessionId"), Y(this, "firstMessageReceived", !1), Y(this, "debug"), Y(this, "logger"), Y(this, "maxObservedTimestamp"), Y(this, "connectionStateSubscribers", /* @__PURE__ */ new Map()), Y(this, "nextConnectionStateSubscriberId", 0), Y(this, "_lastPublishedConnectionState"), Y(this, "markConnectionStateDirty", () => {
1907
1914
  Promise.resolve().then(() => {
@@ -1912,24 +1919,24 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
1912
1919
  }
1913
1920
  });
1914
1921
  }), Y(this, "mark", (e) => {
1915
- this.debug && Yn(e, this.sessionId);
1922
+ this.debug && Qn(e, this.sessionId);
1916
1923
  }), typeof e == "object") throw Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");
1917
- n?.skipConvexDeploymentUrlCheck !== !0 && Ye(e), n = { ...n };
1924
+ n?.skipConvexDeploymentUrlCheck !== !0 && Qe(e), n = { ...n };
1918
1925
  let r = n.authRefreshTokenLeewaySeconds ?? 10, i = n.webSocketConstructor;
1919
1926
  if (!i && typeof WebSocket > "u") throw Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");
1920
- i ||= WebSocket, this.debug = n.reportDebugInfoToConvex ?? !1, this.address = e, this.logger = n.logger === !1 ? Nt({ verbose: n.verbose ?? !1 }) : n.logger !== !0 && n.logger ? n.logger : Mt({ verbose: n.verbose ?? !1 });
1927
+ i ||= WebSocket, this.debug = n.reportDebugInfoToConvex ?? !1, this.address = e, this.logger = n.logger === !1 ? It({ verbose: n.verbose ?? !1 }) : n.logger !== !0 && n.logger ? n.logger : Ft({ verbose: n.verbose ?? !1 });
1921
1928
  let a = e.search("://");
1922
1929
  if (a === -1) throw Error("Provided address was not an absolute URL.");
1923
1930
  let o = e.substring(a + 3), s = e.substring(0, a), c;
1924
1931
  if (s === "http") c = "ws";
1925
1932
  else if (s === "https") c = "wss";
1926
1933
  else throw Error(`Unknown parent protocol ${s}`);
1927
- let l = `${c}://${o}/api/${Re}/sync`;
1928
- this.state = new Wt(), this.remoteQuerySet = new bn((e) => this.state.queryPath(e), this.logger), this.requestManager = new Jt(this.logger, this.markConnectionStateDirty);
1934
+ let l = `${c}://${o}/api/${Be}/sync`;
1935
+ this.state = new qt(), this.remoteQuerySet = new Cn((e) => this.state.queryPath(e), this.logger), this.requestManager = new Zt(this.logger, this.markConnectionStateDirty);
1929
1936
  let u = () => {
1930
1937
  this.webSocketManager.pause(), this.state.pause();
1931
1938
  };
1932
- this.authenticationManager = new qn(this.state, {
1939
+ this.authenticationManager = new Xn(this.state, {
1933
1940
  authenticate: (e) => {
1934
1941
  let t = this.state.setAuth(e);
1935
1942
  return this.webSocketManager.sendMessage(t), t.baseVersion;
@@ -1944,9 +1951,9 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
1944
1951
  }, {
1945
1952
  logger: this.logger,
1946
1953
  refreshTokenLeewaySeconds: r
1947
- }), this.optimisticQueryResults = new sn(), this.addOnTransitionHandler((e) => {
1954
+ }), this.optimisticQueryResults = new un(), this.addOnTransitionHandler((e) => {
1948
1955
  t(e.queries.map((e) => e.token));
1949
- }), this._nextRequestId = 0, this._sessionId = Ln();
1956
+ }), this._nextRequestId = 0, this._sessionId = Bn();
1950
1957
  let { unsavedChangesWarning: d } = n;
1951
1958
  if (typeof window > "u" || window.addEventListener === void 0) {
1952
1959
  if (d === !0) throw Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.");
@@ -1957,14 +1964,14 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
1957
1964
  return (e || window.event).returnValue = t, t;
1958
1965
  }
1959
1966
  });
1960
- this.webSocketManager = new In(l, {
1967
+ this.webSocketManager = new zn(l, {
1961
1968
  onOpen: (e) => {
1962
1969
  this.mark("convexWebSocketOpen"), this.webSocketManager.sendMessage({
1963
1970
  ...e,
1964
1971
  type: "Connect",
1965
1972
  sessionId: this._sessionId,
1966
1973
  maxObservedTimestamp: this.maxObservedTimestamp
1967
- }), this.remoteQuerySet = new bn((e) => this.state.queryPath(e), this.logger);
1974
+ }), this.remoteQuerySet = new Cn((e) => this.state.queryPath(e), this.logger);
1968
1975
  let [t, n] = this.state.restart();
1969
1976
  n && this.webSocketManager.sendMessage(n), this.webSocketManager.sendMessage(t);
1970
1977
  for (let e of this.requestManager.restart()) this.webSocketManager.sendMessage(e);
@@ -1995,7 +2002,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
1995
2002
  this.authenticationManager.onAuthError(e);
1996
2003
  break;
1997
2004
  case "FatalError": {
1998
- let t = Ft(this.logger, e.error);
2005
+ let t = Rt(this.logger, e.error);
1999
2006
  throw this.webSocketManager.terminate(), t;
2000
2007
  }
2001
2008
  default:
@@ -2053,7 +2060,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2053
2060
  getCurrentAuthClaims() {
2054
2061
  let e = this.state.getAuth(), t = {};
2055
2062
  if (e && e.tokenType === "User") try {
2056
- t = e ? Hn(e.value) : {};
2063
+ t = e ? Gn(e.value) : {};
2057
2064
  } catch {
2058
2065
  t = {};
2059
2066
  }
@@ -2078,7 +2085,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2078
2085
  this.webSocketManager.sendMessage(e);
2079
2086
  }
2080
2087
  subscribe(e, t, n) {
2081
- let r = W(t), { modification: i, queryToken: a, unsubscribe: o } = this.state.subscribe(e, r, n?.journal, n?.componentPath);
2088
+ let r = Ze(t), { modification: i, queryToken: a, unsubscribe: o } = this.state.subscribe(e, r, n?.journal, n?.componentPath);
2082
2089
  return i !== null && this.webSocketManager.sendMessage(i), {
2083
2090
  queryToken: a,
2084
2091
  unsubscribe: () => {
@@ -2088,7 +2095,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2088
2095
  };
2089
2096
  }
2090
2097
  localQueryResult(e, t) {
2091
- let n = zt(e, W(t));
2098
+ let n = Ht(e, Ze(t));
2092
2099
  return this.optimisticQueryResults.queryResult(n);
2093
2100
  }
2094
2101
  localQueryResultByToken(e) {
@@ -2098,11 +2105,11 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2098
2105
  return this.optimisticQueryResults.hasQueryResult(e);
2099
2106
  }
2100
2107
  localQueryLogs(e, t) {
2101
- let n = zt(e, W(t));
2108
+ let n = Ht(e, Ze(t));
2102
2109
  return this.optimisticQueryResults.queryLogs(n);
2103
2110
  }
2104
2111
  queryJournal(e, t) {
2105
- let n = zt(e, W(t));
2112
+ let n = Ht(e, Ze(t));
2106
2113
  return this.state.queryJournal(n);
2107
2114
  }
2108
2115
  connectionState() {
@@ -2126,7 +2133,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2126
2133
  }
2127
2134
  async mutation(e, t, n) {
2128
2135
  let r = await this.mutationInternal(e, t, n);
2129
- if (!r.success) throw r.errorData === void 0 ? Error(It("mutation", e, r)) : Lt(r, new Tt(It("mutation", e, r)));
2136
+ if (!r.success) throw r.errorData === void 0 ? Error(zt("mutation", e, r)) : Bt(r, new Ot(zt("mutation", e, r)));
2130
2137
  return r.value;
2131
2138
  }
2132
2139
  async mutationInternal(e, t, n, r) {
@@ -2134,7 +2141,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2134
2141
  return i;
2135
2142
  }
2136
2143
  enqueueMutation(e, t, n, r) {
2137
- let i = W(t);
2144
+ let i = Ze(t);
2138
2145
  this.tryReportLongDisconnect();
2139
2146
  let a = this.nextRequestId;
2140
2147
  if (this._nextRequestId++, n !== void 0) {
@@ -2168,7 +2175,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2168
2175
  requestId: a,
2169
2176
  udfPath: e,
2170
2177
  componentPath: r,
2171
- args: [vt(i)]
2178
+ args: [xt(i)]
2172
2179
  }, s = this.webSocketManager.sendMessage(o);
2173
2180
  return {
2174
2181
  requestId: a,
@@ -2177,18 +2184,18 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2177
2184
  }
2178
2185
  async action(e, t) {
2179
2186
  let n = await this.actionInternal(e, t);
2180
- if (!n.success) throw n.errorData === void 0 ? Error(It("action", e, n)) : Lt(n, new Tt(It("action", e, n)));
2187
+ if (!n.success) throw n.errorData === void 0 ? Error(zt("action", e, n)) : Bt(n, new Ot(zt("action", e, n)));
2181
2188
  return n.value;
2182
2189
  }
2183
2190
  async actionInternal(e, t, n) {
2184
- let r = W(t), i = this.nextRequestId;
2191
+ let r = Ze(t), i = this.nextRequestId;
2185
2192
  this._nextRequestId++, this.tryReportLongDisconnect();
2186
2193
  let a = {
2187
2194
  type: "Action",
2188
2195
  requestId: i,
2189
2196
  udfPath: e,
2190
2197
  componentPath: n,
2191
- args: [vt(r)]
2198
+ args: [xt(r)]
2192
2199
  }, o = this.webSocketManager.sendMessage(a);
2193
2200
  return this.requestManager.request(a, o);
2194
2201
  }
@@ -2206,7 +2213,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2206
2213
  }
2207
2214
  reportMarks() {
2208
2215
  if (this.debug) {
2209
- let e = Zn(this.sessionId);
2216
+ let e = er(this.sessionId);
2210
2217
  this.webSocketManager.sendMessage({
2211
2218
  type: "Event",
2212
2219
  eventType: "ClientConnect",
@@ -2223,7 +2230,7 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2223
2230
  method: "POST",
2224
2231
  headers: {
2225
2232
  "Content-Type": "application/json",
2226
- "Convex-Client": `npm-${Re}`
2233
+ "Convex-Client": `npm-${Be}`
2227
2234
  },
2228
2235
  body: JSON.stringify({ event: "LongWebsocketDisconnect" })
2229
2236
  }).then((e) => {
@@ -2235,23 +2242,23 @@ var Qn = Object.defineProperty, $n = (e, t, n) => t in e ? Qn(e, t, {
2235
2242
  };
2236
2243
  //#endregion
2237
2244
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/pagination.js
2238
- function tr(e) {
2245
+ function ir(e) {
2239
2246
  if (typeof e != "object" || !e || !Array.isArray(e.page) || typeof e.isDone != "boolean" || typeof e.continueCursor != "string") throw Error(`Not a valid paginated query result: ${e?.toString()}`);
2240
2247
  return e;
2241
2248
  }
2242
2249
  //#endregion
2243
2250
  //#region ../../node_modules/.pnpm/convex@1.38.0_react@19.2.6/node_modules/convex/dist/esm/browser/sync/paginated_query_client.js
2244
- var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2251
+ var ar = Object.defineProperty, or = (e, t, n) => t in e ? ar(e, t, {
2245
2252
  enumerable: !0,
2246
2253
  configurable: !0,
2247
2254
  writable: !0,
2248
2255
  value: n
2249
- }) : e[t] = n, ir = (e, t, n) => rr(e, typeof t == "symbol" ? t : t + "", n), ar = class {
2256
+ }) : e[t] = n, sr = (e, t, n) => or(e, typeof t == "symbol" ? t : t + "", n), cr = class {
2250
2257
  constructor(e, t) {
2251
- this.client = e, this.onTransition = t, ir(this, "paginatedQuerySet", /* @__PURE__ */ new Map()), ir(this, "lastTransitionTs"), this.lastTransitionTs = dn.fromNumber(0), this.client.addOnTransitionHandler((e) => this.onBaseTransition(e));
2258
+ this.client = e, this.onTransition = t, sr(this, "paginatedQuerySet", /* @__PURE__ */ new Map()), sr(this, "lastTransitionTs"), this.lastTransitionTs = mn.fromNumber(0), this.client.addOnTransitionHandler((e) => this.onBaseTransition(e));
2252
2259
  }
2253
2260
  subscribe(e, t, n) {
2254
- let r = Rt(e), i = Bt(r, t, n), a = () => this.removePaginatedQuerySubscriber(i), o = this.paginatedQuerySet.get(i);
2261
+ let r = Vt(e), i = Ut(r, t, n), a = () => this.removePaginatedQuerySubscriber(i), o = this.paginatedQuerySet.get(i);
2255
2262
  return o ? (o.numSubscribers += 1, {
2256
2263
  paginatedQueryToken: i,
2257
2264
  unsubscribe: a
@@ -2273,7 +2280,7 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2273
2280
  });
2274
2281
  }
2275
2282
  localQueryResult(e, t, n) {
2276
- let r = Bt(Rt(e), t, n);
2283
+ let r = Ut(Vt(e), t, n);
2277
2284
  return this.localQueryResultByToken(r);
2278
2285
  }
2279
2286
  localQueryResultByToken(e) {
@@ -2292,7 +2299,7 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2292
2299
  i = !0, a = !1;
2293
2300
  continue;
2294
2301
  }
2295
- let n = tr(t);
2302
+ let n = ir(t);
2296
2303
  r = r.concat(n.page), a = !!n.isDone;
2297
2304
  }
2298
2305
  let o;
@@ -2321,7 +2328,7 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2321
2328
  this.mustGetPaginatedQuery(e);
2322
2329
  let n = this.queryTokenForLastPageOfPaginatedQuery(e), r = this.client.localQueryResultByToken(n);
2323
2330
  if (!r) return !1;
2324
- let i = tr(r);
2331
+ let i = ir(r);
2325
2332
  if (i.isDone) return !1;
2326
2333
  this.addPageToPaginatedQuery(e, i.continueCursor, t);
2327
2334
  let a = {
@@ -2355,7 +2362,7 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2355
2362
  if (r.has(n)) continue;
2356
2363
  let a = i.get(n).queryToken, o = t(a);
2357
2364
  if (!o) continue;
2358
- let s = tr(o);
2365
+ let s = ir(o);
2359
2366
  s.splitCursor && (s.pageStatus === "SplitRecommended" || s.pageStatus === "SplitRequired" || s.page.length > e.options.initialNumItems * 2) && this.splitPaginatedQueryPage(e, n, s.splitCursor, s.continueCursor);
2360
2367
  }
2361
2368
  }
@@ -2424,16 +2431,16 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2424
2431
  if (!t) throw Error("paginated query no longer exists for token " + e);
2425
2432
  return t;
2426
2433
  }
2427
- }, or = Object.defineProperty, sr = (e, t, n) => t in e ? or(e, t, {
2434
+ }, lr = Object.defineProperty, ur = (e, t, n) => t in e ? lr(e, t, {
2428
2435
  enumerable: !0,
2429
2436
  configurable: !0,
2430
2437
  writable: !0,
2431
2438
  value: n
2432
- }) : e[t] = n, cr = (e, t, n) => sr(e, typeof t == "symbol" ? t : t + "", n), lr, ur = class {
2439
+ }) : e[t] = n, dr = (e, t, n) => ur(e, typeof t == "symbol" ? t : t + "", n), fr, pr = class {
2433
2440
  constructor(e, t = {}) {
2434
- cr(this, "listeners"), cr(this, "_client"), cr(this, "_paginatedClient"), cr(this, "callNewListenersWithCurrentValuesTimer"), cr(this, "_closed"), cr(this, "_disabled"), t.skipConvexDeploymentUrlCheck !== !0 && Ye(e);
2441
+ dr(this, "listeners"), dr(this, "_client"), dr(this, "_paginatedClient"), dr(this, "callNewListenersWithCurrentValuesTimer"), dr(this, "_closed"), dr(this, "_disabled"), t.skipConvexDeploymentUrlCheck !== !0 && Qe(e);
2435
2442
  let { disabled: n, ...r } = t;
2436
- this._closed = !1, this._disabled = !!n, lr && !("webSocketConstructor" in r) && typeof WebSocket > "u" && (r.webSocketConstructor = lr), typeof window > "u" && !("unsavedChangesWarning" in r) && (r.unsavedChangesWarning = !1), this.disabled || (this._client = new er(e, () => {}, r), this._paginatedClient = new ar(this._client, (e) => this._transition(e))), this.listeners = /* @__PURE__ */ new Set();
2443
+ this._closed = !1, this._disabled = !!n, fr && !("webSocketConstructor" in r) && typeof WebSocket > "u" && (r.webSocketConstructor = fr), typeof window > "u" && !("unsavedChangesWarning" in r) && (r.unsavedChangesWarning = !1), this.disabled || (this._client = new rr(e, () => {}, r), this._paginatedClient = new cr(this._client, (e) => this._transition(e))), this.listeners = /* @__PURE__ */ new Set();
2437
2444
  }
2438
2445
  get closed() {
2439
2446
  return this._closed;
@@ -2529,7 +2536,7 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2529
2536
  _transition({ queries: e, paginatedQueries: t }, n = !1) {
2530
2537
  let r = [...e.map((e) => e.token), ...t.map((e) => e.token)];
2531
2538
  for (let e of this.listeners) {
2532
- let { callback: t, queryToken: i, onError: a, hasEverRun: o } = e, s = Vt(i), c = s ? !!this.paginatedClient.localQueryResultByToken(i) : this.client.hasLocalQueryResultByToken(i);
2539
+ let { callback: t, queryToken: i, onError: a, hasEverRun: o } = e, s = Wt(i), c = s ? !!this.paginatedClient.localQueryResultByToken(i) : this.client.hasLocalQueryResultByToken(i);
2533
2540
  if (r.includes(i) || n && !o && c) {
2534
2541
  e.hasEverRun = !0;
2535
2542
  let n;
@@ -2573,14 +2580,14 @@ var nr = Object.defineProperty, rr = (e, t, n) => t in e ? nr(e, t, {
2573
2580
  };
2574
2581
  //#endregion
2575
2582
  //#region src/lib/machine.ts
2576
- function dr(e) {
2583
+ function mr(e) {
2577
2584
  return e;
2578
2585
  }
2579
- function fr(e, t) {
2580
- let n = B(e);
2586
+ function hr(e, t) {
2587
+ let n = V(e);
2581
2588
  n.current = e;
2582
- let [r, i] = R(() => typeof t == "function" ? t() : t);
2583
- return [r, V((e) => {
2589
+ let [r, i] = z(() => typeof t == "function" ? t() : t);
2590
+ return [r, H((e) => {
2584
2591
  i((t) => {
2585
2592
  let r = n.current[t.kind]?.[e.type];
2586
2593
  return r ? r(t, e) : t;
@@ -2589,7 +2596,7 @@ function fr(e, t) {
2589
2596
  }
2590
2597
  //#endregion
2591
2598
  //#region src/lib/use-async-action.ts
2592
- var pr = dr({
2599
+ var gr = mr({
2593
2600
  idle: { start: () => ({ kind: "pending" }) },
2594
2601
  pending: {
2595
2602
  success: (e, t) => ({
@@ -2610,10 +2617,10 @@ var pr = dr({
2610
2617
  reset: () => ({ kind: "idle" })
2611
2618
  }
2612
2619
  });
2613
- function mr() {
2614
- let [e, t] = fr(pr, { kind: "idle" }), n = e, r = B(n);
2620
+ function _r() {
2621
+ let [e, t] = hr(gr, { kind: "idle" }), n = e, r = V(n);
2615
2622
  r.current = n;
2616
- let i = V(async (e, n) => {
2623
+ let i = H(async (e, n) => {
2617
2624
  if (r.current.kind !== "pending") {
2618
2625
  t({ type: "start" });
2619
2626
  try {
@@ -2631,7 +2638,7 @@ function mr() {
2631
2638
  return;
2632
2639
  }
2633
2640
  }
2634
- }, [t]), a = V(() => t({ type: "reset" }), [t]);
2641
+ }, [t]), a = H(() => t({ type: "reset" }), [t]);
2635
2642
  return {
2636
2643
  state: n,
2637
2644
  isIdle: n.kind === "idle",
@@ -2646,37 +2653,37 @@ function mr() {
2646
2653
  }
2647
2654
  //#endregion
2648
2655
  //#region ../../node_modules/.pnpm/@medv+finder@4.0.2/node_modules/@medv/finder/finder.js
2649
- var hr = new Set([
2656
+ var vr = new Set([
2650
2657
  "role",
2651
2658
  "name",
2652
2659
  "aria-label",
2653
2660
  "rel",
2654
2661
  "href"
2655
2662
  ]);
2656
- function gr(e, t) {
2657
- let n = hr.has(e);
2658
- n ||= e.startsWith("data-") && Sr(e);
2659
- let r = Sr(t) && t.length < 100;
2660
- return r ||= t.startsWith("#") && Sr(t.slice(1)), n && r;
2663
+ function yr(e, t) {
2664
+ let n = vr.has(e);
2665
+ n ||= e.startsWith("data-") && Tr(e);
2666
+ let r = Tr(t) && t.length < 100;
2667
+ return r ||= t.startsWith("#") && Tr(t.slice(1)), n && r;
2661
2668
  }
2662
- function _r(e) {
2663
- return Sr(e);
2669
+ function br(e) {
2670
+ return Tr(e);
2664
2671
  }
2665
- function vr(e) {
2666
- return Sr(e);
2672
+ function xr(e) {
2673
+ return Tr(e);
2667
2674
  }
2668
- function yr(e) {
2675
+ function Sr(e) {
2669
2676
  return !0;
2670
2677
  }
2671
- function br(e, t) {
2678
+ function Cr(e, t) {
2672
2679
  if (e.nodeType !== Node.ELEMENT_NODE) throw Error("Can't generate CSS selector for non-element node type.");
2673
2680
  if (e.tagName.toLowerCase() === "html") return "html";
2674
2681
  let n = {
2675
2682
  root: document.body,
2676
- idName: _r,
2677
- className: vr,
2678
- tagName: yr,
2679
- attr: gr,
2683
+ idName: br,
2684
+ className: xr,
2685
+ tagName: Sr,
2686
+ attr: yr,
2680
2687
  timeoutMs: 1e3,
2681
2688
  seedMinLength: 3,
2682
2689
  optimizedMinLength: 2,
@@ -2684,37 +2691,37 @@ function br(e, t) {
2684
2691
  }, r = /* @__PURE__ */ new Date(), i = {
2685
2692
  ...n,
2686
2693
  ...t
2687
- }, a = Mr(i.root, n), o, s = 0;
2688
- for (let t of xr(e, i, a)) {
2694
+ }, a = Fr(i.root, n), o, s = 0;
2695
+ for (let t of wr(e, i, a)) {
2689
2696
  if ((/* @__PURE__ */ new Date()).getTime() - r.getTime() > i.timeoutMs || s >= i.maxNumberOfPathChecks) {
2690
- let t = Or(e, a);
2697
+ let t = jr(e, a);
2691
2698
  if (!t) throw Error(`Timeout: Can't find a unique selector after ${i.timeoutMs}ms`);
2692
- return wr(t);
2699
+ return Dr(t);
2693
2700
  }
2694
- if (s++, Nr(t, a)) {
2701
+ if (s++, Ir(t, a)) {
2695
2702
  o = t;
2696
2703
  break;
2697
2704
  }
2698
2705
  }
2699
2706
  if (!o) throw Error("Selector was not found.");
2700
- let c = [...Pr(o, e, i, a, r)];
2701
- return c.sort(Er), c.length > 0 ? wr(c[0]) : wr(o);
2707
+ let c = [...Lr(o, e, i, a, r)];
2708
+ return c.sort(kr), c.length > 0 ? Dr(c[0]) : Dr(o);
2702
2709
  }
2703
- function* xr(e, t, n) {
2710
+ function* wr(e, t, n) {
2704
2711
  let r = [], i = [], a = e, o = 0;
2705
2712
  for (; a && a !== n;) {
2706
- let e = Cr(a, t);
2713
+ let e = Er(a, t);
2707
2714
  for (let t of e) t.level = o;
2708
- if (r.push(e), a = a.parentElement, o++, i.push(...jr(r)), o >= t.seedMinLength) {
2709
- i.sort(Er);
2715
+ if (r.push(e), a = a.parentElement, o++, i.push(...Pr(r)), o >= t.seedMinLength) {
2716
+ i.sort(kr);
2710
2717
  for (let e of i) yield e;
2711
2718
  i = [];
2712
2719
  }
2713
2720
  }
2714
- i.sort(Er);
2721
+ i.sort(kr);
2715
2722
  for (let e of i) yield e;
2716
2723
  }
2717
- function Sr(e) {
2724
+ function Tr(e) {
2718
2725
  if (/^[a-z\-]{3,}$/i.test(e)) {
2719
2726
  let t = e.split(/-|[A-Z]/);
2720
2727
  for (let e of t) if (e.length <= 2 || /[^aeiou]{4,}/i.test(e)) return !1;
@@ -2722,7 +2729,7 @@ function Sr(e) {
2722
2729
  }
2723
2730
  return !1;
2724
2731
  }
2725
- function Cr(e, t) {
2732
+ function Er(e, t) {
2726
2733
  let n = [], r = e.getAttribute("id");
2727
2734
  r && t.idName(r) && n.push({
2728
2735
  name: "#" + CSS.escape(r),
@@ -2748,19 +2755,19 @@ function Cr(e, t) {
2748
2755
  name: i,
2749
2756
  penalty: 5
2750
2757
  });
2751
- let t = Dr(e, i);
2758
+ let t = Ar(e, i);
2752
2759
  t !== void 0 && n.push({
2753
- name: Ar(i, t),
2760
+ name: Nr(i, t),
2754
2761
  penalty: 10
2755
2762
  });
2756
2763
  }
2757
- let a = Dr(e);
2764
+ let a = Ar(e);
2758
2765
  return a !== void 0 && n.push({
2759
- name: kr(i, a),
2766
+ name: Mr(i, a),
2760
2767
  penalty: 50
2761
2768
  }), n;
2762
2769
  }
2763
- function wr(e) {
2770
+ function Dr(e) {
2764
2771
  let t = e[0], n = t.name;
2765
2772
  for (let r = 1; r < e.length; r++) {
2766
2773
  let i = e[r].level || 0;
@@ -2768,13 +2775,13 @@ function wr(e) {
2768
2775
  }
2769
2776
  return n;
2770
2777
  }
2771
- function Tr(e) {
2778
+ function Or(e) {
2772
2779
  return e.map((e) => e.penalty).reduce((e, t) => e + t, 0);
2773
2780
  }
2774
- function Er(e, t) {
2775
- return Tr(e) - Tr(t);
2781
+ function kr(e, t) {
2782
+ return Or(e) - Or(t);
2776
2783
  }
2777
- function Dr(e, t) {
2784
+ function Ar(e, t) {
2778
2785
  let n = e.parentNode;
2779
2786
  if (!n) return;
2780
2787
  let r = n.firstChild;
@@ -2783,51 +2790,51 @@ function Dr(e, t) {
2783
2790
  for (; r && (r.nodeType === Node.ELEMENT_NODE && (t === void 0 || r.tagName.toLowerCase() === t) && i++, r !== e);) r = r.nextSibling;
2784
2791
  return i;
2785
2792
  }
2786
- function Or(e, t) {
2793
+ function jr(e, t) {
2787
2794
  let n = 0, r = e, i = [];
2788
2795
  for (; r && r !== t;) {
2789
- let e = r.tagName.toLowerCase(), t = Dr(r, e);
2796
+ let e = r.tagName.toLowerCase(), t = Ar(r, e);
2790
2797
  if (t === void 0) return;
2791
2798
  i.push({
2792
- name: Ar(e, t),
2799
+ name: Nr(e, t),
2793
2800
  penalty: NaN,
2794
2801
  level: n
2795
2802
  }), r = r.parentElement, n++;
2796
2803
  }
2797
- if (Nr(i, t)) return i;
2804
+ if (Ir(i, t)) return i;
2798
2805
  }
2799
- function kr(e, t) {
2806
+ function Mr(e, t) {
2800
2807
  return e === "html" ? "html" : `${e}:nth-child(${t})`;
2801
2808
  }
2802
- function Ar(e, t) {
2809
+ function Nr(e, t) {
2803
2810
  return e === "html" ? "html" : `${e}:nth-of-type(${t})`;
2804
2811
  }
2805
- function* jr(e, t = []) {
2806
- if (e.length > 0) for (let n of e[0]) yield* jr(e.slice(1, e.length), t.concat(n));
2812
+ function* Pr(e, t = []) {
2813
+ if (e.length > 0) for (let n of e[0]) yield* Pr(e.slice(1, e.length), t.concat(n));
2807
2814
  else yield t;
2808
2815
  }
2809
- function Mr(e, t) {
2816
+ function Fr(e, t) {
2810
2817
  return e.nodeType === Node.DOCUMENT_NODE ? e : e === t.root ? e.ownerDocument : e;
2811
2818
  }
2812
- function Nr(e, t) {
2813
- let n = wr(e);
2819
+ function Ir(e, t) {
2820
+ let n = Dr(e);
2814
2821
  switch (t.querySelectorAll(n).length) {
2815
2822
  case 0: throw Error(`Can't select any node with this selector: ${n}`);
2816
2823
  case 1: return !0;
2817
2824
  default: return !1;
2818
2825
  }
2819
2826
  }
2820
- function* Pr(e, t, n, r, i) {
2827
+ function* Lr(e, t, n, r, i) {
2821
2828
  if (e.length > 2 && e.length > n.optimizedMinLength) for (let a = 1; a < e.length - 1; a++) {
2822
2829
  if ((/* @__PURE__ */ new Date()).getTime() - i.getTime() > n.timeoutMs) return;
2823
2830
  let o = [...e];
2824
- o.splice(a, 1), Nr(o, r) && r.querySelector(wr(o)) === t && (yield o, yield* Pr(o, t, n, r, i));
2831
+ o.splice(a, 1), Ir(o, r) && r.querySelector(Dr(o)) === t && (yield o, yield* Lr(o, t, n, r, i));
2825
2832
  }
2826
2833
  }
2827
2834
  //#endregion
2828
2835
  //#region src/runtime/anchor.ts
2829
- function Fr(e, t) {
2830
- let n = document.documentElement, r = Math.max(n.scrollWidth, n.clientWidth), i = Math.max(n.scrollHeight, n.clientHeight), a = e.clientX + window.scrollX, o = e.clientY + window.scrollY, s = t === void 0 ? e.target instanceof Element ? e.target : null : t, c = s ? Lr(s) : void 0, l, u;
2836
+ function Rr(e, t) {
2837
+ let n = document.documentElement, r = Math.max(n.scrollWidth, n.clientWidth), i = Math.max(n.scrollHeight, n.clientHeight), a = e.clientX + window.scrollX, o = e.clientY + window.scrollY, s = t === void 0 ? e.target instanceof Element ? e.target : null : t, c = s ? Br(s) : void 0, l, u;
2831
2838
  if (s) {
2832
2839
  let t = s.getBoundingClientRect();
2833
2840
  t.width > 0 && t.height > 0 && (l = Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)), u = Math.max(0, Math.min(1, (e.clientY - t.top) / t.height)));
@@ -2842,7 +2849,7 @@ function Fr(e, t) {
2842
2849
  anchorOffsetY: u
2843
2850
  };
2844
2851
  }
2845
- function Ir(e) {
2852
+ function zr(e) {
2846
2853
  if (e.anchorSelector) try {
2847
2854
  let t = document.querySelector(e.anchorSelector);
2848
2855
  if (t) {
@@ -2861,93 +2868,164 @@ function Ir(e) {
2861
2868
  resolved: !1
2862
2869
  };
2863
2870
  }
2864
- function Lr(e) {
2871
+ function Br(e) {
2865
2872
  try {
2866
- return br(e, { timeoutMs: 1e3 });
2873
+ return Cr(e, { timeoutMs: 1e3 });
2867
2874
  } catch {
2868
2875
  return;
2869
2876
  }
2870
2877
  }
2871
2878
  //#endregion
2872
2879
  //#region src/runtime/api.ts
2873
- var Rr = class extends Error {
2880
+ var Vr = class extends Error {
2874
2881
  status;
2875
2882
  constructor(e, t) {
2876
2883
  super(e), this.name = "WidgetApiError", this.status = t;
2877
2884
  }
2878
- };
2879
- function zr(e) {
2885
+ }, Hr = class extends Vr {
2886
+ category;
2887
+ constructor(e, t) {
2888
+ super(`${e} took too long — check your connection`, 0), this.name = "WidgetTimeoutError", this.category = t;
2889
+ }
2890
+ }, Ur = 15e3, Wr = 3e4;
2891
+ function Gr(e, t) {
2892
+ let n = AbortSignal.timeout(e);
2893
+ return t ? AbortSignal.any([t, n]) : n;
2894
+ }
2895
+ function Kr(e) {
2880
2896
  let t = e.apiUrl.replace(/\/+$/, "");
2881
- async function n(n, r = {}) {
2882
- let i = {
2897
+ async function n(n, r, i) {
2898
+ let a = {
2883
2899
  "content-type": "application/json",
2884
2900
  "x-markup-api-key": e.apiKey,
2885
2901
  ...r.headers ?? {}
2886
- }, a = e.getToken?.() ?? null, o = a != null && a.token.length > 0 && a.expiresAt > Date.now();
2887
- o && a && (i.authorization = `Bearer ${a.token}`);
2888
- let s = e.getAnonToken?.() ?? null;
2889
- s && (i["x-markup-anon-token"] = s);
2890
- let c = e.getStorageMode?.() === "cookies", l = {
2902
+ }, o = e.getToken?.() ?? null, s = o != null && o.token.length > 0 && o.expiresAt > Date.now();
2903
+ s && o && (a.authorization = `Bearer ${o.token}`);
2904
+ let c = e.getAnonToken?.() ?? null;
2905
+ c && (a["x-markup-anon-token"] = c);
2906
+ let l = e.getStorageMode?.() === "cookies", u = {
2891
2907
  ...r,
2892
- headers: i
2908
+ headers: a,
2909
+ signal: Gr(i.timeoutMs, i.signal)
2893
2910
  };
2894
- c && (l.credentials = "include");
2895
- let u = await fetch(`${t}${n}`, l), d = await u.text(), f = d ? Br(d) : null;
2896
- if (!u.ok) throw u.status === 401 && (o || c) && e.onUnauthorized?.(), new Rr((f && typeof f == "object" && "error" in f && typeof f.error == "string" ? f.error : null) ?? `Request failed with ${u.status}`, u.status);
2897
- return f;
2911
+ l && (u.credentials = "include");
2912
+ let d;
2913
+ try {
2914
+ d = await fetch(`${t}${n}`, u);
2915
+ } catch (e) {
2916
+ throw e instanceof DOMException && e.name === "TimeoutError" ? new Hr(i.operation, i.category) : e;
2917
+ }
2918
+ let f = await d.text(), p = f ? qr(f) : null;
2919
+ if (!d.ok) throw d.status === 401 && (s || l) && e.onUnauthorized?.(), new Vr((p && typeof p == "object" && "error" in p && typeof p.error == "string" ? p.error : null) ?? `Request failed with ${d.status}`, d.status);
2920
+ return p;
2898
2921
  }
2899
2922
  return {
2900
- mintAnonIdentity() {
2901
- return n("/widget/anon-identity", { method: "POST" });
2923
+ mintAnonIdentity(e) {
2924
+ return n("/widget/anon-identity", { method: "POST" }, {
2925
+ timeoutMs: Ur,
2926
+ category: "read",
2927
+ operation: "mint-anon-identity",
2928
+ signal: e?.signal
2929
+ });
2902
2930
  },
2903
- getSubscriptionToken() {
2904
- return n("/widget/subscription-token", { method: "POST" });
2931
+ getSubscriptionToken(e) {
2932
+ return n("/widget/subscription-token", { method: "POST" }, {
2933
+ timeoutMs: Ur,
2934
+ category: "read",
2935
+ operation: "mint-subscription-token",
2936
+ signal: e?.signal
2937
+ });
2905
2938
  },
2906
- getScreenshotUploadUrl() {
2907
- return n("/widget/screenshots/upload-url", { method: "POST" });
2939
+ getScreenshotUploadUrl(e) {
2940
+ return n("/widget/screenshots/upload-url", { method: "POST" }, {
2941
+ timeoutMs: Ur,
2942
+ category: "read",
2943
+ operation: "mint-screenshot-upload-url",
2944
+ signal: e?.signal
2945
+ });
2908
2946
  },
2909
- listThreads(e) {
2910
- return n(`/widget/threads?route=${encodeURIComponent(e)}`, { method: "GET" });
2947
+ listThreads(e, t) {
2948
+ return n(`/widget/threads?route=${encodeURIComponent(e)}`, { method: "GET" }, {
2949
+ timeoutMs: Ur,
2950
+ category: "read",
2951
+ operation: "list-threads",
2952
+ signal: t?.signal
2953
+ });
2911
2954
  },
2912
- createThread(e) {
2955
+ createThread(e, t) {
2913
2956
  return n("/widget/threads", {
2914
2957
  method: "POST",
2915
2958
  body: JSON.stringify(e)
2959
+ }, {
2960
+ timeoutMs: Wr,
2961
+ category: "write",
2962
+ operation: "create-thread",
2963
+ signal: t?.signal
2916
2964
  });
2917
2965
  },
2918
- deleteThread(e) {
2919
- return n(`/widget/threads/${encodeURIComponent(e)}`, { method: "DELETE" });
2966
+ deleteThread(e, t) {
2967
+ return n(`/widget/threads/${encodeURIComponent(e)}`, { method: "DELETE" }, {
2968
+ timeoutMs: Wr,
2969
+ category: "write",
2970
+ operation: "delete-thread",
2971
+ signal: t?.signal
2972
+ });
2920
2973
  },
2921
- resolveThread(e, t) {
2974
+ resolveThread(e, t, r) {
2922
2975
  return n(`/widget/threads/${encodeURIComponent(e)}`, {
2923
2976
  method: "PATCH",
2924
2977
  body: JSON.stringify({ resolvedBy: t })
2978
+ }, {
2979
+ timeoutMs: Wr,
2980
+ category: "write",
2981
+ operation: "resolve-thread",
2982
+ signal: r?.signal
2925
2983
  });
2926
2984
  },
2927
- addComment(e, t) {
2985
+ addComment(e, t, r) {
2928
2986
  return n(`/widget/threads/${encodeURIComponent(e)}/comments`, {
2929
2987
  method: "POST",
2930
2988
  body: JSON.stringify(t)
2989
+ }, {
2990
+ timeoutMs: Wr,
2991
+ category: "write",
2992
+ operation: "add-comment",
2993
+ signal: r?.signal
2931
2994
  });
2932
2995
  },
2933
- editComment(e, t, r) {
2996
+ editComment(e, t, r, i) {
2934
2997
  return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, {
2935
2998
  method: "PATCH",
2936
2999
  body: JSON.stringify(r)
3000
+ }, {
3001
+ timeoutMs: Wr,
3002
+ category: "write",
3003
+ operation: "edit-comment",
3004
+ signal: i?.signal
2937
3005
  });
2938
3006
  },
2939
- deleteComment(e, t) {
2940
- return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, { method: "DELETE" });
3007
+ deleteComment(e, t, r) {
3008
+ return n(`/widget/threads/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`, { method: "DELETE" }, {
3009
+ timeoutMs: Wr,
3010
+ category: "write",
3011
+ operation: "delete-comment",
3012
+ signal: r?.signal
3013
+ });
2941
3014
  },
2942
- toggleReaction(e, t) {
3015
+ toggleReaction(e, t, r) {
2943
3016
  return n(`/widget/comments/${encodeURIComponent(e)}/reactions`, {
2944
3017
  method: "POST",
2945
3018
  body: JSON.stringify(t)
3019
+ }, {
3020
+ timeoutMs: Wr,
3021
+ category: "write",
3022
+ operation: "toggle-reaction",
3023
+ signal: r?.signal
2946
3024
  });
2947
3025
  }
2948
3026
  };
2949
3027
  }
2950
- function Br(e) {
3028
+ function qr(e) {
2951
3029
  try {
2952
3030
  return JSON.parse(e);
2953
3031
  } catch {
@@ -2956,10 +3034,10 @@ function Br(e) {
2956
3034
  }
2957
3035
  //#endregion
2958
3036
  //#region src/runtime/cookie-probe.ts
2959
- var Vr = "markup.cookieProbe";
2960
- async function Hr(e, t) {
3037
+ var Jr = "markup.cookieProbe";
3038
+ async function Yr(e, t) {
2961
3039
  try {
2962
- let e = sessionStorage.getItem(Vr);
3040
+ let e = sessionStorage.getItem(Jr);
2963
3041
  if (e === "supported") return !0;
2964
3042
  if (e === "unsupported") return !1;
2965
3043
  } catch {}
@@ -2978,57 +3056,63 @@ async function Hr(e, t) {
2978
3056
  if (!e.ok) return !1;
2979
3057
  let { supported: t } = await e.json(), i = t === !0;
2980
3058
  try {
2981
- sessionStorage.setItem(Vr, i ? "supported" : "unsupported");
3059
+ sessionStorage.setItem(Jr, i ? "supported" : "unsupported");
2982
3060
  } catch {}
2983
3061
  return i;
2984
- } catch {
2985
- return !1;
3062
+ } catch (e) {
3063
+ return e?.name !== "TypeError" && F(e, { context: "cookie-probe" }), !1;
2986
3064
  }
2987
3065
  }
2988
3066
  //#endregion
2989
3067
  //#region src/runtime/history-observer.ts
2990
- var Ur = "__markup_history_observer__", Wr = "__markup_history_listeners__";
2991
- function Gr(e) {
2992
- e.forEach((e) => e());
3068
+ var Xr = "__markup_history_observer__", Zr = "__markup_history_listeners__";
3069
+ function Qr(e) {
3070
+ e.forEach((e) => {
3071
+ try {
3072
+ e();
3073
+ } catch (e) {
3074
+ F(e, { context: "history-observer-listener" });
3075
+ }
3076
+ });
2993
3077
  }
2994
- function Kr() {
3078
+ function $r() {
2995
3079
  let e = history.pushState;
2996
- if (e[Ur]) return e[Wr];
3080
+ if (e[Xr]) return e[Zr];
2997
3081
  let t = /* @__PURE__ */ new Set(), n = history.pushState, r = history.replaceState;
2998
3082
  function i(...e) {
2999
- n.apply(this, e), Gr(t);
3083
+ n.apply(this, e), Qr(t);
3000
3084
  }
3001
3085
  function a(...e) {
3002
- r.apply(this, e), Gr(t);
3086
+ r.apply(this, e), Qr(t);
3003
3087
  }
3004
- return Object.defineProperty(i, Ur, { value: 1 }), Object.defineProperty(i, Wr, { value: t }), Object.defineProperty(a, Ur, { value: 1 }), history.pushState = i, history.replaceState = a, window.addEventListener("popstate", () => Gr(t)), t;
3088
+ return Object.defineProperty(i, Xr, { value: 1 }), Object.defineProperty(i, Zr, { value: t }), Object.defineProperty(a, Xr, { value: 1 }), history.pushState = i, history.replaceState = a, window.addEventListener("popstate", () => Qr(t)), t;
3005
3089
  }
3006
- var qr = null;
3007
- function Jr(e) {
3008
- return qr ||= Kr(), qr.add(e), () => qr.delete(e);
3090
+ var ei = null;
3091
+ function ti(e) {
3092
+ return ei ||= $r(), ei.add(e), () => ei.delete(e);
3009
3093
  }
3010
3094
  //#endregion
3011
3095
  //#region src/runtime/identity-store.ts
3012
- var Yr = "markup.identity";
3013
- function Xr() {
3096
+ var ni = "markup.identity";
3097
+ function ri() {
3014
3098
  try {
3015
- let e = localStorage.getItem(Yr);
3099
+ let e = localStorage.getItem(ni);
3016
3100
  return e ? JSON.parse(e) : null;
3017
3101
  } catch {
3018
3102
  return null;
3019
3103
  }
3020
3104
  }
3021
- function Zr(e) {
3105
+ function ii(e) {
3022
3106
  try {
3023
3107
  if (e == null) {
3024
- localStorage.removeItem(Yr);
3108
+ localStorage.removeItem(ni);
3025
3109
  return;
3026
3110
  }
3027
- localStorage.setItem(Yr, JSON.stringify(e));
3111
+ localStorage.setItem(ni, JSON.stringify(e));
3028
3112
  } catch {}
3029
3113
  }
3030
- function Qr() {
3031
- let e = Xr(), t = {
3114
+ function ai() {
3115
+ let e = ri(), t = {
3032
3116
  name: e?.name,
3033
3117
  email: e?.email
3034
3118
  };
@@ -3088,10 +3172,10 @@ function Qr() {
3088
3172
  preserved: t
3089
3173
  };
3090
3174
  }
3091
- function $r(e) {
3175
+ function oi(e) {
3092
3176
  switch (e.kind) {
3093
3177
  case "verified":
3094
- Zr({
3178
+ ii({
3095
3179
  clientId: e.identity.clientId,
3096
3180
  storage: e.identity.storage,
3097
3181
  token: e.identity.storage === "cookies" ? void 0 : e.identity.token,
@@ -3104,7 +3188,7 @@ function $r(e) {
3104
3188
  });
3105
3189
  return;
3106
3190
  case "anon":
3107
- Zr({
3191
+ ii({
3108
3192
  clientId: e.identity.clientId,
3109
3193
  anonToken: e.identity.anonToken,
3110
3194
  name: e.identity.name,
@@ -3112,23 +3196,23 @@ function $r(e) {
3112
3196
  });
3113
3197
  return;
3114
3198
  case "recovering":
3115
- Zr({
3199
+ ii({
3116
3200
  name: e.preserved.name,
3117
3201
  email: e.preserved.email
3118
3202
  });
3119
3203
  return;
3120
3204
  case "unresolved":
3121
- Zr(null);
3205
+ ii(null);
3122
3206
  return;
3123
3207
  }
3124
3208
  }
3125
- function ei(e) {
3209
+ function si(e) {
3126
3210
  if (e.kind === "anon" || e.kind === "verified") return e.identity.clientId;
3127
3211
  }
3128
- function ti(e) {
3212
+ function ci(e) {
3129
3213
  return e.kind === "anon" ? e.identity.name ?? null : e.kind === "verified" ? e.identity.name : null;
3130
3214
  }
3131
- function ni(e) {
3215
+ function li(e) {
3132
3216
  if (e.kind === "anon") {
3133
3217
  let t = e.identity.name;
3134
3218
  return t ? {
@@ -3143,7 +3227,7 @@ function ni(e) {
3143
3227
  }
3144
3228
  //#endregion
3145
3229
  //#region src/runtime/popup-auth.ts
3146
- async function ri(e) {
3230
+ async function ui(e) {
3147
3231
  let { apiUrl: t, apiKey: n, useCookies: r } = e, i = new URL(t).origin, a;
3148
3232
  try {
3149
3233
  let e = await fetch(`${t.replace(/\/+$/, "")}/widget/popup-exchange`, {
@@ -3160,7 +3244,7 @@ async function ri(e) {
3160
3244
  let s = r ? "refresh,cookies" : "refresh";
3161
3245
  o.searchParams.set("capabilities", s), a = o.toString();
3162
3246
  } catch (e) {
3163
- return Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
3247
+ return e?.name !== "TypeError" && F(e, { context: "popup-exchange" }), Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
3164
3248
  }
3165
3249
  let o = Math.max(0, window.screenX + (window.outerWidth - 420) / 2), s = Math.max(0, window.screenY + (window.outerHeight - 560) / 2), c = window.open(a, "markup-auth", `width=420,height=560,left=${o},top=${s}`);
3166
3250
  if (!c) return Promise.reject(/* @__PURE__ */ Error("Popup blocked — allow popups for this site to sign in"));
@@ -3200,7 +3284,10 @@ async function ri(e) {
3200
3284
  refreshToken: l.refreshToken
3201
3285
  })
3202
3286
  });
3203
- if (!e.ok) throw Error(`Failed to install widget cookies (${e.status})`);
3287
+ if (!e.ok) {
3288
+ let t = /* @__PURE__ */ Error(`Failed to install widget cookies (${e.status})`);
3289
+ throw F(t, { context: "install-cookies" }), t;
3290
+ }
3204
3291
  return {
3205
3292
  ...l,
3206
3293
  token: null,
@@ -3211,45 +3298,45 @@ async function ri(e) {
3211
3298
  }
3212
3299
  //#endregion
3213
3300
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js
3214
- function ii(e, t) {
3301
+ function di(e, t) {
3215
3302
  if (e.match(/^[a-z]+:\/\//i)) return e;
3216
3303
  if (e.match(/^\/\//)) return window.location.protocol + e;
3217
3304
  if (e.match(/^[a-z]+:/i)) return e;
3218
3305
  let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
3219
3306
  return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
3220
3307
  }
3221
- var ai = (() => {
3308
+ var fi = (() => {
3222
3309
  let e = 0, t = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
3223
3310
  return () => (e += 1, `u${t()}${e}`);
3224
3311
  })();
3225
- function oi(e) {
3312
+ function pi(e) {
3226
3313
  let t = [];
3227
3314
  for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
3228
3315
  return t;
3229
3316
  }
3230
- var si = null;
3231
- function ci(e = {}) {
3232
- return si || (e.includeStyleProperties ? (si = e.includeStyleProperties, si) : (si = oi(window.getComputedStyle(document.documentElement)), si));
3317
+ var mi = null;
3318
+ function hi(e = {}) {
3319
+ return mi || (e.includeStyleProperties ? (mi = e.includeStyleProperties, mi) : (mi = pi(window.getComputedStyle(document.documentElement)), mi));
3233
3320
  }
3234
- function li(e, t) {
3321
+ function gi(e, t) {
3235
3322
  let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
3236
3323
  return n ? parseFloat(n.replace("px", "")) : 0;
3237
3324
  }
3238
- function ui(e) {
3239
- let t = li(e, "border-left-width"), n = li(e, "border-right-width");
3325
+ function _i(e) {
3326
+ let t = gi(e, "border-left-width"), n = gi(e, "border-right-width");
3240
3327
  return e.clientWidth + t + n;
3241
3328
  }
3242
- function di(e) {
3243
- let t = li(e, "border-top-width"), n = li(e, "border-bottom-width");
3329
+ function vi(e) {
3330
+ let t = gi(e, "border-top-width"), n = gi(e, "border-bottom-width");
3244
3331
  return e.clientHeight + t + n;
3245
3332
  }
3246
- function fi(e, t = {}) {
3333
+ function yi(e, t = {}) {
3247
3334
  return {
3248
- width: t.width || ui(e),
3249
- height: t.height || di(e)
3335
+ width: t.width || _i(e),
3336
+ height: t.height || vi(e)
3250
3337
  };
3251
3338
  }
3252
- function pi() {
3339
+ function bi() {
3253
3340
  let e, t;
3254
3341
  try {
3255
3342
  t = process;
@@ -3258,10 +3345,10 @@ function pi() {
3258
3345
  return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
3259
3346
  }
3260
3347
  var X = 16384;
3261
- function mi(e) {
3348
+ function xi(e) {
3262
3349
  (e.width > X || e.height > X) && (e.width > X && e.height > X ? e.width > e.height ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X) : e.width > X ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X));
3263
3350
  }
3264
- function hi(e) {
3351
+ function Si(e) {
3265
3352
  return new Promise((t, n) => {
3266
3353
  let r = new Image();
3267
3354
  r.onload = () => {
@@ -3271,12 +3358,12 @@ function hi(e) {
3271
3358
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
3272
3359
  });
3273
3360
  }
3274
- async function gi(e) {
3361
+ async function Ci(e) {
3275
3362
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
3276
3363
  }
3277
- async function _i(e, t, n) {
3364
+ async function wi(e, t, n) {
3278
3365
  let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
3279
- return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), gi(i);
3366
+ return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), Ci(i);
3280
3367
  }
3281
3368
  var Z = (e, t) => {
3282
3369
  if (e instanceof t) return !0;
@@ -3285,66 +3372,66 @@ var Z = (e, t) => {
3285
3372
  };
3286
3373
  //#endregion
3287
3374
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js
3288
- function vi(e) {
3375
+ function Ti(e) {
3289
3376
  let t = e.getPropertyValue("content");
3290
3377
  return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
3291
3378
  }
3292
- function yi(e, t) {
3293
- return ci(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3379
+ function Ei(e, t) {
3380
+ return hi(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3294
3381
  }
3295
- function bi(e, t, n, r) {
3296
- let i = `.${e}:${t}`, a = n.cssText ? vi(n) : yi(n, r);
3382
+ function Di(e, t, n, r) {
3383
+ let i = `.${e}:${t}`, a = n.cssText ? Ti(n) : Ei(n, r);
3297
3384
  return document.createTextNode(`${i}{${a}}`);
3298
3385
  }
3299
- function xi(e, t, n, r) {
3386
+ function Oi(e, t, n, r) {
3300
3387
  let i = window.getComputedStyle(e, n), a = i.getPropertyValue("content");
3301
3388
  if (a === "" || a === "none") return;
3302
- let o = ai();
3389
+ let o = fi();
3303
3390
  try {
3304
3391
  t.className = `${t.className} ${o}`;
3305
3392
  } catch {
3306
3393
  return;
3307
3394
  }
3308
3395
  let s = document.createElement("style");
3309
- s.appendChild(bi(o, n, i, r)), t.appendChild(s);
3396
+ s.appendChild(Di(o, n, i, r)), t.appendChild(s);
3310
3397
  }
3311
- function Si(e, t, n) {
3312
- xi(e, t, ":before", n), xi(e, t, ":after", n);
3398
+ function ki(e, t, n) {
3399
+ Oi(e, t, ":before", n), Oi(e, t, ":after", n);
3313
3400
  }
3314
3401
  //#endregion
3315
3402
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js
3316
- var Ci = "application/font-woff", wi = "image/jpeg", Ti = {
3317
- woff: Ci,
3318
- woff2: Ci,
3403
+ var Ai = "application/font-woff", ji = "image/jpeg", Mi = {
3404
+ woff: Ai,
3405
+ woff2: Ai,
3319
3406
  ttf: "application/font-truetype",
3320
3407
  eot: "application/vnd.ms-fontobject",
3321
3408
  png: "image/png",
3322
- jpg: wi,
3323
- jpeg: wi,
3409
+ jpg: ji,
3410
+ jpeg: ji,
3324
3411
  gif: "image/gif",
3325
3412
  tiff: "image/tiff",
3326
3413
  svg: "image/svg+xml",
3327
3414
  webp: "image/webp"
3328
3415
  };
3329
- function Ei(e) {
3416
+ function Ni(e) {
3330
3417
  let t = /\.([^./]*?)$/g.exec(e);
3331
3418
  return t ? t[1] : "";
3332
3419
  }
3333
- function Di(e) {
3334
- return Ti[Ei(e).toLowerCase()] || "";
3420
+ function Pi(e) {
3421
+ return Mi[Ni(e).toLowerCase()] || "";
3335
3422
  }
3336
3423
  //#endregion
3337
3424
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js
3338
- function Oi(e) {
3425
+ function Fi(e) {
3339
3426
  return e.split(/,/)[1];
3340
3427
  }
3341
- function ki(e) {
3428
+ function Ii(e) {
3342
3429
  return e.search(/^(data:)/) !== -1;
3343
3430
  }
3344
- function Ai(e, t) {
3431
+ function Li(e, t) {
3345
3432
  return `data:${t};base64,${e}`;
3346
3433
  }
3347
- async function ji(e, t, n) {
3434
+ async function Ri(e, t, n) {
3348
3435
  let r = await fetch(e, t);
3349
3436
  if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
3350
3437
  let i = await r.blob();
@@ -3362,78 +3449,78 @@ async function ji(e, t, n) {
3362
3449
  }, a.readAsDataURL(i);
3363
3450
  });
3364
3451
  }
3365
- var Mi = {};
3366
- function Ni(e, t, n) {
3452
+ var zi = {};
3453
+ function Bi(e, t, n) {
3367
3454
  let r = e.replace(/\?.*/, "");
3368
3455
  return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
3369
3456
  }
3370
- async function Pi(e, t, n) {
3371
- let r = Ni(e, t, n.includeQueryParams);
3372
- if (Mi[r] != null) return Mi[r];
3457
+ async function Vi(e, t, n) {
3458
+ let r = Bi(e, t, n.includeQueryParams);
3459
+ if (zi[r] != null) return zi[r];
3373
3460
  n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
3374
3461
  let i;
3375
3462
  try {
3376
- i = Ai(await ji(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", Oi(n))), t);
3463
+ i = Li(await Ri(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", Fi(n))), t);
3377
3464
  } catch (t) {
3378
3465
  i = n.imagePlaceholder || "";
3379
3466
  let r = `Failed to fetch resource: ${e}`;
3380
3467
  t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
3381
3468
  }
3382
- return Mi[r] = i, i;
3469
+ return zi[r] = i, i;
3383
3470
  }
3384
3471
  //#endregion
3385
3472
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js
3386
- async function Fi(e) {
3473
+ async function Hi(e) {
3387
3474
  let t = e.toDataURL();
3388
- return t === "data:," ? e.cloneNode(!1) : hi(t);
3475
+ return t === "data:," ? e.cloneNode(!1) : Si(t);
3389
3476
  }
3390
- async function Ii(e, t) {
3477
+ async function Ui(e, t) {
3391
3478
  if (e.currentSrc) {
3392
3479
  let t = document.createElement("canvas"), n = t.getContext("2d");
3393
- return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), hi(t.toDataURL());
3480
+ return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), Si(t.toDataURL());
3394
3481
  }
3395
3482
  let n = e.poster;
3396
- return hi(await Pi(n, Di(n), t));
3483
+ return Si(await Vi(n, Pi(n), t));
3397
3484
  }
3398
- async function Li(e, t) {
3485
+ async function Wi(e, t) {
3399
3486
  try {
3400
- if (e?.contentDocument?.body) return await qi(e.contentDocument.body, t, !0);
3487
+ if (e?.contentDocument?.body) return await ea(e.contentDocument.body, t, !0);
3401
3488
  } catch {}
3402
3489
  return e.cloneNode(!1);
3403
3490
  }
3404
- async function Ri(e, t) {
3405
- return Z(e, HTMLCanvasElement) ? Fi(e) : Z(e, HTMLVideoElement) ? Ii(e, t) : Z(e, HTMLIFrameElement) ? Li(e, t) : e.cloneNode(Bi(e));
3491
+ async function Gi(e, t) {
3492
+ return Z(e, HTMLCanvasElement) ? Hi(e) : Z(e, HTMLVideoElement) ? Ui(e, t) : Z(e, HTMLIFrameElement) ? Wi(e, t) : e.cloneNode(qi(e));
3406
3493
  }
3407
- var zi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", Bi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3408
- async function Vi(e, t, n) {
3409
- if (Bi(t)) return t;
3494
+ var Ki = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", qi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3495
+ async function Ji(e, t, n) {
3496
+ if (qi(t)) return t;
3410
3497
  let r = [];
3411
- return r = zi(e) && e.assignedNodes ? oi(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? oi(e.contentDocument.body.childNodes) : oi((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => qi(r, n)).then((e) => {
3498
+ return r = Ki(e) && e.assignedNodes ? pi(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? pi(e.contentDocument.body.childNodes) : pi((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => ea(r, n)).then((e) => {
3412
3499
  e && t.appendChild(e);
3413
3500
  }), Promise.resolve()), t;
3414
3501
  }
3415
- function Hi(e, t, n) {
3502
+ function Yi(e, t, n) {
3416
3503
  let r = t.style;
3417
3504
  if (!r) return;
3418
3505
  let i = window.getComputedStyle(e);
3419
- i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : ci(n).forEach((n) => {
3506
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : hi(n).forEach((n) => {
3420
3507
  let a = i.getPropertyValue(n);
3421
3508
  n === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - .1}px`), Z(e, HTMLIFrameElement) && n === "display" && a === "inline" && (a = "block"), n === "d" && t.getAttribute("d") && (a = `path(${t.getAttribute("d")})`), r.setProperty(n, a, i.getPropertyPriority(n));
3422
3509
  });
3423
3510
  }
3424
- function Ui(e, t) {
3511
+ function Xi(e, t) {
3425
3512
  Z(e, HTMLTextAreaElement) && (t.innerHTML = e.value), Z(e, HTMLInputElement) && t.setAttribute("value", e.value);
3426
3513
  }
3427
- function Wi(e, t) {
3514
+ function Zi(e, t) {
3428
3515
  if (Z(e, HTMLSelectElement)) {
3429
3516
  let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
3430
3517
  r && r.setAttribute("selected", "");
3431
3518
  }
3432
3519
  }
3433
- function Gi(e, t, n) {
3434
- return Z(t, Element) && (Hi(e, t, n), Si(e, t, n), Ui(e, t), Wi(e, t)), t;
3520
+ function Qi(e, t, n) {
3521
+ return Z(t, Element) && (Yi(e, t, n), ki(e, t, n), Xi(e, t), Zi(e, t)), t;
3435
3522
  }
3436
- async function Ki(e, t) {
3523
+ async function $i(e, t) {
3437
3524
  let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
3438
3525
  if (n.length === 0) return e;
3439
3526
  let r = {};
@@ -3441,7 +3528,7 @@ async function Ki(e, t) {
3441
3528
  let a = n[i].getAttribute("xlink:href");
3442
3529
  if (a) {
3443
3530
  let n = e.querySelector(a), i = document.querySelector(a);
3444
- !n && i && !r[a] && (r[a] = await qi(i, t, !0));
3531
+ !n && i && !r[a] && (r[a] = await ea(i, t, !0));
3445
3532
  }
3446
3533
  }
3447
3534
  let i = Object.values(r);
@@ -3455,61 +3542,61 @@ async function Ki(e, t) {
3455
3542
  }
3456
3543
  return e;
3457
3544
  }
3458
- async function qi(e, t, n) {
3459
- return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => Ri(e, t)).then((n) => Vi(e, n, t)).then((n) => Gi(e, n, t)).then((e) => Ki(e, t));
3545
+ async function ea(e, t, n) {
3546
+ return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => Gi(e, t)).then((n) => Ji(e, n, t)).then((n) => Qi(e, n, t)).then((e) => $i(e, t));
3460
3547
  }
3461
3548
  //#endregion
3462
3549
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js
3463
- var Ji = /url\((['"]?)([^'"]+?)\1\)/g, Yi = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Xi = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3464
- function Zi(e) {
3550
+ var ta = /url\((['"]?)([^'"]+?)\1\)/g, na = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ra = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3551
+ function ia(e) {
3465
3552
  let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
3466
3553
  return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
3467
3554
  }
3468
- function Qi(e) {
3555
+ function aa(e) {
3469
3556
  let t = [];
3470
- return e.replace(Ji, (e, n, r) => (t.push(r), e)), t.filter((e) => !ki(e));
3557
+ return e.replace(ta, (e, n, r) => (t.push(r), e)), t.filter((e) => !Ii(e));
3471
3558
  }
3472
- async function $i(e, t, n, r, i) {
3559
+ async function oa(e, t, n, r, i) {
3473
3560
  try {
3474
- let a = n ? ii(t, n) : t, o = Di(t), s;
3475
- return s = i ? Ai(await i(a), o) : await Pi(a, o, r), e.replace(Zi(t), `$1${s}$3`);
3561
+ let a = n ? di(t, n) : t, o = Pi(t), s;
3562
+ return s = i ? Li(await i(a), o) : await Vi(a, o, r), e.replace(ia(t), `$1${s}$3`);
3476
3563
  } catch {}
3477
3564
  return e;
3478
3565
  }
3479
- function ea(e, { preferredFontFormat: t }) {
3480
- return t ? e.replace(Xi, (e) => {
3566
+ function sa(e, { preferredFontFormat: t }) {
3567
+ return t ? e.replace(ra, (e) => {
3481
3568
  for (;;) {
3482
- let [n, , r] = Yi.exec(e) || [];
3569
+ let [n, , r] = na.exec(e) || [];
3483
3570
  if (!r) return "";
3484
3571
  if (r === t) return `src: ${n};`;
3485
3572
  }
3486
3573
  }) : e;
3487
3574
  }
3488
- function ta(e) {
3489
- return e.search(Ji) !== -1;
3575
+ function ca(e) {
3576
+ return e.search(ta) !== -1;
3490
3577
  }
3491
- async function na(e, t, n) {
3492
- if (!ta(e)) return e;
3493
- let r = ea(e, n);
3494
- return Qi(r).reduce((e, r) => e.then((e) => $i(e, r, t, n)), Promise.resolve(r));
3578
+ async function la(e, t, n) {
3579
+ if (!ca(e)) return e;
3580
+ let r = sa(e, n);
3581
+ return aa(r).reduce((e, r) => e.then((e) => oa(e, r, t, n)), Promise.resolve(r));
3495
3582
  }
3496
3583
  //#endregion
3497
3584
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js
3498
- async function ra(e, t, n) {
3585
+ async function ua(e, t, n) {
3499
3586
  let r = t.style?.getPropertyValue(e);
3500
3587
  if (r) {
3501
- let i = await na(r, null, n);
3588
+ let i = await la(r, null, n);
3502
3589
  return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
3503
3590
  }
3504
3591
  return !1;
3505
3592
  }
3506
- async function ia(e, t) {
3507
- await ra("background", e, t) || await ra("background-image", e, t), await ra("mask", e, t) || await ra("-webkit-mask", e, t) || await ra("mask-image", e, t) || await ra("-webkit-mask-image", e, t);
3593
+ async function da(e, t) {
3594
+ await ua("background", e, t) || await ua("background-image", e, t), await ua("mask", e, t) || await ua("-webkit-mask", e, t) || await ua("mask-image", e, t) || await ua("-webkit-mask-image", e, t);
3508
3595
  }
3509
- async function aa(e, t) {
3596
+ async function fa(e, t) {
3510
3597
  let n = Z(e, HTMLImageElement);
3511
- if (!(n && !ki(e.src)) && !(Z(e, SVGImageElement) && !ki(e.href.baseVal))) return;
3512
- let r = n ? e.src : e.href.baseVal, i = await Pi(r, Di(r), t);
3598
+ if (!(n && !Ii(e.src)) && !(Z(e, SVGImageElement) && !Ii(e.href.baseVal))) return;
3599
+ let r = n ? e.src : e.href.baseVal, i = await Vi(r, Pi(r), t);
3513
3600
  await new Promise((r, a) => {
3514
3601
  e.onload = r, e.onerror = t.onImageErrorHandler ? (...e) => {
3515
3602
  try {
@@ -3522,16 +3609,16 @@ async function aa(e, t) {
3522
3609
  o.decode &&= r, o.loading === "lazy" && (o.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
3523
3610
  });
3524
3611
  }
3525
- async function oa(e, t) {
3526
- let n = oi(e.childNodes).map((e) => sa(e, t));
3612
+ async function pa(e, t) {
3613
+ let n = pi(e.childNodes).map((e) => ma(e, t));
3527
3614
  await Promise.all(n).then(() => e);
3528
3615
  }
3529
- async function sa(e, t) {
3530
- Z(e, Element) && (await ia(e, t), await aa(e, t), await oa(e, t));
3616
+ async function ma(e, t) {
3617
+ Z(e, Element) && (await da(e, t), await fa(e, t), await pa(e, t));
3531
3618
  }
3532
3619
  //#endregion
3533
3620
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js
3534
- function ca(e, t) {
3621
+ function ha(e, t) {
3535
3622
  let { style: n } = e;
3536
3623
  t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
3537
3624
  let r = t.style;
@@ -3541,22 +3628,22 @@ function ca(e, t) {
3541
3628
  }
3542
3629
  //#endregion
3543
3630
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js
3544
- var la = {};
3545
- async function ua(e) {
3546
- let t = la[e];
3631
+ var ga = {};
3632
+ async function _a(e) {
3633
+ let t = ga[e];
3547
3634
  return t ?? (t = {
3548
3635
  url: e,
3549
3636
  cssText: await (await fetch(e)).text()
3550
- }, la[e] = t, t);
3637
+ }, ga[e] = t, t);
3551
3638
  }
3552
- async function da(e, t) {
3639
+ async function va(e, t) {
3553
3640
  let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
3554
3641
  let a = i.replace(r, "$1");
3555
- return a.startsWith("https://") || (a = new URL(a, e.url).href), ji(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3642
+ return a.startsWith("https://") || (a = new URL(a, e.url).href), Ri(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3556
3643
  });
3557
3644
  return Promise.all(i).then(() => n);
3558
3645
  }
3559
- function fa(e) {
3646
+ function ya(e) {
3560
3647
  if (e == null) return [];
3561
3648
  let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
3562
3649
  for (;;) {
@@ -3576,13 +3663,13 @@ function fa(e) {
3576
3663
  }
3577
3664
  return t;
3578
3665
  }
3579
- async function pa(e, t) {
3666
+ async function ba(e, t) {
3580
3667
  let n = [], r = [];
3581
3668
  return e.forEach((n) => {
3582
3669
  if ("cssRules" in n) try {
3583
- oi(n.cssRules || []).forEach((e, i) => {
3670
+ pi(n.cssRules || []).forEach((e, i) => {
3584
3671
  if (e.type === CSSRule.IMPORT_RULE) {
3585
- let a = i + 1, o = e.href, s = ua(o).then((e) => da(e, t)).then((e) => fa(e).forEach((e) => {
3672
+ let a = i + 1, o = e.href, s = _a(o).then((e) => va(e, t)).then((e) => ya(e).forEach((e) => {
3586
3673
  try {
3587
3674
  n.insertRule(e, e.startsWith("@import") ? a += 1 : n.cssRules.length);
3588
3675
  } catch (t) {
@@ -3599,7 +3686,7 @@ async function pa(e, t) {
3599
3686
  });
3600
3687
  } catch (i) {
3601
3688
  let a = e.find((e) => e.href == null) || document.styleSheets[0];
3602
- n.href != null && r.push(ua(n.href).then((e) => da(e, t)).then((e) => fa(e).forEach((e) => {
3689
+ n.href != null && r.push(_a(n.href).then((e) => va(e, t)).then((e) => ya(e).forEach((e) => {
3603
3690
  a.insertRule(e, a.cssRules.length);
3604
3691
  })).catch((e) => {
3605
3692
  console.error("Error loading remote stylesheet", e);
@@ -3607,7 +3694,7 @@ async function pa(e, t) {
3607
3694
  }
3608
3695
  }), Promise.all(r).then(() => (e.forEach((e) => {
3609
3696
  if ("cssRules" in e) try {
3610
- oi(e.cssRules || []).forEach((e) => {
3697
+ pi(e.cssRules || []).forEach((e) => {
3611
3698
  n.push(e);
3612
3699
  });
3613
3700
  } catch (t) {
@@ -3615,36 +3702,36 @@ async function pa(e, t) {
3615
3702
  }
3616
3703
  }), n));
3617
3704
  }
3618
- function ma(e) {
3619
- return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ta(e.style.getPropertyValue("src")));
3705
+ function xa(e) {
3706
+ return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ca(e.style.getPropertyValue("src")));
3620
3707
  }
3621
- async function ha(e, t) {
3708
+ async function Sa(e, t) {
3622
3709
  if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
3623
- return ma(await pa(oi(e.ownerDocument.styleSheets), t));
3710
+ return xa(await ba(pi(e.ownerDocument.styleSheets), t));
3624
3711
  }
3625
- function ga(e) {
3712
+ function Ca(e) {
3626
3713
  return e.trim().replace(/["']/g, "");
3627
3714
  }
3628
- function _a(e) {
3715
+ function wa(e) {
3629
3716
  let t = /* @__PURE__ */ new Set();
3630
3717
  function n(e) {
3631
3718
  (e.style.fontFamily || getComputedStyle(e).fontFamily).split(",").forEach((e) => {
3632
- t.add(ga(e));
3719
+ t.add(Ca(e));
3633
3720
  }), Array.from(e.children).forEach((e) => {
3634
3721
  e instanceof HTMLElement && n(e);
3635
3722
  });
3636
3723
  }
3637
3724
  return n(e), t;
3638
3725
  }
3639
- async function va(e, t) {
3640
- let n = await ha(e, t), r = _a(e);
3641
- return (await Promise.all(n.filter((e) => r.has(ga(e.style.fontFamily))).map((e) => {
3726
+ async function Ta(e, t) {
3727
+ let n = await Sa(e, t), r = wa(e);
3728
+ return (await Promise.all(n.filter((e) => r.has(Ca(e.style.fontFamily))).map((e) => {
3642
3729
  let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
3643
- return na(e.cssText, n, t);
3730
+ return la(e.cssText, n, t);
3644
3731
  }))).join("\n");
3645
3732
  }
3646
- async function ya(e, t) {
3647
- let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await va(e, t) : t.fontEmbedCSS;
3733
+ async function Ea(e, t) {
3734
+ let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await Ta(e, t) : t.fontEmbedCSS;
3648
3735
  if (n) {
3649
3736
  let t = document.createElement("style"), r = document.createTextNode(n);
3650
3737
  t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
@@ -3652,18 +3739,18 @@ async function ya(e, t) {
3652
3739
  }
3653
3740
  //#endregion
3654
3741
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js
3655
- async function ba(e, t = {}) {
3656
- let { width: n, height: r } = fi(e, t), i = await qi(e, t, !0);
3657
- return await ya(i, t), await sa(i, t), ca(i, t), await _i(i, n, r);
3742
+ async function Da(e, t = {}) {
3743
+ let { width: n, height: r } = yi(e, t), i = await ea(e, t, !0);
3744
+ return await Ea(i, t), await ma(i, t), ha(i, t), await wi(i, n, r);
3658
3745
  }
3659
- async function xa(e, t = {}) {
3660
- let { width: n, height: r } = fi(e, t), i = await hi(await ba(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || pi(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3661
- return a.width = c * s, a.height = l * s, t.skipAutoScale || mi(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
3746
+ async function Oa(e, t = {}) {
3747
+ let { width: n, height: r } = yi(e, t), i = await Si(await Da(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || bi(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3748
+ return a.width = c * s, a.height = l * s, t.skipAutoScale || xi(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
3662
3749
  }
3663
3750
  //#endregion
3664
3751
  //#region src/runtime/screenshot.ts
3665
- var Sa = 2 * 1024 * 1024, Ca = "background:currentColor!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important", wa = "input[type=\"password\"],input[autocomplete~=\"cc-number\"],input[autocomplete~=\"cc-csc\"],input[autocomplete~=\"cc-exp\"],input[autocomplete~=\"cc-name\"],input[autocomplete~=\"cc-type\"],input[autocomplete~=\"current-password\"],input[autocomplete~=\"new-password\"],input[autocomplete~=\"one-time-code\"]";
3666
- function Ta(e) {
3752
+ var ka = 2 * 1024 * 1024, Aa = "background:currentColor!important;color:transparent!important;text-shadow:none!important;-webkit-text-fill-color:transparent!important", ja = "input[type=\"password\"],input[autocomplete~=\"cc-number\"],input[autocomplete~=\"cc-csc\"],input[autocomplete~=\"cc-exp\"],input[autocomplete~=\"cc-name\"],input[autocomplete~=\"cc-type\"],input[autocomplete~=\"current-password\"],input[autocomplete~=\"new-password\"],input[autocomplete~=\"one-time-code\"]";
3753
+ function Ma(e) {
3667
3754
  let t = e.parentElement;
3668
3755
  for (; t;) {
3669
3756
  if (t.hasAttribute("data-markup-safe")) return !0;
@@ -3671,35 +3758,37 @@ function Ta(e) {
3671
3758
  }
3672
3759
  return !1;
3673
3760
  }
3674
- function Ea(e) {
3761
+ function Na(e) {
3675
3762
  let t = /* @__PURE__ */ new Set(), n = [];
3676
3763
  function r(e) {
3677
3764
  t.has(e) || (t.add(e), n.push(e));
3678
3765
  }
3679
3766
  for (let e of document.querySelectorAll("[data-markup-private],[data-markup-redact]")) r(e);
3680
- for (let e of document.querySelectorAll(wa)) Ta(e) || r(e);
3767
+ for (let e of document.querySelectorAll(ja)) Ma(e) || r(e);
3681
3768
  if (e.redactSelector) try {
3682
- for (let t of document.querySelectorAll(e.redactSelector)) Ta(t) || r(t);
3683
- } catch {}
3684
- if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Ta(e) || r(e);
3769
+ for (let t of document.querySelectorAll(e.redactSelector)) Ma(t) || r(t);
3770
+ } catch (e) {
3771
+ F(e, { context: "screenshot-redact-selector" });
3772
+ }
3773
+ if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Ma(e) || r(e);
3685
3774
  return n;
3686
3775
  }
3687
- function Da(e) {
3776
+ function Pa(e) {
3688
3777
  let t = e.getAttribute("style");
3689
- return e.setAttribute("style", t ? `${t};${Ca}` : Ca), () => {
3778
+ return e.setAttribute("style", t ? `${t};${Aa}` : Aa), () => {
3690
3779
  t === null ? e.removeAttribute("style") : e.setAttribute("style", t);
3691
3780
  };
3692
3781
  }
3693
- function Oa(e) {
3782
+ function Fa(e) {
3694
3783
  if (e.id) return `#${CSS.escape(e.id)}`;
3695
3784
  let t = e.tagName.toLowerCase(), n = e.getAttribute("type"), r = e.getAttribute("name");
3696
3785
  return n && r ? `${t}[type="${n}"][name="${r}"]` : n ? `${t}[type="${n}"]` : r ? `${t}[name="${r}"]` : t;
3697
3786
  }
3698
- async function ka(e, t, n) {
3787
+ async function Ia(e, t, n) {
3699
3788
  try {
3700
- let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = n ? Ea(n) : [], s = o.map(Oa), c = o.map(Da), l;
3789
+ let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = n ? Na(n) : [], s = o.map(Fa), c = o.map(Pa), l;
3701
3790
  try {
3702
- l = await xa(document.documentElement, {
3791
+ l = await Oa(document.documentElement, {
3703
3792
  width: r,
3704
3793
  height: i,
3705
3794
  cacheBust: !0,
@@ -3718,29 +3807,29 @@ async function ka(e, t, n) {
3718
3807
  }
3719
3808
  if (t) {
3720
3809
  let e = l.getContext("2d");
3721
- e && ja(e, t.x, t.y, a);
3810
+ e && Ra(e, t.x, t.y, a);
3722
3811
  }
3723
- let u = await Aa(l, .85);
3812
+ let u = await La(l, .85);
3724
3813
  if (!u) return null;
3725
- if (u.size <= Sa) return {
3814
+ if (u.size <= ka) return {
3726
3815
  blob: u,
3727
3816
  redactedCount: s.length,
3728
3817
  redactedSelectors: s
3729
3818
  };
3730
- let d = await Aa(l, .5);
3731
- return !d || d.size > Sa ? null : {
3819
+ let d = await La(l, .5);
3820
+ return !d || d.size > ka ? null : {
3732
3821
  blob: d,
3733
3822
  redactedCount: s.length,
3734
3823
  redactedSelectors: s
3735
3824
  };
3736
- } catch {
3737
- return null;
3825
+ } catch (e) {
3826
+ return F(e, { context: "screenshot-capture" }), null;
3738
3827
  }
3739
3828
  }
3740
- function Aa(e, t) {
3829
+ function La(e, t) {
3741
3830
  return new Promise((n) => e.toBlob(n, "image/jpeg", t));
3742
3831
  }
3743
- function ja(e, t, n, r) {
3832
+ function Ra(e, t, n, r) {
3744
3833
  let i = r, a = 28 * i, o = a / 2, s = t * i, c = n * i;
3745
3834
  e.save();
3746
3835
  let l = 2 * i;
@@ -3758,7 +3847,7 @@ function ja(e, t, n, r) {
3758
3847
  }
3759
3848
  //#endregion
3760
3849
  //#region src/runtime/use-subscription-token.ts
3761
- var Ma = dr({
3850
+ var za = mr({
3762
3851
  idle: { issued: (e, t) => ({
3763
3852
  kind: "active",
3764
3853
  token: t.token,
@@ -3769,10 +3858,10 @@ var Ma = dr({
3769
3858
  token: t.token,
3770
3859
  expiresAt: t.expiresAt
3771
3860
  }) }
3772
- }), Na = 30 * 6e4, Pa = 6e4, Fa = 6e4;
3773
- function Ia(e) {
3774
- let [t, n] = fr(Ma, { kind: "idle" });
3775
- return z(() => {
3861
+ }), Ba = 30 * 6e4, Va = 6e4, Ha = 6e4;
3862
+ function Ua(e) {
3863
+ let [t, n] = hr(za, { kind: "idle" });
3864
+ return B(() => {
3776
3865
  let t = !1, r = null;
3777
3866
  async function i() {
3778
3867
  try {
@@ -3783,11 +3872,11 @@ function Ia(e) {
3783
3872
  token: a.token,
3784
3873
  expiresAt: a.expiresAt
3785
3874
  });
3786
- let o = Math.max(Pa, a.expiresAt - Date.now() - Na);
3875
+ let o = Math.max(Va, a.expiresAt - Date.now() - Ba);
3787
3876
  r = setTimeout(i, o);
3788
- } catch {
3877
+ } catch (e) {
3789
3878
  if (t) return;
3790
- r = setTimeout(i, Fa);
3879
+ e?.name !== "TypeError" && F(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ha);
3791
3880
  }
3792
3881
  }
3793
3882
  return i(), () => {
@@ -3797,7 +3886,7 @@ function Ia(e) {
3797
3886
  }
3798
3887
  //#endregion
3799
3888
  //#region src/runtime/refresh-token.ts
3800
- async function La(e) {
3889
+ async function Wa(e) {
3801
3890
  try {
3802
3891
  let t = {
3803
3892
  method: "POST",
@@ -3826,24 +3915,25 @@ async function La(e) {
3826
3915
  refreshToken: r.refreshToken,
3827
3916
  refreshTokenExpiresAt: r.refreshTokenExpiresAt
3828
3917
  };
3829
- } catch {
3830
- return null;
3918
+ } catch (e) {
3919
+ let t = e?.name;
3920
+ return t !== "AbortError" && t !== "TypeError" && F(e, { context: "refresh-token" }), null;
3831
3921
  }
3832
3922
  }
3833
3923
  //#endregion
3834
3924
  //#region src/runtime/use-token-refresh.ts
3835
- var Ra = 6e4, za = 500;
3836
- function Ba(e, t, n, r, i) {
3925
+ var Ga = 6e4, Ka = 500;
3926
+ function qa(e, t, n, r, i) {
3837
3927
  let a = e.kind === "verified", o = a ? e.identity.storage : void 0, s = a ? e.identity.refreshToken : void 0, c = a ? e.identity.refreshTokenExpiresAt : void 0, l = a ? e.identity.tokenExpiresAt : void 0;
3838
- z(() => {
3928
+ B(() => {
3839
3929
  if (!a || c == null || l == null || o === "localStorage" && s == null || o !== "cookies" && o !== "localStorage") return;
3840
3930
  let u = Date.now();
3841
3931
  if (c <= u) {
3842
3932
  i();
3843
3933
  return;
3844
3934
  }
3845
- let d = Math.max(za, l - Ra - u), f = new AbortController(), p = window.setTimeout(async () => {
3846
- let a = await La({
3935
+ let d = Math.max(Ka, l - Ga - u), f = new AbortController(), p = window.setTimeout(async () => {
3936
+ let a = await Wa({
3847
3937
  apiUrl: t,
3848
3938
  apiKey: n,
3849
3939
  mode: o,
@@ -3888,12 +3978,12 @@ function Q(...e) {
3888
3978
  }
3889
3979
  //#endregion
3890
3980
  //#region src/runtime/use-drag.ts
3891
- function Va(e) {
3892
- let t = B(e);
3981
+ function Ja(e) {
3982
+ let t = V(e);
3893
3983
  t.current = e;
3894
- let [n, r] = R(!1), i = B(!1);
3984
+ let [n, r] = z(!1), i = V(!1);
3895
3985
  return {
3896
- onPointerDown: V((e) => {
3986
+ onPointerDown: H((e) => {
3897
3987
  let n = t.current;
3898
3988
  if (n.preventDefault && e.preventDefault(), n.stopPropagation && e.stopPropagation(), e.button !== 0 || n.shouldStart && !n.shouldStart(e)) return;
3899
3989
  let a = e.currentTarget;
@@ -3917,8 +4007,8 @@ function Va(e) {
3917
4007
  g = !0, i.current = !0, r(!0), t.current.onStart?.();
3918
4008
  }
3919
4009
  let o = Math.max(m, window.innerWidth - d - m), v = Math.max(m, window.innerHeight - f - m), y = {
3920
- left: Ha(l + n, m, o),
3921
- top: Ha(u + a, m, v)
4010
+ left: Ya(l + n, m, o),
4011
+ top: Ya(u + a, m, v)
3922
4012
  };
3923
4013
  _ = y, t.current.onMove(y);
3924
4014
  }
@@ -3931,15 +4021,15 @@ function Va(e) {
3931
4021
  a.addEventListener("pointermove", y), a.addEventListener("pointerup", b), a.addEventListener("pointercancel", x);
3932
4022
  }, []),
3933
4023
  isDragging: n,
3934
- consumeClickIfDragged: V(() => i.current ? (i.current = !1, !0) : !1, [])
4024
+ consumeClickIfDragged: H(() => i.current ? (i.current = !1, !0) : !1, [])
3935
4025
  };
3936
4026
  }
3937
- function Ha(e, t, n) {
4027
+ function Ya(e, t, n) {
3938
4028
  return Math.max(t, Math.min(n, e));
3939
4029
  }
3940
4030
  //#endregion
3941
4031
  //#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
3942
- var Ua = 0;
4032
+ var Xa = 0;
3943
4033
  Array.isArray;
3944
4034
  function $(e, n, r, i, a, o) {
3945
4035
  n ||= {};
@@ -3956,7 +4046,7 @@ function $(e, n, r, i, a, o) {
3956
4046
  __e: null,
3957
4047
  __c: null,
3958
4048
  constructor: void 0,
3959
- __v: --Ua,
4049
+ __v: --Xa,
3960
4050
  __i: -1,
3961
4051
  __u: 0,
3962
4052
  __source: a,
@@ -3967,7 +4057,7 @@ function $(e, n, r, i, a, o) {
3967
4057
  }
3968
4058
  //#endregion
3969
4059
  //#region src/runtime/ui/icons.tsx
3970
- function Wa({ size: e = 16 }) {
4060
+ function Za({ size: e = 16 }) {
3971
4061
  return /* @__PURE__ */ $("svg", {
3972
4062
  width: e,
3973
4063
  height: e,
@@ -3977,7 +4067,7 @@ function Wa({ size: e = 16 }) {
3977
4067
  children: /* @__PURE__ */ $("path", { d: "M63.4561 0.00557731C70.6277 -0.0175584 76.9025 1.04088 83.5898 3.71066C97.7952 9.43043 109.186 20.5001 115.311 34.5359C119.708 44.8002 120.746 54.7869 119.156 65.8171C116.857 82.7956 105.129 98.8382 90.0566 106.846C83.4394 110.362 74.7336 113.029 67.2051 113.271C62.4204 113.425 61.1274 113.32 56.6807 115.204C50.2035 117.858 43.6874 120.417 37.1348 122.879C34.8442 123.763 32.3203 124.902 29.9404 125.51C29.4023 125.648 28.1978 125.009 27.7598 124.646C26.9046 123.951 27.0582 122.505 27.0264 121.484C26.8123 114.646 27.3302 107.458 26.8604 100.656C25.1578 98.6714 22.4026 96.603 20.3086 94.1989C12.1853 84.8731 7.05334 73.9949 6.18164 61.6101C4.95583 46.292 9.97176 31.1285 20.0908 19.5632C29.989 8.13202 44.0369 1.11921 59.1221 0.0788195C60.2694 -0.0356049 62.2637 0.00944821 63.4561 0.00557731ZM92.2676 55.7497C91.5754 39.5314 77.8207 26.9725 61.6064 27.7536C45.5175 28.5287 33.0758 42.1537 33.7627 58.2468C34.4496 74.3398 48.007 86.8553 64.1035 86.2566C80.3254 85.6533 92.9599 71.968 92.2676 55.7497Z" })
3978
4068
  });
3979
4069
  }
3980
- function Ga({ size: e = 16 }) {
4070
+ function Qa({ size: e = 16 }) {
3981
4071
  return /* @__PURE__ */ $("svg", {
3982
4072
  width: e,
3983
4073
  height: e,
@@ -3986,7 +4076,7 @@ function Ga({ size: e = 16 }) {
3986
4076
  children: /* @__PURE__ */ $("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
3987
4077
  });
3988
4078
  }
3989
- function Ka({ size: e = 16 }) {
4079
+ function $a({ size: e = 16 }) {
3990
4080
  return /* @__PURE__ */ $("svg", {
3991
4081
  width: e,
3992
4082
  height: e,
@@ -3995,7 +4085,7 @@ function Ka({ size: e = 16 }) {
3995
4085
  children: /* @__PURE__ */ $("path", { d: "M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" })
3996
4086
  });
3997
4087
  }
3998
- function qa({ size: e = 16 }) {
4088
+ function eo({ size: e = 16 }) {
3999
4089
  return /* @__PURE__ */ $("svg", {
4000
4090
  width: e,
4001
4091
  height: e,
@@ -4008,7 +4098,7 @@ function qa({ size: e = 16 }) {
4008
4098
  })
4009
4099
  });
4010
4100
  }
4011
- function Ja({ size: e = 16 }) {
4101
+ function to({ size: e = 16 }) {
4012
4102
  return /* @__PURE__ */ $("svg", {
4013
4103
  width: e,
4014
4104
  height: e,
@@ -4022,7 +4112,7 @@ function Ja({ size: e = 16 }) {
4022
4112
  })
4023
4113
  });
4024
4114
  }
4025
- function Ya({ size: e = 16 }) {
4115
+ function no({ size: e = 16 }) {
4026
4116
  return /* @__PURE__ */ $("svg", {
4027
4117
  width: e,
4028
4118
  height: e,
@@ -4031,7 +4121,7 @@ function Ya({ size: e = 16 }) {
4031
4121
  children: /* @__PURE__ */ $("path", { d: "M2.87 2.298a.75.75 0 0 0-.812 1.021L3.39 6.624a1 1 0 0 0 .928.626H8.25a.75.75 0 0 1 0 1.5H4.318a1 1 0 0 0-.927.626l-1.333 3.305a.75.75 0 0 0 .811 1.022 24.89 24.89 0 0 0 11.668-5.115.75.75 0 0 0 0-1.175A24.89 24.89 0 0 0 2.869 2.298Z" })
4032
4122
  });
4033
4123
  }
4034
- function Xa({ size: e = 16 }) {
4124
+ function ro({ size: e = 16 }) {
4035
4125
  return /* @__PURE__ */ $("svg", {
4036
4126
  width: e,
4037
4127
  height: e,
@@ -4043,8 +4133,8 @@ function Xa({ size: e = 16 }) {
4043
4133
  }
4044
4134
  //#endregion
4045
4135
  //#region src/runtime/ui/fab.tsx
4046
- function Za({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
4047
- let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = R(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = Va({
4136
+ function io({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
4137
+ let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = z(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = Ja({
4048
4138
  preventDefault: !0,
4049
4139
  stopPropagation: !0,
4050
4140
  onMove: l,
@@ -4076,7 +4166,7 @@ function Za({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
4076
4166
  "aria-pressed": e,
4077
4167
  children: [/* @__PURE__ */ $("span", {
4078
4168
  class: "markup-fab-icon",
4079
- children: $(e ? Ga : Wa, { size: 16 })
4169
+ children: $(e ? Qa : Za, { size: 16 })
4080
4170
  }), o ? null : /* @__PURE__ */ $("span", {
4081
4171
  class: "markup-fab-label",
4082
4172
  children: e ? "Cancel" : "Markup"
@@ -4085,7 +4175,7 @@ function Za({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
4085
4175
  }
4086
4176
  //#endregion
4087
4177
  //#region src/runtime/use-focus-trap.ts
4088
- var Qa = [
4178
+ var ao = [
4089
4179
  "a[href]",
4090
4180
  "button:not([disabled])",
4091
4181
  "input:not([disabled])",
@@ -4093,14 +4183,14 @@ var Qa = [
4093
4183
  "textarea:not([disabled])",
4094
4184
  "[tabindex]:not([tabindex=\"-1\"])"
4095
4185
  ].join(",");
4096
- function $a(e, t) {
4097
- z(() => {
4186
+ function oo(e, t) {
4187
+ B(() => {
4098
4188
  if (!t) return;
4099
4189
  let n = e.current;
4100
4190
  if (!n) return;
4101
4191
  function r(e) {
4102
4192
  if (e.key !== "Tab") return;
4103
- let t = Array.from(n.querySelectorAll(Qa)), r = t[0], i = t[t.length - 1];
4193
+ let t = Array.from(n.querySelectorAll(ao)), r = t[0], i = t[t.length - 1];
4104
4194
  if (!r || !i) return;
4105
4195
  let a = n.getRootNode(), o = a instanceof ShadowRoot ? a.activeElement : document.activeElement;
4106
4196
  (e.shiftKey ? o === r : o === i) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
@@ -4110,9 +4200,9 @@ function $a(e, t) {
4110
4200
  }
4111
4201
  //#endregion
4112
4202
  //#region src/runtime/use-object-url.ts
4113
- function eo(e) {
4114
- let [t, n] = R(null);
4115
- return z(() => {
4203
+ function so(e) {
4204
+ let [t, n] = z(null);
4205
+ return B(() => {
4116
4206
  if (!e) {
4117
4207
  n(null);
4118
4208
  return;
@@ -4123,9 +4213,9 @@ function eo(e) {
4123
4213
  }
4124
4214
  //#endregion
4125
4215
  //#region src/runtime/ui/author-prompt.tsx
4126
- function to({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
4127
- let [o, s] = R(""), [c, l] = R(""), u = B(null);
4128
- z(() => {
4216
+ function co({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
4217
+ let [o, s] = z(""), [c, l] = z(""), u = V(null);
4218
+ B(() => {
4129
4219
  u.current?.focus();
4130
4220
  }, []);
4131
4221
  function d(n) {
@@ -4202,18 +4292,18 @@ function to({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit:
4202
4292
  }
4203
4293
  //#endregion
4204
4294
  //#region src/runtime/ui/composer.tsx
4205
- var no = 4e3;
4206
- function ro({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, isPending: i, error: a, onSubmit: o }) {
4207
- let [s, c] = R(""), l = B(null), u = B(!1);
4208
- z(() => {
4295
+ var lo = 4e3;
4296
+ function uo({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, isPending: i, error: a, onSubmit: o }) {
4297
+ let [s, c] = z(""), l = V(null), u = V(!1);
4298
+ B(() => {
4209
4299
  r && l.current?.focus();
4210
- }, [r]), z(() => {
4300
+ }, [r]), B(() => {
4211
4301
  let e = l.current;
4212
4302
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 160)}px`);
4213
- }, [s]), z(() => {
4303
+ }, [s]), B(() => {
4214
4304
  u.current && !i && !a && (c(""), l.current?.focus()), u.current = i;
4215
4305
  }, [i, a]);
4216
- let d = no - s.length, f = d < 0;
4306
+ let d = lo - s.length, f = d < 0;
4217
4307
  function p(e) {
4218
4308
  e?.preventDefault();
4219
4309
  let t = s.trim();
@@ -4231,7 +4321,7 @@ function ro({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4231
4321
  "aria-label": i ? "Sending…" : n,
4232
4322
  title: i ? "Sending…" : n,
4233
4323
  tabIndex: e,
4234
- children: /* @__PURE__ */ $(Ya, { size: 14 })
4324
+ children: /* @__PURE__ */ $(no, { size: 14 })
4235
4325
  });
4236
4326
  }
4237
4327
  return /* @__PURE__ */ $("form", {
@@ -4244,7 +4334,7 @@ function ro({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4244
4334
  class: "markup-composer-input",
4245
4335
  placeholder: t,
4246
4336
  rows: h ? 2 : 1,
4247
- maxLength: no + 100,
4337
+ maxLength: lo + 100,
4248
4338
  value: s,
4249
4339
  onInput: (e) => c(e.currentTarget.value),
4250
4340
  onKeyDown: m,
@@ -4280,15 +4370,15 @@ function ro({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
4280
4370
  }
4281
4371
  //#endregion
4282
4372
  //#region src/runtime/ui/new-thread-popover.tsx
4283
- function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, isPending: o, error: s, screenshot: c, isScreenshotCapturing: l, screenshotRedactedCount: u, screenshotRedactedSelectors: d, onAuthor: f, onSignIn: p, onSubmit: m, onClose: h }) {
4284
- let g = B(null);
4285
- $a(g, !0);
4286
- let [_, v] = R(!1), [y, b] = R(!1), x = eo(c), [C, w] = R(null), { onPointerDown: T, isDragging: E } = Va({
4373
+ function fo({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, isPending: o, error: s, screenshot: c, isScreenshotCapturing: l, screenshotRedactedCount: u, screenshotRedactedSelectors: d, onAuthor: f, onSignIn: p, onSubmit: m, onClose: h }) {
4374
+ let g = V(null);
4375
+ oo(g, !0);
4376
+ let [_, v] = z(!1), [y, b] = z(!1), x = so(c), [C, w] = z(null), { onPointerDown: T, isDragging: E } = Ja({
4287
4377
  targetRef: g,
4288
4378
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
4289
4379
  onMove: w
4290
4380
  });
4291
- z(() => {
4381
+ B(() => {
4292
4382
  let e = g.current;
4293
4383
  if (!e) return;
4294
4384
  if (typeof e.showPopover == "function" && !e.matches(":popover-open")) try {
@@ -4299,7 +4389,7 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4299
4389
  }
4300
4390
  return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
4301
4391
  }, [h]);
4302
- let D = ao(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), O = ao(t - window.scrollY - 16, 12, window.innerHeight - 220), k = c != null, A = l || k;
4392
+ let D = po(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), O = po(t - window.scrollY - 16, 12, window.innerHeight - 220), k = c != null, A = l || k;
4303
4393
  return /* @__PURE__ */ $("div", {
4304
4394
  ref: g,
4305
4395
  class: Q("markup-popover", C && "is-floating", E && "is-dragging"),
@@ -4321,9 +4411,9 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4321
4411
  class: "markup-icon-btn",
4322
4412
  "aria-label": "Discard pin",
4323
4413
  onClick: h,
4324
- children: /* @__PURE__ */ $(Ga, { size: 16 })
4414
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4325
4415
  })]
4326
- }), n == null ? /* @__PURE__ */ $(to, {
4416
+ }), n == null ? /* @__PURE__ */ $(co, {
4327
4417
  isPending: o,
4328
4418
  isConnecting: i,
4329
4419
  isSigningIn: a,
@@ -4347,7 +4437,7 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4347
4437
  }) : null
4348
4438
  ]
4349
4439
  }),
4350
- /* @__PURE__ */ $(ro, {
4440
+ /* @__PURE__ */ $(uo, {
4351
4441
  label: "Feedback",
4352
4442
  placeholder: "What's wrong, missing, or worth noting?",
4353
4443
  submitLabel: "Post markup",
@@ -4365,7 +4455,7 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4365
4455
  class: "markup-screenshot-checkbox",
4366
4456
  disabled: !0
4367
4457
  }),
4368
- /* @__PURE__ */ $(Ja, { size: 12 }),
4458
+ /* @__PURE__ */ $(to, { size: 12 }),
4369
4459
  /* @__PURE__ */ $("span", { children: "Capturing…" })
4370
4460
  ]
4371
4461
  }) : /* @__PURE__ */ $("label", {
@@ -4377,7 +4467,7 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4377
4467
  checked: _,
4378
4468
  onChange: (e) => v(e.currentTarget.checked)
4379
4469
  }),
4380
- /* @__PURE__ */ $(Ja, { size: 12 }),
4470
+ /* @__PURE__ */ $(to, { size: 12 }),
4381
4471
  /* @__PURE__ */ $("span", { children: "Attach screenshot" }),
4382
4472
  x && _ ? /* @__PURE__ */ $("img", {
4383
4473
  class: "markup-screenshot-thumb",
@@ -4425,12 +4515,12 @@ function io({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
4425
4515
  })]
4426
4516
  });
4427
4517
  }
4428
- function ao(e, t, n) {
4518
+ function po(e, t, n) {
4429
4519
  return Math.max(t, Math.min(n, e));
4430
4520
  }
4431
4521
  //#endregion
4432
4522
  //#region src/runtime/ui/pin.tsx
4433
- function oo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClick: a }) {
4523
+ function mo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClick: a }) {
4434
4524
  let o = t - window.scrollY, s = e - window.scrollX;
4435
4525
  return /* @__PURE__ */ $("button", {
4436
4526
  type: "button",
@@ -4453,7 +4543,7 @@ function oo({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClic
4453
4543
  }) : null]
4454
4544
  });
4455
4545
  }
4456
- function so({ pageX: e, pageY: t }) {
4546
+ function ho({ pageX: e, pageY: t }) {
4457
4547
  let n = t - window.scrollY, r = e - window.scrollX;
4458
4548
  return /* @__PURE__ */ $("div", {
4459
4549
  class: "markup-pin markup-pin-ghost is-anchor",
@@ -4469,15 +4559,15 @@ function so({ pageX: e, pageY: t }) {
4469
4559
  }
4470
4560
  //#endregion
4471
4561
  //#region src/runtime/ui/placement-overlay.tsx
4472
- function co({ onPlace: e, onCancel: t }) {
4473
- z(() => {
4562
+ function go({ onPlace: e, onCancel: t }) {
4563
+ B(() => {
4474
4564
  function e(e) {
4475
4565
  e.key === "Escape" && t();
4476
4566
  }
4477
4567
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
4478
4568
  }, [t]);
4479
4569
  function n(t) {
4480
- t.stopPropagation(), t.preventDefault(), e(Fr(t, document.elementsFromPoint(t.clientX, t.clientY).find((e) => !e.shadowRoot) ?? null), t.clientX, t.clientY);
4570
+ t.stopPropagation(), t.preventDefault(), e(Rr(t, document.elementsFromPoint(t.clientX, t.clientY).find((e) => !e.shadowRoot) ?? null), t.clientX, t.clientY);
4481
4571
  }
4482
4572
  function r(e) {
4483
4573
  e.preventDefault(), e.stopPropagation();
@@ -4495,14 +4585,14 @@ function co({ onPlace: e, onCancel: t }) {
4495
4585
  }
4496
4586
  //#endregion
4497
4587
  //#region src/runtime/ui/thread-popover.tsx
4498
- var lo = [
4588
+ var _o = [
4499
4589
  "👍",
4500
4590
  "❤️",
4501
4591
  "🎉",
4502
4592
  "😮",
4503
4593
  "😄",
4504
4594
  "❓"
4505
- ], uo = dr({
4595
+ ], vo = mr({
4506
4596
  none: {
4507
4597
  "toggle-thread-menu": () => ({
4508
4598
  kind: "thread-menu",
@@ -4558,22 +4648,22 @@ var lo = [
4558
4648
  dismiss: () => ({ kind: "none" })
4559
4649
  }
4560
4650
  });
4561
- function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, canDelete: o, isPending: s, error: c, isHidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4562
- let y = B(null), b = B(null), x = B(null), S = B(null), [C, w] = fr(uo, { kind: "none" }), [T, E] = R(null), { onPointerDown: D, isDragging: O } = Va({
4651
+ function yo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, canDelete: o, isPending: s, error: c, isHidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4652
+ let y = V(null), b = V(null), x = V(null), S = V(null), [C, w] = hr(vo, { kind: "none" }), [T, E] = z(null), { onPointerDown: D, isDragging: O } = Ja({
4563
4653
  targetRef: y,
4564
4654
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
4565
4655
  onMove: E
4566
4656
  });
4567
- $a(y, !0);
4568
- let k = e.resolvedAt != null, A = Ae(() => e.comments.filter((e) => !e.deleted), [e.comments]);
4569
- z(() => {
4657
+ oo(y, !0);
4658
+ let k = e.resolvedAt != null, A = Me(() => e.comments.filter((e) => !e.deleted), [e.comments]);
4659
+ B(() => {
4570
4660
  if (C.kind === "none" || C.kind === "editing") return;
4571
4661
  function e(e) {
4572
4662
  let t = S.current;
4573
4663
  t && !e.composedPath().includes(t) && w({ type: "dismiss" });
4574
4664
  }
4575
4665
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4576
- }, [C.kind, w]), z(() => {
4666
+ }, [C.kind, w]), B(() => {
4577
4667
  if (C.kind !== "editing") return;
4578
4668
  let t = e.comments.find((e) => e._id === C.commentId);
4579
4669
  (!t || t.deleted) && w({ type: "dismiss" });
@@ -4582,8 +4672,8 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4582
4672
  C,
4583
4673
  w
4584
4674
  ]);
4585
- let j = B(!0);
4586
- z(() => {
4675
+ let j = V(!0);
4676
+ B(() => {
4587
4677
  let e = b.current;
4588
4678
  if (e) {
4589
4679
  if (j.current) {
@@ -4592,7 +4682,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4592
4682
  }
4593
4683
  e.scrollHeight - e.scrollTop - e.clientHeight < 80 && (e.scrollTop = e.scrollHeight);
4594
4684
  }
4595
- }, [A.length]), z(() => {
4685
+ }, [A.length]), B(() => {
4596
4686
  let e = y.current;
4597
4687
  if (!e) return;
4598
4688
  if (typeof e.showPopover == "function" && !e.matches(":popover-open")) try {
@@ -4603,15 +4693,15 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4603
4693
  }
4604
4694
  return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
4605
4695
  }, [f]);
4606
- let M = Ae(() => {
4607
- let t = Ir({
4696
+ let M = Me(() => {
4697
+ let t = zr({
4608
4698
  anchorX: e.anchorX,
4609
4699
  anchorY: e.anchorY,
4610
4700
  anchorSelector: e.anchorSelector
4611
4701
  });
4612
4702
  return {
4613
- left: go(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4614
- top: go(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4703
+ left: Co(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4704
+ top: Co(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4615
4705
  };
4616
4706
  }, [
4617
4707
  e.anchorX,
@@ -4655,7 +4745,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4655
4745
  class: Q("markup-icon-btn", C.kind === "thread-menu" && "is-open"),
4656
4746
  title: "More options",
4657
4747
  onClick: () => w({ type: "toggle-thread-menu" }),
4658
- children: /* @__PURE__ */ $(Ka, { size: 16 })
4748
+ children: /* @__PURE__ */ $($a, { size: 16 })
4659
4749
  }), C.kind === "thread-menu" ? /* @__PURE__ */ $("div", {
4660
4750
  class: "markup-thread-menu-list",
4661
4751
  children: [/* @__PURE__ */ $("button", {
@@ -4683,14 +4773,14 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4683
4773
  title: "Mark as resolved",
4684
4774
  disabled: s,
4685
4775
  onClick: _,
4686
- children: /* @__PURE__ */ $(qa, { size: 16 })
4776
+ children: /* @__PURE__ */ $(eo, { size: 16 })
4687
4777
  }) : null,
4688
4778
  /* @__PURE__ */ $("button", {
4689
4779
  type: "button",
4690
4780
  class: "markup-icon-btn",
4691
4781
  title: "Close thread",
4692
4782
  onClick: f,
4693
- children: /* @__PURE__ */ $(Ga, { size: 16 })
4783
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4694
4784
  })
4695
4785
  ]
4696
4786
  })]
@@ -4717,12 +4807,12 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4717
4807
  /* @__PURE__ */ $("time", {
4718
4808
  class: "markup-comment-time",
4719
4809
  datetime: new Date(t.createdAt).toISOString(),
4720
- title: vo(t.createdAt),
4721
- children: _o(t.createdAt)
4810
+ title: To(t.createdAt),
4811
+ children: wo(t.createdAt)
4722
4812
  }),
4723
4813
  /* @__PURE__ */ $("div", {
4724
4814
  class: "markup-thread-actions",
4725
- children: [!k && !l ? /* @__PURE__ */ $(po, {
4815
+ children: [!k && !l ? /* @__PURE__ */ $(bo, {
4726
4816
  comment: t,
4727
4817
  pickerOpen: p,
4728
4818
  pickerDirection: _,
@@ -4790,7 +4880,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4790
4880
  direction: a < i ? "up" : "down"
4791
4881
  });
4792
4882
  },
4793
- children: /* @__PURE__ */ $(Ka, { size: 16 })
4883
+ children: /* @__PURE__ */ $($a, { size: 16 })
4794
4884
  }), d ? /* @__PURE__ */ $("div", {
4795
4885
  class: "markup-thread-menu-list",
4796
4886
  children: [o ? /* @__PURE__ */ $("button", {
@@ -4862,7 +4952,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4862
4952
  children: [t.body, t.editedAt == null ? null : /* @__PURE__ */ $("time", {
4863
4953
  class: "markup-comment-edited",
4864
4954
  datetime: new Date(t.editedAt).toISOString(),
4865
- title: vo(t.editedAt),
4955
+ title: To(t.editedAt),
4866
4956
  children: [" ", "(edited)"]
4867
4957
  })]
4868
4958
  }),
@@ -4875,7 +4965,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4875
4965
  alt: "Screenshot"
4876
4966
  })
4877
4967
  }) : null,
4878
- !l && t.reactions.length > 0 ? /* @__PURE__ */ $(mo, {
4968
+ !l && t.reactions.length > 0 ? /* @__PURE__ */ $(xo, {
4879
4969
  comment: t,
4880
4970
  isResolved: k,
4881
4971
  onToggle: (e) => g(t._id, e)
@@ -4895,7 +4985,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4895
4985
  onClick: (e) => {
4896
4986
  e.stopPropagation(), x.current?.close();
4897
4987
  },
4898
- children: /* @__PURE__ */ $(Ga, { size: 16 })
4988
+ children: /* @__PURE__ */ $(Qa, { size: 16 })
4899
4989
  }), /* @__PURE__ */ $("img", {
4900
4990
  class: "markup-lightbox-img",
4901
4991
  src: e.screenshotUrl,
@@ -4903,7 +4993,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4903
4993
  onClick: (e) => e.stopPropagation()
4904
4994
  })]
4905
4995
  }) : null,
4906
- t == null ? /* @__PURE__ */ $(to, {
4996
+ t == null ? /* @__PURE__ */ $(co, {
4907
4997
  isPending: s,
4908
4998
  isConnecting: i,
4909
4999
  isSigningIn: a,
@@ -4925,7 +5015,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4925
5015
  children: "team"
4926
5016
  }) : null
4927
5017
  ]
4928
- }), /* @__PURE__ */ $(ro, {
5018
+ }), /* @__PURE__ */ $(uo, {
4929
5019
  label: "Reply",
4930
5020
  placeholder: "Write a reply…",
4931
5021
  submitLabel: "Reply",
@@ -4938,7 +5028,7 @@ function fo({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
4938
5028
  ]
4939
5029
  });
4940
5030
  }
4941
- function po({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
5031
+ function bo({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
4942
5032
  return /* @__PURE__ */ $("div", {
4943
5033
  class: Q("markup-reaction-picker-wrap", t && "is-open", t && n === "up" && "is-up", r && "is-side"),
4944
5034
  ref: i,
@@ -4948,11 +5038,11 @@ function po({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4948
5038
  title: "Add reaction",
4949
5039
  "aria-label": "Add reaction",
4950
5040
  onClick: a,
4951
- children: /* @__PURE__ */ $(Xa, { size: 16 })
5041
+ children: /* @__PURE__ */ $(ro, { size: 16 })
4952
5042
  }), t ? /* @__PURE__ */ $("div", {
4953
5043
  class: "markup-reaction-picker",
4954
5044
  role: "menu",
4955
- children: lo.map((t) => /* @__PURE__ */ $("button", {
5045
+ children: _o.map((t) => /* @__PURE__ */ $("button", {
4956
5046
  type: "button",
4957
5047
  role: "menuitem",
4958
5048
  class: Q("markup-reaction-picker-item", (e.reactions.find((e) => e.emoji === t)?.mine ?? !1) && "is-mine"),
@@ -4962,11 +5052,11 @@ function po({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4962
5052
  }) : null]
4963
5053
  });
4964
5054
  }
4965
- function mo({ comment: e, isResolved: t, onToggle: n }) {
5055
+ function xo({ comment: e, isResolved: t, onToggle: n }) {
4966
5056
  return /* @__PURE__ */ $("div", {
4967
5057
  class: "markup-reactions",
4968
5058
  children: e.reactions.map((e) => {
4969
- let r = ho(e.reactors, e.mine, e.count, e.emoji);
5059
+ let r = So(e.reactors, e.mine, e.count, e.emoji);
4970
5060
  return /* @__PURE__ */ $("button", {
4971
5061
  type: "button",
4972
5062
  class: Q("markup-reaction-chip", e.mine && "is-mine"),
@@ -4987,14 +5077,14 @@ function mo({ comment: e, isResolved: t, onToggle: n }) {
4987
5077
  })
4988
5078
  });
4989
5079
  }
4990
- function ho(e, t, n, r) {
5080
+ function So(e, t, n, r) {
4991
5081
  let i = e.slice(), a = i.length + +!!t, o = Math.max(0, n - a);
4992
5082
  return o > 0 && i.push(`${o} other${o === 1 ? "" : "s"}`), t && i.push("you"), i.length === 0 ? `${n} reacted with ${r}` : `${i.length === 1 ? i[0] : `${i.slice(0, -1).join(", ")} and ${i[i.length - 1]}`} reacted with ${r}`;
4993
5083
  }
4994
- function go(e, t, n) {
5084
+ function Co(e, t, n) {
4995
5085
  return Math.max(t, Math.min(n, e));
4996
5086
  }
4997
- function _o(e) {
5087
+ function wo(e) {
4998
5088
  let t = Date.now() - e, n = Math.floor(t / 1e3);
4999
5089
  if (n < 60) return "just now";
5000
5090
  let r = Math.floor(n / 60);
@@ -5011,7 +5101,7 @@ function _o(e) {
5011
5101
  year: "numeric"
5012
5102
  });
5013
5103
  }
5014
- function vo(e) {
5104
+ function To(e) {
5015
5105
  return new Date(e).toLocaleDateString([], {
5016
5106
  month: "long",
5017
5107
  day: "numeric",
@@ -5022,7 +5112,7 @@ function vo(e) {
5022
5112
  }
5023
5113
  //#endregion
5024
5114
  //#region src/runtime/ui/app.tsx
5025
- function yo(e) {
5115
+ function Eo(e) {
5026
5116
  let t = {
5027
5117
  clientId: `markup_user_${e.identity.id}`,
5028
5118
  name: e.identity.name,
@@ -5047,10 +5137,10 @@ function yo(e) {
5047
5137
  } : {}
5048
5138
  };
5049
5139
  }
5050
- function bo() {
5140
+ function Do() {
5051
5141
  return window.location.host + window.location.pathname;
5052
5142
  }
5053
- var xo = dr({
5143
+ var Oo = mr({
5054
5144
  visible: {
5055
5145
  "hide-with-toast": () => ({ kind: "hidden-with-toast" }),
5056
5146
  toggle: () => ({ kind: "hidden" })
@@ -5061,26 +5151,26 @@ var xo = dr({
5061
5151
  },
5062
5152
  hidden: { toggle: () => ({ kind: "visible" }) }
5063
5153
  });
5064
- function So(e) {
5065
- return $r(e), e;
5154
+ function ko(e) {
5155
+ return oi(e), e;
5066
5156
  }
5067
- var Co = dr({
5157
+ var Ao = mr({
5068
5158
  unresolved: {
5069
- "mint-success": (e, t) => So({
5159
+ "mint-success": (e, t) => ko({
5070
5160
  kind: "anon",
5071
5161
  identity: t.identity
5072
5162
  }),
5073
- "signed-in": (e, t) => So({
5163
+ "signed-in": (e, t) => ko({
5074
5164
  kind: "verified",
5075
5165
  identity: t.identity
5076
5166
  })
5077
5167
  },
5078
5168
  anon: {
5079
- "signed-in": (e, t) => So({
5169
+ "signed-in": (e, t) => ko({
5080
5170
  kind: "verified",
5081
5171
  identity: t.identity
5082
5172
  }),
5083
- "author-set": (e, t) => So({
5173
+ "author-set": (e, t) => ko({
5084
5174
  kind: "anon",
5085
5175
  identity: {
5086
5176
  ...e.identity,
@@ -5090,11 +5180,11 @@ var Co = dr({
5090
5180
  })
5091
5181
  },
5092
5182
  verified: {
5093
- "signed-in": (e, t) => So({
5183
+ "signed-in": (e, t) => ko({
5094
5184
  kind: "verified",
5095
5185
  identity: t.identity
5096
5186
  }),
5097
- unauthorized: (e) => So({
5187
+ unauthorized: (e) => ko({
5098
5188
  kind: "recovering",
5099
5189
  preserved: {
5100
5190
  name: e.identity.name,
@@ -5103,32 +5193,32 @@ var Co = dr({
5103
5193
  })
5104
5194
  },
5105
5195
  recovering: {
5106
- "mint-success": (e, t) => So({
5196
+ "mint-success": (e, t) => ko({
5107
5197
  kind: "anon",
5108
5198
  identity: t.identity
5109
5199
  }),
5110
- "signed-in": (e, t) => So({
5200
+ "signed-in": (e, t) => ko({
5111
5201
  kind: "verified",
5112
5202
  identity: t.identity
5113
5203
  })
5114
5204
  }
5115
5205
  });
5116
- function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
5117
- let [a, o] = R(bo), [s, c] = R([]), [l, u] = R(!1), d = Ae(() => Qr(), []), [f, p] = fr(Co, d.state), [m, h] = R(null);
5118
- z(() => {
5206
+ function jo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
5207
+ let [a, o] = z(Do), [s, c] = z([]), [l, u] = z(!1), d = Me(() => ai(), []), [f, p] = hr(Ao, d.state), [m, h] = z(null);
5208
+ B(() => {
5119
5209
  let n = !1;
5120
- return Hr(e, t).then((e) => {
5210
+ return Yr(e, t).then((e) => {
5121
5211
  n || h(e);
5122
5212
  }), () => {
5123
5213
  n = !0;
5124
5214
  };
5125
5215
  }, [e, t]);
5126
- let [g, _] = R(n), v = B(f);
5127
- v.current = f, Ba(f, e, t, (e) => p({
5216
+ let [g, _] = z(n), v = V(f);
5217
+ v.current = f, qa(f, e, t, (e) => p({
5128
5218
  type: "signed-in",
5129
5219
  identity: e
5130
5220
  }), () => p({ type: "unauthorized" }));
5131
- let y = Ae(() => zr({
5221
+ let y = Me(() => Kr({
5132
5222
  apiUrl: e,
5133
5223
  apiKey: t,
5134
5224
  getToken: () => {
@@ -5153,8 +5243,8 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5153
5243
  e,
5154
5244
  t,
5155
5245
  p
5156
- ]), [b, x] = R({ kind: "idle" }), S = mr(), C = mr(), w = mr(), { run: T, reset: E } = S, { run: D } = C, { run: O, reset: k } = w, A = S.isPending, j = S.error ?? C.error ?? w.error, [M, N] = fr(xo, { kind: "visible" }), ee = M.kind !== "visible", [te, ne] = R(0), re = B(null), ie = ti(f), ae = f.kind === "verified", oe = f.kind === "unresolved" || f.kind === "recovering", P = ei(f);
5157
- z(() => {
5246
+ ]), [b, x] = z({ kind: "idle" }), S = _r(), C = _r(), w = _r(), { run: T, reset: E } = S, { run: D } = C, { run: O, reset: k } = w, A = S.isPending, j = S.error ?? C.error ?? w.error, [M, N] = hr(Oo, { kind: "visible" }), ee = M.kind !== "visible", [te, ne] = z(0), re = V(null), ie = ci(f), ae = f.kind === "verified", oe = f.kind === "unresolved" || f.kind === "recovering", P = si(f);
5247
+ B(() => {
5158
5248
  if (f.kind !== "unresolved" && f.kind !== "recovering") return;
5159
5249
  let e = f.kind === "recovering" ? f.preserved : d.preserved, t = !1, n = null, r = 1e3;
5160
5250
  function i() {
@@ -5181,16 +5271,16 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5181
5271
  p,
5182
5272
  d
5183
5273
  ]);
5184
- let se = Ia(y), [ce, le] = R(null);
5185
- z(() => {
5186
- let t = new ur(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
5274
+ let se = Ua(y), [ce, le] = z(null);
5275
+ B(() => {
5276
+ let t = new pr(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
5187
5277
  return le(t), () => {
5188
5278
  t.close(), le((e) => e === t ? null : e);
5189
5279
  };
5190
5280
  }, [e]);
5191
- let ue = B(!1);
5192
- z(() => {
5193
- if (!(!ce || !se)) return E(), k(), ce.onUpdate(en("widget/queries:subscribeThreadsForRoute"), {
5281
+ let ue = V(!1);
5282
+ B(() => {
5283
+ if (!(!ce || !se)) return E(), k(), ce.onUpdate(rn("widget/queries:subscribeThreadsForRoute"), {
5194
5284
  subscriptionToken: se,
5195
5285
  route: a,
5196
5286
  viewerClientId: P
@@ -5204,7 +5294,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5204
5294
  P,
5205
5295
  E,
5206
5296
  k
5207
- ]), z(() => {
5297
+ ]), B(() => {
5208
5298
  if (ue.current || !l) return;
5209
5299
  let e = window.location.hash.match(/^#markup-thread=(.+)$/);
5210
5300
  if (e) {
@@ -5215,16 +5305,16 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5215
5305
  }), history.replaceState(null, "", window.location.pathname + window.location.search);
5216
5306
  }
5217
5307
  ue.current = !0;
5218
- }, [s, l]), z(() => Jr(() => o(bo())), []), z(() => {
5308
+ }, [s, l]), B(() => ti(() => o(Do())), []), B(() => {
5219
5309
  function e(e) {
5220
5310
  e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), N({ type: "toggle" })));
5221
5311
  }
5222
5312
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
5223
- }, [N]), z(() => {
5313
+ }, [N]), B(() => {
5224
5314
  if (M.kind !== "hidden-with-toast") return;
5225
5315
  let e = window.setTimeout(() => N({ type: "dismiss-toast" }), 5e3);
5226
5316
  return () => window.clearTimeout(e);
5227
- }, [M.kind, N]), z(() => {
5317
+ }, [M.kind, N]), B(() => {
5228
5318
  let e = null;
5229
5319
  function t() {
5230
5320
  e ??= requestAnimationFrame(() => {
@@ -5237,11 +5327,11 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5237
5327
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n.disconnect(), e != null && cancelAnimationFrame(e);
5238
5328
  };
5239
5329
  }, []);
5240
- let de = V(() => {
5330
+ let de = H(() => {
5241
5331
  E(), k(), x({ kind: "placing" });
5242
- }, [E, k]), fe = V(() => {
5332
+ }, [E, k]), fe = H(() => {
5243
5333
  x({ kind: "idle" }), E(), k();
5244
- }, [E, k]), pe = B(0), me = V((e, t, n) => {
5334
+ }, [E, k]), pe = V(0), me = H((e, t, n) => {
5245
5335
  let r = t + window.scrollX, a = n + window.scrollY, o = ++pe.current;
5246
5336
  if (i?.enabled === !1) {
5247
5337
  x({
@@ -5272,7 +5362,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5272
5362
  strictScrub: i?.strictScrub,
5273
5363
  redactSelector: i?.redactSelector
5274
5364
  };
5275
- ka(s, {
5365
+ Ia(s, {
5276
5366
  x: t,
5277
5367
  y: n
5278
5368
  }, c).then((e) => {
@@ -5284,15 +5374,15 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5284
5374
  screenshotRedactedSelectors: e?.redactedSelectors ?? []
5285
5375
  });
5286
5376
  });
5287
- }, [i]), he = V((e, t) => {
5377
+ }, [i]), he = H((e, t) => {
5288
5378
  p({
5289
5379
  type: "author-set",
5290
5380
  name: e,
5291
5381
  email: t
5292
5382
  });
5293
- }, [p]), ge = C.isPending, _e = V(async () => {
5383
+ }, [p]), ge = C.isPending, _e = H(async () => {
5294
5384
  await D(async () => {
5295
- let n = yo(await ri({
5385
+ let n = Eo(await ui({
5296
5386
  apiUrl: e,
5297
5387
  apiKey: t,
5298
5388
  useCookies: m === !0
@@ -5309,17 +5399,23 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5309
5399
  m,
5310
5400
  D,
5311
5401
  p
5312
- ]), ve = V(async (e, t) => {
5402
+ ]), ve = H(async (e, t) => {
5313
5403
  if (b.kind !== "composing-new") return;
5314
- let n = ni(f);
5404
+ let n = li(f);
5315
5405
  n && await T(async () => {
5316
5406
  let r;
5317
5407
  if (t && b.screenshot) {
5318
- let { uploadUrl: e } = await y.getScreenshotUploadUrl(), t = await fetch(e, {
5319
- method: "POST",
5320
- headers: { "Content-Type": b.screenshot.type || "image/png" },
5321
- body: b.screenshot
5322
- });
5408
+ let { uploadUrl: e } = await y.getScreenshotUploadUrl(), t;
5409
+ try {
5410
+ t = await fetch(e, {
5411
+ method: "POST",
5412
+ headers: { "Content-Type": b.screenshot.type || "image/png" },
5413
+ body: b.screenshot,
5414
+ signal: AbortSignal.timeout(6e4)
5415
+ });
5416
+ } catch (e) {
5417
+ throw e instanceof DOMException && e.name === "TimeoutError" ? Error("Screenshot upload took too long — check your connection") : e;
5418
+ }
5323
5419
  if (!t.ok) throw Error(`Screenshot upload failed (${t.status})`);
5324
5420
  let { storageId: n } = await t.json();
5325
5421
  r = n;
@@ -5351,7 +5447,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5351
5447
  b,
5352
5448
  a,
5353
5449
  T
5354
- ]), F = V(async () => {
5450
+ ]), ye = H(async () => {
5355
5451
  if (b.kind !== "thread") return;
5356
5452
  let e = b.threadId;
5357
5453
  await T(async () => {
@@ -5361,7 +5457,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5361
5457
  y,
5362
5458
  b,
5363
5459
  T
5364
- ]), ye = V(async () => {
5460
+ ]), F = H(async () => {
5365
5461
  if (b.kind !== "thread") return;
5366
5462
  let e = b.threadId;
5367
5463
  await T(async () => {
@@ -5372,9 +5468,9 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5372
5468
  b,
5373
5469
  P,
5374
5470
  T
5375
- ]), be = V(async (e) => {
5471
+ ]), be = H(async (e) => {
5376
5472
  if (b.kind !== "thread") return;
5377
- let t = ni(f);
5473
+ let t = li(f);
5378
5474
  if (!t) return;
5379
5475
  let n = b.threadId;
5380
5476
  await T(async () => {
@@ -5390,7 +5486,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5390
5486
  f,
5391
5487
  b,
5392
5488
  T
5393
- ]), xe = V(async (e, t) => {
5489
+ ]), I = H(async (e, t) => {
5394
5490
  if (b.kind !== "thread" || f.kind !== "anon" && f.kind !== "verified") return;
5395
5491
  let n = b.threadId;
5396
5492
  await T(async () => {
@@ -5402,7 +5498,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5402
5498
  f,
5403
5499
  b,
5404
5500
  T
5405
- ]), Se = V(async (e) => {
5501
+ ]), xe = H(async (e) => {
5406
5502
  if (b.kind !== "thread" || f.kind !== "anon" && f.kind !== "verified") return;
5407
5503
  let t = b.threadId;
5408
5504
  await T(async () => {
@@ -5414,9 +5510,9 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5414
5510
  f,
5415
5511
  b,
5416
5512
  T
5417
- ]), I = V(async (e, t) => {
5513
+ ]), Se = H(async (e, t) => {
5418
5514
  if (b.kind !== "thread") return;
5419
- let n = ni(f);
5515
+ let n = li(f);
5420
5516
  if (!n) return;
5421
5517
  let r = b.threadId;
5422
5518
  await O(async () => {
@@ -5431,18 +5527,18 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5431
5527
  f,
5432
5528
  b,
5433
5529
  O
5434
- ]), L = b.kind === "thread" ? s.find((e) => e._id === b.threadId) ?? null : null, Ce = ae || P != null && P === L?.authorClientId, we = Ae(() => s.map((e) => ({
5530
+ ]), L = b.kind === "thread" ? s.find((e) => e._id === b.threadId) ?? null : null, Ce = ae || P != null && P === L?.authorClientId, R = Me(() => s.map((e) => ({
5435
5531
  thread: e,
5436
- point: Ir({
5532
+ point: zr({
5437
5533
  anchorX: e.anchorX,
5438
5534
  anchorY: e.anchorY,
5439
5535
  anchorSelector: e.anchorSelector,
5440
5536
  anchorOffsetX: e.anchorOffsetX,
5441
5537
  anchorOffsetY: e.anchorOffsetY
5442
5538
  })
5443
- })), [s, te]), Te = we.some((e) => !e.point.resolved);
5444
- return z(() => {
5445
- if (!Te) return;
5539
+ })), [s, te]), we = R.some((e) => !e.point.resolved);
5540
+ return B(() => {
5541
+ if (!we) return;
5446
5542
  let e = null;
5447
5543
  function t() {
5448
5544
  e ??= requestAnimationFrame(() => {
@@ -5456,7 +5552,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5456
5552
  }), () => {
5457
5553
  n.disconnect(), e != null && cancelAnimationFrame(e);
5458
5554
  };
5459
- }, [Te]), z(() => {
5555
+ }, [we]), B(() => {
5460
5556
  b.kind === "thread" && L == null && fe();
5461
5557
  }, [
5462
5558
  b,
@@ -5468,9 +5564,9 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5468
5564
  children: [
5469
5565
  b.kind === "placing" ? null : /* @__PURE__ */ $("div", {
5470
5566
  class: "markup-pins-layer",
5471
- children: [ee ? null : we.map(({ thread: e, point: t }) => {
5567
+ children: [ee ? null : R.map(({ thread: e, point: t }) => {
5472
5568
  let n = b.kind === "thread" && b.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
5473
- return /* @__PURE__ */ $(oo, {
5569
+ return /* @__PURE__ */ $(mo, {
5474
5570
  pageX: t.pageX,
5475
5571
  pageY: t.pageY,
5476
5572
  count: r,
@@ -5481,16 +5577,16 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5481
5577
  threadId: e._id
5482
5578
  })
5483
5579
  }, e._id);
5484
- }), b.kind === "composing-new" ? /* @__PURE__ */ $(so, {
5580
+ }), b.kind === "composing-new" ? /* @__PURE__ */ $(ho, {
5485
5581
  pageX: b.pageX,
5486
5582
  pageY: b.pageY
5487
5583
  }) : null]
5488
5584
  }),
5489
- b.kind === "placing" ? /* @__PURE__ */ $(co, {
5585
+ b.kind === "placing" ? /* @__PURE__ */ $(go, {
5490
5586
  onPlace: me,
5491
5587
  onCancel: fe
5492
5588
  }) : null,
5493
- b.kind === "thread" && L ? /* @__PURE__ */ $(fo, {
5589
+ b.kind === "thread" && L ? /* @__PURE__ */ $(yo, {
5494
5590
  thread: L,
5495
5591
  authorName: ie,
5496
5592
  currentClientId: P ?? null,
@@ -5505,13 +5601,13 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5505
5601
  onSignIn: _e,
5506
5602
  onClose: fe,
5507
5603
  onReply: be,
5508
- onEditComment: xe,
5509
- onDeleteComment: Se,
5510
- onToggleReaction: I,
5511
- onDelete: F,
5512
- onResolve: ye
5604
+ onEditComment: I,
5605
+ onDeleteComment: xe,
5606
+ onToggleReaction: Se,
5607
+ onDelete: ye,
5608
+ onResolve: F
5513
5609
  }, L._id) : null,
5514
- b.kind === "composing-new" ? /* @__PURE__ */ $(io, {
5610
+ b.kind === "composing-new" ? /* @__PURE__ */ $(fo, {
5515
5611
  pageX: b.pageX,
5516
5612
  pageY: b.pageY,
5517
5613
  authorName: ie,
@@ -5529,7 +5625,7 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5529
5625
  onSubmit: ve,
5530
5626
  onClose: fe
5531
5627
  }) : null,
5532
- !ee || b.kind === "placing" || b.kind === "composing-new" ? /* @__PURE__ */ $(Za, {
5628
+ !ee || b.kind === "placing" || b.kind === "composing-new" ? /* @__PURE__ */ $(io, {
5533
5629
  isActive: b.kind === "placing",
5534
5630
  onToggle: () => b.kind === "placing" ? fe() : de(),
5535
5631
  onHide: () => N({ type: "hide-with-toast" }),
@@ -5537,11 +5633,11 @@ function wo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5537
5633
  onPositionChange: _,
5538
5634
  variant: r
5539
5635
  }) : null,
5540
- M.kind === "hidden-with-toast" ? /* @__PURE__ */ $(To, { position: g }) : null
5636
+ M.kind === "hidden-with-toast" ? /* @__PURE__ */ $(Mo, { position: g }) : null
5541
5637
  ]
5542
5638
  });
5543
5639
  }
5544
- function To({ position: e }) {
5640
+ function Mo({ position: e }) {
5545
5641
  let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
5546
5642
  return /* @__PURE__ */ $("div", {
5547
5643
  class: Q("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : e === "bottom-center" ? "markup-hud-hidden-toast-center" : "markup-hud-hidden-toast-right"),
@@ -5563,47 +5659,50 @@ function To({ position: e }) {
5563
5659
  }
5564
5660
  //#endregion
5565
5661
  //#region src/runtime/mount.tsx
5566
- function Eo(e, t) {
5662
+ function No(e, t) {
5567
5663
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
5568
5664
  let n = t.theme ?? "auto";
5569
5665
  n !== "auto" && (e.dataset.theme = n);
5570
5666
  let r = e.attachShadow({ mode: "open" }), i = document.createElement("style");
5571
5667
  i.textContent = ue, r.appendChild(i);
5572
5668
  let a = document.createElement("div");
5573
- a.className = "markup-shadow-root", r.appendChild(a);
5574
- let o = {
5669
+ a.className = "markup-shadow-root", r.appendChild(a), ye({
5575
5670
  apiUrl: t.apiUrl,
5576
- apiKey: t.apiKey
5577
- }, { theme: s, ...c } = t;
5671
+ apiKey: t.apiKey,
5672
+ widgetVersion: "1.11.0"
5673
+ });
5674
+ let { theme: o, ...s } = t;
5578
5675
  return le(/* @__PURE__ */ $(de, {
5579
- onError: (e) => _e(o, e, { context: "render" }),
5580
- children: /* @__PURE__ */ $(wo, { ...c })
5581
- }), a), () => le(null, a);
5676
+ onError: (e) => F(e, { context: "render" }),
5677
+ children: /* @__PURE__ */ $(jo, { ...s })
5678
+ }), a), () => {
5679
+ ye(null), le(null, a);
5680
+ };
5582
5681
  }
5583
5682
  //#endregion
5584
5683
  //#region src/widget.ts
5585
- var Do = null, Oo = null, ko = null;
5586
- function Ao(e) {
5684
+ var Po = null, Fo = null, Io = null;
5685
+ function Lo(e) {
5587
5686
  if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
5588
- jo();
5687
+ Ro();
5589
5688
  let t = () => {
5590
- if (ko = null, !document.body) return;
5689
+ if (Io = null, !document.body) return;
5591
5690
  let t = document.createElement("div");
5592
- t.id = "markup-widget", document.body.appendChild(t), Oo = t, Do = Eo(t, e);
5691
+ t.id = "markup-widget", document.body.appendChild(t), Fo = t, Po = No(t, e);
5593
5692
  };
5594
5693
  if (document.readyState === "loading" || !document.body) {
5595
5694
  let e = () => t();
5596
- ko = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5695
+ Io = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5597
5696
  } else t();
5598
- return jo;
5697
+ return Ro;
5599
5698
  }
5600
- function jo() {
5601
- ko &&= (ko(), null), Do &&= (Do(), null), Oo?.parentNode && Oo.parentNode.removeChild(Oo), Oo = null;
5699
+ function Ro() {
5700
+ Io &&= (Io(), null), Po &&= (Po(), null), Fo?.parentNode && Fo.parentNode.removeChild(Fo), Fo = null;
5602
5701
  }
5603
5702
  if (typeof document < "u") {
5604
5703
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5605
5704
  if (t && n) {
5606
- let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Ao({
5705
+ let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Lo({
5607
5706
  apiUrl: t,
5608
5707
  apiKey: n,
5609
5708
  position: r,
@@ -5614,6 +5713,6 @@ if (typeof document < "u") {
5614
5713
  }
5615
5714
  }
5616
5715
  //#endregion
5617
- export { jo as destroy, Ao as init };
5716
+ export { Ro as destroy, Lo as init };
5618
5717
 
5619
5718
  //# sourceMappingURL=widget.js.map