moqtail 0.13.0 → 0.14.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/model.cjs CHANGED
@@ -214,7 +214,7 @@ var TerminationError = class extends MOQtailError {
214
214
  * limitations under the License.
215
215
  */
216
216
  const MAX_VALUE_LENGTH = 2 ** 16 - 1;
217
- const MAX_U64 = 2n ** 64n - 1n;
217
+ const MAX_U64$2 = 2n ** 64n - 1n;
218
218
  /**
219
219
  * @public
220
220
  * Represents a key-value pair for MOQT protocol parameters.
@@ -223,6 +223,8 @@ const MAX_U64 = 2n ** 64n - 1n;
223
223
  * - If `typeValue` is **odd**, the value is a binary blob (`Uint8Array`) with a maximum length of 65535 bytes.
224
224
  *
225
225
  * Use {@link KeyValuePair.tryNewVarInt} for varint pairs and {@link KeyValuePair.tryNewBytes} for blob pairs.
226
+ * A Type whose own namespace fixes the value encoding overrides the parity rule; see
227
+ * {@link KeyValuePair.newBytes}.
226
228
  */
227
229
  var KeyValuePair = class KeyValuePair {
228
230
  /**
@@ -261,6 +263,17 @@ var KeyValuePair = class KeyValuePair {
261
263
  return new KeyValuePair(tv, v);
262
264
  }
263
265
  /**
266
+ * Creates a varint KeyValuePair for a Type whose namespace defines a numeric value
267
+ * regardless of parity. Prefer {@link KeyValuePair.tryNewVarInt}.
268
+ * @param typeValue - The key/type identifier; parity is not checked.
269
+ * @param value - The varint value.
270
+ */
271
+ static newVarInt(typeValue, value) {
272
+ const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
273
+ const v = typeof value === "number" ? BigInt(value) : value;
274
+ return new KeyValuePair(tv, v);
275
+ }
276
+ /**
264
277
  * Creates a new blob KeyValuePair.
265
278
  * @param typeValue - Must be odd.
266
279
  * @param value - The binary blob value.
@@ -271,8 +284,19 @@ var KeyValuePair = class KeyValuePair {
271
284
  static tryNewBytes(typeValue, value) {
272
285
  const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
273
286
  if (tv % 2n === 0n) throw new KeyValueFormattingError("KeyValuePair.tryNewBytes");
287
+ return KeyValuePair.newBytes(tv, value);
288
+ }
289
+ /**
290
+ * Creates a blob KeyValuePair for a Type whose namespace defines a byte-string
291
+ * value regardless of parity. Prefer {@link KeyValuePair.tryNewBytes}.
292
+ * @param typeValue - The key/type identifier; parity is not checked.
293
+ * @param value - The binary blob value.
294
+ * @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
295
+ */
296
+ static newBytes(typeValue, value) {
297
+ const tv = typeof typeValue === "number" ? BigInt(typeValue) : typeValue;
274
298
  const len = value.length;
275
- if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.tryNewBytes", MAX_VALUE_LENGTH, len);
299
+ if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.newBytes", MAX_VALUE_LENGTH, len);
276
300
  return new KeyValuePair(tv, value);
277
301
  }
278
302
  /**
@@ -321,7 +345,7 @@ var KeyValuePair = class KeyValuePair {
321
345
  static deserializeDelta(buf, prevType) {
322
346
  const deltaType = buf.getVI();
323
347
  const typeValue = prevType + deltaType;
324
- if (typeValue > MAX_U64) throw new ProtocolViolationError("KeyValuePair.deserializeDelta", `previous type ${prevType} plus delta type ${deltaType} exceeds 2^64 - 1`);
348
+ if (typeValue > MAX_U64$2) throw new ProtocolViolationError("KeyValuePair.deserializeDelta", `previous type ${prevType} plus delta type ${deltaType} exceeds 2^64 - 1`);
325
349
  return KeyValuePair.deserializeValue(buf, typeValue);
326
350
  }
327
351
  /**
@@ -335,12 +359,20 @@ var KeyValuePair = class KeyValuePair {
335
359
  if (typeValue % 2n === 0n) {
336
360
  const value = buf.getVI();
337
361
  return new KeyValuePair(typeValue, value);
338
- } else {
339
- const len = buf.getNumberVI();
340
- if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.deserialize", MAX_VALUE_LENGTH, len);
341
- const value = buf.getBytes(len);
342
- return new KeyValuePair(typeValue, value);
343
362
  }
363
+ return KeyValuePair.deserializeBytesValue(buf, typeValue);
364
+ }
365
+ /**
366
+ * Reads a length-prefixed byte-string Value, independent of Type parity.
367
+ * @param buf - The buffer to read from.
368
+ * @param typeValue - The already-decoded Type.
369
+ * @throws LengthExceedsMaxError if the length exceeds 65535 bytes.
370
+ */
371
+ static deserializeBytesValue(buf, typeValue) {
372
+ const len = buf.getNumberVI();
373
+ if (len > MAX_VALUE_LENGTH) throw new LengthExceedsMaxError("KeyValuePair.deserializeBytesValue", MAX_VALUE_LENGTH, len);
374
+ const value = buf.getBytes(len);
375
+ return new KeyValuePair(typeValue, value);
344
376
  }
345
377
  /**
346
378
  * Checks if this pair is equal to another.
@@ -403,20 +435,20 @@ function deserializeKvpListUntilEmpty(buf) {
403
435
  return items;
404
436
  }
405
437
  /**
406
- * Checks if the KeyValuePair is a varint pair (even typeValue).
438
+ * Checks if the KeyValuePair carries a varint value.
407
439
  * @param pair - The KeyValuePair to check.
408
440
  * @returns True if value is a varint.
409
441
  */
410
442
  function isVarInt(pair) {
411
- return pair.typeValue % 2n === 0n;
443
+ return typeof pair.value === "bigint";
412
444
  }
413
445
  /**
414
- * Checks if the KeyValuePair is a blob pair (odd typeValue).
446
+ * Checks if the KeyValuePair carries a blob value.
415
447
  * @param pair - The KeyValuePair to check.
416
448
  * @returns True if value is a Uint8Array.
417
449
  */
418
450
  function isBytes(pair) {
419
- return pair.typeValue % 2n !== 0n;
451
+ return pair.value instanceof Uint8Array;
420
452
  }
421
453
  //#endregion
422
454
  //#region src/model/common/location.ts
@@ -812,12 +844,12 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
812
844
  TerminationCode[TerminationCode["DATA_STREAM_TIMEOUT"] = 18] = "DATA_STREAM_TIMEOUT";
813
845
  TerminationCode[TerminationCode["AUTH_TOKEN_CACHE_OVERFLOW"] = 19] = "AUTH_TOKEN_CACHE_OVERFLOW";
814
846
  TerminationCode[TerminationCode["DUPLICATE_AUTH_TOKEN_ALIAS"] = 20] = "DUPLICATE_AUTH_TOKEN_ALIAS";
815
- TerminationCode[TerminationCode["VERSION_NEGOTIATION_FAILED"] = 21] = "VERSION_NEGOTIATION_FAILED";
816
847
  TerminationCode[TerminationCode["MALFORMED_AUTH_TOKEN"] = 22] = "MALFORMED_AUTH_TOKEN";
817
848
  TerminationCode[TerminationCode["UNKNOWN_AUTH_TOKEN_ALIAS"] = 23] = "UNKNOWN_AUTH_TOKEN_ALIAS";
818
849
  TerminationCode[TerminationCode["EXPIRED_AUTH_TOKEN"] = 24] = "EXPIRED_AUTH_TOKEN";
819
850
  TerminationCode[TerminationCode["INVALID_AUTHORITY"] = 25] = "INVALID_AUTHORITY";
820
851
  TerminationCode[TerminationCode["MALFORMED_AUTHORITY"] = 26] = "MALFORMED_AUTHORITY";
852
+ TerminationCode[TerminationCode["TOO_MANY_REQUEST_UPDATES"] = 27] = "TOO_MANY_REQUEST_UPDATES";
821
853
  return TerminationCode;
822
854
  }({});
823
855
  (function(_TerminationCode) {
@@ -837,12 +869,12 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
837
869
  case 18: return 18;
838
870
  case 19: return 19;
839
871
  case 20: return 20;
840
- case 21: return 21;
841
872
  case 22: return 22;
842
873
  case 23: return 23;
843
874
  case 24: return 24;
844
875
  case 25: return 25;
845
876
  case 26: return 26;
877
+ case 27: return 27;
846
878
  default: throw new InvalidTypeError("TerminationCode.tryFrom", `Unknown termination code: ${code}`);
847
879
  }
848
880
  }
@@ -867,8 +899,7 @@ let TerminationCode = /* @__PURE__ */ function(TerminationCode) {
867
899
  */
868
900
  /**
869
901
  * @public
870
- * Codes carried when resetting a request stream or sending STOP_SENDING on one, per
871
- * draft-18 §3.3.3.
902
+ * Codes carried when resetting a request stream or sending STOP_SENDING on one.
872
903
  *
873
904
  * A separate registry from {@link (RequestErrorCode:enum)}, which disagrees with it on
874
905
  * the same names: `GOING_AWAY` is `0x4` here but `0x6` there.
@@ -923,7 +954,7 @@ let StreamResetCode = /* @__PURE__ */ function(StreamResetCode) {
923
954
  */
924
955
  /**
925
956
  * @public
926
- * Object datagram types for MOQT objects (Draft-16).
957
+ * Object datagram types for MOQT objects.
927
958
  *
928
959
  * Type bit layout (form 0b00X0XXXX):
929
960
  * - Bit 0 (0x01): PROPERTIES - Properties field present
@@ -1227,7 +1258,7 @@ let ObjectStatus = /* @__PURE__ */ function(ObjectStatus) {
1227
1258
  * limitations under the License.
1228
1259
  */
1229
1260
  /**
1230
- * Represents a unified OBJECT_DATAGRAM message (Draft-16).
1261
+ * Represents a unified OBJECT_DATAGRAM message.
1231
1262
  *
1232
1263
  * Type bit layout (form 0b00X0XXXX):
1233
1264
  * - Bit 0 (0x01): PROPERTIES
@@ -1357,53 +1388,6 @@ var FetchHeader = class FetchHeader {
1357
1388
  }
1358
1389
  };
1359
1390
  //#endregion
1360
- //#region src/model/common/grease.ts
1361
- /**
1362
- * Copyright 2026 The MOQtail Authors
1363
- *
1364
- * Licensed under the Apache License, Version 2.0 (the "License");
1365
- * you may not use this file except in compliance with the License.
1366
- * You may obtain a copy of the License at
1367
- *
1368
- * http://www.apache.org/licenses/LICENSE-2.0
1369
- *
1370
- * Unless required by applicable law or agreed to in writing, software
1371
- * distributed under the License is distributed on an "AS IS" BASIS,
1372
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1373
- * See the License for the specific language governing permissions and
1374
- * limitations under the License.
1375
- */
1376
- /**
1377
- * GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
1378
- * several registries (Setup Options, Properties, error codes) so peers can emit them
1379
- * to exercise unknown-value handling. Receivers treat them like any other unknown
1380
- * value: ignore, never fatal.
1381
- */
1382
- /** Step between successive GREASE values. */
1383
- const GREASE_STEP = 127n;
1384
- /** The smallest GREASE value (N = 0). */
1385
- const GREASE_BASE = 157n;
1386
- /** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
1387
- const GREASE_MAX = 4611686018427387870n;
1388
- /**
1389
- * @public
1390
- * True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
1391
- * non-negative `N`.
1392
- */
1393
- function isGrease(value) {
1394
- const v = BigInt(value);
1395
- return v >= 157n && (v - 157n) % 127n === 0n;
1396
- }
1397
- /**
1398
- * @public
1399
- * The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
1400
- * varint can carry (the pattern is capped at `0x3fffffffffffffde`).
1401
- */
1402
- function greaseValue(n) {
1403
- const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
1404
- return value > GREASE_MAX ? void 0 : value;
1405
- }
1406
- //#endregion
1407
1391
  //#region src/model/control/constant.ts
1408
1392
  /**
1409
1393
  * Copyright 2025 The MOQtail Authors
@@ -1423,21 +1407,10 @@ function greaseValue(n) {
1423
1407
  /**
1424
1408
  * Protocol string array exchanged in wt-available-protocols header
1425
1409
  */
1426
- const SUPPORTED_VERSIONS = ["moqt-18"];
1410
+ const SUPPORTED_VERSIONS = ["moqt-22"];
1427
1411
  /**
1428
1412
  * @public
1429
- * Control message types, per draft-18 Table 5.
1430
- *
1431
- * The comment on each member is the Stream column: `Control` is the control stream
1432
- * (§3.3), `Request` a bidirectional request stream, and `First` means the message MUST
1433
- * be the first on a new request stream.
1434
- *
1435
- * Table 5 reserves `0x01` (SETUP for version 00), `0x40`/`0x41` (CLIENT_SETUP /
1436
- * SERVER_SETUP for versions 10 and below) and `0x20`/`0x21` (CLIENT_SETUP /
1437
- * SERVER_SETUP for versions 16 and below — folded into Setup by #256). All five stay
1438
- * in the enum as documentation, but `tryFrom` rejects every RESERVED codepoint, which
1439
- * is what §10 requires — an endpoint receiving an unknown message type MUST close the
1440
- * session.
1413
+ * Control message types.
1441
1414
  */
1442
1415
  let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
1443
1416
  ControlMessageType[ControlMessageType["ReservedSetupV00"] = 1] = "ReservedSetupV00";
@@ -1463,8 +1436,7 @@ let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
1463
1436
  ControlMessageType[ControlMessageType["SubscribeTracks"] = 81] = "SubscribeTracks";
1464
1437
  ControlMessageType[ControlMessageType["Publish"] = 29] = "Publish";
1465
1438
  ControlMessageType[ControlMessageType["PublishOk"] = 30] = "PublishOk";
1466
- ControlMessageType[ControlMessageType["PublishBlocked"] = 15] = "PublishBlocked";
1467
- ControlMessageType[ControlMessageType["Switch"] = 34] = "Switch";
1439
+ ControlMessageType[ControlMessageType["PublishSkipped"] = 15] = "PublishSkipped";
1468
1440
  return ControlMessageType;
1469
1441
  }({});
1470
1442
  (function(_ControlMessageType) {
@@ -1521,48 +1493,45 @@ let ControlMessageType = /* @__PURE__ */ function(ControlMessageType) {
1521
1493
  })(ControlMessageType || (ControlMessageType = {}));
1522
1494
  /**
1523
1495
  * @public
1524
- * Filter types for subscription requests.
1525
- */
1526
- let FilterType = /* @__PURE__ */ function(FilterType) {
1527
- FilterType[FilterType["NextGroupStart"] = 1] = "NextGroupStart";
1528
- FilterType[FilterType["LatestObject"] = 2] = "LatestObject";
1529
- FilterType[FilterType["AbsoluteStart"] = 3] = "AbsoluteStart";
1530
- FilterType[FilterType["AbsoluteRange"] = 4] = "AbsoluteRange";
1531
- return FilterType;
1496
+ * Which fields of a LOCATION_FILTER follow its type, and how they are read.
1497
+ */
1498
+ let LocationFilterType = /* @__PURE__ */ function(LocationFilterType) {
1499
+ /** No filter: every Object passes. */
1500
+ LocationFilterType[LocationFilterType["None"] = 0] = "None";
1501
+ /** Starts StartGroup groups before the Next Group. */
1502
+ LocationFilterType[LocationFilterType["RelativeStart"] = 1] = "RelativeStart";
1503
+ LocationFilterType[LocationFilterType["AbsoluteStart"] = 2] = "AbsoluteStart";
1504
+ /** Ends with the last Object of the End Group. */
1505
+ LocationFilterType[LocationFilterType["AbsoluteStartGroupEnd"] = 3] = "AbsoluteStartGroupEnd";
1506
+ /** Ends with End Object of the End Group. */
1507
+ LocationFilterType[LocationFilterType["AbsoluteRange"] = 4] = "AbsoluteRange";
1508
+ /** Starts at the Object after the Largest Object. */
1509
+ LocationFilterType[LocationFilterType["NextObject"] = 5] = "NextObject";
1510
+ return LocationFilterType;
1532
1511
  }({});
1533
- (function(_FilterType) {
1512
+ (function(_LocationFilterType) {
1534
1513
  function tryFrom(v) {
1535
1514
  switch (v) {
1515
+ case 0n: return 0;
1536
1516
  case 1n: return 1;
1537
1517
  case 2n: return 2;
1538
1518
  case 3n: return 3;
1539
1519
  case 4n: return 4;
1540
- default: throw new InvalidEnumValue("FilterType.tryFrom", v);
1520
+ case 5n: return 5;
1521
+ default: throw new InvalidEnumValue("LocationFilterType.tryFrom", v);
1541
1522
  }
1542
1523
  }
1543
- _FilterType.tryFrom = tryFrom;
1544
- })(FilterType || (FilterType = {}));
1524
+ _LocationFilterType.tryFrom = tryFrom;
1525
+ })(LocationFilterType || (LocationFilterType = {}));
1545
1526
  /**
1546
1527
  * @public
1547
- * Fetch request types for MOQT protocol.
1528
+ * Switch modes for subscription switching requests.
1548
1529
  */
1549
- let FetchType = /* @__PURE__ */ function(FetchType) {
1550
- FetchType[FetchType["Standalone"] = 1] = "Standalone";
1551
- FetchType[FetchType["Relative"] = 2] = "Relative";
1552
- FetchType[FetchType["Absolute"] = 3] = "Absolute";
1553
- return FetchType;
1530
+ let SwitchMode = /* @__PURE__ */ function(SwitchMode) {
1531
+ SwitchMode[SwitchMode["Hard"] = 0] = "Hard";
1532
+ SwitchMode[SwitchMode["Soft"] = 1] = "Soft";
1533
+ return SwitchMode;
1554
1534
  }({});
1555
- (function(_FetchType) {
1556
- function tryFrom(v) {
1557
- switch (v) {
1558
- case 1n: return 1;
1559
- case 2n: return 2;
1560
- case 3n: return 3;
1561
- default: throw new InvalidEnumValue("FetchType.tryFrom", v);
1562
- }
1563
- }
1564
- _FetchType.tryFrom = tryFrom;
1565
- })(FetchType || (FetchType = {}));
1566
1535
  /**
1567
1536
  * @public
1568
1537
  * Group ordering options for object delivery.
@@ -1617,7 +1586,6 @@ let PublishDoneStatusCode = /* @__PURE__ */ function(PublishDoneStatusCode) {
1617
1586
  PublishDoneStatusCode[PublishDoneStatusCode["InternalError"] = 0] = "InternalError";
1618
1587
  PublishDoneStatusCode[PublishDoneStatusCode["Unauthorized"] = 1] = "Unauthorized";
1619
1588
  PublishDoneStatusCode[PublishDoneStatusCode["TrackEnded"] = 2] = "TrackEnded";
1620
- PublishDoneStatusCode[PublishDoneStatusCode["SubscriptionEnded"] = 3] = "SubscriptionEnded";
1621
1589
  PublishDoneStatusCode[PublishDoneStatusCode["GoingAway"] = 4] = "GoingAway";
1622
1590
  PublishDoneStatusCode[PublishDoneStatusCode["TooFarBehind"] = 5] = "TooFarBehind";
1623
1591
  PublishDoneStatusCode[PublishDoneStatusCode["Expired"] = 6] = "Expired";
@@ -1632,7 +1600,6 @@ let PublishDoneStatusCode = /* @__PURE__ */ function(PublishDoneStatusCode) {
1632
1600
  case 0n: return 0;
1633
1601
  case 1n: return 1;
1634
1602
  case 2n: return 2;
1635
- case 3n: return 3;
1636
1603
  case 4n: return 4;
1637
1604
  case 5n: return 5;
1638
1605
  case 6n: return 6;
@@ -1671,13 +1638,14 @@ let RequestErrorCode = /* @__PURE__ */ function(RequestErrorCode) {
1671
1638
  RequestErrorCode[RequestErrorCode["DoesNotExist"] = 16] = "DoesNotExist";
1672
1639
  RequestErrorCode[RequestErrorCode["InvalidRange"] = 17] = "InvalidRange";
1673
1640
  RequestErrorCode[RequestErrorCode["MalformedTrack"] = 18] = "MalformedTrack";
1674
- RequestErrorCode[RequestErrorCode["DuplicateSubscription"] = 25] = "DuplicateSubscription";
1675
1641
  RequestErrorCode[RequestErrorCode["Uninterested"] = 32] = "Uninterested";
1676
1642
  RequestErrorCode[RequestErrorCode["PrefixOverlap"] = 48] = "PrefixOverlap";
1677
1643
  RequestErrorCode[RequestErrorCode["NamespaceTooLarge"] = 49] = "NamespaceTooLarge";
1678
- RequestErrorCode[RequestErrorCode["InvalidJoiningRequestId"] = 50] = "InvalidJoiningRequestId";
1644
+ RequestErrorCode[RequestErrorCode["InvalidSwitch"] = 50] = "InvalidSwitch";
1679
1645
  RequestErrorCode[RequestErrorCode["UnsupportedExtension"] = 51] = "UnsupportedExtension";
1680
1646
  RequestErrorCode[RequestErrorCode["Redirect"] = 52] = "Redirect";
1647
+ RequestErrorCode[RequestErrorCode["ConflictingFilters"] = 53] = "ConflictingFilters";
1648
+ RequestErrorCode[RequestErrorCode["InvalidFilter"] = 54] = "InvalidFilter";
1681
1649
  return RequestErrorCode;
1682
1650
  }({});
1683
1651
  (function(_RequestErrorCode) {
@@ -1694,13 +1662,14 @@ let RequestErrorCode = /* @__PURE__ */ function(RequestErrorCode) {
1694
1662
  case 16n: return 16;
1695
1663
  case 17n: return 17;
1696
1664
  case 18n: return 18;
1697
- case 25n: return 25;
1698
1665
  case 32n: return 32;
1699
1666
  case 48n: return 48;
1700
1667
  case 49n: return 49;
1701
1668
  case 50n: return 50;
1702
1669
  case 51n: return 51;
1703
1670
  case 52n: return 52;
1671
+ case 53n: return 53;
1672
+ case 54n: return 54;
1704
1673
  default: throw new InvalidEnumValue("RequestErrorCode.tryFrom", v);
1705
1674
  }
1706
1675
  }
@@ -1954,7 +1923,7 @@ const MAX_FULL_TRACK_NAME_LENGTH = 4096;
1954
1923
  * Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.
1955
1924
  *
1956
1925
  * Constraints enforced (throws {@link TrackNameError}):
1957
- * - Namespace tuple field count: 0 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (draft-18 §2.4.1; an empty namespace is legal).
1926
+ * - Namespace tuple field count: 0 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (an empty namespace is legal).
1958
1927
  * - Total serialized length (namespace tuple + raw name bytes) less than or equals {@link MAX_FULL_TRACK_NAME_LENGTH} bytes.
1959
1928
  *
1960
1929
  * Namespace input may be:
@@ -2082,11 +2051,8 @@ function locPropertyIdFromNumber(value) {
2082
2051
  }
2083
2052
  /**
2084
2053
  * @public
2085
- * Registration-policy ranges for the Property Type space (§15.8).
2054
+ * Registration-policy ranges for the Property Type space.
2086
2055
  *
2087
- * §2.5 gives the 1-byte application-specific range as `0x38-0x3F`; that is stale text
2088
- * from before draft-18's varint change, which made the 1-byte space `0x00-0x7F`.
2089
- * §15.8 is the correct table and is what these constants follow.
2090
2056
  */
2091
2057
  const PropertyRanges = {
2092
2058
  /** Standards Action or IESG Approval (1-byte encoding). */
@@ -2351,6 +2317,53 @@ var LOCProperties = class {
2351
2317
  }
2352
2318
  };
2353
2319
  //#endregion
2320
+ //#region src/model/common/grease.ts
2321
+ /**
2322
+ * Copyright 2026 The MOQtail Authors
2323
+ *
2324
+ * Licensed under the Apache License, Version 2.0 (the "License");
2325
+ * you may not use this file except in compliance with the License.
2326
+ * You may obtain a copy of the License at
2327
+ *
2328
+ * http://www.apache.org/licenses/LICENSE-2.0
2329
+ *
2330
+ * Unless required by applicable law or agreed to in writing, software
2331
+ * distributed under the License is distributed on an "AS IS" BASIS,
2332
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2333
+ * See the License for the specific language governing permissions and
2334
+ * limitations under the License.
2335
+ */
2336
+ /**
2337
+ * GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
2338
+ * several registries (Setup Options, Properties, error codes) so peers can emit them
2339
+ * to exercise unknown-value handling. Receivers treat them like any other unknown
2340
+ * value: ignore, never fatal.
2341
+ */
2342
+ /** Step between successive GREASE values. */
2343
+ const GREASE_STEP = 127n;
2344
+ /** The smallest GREASE value (N = 0). */
2345
+ const GREASE_BASE = 157n;
2346
+ /** The largest GREASE value that still fits a varint, i.e. `0x3fffffffffffffde`. */
2347
+ const GREASE_MAX = 4611686018427387870n;
2348
+ /**
2349
+ * @public
2350
+ * True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
2351
+ * non-negative `N`.
2352
+ */
2353
+ function isGrease(value) {
2354
+ const v = BigInt(value);
2355
+ return v >= 157n && (v - 157n) % 127n === 0n;
2356
+ }
2357
+ /**
2358
+ * @public
2359
+ * The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
2360
+ * varint can carry (the pattern is capped at `0x3fffffffffffffde`).
2361
+ */
2362
+ function greaseValue(n) {
2363
+ const value = GREASE_STEP * BigInt(n) + GREASE_BASE;
2364
+ return value > GREASE_MAX ? void 0 : value;
2365
+ }
2366
+ //#endregion
2354
2367
  //#region src/model/property/track_property.ts
2355
2368
  /**
2356
2369
  * Copyright 2026 The MOQtail Authors
@@ -2675,7 +2688,7 @@ var SubgroupObject = class SubgroupObject {
2675
2688
  return new SubgroupObject(objectId, normalizeProperties(properties), null, payload);
2676
2689
  }
2677
2690
  serialize(previousObjectId) {
2678
- let objectIdDelta = previousObjectId ? this.objectId - previousObjectId - BigInt(1) : this.objectId;
2691
+ let objectIdDelta = previousObjectId !== void 0 ? this.objectId - previousObjectId - BigInt(1) : this.objectId;
2679
2692
  const buf = new ByteBuffer();
2680
2693
  buf.putVI(objectIdDelta);
2681
2694
  if (this.properties !== null) buf.putLengthPrefixedBytes(serializeKvpList(this.properties).toUint8Array());
@@ -2762,7 +2775,7 @@ var MoqtObject = class MoqtObject {
2762
2775
  return new MoqtObject(fullTrackName, location, publisherPriority, objectForwardingPreference, subgroupId, objectStatus, properties, null);
2763
2776
  }
2764
2777
  /**
2765
- * Create a MoqtObject from a Datagram (Draft-16).
2778
+ * Create a MoqtObject from a Datagram.
2766
2779
  * @param datagram - The received Datagram.
2767
2780
  * @param fullTrackName - The resolved full track name.
2768
2781
  * @param defaultPriority - The default publisher priority from the control message (used when DEFAULT_PRIORITY bit is set).
@@ -2789,7 +2802,7 @@ var MoqtObject = class MoqtObject {
2789
2802
  return new MoqtObject(fullTrackName, new Location(groupId, subgroupObject.objectId), publisherPriority ?? 128, "Subgroup", subgroupId, subgroupObject.objectStatus || 0, subgroupObject.properties, subgroupObject.payload);
2790
2803
  }
2791
2804
  /**
2792
- * Convert to Datagram for wire transmission (Draft-16).
2805
+ * Convert to Datagram for wire transmission.
2793
2806
  * Automatically creates a payload or status Datagram based on the object's state.
2794
2807
  * @param trackAlias - The track alias to use.
2795
2808
  * @param endOfGroup - Whether this is the last object in the group (only for payload datagrams).
@@ -3237,8 +3250,7 @@ var ByteBuffer = class extends BaseByteBuffer {
3237
3250
  }
3238
3251
  /**
3239
3252
  /**
3240
- * Encode a MOQT draft-18 varint using the minimal length.
3241
- * See section 1.4.1 https://datatracker.ietf.org/doc/draft-ietf-moq-transport/
3253
+ * Encode a MOQT varint using the minimal length.
3242
3254
  */
3243
3255
  putVI(v) {
3244
3256
  const value = typeof v === "number" ? BigInt(v) : v;
@@ -3309,7 +3321,7 @@ var FrozenByteBuffer = class extends BaseByteBuffer {
3309
3321
  }
3310
3322
  };
3311
3323
  //#endregion
3312
- //#region src/model/control/publish_blocked.ts
3324
+ //#region src/model/control/publish_skipped.ts
3313
3325
  /**
3314
3326
  * Copyright 2026 The MOQtail Authors
3315
3327
  *
@@ -3327,15 +3339,13 @@ var FrozenByteBuffer = class extends BaseByteBuffer {
3327
3339
  */
3328
3340
  /**
3329
3341
  * @public
3330
- * PUBLISH_BLOCKED (0xF): a publisher tells the peer it cannot send the PUBLISH that
3331
- * would start a subscription to a track under a SUBSCRIBE_TRACKS namespace, because it
3332
- * is blocked by the peer's bidirectional stream limit. It MUST NOT send PUBLISH for
3333
- * that track until the limit lifts (§10.20).
3342
+ * PUBLISH_SKIPPED (0xF): a publisher tells the peer it cannot send the PUBLISH that
3343
+ * would start a subscription to a track under a SUBSCRIBE_TRACKS namespace.
3334
3344
  *
3335
3345
  * Sent on the SUBSCRIBE_TRACKS response stream, so only the namespace suffix after that
3336
3346
  * subscription's prefix is carried.
3337
3347
  */
3338
- var PublishBlocked = class PublishBlocked {
3348
+ var PublishSkipped = class PublishSkipped {
3339
3349
  trackNamespaceSuffix;
3340
3350
  trackName;
3341
3351
  constructor(trackNamespaceSuffix, trackName) {
@@ -3352,7 +3362,7 @@ var PublishBlocked = class PublishBlocked {
3352
3362
  payload.putTuple(this.trackNamespaceSuffix);
3353
3363
  payload.putLengthPrefixedBytes(this.trackName);
3354
3364
  const payloadBytes = payload.toUint8Array();
3355
- if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("PublishBlocked::serialize(payloadBytes.length)", 65535, payloadBytes.length);
3365
+ if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("PublishSkipped::serialize(payloadBytes.length)", 65535, payloadBytes.length);
3356
3366
  buf.putU16(payloadBytes.length);
3357
3367
  buf.putBytes(payloadBytes);
3358
3368
  return buf.freeze();
@@ -3360,10 +3370,135 @@ var PublishBlocked = class PublishBlocked {
3360
3370
  static parsePayload(buf) {
3361
3371
  const trackNamespaceSuffix = buf.getTuple();
3362
3372
  const trackName = buf.getLengthPrefixedBytes();
3363
- return new PublishBlocked(trackNamespaceSuffix, trackName);
3373
+ return new PublishSkipped(trackNamespaceSuffix, trackName);
3364
3374
  }
3365
3375
  };
3366
3376
  //#endregion
3377
+ //#region src/model/parameter/constant.ts
3378
+ /**
3379
+ * Copyright 2026 The MOQtail Authors
3380
+ *
3381
+ * Licensed under the Apache License, Version 2.0 (the "License");
3382
+ * you may not use this file except in compliance with the License.
3383
+ * You may obtain a copy of the License at
3384
+ *
3385
+ * http://www.apache.org/licenses/LICENSE-2.0
3386
+ *
3387
+ * Unless required by applicable law or agreed to in writing, software
3388
+ * distributed under the License is distributed on an "AS IS" BASIS,
3389
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3390
+ * See the License for the specific language governing permissions and
3391
+ * limitations under the License.
3392
+ */
3393
+ let SetupOptionType = /* @__PURE__ */ function(SetupOptionType) {
3394
+ SetupOptionType[SetupOptionType["Path"] = 1] = "Path";
3395
+ SetupOptionType[SetupOptionType["AuthorizationToken"] = 3] = "AuthorizationToken";
3396
+ SetupOptionType[SetupOptionType["MaxAuthTokenCacheSize"] = 4] = "MaxAuthTokenCacheSize";
3397
+ /** Raw-QUIC only. Client-only; MUST NOT be sent over WebTransport. */
3398
+ SetupOptionType[SetupOptionType["Authority"] = 5] = "Authority";
3399
+ SetupOptionType[SetupOptionType["MaxFilterRanges"] = 6] = "MaxFilterRanges";
3400
+ SetupOptionType[SetupOptionType["MoqtImplementation"] = 7] = "MoqtImplementation";
3401
+ SetupOptionType[SetupOptionType["MaxRequestUpdates"] = 8] = "MaxRequestUpdates";
3402
+ /**
3403
+ * PROVISIONAL: sender-side track switching is not an adopted extension, so this
3404
+ * codepoint is absent from the registry the conformance fixture tracks. It sits in the
3405
+ * 0x07-0x7F range of this space, which that registry leaves free.
3406
+ */
3407
+ SetupOptionType[SetupOptionType["SstsAlgorithms"] = 9] = "SstsAlgorithms";
3408
+ return SetupOptionType;
3409
+ }({});
3410
+ function setupOptionTypeFromNumber(value) {
3411
+ switch (value) {
3412
+ case 1: return 1;
3413
+ case 3: return 3;
3414
+ case 4: return 4;
3415
+ case 5: return 5;
3416
+ case 6: return 6;
3417
+ case 7: return 7;
3418
+ case 8: return 8;
3419
+ case 9: return 9;
3420
+ default: throw new InvalidTypeError("setupOptionTypeFromNumber", `Invalid setup option type: ${value}`);
3421
+ }
3422
+ }
3423
+ let MessageParameterType = /* @__PURE__ */ function(MessageParameterType) {
3424
+ MessageParameterType[MessageParameterType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
3425
+ MessageParameterType[MessageParameterType["AuthorizationToken"] = 3] = "AuthorizationToken";
3426
+ MessageParameterType[MessageParameterType["RendezvousTimeout"] = 4] = "RendezvousTimeout";
3427
+ MessageParameterType[MessageParameterType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
3428
+ MessageParameterType[MessageParameterType["Expires"] = 8] = "Expires";
3429
+ MessageParameterType[MessageParameterType["LargestObject"] = 9] = "LargestObject";
3430
+ MessageParameterType[MessageParameterType["FillTimeout"] = 10] = "FillTimeout";
3431
+ MessageParameterType[MessageParameterType["Forward"] = 16] = "Forward";
3432
+ MessageParameterType[MessageParameterType["SubscriberPriority"] = 32] = "SubscriberPriority";
3433
+ MessageParameterType[MessageParameterType["LocationFilter"] = 33] = "LocationFilter";
3434
+ MessageParameterType[MessageParameterType["GroupOrder"] = 34] = "GroupOrder";
3435
+ MessageParameterType[MessageParameterType["FillParameters"] = 35] = "FillParameters";
3436
+ MessageParameterType[MessageParameterType["SwitchFrom"] = 36] = "SwitchFrom";
3437
+ MessageParameterType[MessageParameterType["SubgroupFilter"] = 37] = "SubgroupFilter";
3438
+ MessageParameterType[MessageParameterType["ObjectIdFilter"] = 38] = "ObjectIdFilter";
3439
+ MessageParameterType[MessageParameterType["PriorityFilter"] = 39] = "PriorityFilter";
3440
+ MessageParameterType[MessageParameterType["ObjectPropertyFilter"] = 40] = "ObjectPropertyFilter";
3441
+ MessageParameterType[MessageParameterType["TrackPropertyFilter"] = 41] = "TrackPropertyFilter";
3442
+ MessageParameterType[MessageParameterType["NewGroupRequest"] = 50] = "NewGroupRequest";
3443
+ /**
3444
+ * Registered codepoint with no typed parameter yet: its consumer is REQUEST_UPDATE for
3445
+ * SUBSCRIBE_TRACKS (TS-11), and the value is a Track Namespace tuple rather than the
3446
+ * varint its even Type implies.
3447
+ */
3448
+ MessageParameterType[MessageParameterType["TrackNamespacePrefix"] = 52] = "TrackNamespacePrefix";
3449
+ MessageParameterType[MessageParameterType["IncludeProperties"] = 53] = "IncludeProperties";
3450
+ /**
3451
+ * PROVISIONAL: sender-side track switching is not an adopted extension, so this
3452
+ * codepoint is absent from the registry the conformance fixture tracks; see its
3453
+ * `local_extensions`.
3454
+ */
3455
+ MessageParameterType[MessageParameterType["SwitchingSetAssignment"] = 65] = "SwitchingSetAssignment";
3456
+ return MessageParameterType;
3457
+ }({});
3458
+ function messageParameterTypeFromNumber(value) {
3459
+ switch (Number(value)) {
3460
+ case 2: return 2;
3461
+ case 3: return 3;
3462
+ case 4: return 4;
3463
+ case 6: return 6;
3464
+ case 8: return 8;
3465
+ case 9: return 9;
3466
+ case 10: return 10;
3467
+ case 16: return 16;
3468
+ case 32: return 32;
3469
+ case 33: return 33;
3470
+ case 34: return 34;
3471
+ case 35: return 35;
3472
+ case 36: return 36;
3473
+ case 37: return 37;
3474
+ case 38: return 38;
3475
+ case 39: return 39;
3476
+ case 40: return 40;
3477
+ case 41: return 41;
3478
+ case 50: return 50;
3479
+ case 52: return 52;
3480
+ case 53: return 53;
3481
+ case 65: return 65;
3482
+ default: throw new InvalidTypeError("messageParameterTypeFromNumber", `Unknown message parameter type: ${value}`);
3483
+ }
3484
+ }
3485
+ let TokenAliasType = /* @__PURE__ */ function(TokenAliasType) {
3486
+ TokenAliasType[TokenAliasType["Delete"] = 0] = "Delete";
3487
+ TokenAliasType[TokenAliasType["Register"] = 1] = "Register";
3488
+ TokenAliasType[TokenAliasType["UseAlias"] = 2] = "UseAlias";
3489
+ TokenAliasType[TokenAliasType["UseValue"] = 3] = "UseValue";
3490
+ return TokenAliasType;
3491
+ }({});
3492
+ function tokenAliasTypeFromNumber(value) {
3493
+ switch (value) {
3494
+ case 0: return 0;
3495
+ case 1: return 1;
3496
+ case 2: return 2;
3497
+ case 3: return 3;
3498
+ default: throw new InvalidTypeError("tokenAliasTypeFromNumber", `Invalid token alias type: ${value}`);
3499
+ }
3500
+ }
3501
+ //#endregion
3367
3502
  //#region src/model/common/moqt_url.ts
3368
3503
  /**
3369
3504
  * Copyright 2026 The MOQtail Authors
@@ -3382,7 +3517,7 @@ var PublishBlocked = class PublishBlocked {
3382
3517
  */
3383
3518
  /**
3384
3519
  * @public
3385
- * A parsed `moqt://authority/path[?query][#fragment]` URI (draft-18 §3.1).
3520
+ * A parsed `moqt://authority/path[?query][#fragment]` URI.
3386
3521
  *
3387
3522
  * `moqt-URI = "moqt" "://" authority path-abempty [ "?" query ]`, with an optional
3388
3523
  * local-only fragment. `authority` is `host[:port]`; `path` keeps its leading `/`
@@ -3522,112 +3657,7 @@ var Redirect = class Redirect {
3522
3657
  }
3523
3658
  };
3524
3659
  //#endregion
3525
- //#region src/model/parameter/constant.ts
3526
- /**
3527
- * Copyright 2026 The MOQtail Authors
3528
- *
3529
- * Licensed under the Apache License, Version 2.0 (the "License");
3530
- * you may not use this file except in compliance with the License.
3531
- * You may obtain a copy of the License at
3532
- *
3533
- * http://www.apache.org/licenses/LICENSE-2.0
3534
- *
3535
- * Unless required by applicable law or agreed to in writing, software
3536
- * distributed under the License is distributed on an "AS IS" BASIS,
3537
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3538
- * See the License for the specific language governing permissions and
3539
- * limitations under the License.
3540
- */
3541
- let SetupOptionType = /* @__PURE__ */ function(SetupOptionType) {
3542
- SetupOptionType[SetupOptionType["Path"] = 1] = "Path";
3543
- SetupOptionType[SetupOptionType["AuthorizationToken"] = 3] = "AuthorizationToken";
3544
- SetupOptionType[SetupOptionType["MaxAuthTokenCacheSize"] = 4] = "MaxAuthTokenCacheSize";
3545
- /** Raw-QUIC only. Client-only; MUST NOT be sent over WebTransport (draft-18 §10.3.1.1). */
3546
- SetupOptionType[SetupOptionType["Authority"] = 5] = "Authority";
3547
- SetupOptionType[SetupOptionType["MoqtImplementation"] = 7] = "MoqtImplementation";
3548
- /**
3549
- * PROVISIONAL: sender-side track switching is not an adopted extension, so this
3550
- * codepoint is absent from the registry the conformance fixture tracks. It sits in the
3551
- * 0x07-0x7F range of this space, which that registry leaves free.
3552
- */
3553
- SetupOptionType[SetupOptionType["SstsAlgorithms"] = 9] = "SstsAlgorithms";
3554
- return SetupOptionType;
3555
- }({});
3556
- function setupOptionTypeFromNumber(value) {
3557
- switch (value) {
3558
- case 1: return 1;
3559
- case 3: return 3;
3560
- case 4: return 4;
3561
- case 5: return 5;
3562
- case 7: return 7;
3563
- case 9: return 9;
3564
- default: throw new InvalidTypeError("setupOptionTypeFromNumber", `Invalid setup option type: ${value}`);
3565
- }
3566
- }
3567
- let MessageParameterType = /* @__PURE__ */ function(MessageParameterType) {
3568
- MessageParameterType[MessageParameterType["ObjectDeliveryTimeout"] = 2] = "ObjectDeliveryTimeout";
3569
- MessageParameterType[MessageParameterType["AuthorizationToken"] = 3] = "AuthorizationToken";
3570
- MessageParameterType[MessageParameterType["RendezvousTimeout"] = 4] = "RendezvousTimeout";
3571
- MessageParameterType[MessageParameterType["SubgroupDeliveryTimeout"] = 6] = "SubgroupDeliveryTimeout";
3572
- MessageParameterType[MessageParameterType["Expires"] = 8] = "Expires";
3573
- MessageParameterType[MessageParameterType["LargestObject"] = 9] = "LargestObject";
3574
- MessageParameterType[MessageParameterType["FillTimeout"] = 10] = "FillTimeout";
3575
- MessageParameterType[MessageParameterType["Forward"] = 16] = "Forward";
3576
- MessageParameterType[MessageParameterType["SubscriberPriority"] = 32] = "SubscriberPriority";
3577
- MessageParameterType[MessageParameterType["SubscriptionFilter"] = 33] = "SubscriptionFilter";
3578
- MessageParameterType[MessageParameterType["GroupOrder"] = 34] = "GroupOrder";
3579
- MessageParameterType[MessageParameterType["NewGroupRequest"] = 50] = "NewGroupRequest";
3580
- /**
3581
- * Registered codepoint with no typed parameter yet: its consumer is REQUEST_UPDATE for
3582
- * SUBSCRIBE_TRACKS (TS-11), and the value is a Track Namespace tuple rather than the
3583
- * varint its even Type implies.
3584
- */
3585
- MessageParameterType[MessageParameterType["TrackNamespacePrefix"] = 52] = "TrackNamespacePrefix";
3586
- /**
3587
- * PROVISIONAL: sender-side track switching is not an adopted extension, so this
3588
- * codepoint is absent from the registry the conformance fixture tracks; see its
3589
- * `local_extensions`.
3590
- */
3591
- MessageParameterType[MessageParameterType["SwitchingSetAssignment"] = 65] = "SwitchingSetAssignment";
3592
- return MessageParameterType;
3593
- }({});
3594
- function messageParameterTypeFromNumber(value) {
3595
- switch (Number(value)) {
3596
- case 2: return 2;
3597
- case 3: return 3;
3598
- case 4: return 4;
3599
- case 6: return 6;
3600
- case 8: return 8;
3601
- case 9: return 9;
3602
- case 10: return 10;
3603
- case 16: return 16;
3604
- case 32: return 32;
3605
- case 33: return 33;
3606
- case 34: return 34;
3607
- case 50: return 50;
3608
- case 52: return 52;
3609
- case 65: return 65;
3610
- default: throw new InvalidTypeError("messageParameterTypeFromNumber", `Unknown message parameter type: ${value}`);
3611
- }
3612
- }
3613
- let TokenAliasType = /* @__PURE__ */ function(TokenAliasType) {
3614
- TokenAliasType[TokenAliasType["Delete"] = 0] = "Delete";
3615
- TokenAliasType[TokenAliasType["Register"] = 1] = "Register";
3616
- TokenAliasType[TokenAliasType["UseAlias"] = 2] = "UseAlias";
3617
- TokenAliasType[TokenAliasType["UseValue"] = 3] = "UseValue";
3618
- return TokenAliasType;
3619
- }({});
3620
- function tokenAliasTypeFromNumber(value) {
3621
- switch (value) {
3622
- case 0: return 0;
3623
- case 1: return 1;
3624
- case 2: return 2;
3625
- case 3: return 3;
3626
- default: throw new InvalidTypeError("tokenAliasTypeFromNumber", `Invalid token alias type: ${value}`);
3627
- }
3628
- }
3629
- //#endregion
3630
- //#region src/model/parameter/common/authorization_token.ts
3660
+ //#region src/model/parameter/common/authorization_token.ts
3631
3661
  /**
3632
3662
  * Copyright 2026 The MOQtail Authors
3633
3663
  *
@@ -3957,6 +3987,45 @@ var Forward = class Forward {
3957
3987
  }
3958
3988
  };
3959
3989
  //#endregion
3990
+ //#region src/model/parameter/message/include_properties.ts
3991
+ /**
3992
+ * Copyright 2026 The MOQtail Authors
3993
+ *
3994
+ * Licensed under the Apache License, Version 2.0 (the "License");
3995
+ * you may not use this file except in compliance with the License.
3996
+ * You may obtain a copy of the License at
3997
+ *
3998
+ * http://www.apache.org/licenses/LICENSE-2.0
3999
+ *
4000
+ * Unless required by applicable law or agreed to in writing, software
4001
+ * distributed under the License is distributed on an "AS IS" BASIS,
4002
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4003
+ * See the License for the specific language governing permissions and
4004
+ * limitations under the License.
4005
+ */
4006
+ /**
4007
+ * Whether the response carries Track Properties: the OK answering a SUBSCRIBE,
4008
+ * TRACK_STATUS or FETCH, or each PUBLISH a SUBSCRIBE_TRACKS brings. With 0 the
4009
+ * Track Properties field is still there, but empty.
4010
+ * Allowed wire values: 0 or 1; any other value is a PROTOCOL_VIOLATION.
4011
+ * Default (when omitted) is 1 (include them).
4012
+ */
4013
+ var IncludeProperties = class IncludeProperties {
4014
+ include;
4015
+ static TYPE = 53;
4016
+ constructor(include) {
4017
+ this.include = include;
4018
+ }
4019
+ toKeyValuePair() {
4020
+ return KeyValuePair.newVarInt(IncludeProperties.TYPE, this.include ? 1n : 0n);
4021
+ }
4022
+ static fromKeyValuePair(pair) {
4023
+ if (Number(pair.typeValue) !== IncludeProperties.TYPE || typeof pair.value !== "bigint") return void 0;
4024
+ if (pair.value !== 0n && pair.value !== 1n) throw new ProtocolViolationError("IncludeProperties.fromKeyValuePair", `INCLUDE_PROPERTIES must be 0 or 1, got ${pair.value}`);
4025
+ return new IncludeProperties(pair.value === 1n);
4026
+ }
4027
+ };
4028
+ //#endregion
3960
4029
  //#region src/model/parameter/message/group_order_param.ts
3961
4030
  /**
3962
4031
  * Copyright 2026 The MOQtail Authors
@@ -4095,7 +4164,7 @@ var NewGroupRequest = class NewGroupRequest {
4095
4164
  *
4096
4165
  * PROVISIONAL: sender-side track switching is not an adopted extension, so
4097
4166
  * this parameter has no codepoint in the registry the conformance fixture
4098
- * tracks (`dev/conformance/draft18`) and is never asserted against it. Id 0 is
4167
+ * tracks (`dev/conformance/draft22`) and is never asserted against it. Id 0 is
4099
4168
  * the default allocation every implementation runs; other ids select an
4100
4169
  * algorithm specific to one implementation.
4101
4170
  */
@@ -4179,7 +4248,7 @@ var SubscriberPriority = class SubscriberPriority {
4179
4248
  }
4180
4249
  };
4181
4250
  //#endregion
4182
- //#region src/model/parameter/message/subscription_filter.ts
4251
+ //#region src/model/parameter/message/location_filter.ts
4183
4252
  /**
4184
4253
  * Copyright 2026 The MOQtail Authors
4185
4254
  *
@@ -4195,40 +4264,466 @@ var SubscriberPriority = class SubscriberPriority {
4195
4264
  * See the License for the specific language governing permissions and
4196
4265
  * limitations under the License.
4197
4266
  */
4267
+ const MAX_U64$1 = 18446744073709551615n;
4268
+ /** The fields each Location Filter Type carries, in wire order. */
4269
+ const FIELD_COUNT = {
4270
+ [0]: 0,
4271
+ [1]: 1,
4272
+ [2]: 2,
4273
+ [3]: 3,
4274
+ [4]: 4,
4275
+ [5]: 0
4276
+ };
4198
4277
  /**
4199
- * Length-prefixed Subscription Filter specifying what objects the subscriber wants.
4200
- * If omitted from SUBSCRIBE or PUBLISH_OK, the subscription is unfiltered (LatestObject).
4278
+ * The range of Locations a subscription or fetch selects. The Location Filter
4279
+ * Type decides which fields are set, and the value is not length-prefixed.
4280
+ *
4281
+ * Every Group here is absolute, except `startGroup` of a
4282
+ * {@link (LocationFilterType:enum).RelativeStart}, which counts back from the Next
4283
+ * Group: 0 is the Next Group, 1 the current one. The wire carries the End Group
4284
+ * as a delta from the Start Group; that is undone on the way in and redone on
4285
+ * the way out.
4286
+ *
4287
+ * If omitted from SUBSCRIBE or FETCH, the subscription or fetch is unfiltered.
4201
4288
  * If omitted from REQUEST_UPDATE, the value is unchanged.
4202
4289
  */
4203
- var SubscriptionFilter = class SubscriptionFilter {
4290
+ var LocationFilter = class LocationFilter {
4204
4291
  filterType;
4205
- startLocation;
4292
+ startGroup;
4293
+ startObject;
4206
4294
  endGroup;
4295
+ endObject;
4207
4296
  static TYPE = 33;
4208
- constructor(filterType, startLocation, endGroup) {
4297
+ /**
4298
+ * @throws :{@link ProtocolViolationError} When a field the type calls for is
4299
+ * missing, or the End Group is before the Start Group.
4300
+ */
4301
+ constructor(filterType, startGroup, startObject, endGroup, endObject) {
4209
4302
  this.filterType = filterType;
4210
- this.startLocation = startLocation;
4303
+ this.startGroup = startGroup;
4304
+ this.startObject = startObject;
4211
4305
  this.endGroup = endGroup;
4306
+ this.endObject = endObject;
4307
+ const fields = [
4308
+ startGroup,
4309
+ startObject,
4310
+ endGroup,
4311
+ endObject
4312
+ ];
4313
+ const count = FIELD_COUNT[filterType];
4314
+ if (count === void 0) throw new ProtocolViolationError("LocationFilter", `unknown Location Filter Type ${filterType}`);
4315
+ fields.forEach((field, i) => {
4316
+ if (field !== void 0 !== i < count) throw new ProtocolViolationError("LocationFilter", `Location Filter Type ${filterType} carries ${count} fields; field ${i + 1} is ${field === void 0 ? "missing" : "not one of them"}`);
4317
+ });
4318
+ if (endGroup !== void 0 && endGroup < startGroup) throw new ProtocolViolationError("LocationFilter", `End Group ${endGroup} is before Start Group ${startGroup}`);
4212
4319
  }
4213
- toKeyValuePair() {
4320
+ /**
4321
+ * The first Location the filter passes, given the track's Largest Object, or
4322
+ * `undefined` when there is no filter. A relative start that would fall before
4323
+ * group 0 is group 0; a track with nothing published yet starts a relative
4324
+ * filter at `{0,0}`.
4325
+ */
4326
+ startLocation(largest) {
4327
+ switch (this.filterType) {
4328
+ case 0: return;
4329
+ case 1: {
4330
+ if (!largest) return new Location(0n, 0n);
4331
+ const group = largest.group + 1n - this.startGroup;
4332
+ return new Location(group < 0n ? 0n : group > MAX_U64$1 ? MAX_U64$1 : group, 0n);
4333
+ }
4334
+ case 5: return largest ? new Location(largest.group, largest.object + 1n) : new Location(0n, 0n);
4335
+ default: return new Location(this.startGroup, this.startObject);
4336
+ }
4337
+ }
4338
+ /** The Start Location an absolute filter carries; `undefined` for the others. */
4339
+ get absoluteStart() {
4340
+ switch (this.filterType) {
4341
+ case 2:
4342
+ case 3:
4343
+ case 4: return new Location(this.startGroup, this.startObject);
4344
+ default: return;
4345
+ }
4346
+ }
4347
+ /**
4348
+ * The last Location the filter passes, inclusive, or `undefined` when it is
4349
+ * open-ended. A Group End is the whole of that group, so its Object is 2^64-1.
4350
+ */
4351
+ endLocation() {
4352
+ switch (this.filterType) {
4353
+ case 3: return new Location(this.endGroup, MAX_U64$1);
4354
+ case 4: return new Location(this.endGroup, this.endObject);
4355
+ default: return;
4356
+ }
4357
+ }
4358
+ /**
4359
+ * The inclusive range the filter selects under the rules for a Fetch, which
4360
+ * never reach past the Largest Object: an open end is the Largest Object, and
4361
+ * no filter at all is the whole track up to it.
4362
+ *
4363
+ * `undefined` when that range is empty, which includes a track with nothing
4364
+ * published yet and a Next Object filter, whose start is always past the
4365
+ * Largest Object.
4366
+ */
4367
+ fetchRange(largest) {
4368
+ if (!largest) return void 0;
4369
+ const start = this.startLocation(largest) ?? new Location(0n, 0n);
4370
+ const filterEnd = this.endLocation();
4371
+ const end = filterEnd && filterEnd.compare(largest) < 0 ? filterEnd : largest;
4372
+ return start.compare(end) <= 0 ? {
4373
+ start,
4374
+ end
4375
+ } : void 0;
4376
+ }
4377
+ /** The Location Filter Type and its fields, without the Parameter Type. */
4378
+ serializeValue() {
4214
4379
  const buf = new ByteBuffer();
4215
4380
  buf.putVI(this.filterType);
4216
- if (this.filterType === 3 || this.filterType === 4) {
4217
- if (this.startLocation) buf.putLocation(this.startLocation);
4381
+ const count = FIELD_COUNT[this.filterType];
4382
+ if (count > 0) buf.putVI(this.startGroup);
4383
+ if (count > 1) buf.putVI(this.startObject);
4384
+ if (count > 2) buf.putVI(this.endGroup - this.startGroup);
4385
+ if (count > 3) buf.putVI(this.endObject);
4386
+ return buf.toUint8Array();
4387
+ }
4388
+ /**
4389
+ * Reads a Location Filter Type and exactly the fields it calls for.
4390
+ * @throws :{@link ProtocolViolationError} For an unknown Location Filter Type,
4391
+ * or an End Group past 2^64-1.
4392
+ */
4393
+ static deserializeValue(buf) {
4394
+ const raw = buf.getVI();
4395
+ let filterType;
4396
+ try {
4397
+ filterType = LocationFilterType.tryFrom(raw);
4398
+ } catch {
4399
+ throw new ProtocolViolationError("LocationFilter.deserializeValue", `unknown Location Filter Type ${raw}`);
4400
+ }
4401
+ const count = FIELD_COUNT[filterType];
4402
+ const startGroup = count > 0 ? buf.getVI() : void 0;
4403
+ const startObject = count > 1 ? buf.getVI() : void 0;
4404
+ let endGroup;
4405
+ if (count > 2) {
4406
+ endGroup = startGroup + buf.getVI();
4407
+ if (endGroup > MAX_U64$1) throw new ProtocolViolationError("LocationFilter.deserializeValue", `StartGroup plus EndGroupDelta exceeds 2^64 - 1`);
4218
4408
  }
4219
- if (this.filterType === 4 && this.endGroup != null) buf.putVI(this.endGroup);
4220
- return KeyValuePair.tryNewBytes(SubscriptionFilter.TYPE, buf.toUint8Array());
4409
+ const endObject = count > 3 ? buf.getVI() : void 0;
4410
+ return new LocationFilter(filterType, startGroup, startObject, endGroup, endObject);
4411
+ }
4412
+ toKeyValuePair() {
4413
+ return KeyValuePair.tryNewBytes(LocationFilter.TYPE, this.serializeValue());
4221
4414
  }
4222
4415
  static fromKeyValuePair(pair) {
4223
- if (Number(pair.typeValue) !== SubscriptionFilter.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
4416
+ if (Number(pair.typeValue) !== LocationFilter.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
4224
4417
  const buf = new ByteBuffer();
4225
4418
  buf.putBytes(pair.value);
4226
- const filterType = Number(buf.getVI());
4227
- let startLocation;
4228
- let endGroup;
4229
- if (filterType === 3 || filterType === 4) startLocation = buf.getLocation();
4230
- if (filterType === 4) endGroup = buf.getVI();
4231
- return new SubscriptionFilter(filterType, startLocation, endGroup);
4419
+ const frozen = buf.freeze();
4420
+ const filter = LocationFilter.deserializeValue(frozen);
4421
+ if (frozen.remaining > 0) throw new ProtocolViolationError("LocationFilter.fromKeyValuePair", "trailing bytes after the Location Filter");
4422
+ return filter;
4423
+ }
4424
+ };
4425
+ //#endregion
4426
+ //#region src/model/parameter/message/switch_from.ts
4427
+ /**
4428
+ * Copyright 2026 The MOQtail Authors
4429
+ *
4430
+ * Licensed under the Apache License, Version 2.0 (the "License");
4431
+ * you may not use this file except in compliance with the License.
4432
+ * You may obtain a copy of the License at
4433
+ *
4434
+ * http://www.apache.org/licenses/LICENSE-2.0
4435
+ *
4436
+ * Unless required by applicable law or agreed to in writing, software
4437
+ * distributed under the License is distributed on an "AS IS" BASIS,
4438
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4439
+ * See the License for the specific language governing permissions and
4440
+ * limitations under the License.
4441
+ */
4442
+ /**
4443
+ * Identifies the subscription being replaced by a switch request.
4444
+ * The value is two varints followed by a flags byte: bit 7 (MSB) is Publish Done;
4445
+ * bits 0 through 6 are reserved and must be zero.
4446
+ */
4447
+ var SwitchFrom = class SwitchFrom {
4448
+ requestId;
4449
+ mode;
4450
+ publishDone;
4451
+ static TYPE = 36;
4452
+ constructor(requestId, mode, publishDone) {
4453
+ this.requestId = requestId;
4454
+ this.mode = mode;
4455
+ this.publishDone = publishDone;
4456
+ }
4457
+ toKeyValuePair() {
4458
+ const buf = new ByteBuffer();
4459
+ buf.putVI(this.requestId);
4460
+ buf.putVI(this.mode);
4461
+ buf.putU8(this.publishDone ? 128 : 0);
4462
+ return KeyValuePair.newBytes(SwitchFrom.TYPE, buf.toUint8Array());
4463
+ }
4464
+ static fromKeyValuePair(pair) {
4465
+ if (Number(pair.typeValue) !== SwitchFrom.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
4466
+ const buf = new ByteBuffer();
4467
+ buf.putBytes(pair.value);
4468
+ const requestId = buf.getVI();
4469
+ const modeValue = buf.getVI();
4470
+ if (modeValue !== BigInt(0) && modeValue !== BigInt(1)) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", `invalid mode ${modeValue}`);
4471
+ const flags = buf.getU8();
4472
+ if ((flags & 127) !== 0) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", `reserved bits must be zero, got ${flags}`);
4473
+ if (buf.remaining !== 0) throw new ProtocolViolationError("SwitchFrom.fromKeyValuePair", "unexpected trailing bytes");
4474
+ return new SwitchFrom(requestId, Number(modeValue), (flags & 128) !== 0);
4475
+ }
4476
+ };
4477
+ //#endregion
4478
+ //#region src/model/parameter/message/fill_parameters.ts
4479
+ /**
4480
+ * Copyright 2026 The MOQtail Authors
4481
+ *
4482
+ * Licensed under the Apache License, Version 2.0 (the "License");
4483
+ * you may not use this file except in compliance with the License.
4484
+ * You may obtain a copy of the License at
4485
+ *
4486
+ * http://www.apache.org/licenses/LICENSE-2.0
4487
+ *
4488
+ * Unless required by applicable law or agreed to in writing, software
4489
+ * distributed under the License is distributed on an "AS IS" BASIS,
4490
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4491
+ * See the License for the specific language governing permissions and
4492
+ * limitations under the License.
4493
+ */
4494
+ /** The only parameters that may override anything for the fill fetch stream. */
4495
+ const ALLOWED = [
4496
+ 10,
4497
+ 32,
4498
+ 33,
4499
+ 34,
4500
+ 37,
4501
+ 38,
4502
+ 39,
4503
+ 40
4504
+ ];
4505
+ /**
4506
+ * Requests a fill fetch stream, and overrides for it. An omitted parameter keeps
4507
+ * the value it has for the live subscription; an omitted LOCATION_FILTER fills
4508
+ * over the subscription's own.
4509
+ */
4510
+ var FillParameters = class FillParameters {
4511
+ parameters;
4512
+ static TYPE = 35;
4513
+ constructor(parameters) {
4514
+ this.parameters = parameters;
4515
+ }
4516
+ toKeyValuePair() {
4517
+ const pairs = this.parameters.map((p) => p.toKeyValuePair());
4518
+ for (const pair of pairs) if (!ALLOWED.includes(Number(pair.typeValue))) throw new ProtocolViolationError("FillParameters.toKeyValuePair", `parameter type 0x${pair.typeValue.toString(16)} is not allowed inside FILL_PARAMETERS`);
4519
+ const value = new ByteBuffer();
4520
+ value.putVI(pairs.length);
4521
+ value.putBytes(serializeMessageParameterKvps(pairs).toUint8Array());
4522
+ return KeyValuePair.tryNewBytes(FillParameters.TYPE, value.toUint8Array());
4523
+ }
4524
+ static fromKeyValuePair(pair) {
4525
+ if (Number(pair.typeValue) !== FillParameters.TYPE || !(pair.value instanceof Uint8Array)) return void 0;
4526
+ const buf = new ByteBuffer();
4527
+ buf.putBytes(pair.value);
4528
+ const frozen = buf.freeze();
4529
+ const count = frozen.getVI();
4530
+ const pairs = deserializeMessageParameterKvps(frozen, count);
4531
+ if (frozen.remaining > 0) throw new ProtocolViolationError("FillParameters.fromKeyValuePair", `${frozen.remaining} bytes left after ${count} parameters`);
4532
+ for (const inner of pairs) if (!ALLOWED.includes(Number(inner.typeValue))) throw new ProtocolViolationError("FillParameters.fromKeyValuePair", `parameter type 0x${inner.typeValue.toString(16)} is not allowed inside FILL_PARAMETERS`);
4533
+ return new FillParameters(MessageParameters.fromKeyValuePairs(pairs));
4534
+ }
4535
+ };
4536
+ //#endregion
4537
+ //#region src/model/parameter/message/range_filter.ts
4538
+ /**
4539
+ * Copyright 2026 The MOQtail Authors
4540
+ *
4541
+ * Licensed under the Apache License, Version 2.0 (the "License");
4542
+ * you may not use this file except in compliance with the License.
4543
+ * You may obtain a copy of the License at
4544
+ *
4545
+ * http://www.apache.org/licenses/LICENSE-2.0
4546
+ *
4547
+ * Unless required by applicable law or agreed to in writing, software
4548
+ * distributed under the License is distributed on an "AS IS" BASIS,
4549
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4550
+ * See the License for the specific language governing permissions and
4551
+ * limitations under the License.
4552
+ */
4553
+ const MAX_U64 = 18446744073709551615n;
4554
+ /**
4555
+ * What a Range Filter selects on. Each kind is its own parameter type, and the two
4556
+ * property kinds also name the Property they read.
4557
+ */
4558
+ let RangeFilterKind = /* @__PURE__ */ function(RangeFilterKind) {
4559
+ RangeFilterKind[RangeFilterKind["Subgroup"] = 37] = "Subgroup";
4560
+ RangeFilterKind[RangeFilterKind["ObjectId"] = 38] = "ObjectId";
4561
+ /** Publisher Priority, which is a single byte. */
4562
+ RangeFilterKind[RangeFilterKind["Priority"] = 39] = "Priority";
4563
+ RangeFilterKind[RangeFilterKind["ObjectProperty"] = 40] = "ObjectProperty";
4564
+ /** Selects tracks rather than Objects, so it only rides SUBSCRIBE_TRACKS. */
4565
+ RangeFilterKind[RangeFilterKind["TrackProperty"] = 41] = "TrackProperty";
4566
+ return RangeFilterKind;
4567
+ }({});
4568
+ (function(_RangeFilterKind) {
4569
+ function hasPropertyType(kind) {
4570
+ return kind === RangeFilterKind.ObjectProperty || kind === RangeFilterKind.TrackProperty;
4571
+ }
4572
+ _RangeFilterKind.hasPropertyType = hasPropertyType;
4573
+ function isRangeFilterType(typeValue) {
4574
+ const n = Number(typeValue);
4575
+ return n >= 37 && n <= 41;
4576
+ }
4577
+ _RangeFilterKind.isRangeFilterType = isRangeFilterType;
4578
+ })(RangeFilterKind || (RangeFilterKind = {}));
4579
+ /**
4580
+ * A Range Filter that cannot be honoured. A peer that sends one is answered with
4581
+ * REQUEST_ERROR INVALID_FILTER rather than a closed session: the request is
4582
+ * well-formed, it just asks for something that cannot be applied.
4583
+ */
4584
+ var InvalidFilterError = class extends MOQtailError {
4585
+ context;
4586
+ details;
4587
+ constructor(context, details) {
4588
+ super(`Invalid filter in ${context}: ${details}`);
4589
+ this.context = context;
4590
+ this.details = details;
4591
+ }
4592
+ };
4593
+ /**
4594
+ * Delta-encodes ascending `ranges`. Only the last may be open-ended.
4595
+ * @throws :{@link InvalidFilterError} When the ranges do not ascend.
4596
+ */
4597
+ function encodeRanges(ranges) {
4598
+ const deltas = [];
4599
+ let priorEnd = 0n;
4600
+ ranges.forEach((range, i) => {
4601
+ if (range.start < priorEnd || range.end !== void 0 && range.end < range.start) throw new InvalidFilterError("encodeRanges", "ranges are not ascending");
4602
+ if (range.end === void 0) {
4603
+ if (i + 1 !== ranges.length) throw new InvalidFilterError("encodeRanges", "only the last range can be open-ended");
4604
+ deltas.push([range.start - priorEnd]);
4605
+ return;
4606
+ }
4607
+ deltas.push([range.start - priorEnd, range.end - range.start]);
4608
+ priorEnd = range.end;
4609
+ });
4610
+ return deltas;
4611
+ }
4612
+ /**
4613
+ * One Range Filter parameter. Unlike other parameters it may repeat in a message,
4614
+ * once per SetID (and Property Type).
4615
+ *
4616
+ * Without a `setId` it is the zero-length form, which in REQUEST_UPDATE removes the
4617
+ * filters of its kind.
4618
+ *
4619
+ * The Ranges are held as the wire's deltas and only added back by {@link
4620
+ * RangeFilter.ranges}: a sum past 2^64-1 is answered with a REQUEST_ERROR for the
4621
+ * request that carried it, which a parser that rejected it could not do.
4622
+ */
4623
+ var RangeFilter = class RangeFilter {
4624
+ kind;
4625
+ setId;
4626
+ propertyType;
4627
+ deltas;
4628
+ /**
4629
+ * @throws :{@link ProtocolViolationError} When the Property Type's presence does not
4630
+ * match the kind, or a removal carries anything but its kind.
4631
+ */
4632
+ constructor(kind, setId, propertyType, deltas = []) {
4633
+ this.kind = kind;
4634
+ this.setId = setId;
4635
+ this.propertyType = propertyType;
4636
+ this.deltas = deltas;
4637
+ if (setId === void 0) {
4638
+ if (propertyType !== void 0 || deltas.length > 0) throw new ProtocolViolationError("RangeFilter", "a removal carries no SetID, Property Type or Ranges");
4639
+ return;
4640
+ }
4641
+ if (!Number.isInteger(setId) || setId < 0 || setId > 255) throw new ProtocolViolationError("RangeFilter", `SetID ${setId} is not a single byte`);
4642
+ if (RangeFilterKind.hasPropertyType(kind) !== (propertyType !== void 0)) throw new ProtocolViolationError("RangeFilter", `${RangeFilterKind[kind]} filter has the wrong Property Type presence`);
4643
+ deltas.forEach(([, end], i) => {
4644
+ if (end === void 0 && i + 1 !== deltas.length) throw new ProtocolViolationError("RangeFilter", "only the last range can be open-ended");
4645
+ });
4646
+ }
4647
+ /** The zero-length form, which removes the filters of its kind. */
4648
+ get isRemoval() {
4649
+ return this.setId === void 0;
4650
+ }
4651
+ /** How many Ranges the filter holds, which is what a peer's range limit counts. */
4652
+ get rangeCount() {
4653
+ return this.deltas.length;
4654
+ }
4655
+ /**
4656
+ * The Ranges with their deltas added back.
4657
+ * @throws :{@link InvalidFilterError} When a bound exceeds 2^64-1.
4658
+ */
4659
+ ranges() {
4660
+ const ranges = [];
4661
+ let priorEnd = 0n;
4662
+ for (const [startDelta, endDelta] of this.deltas) {
4663
+ const start = priorEnd + startDelta;
4664
+ if (start > MAX_U64) throw new InvalidFilterError("RangeFilter.ranges", "a range bound exceeds 2^64 - 1");
4665
+ if (endDelta === void 0) {
4666
+ ranges.push({ start });
4667
+ continue;
4668
+ }
4669
+ const end = start + endDelta;
4670
+ if (end > MAX_U64) throw new InvalidFilterError("RangeFilter.ranges", "a range bound exceeds 2^64 - 1");
4671
+ ranges.push({
4672
+ start,
4673
+ end
4674
+ });
4675
+ priorEnd = end;
4676
+ }
4677
+ return ranges;
4678
+ }
4679
+ /**
4680
+ * The Ranges, once everything a filter of this kind has to satisfy holds.
4681
+ * @throws :{@link InvalidFilterError} For an odd Property Type, a priority above
4682
+ * 255, or a bound past 2^64-1.
4683
+ */
4684
+ validate() {
4685
+ if (this.propertyType !== void 0 && this.propertyType % 2n !== 0n) throw new InvalidFilterError("RangeFilter.validate", `property type 0x${this.propertyType.toString(16)} is odd`);
4686
+ const ranges = this.ranges();
4687
+ if (this.kind === RangeFilterKind.Priority) {
4688
+ const over = ranges.flatMap((r) => [r.start, r.end]).find((v) => v !== void 0 && v > 255n);
4689
+ if (over !== void 0) throw new InvalidFilterError("RangeFilter.validate", `priority ${over} is outside 0-255`);
4690
+ }
4691
+ return ranges;
4692
+ }
4693
+ /** The SetID, Property Type if any, and the Ranges, without the Type or Length. */
4694
+ serializeValue() {
4695
+ if (this.setId === void 0) return /* @__PURE__ */ new Uint8Array();
4696
+ const buf = new ByteBuffer();
4697
+ buf.putU8(this.setId);
4698
+ if (this.propertyType !== void 0) buf.putVI(this.propertyType);
4699
+ for (const [start, end] of this.deltas) {
4700
+ buf.putVI(start);
4701
+ if (end !== void 0) buf.putVI(end);
4702
+ }
4703
+ return buf.toUint8Array();
4704
+ }
4705
+ toKeyValuePair() {
4706
+ return KeyValuePair.newBytes(this.kind, this.serializeValue());
4707
+ }
4708
+ /**
4709
+ * Decodes a Range Filter value. The Value ends with the last Range, so a Start
4710
+ * with nothing after it is an open-ended last Range.
4711
+ */
4712
+ static fromKeyValuePair(pair) {
4713
+ if (!RangeFilterKind.isRangeFilterType(pair.typeValue) || !(pair.value instanceof Uint8Array)) return void 0;
4714
+ const kind = Number(pair.typeValue);
4715
+ if (pair.value.length === 0) return new RangeFilter(kind);
4716
+ const buf = new ByteBuffer();
4717
+ buf.putBytes(pair.value);
4718
+ const frozen = buf.freeze();
4719
+ const setId = frozen.getU8();
4720
+ const propertyType = RangeFilterKind.hasPropertyType(kind) ? frozen.getVI() : void 0;
4721
+ const deltas = [];
4722
+ while (frozen.remaining > 0) {
4723
+ const start = frozen.getVI();
4724
+ deltas.push(frozen.remaining > 0 ? [start, frozen.getVI()] : [start]);
4725
+ }
4726
+ return new RangeFilter(kind, setId, propertyType, deltas);
4232
4727
  }
4233
4728
  };
4234
4729
  //#endregion
@@ -4251,7 +4746,7 @@ var SubscriptionFilter = class SubscriptionFilter {
4251
4746
  let MessageParameter;
4252
4747
  (function(_MessageParameter) {
4253
4748
  function fromKeyValuePair(pair) {
4254
- return ObjectDeliveryTimeout.fromKeyValuePair(pair) ?? SubgroupDeliveryTimeout.fromKeyValuePair(pair) ?? RendezvousTimeout.fromKeyValuePair(pair) ?? FillTimeout.fromKeyValuePair(pair) ?? AuthorizationToken.fromKeyValuePair(pair) ?? Expires.fromKeyValuePair(pair) ?? LargestObject.fromKeyValuePair(pair) ?? Forward.fromKeyValuePair(pair) ?? SubscriberPriority.fromKeyValuePair(pair) ?? GroupOrderParam.fromKeyValuePair(pair) ?? SubscriptionFilter.fromKeyValuePair(pair) ?? NewGroupRequest.fromKeyValuePair(pair) ?? SwitchingSetAssignment.fromKeyValuePair(pair);
4749
+ return ObjectDeliveryTimeout.fromKeyValuePair(pair) ?? SubgroupDeliveryTimeout.fromKeyValuePair(pair) ?? RendezvousTimeout.fromKeyValuePair(pair) ?? FillTimeout.fromKeyValuePair(pair) ?? AuthorizationToken.fromKeyValuePair(pair) ?? Expires.fromKeyValuePair(pair) ?? LargestObject.fromKeyValuePair(pair) ?? Forward.fromKeyValuePair(pair) ?? SubscriberPriority.fromKeyValuePair(pair) ?? GroupOrderParam.fromKeyValuePair(pair) ?? LocationFilter.fromKeyValuePair(pair) ?? NewGroupRequest.fromKeyValuePair(pair) ?? SwitchFrom.fromKeyValuePair(pair) ?? FillParameters.fromKeyValuePair(pair) ?? RangeFilter.fromKeyValuePair(pair) ?? IncludeProperties.fromKeyValuePair(pair) ?? SwitchingSetAssignment.fromKeyValuePair(pair);
4255
4750
  }
4256
4751
  _MessageParameter.fromKeyValuePair = fromKeyValuePair;
4257
4752
  function toKeyValuePair(param) {
@@ -4306,14 +4801,42 @@ let MessageParameter;
4306
4801
  return params.find(isGroupOrderParam)?.order ?? 0;
4307
4802
  }
4308
4803
  _MessageParameter.groupOrderOf = groupOrderOf;
4309
- function isSubscriptionFilter(param) {
4310
- return param instanceof SubscriptionFilter;
4804
+ function isLocationFilter(param) {
4805
+ return param instanceof LocationFilter;
4311
4806
  }
4312
- _MessageParameter.isSubscriptionFilter = isSubscriptionFilter;
4807
+ _MessageParameter.isLocationFilter = isLocationFilter;
4313
4808
  function isNewGroupRequest(param) {
4314
4809
  return param instanceof NewGroupRequest;
4315
4810
  }
4316
4811
  _MessageParameter.isNewGroupRequest = isNewGroupRequest;
4812
+ function isSwitchFrom(param) {
4813
+ return param instanceof SwitchFrom;
4814
+ }
4815
+ _MessageParameter.isSwitchFrom = isSwitchFrom;
4816
+ function isFillParameters(param) {
4817
+ return param instanceof FillParameters;
4818
+ }
4819
+ _MessageParameter.isFillParameters = isFillParameters;
4820
+ function isRangeFilter(param) {
4821
+ return param instanceof RangeFilter;
4822
+ }
4823
+ _MessageParameter.isRangeFilter = isRangeFilter;
4824
+ function carriesRangeFilter(params) {
4825
+ return params.some((p) => isRangeFilter(p) || isFillParameters(p) && carriesRangeFilter(p.parameters));
4826
+ }
4827
+ _MessageParameter.carriesRangeFilter = carriesRangeFilter;
4828
+ function isIncludeProperties(param) {
4829
+ return param instanceof IncludeProperties;
4830
+ }
4831
+ _MessageParameter.isIncludeProperties = isIncludeProperties;
4832
+ function publishParametersFor(subscribeTracks) {
4833
+ return subscribeTracks.filter((p) => isForward(p) || isGroupOrderParam(p) || isLocationFilter(p));
4834
+ }
4835
+ _MessageParameter.publishParametersFor = publishParametersFor;
4836
+ function includesProperties(params) {
4837
+ return !params.some((p) => isIncludeProperties(p) && !p.include);
4838
+ }
4839
+ _MessageParameter.includesProperties = includesProperties;
4317
4840
  })(MessageParameter || (MessageParameter = {}));
4318
4841
  /**
4319
4842
  * Builder for constructing a list of MessageParameters.
@@ -4346,18 +4869,30 @@ var MessageParameters = class {
4346
4869
  addForward(forward) {
4347
4870
  return this.add(new Forward(forward));
4348
4871
  }
4872
+ addIncludeProperties(include) {
4873
+ return this.add(new IncludeProperties(include));
4874
+ }
4349
4875
  addSubscriberPriority(priority) {
4350
4876
  return this.add(new SubscriberPriority(priority));
4351
4877
  }
4352
4878
  addGroupOrder(order) {
4353
4879
  return this.add(new GroupOrderParam(order));
4354
4880
  }
4355
- addSubscriptionFilter(filter) {
4881
+ addLocationFilter(filter) {
4356
4882
  return this.add(filter);
4357
4883
  }
4358
4884
  addNewGroupRequest(group) {
4359
4885
  return this.add(new NewGroupRequest(BigInt(group)));
4360
4886
  }
4887
+ addSwitchFrom(requestId, mode, publishDone) {
4888
+ return this.add(new SwitchFrom(BigInt(requestId), mode, publishDone));
4889
+ }
4890
+ addFillParameters(parameters) {
4891
+ return this.add(new FillParameters(parameters));
4892
+ }
4893
+ addRangeFilter(filter) {
4894
+ return this.add(filter);
4895
+ }
4361
4896
  build() {
4362
4897
  return [...this.params];
4363
4898
  }
@@ -4375,24 +4910,23 @@ var MessageParameters = class {
4375
4910
  return result;
4376
4911
  }
4377
4912
  };
4378
- /**
4379
- * LARGEST_OBJECT (0x09) is a bare Location -- two consecutive varints with no
4380
- * length prefix. Its Type is odd, so the generic KVP parity rule would read a
4381
- * length prefix and desync. This is a message-parameter encoding: the same Type
4382
- * number in the setup-option namespace means something else, so the rule lives
4383
- * here rather than in the shared codec.
4384
- */
4385
- function isLocationMessageParam(typeValue) {
4386
- return typeValue === 9n;
4387
- }
4388
- /**
4389
- * FORWARD (0x10), SUBSCRIBER_PRIORITY (0x20) and GROUP_ORDER (0x22) carry a
4390
- * single uint8, not the generic even-Type varint. These Types are even, so
4391
- * without this the parity rule would read a varint and desync on any value
4392
- * >= 64 (e.g. the default SUBSCRIBER_PRIORITY of 128 = 0x80).
4393
- */
4394
- function isUint8MessageParam(typeValue) {
4395
- return typeValue === 16n || typeValue === 32n || typeValue === 34n;
4913
+ function valueShapeOf(typeValue) {
4914
+ switch (typeValue) {
4915
+ case BigInt(16):
4916
+ case BigInt(32):
4917
+ case BigInt(34):
4918
+ case BigInt(53): return 1;
4919
+ case BigInt(9): return 2;
4920
+ case BigInt(33): return 3;
4921
+ case BigInt(36):
4922
+ case BigInt(52):
4923
+ case BigInt(37):
4924
+ case BigInt(38):
4925
+ case BigInt(39):
4926
+ case BigInt(40):
4927
+ case BigInt(41): return 4;
4928
+ default: return typeValue % 2n === 0n ? 0 : 4;
4929
+ }
4396
4930
  }
4397
4931
  /**
4398
4932
  * Serializes a list of message-parameter KVPs, delta-encoding the Types.
@@ -4404,12 +4938,22 @@ function serializeMessageParameterKvps(items) {
4404
4938
  let prevType = 0n;
4405
4939
  for (const kvp of sorted) {
4406
4940
  buf.putVI(kvp.typeValue - prevType);
4407
- if (isVarInt(kvp) && isUint8MessageParam(kvp.typeValue)) {
4408
- if (kvp.value < 0n || kvp.value > 255n) throw new ProtocolViolationError("serializeMessageParameterKvps", `uint8 parameter 0x${kvp.typeValue.toString(16)} value ${kvp.value} exceeds 255`);
4409
- buf.putU8(Number(kvp.value));
4410
- } else if (isVarInt(kvp)) buf.putVI(kvp.value);
4411
- else if (isBytes(kvp) && isLocationMessageParam(kvp.typeValue)) buf.putBytes(kvp.value);
4412
- else if (isBytes(kvp)) buf.putLengthPrefixedBytes(kvp.value);
4941
+ switch (valueShapeOf(kvp.typeValue)) {
4942
+ case 1:
4943
+ if (!isVarInt(kvp) || kvp.value < 0n || kvp.value > 255n) throw new ProtocolViolationError("serializeMessageParameterKvps", `uint8 parameter 0x${kvp.typeValue.toString(16)} value ${kvp.value} exceeds 255`);
4944
+ buf.putU8(Number(kvp.value));
4945
+ break;
4946
+ case 2:
4947
+ case 3:
4948
+ if (isBytes(kvp)) buf.putBytes(kvp.value);
4949
+ break;
4950
+ case 4:
4951
+ if (isBytes(kvp)) buf.putLengthPrefixedBytes(kvp.value);
4952
+ break;
4953
+ case 0:
4954
+ if (isVarInt(kvp)) buf.putVI(kvp.value);
4955
+ break;
4956
+ }
4413
4957
  prevType = kvp.typeValue;
4414
4958
  }
4415
4959
  return buf.freeze();
@@ -4420,33 +4964,53 @@ function serializeMessageParameterKvps(items) {
4420
4964
  */
4421
4965
  function deserializeMessageParameterKvps(buf, count) {
4422
4966
  const n = typeof count === "bigint" ? Number(count) : count;
4423
- const items = new Array(n);
4967
+ let read = 0;
4968
+ return readMessageParameterKvps(buf, () => read++ < n);
4969
+ }
4970
+ function readMessageParameterKvps(buf, more) {
4971
+ const items = [];
4424
4972
  let prevType = 0n;
4425
- for (let i = 0; i < n; i++) {
4973
+ while (more()) {
4426
4974
  const typeValue = prevType + buf.getVI();
4427
- if (isUint8MessageParam(typeValue)) items[i] = KeyValuePair.tryNewVarInt(typeValue, BigInt(buf.getU8()));
4428
- else if (isLocationMessageParam(typeValue)) {
4429
- const loc = new ByteBuffer();
4430
- loc.putVI(buf.getVI());
4431
- loc.putVI(buf.getVI());
4432
- items[i] = KeyValuePair.tryNewBytes(typeValue, loc.toUint8Array());
4433
- } else items[i] = KeyValuePair.deserializeValue(buf, typeValue);
4975
+ switch (valueShapeOf(typeValue)) {
4976
+ case 1:
4977
+ items.push(KeyValuePair.newVarInt(typeValue, BigInt(buf.getU8())));
4978
+ break;
4979
+ case 2: {
4980
+ const loc = new ByteBuffer();
4981
+ loc.putVI(buf.getVI());
4982
+ loc.putVI(buf.getVI());
4983
+ items.push(KeyValuePair.newBytes(typeValue, loc.toUint8Array()));
4984
+ break;
4985
+ }
4986
+ case 3:
4987
+ items.push(KeyValuePair.newBytes(typeValue, LocationFilter.deserializeValue(buf).serializeValue()));
4988
+ break;
4989
+ case 4:
4990
+ items.push(KeyValuePair.deserializeBytesValue(buf, typeValue));
4991
+ break;
4992
+ case 0:
4993
+ items.push(KeyValuePair.tryNewVarInt(typeValue, buf.getVI()));
4994
+ break;
4995
+ }
4434
4996
  prevType = typeValue;
4435
4997
  }
4436
4998
  return items;
4437
4999
  }
4438
5000
  /**
4439
5001
  * Applies a set of parameter updates to an existing parameter list.
4440
- * For each update, replaces the matching parameter (by wire type value) or appends it.
4441
- * Per spec: "If omitted from REQUEST_UPDATE/SUBSCRIBE_UPDATE, the value is unchanged."
5002
+ *
5003
+ * A Type the update leaves out keeps its value. A Type it carries is replaced
5004
+ * outright, every instance of it: a Range Filter can repeat, and an update that
5005
+ * names a filter kind states the whole of that kind, so one left over from before
5006
+ * would quietly widen or narrow what the subscriber asked for. A zero-length Range
5007
+ * Filter replaces its kind with nothing.
4442
5008
  */
4443
5009
  function applyMessageParameterUpdate(current, updates) {
4444
- for (const update of updates) {
4445
- const updateType = update.toKeyValuePair().typeValue;
4446
- const idx = current.findIndex((p) => p.toKeyValuePair().typeValue === updateType);
4447
- if (idx >= 0) current[idx] = update;
4448
- else current.push(update);
4449
- }
5010
+ const typeOf = (p) => p.toKeyValuePair().typeValue;
5011
+ const updated = new Set(updates.map(typeOf));
5012
+ const kept = current.filter((p) => !updated.has(typeOf(p)));
5013
+ current.splice(0, current.length, ...kept, ...updates.filter((u) => !(u instanceof RangeFilter && u.isRemoval)));
4450
5014
  }
4451
5015
  //#endregion
4452
5016
  //#region src/model/control/publish_namespace.ts
@@ -4643,11 +5207,10 @@ var NamespaceDone = class NamespaceDone {
4643
5207
  * limitations under the License.
4644
5208
  */
4645
5209
  /**
4646
- * The first message each endpoint sends on its control stream (draft-18 §10.3).
5210
+ * The first message each endpoint sends on its control stream.
4647
5211
  *
4648
5212
  * Both peers send the same message; there are no separate client and server forms and
4649
- * no version fields, since version negotiation happens over ALPN (§3.1). Replaces
4650
- * CLIENT_SETUP / SERVER_SETUP.
5213
+ * no version fields, since version negotiation happens over ALPN.
4651
5214
  *
4652
5215
  * Some options are client-only (see {@link SetupOptionType}); whether a peer is
4653
5216
  * allowed to send a given option depends on which side it is and on the transport,
@@ -4695,13 +5258,20 @@ var Setup = class Setup {
4695
5258
  */
4696
5259
  var Fetch = class Fetch {
4697
5260
  requestId;
4698
- typeAndProps;
5261
+ fullTrackName;
4699
5262
  parameters;
4700
- constructor(requestId, typeAndProps, parameters) {
5263
+ constructor(requestId, fullTrackName, parameters) {
4701
5264
  this.requestId = requestId;
4702
- this.typeAndProps = typeAndProps;
5265
+ this.fullTrackName = fullTrackName;
4703
5266
  this.parameters = parameters;
4704
5267
  }
5268
+ /**
5269
+ * The requested range. A FETCH without a LOCATION_FILTER parameter asks for the
5270
+ * whole track up to the Largest Object, the same as a {@link (LocationFilterType:enum).None} filter.
5271
+ */
5272
+ get locationFilter() {
5273
+ return this.parameters.find(MessageParameter.isLocationFilter) ?? new LocationFilter(0);
5274
+ }
4705
5275
  getType() {
4706
5276
  return 22;
4707
5277
  }
@@ -4710,19 +5280,7 @@ var Fetch = class Fetch {
4710
5280
  buf.putVI(22);
4711
5281
  const payload = new ByteBuffer();
4712
5282
  payload.putVI(this.requestId);
4713
- payload.putVI(this.typeAndProps.type);
4714
- switch (this.typeAndProps.type) {
4715
- case 3:
4716
- case 2:
4717
- payload.putVI(this.typeAndProps.props.joiningRequestId);
4718
- payload.putVI(this.typeAndProps.props.joiningStart);
4719
- break;
4720
- case 1:
4721
- payload.putFullTrackName(this.typeAndProps.props.fullTrackName);
4722
- payload.putLocation(this.typeAndProps.props.startLocation);
4723
- payload.putLocation(this.typeAndProps.props.endLocation);
4724
- break;
4725
- }
5283
+ payload.putFullTrackName(this.fullTrackName);
4726
5284
  payload.putVI(this.parameters.length);
4727
5285
  payload.putBytes(serializeMessageParameterKvps(this.parameters.map((p) => p.toKeyValuePair())).toUint8Array());
4728
5286
  const payloadBytes = payload.toUint8Array();
@@ -4733,35 +5291,10 @@ var Fetch = class Fetch {
4733
5291
  }
4734
5292
  static parsePayload(buf) {
4735
5293
  const requestId = buf.getVI();
4736
- const fetchTypeRaw = buf.getVI();
4737
- const fetchType = FetchType.tryFrom(fetchTypeRaw);
4738
- let props;
4739
- switch (fetchType) {
4740
- case 3:
4741
- case 2:
4742
- props = {
4743
- type: fetchType,
4744
- props: {
4745
- joiningRequestId: buf.getVI(),
4746
- joiningStart: buf.getVI()
4747
- }
4748
- };
4749
- break;
4750
- case 1:
4751
- props = {
4752
- type: 1,
4753
- props: {
4754
- fullTrackName: buf.getFullTrackName(),
4755
- startLocation: buf.getLocation(),
4756
- endLocation: buf.getLocation()
4757
- }
4758
- };
4759
- break;
4760
- default: throw new Error(`Unknown fetch type: ${fetchType}`);
4761
- }
5294
+ const fullTrackName = buf.getFullTrackName();
4762
5295
  const rawParams = deserializeMessageParameterKvps(buf, buf.getNumberVI());
4763
5296
  const parameters = MessageParameters.fromKeyValuePairs(rawParams);
4764
- return new Fetch(requestId, props, parameters);
5297
+ return new Fetch(requestId, fullTrackName, parameters);
4765
5298
  }
4766
5299
  };
4767
5300
  //#endregion
@@ -4850,7 +5383,7 @@ var FetchOk = class FetchOk {
4850
5383
  const MAX_NEW_SESSION_URI_LENGTH = 8192;
4851
5384
  /**
4852
5385
  * GOAWAY (0x10) winds down a session, or — on a request stream — migrates that one
4853
- * request (§10.4).
5386
+ * request.
4854
5387
  */
4855
5388
  var GoAway = class GoAway {
4856
5389
  newSessionUri;
@@ -4860,16 +5393,10 @@ var GoAway = class GoAway {
4860
5393
  * on a request stream it resets the stream with `GOING_AWAY`.
4861
5394
  */
4862
5395
  timeout;
4863
- /**
4864
- * The smallest peer Request ID that was not or might not have been processed. Present
4865
- * only on the control stream, so a GOAWAY migrating a single request omits it.
4866
- */
4867
- requestId;
4868
- constructor(newSessionUri, timeout = 0n, requestId) {
5396
+ constructor(newSessionUri, timeout = 0n) {
4869
5397
  if (newSessionUri && newSessionUri.length === 0) this.newSessionUri = void 0;
4870
5398
  else this.newSessionUri = newSessionUri;
4871
5399
  this.timeout = timeout;
4872
- this.requestId = requestId;
4873
5400
  }
4874
5401
  getType() {
4875
5402
  return 16;
@@ -4888,7 +5415,6 @@ var GoAway = class GoAway {
4888
5415
  payload.putLengthPrefixedBytes(uriBytes);
4889
5416
  } else payload.putVI(0);
4890
5417
  payload.putVI(this.timeout);
4891
- if (this.requestId !== void 0) payload.putVI(this.requestId);
4892
5418
  const payloadBytes = payload.toUint8Array();
4893
5419
  if (payloadBytes.length > 65535) throw new LengthExceedsMaxError("GoAway::serialize(payloadBytes.length)", 65535, payloadBytes.length);
4894
5420
  buf.putU16(payloadBytes.length);
@@ -4909,8 +5435,7 @@ var GoAway = class GoAway {
4909
5435
  }
4910
5436
  }
4911
5437
  const timeout = buf.getVI();
4912
- const requestId = buf.remaining > 0 ? buf.getVI() : void 0;
4913
- return new GoAway(newSessionUri, timeout, requestId);
5438
+ return new GoAway(newSessionUri, timeout);
4914
5439
  }
4915
5440
  };
4916
5441
  //#endregion
@@ -4939,19 +5464,6 @@ var Subscribe = class Subscribe {
4939
5464
  this.fullTrackName = fullTrackName;
4940
5465
  this.parameters = parameters;
4941
5466
  }
4942
- static newNextGroupStart(requestId, fullTrackName, parameters) {
4943
- return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(1)]);
4944
- }
4945
- static newLatestObject(requestId, fullTrackName, parameters) {
4946
- return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(2)]);
4947
- }
4948
- static newAbsoluteStart(requestId, fullTrackName, startLocation, parameters) {
4949
- return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(3, startLocation)]);
4950
- }
4951
- static newAbsoluteRange(requestId, fullTrackName, startLocation, endGroup, parameters) {
4952
- if (endGroup < startLocation.group) throw new Error("End Group must be >= Start Group");
4953
- return new Subscribe(requestId, fullTrackName, [...parameters, new SubscriptionFilter(4, startLocation, endGroup)]);
4954
- }
4955
5467
  getType() {
4956
5468
  return 3;
4957
5469
  }
@@ -5001,6 +5513,11 @@ var PublishDone = class PublishDone {
5001
5513
  statusCode;
5002
5514
  streamCount;
5003
5515
  errorReason;
5516
+ /**
5517
+ * The Stream Count a publisher sends when it cannot name the exact number of streams
5518
+ * it opened. Receivers fall back on a timeout to end the subscription.
5519
+ */
5520
+ static UNKNOWN_STREAM_COUNT = 2n ** 64n - 1n;
5004
5521
  constructor(statusCode, streamCount, errorReason) {
5005
5522
  this.statusCode = statusCode;
5006
5523
  this.streamCount = streamCount;
@@ -5239,35 +5756,18 @@ var TrackStatus = class TrackStatus {
5239
5756
  subscriberPriority;
5240
5757
  groupOrder;
5241
5758
  forward;
5242
- filterType;
5243
- startLocation;
5244
- endGroup;
5759
+ locationFilter;
5245
5760
  subscribeParameters;
5246
- constructor(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, filterType, startLocation, endGroup, subscribeParameters) {
5761
+ constructor(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, locationFilter, subscribeParameters) {
5247
5762
  this.requestId = requestId;
5248
5763
  this.trackAlias = trackAlias;
5249
5764
  this.fullTrackName = fullTrackName;
5250
5765
  this.subscriberPriority = subscriberPriority;
5251
5766
  this.groupOrder = groupOrder;
5252
5767
  this.forward = forward;
5253
- this.filterType = filterType;
5254
- this.startLocation = startLocation;
5255
- this.endGroup = endGroup;
5768
+ this.locationFilter = locationFilter;
5256
5769
  this.subscribeParameters = subscribeParameters;
5257
5770
  }
5258
- static newNextGroupStart(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, subscribeParameters) {
5259
- return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 1, void 0, void 0, subscribeParameters);
5260
- }
5261
- static newLatestObject(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, subscribeParameters) {
5262
- return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 2, void 0, void 0, subscribeParameters);
5263
- }
5264
- static newAbsoluteStart(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, startLocation, subscribeParameters) {
5265
- return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 3, startLocation, void 0, subscribeParameters);
5266
- }
5267
- static newAbsoluteRange(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, startLocation, endGroup, subscribeParameters) {
5268
- if (endGroup < startLocation.group) throw new Error("End Group must be >= Start Group");
5269
- return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, 4, startLocation, endGroup, subscribeParameters);
5270
- }
5271
5771
  getType() {
5272
5772
  return 13;
5273
5773
  }
@@ -5281,15 +5781,7 @@ var TrackStatus = class TrackStatus {
5281
5781
  payload.putU8(this.subscriberPriority);
5282
5782
  payload.putU8(this.groupOrder);
5283
5783
  payload.putU8(this.forward ? 1 : 0);
5284
- payload.putVI(this.filterType);
5285
- if (this.filterType === 3 || this.filterType === 4) {
5286
- if (!this.startLocation) throw new Error("StartLocation required for selected filterType");
5287
- payload.putLocation(this.startLocation);
5288
- }
5289
- if (this.filterType === 4) {
5290
- if (this.endGroup == null) throw new Error("EndGroup required for AbsoluteRange");
5291
- payload.putVI(this.endGroup);
5292
- }
5784
+ payload.putBytes(this.locationFilter.serializeValue());
5293
5785
  payload.putVI(this.subscribeParameters.length);
5294
5786
  payload.putBytes(serializeMessageParameterKvps(this.subscribeParameters.map((p) => p.toKeyValuePair())).toUint8Array());
5295
5787
  const payloadBytes = payload.toUint8Array();
@@ -5304,14 +5796,10 @@ var TrackStatus = class TrackStatus {
5304
5796
  const subscriberPriority = buf.getU8();
5305
5797
  const groupOrder = buf.getU8();
5306
5798
  const forward = buf.getU8() === 1;
5307
- const filterType = Number(buf.getVI());
5308
- let startLocation = void 0;
5309
- let endGroup = void 0;
5310
- if (filterType === 3 || filterType === 4) startLocation = buf.getLocation();
5311
- if (filterType === 4) endGroup = buf.getVI();
5799
+ const locationFilter = LocationFilter.deserializeValue(buf);
5312
5800
  const rawParams = deserializeMessageParameterKvps(buf, Number(buf.getVI()));
5313
5801
  const subscribeParameters = MessageParameters.fromKeyValuePairs(rawParams);
5314
- return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, filterType, startLocation, endGroup, subscribeParameters);
5802
+ return new TrackStatus(requestId, trackAlias, fullTrackName, subscriberPriority, groupOrder, forward, locationFilter, subscribeParameters);
5315
5803
  }
5316
5804
  };
5317
5805
  //#endregion
@@ -5447,13 +5935,12 @@ var SubscribeTracks = class SubscribeTracks {
5447
5935
  * names (PUBLISH_OK, TRACK_STATUS_OK, ...) are shorthands for logging, not distinct
5448
5936
  * messages. SUBSCRIBE_OK (0x4) and FETCH_OK (0x18) do keep bodies of their own.
5449
5937
  *
5450
- * It carries no Request ID: the request stream it arrives on identifies the request
5451
- * (§10.1).
5938
+ * It carries no Request ID: the request stream it arrives on identifies the request.
5452
5939
  */
5453
5940
  var RequestOk = class RequestOk {
5454
5941
  parameters;
5455
5942
  /**
5456
- * Draft-18 Track Properties, which the trailing bytes of the payload carry with no
5943
+ * Track Properties, which the trailing bytes of the payload carry with no
5457
5944
  * count of their own. Populated only in TRACK_STATUS_OK; empty for every other request
5458
5945
  * type — see {@link RequestOk.validateTrackProperties}.
5459
5946
  */
@@ -5615,7 +6102,7 @@ let ControlMessage;
5615
6102
  case 80: return SubscribeNamespace.parsePayload(payload);
5616
6103
  case 81: return SubscribeTracks.parsePayload(payload);
5617
6104
  case 12032: return Setup.parsePayload(payload);
5618
- case 15: return PublishBlocked.parsePayload(payload);
6105
+ case 15: return PublishSkipped.parsePayload(payload);
5619
6106
  default: throw new Error(`Unknown or unhandled ControlMessageType: ${messageType}`);
5620
6107
  }
5621
6108
  }
@@ -5794,59 +6281,6 @@ var CMSFCatalog = class CMSFCatalog {
5794
6281
  }
5795
6282
  };
5796
6283
  //#endregion
5797
- //#region src/model/control/switch.ts
5798
- /**
5799
- * Copyright 2025 The MOQtail Authors
5800
- *
5801
- * Licensed under the Apache License, Version 2.0 (the "License");
5802
- * you may not use this file except in compliance with the License.
5803
- * You may obtain a copy of the License at
5804
- *
5805
- * http://www.apache.org/licenses/LICENSE-2.0
5806
- *
5807
- * Unless required by applicable law or agreed to in writing, software
5808
- * distributed under the License is distributed on an "AS IS" BASIS,
5809
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5810
- * See the License for the specific language governing permissions and
5811
- * limitations under the License.
5812
- */
5813
- var Switch = class Switch {
5814
- requestId;
5815
- fullTrackName;
5816
- subscriptionRequestId;
5817
- parameters;
5818
- constructor(requestId, fullTrackName, subscriptionRequestId, parameters) {
5819
- this.requestId = requestId;
5820
- this.fullTrackName = fullTrackName;
5821
- this.subscriptionRequestId = subscriptionRequestId;
5822
- this.parameters = parameters;
5823
- }
5824
- getType() {
5825
- return 34;
5826
- }
5827
- serialize() {
5828
- const buf = new ByteBuffer();
5829
- buf.putVI(34);
5830
- const payload = new ByteBuffer();
5831
- payload.putVI(this.requestId);
5832
- payload.putBytes(this.fullTrackName.serialize().toUint8Array());
5833
- payload.putVI(this.subscriptionRequestId);
5834
- payload.putVI(this.parameters.length);
5835
- payload.putBytes(serializeMessageParameterKvps(this.parameters).toUint8Array());
5836
- const payloadBytes = payload.toUint8Array();
5837
- buf.putU16(payloadBytes.length);
5838
- buf.putBytes(payloadBytes);
5839
- return buf.freeze();
5840
- }
5841
- static parsePayload(buf) {
5842
- const requestId = buf.getVI();
5843
- const fullTrackName = buf.getFullTrackName();
5844
- const subscriptionRequestId = buf.getVI();
5845
- const parameters = deserializeMessageParameterKvps(buf, Number(buf.getVI()));
5846
- return new Switch(requestId, fullTrackName, subscriptionRequestId, parameters);
5847
- }
5848
- };
5849
- //#endregion
5850
6284
  //#region src/model/parameter/setup/path.ts
5851
6285
  /**
5852
6286
  * Copyright 2025 The MOQtail Authors
@@ -5929,7 +6363,7 @@ var MaxAuthTokenCacheSize = class MaxAuthTokenCacheSize {
5929
6363
  */
5930
6364
  /**
5931
6365
  * Raw-QUIC only: the authority component of the `moqt://` URI, carried in SETUP because
5932
- * there is no HTTP CONNECT to carry it (draft-18 §10.3.1.1).
6366
+ * there is no HTTP CONNECT to carry it.
5933
6367
  *
5934
6368
  * Client-only; MUST NOT be sent by a server or over WebTransport. moqtail-ts always
5935
6369
  * connects over WebTransport, so its own handshake never sends this — see
@@ -5952,6 +6386,42 @@ var Authority = class Authority {
5952
6386
  }
5953
6387
  };
5954
6388
  //#endregion
6389
+ //#region src/model/parameter/setup/max_filter_ranges.ts
6390
+ /**
6391
+ * Copyright 2026 The MOQtail Authors
6392
+ *
6393
+ * Licensed under the Apache License, Version 2.0 (the "License");
6394
+ * you may not use this file except in compliance with the License.
6395
+ * You may obtain a copy of the License at
6396
+ *
6397
+ * http://www.apache.org/licenses/LICENSE-2.0
6398
+ *
6399
+ * Unless required by applicable law or agreed to in writing, software
6400
+ * distributed under the License is distributed on an "AS IS" BASIS,
6401
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6402
+ * See the License for the specific language governing permissions and
6403
+ * limitations under the License.
6404
+ */
6405
+ /**
6406
+ * Limits the total number of Ranges the peer may have across all Range filter parameters
6407
+ * of a single subscription or fetch. Zero, the default when absent, means the peer may
6408
+ * not send Range filters at all.
6409
+ */
6410
+ var MaxFilterRanges = class MaxFilterRanges {
6411
+ value;
6412
+ static TYPE = 6;
6413
+ constructor(value) {
6414
+ this.value = value;
6415
+ }
6416
+ toKeyValuePair() {
6417
+ return KeyValuePair.tryNewVarInt(MaxFilterRanges.TYPE, this.value);
6418
+ }
6419
+ static fromKeyValuePair(pair) {
6420
+ if (Number(pair.typeValue) !== MaxFilterRanges.TYPE || typeof pair.value !== "bigint") return void 0;
6421
+ return new MaxFilterRanges(pair.value);
6422
+ }
6423
+ };
6424
+ //#endregion
5955
6425
  //#region src/model/parameter/setup/moqt_implementation.ts
5956
6426
  /**
5957
6427
  * Copyright 2026 The MOQtail Authors
@@ -5969,8 +6439,8 @@ var Authority = class Authority {
5969
6439
  * limitations under the License.
5970
6440
  */
5971
6441
  /**
5972
- * Free-form implementation identification string, e.g. for logging and debugging
5973
- * (draft-18 §10.3.1.5). Either peer may send it.
6442
+ * Free-form implementation identification string, e.g. for logging and debugging.
6443
+ * Either peer may send it.
5974
6444
  */
5975
6445
  var MoqtImplementation = class MoqtImplementation {
5976
6446
  info;
@@ -5989,6 +6459,42 @@ var MoqtImplementation = class MoqtImplementation {
5989
6459
  }
5990
6460
  };
5991
6461
  //#endregion
6462
+ //#region src/model/parameter/setup/max_request_updates.ts
6463
+ /**
6464
+ * Copyright 2026 The MOQtail Authors
6465
+ *
6466
+ * Licensed under the Apache License, Version 2.0 (the "License");
6467
+ * you may not use this file except in compliance with the License.
6468
+ * You may obtain a copy of the License at
6469
+ *
6470
+ * http://www.apache.org/licenses/LICENSE-2.0
6471
+ *
6472
+ * Unless required by applicable law or agreed to in writing, software
6473
+ * distributed under the License is distributed on an "AS IS" BASIS,
6474
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6475
+ * See the License for the specific language governing permissions and
6476
+ * limitations under the License.
6477
+ */
6478
+ /**
6479
+ * Maximum number of outstanding REQUEST_UPDATEs per request stream: an update counts
6480
+ * until its REQUEST_OK or REQUEST_ERROR arrives. Zero, the default when absent, means
6481
+ * no limit. Receiving one past the limit closes the session with TOO_MANY_REQUEST_UPDATES.
6482
+ */
6483
+ var MaxRequestUpdates = class MaxRequestUpdates {
6484
+ value;
6485
+ static TYPE = 8;
6486
+ constructor(value) {
6487
+ this.value = value;
6488
+ }
6489
+ toKeyValuePair() {
6490
+ return KeyValuePair.tryNewVarInt(MaxRequestUpdates.TYPE, this.value);
6491
+ }
6492
+ static fromKeyValuePair(pair) {
6493
+ if (Number(pair.typeValue) !== MaxRequestUpdates.TYPE || typeof pair.value !== "bigint") return void 0;
6494
+ return new MaxRequestUpdates(pair.value);
6495
+ }
6496
+ };
6497
+ //#endregion
5992
6498
  //#region src/model/parameter/setup/ssts_algorithms.ts
5993
6499
  /**
5994
6500
  * Copyright 2026 The MOQtail Authors
@@ -6010,7 +6516,7 @@ var MoqtImplementation = class MoqtImplementation {
6010
6516
  *
6011
6517
  * PROVISIONAL: sender-side track switching is not an adopted extension, so
6012
6518
  * this option has no codepoint in the registry the conformance fixture tracks
6013
- * (`dev/conformance/draft18`) and is never asserted against it. An empty list
6519
+ * (`dev/conformance/draft22`) and is never asserted against it. An empty list
6014
6520
  * — or the absence of the option — prohibits the use of SSTS.
6015
6521
  */
6016
6522
  var SstsAlgorithms = class SstsAlgorithms {
@@ -6038,7 +6544,7 @@ var SstsAlgorithms = class SstsAlgorithms {
6038
6544
  let SetupOption;
6039
6545
  (function(_SetupOption) {
6040
6546
  function fromKeyValuePair(pair) {
6041
- return Path.fromKeyValuePair(pair) || MaxAuthTokenCacheSize.fromKeyValuePair(pair) || AuthorizationToken.fromKeyValuePair(pair) || Authority.fromKeyValuePair(pair) || MoqtImplementation.fromKeyValuePair(pair) || SstsAlgorithms.fromKeyValuePair(pair);
6547
+ return Path.fromKeyValuePair(pair) || MaxAuthTokenCacheSize.fromKeyValuePair(pair) || AuthorizationToken.fromKeyValuePair(pair) || Authority.fromKeyValuePair(pair) || MaxFilterRanges.fromKeyValuePair(pair) || MoqtImplementation.fromKeyValuePair(pair) || MaxRequestUpdates.fromKeyValuePair(pair) || SstsAlgorithms.fromKeyValuePair(pair);
6042
6548
  }
6043
6549
  _SetupOption.fromKeyValuePair = fromKeyValuePair;
6044
6550
  function toKeyValuePair(param) {
@@ -6061,6 +6567,14 @@ let SetupOption;
6061
6567
  return param instanceof Authority;
6062
6568
  }
6063
6569
  _SetupOption.isAuthority = isAuthority;
6570
+ function isMaxFilterRanges(param) {
6571
+ return param instanceof MaxFilterRanges;
6572
+ }
6573
+ _SetupOption.isMaxFilterRanges = isMaxFilterRanges;
6574
+ function isMaxRequestUpdates(param) {
6575
+ return param instanceof MaxRequestUpdates;
6576
+ }
6577
+ _SetupOption.isMaxRequestUpdates = isMaxRequestUpdates;
6064
6578
  function isMoqtImplementation(param) {
6065
6579
  return param instanceof MoqtImplementation;
6066
6580
  }
@@ -6072,7 +6586,7 @@ let SetupOption;
6072
6586
  })(SetupOption || (SetupOption = {}));
6073
6587
  /** Throws if `params` carries AUTHORITY, which MUST NOT be sent over WebTransport. */
6074
6588
  function assertNoAuthorityOverWebTransport(params) {
6075
- if (params.some((p) => Number(p.typeValue) === 5)) throw new ProtocolViolationError("assertNoAuthorityOverWebTransport", "AUTHORITY setup option MUST NOT be sent over WebTransport (draft-18 §10.3.1.1)");
6589
+ if (params.some((p) => Number(p.typeValue) === 5)) throw new ProtocolViolationError("assertNoAuthorityOverWebTransport", "AUTHORITY setup option MUST NOT be sent over WebTransport");
6076
6590
  }
6077
6591
  var SetupOptions = class {
6078
6592
  kvps = [];
@@ -6088,6 +6602,14 @@ var SetupOptions = class {
6088
6602
  this.kvps.push(auth.toKeyValuePair());
6089
6603
  return this;
6090
6604
  }
6605
+ addMaxFilterRanges(value) {
6606
+ this.kvps.push(new MaxFilterRanges(BigInt(value)).toKeyValuePair());
6607
+ return this;
6608
+ }
6609
+ addMaxRequestUpdates(value) {
6610
+ this.kvps.push(new MaxRequestUpdates(BigInt(value)).toKeyValuePair());
6611
+ return this;
6612
+ }
6091
6613
  addMoqtImplementation(info) {
6092
6614
  this.kvps.push(new MoqtImplementation(info).toKeyValuePair());
6093
6615
  return this;
@@ -6106,13 +6628,132 @@ var SetupOptions = class {
6106
6628
  static fromKeyValuePairs(kvps) {
6107
6629
  const result = [];
6108
6630
  for (const kvp of kvps) {
6109
- const parsed = Path.fromKeyValuePair(kvp) || MaxAuthTokenCacheSize.fromKeyValuePair(kvp) || AuthorizationToken.fromKeyValuePair(kvp) || Authority.fromKeyValuePair(kvp) || MoqtImplementation.fromKeyValuePair(kvp) || SstsAlgorithms.fromKeyValuePair(kvp);
6631
+ const parsed = Path.fromKeyValuePair(kvp) || MaxAuthTokenCacheSize.fromKeyValuePair(kvp) || AuthorizationToken.fromKeyValuePair(kvp) || Authority.fromKeyValuePair(kvp) || MaxFilterRanges.fromKeyValuePair(kvp) || MoqtImplementation.fromKeyValuePair(kvp) || MaxRequestUpdates.fromKeyValuePair(kvp) || SstsAlgorithms.fromKeyValuePair(kvp);
6110
6632
  if (parsed) result.push(parsed);
6111
6633
  }
6112
6634
  return result;
6113
6635
  }
6114
6636
  };
6115
6637
  //#endregion
6638
+ //#region src/model/parameter/message/combined_filter.ts
6639
+ /**
6640
+ * Copyright 2026 The MOQtail Authors
6641
+ *
6642
+ * Licensed under the Apache License, Version 2.0 (the "License");
6643
+ * you may not use this file except in compliance with the License.
6644
+ * You may obtain a copy of the License at
6645
+ *
6646
+ * http://www.apache.org/licenses/LICENSE-2.0
6647
+ *
6648
+ * Unless required by applicable law or agreed to in writing, software
6649
+ * distributed under the License is distributed on an "AS IS" BASIS,
6650
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6651
+ * See the License for the specific language governing permissions and
6652
+ * limitations under the License.
6653
+ */
6654
+ const within = (ranges, value) => ranges.some((r) => value >= r.start && (r.end === void 0 || value <= r.end));
6655
+ /**
6656
+ * The object filter a request's Range Filters add up to.
6657
+ *
6658
+ * Ranges within one filter are OR'd, filters sharing a SetID are AND'd, and the
6659
+ * SetIDs are OR'd with each other. No filter at all passes every Object.
6660
+ */
6661
+ var CombinedFilter = class {
6662
+ #sets = /* @__PURE__ */ new Map();
6663
+ /** How many Ranges the filters hold, which is what a range limit counts. */
6664
+ rangeCount;
6665
+ /**
6666
+ * Builds the filter from every Range Filter in `params`; anything else, and a
6667
+ * zero-length removal, is ignored.
6668
+ *
6669
+ * @throws :{@link InvalidFilterError} For a filter that cannot be applied: one
6670
+ * that repeats a Type, SetID and Property Type already given, one with an odd
6671
+ * Property Type, a priority above 255 or a bound past 2^64-1, or a track filter,
6672
+ * which selects tracks rather than Objects.
6673
+ */
6674
+ constructor(params) {
6675
+ let rangeCount = 0;
6676
+ const seen = /* @__PURE__ */ new Set();
6677
+ for (const param of params) {
6678
+ if (!(param instanceof RangeFilter) || param.isRemoval) continue;
6679
+ const filter = param;
6680
+ if (filter.kind === RangeFilterKind.TrackProperty) throw new InvalidFilterError("CombinedFilter", "a track property filter selects tracks, not Objects");
6681
+ const key = `${filter.kind}/${filter.setId}/${filter.propertyType ?? ""}`;
6682
+ if (seen.has(key)) throw new InvalidFilterError("CombinedFilter", `${RangeFilterKind[filter.kind]} filter repeats SetID ${filter.setId}` + (filter.propertyType !== void 0 ? ` for property 0x${filter.propertyType.toString(16)}` : ""));
6683
+ seen.add(key);
6684
+ const ranges = filter.validate();
6685
+ rangeCount += ranges.length;
6686
+ let set = this.#sets.get(filter.setId);
6687
+ if (!set) {
6688
+ set = { properties: /* @__PURE__ */ new Map() };
6689
+ this.#sets.set(filter.setId, set);
6690
+ }
6691
+ switch (filter.kind) {
6692
+ case RangeFilterKind.Subgroup:
6693
+ set.subgroup = ranges;
6694
+ break;
6695
+ case RangeFilterKind.ObjectId:
6696
+ set.objectId = ranges;
6697
+ break;
6698
+ case RangeFilterKind.Priority:
6699
+ set.priority = ranges;
6700
+ break;
6701
+ case RangeFilterKind.ObjectProperty:
6702
+ set.properties.set(filter.propertyType, ranges);
6703
+ break;
6704
+ }
6705
+ }
6706
+ this.rangeCount = rangeCount;
6707
+ }
6708
+ /** Whether the filter passes everything. */
6709
+ get isEmpty() {
6710
+ return this.#sets.size === 0;
6711
+ }
6712
+ /**
6713
+ * Whether `obj` passes.
6714
+ *
6715
+ * @param subgroupId - The Subgroup ID `obj` travels in. It is passed in because an
6716
+ * Object whose Subgroup ID is its subgroup's first Object ID does not know it
6717
+ * itself. `null` — a datagram — has no subgroup, so no subgroup filter passes it.
6718
+ */
6719
+ matches(obj, subgroupId = obj.subgroupId) {
6720
+ if (this.isEmpty) return true;
6721
+ for (const set of this.#sets.values()) {
6722
+ if (set.subgroup && (subgroupId === null || !within(set.subgroup, subgroupId))) continue;
6723
+ if (set.objectId && !within(set.objectId, obj.location.object)) continue;
6724
+ if (set.priority && !within(set.priority, BigInt(obj.publisherPriority))) continue;
6725
+ if (!propertiesPass(set.properties, obj.properties)) continue;
6726
+ return true;
6727
+ }
6728
+ return false;
6729
+ }
6730
+ };
6731
+ /**
6732
+ * Whether each required Property is present with a value in its Ranges. One the
6733
+ * Object does not carry fails. Properties inside ImmutableProperties count as the
6734
+ * Object's own.
6735
+ */
6736
+ function propertiesPass(required, properties) {
6737
+ if (required.size === 0) return true;
6738
+ const values = /* @__PURE__ */ new Map();
6739
+ const collect = (pairs) => {
6740
+ for (const pair of pairs) {
6741
+ if (isVarInt(pair)) {
6742
+ if (!values.has(pair.typeValue)) values.set(pair.typeValue, pair.value);
6743
+ continue;
6744
+ }
6745
+ const immutable = ImmutablePropertiesObjectProperty.fromKeyValuePair(pair);
6746
+ if (immutable) collect(immutable.properties);
6747
+ }
6748
+ };
6749
+ collect(properties ?? []);
6750
+ for (const [type, ranges] of required) {
6751
+ const value = values.get(type);
6752
+ if (value === void 0 || !within(ranges, value)) return false;
6753
+ }
6754
+ return true;
6755
+ }
6756
+ //#endregion
6116
6757
  exports.AudioLevel = AudioLevel;
6117
6758
  exports.Authority = Authority;
6118
6759
  exports.AuthorizationToken = AuthorizationToken;
@@ -6120,6 +6761,7 @@ exports.BaseByteBuffer = BaseByteBuffer;
6120
6761
  exports.ByteBuffer = ByteBuffer;
6121
6762
  exports.CMSFCatalog = CMSFCatalog;
6122
6763
  exports.CastingError = CastingError;
6764
+ exports.CombinedFilter = CombinedFilter;
6123
6765
  Object.defineProperty(exports, "ControlMessage", {
6124
6766
  enumerable: true,
6125
6767
  get: function() {
@@ -6149,19 +6791,8 @@ Object.defineProperty(exports, "FetchHeaderType", {
6149
6791
  });
6150
6792
  exports.FetchObject = FetchObject;
6151
6793
  exports.FetchOk = FetchOk;
6152
- Object.defineProperty(exports, "FetchType", {
6153
- enumerable: true,
6154
- get: function() {
6155
- return FetchType;
6156
- }
6157
- });
6794
+ exports.FillParameters = FillParameters;
6158
6795
  exports.FillTimeout = FillTimeout;
6159
- Object.defineProperty(exports, "FilterType", {
6160
- enumerable: true,
6161
- get: function() {
6162
- return FilterType;
6163
- }
6164
- });
6165
6796
  exports.Forward = Forward;
6166
6797
  exports.FrozenByteBuffer = FrozenByteBuffer;
6167
6798
  exports.FullTrackName = FullTrackName;
@@ -6183,8 +6814,10 @@ Object.defineProperty(exports, "Header", {
6183
6814
  });
6184
6815
  exports.ImmutablePropertiesObjectProperty = ImmutablePropertiesObjectProperty;
6185
6816
  exports.ImmutablePropertiesTrackProperty = ImmutablePropertiesTrackProperty;
6817
+ exports.IncludeProperties = IncludeProperties;
6186
6818
  exports.InternalError = InternalError;
6187
6819
  exports.InvalidEnumValue = InvalidEnumValue;
6820
+ exports.InvalidFilterError = InvalidFilterError;
6188
6821
  exports.InvalidTypeError = InvalidTypeError;
6189
6822
  exports.InvalidUTF8Error = InvalidUTF8Error;
6190
6823
  exports.KeyValueFormattingError = KeyValueFormattingError;
@@ -6200,6 +6833,13 @@ exports.LOCPropertyId = LOCPropertyId;
6200
6833
  exports.LargestObject = LargestObject;
6201
6834
  exports.LengthExceedsMaxError = LengthExceedsMaxError;
6202
6835
  exports.Location = Location;
6836
+ exports.LocationFilter = LocationFilter;
6837
+ Object.defineProperty(exports, "LocationFilterType", {
6838
+ enumerable: true,
6839
+ get: function() {
6840
+ return LocationFilterType;
6841
+ }
6842
+ });
6203
6843
  exports.MAX_FULL_TRACK_NAME_LENGTH = MAX_FULL_TRACK_NAME_LENGTH;
6204
6844
  exports.MAX_NAMESPACE_TUPLE_COUNT = MAX_NAMESPACE_TUPLE_COUNT;
6205
6845
  exports.MAX_NEW_SESSION_URI_LENGTH = MAX_NEW_SESSION_URI_LENGTH;
@@ -6207,6 +6847,8 @@ exports.MAX_REASON_PHRASE_LEN = MAX_REASON_PHRASE_LEN;
6207
6847
  exports.MOQtailError = MOQtailError;
6208
6848
  exports.MaxAuthTokenCacheSize = MaxAuthTokenCacheSize;
6209
6849
  exports.MaxCacheDurationProperty = MaxCacheDurationProperty;
6850
+ exports.MaxFilterRanges = MaxFilterRanges;
6851
+ exports.MaxRequestUpdates = MaxRequestUpdates;
6210
6852
  Object.defineProperty(exports, "MessageParameter", {
6211
6853
  enumerable: true,
6212
6854
  get: function() {
@@ -6254,7 +6896,6 @@ exports.PriorObjectIdGapProperty = PriorObjectIdGapProperty;
6254
6896
  exports.PropertyRanges = PropertyRanges;
6255
6897
  exports.ProtocolViolationError = ProtocolViolationError;
6256
6898
  exports.Publish = Publish;
6257
- exports.PublishBlocked = PublishBlocked;
6258
6899
  exports.PublishDone = PublishDone;
6259
6900
  Object.defineProperty(exports, "PublishDoneStatusCode", {
6260
6901
  enumerable: true,
@@ -6263,6 +6904,14 @@ Object.defineProperty(exports, "PublishDoneStatusCode", {
6263
6904
  }
6264
6905
  });
6265
6906
  exports.PublishNamespace = PublishNamespace;
6907
+ exports.PublishSkipped = PublishSkipped;
6908
+ exports.RangeFilter = RangeFilter;
6909
+ Object.defineProperty(exports, "RangeFilterKind", {
6910
+ enumerable: true,
6911
+ get: function() {
6912
+ return RangeFilterKind;
6913
+ }
6914
+ });
6266
6915
  exports.ReasonPhrase = ReasonPhrase;
6267
6916
  exports.Redirect = Redirect;
6268
6917
  exports.RendezvousTimeout = RendezvousTimeout;
@@ -6309,8 +6958,8 @@ exports.SubscribeNamespace = SubscribeNamespace;
6309
6958
  exports.SubscribeOk = SubscribeOk;
6310
6959
  exports.SubscribeTracks = SubscribeTracks;
6311
6960
  exports.SubscriberPriority = SubscriberPriority;
6312
- exports.SubscriptionFilter = SubscriptionFilter;
6313
- exports.Switch = Switch;
6961
+ exports.SwitchFrom = SwitchFrom;
6962
+ exports.SwitchMode = SwitchMode;
6314
6963
  exports.SwitchingSetAssignment = SwitchingSetAssignment;
6315
6964
  Object.defineProperty(exports, "TerminationCode", {
6316
6965
  enumerable: true,
@@ -6350,6 +6999,7 @@ exports.assertNoAuthorityOverWebTransport = assertNoAuthorityOverWebTransport;
6350
6999
  exports.deserializeKvpList = deserializeKvpList;
6351
7000
  exports.deserializeKvpListUntilEmpty = deserializeKvpListUntilEmpty;
6352
7001
  exports.deserializeMessageParameterKvps = deserializeMessageParameterKvps;
7002
+ exports.encodeRanges = encodeRanges;
6353
7003
  exports.greaseValue = greaseValue;
6354
7004
  exports.isApplicationSpecificProperty = isApplicationSpecificProperty;
6355
7005
  exports.isBytes = isBytes;