@moq/watch 0.1.1 → 0.2.1

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.
@@ -404,7 +404,7 @@ const Ge = (e) => (n, t, r, s) => {
404
404
  throw Cn(a, s?.callee), a;
405
405
  }
406
406
  return o.value;
407
- }, Re = (e) => (n, t, r) => {
407
+ }, Ue = (e) => (n, t, r) => {
408
408
  const s = r ? { ...r, async: !1 } : { async: !1 }, i = n._zod.run({ value: t, issues: [] }, s);
409
409
  if (i instanceof Promise)
410
410
  throw new oe();
@@ -412,26 +412,26 @@ const Ge = (e) => (n, t, r, s) => {
412
412
  success: !1,
413
413
  error: new (e ?? Zn)(i.issues.map((o) => X(o, s, H())))
414
414
  } : { success: !0, data: i.value };
415
- }, Xt = /* @__PURE__ */ Re(Fn), Ue = (e) => async (n, t, r) => {
415
+ }, Xt = /* @__PURE__ */ Ue(Fn), Re = (e) => async (n, t, r) => {
416
416
  const s = r ? Object.assign(r, { async: !0 }) : { async: !0 };
417
417
  let i = n._zod.run({ value: t, issues: [] }, s);
418
418
  return i instanceof Promise && (i = await i), i.issues.length ? {
419
419
  success: !1,
420
420
  error: new e(i.issues.map((o) => X(o, s, H())))
421
421
  } : { success: !0, data: i.value };
422
- }, Kt = /* @__PURE__ */ Ue(Fn), Yt = (e) => (n, t, r) => {
422
+ }, Kt = /* @__PURE__ */ Re(Fn), Yt = (e) => (n, t, r) => {
423
423
  const s = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
424
424
  return Ge(e)(n, t, s);
425
425
  }, Qt = (e) => (n, t, r) => Ge(e)(n, t, r), er = (e) => async (n, t, r) => {
426
426
  const s = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
427
427
  return Je(e)(n, t, s);
428
428
  }, nr = (e) => async (n, t, r) => Je(e)(n, t, r), tr = (e) => (n, t, r) => {
429
- const s = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
430
- return Re(e)(n, t, s);
431
- }, rr = (e) => (n, t, r) => Re(e)(n, t, r), sr = (e) => async (n, t, r) => {
432
429
  const s = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
433
430
  return Ue(e)(n, t, s);
434
- }, ir = (e) => async (n, t, r) => Ue(e)(n, t, r), or = /^[cC][^\s-]{8,}$/, ar = /^[0-9a-z]+$/, cr = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, ur = /^[0-9a-vA-V]{20}$/, dr = /^[A-Za-z0-9]{27}$/, lr = /^[a-zA-Z0-9_-]{21}$/, fr = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, hr = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, en = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, pr = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, mr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
431
+ }, rr = (e) => (n, t, r) => Ue(e)(n, t, r), sr = (e) => async (n, t, r) => {
432
+ const s = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
433
+ return Re(e)(n, t, s);
434
+ }, ir = (e) => async (n, t, r) => Re(e)(n, t, r), or = /^[cC][^\s-]{8,}$/, ar = /^[0-9a-z]+$/, cr = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, ur = /^[0-9a-vA-V]{20}$/, dr = /^[A-Za-z0-9]{27}$/, lr = /^[a-zA-Z0-9_-]{21}$/, fr = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, hr = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, en = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, pr = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, mr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
435
435
  function wr() {
436
436
  return new RegExp(mr, "u");
437
437
  }
@@ -493,7 +493,7 @@ const Er = (e) => {
493
493
  continue: !n.abort
494
494
  });
495
495
  };
496
- }), Rr = /* @__PURE__ */ l("$ZodCheckMultipleOf", (e, n) => {
496
+ }), Ur = /* @__PURE__ */ l("$ZodCheckMultipleOf", (e, n) => {
497
497
  x.init(e, n), e._zod.onattach.push((t) => {
498
498
  var r;
499
499
  (r = t._zod.bag).multipleOf ?? (r.multipleOf = n.value);
@@ -509,7 +509,7 @@ const Er = (e) => {
509
509
  continue: !n.abort
510
510
  });
511
511
  };
512
- }), Ur = /* @__PURE__ */ l("$ZodCheckNumberFormat", (e, n) => {
512
+ }), Rr = /* @__PURE__ */ l("$ZodCheckNumberFormat", (e, n) => {
513
513
  x.init(e, n), n.format = n.format || "float64";
514
514
  const t = n.format?.includes("int"), r = t ? "int" : "number", [s, i] = Zt[n.format];
515
515
  e._zod.onattach.push((o) => {
@@ -1050,7 +1050,7 @@ const ms = /* @__PURE__ */ l("$ZodJWT", (e, n) => {
1050
1050
  }), t;
1051
1051
  };
1052
1052
  }), ws = /* @__PURE__ */ l("$ZodNumberFormat", (e, n) => {
1053
- Ur.init(e, n), Xn.init(e, n);
1053
+ Rr.init(e, n), Xn.init(e, n);
1054
1054
  }), gs = /* @__PURE__ */ l("$ZodBoolean", (e, n) => {
1055
1055
  z.init(e, n), e._zod.pattern = Or, e._zod.parse = (t, r) => {
1056
1056
  if (n.coerce)
@@ -1190,19 +1190,19 @@ const _s = /* @__PURE__ */ l("$ZodObject", (e, n) => {
1190
1190
  }), ks = /* @__PURE__ */ l("$ZodObjectJIT", (e, n) => {
1191
1191
  _s.init(e, n);
1192
1192
  const t = e._zod.parse, r = Pe(() => Kn(n)), s = (p) => {
1193
- const m = new jr(["shape", "payload", "ctx"]), y = r.value, g = (U) => {
1194
- const k = Qe(U);
1193
+ const m = new jr(["shape", "payload", "ctx"]), y = r.value, g = (R) => {
1194
+ const k = Qe(R);
1195
1195
  return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1196
1196
  };
1197
1197
  m.write("const input = payload.value;");
1198
1198
  const M = /* @__PURE__ */ Object.create(null);
1199
1199
  let q = 0;
1200
- for (const U of y.keys)
1201
- M[U] = `key_${q++}`;
1200
+ for (const R of y.keys)
1201
+ M[R] = `key_${q++}`;
1202
1202
  m.write("const newResult = {};");
1203
- for (const U of y.keys) {
1204
- const k = M[U], O = Qe(U), B = p[U]?._zod?.optout === "optional";
1205
- m.write(`const ${k} = ${g(U)};`), B ? m.write(`
1203
+ for (const R of y.keys) {
1204
+ const k = M[R], O = Qe(R), B = p[R]?._zod?.optout === "optional";
1205
+ m.write(`const ${k} = ${g(R)};`), B ? m.write(`
1206
1206
  if (${k}.issues.length) {
1207
1207
  if (${O} in input) {
1208
1208
  payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
@@ -1240,7 +1240,7 @@ const _s = /* @__PURE__ */ l("$ZodObject", (e, n) => {
1240
1240
  }
1241
1241
  m.write("payload.value = newResult;"), m.write("return payload;");
1242
1242
  const Z = m.compile();
1243
- return (U, k) => Z(p, U, k);
1243
+ return (R, k) => Z(p, R, k);
1244
1244
  };
1245
1245
  let i;
1246
1246
  const o = ge, a = !$n.jitless, u = a && Ct.value, d = n.catchall;
@@ -1537,7 +1537,7 @@ const et = /* @__PURE__ */ l("$ZodOptional", (e, n) => {
1537
1537
  const t = n.innerType._zod.pattern;
1538
1538
  return t ? new RegExp(`^(${Ve(t.source)}|null)$`) : void 0;
1539
1539
  }), b(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, null]) : void 0), e._zod.parse = (t, r) => t.value === null ? t : n.innerType._zod.run(t, r);
1540
- }), Rs = /* @__PURE__ */ l("$ZodDefault", (e, n) => {
1540
+ }), Us = /* @__PURE__ */ l("$ZodDefault", (e, n) => {
1541
1541
  z.init(e, n), e._zod.optin = "optional", b(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1542
1542
  if (r.direction === "backward")
1543
1543
  return n.innerType._zod.run(t, r);
@@ -1550,7 +1550,7 @@ const et = /* @__PURE__ */ l("$ZodOptional", (e, n) => {
1550
1550
  function on(e, n) {
1551
1551
  return e.value === void 0 && (e.value = n.defaultValue), e;
1552
1552
  }
1553
- const Us = /* @__PURE__ */ l("$ZodPrefault", (e, n) => {
1553
+ const Rs = /* @__PURE__ */ l("$ZodPrefault", (e, n) => {
1554
1554
  z.init(e, n), e._zod.optin = "optional", b(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => (r.direction === "backward" || t.value === void 0 && (t.value = n.defaultValue), n.innerType._zod.run(t, r));
1555
1555
  }), Ns = /* @__PURE__ */ l("$ZodNonOptional", (e, n) => {
1556
1556
  z.init(e, n), b(e._zod, "values", () => {
@@ -2016,7 +2016,7 @@ function De(e, n) {
2016
2016
  }
2017
2017
  // @__NO_SIDE_EFFECTS__
2018
2018
  function pn(e, n) {
2019
- return new Rr({
2019
+ return new Ur({
2020
2020
  check: "multiple_of",
2021
2021
  ...w(n),
2022
2022
  value: e
@@ -2147,7 +2147,7 @@ function Ai(e, n, t) {
2147
2147
  }
2148
2148
  // @__NO_SIDE_EFFECTS__
2149
2149
  function Pi(e) {
2150
- const n = /* @__PURE__ */ Ri((t) => (t.addIssue = (r) => {
2150
+ const n = /* @__PURE__ */ Ui((t) => (t.addIssue = (r) => {
2151
2151
  if (typeof r == "string")
2152
2152
  t.issues.push(ve(r, t.value, n._zod.def));
2153
2153
  else {
@@ -2158,7 +2158,7 @@ function Pi(e) {
2158
2158
  return n;
2159
2159
  }
2160
2160
  // @__NO_SIDE_EFFECTS__
2161
- function Ri(e, n) {
2161
+ function Ui(e, n) {
2162
2162
  const t = new x({
2163
2163
  check: "custom",
2164
2164
  ...w(n)
@@ -2392,7 +2392,7 @@ function $(e, n) {
2392
2392
  }
2393
2393
  return !1;
2394
2394
  }
2395
- const Ui = (e, n = {}) => (t) => {
2395
+ const Ri = (e, n = {}) => (t) => {
2396
2396
  const r = rt({ ...t, processors: n });
2397
2397
  return P(e, r), st(r, e), it(r, e);
2398
2398
  }, Oe = (e, n, t = {}) => (r) => {
@@ -2615,12 +2615,12 @@ const uo = (e, n) => {
2615
2615
  });
2616
2616
  }, F = l("ZodError", uo, {
2617
2617
  Parent: Error
2618
- }), lo = /* @__PURE__ */ Ge(F), fo = /* @__PURE__ */ Je(F), ho = /* @__PURE__ */ Re(F), po = /* @__PURE__ */ Ue(F), mo = /* @__PURE__ */ Yt(F), wo = /* @__PURE__ */ Qt(F), go = /* @__PURE__ */ er(F), vo = /* @__PURE__ */ nr(F), bo = /* @__PURE__ */ tr(F), yo = /* @__PURE__ */ rr(F), _o = /* @__PURE__ */ sr(F), ko = /* @__PURE__ */ ir(F), I = /* @__PURE__ */ l("ZodType", (e, n) => (z.init(e, n), Object.assign(e["~standard"], {
2618
+ }), lo = /* @__PURE__ */ Ge(F), fo = /* @__PURE__ */ Je(F), ho = /* @__PURE__ */ Ue(F), po = /* @__PURE__ */ Re(F), mo = /* @__PURE__ */ Yt(F), wo = /* @__PURE__ */ Qt(F), go = /* @__PURE__ */ er(F), vo = /* @__PURE__ */ nr(F), bo = /* @__PURE__ */ tr(F), yo = /* @__PURE__ */ rr(F), _o = /* @__PURE__ */ sr(F), ko = /* @__PURE__ */ ir(F), I = /* @__PURE__ */ l("ZodType", (e, n) => (z.init(e, n), Object.assign(e["~standard"], {
2619
2619
  jsonSchema: {
2620
2620
  input: Oe(e, "input"),
2621
2621
  output: Oe(e, "output")
2622
2622
  }
2623
- }), e.toJSONSchema = Ui(e, {}), e.def = n, e.type = n.type, Object.defineProperty(e, "_def", { value: n }), e.check = (...t) => e.clone(Y(n, {
2623
+ }), e.toJSONSchema = Ri(e, {}), e.def = n, e.type = n.type, Object.defineProperty(e, "_def", { value: n }), e.check = (...t) => e.clone(Y(n, {
2624
2624
  checks: [
2625
2625
  ...n.checks ?? [],
2626
2626
  ...t.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
@@ -2645,7 +2645,7 @@ const uo = (e, n) => {
2645
2645
  const t = e._zod.bag;
2646
2646
  e.format = t.format ?? null, e.minLength = t.minimum ?? null, e.maxLength = t.maximum ?? null, e.regex = (...r) => e.check(/* @__PURE__ */ gi(...r)), e.includes = (...r) => e.check(/* @__PURE__ */ yi(...r)), e.startsWith = (...r) => e.check(/* @__PURE__ */ _i(...r)), e.endsWith = (...r) => e.check(/* @__PURE__ */ ki(...r)), e.min = (...r) => e.check(/* @__PURE__ */ Te(...r)), e.max = (...r) => e.check(/* @__PURE__ */ nt(...r)), e.length = (...r) => e.check(/* @__PURE__ */ tt(...r)), e.nonempty = (...r) => e.check(/* @__PURE__ */ Te(1, ...r)), e.lowercase = (r) => e.check(/* @__PURE__ */ vi(r)), e.uppercase = (r) => e.check(/* @__PURE__ */ bi(r)), e.trim = () => e.check(/* @__PURE__ */ zi()), e.normalize = (...r) => e.check(/* @__PURE__ */ Si(...r)), e.toLowerCase = () => e.check(/* @__PURE__ */ Ii()), e.toUpperCase = () => e.check(/* @__PURE__ */ Ei()), e.slugify = () => e.check(/* @__PURE__ */ Ti());
2647
2647
  }), So = /* @__PURE__ */ l("ZodString", (e, n) => {
2648
- We.init(e, n), at.init(e, n), e.email = (t) => e.check(/* @__PURE__ */ Fs(zo, t)), e.url = (t) => e.check(/* @__PURE__ */ Gs(Io, t)), e.jwt = (t) => e.check(/* @__PURE__ */ ai(Zo, t)), e.emoji = (t) => e.check(/* @__PURE__ */ Js(Eo, t)), e.guid = (t) => e.check(/* @__PURE__ */ ln(mn, t)), e.uuid = (t) => e.check(/* @__PURE__ */ Bs(Ie, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ js(Ie, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ Vs(Ie, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ Ls(Ie, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ Ws(To, t)), e.guid = (t) => e.check(/* @__PURE__ */ ln(mn, t)), e.cuid = (t) => e.check(/* @__PURE__ */ Hs(Oo, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ Xs(Ao, t)), e.ulid = (t) => e.check(/* @__PURE__ */ Ks(Po, t)), e.base64 = (t) => e.check(/* @__PURE__ */ si(Co, t)), e.base64url = (t) => e.check(/* @__PURE__ */ ii(xo, t)), e.xid = (t) => e.check(/* @__PURE__ */ Ys(Ro, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ Qs(Uo, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ ei(No, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ ni(Mo, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ ti($o, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ ri(Do, t)), e.e164 = (t) => e.check(/* @__PURE__ */ oi(qo, t)), e.datetime = (t) => e.check(to(t)), e.date = (t) => e.check(so(t)), e.time = (t) => e.check(oo(t)), e.duration = (t) => e.check(co(t));
2648
+ We.init(e, n), at.init(e, n), e.email = (t) => e.check(/* @__PURE__ */ Fs(zo, t)), e.url = (t) => e.check(/* @__PURE__ */ Gs(Io, t)), e.jwt = (t) => e.check(/* @__PURE__ */ ai(Zo, t)), e.emoji = (t) => e.check(/* @__PURE__ */ Js(Eo, t)), e.guid = (t) => e.check(/* @__PURE__ */ ln(mn, t)), e.uuid = (t) => e.check(/* @__PURE__ */ Bs(Ie, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ js(Ie, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ Vs(Ie, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ Ls(Ie, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ Ws(To, t)), e.guid = (t) => e.check(/* @__PURE__ */ ln(mn, t)), e.cuid = (t) => e.check(/* @__PURE__ */ Hs(Oo, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ Xs(Ao, t)), e.ulid = (t) => e.check(/* @__PURE__ */ Ks(Po, t)), e.base64 = (t) => e.check(/* @__PURE__ */ si(Co, t)), e.base64url = (t) => e.check(/* @__PURE__ */ ii(xo, t)), e.xid = (t) => e.check(/* @__PURE__ */ Ys(Uo, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ Qs(Ro, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ ei(No, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ ni(Mo, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ ti($o, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ ri(Do, t)), e.e164 = (t) => e.check(/* @__PURE__ */ oi(qo, t)), e.datetime = (t) => e.check(to(t)), e.date = (t) => e.check(so(t)), e.time = (t) => e.check(oo(t)), e.duration = (t) => e.check(co(t));
2649
2649
  });
2650
2650
  function S(e) {
2651
2651
  return /* @__PURE__ */ Zs(So, e);
@@ -2670,9 +2670,9 @@ const E = /* @__PURE__ */ l("ZodStringFormat", (e, n) => {
2670
2670
  Yr.init(e, n), E.init(e, n);
2671
2671
  }), Po = /* @__PURE__ */ l("ZodULID", (e, n) => {
2672
2672
  Qr.init(e, n), E.init(e, n);
2673
- }), Ro = /* @__PURE__ */ l("ZodXID", (e, n) => {
2673
+ }), Uo = /* @__PURE__ */ l("ZodXID", (e, n) => {
2674
2674
  es.init(e, n), E.init(e, n);
2675
- }), Uo = /* @__PURE__ */ l("ZodKSUID", (e, n) => {
2675
+ }), Ro = /* @__PURE__ */ l("ZodKSUID", (e, n) => {
2676
2676
  ns.init(e, n), E.init(e, n);
2677
2677
  }), No = /* @__PURE__ */ l("ZodIPv4", (e, n) => {
2678
2678
  os.init(e, n), E.init(e, n);
@@ -2886,7 +2886,7 @@ function yn(e) {
2886
2886
  });
2887
2887
  }
2888
2888
  const aa = /* @__PURE__ */ l("ZodDefault", (e, n) => {
2889
- Rs.init(e, n), I.init(e, n), e._zod.processJSONSchema = (t, r, s) => Xi(e, t, r, s), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2889
+ Us.init(e, n), I.init(e, n), e._zod.processJSONSchema = (t, r, s) => Xi(e, t, r, s), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2890
2890
  });
2891
2891
  function ca(e, n) {
2892
2892
  return new aa({
@@ -2898,7 +2898,7 @@ function ca(e, n) {
2898
2898
  });
2899
2899
  }
2900
2900
  const ua = /* @__PURE__ */ l("ZodPrefault", (e, n) => {
2901
- Us.init(e, n), I.init(e, n), e._zod.processJSONSchema = (t, r, s) => Ki(e, t, r, s), e.unwrap = () => e._zod.def.innerType;
2901
+ Rs.init(e, n), I.init(e, n), e._zod.processJSONSchema = (t, r, s) => Ki(e, t, r, s), e.unwrap = () => e._zod.def.innerType;
2902
2902
  });
2903
2903
  function da(e, n) {
2904
2904
  return new ua({
@@ -3051,7 +3051,7 @@ const D = J().int().nonnegative().max(Number.MAX_SAFE_INTEGER).brand("u53"), ft
3051
3051
  // If provided, this broadcaster is signaling the location of other peers.
3052
3052
  // The payload is a JSON blob keyed by handle for each peer.
3053
3053
  peers: be.optional()
3054
- }), Wc = He(S(), ht), Hc = T({
3054
+ }), Kc = He(S(), ht), Yc = T({
3055
3055
  name: S().optional(),
3056
3056
  // name
3057
3057
  avatar: S().optional(),
@@ -3159,7 +3159,7 @@ const D = J().int().nonnegative().max(Number.MAX_SAFE_INTEGER).brand("u53"), ft
3159
3159
  capabilities: za.optional(),
3160
3160
  preview: be.optional()
3161
3161
  });
3162
- function Ra(e) {
3162
+ function Ua(e) {
3163
3163
  const t = new TextDecoder().decode(e);
3164
3164
  try {
3165
3165
  const r = JSON.parse(t);
@@ -3168,10 +3168,10 @@ function Ra(e) {
3168
3168
  throw console.warn("invalid catalog", t), r;
3169
3169
  }
3170
3170
  }
3171
- async function Ua(e) {
3171
+ async function Ra(e) {
3172
3172
  const n = await e.readFrame();
3173
3173
  if (n)
3174
- return Ra(n);
3174
+ return Ua(n);
3175
3175
  }
3176
3176
  function pt(e) {
3177
3177
  return e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer;
@@ -3781,13 +3781,13 @@ function St(e, n) {
3781
3781
  throw new Error(
3782
3782
  `Sample ${g} would overflow mdat: offset=${m}, size=${q}, mdatLength=${f.length}`
3783
3783
  );
3784
- const U = g === 0 && u.firstSampleFlags !== void 0 ? u.firstSampleFlags : M.sampleFlags ?? c, k = M.sampleCompositionTimeOffset ?? 0, O = new Uint8Array(f.slice(m, m + q));
3784
+ const R = g === 0 && u.firstSampleFlags !== void 0 ? u.firstSampleFlags : M.sampleFlags ?? c, k = M.sampleCompositionTimeOffset ?? 0, O = new Uint8Array(f.slice(m, m + q));
3785
3785
  m += q;
3786
- const j = y + k, B = Math.round(j * 1e6 / n), R = U === 0 || (U & 65536) === 0;
3786
+ const j = y + k, B = Math.round(j * 1e6 / n), U = R === 0 || (R & 65536) === 0;
3787
3787
  p.push({
3788
3788
  data: O,
3789
3789
  timestamp: B,
3790
- keyframe: R
3790
+ keyframe: U
3791
3791
  }), y += Z;
3792
3792
  }
3793
3793
  return p;
@@ -3946,7 +3946,7 @@ function Pn(e) {
3946
3946
  flags: 0,
3947
3947
  entryCount: 0,
3948
3948
  entries: []
3949
- }, U = zt(), k = It(), O = Et(), Me = we([a, {
3949
+ }, R = zt(), k = It(), O = Et(), Me = we([a, {
3950
3950
  type: "moov",
3951
3951
  boxes: [c, {
3952
3952
  type: "trak",
@@ -3957,7 +3957,7 @@ function Pn(e) {
3957
3957
  boxes: [p, g, {
3958
3958
  type: "stbl",
3959
3959
  // biome-ignore lint/suspicious/noExplicitAny: Raw boxes for types without library writers
3960
- boxes: [q, Z, U, k, O]
3960
+ boxes: [q, Z, R, k, O]
3961
3961
  }]
3962
3962
  }]
3963
3963
  }]
@@ -3980,7 +3980,7 @@ function Pn(e) {
3980
3980
  ke.set(new Uint8Array(V.buffer, V.byteOffset, V.byteLength), fe), fe += V.byteLength;
3981
3981
  return ke;
3982
3982
  }
3983
- function Rn(e) {
3983
+ function Un(e) {
3984
3984
  const { sampleRate: n, numberOfChannels: t, description: r, codec: s, container: i } = e, o = i.kind === "cmaf" ? i.timescale : 1e6, a = i.kind === "cmaf" ? i.trackId : 1, c = {
3985
3985
  type: "ftyp",
3986
3986
  majorBrand: "isom",
@@ -4064,7 +4064,7 @@ function Rn(e) {
4064
4064
  entryCount: 1,
4065
4065
  // biome-ignore lint/suspicious/noExplicitAny: Raw sample entry box
4066
4066
  entries: [gc(s, n, t, r)]
4067
- }, U = {
4067
+ }, R = {
4068
4068
  type: "stts",
4069
4069
  version: 0,
4070
4070
  flags: 0,
@@ -4081,7 +4081,7 @@ function Rn(e) {
4081
4081
  boxes: [m, M, {
4082
4082
  type: "stbl",
4083
4083
  // biome-ignore lint/suspicious/noExplicitAny: Raw boxes for types without library writers
4084
- boxes: [Z, U, k, O, j]
4084
+ boxes: [Z, R, k, O, j]
4085
4085
  }]
4086
4086
  }]
4087
4087
  }]
@@ -4192,13 +4192,13 @@ function Tt(e) {
4192
4192
  }]
4193
4193
  }, y = we([m]);
4194
4194
  let g = 0;
4195
- for (const R of y)
4196
- g += R.byteLength;
4195
+ for (const U of y)
4196
+ g += U.byteLength;
4197
4197
  f.dataOffset = g + 8;
4198
4198
  const M = we([m]);
4199
4199
  g = 0;
4200
- for (const R of M)
4201
- g += R.byteLength;
4200
+ for (const U of M)
4201
+ g += U.byteLength;
4202
4202
  const q = new ArrayBuffer(n.byteLength), Z = new Uint8Array(q);
4203
4203
  Z.set(n);
4204
4204
  const k = we([{
@@ -4206,14 +4206,14 @@ function Tt(e) {
4206
4206
  data: Z
4207
4207
  }]);
4208
4208
  let O = 0;
4209
- for (const R of k)
4210
- O += R.byteLength;
4209
+ for (const U of k)
4210
+ O += U.byteLength;
4211
4211
  const j = new Uint8Array(g + O);
4212
4212
  let B = 0;
4213
- for (const R of M)
4214
- j.set(new Uint8Array(R.buffer, R.byteOffset, R.byteLength), B), B += R.byteLength;
4215
- for (const R of k)
4216
- j.set(new Uint8Array(R.buffer, R.byteOffset, R.byteLength), B), B += R.byteLength;
4213
+ for (const U of M)
4214
+ j.set(new Uint8Array(U.buffer, U.byteOffset, U.byteLength), B), B += U.byteLength;
4215
+ for (const U of k)
4216
+ j.set(new Uint8Array(U.buffer, U.byteOffset, U.byteLength), B), B += U.byteLength;
4217
4217
  return j;
4218
4218
  }
4219
4219
  class le {
@@ -4261,23 +4261,29 @@ class le {
4261
4261
  timestamp: i,
4262
4262
  keyframe: t
4263
4263
  };
4264
- t = !1, n.frames.push(o), (!n.latest || i > n.latest) && (n.latest = i), this.#u(), n.consumer.sequence === this.#t ? (this.#s?.(), this.#s = void 0) : this.#d();
4264
+ t = !1, n.frames.push(o), (n.latest === void 0 || i > n.latest) && (n.latest = i), this.#u(), n.consumer.sequence === this.#t ? (this.#s?.(), this.#s = void 0) : this.#d();
4265
4265
  }
4266
4266
  } catch {
4267
4267
  } finally {
4268
- n.consumer.sequence === this.#t && (this.#t += 1, this.#s?.(), this.#s = void 0), n.consumer.close();
4268
+ n.done = !0, n.consumer.sequence === this.#t && (this.#t += 1), this.#u(), this.#s?.(), this.#s = void 0, n.consumer.close();
4269
4269
  }
4270
4270
  }
4271
4271
  #d() {
4272
- if (this.#e.length < 2) return;
4273
- const n = this.#e[0];
4274
- let t, r;
4275
- for (const i of this.#e) {
4276
- if (!i.latest) continue;
4277
- const o = i.frames.at(0)?.timestamp ?? i.latest;
4278
- (t === void 0 || o < t) && (t = o), (r === void 0 || i.latest > r) && (r = i.latest);
4272
+ if (this.#t === void 0) return;
4273
+ let n = !1;
4274
+ for (; this.#e.length >= 2; ) {
4275
+ const t = A.Time.Micro.fromMilli(this.#r.peek());
4276
+ let r, s;
4277
+ for (const a of this.#e) {
4278
+ if (a.latest === void 0) continue;
4279
+ const c = a.frames.at(0)?.timestamp ?? a.latest;
4280
+ (r === void 0 || c < r) && (r = c), (s === void 0 || a.latest > s) && (s = a.latest);
4281
+ }
4282
+ if (r === void 0 || s === void 0 || s - r <= t) break;
4283
+ const o = this.#e.shift();
4284
+ this.#t = this.#e[0]?.consumer.sequence, console.warn(`skipping slow group: ${o.consumer.sequence} -> ${this.#t}`), o.consumer.close(), o.frames.length = 0, n = !0;
4279
4285
  }
4280
- t === void 0 || r === void 0 || r - t < A.Time.Micro.fromMilli(this.#r.peek()) || (this.#t !== void 0 && n.consumer.sequence <= this.#t && (this.#e.shift(), this.#t = this.#e[0]?.consumer.sequence, console.warn(`skipping slow group: ${n.consumer.sequence} < ${this.#t}`), n.consumer.close(), n.frames.length = 0), this.#u(), this.#s?.(), this.#s = void 0);
4286
+ n && (this.#u(), this.#s?.(), this.#s = void 0);
4281
4287
  }
4282
4288
  // Returns the next frame in order, along with the group number.
4283
4289
  // If frame is undefined, the group is done.
@@ -4287,7 +4293,8 @@ class le {
4287
4293
  const t = this.#e[0].frames.shift();
4288
4294
  if (t)
4289
4295
  return this.#u(), { frame: t, group: this.#e[0].consumer.sequence };
4290
- if (this.#t > this.#e[0].consumer.sequence) {
4296
+ if (this.#t > this.#e[0].consumer.sequence || this.#e[0].done) {
4297
+ this.#e[0].consumer.sequence === this.#t && (this.#t += 1);
4291
4298
  const r = this.#e.shift();
4292
4299
  if (r)
4293
4300
  return this.#u(), { frame: void 0, group: r.consumer.sequence };
@@ -4311,11 +4318,12 @@ class le {
4311
4318
  }
4312
4319
  #u() {
4313
4320
  const n = [];
4314
- for (const t of this.#e) {
4315
- const r = t.frames.at(0);
4316
- if (!r || !t.latest) continue;
4317
- const s = A.Time.Milli.fromMicro(r.timestamp), i = A.Time.Milli.fromMicro(t.latest), o = n.at(-1);
4318
- o && o.end >= s ? o.end = A.Time.Milli.max(o.end, i) : n.push({ start: s, end: i });
4321
+ let t;
4322
+ for (const r of this.#e) {
4323
+ const s = r.frames.at(0);
4324
+ if (!s || r.latest === void 0) continue;
4325
+ const i = A.Time.Milli.fromMicro(s.timestamp), o = A.Time.Milli.fromMicro(r.latest), a = n.at(-1), c = t?.done && t.consumer.sequence + 1 === r.consumer.sequence;
4326
+ a && (a.end >= i || c) ? a.end = A.Time.Milli.max(a.end, o) : n.push({ start: i, end: o }), t = r;
4319
4327
  }
4320
4328
  this.#i.set(n);
4321
4329
  }
@@ -4329,7 +4337,7 @@ class le {
4329
4337
  navigator.userAgent.toLowerCase().includes("chrome");
4330
4338
  navigator.userAgent.toLowerCase().includes("firefox");
4331
4339
  let xe;
4332
- async function Un() {
4340
+ async function Rn() {
4333
4341
  return globalThis.AudioEncoder && globalThis.AudioDecoder ? !0 : (xe || (console.warn("using Opus polyfill; performance may be degraded"), xe = Promise.all([
4334
4342
  import("./libav-opus-af-BlMWboA7.js"),
4335
4343
  import("./main-DGBFe0O7.js")
@@ -4606,7 +4614,7 @@ var Effect = class _Effect {
4606
4614
  this.#scheduled = false;
4607
4615
  if (this.#fn) {
4608
4616
  this.#fn(this);
4609
- if (DEV && this.#unwatch.length === 0) {
4617
+ if (DEV && this.#dispose !== void 0 && this.#unwatch.length === 0 && this.#dispose.length === 0 && this.#async.length === 0) {
4610
4618
  console.warn("Effect did not subscribe to any signals; it will never rerun.", this.#stack);
4611
4619
  }
4612
4620
  }
@@ -4766,10 +4774,6 @@ var Effect = class _Effect {
4766
4774
  target.addEventListener(type, listener, options);
4767
4775
  this.cleanup(() => target.removeEventListener(type, listener, options));
4768
4776
  }
4769
- // Reschedule the effect to run again.
4770
- reload() {
4771
- this.#schedule();
4772
- }
4773
4777
  // Register a cleanup function.
4774
4778
  cleanup(fn) {
4775
4779
  if (this.#dispose === void 0) {
@@ -5184,6 +5188,11 @@ function setInt32(dst, v) {
5184
5188
  return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
5185
5189
  }
5186
5190
 
5191
+ // ../lite/src/util/error.ts
5192
+ function unreachable(value) {
5193
+ throw new Error(\`unreachable: \${value}\`);
5194
+ }
5195
+
5187
5196
  // ../../node_modules/.bun/async-mutex@0.5.0/node_modules/async-mutex/index.mjs
5188
5197
  var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
5189
5198
  var E_ALREADY_LOCKED = new Error("mutex already locked");
@@ -5727,8 +5736,7 @@ var Publish = class _Publish {
5727
5736
  await w.bool(this.forward);
5728
5737
  await w.u53(0);
5729
5738
  } else {
5730
- const _ = version;
5731
- throw new Error(\`unsupported version: \${_}\`);
5739
+ unreachable(version);
5732
5740
  }
5733
5741
  }
5734
5742
  async encode(w, version) {
@@ -5774,8 +5782,7 @@ var Publish = class _Publish {
5774
5782
  forward
5775
5783
  });
5776
5784
  } else {
5777
- const _ = version;
5778
- throw new Error(\`unsupported version: \${_}\`);
5785
+ unreachable(version);
5779
5786
  }
5780
5787
  }
5781
5788
  };
@@ -6147,8 +6154,7 @@ var ClientSetup = class _ClientSetup {
6147
6154
  }
6148
6155
  await this.parameters.encode(w, version);
6149
6156
  } else {
6150
- const _ = version;
6151
- throw new Error(\`unsupported version: \${_}\`);
6157
+ unreachable(version);
6152
6158
  }
6153
6159
  }
6154
6160
  async encode(w, version) {
@@ -6171,8 +6177,7 @@ var ClientSetup = class _ClientSetup {
6171
6177
  const parameters = await Parameters.decode(r, version);
6172
6178
  return new _ClientSetup({ versions: supportedVersions, parameters });
6173
6179
  } else {
6174
- const _ = version;
6175
- throw new Error(\`unsupported version: \${_}\`);
6180
+ unreachable(version);
6176
6181
  }
6177
6182
  }
6178
6183
  static async decode(r, version) {
@@ -6194,8 +6199,7 @@ var ServerSetup = class _ServerSetup {
6194
6199
  await w.u53(this.version);
6195
6200
  await this.parameters.encode(w, version);
6196
6201
  } else {
6197
- const _ = version;
6198
- throw new Error(\`unsupported version: \${_}\`);
6202
+ unreachable(version);
6199
6203
  }
6200
6204
  }
6201
6205
  async encode(w, version) {
@@ -6210,8 +6214,7 @@ var ServerSetup = class _ServerSetup {
6210
6214
  const parameters = await Parameters.decode(r, version);
6211
6215
  return new _ServerSetup({ version: selectedVersion, parameters });
6212
6216
  } else {
6213
- const _ = version;
6214
- throw new Error(\`unsupported version: \${_}\`);
6217
+ unreachable(version);
6215
6218
  }
6216
6219
  }
6217
6220
  static async decode(r, version) {
@@ -6256,8 +6259,7 @@ var Subscribe = class _Subscribe {
6256
6259
  await w.u53(2);
6257
6260
  await w.u53(0);
6258
6261
  } else {
6259
- const _ = version;
6260
- throw new Error(\`unsupported version: \${_}\`);
6262
+ unreachable(version);
6261
6263
  }
6262
6264
  }
6263
6265
  async encode(w, version) {
@@ -6309,8 +6311,7 @@ var Subscribe = class _Subscribe {
6309
6311
  await Parameters.decode(r, version);
6310
6312
  return new _Subscribe({ requestId, trackNamespace, trackName, subscriberPriority });
6311
6313
  } else {
6312
- const _ = version;
6313
- throw new Error(\`unsupported version: \${_}\`);
6314
+ unreachable(version);
6314
6315
  }
6315
6316
  }
6316
6317
  };
@@ -6335,8 +6336,7 @@ var SubscribeOk = class _SubscribeOk {
6335
6336
  await w.bool(false);
6336
6337
  await w.u53(0);
6337
6338
  } else {
6338
- const _ = version;
6339
- throw new Error(\`unsupported version: \${_}\`);
6339
+ unreachable(version);
6340
6340
  }
6341
6341
  }
6342
6342
  async encode(w, version) {
@@ -6363,8 +6363,7 @@ var SubscribeOk = class _SubscribeOk {
6363
6363
  }
6364
6364
  await Parameters.decode(r, version);
6365
6365
  } else {
6366
- const _ = version;
6367
- throw new Error(\`unsupported version: \${_}\`);
6366
+ unreachable(version);
6368
6367
  }
6369
6368
  return new _SubscribeOk({ requestId, trackAlias });
6370
6369
  }
@@ -7029,7 +7028,7 @@ let Ec = class {
7029
7028
  const o = i.get(s.buffered), a = i.get(this.#o);
7030
7029
  this.#a.update(() => Oc(o, a));
7031
7030
  }), n.spawn(async () => {
7032
- if (!await Un()) return;
7031
+ if (!await Rn()) return;
7033
7032
  const o = new AudioDecoder({
7034
7033
  output: (c) => this.#f(c),
7035
7034
  error: (c) => console.error(c)
@@ -7063,7 +7062,7 @@ let Ec = class {
7063
7062
  const a = o.get(this.#o);
7064
7063
  this.#a.update(() => a);
7065
7064
  }), n.spawn(async () => {
7066
- if (!await Un()) return;
7065
+ if (!await Rn()) return;
7067
7066
  const a = new AudioDecoder({
7068
7067
  output: (c) => this.#f(c),
7069
7068
  error: (c) => console.error(c)
@@ -7192,8 +7191,8 @@ class Ac {
7192
7191
  const s = r.get(this.source.root);
7193
7192
  if (!s) return;
7194
7193
  const i = new GainNode(s.context, { gain: r.get(this.volume) });
7195
- s.connect(i), r.set(this.#e, i), r.run(() => {
7196
- r.get(this.source.enabled) && (i.connect(s.context.destination), r.cleanup(() => i.disconnect()));
7194
+ s.connect(i), r.set(this.#e, i), r.run((o) => {
7195
+ o.get(this.source.enabled) && (i.connect(s.context.destination), o.cleanup(() => i.disconnect()));
7197
7196
  });
7198
7197
  }), this.#n.run((r) => {
7199
7198
  const s = r.get(this.#e);
@@ -7276,7 +7275,7 @@ class Ot {
7276
7275
  this.#e.close();
7277
7276
  }
7278
7277
  }
7279
- const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7278
+ const eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7280
7279
  __proto__: null,
7281
7280
  Muxer: Ot
7282
7281
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7334,7 +7333,7 @@ class Pc {
7334
7333
  this.signals.close();
7335
7334
  }
7336
7335
  }
7337
- const Rc = 500, Uc = 100;
7336
+ const Uc = 500, Rc = 100;
7338
7337
  class Nc {
7339
7338
  enabled;
7340
7339
  // Don't download any longer
@@ -7378,7 +7377,7 @@ class Nc {
7378
7377
  const d = u.get(this.#n);
7379
7378
  if (d) {
7380
7379
  const f = u.get(c.timestamp), p = u.get(d.timestamp);
7381
- if (!f || p && p > f + Uc) return;
7380
+ if (!f || p && p > f + Rc) return;
7382
7381
  }
7383
7382
  this.#n.set(c), c = void 0;
7384
7383
  });
@@ -7412,7 +7411,7 @@ class Nc {
7412
7411
  }
7413
7412
  this.#s.set(!1), n.timer(() => {
7414
7413
  this.#s.set(!0);
7415
- }, Rc);
7414
+ }, Uc);
7416
7415
  }
7417
7416
  close() {
7418
7417
  this.#r.update((n) => {
@@ -7789,7 +7788,38 @@ class qc {
7789
7788
  this.#n?.close(), this.#n = void 0, this.#e.close();
7790
7789
  }
7791
7790
  }
7792
- let Zc = class {
7791
+ function Zc(e) {
7792
+ return (n) => {
7793
+ const t = [], r = [];
7794
+ for (const [s, i] of n)
7795
+ if (i.codedWidth && i.codedHeight) {
7796
+ const o = i.codedWidth * i.codedHeight;
7797
+ o <= e ? t.push({ name: s, size: o }) : r.push({ name: s, size: o });
7798
+ }
7799
+ return t.sort((s, i) => i.size - s.size), t.length > 0 ? t.map((s) => s.name) : r.length > 0 ? (r.sort((s, i) => s.size - i.size), [r[0].name]) : n.map(([s]) => s);
7800
+ };
7801
+ }
7802
+ function Fc(e) {
7803
+ return (n) => {
7804
+ const t = [], r = [];
7805
+ for (const [s, i] of n)
7806
+ i.bitrate != null && i.bitrate <= e ? t.push({ name: s, bitrate: i.bitrate }) : i.bitrate != null && r.push({ name: s, bitrate: i.bitrate });
7807
+ return t.sort((s, i) => i.bitrate - s.bitrate), t.length > 0 ? t.map((s) => s.name) : r.length > 0 ? (r.sort((s, i) => s.bitrate - i.bitrate), [r[0].name]) : n.map(([s]) => s);
7808
+ };
7809
+ }
7810
+ function Bc(e) {
7811
+ let n = e[0];
7812
+ for (const t of e) {
7813
+ const [, r] = t, [, s] = n, i = (r.codedWidth ?? 0) * (r.codedHeight ?? 0), o = (s.codedWidth ?? 0) * (s.codedHeight ?? 0);
7814
+ if (i !== o) {
7815
+ i > o && (n = t);
7816
+ continue;
7817
+ }
7818
+ (r.bitrate ?? 0) > (s.bitrate ?? 0) && (n = t);
7819
+ }
7820
+ return n[0];
7821
+ }
7822
+ let jc = class {
7793
7823
  broadcast;
7794
7824
  target;
7795
7825
  #n = new h(void 0);
@@ -7833,21 +7863,24 @@ let Zc = class {
7833
7863
  n.set(this.#e, i), n.set(this.#t, o), n.set(this.sync.video, o.jitter);
7834
7864
  }
7835
7865
  /**
7836
- * Select the best rendition based on target pixel count.
7837
- * Rounds up to the closest larger rendition, or falls back to the largest smaller one.
7866
+ * Select the best rendition using a generic filter system.
7867
+ *
7868
+ * Each enabled filter returns matching renditions sorted by preference.
7869
+ * The first rendition present in every filter's output is selected.
7870
+ * If no rendition satisfies all filters, a warning is logged.
7838
7871
  */
7839
7872
  #c(n, t) {
7840
7873
  const r = Object.entries(n);
7841
7874
  if (r.length === 0) return;
7842
7875
  if (r.length === 1) return r[0][0];
7843
- const s = t?.pixels ?? Number.MAX_SAFE_INTEGER / 2 - 1;
7844
- let i, o, a, c;
7845
- for (const [u, d] of r) {
7846
- if (!d.codedHeight || !d.codedWidth) continue;
7847
- const f = d.codedHeight * d.codedWidth;
7848
- f > s && (!o || f < o) ? (i = u, o = f) : f < s && (!c || f > c) && (a = u, c = f);
7849
- }
7850
- return i || a || (console.warn("no width/height information, choosing the first supported rendition"), r[0][0]);
7876
+ const s = [];
7877
+ if (t?.pixels != null && s.push(Zc(t.pixels)), t?.bitrate != null && s.push(Fc(t.bitrate)), s.length === 0)
7878
+ return Bc(r);
7879
+ const i = s.map((a) => a(r)), o = i.map((a) => new Set(a));
7880
+ for (const a of i[0])
7881
+ if (o.every((c) => c.has(a)))
7882
+ return a;
7883
+ console.warn("conflicting rendition filters, no rendition satisfies all criteria");
7851
7884
  }
7852
7885
  close() {
7853
7886
  this.#s.close();
@@ -7861,7 +7894,7 @@ function At(e) {
7861
7894
  }
7862
7895
  return n;
7863
7896
  }
7864
- class Fc {
7897
+ class Vc {
7865
7898
  // The source of the video.
7866
7899
  source;
7867
7900
  // The stats of the video.
@@ -7876,7 +7909,7 @@ class Fc {
7876
7909
  this.source = n;
7877
7910
  }
7878
7911
  }
7879
- class Bc {
7912
+ class Lc {
7880
7913
  source;
7881
7914
  // The volume of the audio, between 0 and 1.
7882
7915
  volume = new h(0.5);
@@ -7890,7 +7923,7 @@ class Bc {
7890
7923
  this.source = n;
7891
7924
  }
7892
7925
  }
7893
- class eu {
7926
+ class ru {
7894
7927
  element = new h(void 0);
7895
7928
  broadcast;
7896
7929
  jitter;
@@ -7903,11 +7936,11 @@ class eu {
7903
7936
  #e;
7904
7937
  signals = new C();
7905
7938
  constructor(n) {
7906
- this.element = h.from(n?.element), this.broadcast = h.from(n?.broadcast), this.jitter = h.from(n?.jitter ?? 100), this.#e = new Pc({ jitter: this.jitter }), this.#n = new Zc(this.#e, {
7939
+ this.element = h.from(n?.element), this.broadcast = h.from(n?.broadcast), this.jitter = h.from(n?.jitter ?? 100), this.#e = new Pc({ jitter: this.jitter }), this.#n = new jc(this.#e, {
7907
7940
  broadcast: this.broadcast
7908
- }), this.#r = new Lc(this.#e, {
7941
+ }), this.#r = new Wc(this.#e, {
7909
7942
  broadcast: this.broadcast
7910
- }), this.video = new Fc(this.#n), this.audio = new Bc(this.#r), this.paused = h.from(n?.paused ?? !1), this.signals.run(this.#t.bind(this));
7943
+ }), this.video = new Vc(this.#n), this.audio = new Lc(this.#r), this.paused = h.from(n?.paused ?? !1), this.signals.run(this.#t.bind(this));
7911
7944
  }
7912
7945
  #t(n) {
7913
7946
  const t = n.get(this.element);
@@ -7927,7 +7960,7 @@ class eu {
7927
7960
  const r = new Ot(this.#e, {
7928
7961
  paused: this.paused,
7929
7962
  element: t
7930
- }), s = new Cc(r, this.#n), i = new jc(r, this.#r, {
7963
+ }), s = new Cc(r, this.#n), i = new Gc(r, this.#r, {
7931
7964
  volume: this.audio.volume,
7932
7965
  muted: this.audio.muted
7933
7966
  });
@@ -7939,7 +7972,7 @@ class eu {
7939
7972
  this.signals.close();
7940
7973
  }
7941
7974
  }
7942
- class jc {
7975
+ class Gc {
7943
7976
  muxer;
7944
7977
  source;
7945
7978
  volume;
@@ -7950,7 +7983,7 @@ class jc {
7950
7983
  buffered = this.#r;
7951
7984
  #e = new C();
7952
7985
  constructor(n, t, r) {
7953
- this.muxer = n, this.source = t, this.source.supported.set(Vc), this.volume = h.from(r?.volume ?? 0.5), this.muted = h.from(r?.muted ?? !1), this.#e.run(this.#t.bind(this)), this.#e.run(this.#a.bind(this));
7986
+ this.muxer = n, this.source = t, this.source.supported.set(Jc), this.volume = h.from(r?.volume ?? 0.5), this.muted = h.from(r?.muted ?? !1), this.#e.run(this.#t.bind(this)), this.#e.run(this.#a.bind(this));
7954
7987
  }
7955
7988
  #t(n) {
7956
7989
  const t = n.get(this.muxer.element);
@@ -7986,7 +8019,7 @@ class jc {
7986
8019
  if (r.container.kind !== "cmaf") throw new Error("unreachable");
7987
8020
  const o = r.container.timescale;
7988
8021
  n.spawn(async () => {
7989
- const a = Rn(r);
8022
+ const a = Un(r);
7990
8023
  for (await this.#s(s, a); ; ) {
7991
8024
  const c = await t.readFrame();
7992
8025
  if (!c) return;
@@ -8000,7 +8033,7 @@ class jc {
8000
8033
  latency: this.source.sync.latency
8001
8034
  });
8002
8035
  n.cleanup(() => o.close()), n.spawn(async () => {
8003
- const a = Rn(r);
8036
+ const a = Un(r);
8004
8037
  await this.#s(s, a);
8005
8038
  let c = 1, u, d;
8006
8039
  for (; ; ) {
@@ -8041,10 +8074,10 @@ class jc {
8041
8074
  this.#e.close();
8042
8075
  }
8043
8076
  }
8044
- async function Vc(e) {
8077
+ async function Jc(e) {
8045
8078
  return MediaSource.isTypeSupported(`audio/mp4; codecs="${e.codec}"`);
8046
8079
  }
8047
- class Lc {
8080
+ class Wc {
8048
8081
  broadcast;
8049
8082
  target;
8050
8083
  #n = new h(void 0);
@@ -8105,10 +8138,10 @@ class Lc {
8105
8138
  this.#s.close();
8106
8139
  }
8107
8140
  }
8108
- class nu {
8141
+ class su {
8109
8142
  connection;
8110
8143
  enabled;
8111
- path;
8144
+ name;
8112
8145
  status = new h("offline");
8113
8146
  reload;
8114
8147
  #n = new h(void 0);
@@ -8119,7 +8152,7 @@ class nu {
8119
8152
  #e = new h(!1);
8120
8153
  signals = new C();
8121
8154
  constructor(n) {
8122
- this.connection = h.from(n?.connection), this.path = h.from(n?.path), this.enabled = h.from(n?.enabled ?? !1), this.reload = h.from(n?.reload ?? !1), this.signals.run(this.#t.bind(this)), this.signals.run(this.#s.bind(this)), this.signals.run(this.#i.bind(this));
8155
+ this.connection = h.from(n?.connection), this.name = h.from(n?.name), this.enabled = h.from(n?.enabled ?? !1), this.reload = h.from(n?.reload ?? !1), this.signals.run(this.#t.bind(this)), this.signals.run(this.#s.bind(this)), this.signals.run(this.#i.bind(this));
8123
8156
  }
8124
8157
  #t(n) {
8125
8158
  if (!n.get(this.enabled)) return;
@@ -8129,7 +8162,7 @@ class nu {
8129
8162
  }
8130
8163
  const s = n.get(this.connection);
8131
8164
  if (!s) return;
8132
- const i = n.get(this.path);
8165
+ const i = n.get(this.name);
8133
8166
  if (i === void 0) return;
8134
8167
  const o = s.announced(i);
8135
8168
  n.cleanup(() => o.close()), n.spawn(async () => {
@@ -8147,7 +8180,7 @@ class nu {
8147
8180
  #s(n) {
8148
8181
  const t = n.getAll([this.enabled, this.#e, this.connection]);
8149
8182
  if (!t) return;
8150
- const [r, s, i] = t, o = n.get(this.path);
8183
+ const [r, s, i] = t, o = n.get(this.name);
8151
8184
  if (o === void 0) return;
8152
8185
  const a = i.consume(o);
8153
8186
  n.cleanup(() => a.close()), n.set(this.#n, a);
@@ -8163,12 +8196,12 @@ class nu {
8163
8196
  async #o(n) {
8164
8197
  try {
8165
8198
  for (; ; ) {
8166
- const t = await Ua(n);
8199
+ const t = await Ra(n);
8167
8200
  if (!t) break;
8168
- console.debug("received catalog", this.path.peek(), t), this.#r.set(t), this.status.set("live");
8201
+ console.debug("received catalog", this.name.peek(), t), this.#r.set(t), this.status.set("live");
8169
8202
  }
8170
8203
  } catch (t) {
8171
- console.warn("error fetching catalog", this.path.peek(), t);
8204
+ console.warn("error fetching catalog", this.name.peek(), t);
8172
8205
  } finally {
8173
8206
  this.#r.set(void 0), this.status.set("offline");
8174
8207
  }
@@ -8178,22 +8211,22 @@ class nu {
8178
8211
  }
8179
8212
  }
8180
8213
  export {
8181
- nu as B,
8214
+ su as B,
8182
8215
  Nc as D,
8183
8216
  Ac as E,
8184
8217
  Cc as M,
8185
8218
  ue as P,
8186
8219
  qc as R,
8187
- Zc as S,
8220
+ jc as S,
8188
8221
  Ec as a,
8189
- jc as b,
8190
- Lc as c,
8191
- Wc as d,
8222
+ Gc as b,
8223
+ Wc as c,
8224
+ Kc as d,
8192
8225
  ht as e,
8193
- Hc as f,
8194
- eu as g,
8226
+ Yc as f,
8227
+ ru as g,
8195
8228
  Pc as h,
8196
- Kc as m,
8229
+ eu as m,
8197
8230
  At as t
8198
8231
  };
8199
- //# sourceMappingURL=broadcast-BFfLDq15.js.map
8232
+ //# sourceMappingURL=broadcast-CZc0dhfv.js.map