@ghostlytools/cli 1.10.1 → 1.10.3

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.
Files changed (97) hide show
  1. package/README.md +14 -10
  2. package/SKILL.md +3 -2
  3. package/dist/assets/{api-BOWLZYXM.js → api-BdaxsDvA.js} +2 -2
  4. package/dist/assets/{api-Bi6hCcwG.js → api-C4MLg5Rs.js} +126 -49
  5. package/dist/assets/api-C4MLg5Rs.js.map +1 -0
  6. package/dist/assets/{apiKit-DzXHZojD.js → apiKit-BbNaxZGZ.js} +87 -25
  7. package/dist/assets/apiKit-BbNaxZGZ.js.map +1 -0
  8. package/dist/assets/{apps-DIQbzG08.js → apps-BluQgEhv.js} +5 -5
  9. package/dist/assets/{apps-DIQbzG08.js.map → apps-BluQgEhv.js.map} +1 -1
  10. package/dist/assets/{apps-0Ks6KjqS.js → apps-BtGFth7o.js} +1 -1
  11. package/dist/assets/{arkade-zozCldAE.js → arkade-DdZx4b_I.js} +2 -2
  12. package/dist/assets/{arkade-zozCldAE.js.map → arkade-DdZx4b_I.js.map} +1 -1
  13. package/dist/assets/{backup-BL49Kt-T.js → backup-DyDsW7sC.js} +7 -7
  14. package/dist/assets/{backup-BL49Kt-T.js.map → backup-DyDsW7sC.js.map} +1 -1
  15. package/dist/assets/{backup-BvIFcZM7.js → backup-I1n7ccz7.js} +1 -1
  16. package/dist/assets/{buttons-CAW5v5EE.js → buttons-Do7dCku6.js} +6 -6
  17. package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-Do7dCku6.js.map} +1 -1
  18. package/dist/assets/buttons-DpjwXePb.js +2 -0
  19. package/dist/assets/{client-CyApKBEw.js → client-CWsjRiH8.js} +3 -3
  20. package/dist/assets/{client-CyApKBEw.js.map → client-CWsjRiH8.js.map} +1 -1
  21. package/dist/assets/{codec-DqFxxB_q.js → codec-DPaXhuYc.js} +2 -2
  22. package/dist/assets/{codec-DqFxxB_q.js.map → codec-DPaXhuYc.js.map} +1 -1
  23. package/dist/assets/{envelope-CMUgz31I.js → envelope-5Gu9yGk_.js} +2 -2
  24. package/dist/assets/{envelope-CMUgz31I.js.map → envelope-5Gu9yGk_.js.map} +1 -1
  25. package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
  26. package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
  27. package/dist/assets/{fixedHosts-C2hdCfzK.js → fixedHosts-PR1BcfKX.js} +7 -8
  28. package/dist/assets/fixedHosts-PR1BcfKX.js.map +1 -0
  29. package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-BuToTMUk.js} +307 -69
  30. package/dist/assets/groupFiles-BuToTMUk.js.map +1 -0
  31. package/dist/assets/{host-CaRlDMTd.js → host-fkQYBvKH.js} +322 -72
  32. package/dist/assets/host-fkQYBvKH.js.map +1 -0
  33. package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-DDCak5PY.js} +28 -20
  34. package/dist/assets/hyperdhtRelay-DDCak5PY.js.map +1 -0
  35. package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-B4_swKx0.js} +112 -34
  36. package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-B4_swKx0.js.map} +1 -1
  37. package/dist/assets/{main-Bc4Ow56Z.js → main-ClYsttvY.js} +98 -51
  38. package/dist/assets/main-ClYsttvY.js.map +1 -0
  39. package/dist/assets/{mainline-DWh4Ccri.js → mainline-Hsk2SZ1B.js} +66 -6
  40. package/dist/assets/mainline-Hsk2SZ1B.js.map +1 -0
  41. package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-C9Hr-hO7.js} +4 -4
  42. package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-C9Hr-hO7.js.map} +1 -1
  43. package/dist/assets/{nwc-DoSEhUKb.js → nwc-BbK6qNxS.js} +3 -3
  44. package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BbK6qNxS.js.map} +1 -1
  45. package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-D_tt2X3Z.js} +2 -2
  46. package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-D_tt2X3Z.js.map} +1 -1
  47. package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DkK_jem4.js} +2 -2
  48. package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DkK_jem4.js.map} +1 -1
  49. package/dist/assets/{profiles-DgIfvBeN.js → profiles-aV9vaK0B.js} +17 -8
  50. package/dist/assets/profiles-aV9vaK0B.js.map +1 -0
  51. package/dist/assets/{registry-C5cn80Rw.js → registry-C9T6tYCO.js} +1 -1
  52. package/dist/assets/{registry-BSyxGjN6.js → registry-CEjnubep.js} +57 -17
  53. package/dist/assets/registry-CEjnubep.js.map +1 -0
  54. package/dist/assets/{resolve-D-9YRFhl.js → resolve-BBOrN13E.js} +27 -6
  55. package/dist/assets/resolve-BBOrN13E.js.map +1 -0
  56. package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
  57. package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
  58. package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
  59. package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
  60. package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
  61. package/dist/assets/{server-BufntkX8.js → server-BJ3T-kx3.js} +1051 -389
  62. package/dist/assets/server-BJ3T-kx3.js.map +1 -0
  63. package/dist/assets/{src-CCt5s4DK.js → src-BIdfHB7t.js} +667 -134
  64. package/dist/assets/src-BIdfHB7t.js.map +1 -0
  65. package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-CRg-NGld.js} +2 -2
  66. package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-CRg-NGld.js.map} +1 -1
  67. package/dist/assets/{translate-Cb-6hMhD.js → translate-b0X61WMI.js} +3 -3
  68. package/dist/assets/{translate-Cb-6hMhD.js.map → translate-b0X61WMI.js.map} +1 -1
  69. package/dist/assets/{usdt-ds461mzA.js → usdt-6CQdfye1.js} +7 -4
  70. package/dist/assets/usdt-6CQdfye1.js.map +1 -0
  71. package/dist/assets/waitNotice-Ce3YCinu.js +101 -0
  72. package/dist/assets/waitNotice-Ce3YCinu.js.map +1 -0
  73. package/dist/assets/{words-B1ylON2h.js → words-Dk6o6wz4.js} +4 -4
  74. package/dist/assets/words-Dk6o6wz4.js.map +1 -0
  75. package/dist/ghostly.mjs +1 -1
  76. package/package.json +1 -1
  77. package/dist/assets/api-Bi6hCcwG.js.map +0 -1
  78. package/dist/assets/apiKit-DzXHZojD.js.map +0 -1
  79. package/dist/assets/buttons-oJI5mHSL.js +0 -2
  80. package/dist/assets/errors-R4S2SAEM.js.map +0 -1
  81. package/dist/assets/fixedHosts-C2hdCfzK.js.map +0 -1
  82. package/dist/assets/groupFiles-BAQIt_bJ.js.map +0 -1
  83. package/dist/assets/host-CaRlDMTd.js.map +0 -1
  84. package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
  85. package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
  86. package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
  87. package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
  88. package/dist/assets/registry-BSyxGjN6.js.map +0 -1
  89. package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
  90. package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
  91. package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
  92. package/dist/assets/server-BufntkX8.js.map +0 -1
  93. package/dist/assets/src-CCt5s4DK.js.map +0 -1
  94. package/dist/assets/usdt-ds461mzA.js.map +0 -1
  95. package/dist/assets/waitNotice-B8D8WhbE.js +0 -45
  96. package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
  97. package/dist/assets/words-B1ylON2h.js.map +0 -1
@@ -928,6 +928,22 @@ var isChatWatch = (who) => who.watch && isChat(who);
928
928
  * So may its reads of a member that was live when this app last ran, until one is answered (`resume`): its offer waits on them.
929
929
  */
930
930
  var isGroupSignal = (who) => who.group && !who.background && (who.signal || isWatch(who) || who.watchWrite || who.resume);
931
+ /** A group edge's read for the signal it waits for, the answer to its offer (`signal`): first on the floor (`ANSWER_READ_FIRST_MS`). */
932
+ var isGroupAnswerRead = (who) => isGroupSignal(who) && who.signal && !who.write;
933
+ /** Such a read, as the budget weighs it (`ANSWER_READ_FIRST_MS`). */
934
+ var ANSWER_READER = {
935
+ background: false,
936
+ group: true,
937
+ urgent: true,
938
+ door: false,
939
+ write: false,
940
+ signal: true,
941
+ watch: false,
942
+ watchWrite: false,
943
+ departed: false,
944
+ resume: false,
945
+ back: false
946
+ };
931
947
  /** A community member's way back to its group while it has no edge up: it may use its own allowance (`WAY_BACK_SHARE`). */
932
948
  var isWayBack = (who) => who.back && who.group && !who.background;
933
949
  /** Watch reads that the same other limits hold take turns together: urgent or not, background or not; the chats' on their own. */
@@ -944,6 +960,13 @@ var firstWriter = (who) => !who.write || who.background ? null : who.group ? "gr
944
960
  /** A key's turn neither asked nor read in the last minute: it is dropped, and asking again starts a new one (`TURNS_PRUNE_MS`). */
945
961
  var staleTurn = (turn, now) => now - Math.max(turn.askedAt, turn.servedAt) >= 6e4;
946
962
  /**
963
+ * The times of `list` (oldest first) within the last `ms`. One dated after now, the device clock gone back since (an NTP
964
+ * step, a clock that ran ahead fixed by hand), counts as of now: as just spent, not for as long as the clock went back.
965
+ * Counted as they were, an hour's step back held every background read for 59 minutes, and a daemon with 50 contacts
966
+ * away read 4 of them in the next 15 (bug hunt, 2026-11-07).
967
+ */
968
+ var within = (list, now, ms) => list.map((at) => Math.min(at, now)).filter((at) => now - at < ms);
969
+ /**
947
970
  * Keys and when each was last set, those of the last minute: how many and the latest, without walking them all (the
948
971
  * chats that need a relay, `chatNeeds`). Each is set at the time it is set, so the sets come oldest first; a clock
949
972
  * gone back makes the later ones as of now.
@@ -1086,10 +1109,10 @@ var GROUP_SIGNALING_ALLOWANCE_SHARE = 2 / 15;
1086
1109
  * in the first minute on the default relays: a reading of each beacon, and a read and a write in a hub's lobby (a write
1087
1110
  * goes to every relay). A member asks it only while it has no edge up in that community.
1088
1111
  *
1089
- * At worst a relay then sees, in one minute, its limit, the chats' allowance past it, the edges' and this one: 46 on a
1090
- * relay of 30 (pkarr.pubky.org allows 50 an address, `x-ratelimit-limit`), 92 on pkarr.pubky.app's 60 (it allows 1000)
1091
- * and 7 on a relay of 5 (relay.pkarr.org and pkarr.miguelmedeiros.dev allow 10). A share raised past those limits gets
1092
- * 429s (docs/TRANSPORTS.md, "The default list").
1112
+ * At worst a relay then sees, in one minute, its limit, the chats' allowance past it, the edges', this one and the edges'
1113
+ * answer reads' (`ANSWER_READ_ALLOWANCE`): 49 on a relay of 30 (pkarr.pubky.org allows 50 an address,
1114
+ * `x-ratelimit-limit`), 95 on pkarr.pubky.app's 60 (it allows 1000) and 7 on a relay of 5 (relay.pkarr.org and
1115
+ * pkarr.miguelmedeiros.dev allow 10). A share raised past those limits gets 429s (docs/TRANSPORTS.md, "The default list").
1093
1116
  */
1094
1117
  var WAY_BACK_SHARE = 1 / 5;
1095
1118
  /** Past the limit, a group's reads within its allowance go no more often than this on a relay. */
@@ -1257,6 +1280,22 @@ function normalizeRelayUrl(input) {
1257
1280
  return null;
1258
1281
  }
1259
1282
  }
1283
+ /**
1284
+ * Why a line of a Pkarr relay list is not a relay `normalizeRelayUrl` keeps, with the line as typed; null when it is
1285
+ * one. A host alone or another scheme (`relay.example.org`, `wss://…`) was meant as an https:// relay.
1286
+ */
1287
+ function relayUrlProblem(input) {
1288
+ const line = input.trim();
1289
+ if (normalizeRelayUrl(line)) return null;
1290
+ return looksLikeHost(line) || looksLikeHost(line.replace(/^[a-z][a-z\d+.-]*:\/\//i, "")) ? `Use an https:// relay address: ${line}` : `Not a relay address: ${line}`;
1291
+ }
1292
+ /** No space, and a dot after the first character, before the last one and before any `/` or `:`; linear, for a long pasted line. */
1293
+ function looksLikeHost(text) {
1294
+ if (/\s/.test(text)) return false;
1295
+ const slash = text.search(/[/:]/);
1296
+ const dot = text.indexOf(".", 1);
1297
+ return dot > 0 && dot < text.length - 1 && (slash < 0 || dot < slash);
1298
+ }
1260
1299
  /** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
1261
1300
  var RelayLeftAloneError = class extends Error {};
1262
1301
  /**
@@ -1301,8 +1340,9 @@ var RelayTransport = class {
1301
1340
  spentBackground = /* @__PURE__ */ new Map();
1302
1341
  /** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
1303
1342
  spentBackgroundWrites = /* @__PURE__ */ new Map();
1304
- /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
1343
+ /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`: edges' reads for an answer apart (`ANSWER_READ_FIRST_MS`). */
1305
1344
  spentGroupUrgent = /* @__PURE__ */ new Map();
1345
+ spentAnswerUrgent = /* @__PURE__ */ new Map();
1306
1346
  /** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
1307
1347
  spentWatch = /* @__PURE__ */ new Map();
1308
1348
  /** 1:1 chats' watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`CHAT_WATCH_SHARE`). */
@@ -1313,6 +1353,8 @@ var RelayTransport = class {
1313
1353
  spentGroupSignal = /* @__PURE__ */ new Map();
1314
1354
  /** Community members' ways back on each relay in the last minute: their allowance (`WAY_BACK_SHARE`). */
1315
1355
  spentWayBack = /* @__PURE__ */ new Map();
1356
+ /** Edges' reads for an answer that only their own allowance let through, on each relay in the last minute (`ANSWER_READ_ALLOWANCE`). */
1357
+ spentAnswerAllowance = /* @__PURE__ */ new Map();
1316
1358
  /** Per contact, its departed reads past the limit in the last minute, every relay together (`DEPARTED_READS`). */
1317
1359
  departedOver = /* @__PURE__ */ new Map();
1318
1360
  /**
@@ -1331,6 +1373,8 @@ var RelayTransport = class {
1331
1373
  groupsFullAt = /* @__PURE__ */ new Map();
1332
1374
  /** When a link's write was last refused on each relay (`chat <relay>`, `group <relay>`), while it waits for the budget. */
1333
1375
  writeWaiting = /* @__PURE__ */ new Map();
1376
+ /** Per relay, the keys whose edges' reads for an answer it last refused, and when, until one is read (`ANSWER_READ_FIRST_MS`). */
1377
+ answerReadWaiting = /* @__PURE__ */ new Map();
1334
1378
  /**
1335
1379
  * Per key a 1:1 chat asks for: when it last read urgently (for the next minute, groups leave it `CHAT_RESERVE` on
1336
1380
  * every relay) and when the budget last refused it on each relay (the same, on that relay). A read of the key at a
@@ -1746,8 +1790,8 @@ var RelayTransport = class {
1746
1790
  async resolve(pubKeyZ32, options = {}, keptOnFailure = true) {
1747
1791
  if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
1748
1792
  if (options.background && !options.urgent && !options.group) this.chatNeedLapsed(pubKeyZ32);
1749
- const readAt = this.readAt.get(pubKeyZ32);
1750
- if (readAt !== void 0 && Date.now() - readAt < this.freshReadMs) return this.newest.get(pubKeyZ32) ?? null;
1793
+ const readAt = this.readAt.get(pubKeyZ32), age = readAt === void 0 ? Infinity : Date.now() - readAt;
1794
+ if (age >= 0 && age < this.freshReadMs) return this.newest.get(pubKeyZ32) ?? null;
1751
1795
  const order = this.readOrder(pubKeyZ32);
1752
1796
  const probe = this.breaker.allDownProbe(this.relays);
1753
1797
  let budgetWait = Infinity, down = false;
@@ -1955,7 +1999,7 @@ var RelayTransport = class {
1955
1999
  */
1956
2000
  hedgeRoom(relay) {
1957
2001
  const now = Date.now();
1958
- return (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
2002
+ return within(this.spent.get(relay) ?? [], now, 6e4).length < this.limitOf(relay) - this.reserveOf(relay);
1959
2003
  }
1960
2004
  readAnsweredAt(pubKeyZ32) {
1961
2005
  return this.readAt.get(pubKeyZ32);
@@ -2109,9 +2153,14 @@ var RelayTransport = class {
2109
2153
  if (isGroupRead(who) && (this.spent.get(relay)?.length ?? 0) >= this.limitOf(relay)) this.groupsFullAt.set(relay, now);
2110
2154
  if (isChat(who)) this.chatNeed(key, now, relay);
2111
2155
  if (writer) this.writeWaiting.set(`${writer} ${relay}`, now);
2156
+ if (isGroupAnswerRead(who)) {
2157
+ const waiting = this.answerReadWaiting.get(relay) ?? /* @__PURE__ */ new Map();
2158
+ this.answerReadWaiting.set(relay, waiting.set(key, now));
2159
+ }
2112
2160
  return false;
2113
2161
  }
2114
2162
  if (writer) this.writeWaiting.delete(`${writer} ${relay}`);
2163
+ if (isGroupAnswerRead(who)) this.answerReadWaiting.get(relay)?.delete(key);
2115
2164
  if (isWayBack(who) && this.heldFor(relay, {
2116
2165
  ...who,
2117
2166
  back: false
@@ -2126,6 +2175,18 @@ var RelayTransport = class {
2126
2175
  });
2127
2176
  return true;
2128
2177
  }
2178
+ if (isGroupAnswerRead(who) && this.heldFor(relay, who, now, key, false, false) > 0) {
2179
+ this.spentAnswerAllowance.set(relay, [...this.spentAnswerAllowance.get(relay) ?? [], now]);
2180
+ this.readTurns.set(key, {
2181
+ servedAt: now,
2182
+ askedAt: now,
2183
+ waiting: false,
2184
+ watch: false,
2185
+ lane: watchLane(who),
2186
+ answer: true
2187
+ });
2188
+ return true;
2189
+ }
2129
2190
  if (isGroupSignal(who) && !who.write && this.spent.get(relay).length >= this.limitOf(relay)) this.spentGroupOver.get(relay).push(now);
2130
2191
  if (isGroupSignal(who)) this.spentGroupSignal.get(relay).push(now);
2131
2192
  const departedOver = isDepartedRead(who) && this.spent.get(relay).length >= this.limitOf(relay);
@@ -2133,7 +2194,8 @@ var RelayTransport = class {
2133
2194
  this.spent.get(relay).push(now);
2134
2195
  if (who.background) this.spentBackground.get(relay).push(now);
2135
2196
  if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
2136
- if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
2197
+ if (isGroupUrgentRead(who) && isGroupAnswerRead(who)) this.spentAnswerUrgent.set(relay, [...this.spentAnswerUrgent.get(relay) ?? [], now]);
2198
+ else if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
2137
2199
  if (isWatch(who)) this.spentWatch.get(relay).push(now);
2138
2200
  if (isChatWatch(who) && !departedOver) this.spentChatWatch.get(relay).push(now);
2139
2201
  if (isGroupRead(who)) this.spentGroupReads.get(relay).push(now);
@@ -2159,26 +2221,27 @@ var RelayTransport = class {
2159
2221
  * Who goes first: a chat's refused write holds back everything but chat writes; a group's refused write holds back
2160
2222
  * group reads and background requests, never a chat's. Background requests yield to a link that signals. A chat's
2161
2223
  * signaling goes over the limit by its allowance (`SIGNALING_ALLOWANCE_SHARE`), and so do a few of its reads of a
2162
- * contact that just went away (`DEPARTED_READS`).
2224
+ * contact that just went away (`DEPARTED_READS`). `ownAllowance` false: what holds an edge's read for its answer
2225
+ * without its own allowance (`ANSWER_READ_ALLOWANCE`).
2163
2226
  */
2164
- heldFor(relay, who, now = Date.now(), key, turns = true) {
2165
- const recent = (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4);
2166
- const recentBackground = (this.spentBackground.get(relay) ?? []).filter((at) => now - at < 6e4);
2227
+ heldFor(relay, who, now = Date.now(), key, turns = true, ownAllowance = true) {
2228
+ const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2229
+ const recentBackground = within(this.spentBackground.get(relay) ?? [], now, 6e4);
2167
2230
  this.spent.set(relay, recent);
2168
2231
  this.spentBackground.set(relay, recentBackground);
2169
- const recentBackgroundWrites = (this.spentBackgroundWrites.get(relay) ?? []).filter((at) => now - at < 6e4);
2232
+ const recentBackgroundWrites = within(this.spentBackgroundWrites.get(relay) ?? [], now, 6e4);
2170
2233
  this.spentBackgroundWrites.set(relay, recentBackgroundWrites);
2171
2234
  const over = (list, limit) => list.length >= limit ? list[list.length - limit] + 6e4 - now : 0;
2172
2235
  const limit = this.limitOf(relay);
2173
2236
  const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.departedReads(key, now) < 6;
2174
2237
  const share = isChatSignal(who) || departed ? SIGNALING_ALLOWANCE_SHARE : isGroupSignal(who) ? GROUP_SIGNALING_ALLOWANCE_SHARE : 0;
2175
2238
  const allowance = share ? Math.max(0, Math.floor(limit * share) - (who.write ? 0 : 1)) : 0;
2176
- const groupSignaled = (this.spentGroupSignal.get(relay) ?? []).filter((at) => now - at < 6e4);
2239
+ const groupSignaled = within(this.spentGroupSignal.get(relay) ?? [], now, 6e4);
2177
2240
  this.spentGroupSignal.set(relay, groupSignaled);
2178
2241
  const groupFloor = isGroupSignal(who) && groupSignaled.length < allowance;
2179
2242
  let wait = groupFloor ? 0 : over(recent, limit + allowance);
2180
2243
  const starved = key !== void 0 && this.starved(key, who, now);
2181
- const groupOver = (this.spentGroupOver.get(relay) ?? []).filter((at) => now - at < GROUP_OVER_PACE_MS);
2244
+ const groupOver = within(this.spentGroupOver.get(relay) ?? [], now, GROUP_OVER_PACE_MS);
2182
2245
  this.spentGroupOver.set(relay, groupOver);
2183
2246
  if (isGroupSignal(who) && !who.write && recent.length >= limit && groupOver.length > 0) wait = Math.max(wait, groupOver[groupOver.length - 1] + GROUP_OVER_PACE_MS - now);
2184
2247
  if (who.background && !starved) {
@@ -2188,13 +2251,16 @@ var RelayTransport = class {
2188
2251
  const signaling = this.urgentAt + SIGNALING_WINDOW_MS - now;
2189
2252
  if (signaling > 0 && !who.door) wait = Math.max(wait, Math.min(signaling, over(recentBackground, Math.min(this.backgroundWhileSignaling, Math.ceil(limit / 6)))));
2190
2253
  }
2191
- const burst = (this.spentGroupUrgent.get(relay) ?? []).filter((at) => now - at < GROUP_BURST_MS);
2254
+ const burst = within(this.spentGroupUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2192
2255
  this.spentGroupUrgent.set(relay, burst);
2256
+ const answerBurst = within(this.spentAnswerUrgent.get(relay) ?? [], now, GROUP_BURST_MS);
2257
+ this.spentAnswerUrgent.set(relay, answerBurst);
2193
2258
  if (isGroupUrgentRead(who)) {
2194
2259
  const most = Math.max(8, Math.floor(limit * GROUP_BURST_MS / 6e4));
2195
- if (burst.length >= most) wait = Math.max(wait, burst[burst.length - most] + GROUP_BURST_MS - now);
2260
+ const spent = isGroupAnswerRead(who) ? answerBurst : burst;
2261
+ if (spent.length >= most) wait = Math.max(wait, spent[spent.length - most] + GROUP_BURST_MS - now);
2196
2262
  }
2197
- const watched = (this.spentWatch.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2263
+ const watched = within(this.spentWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2198
2264
  this.spentWatch.set(relay, watched);
2199
2265
  let turn = 0;
2200
2266
  if (isWatch(who)) {
@@ -2202,20 +2268,20 @@ var RelayTransport = class {
2202
2268
  if (watched.length >= most) wait = Math.max(wait, watched[watched.length - most] + GROUP_RATION_WINDOW_MS - now);
2203
2269
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2204
2270
  }
2205
- const chatWatched = (this.spentChatWatch.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2271
+ const chatWatched = within(this.spentChatWatch.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2206
2272
  this.spentChatWatch.set(relay, chatWatched);
2207
2273
  if (isChatWatch(who) && !departed) {
2208
2274
  const most = Math.max(1, Math.ceil(limit * CHAT_WATCH_SHARE * GROUP_RATION_WINDOW_MS / 6e4));
2209
2275
  if (chatWatched.length >= most) wait = Math.max(wait, chatWatched[chatWatched.length - most] + GROUP_RATION_WINDOW_MS - now);
2210
2276
  if (this.readsAhead(key, now, watchLane(who)) > 0) turn = TURN_WAIT_MS;
2211
2277
  }
2212
- const rationed = (this.spentGroupReads.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2278
+ const rationed = within(this.spentGroupReads.get(relay) ?? [], now, GROUP_RATION_WINDOW_MS);
2213
2279
  this.spentGroupReads.set(relay, rationed);
2214
2280
  const pastLimit = isGroupSignal(who) && recent.length >= limit;
2215
2281
  if (isGroupRead(who) && !pastLimit && now - (this.groupsFullAt.get(relay) ?? -Infinity) < GROUP_RATION_MS) {
2216
2282
  const most = Math.max(1, Math.ceil(limit * GROUP_RATION_WINDOW_MS / 6e4));
2217
2283
  if (rationed.length >= most) wait = Math.max(wait, rationed[rationed.length - most] + GROUP_RATION_WINDOW_MS - now);
2218
- if (this.readsAhead(key, now) > 0) turn = TURN_WAIT_MS;
2284
+ if (this.readsAhead(key, now, void 0, isGroupAnswerRead(who)) > 0) turn = TURN_WAIT_MS;
2219
2285
  }
2220
2286
  if (who.group && !groupFloor || who.background) {
2221
2287
  const reserved = this.chatReservedFor(relay, now);
@@ -2227,14 +2293,47 @@ var RelayTransport = class {
2227
2293
  return at !== void 0 && now - at < 5e3 ? at + WRITE_FIRST_MS - now : 0;
2228
2294
  };
2229
2295
  if (writer !== "chat" && !departed && !starved) wait = Math.max(wait, waiting("chat"));
2230
- if ((writer === null && who.group && !pastLimit || who.background) && !starved) wait = Math.max(wait, waiting("group"));
2296
+ if ((writer === null && who.group && !pastLimit && !isGroupAnswerRead(who) || who.background) && !starved) wait = Math.max(wait, waiting("group"));
2297
+ if (isGroupSignal(who) && !isGroupAnswerRead(who)) {
2298
+ const ahead = this.answerReadAhead(relay, now);
2299
+ if (ahead && this.heldFor(relay, ANSWER_READER, now, ahead.key, false, false) <= 0) wait = Math.max(wait, ahead.ms);
2300
+ }
2231
2301
  if (turns && wait <= 0 && isTurnRead(who) && this.turnAhead(relay, key, who, now)) turn = TURN_WAIT_MS;
2232
2302
  if (wait > 0 && isWayBack(who) && this.wayBackLeft(relay, who, now) > 0) return 0;
2303
+ if (wait > 0 && ownAllowance && isGroupAnswerRead(who) && this.answerAllowanceFree(relay, now)) return 0;
2233
2304
  return Math.max(wait, turn, 0);
2234
2305
  }
2306
+ /**
2307
+ * The edges' reads for their answers may take their own allowance on this relay now (`ANSWER_READ_ALLOWANCE`): fewer
2308
+ * than it in the last minute, and none within `ANSWER_READ_SPACING_MS`. None where the groups have no allowance.
2309
+ */
2310
+ answerAllowanceFree(relay, now) {
2311
+ const spent = within(this.spentAnswerAllowance.get(relay) ?? [], now, 6e4);
2312
+ this.spentAnswerAllowance.set(relay, spent);
2313
+ const most = Math.min(3, Math.floor(this.limitOf(relay) * GROUP_SIGNALING_ALLOWANCE_SHARE));
2314
+ return spent.length < most && (spent.length === 0 || now - spent[spent.length - 1] >= 2e4);
2315
+ }
2316
+ /**
2317
+ * The edges' reads for their answers the budget refused on this relay within `ANSWER_READ_FIRST_MS`, still not read:
2318
+ * the key refused last, and how long the groups' other signaling waits for them there. Undefined when there is none.
2319
+ */
2320
+ answerReadAhead(relay, now) {
2321
+ const waiting = this.answerReadWaiting.get(relay);
2322
+ if (!waiting) return void 0;
2323
+ let last;
2324
+ for (const [key, at] of waiting) if (now - at >= 5e3) waiting.delete(key);
2325
+ else if (!last || at > last.at) last = {
2326
+ key,
2327
+ at
2328
+ };
2329
+ return last && {
2330
+ key: last.key,
2331
+ ms: last.at + 5e3 - now
2332
+ };
2333
+ }
2235
2334
  /** What is left of the community members' way back allowance on this relay (`WAY_BACK_SHARE`); its reads leave a write the last of it. */
2236
2335
  wayBackLeft(relay, who, now) {
2237
- const spent = (this.spentWayBack.get(relay) ?? []).filter((at) => now - at < 6e4);
2336
+ const spent = within(this.spentWayBack.get(relay) ?? [], now, 6e4);
2238
2337
  this.spentWayBack.set(relay, spent);
2239
2338
  return Math.floor(this.limitOf(relay) * WAY_BACK_SHARE) - (who.write ? 0 : 1) - spent.length;
2240
2339
  }
@@ -2247,20 +2346,23 @@ var RelayTransport = class {
2247
2346
  askedAt: now,
2248
2347
  waiting: true,
2249
2348
  watch: isWatch(who) || isChatWatch(who),
2250
- lane: watchLane(who)
2349
+ lane: watchLane(who),
2350
+ answer: isGroupAnswerRead(who)
2251
2351
  });
2252
2352
  }
2253
2353
  /**
2254
2354
  * Keys a group reads, still asking (within `WATCH_TURN_MS`), that were read longer ago than `key`: a share keeps a
2255
2355
  * request for each. With `watchLane`, only watched keys the same other limits hold: one the groups' burst holds back
2256
- * would keep a turn it cannot take. The chats' watched keys only in their own lane (`CHAT_WATCH_SHARE`).
2356
+ * would keep a turn it cannot take. The chats' watched keys only in their own lane (`CHAT_WATCH_SHARE`). `answer`: an
2357
+ * edge's read for its answer, which waits only for the others' (`ANSWER_READ_FIRST_MS`).
2257
2358
  */
2258
- readsAhead(key, now, watchLane) {
2359
+ readsAhead(key, now, watchLane, answer = false) {
2259
2360
  const mine = key === void 0 ? -Infinity : this.readTurns.get(key)?.servedAt ?? -Infinity;
2260
2361
  let ahead = 0;
2261
2362
  for (const [other, turn] of this.readTurns) {
2262
2363
  if (other === key || !turn.waiting || now - turn.askedAt >= WATCH_TURN_MS) continue;
2263
2364
  if (watchLane !== void 0 ? !turn.watch || turn.lane !== watchLane : turn.lane === "chat") continue;
2365
+ if (answer && !turn.answer) continue;
2264
2366
  if (turn.servedAt < mine) ahead++;
2265
2367
  }
2266
2368
  return ahead;
@@ -2278,9 +2380,17 @@ var RelayTransport = class {
2278
2380
  }
2279
2381
  /** Drops the turns asked and read over a minute ago, at most once in `TURNS_PRUNE_MS` (or when the clock went back). */
2280
2382
  pruneTurns(turns, now) {
2281
- if (Math.abs(now - (this.turnsPrunedAt.get(turns) ?? -Infinity)) < TURNS_PRUNE_MS) return;
2383
+ const prunedAt = this.turnsPrunedAt.get(turns) ?? -Infinity;
2384
+ if (Math.abs(now - prunedAt) < TURNS_PRUNE_MS) return;
2282
2385
  this.turnsPrunedAt.set(turns, now);
2283
- for (const [key, turn] of turns) if (staleTurn(turn, now)) turns.delete(key);
2386
+ const back = now < prunedAt;
2387
+ for (const [key, turn] of turns) {
2388
+ if (back) {
2389
+ turn.servedAt = Math.min(turn.servedAt, now);
2390
+ turn.askedAt = Math.min(turn.askedAt, now);
2391
+ }
2392
+ if (staleTurn(turn, now)) turns.delete(key);
2393
+ }
2284
2394
  }
2285
2395
  /**
2286
2396
  * Whether a key read in turn longer ago than `key`, still asking, would take this relay's next request: one read in the
@@ -2307,7 +2417,7 @@ var RelayTransport = class {
2307
2417
  }
2308
2418
  /** This contact's departed reads past the limit in the last minute (`DEPARTED_READS`). */
2309
2419
  departedReads(key, now) {
2310
- const reads = (this.departedOver.get(key) ?? []).filter((at) => now - at < 6e4);
2420
+ const reads = within(this.departedOver.get(key) ?? [], now, 6e4);
2311
2421
  if (reads.length) this.departedOver.set(key, reads);
2312
2422
  else this.departedOver.delete(key);
2313
2423
  return reads.length;
@@ -2355,7 +2465,7 @@ var RelayTransport = class {
2355
2465
  spareHeldFor(relay, now) {
2356
2466
  const reserved = this.chatReservedFor(relay, now);
2357
2467
  if (reserved <= 0) return 0;
2358
- const recent = (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4);
2468
+ const recent = within(this.spent.get(relay) ?? [], now, 6e4);
2359
2469
  const keep = this.limitOf(relay) - this.chatReserveOf(relay, now);
2360
2470
  return recent.length >= keep ? Math.min(reserved, recent[recent.length - keep] + 6e4 - now) : 0;
2361
2471
  }
@@ -6535,6 +6645,8 @@ var ICE_UFRAG = /^[A-Za-z0-9+/]{4,256}$/;
6535
6645
  var ICE_PWD = /^[A-Za-z0-9+/]{22,256}$/;
6536
6646
  var ICE_FOUNDATION = /^[A-Za-z0-9+/]{1,32}$/;
6537
6647
  var CANDIDATE_ADDRESS = /^[A-Za-z0-9.:-]{1,64}$/;
6648
+ var IPV4 = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/;
6649
+ var MDNS_NAME = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\.local$/;
6538
6650
  var CANDIDATE_TYPES$1 = /* @__PURE__ */ new Set([
6539
6651
  "host",
6540
6652
  "srflx",
@@ -6544,6 +6656,24 @@ var CANDIDATE_TYPES$1 = /* @__PURE__ */ new Set([
6544
6656
  var EXTENSION_TOKEN = /^[A-Za-z0-9+/._-]{1,64}$/;
6545
6657
  var DIGITS = /^\d{1,10}$/;
6546
6658
  var MAX_CANDIDATES = 8;
6659
+ function isIpv6(text) {
6660
+ const halves = text.split("::");
6661
+ if (halves.length > 2) return false;
6662
+ const groups = halves.flatMap((half) => half ? half.split(":") : []);
6663
+ const v4 = groups.length > 0 && IPV4.test(groups[groups.length - 1]);
6664
+ if (v4) groups.pop();
6665
+ if (!groups.every((group) => /^[0-9a-fA-F]{1,4}$/.test(group))) return false;
6666
+ const count = groups.length + (v4 ? 2 : 0);
6667
+ return halves.length === 2 ? count < 8 : count === 8;
6668
+ }
6669
+ /**
6670
+ * Whether a contact's candidate address may go into this device's remote description: an IPv4 or IPv6 literal, or the
6671
+ * `<uuid>.local` name a browser gives its host candidate. Any other name would have this side's ICE agent look it up in
6672
+ * DNS, a request the contact chose, whatever the relay policy says.
6673
+ */
6674
+ function isCandidateAddress(address) {
6675
+ return IPV4.test(address) || MDNS_NAME.test(address) || address.includes(":") && isIpv6(address);
6676
+ }
6547
6677
  function uint(value, max) {
6548
6678
  if (!DIGITS.test(value)) return null;
6549
6679
  const n = Number(value);
@@ -6553,7 +6683,8 @@ function uint(value, max) {
6553
6683
  * Parses the part of an `a=candidate:` line that the signal carries
6554
6684
  * (`foundation component transport priority address port typ type [raddr a rport p] [ext value]...`)
6555
6685
  * and serializes it again from the validated parts. Returns `undefined` for a
6556
- * well-formed candidate that is not UDP (skipped) and `null` for anything malformed.
6686
+ * well-formed candidate that is not UDP or not on an address (`isCandidateAddress`), skipped, and `null` for anything
6687
+ * malformed.
6557
6688
  */
6558
6689
  function normalizeCandidate(candidate) {
6559
6690
  if (typeof candidate !== "string" || candidate.length > 512) return null;
@@ -6582,6 +6713,7 @@ function normalizeCandidate(candidate) {
6582
6713
  } else if (!EXTENSION_TOKEN.test(value)) return null;
6583
6714
  }
6584
6715
  if (transport.toLowerCase() !== "udp") return void 0;
6716
+ if (!isCandidateAddress(address) || raddr !== null && !isCandidateAddress(raddr)) return void 0;
6585
6717
  let line = `${foundation} ${component} udp ${priority} ${address} ${port} typ ${type}`;
6586
6718
  if (raddr !== null && rport !== null) line += ` raddr ${raddr} rport ${rport}`;
6587
6719
  return line;
@@ -7024,6 +7156,7 @@ function parseRtcSignal(json) {
7024
7156
  const [type, address, port] = c.split(",");
7025
7157
  if (!CANDIDATE_TYPE_NAME[type] || !SAFE_ADDRESS.test(address ?? "") || !/^\d{1,5}$/.test(port ?? "")) return null;
7026
7158
  }
7159
+ const c = raw.c.filter((candidate) => isCandidateAddress(candidate.split(",")[1]));
7027
7160
  return {
7028
7161
  t: raw.t,
7029
7162
  ts: raw.ts,
@@ -7032,7 +7165,7 @@ function parseRtcSignal(json) {
7032
7165
  p: raw.p,
7033
7166
  f: raw.f,
7034
7167
  s: raw.s,
7035
- c: raw.c
7168
+ c
7036
7169
  };
7037
7170
  }
7038
7171
  function buildDataSdp(signal) {
@@ -8076,6 +8209,10 @@ var LinkSession = class {
8076
8209
  lastCallSignalIn = null;
8077
8210
  /** The `_rtc` signal the last packet that went out carried. */
8078
8211
  rtcSignalOut = null;
8212
+ /** Counts the signals taken back (`setRtcSignal(null)`): each ends an attempt. */
8213
+ rtcAttempt = 0;
8214
+ /** A publish that went out carried a signal of this attempt (since the last take-back). */
8215
+ rtcAttemptOut = false;
8079
8216
  lastRtcSignalIn = null;
8080
8217
  /** The `_rtc` signal the peer's packet carried as last read (null: none), whether or not it was new. */
8081
8218
  peerRtcSignal = null;
@@ -8085,6 +8222,8 @@ var LinkSession = class {
8085
8222
  /** When a read first found the peer's packet advertising with no `_tr` (0: the last packet that said carried one). */
8086
8223
  transportsAbsentSince = 0;
8087
8224
  transportsGone = false;
8225
+ /** The peer's packet carried a `_tr` and the last read found none (`onPeerTransportsUnsaid`). */
8226
+ transportsUnsaid = false;
8088
8227
  running = false;
8089
8228
  /** Stopped without a last packet (`stop(false)`): nothing more goes out. */
8090
8229
  silent = false;
@@ -8113,6 +8252,8 @@ var LinkSession = class {
8113
8252
  fastStepsAfter = 0;
8114
8253
  /** Fast reads still signaling since this side's last new offer or answer went out (`SIGNAL_OUT_READS`). */
8115
8254
  signalReadsLeft = 0;
8255
+ /** Fast reads still signaling while the contact's offer is due (`SIGNAL_DUE_READS`). */
8256
+ dueSignalReadsLeft = 0;
8116
8257
  /** When the last `expectPeer` window ends (or ended): the pace slows down from there step by step. */
8117
8258
  expectUntil = 0;
8118
8259
  /**
@@ -8182,6 +8323,13 @@ var LinkSession = class {
8182
8323
  get peerPresence() {
8183
8324
  return this.presence;
8184
8325
  }
8326
+ /**
8327
+ * The relays took a WebRTC signal of this attempt: its answer, or an earlier one of it. Not an earlier attempt's still
8328
+ * in the packet out: its take-back, a background write, is the first the relays' budget holds back.
8329
+ */
8330
+ get rtcSignalPublished() {
8331
+ return this.rtcAttemptOut;
8332
+ }
8185
8333
  /** The `_rtc` signal the peer's packet carries, as last read: null when it carries none. */
8186
8334
  get peerSignal() {
8187
8335
  return this.peerRtcSignal;
@@ -8268,21 +8416,24 @@ var LinkSession = class {
8268
8416
  setFastPoll(fast, offer = false) {
8269
8417
  this.fastPollUntil = fast ? Date.now() + (offer ? OFFER_LOOK_MS : FAST_POLL_MAX_MS) : 0;
8270
8418
  this.fastStepsAfter = fast && offer ? Date.now() + OFFER_FAST_MS : 0;
8271
- this.signalReadsLeft = 0;
8419
+ this.signalReadsLeft = this.dueSignalReadsLeft = 0;
8272
8420
  if (fast) this.pollNow();
8273
8421
  }
8274
8422
  /**
8275
8423
  * The peer, or its offer, is due any moment: poll fast for `EXPECT_PEER_MS` (never cutting a longer fast window short),
8276
- * then slow down step by step (`nextInterval`) rather than at once.
8424
+ * then slow down step by step (`nextInterval`) rather than at once. `signal`: its offer is due now (it may be out
8425
+ * already): a read goes at once, even inside a window already looking fast, and the first reads that look for it are
8426
+ * signaling (`SIGNAL_DUE_READS`).
8277
8427
  */
8278
- expectPeer(awaited = false) {
8428
+ expectPeer(awaited = false, signal = false) {
8279
8429
  const until = Date.now() + EXPECT_PEER_MS;
8280
8430
  this.expectUntil = Math.max(this.expectUntil, until);
8281
8431
  if (awaited) this.awaitedUntil = Math.max(this.awaitedUntil, until);
8432
+ if (signal) this.dueSignalReadsLeft = 3;
8282
8433
  const stepping = this.fastStepsAfter > 0 && Date.now() >= this.fastStepsAfter;
8283
8434
  if (this.fastStepsAfter) this.fastStepsAfter = Math.max(this.fastStepsAfter, until);
8284
8435
  if (until <= this.fastPollUntil) {
8285
- if (stepping) this.pollNow();
8436
+ if (stepping || signal) this.pollNow();
8286
8437
  return;
8287
8438
  }
8288
8439
  this.fastPollUntil = until;
@@ -8307,7 +8458,7 @@ var LinkSession = class {
8307
8458
  */
8308
8459
  calm() {
8309
8460
  if (this.rtcSignal !== null) return;
8310
- this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = this.lingerUntil = 0;
8461
+ this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = this.lingerUntil = this.dueSignalReadsLeft = 0;
8311
8462
  }
8312
8463
  /** The data link carries chat and services while it is up. */
8313
8464
  setDataLinkOpen(open) {
@@ -8365,6 +8516,10 @@ var LinkSession = class {
8365
8516
  async setRtcSignal(signal, reportFailure = false) {
8366
8517
  if (this.rtcSignal === signal) return;
8367
8518
  this.rtcSignal = signal;
8519
+ if (signal === null) {
8520
+ this.rtcAttempt++;
8521
+ this.rtcAttemptOut = false;
8522
+ }
8368
8523
  if (reportFailure) await this.publish(signal === null);
8369
8524
  else await this.publish(signal === null).catch(() => {});
8370
8525
  if (signal) this.pollNow();
@@ -8514,6 +8669,7 @@ var LinkSession = class {
8514
8669
  }
8515
8670
  async publishOnce(advertise, upkeep = false) {
8516
8671
  const rtcSignal = advertise ? this.rtcSignal : null;
8672
+ const attempt = this.rtcAttempt;
8517
8673
  const started = Date.now();
8518
8674
  let keptMessages;
8519
8675
  try {
@@ -8567,6 +8723,7 @@ var LinkSession = class {
8567
8723
  if (lapsed) this.pollNow();
8568
8724
  }
8569
8725
  this.rtcSignalOut = rtcSignal;
8726
+ if (rtcSignal && attempt === this.rtcAttempt) this.rtcAttemptOut = true;
8570
8727
  traceLink(this.identity.pubKeyZ32, "publish", {
8571
8728
  ms,
8572
8729
  rtc: !!rtcSignal,
@@ -8602,14 +8759,23 @@ var LinkSession = class {
8602
8759
  });
8603
8760
  const started = Date.now();
8604
8761
  let heldBackMs;
8762
+ /** This read is one of `SIGNAL_DUE_READS`: one the budget held back asked nothing of the relays, and is not counted. */
8763
+ let dueRead = false;
8605
8764
  try {
8606
8765
  const pace = this.pace();
8607
- const signal = pace === "fast" && this.rtcSignalOut !== null && (this.fastStepsAfter > 0 || this.signalReadsLeft > 0);
8608
- if (signal && !this.fastStepsAfter) this.signalReadsLeft--;
8766
+ const signalOut = pace === "fast" && this.rtcSignalOut !== null && (this.fastStepsAfter > 0 || this.signalReadsLeft > 0);
8767
+ const signal = signalOut || pace === "fast" && this.dueSignalReadsLeft > 0;
8768
+ if (signalOut) {
8769
+ if (!this.fastStepsAfter) this.signalReadsLeft--;
8770
+ } else if (signal) {
8771
+ this.dueSignalReadsLeft--;
8772
+ dueRead = true;
8773
+ }
8609
8774
  const watch = !signal && this.watching();
8610
8775
  const departed = !signal && Date.now() < this.departedUntil;
8611
8776
  const background = pace === "background" || pace === "connected" || pace === "idle" && !this.active;
8612
8777
  const resume = !signal && !watch && (this.resumeReads || Date.now() < this.awaitedUntil);
8778
+ let unread;
8613
8779
  const packet = await this.transport.resolve(this.peerPubKeyZ32, {
8614
8780
  background,
8615
8781
  urgent: pace === "fast",
@@ -8617,9 +8783,13 @@ var LinkSession = class {
8617
8783
  ...watch && { watch },
8618
8784
  ...departed && { departed },
8619
8785
  ...resume && { resume }
8786
+ }, false).catch((error) => {
8787
+ if (!(error instanceof RelaysFailedError)) throw error;
8788
+ unread = error;
8789
+ return error.kept;
8620
8790
  });
8621
8791
  if (!this.running) return;
8622
- this.discoveryResult("read");
8792
+ this.discoveryResult("read", unread);
8623
8793
  const ms = Date.now() - started;
8624
8794
  const wasOnline = this.presence.online, wasSeen = this.presence.lastPacketAt;
8625
8795
  const readBefore = this.lastReadAt, peerPacketBefore = this.peerPacketAt;
@@ -8668,8 +8838,16 @@ var LinkSession = class {
8668
8838
  this.lastTransportsIn = batch.transports;
8669
8839
  this.events.onPeerTransports?.(batch.transports);
8670
8840
  }
8841
+ if (this.transportsUnsaid) {
8842
+ this.transportsUnsaid = false;
8843
+ this.events.onPeerTransportsUnsaid?.(false);
8844
+ }
8671
8845
  } else if (batch.services !== null && !this.transportsGone) {
8672
8846
  this.transportsAbsentSince ||= Date.now();
8847
+ if (!this.transportsUnsaid && this.lastTransportsIn !== null) {
8848
+ this.transportsUnsaid = true;
8849
+ this.events.onPeerTransportsUnsaid?.(true);
8850
+ }
8673
8851
  if (Date.now() - this.transportsAbsentSince >= 12e4) {
8674
8852
  this.transportsGone = true;
8675
8853
  this.lastTransportsIn = null;
@@ -8694,6 +8872,7 @@ var LinkSession = class {
8694
8872
  first: wasSeen === 0
8695
8873
  });
8696
8874
  if (newSignal) {
8875
+ this.dueSignalReadsLeft = 0;
8697
8876
  this.lastRtcSignalIn = batch.rtcSignal;
8698
8877
  this.events.onRtcSignal?.(batch.rtcSignal, readBefore ? {
8699
8878
  since: readBefore,
@@ -8730,6 +8909,7 @@ var LinkSession = class {
8730
8909
  }
8731
8910
  } finally {
8732
8911
  this.polling = false;
8912
+ if (dueRead && heldBackMs !== void 0) this.dueSignalReadsLeft++;
8733
8913
  if (this.running && this.pollAgain) {
8734
8914
  this.pollAgain = false;
8735
8915
  if (this.pollTimer) clearTimeout(this.pollTimer);
@@ -8870,6 +9050,17 @@ var ANSWER_REFUSED_AFTER_MS = 1e3;
8870
9050
  /** An offer this close to the end of the offerer's attempt is not answered again: the new answer would come too late. */
8871
9051
  var REANSWER_MARGIN_MS = 15e3;
8872
9052
  /**
9053
+ * An answer to this side's offer that comes this long or more after the offer reached the relays was read late (the
9054
+ * relays' request budget held the read back, a restart's first minute), and an attempt that ends after this side made
9055
+ * its answer again (`REANSWERS`) this long after it took an offer that still stands answered one the offerer has not
9056
+ * read yet. Neither says anything about direct connections (`DirectEvidence`): the answering side's ICE gives up about
9057
+ * 30 s after its answer with no reply, so the answer that went in late found nobody there, and the offerer gives up on
9058
+ * the attempt and offers again. Taken for a network that lets nothing through, a group's edge went native on both
9059
+ * sides, and past the native slots members stayed unreachable for the rest of a restart lab (agents#971, 2026-11-03):
9060
+ * of 38 answers read 60 s or more after their offer, 13 connected nothing; of 78 read within 20 s, none failed.
9061
+ */
9062
+ var LATE_ANSWER_MS = 2e4;
9063
+ /**
8873
9064
  * Traces the candidate pair an opened data link uses, by type only (host, srflx, prflx, relay; never an address): two
8874
9065
  * devices on one network should meet host to host. A connection without stats (a test's fake) traces nothing.
8875
9066
  */
@@ -8899,6 +9090,10 @@ var DataLink = class {
8899
9090
  /** Each connection's listeners, and its data channel's (`wrapDataChannel`), dropped once it is closed. */
8900
9091
  ends = /* @__PURE__ */ new WeakMap();
8901
9092
  myOfferTs = 0;
9093
+ /** When this side's offer reached the relays, as far as this link knows (`signalWentOut`). */
9094
+ myOfferOutAt = 0;
9095
+ /** The answer to this side's offer came `LATE_ANSWER_MS` or more after the offer went out. */
9096
+ answerCameLate = false;
8902
9097
  /**
8903
9098
  * An offer or answer of this side's that went without a public candidate came to nothing (both descriptions were
8904
9099
  * exchanged, and no path connected): the next one waits for its STUN servers as long as it takes
@@ -8951,7 +9146,8 @@ var DataLink = class {
8951
9146
  this.setState("offering");
8952
9147
  this.options.setFastPoll(true, true);
8953
9148
  }
8954
- this.myOfferTs = Date.now();
9149
+ this.myOfferTs = this.myOfferOutAt = Date.now();
9150
+ this.answerCameLate = false;
8955
9151
  this.sentLacksPublic = !PUBLIC_CANDIDATE.test(pc.localDescription?.sdp ?? "");
8956
9152
  const signal = {
8957
9153
  t: "o",
@@ -9018,6 +9214,9 @@ var DataLink = class {
9018
9214
  } else if (this.state === "offering" && signal.o === this.myOfferTs && this.pc) {
9019
9215
  this.lastSignalTs = signal.ts;
9020
9216
  const pc = this.pc;
9217
+ const sinceOffer = Date.now() - this.myOfferOutAt;
9218
+ this.answerCameLate = sinceOffer >= LATE_ANSWER_MS;
9219
+ if (this.answerCameLate) traceLink(this.options.myPubKeyZ32, "answer-late", { ms: sinceOffer });
9021
9220
  try {
9022
9221
  this.remoteSdp = buildDataSdp(signal);
9023
9222
  await pc.setRemoteDescription({
@@ -9050,6 +9249,28 @@ var DataLink = class {
9050
9249
  return null;
9051
9250
  }
9052
9251
  }
9252
+ /**
9253
+ * The answer this side's offer is connecting on came `LATE_ANSWER_MS` or more after the offer went out: if it connects
9254
+ * nothing, that says nothing about direct connections, and the link offers again (`GhostLink`'s stall of a group link).
9255
+ */
9256
+ get answerLate() {
9257
+ return this.state === "connecting" && !!this.myOfferTs && this.answerCameLate;
9258
+ }
9259
+ /**
9260
+ * This side answered, and no answer of its went out in this attempt (`signalOut`: the relays' budget held every one
9261
+ * back): the offerer never had one to try (agents#1637). The answering side's twin of `answerLate`.
9262
+ */
9263
+ get answerNotOut() {
9264
+ return this.state === "connecting" && !this.myOfferTs && this.options.signalOut?.() === false;
9265
+ }
9266
+ /**
9267
+ * This attempt, if it ends now without opening, says nothing about direct connections: the answer to this side's offer
9268
+ * was read late (`answerLate`), or this side's answer never went out (`answerNotOut`). An answer made again and still
9269
+ * unread `LATE_ANSWER_MS` on (`failed`) is the same case, seen from the offer that still stands.
9270
+ */
9271
+ get saysNothing() {
9272
+ return this.answerLate || this.answerNotOut;
9273
+ }
9053
9274
  /** The peer connection this link holds now (null when idle): a later one is another attempt. */
9054
9275
  get connection() {
9055
9276
  return this.pc;
@@ -9075,7 +9296,7 @@ var DataLink = class {
9075
9296
  * nothing: the next offer or answer gathers for as long as it takes.
9076
9297
  */
9077
9298
  noteNoPublic(ended) {
9078
- if (ended && (this.myOfferTs || this.answered) && this.sentLacksPublic && this.state === "connecting") this.fullGather = true;
9299
+ if (ended && !this.saysNothing && (this.myOfferTs || this.answered) && this.sentLacksPublic && this.state === "connecting") this.fullGather = true;
9079
9300
  }
9080
9301
  /**
9081
9302
  * What this attempt says about direct connections if it ends now without opening: nothing unless both descriptions
@@ -9083,7 +9304,7 @@ var DataLink = class {
9083
9304
  * candidate, a public port per STUN server, or (for the side that offered) candidates that read as reachable.
9084
9305
  */
9085
9306
  directEvidence() {
9086
- if (this.state !== "connecting" || !this.pc) return null;
9307
+ if (this.state !== "connecting" || !this.pc || this.saysNothing) return null;
9087
9308
  const local = this.pc.localDescription?.sdp ?? "";
9088
9309
  return !PUBLIC_CANDIDATE.test(local) ? "no-public" : symmetricNat(local) ? "symmetric" : this.myOfferTs ? "no-path" : null;
9089
9310
  }
@@ -9104,8 +9325,13 @@ var DataLink = class {
9104
9325
  const answered = this.state === "connecting" ? this.answered : null;
9105
9326
  const left = answered ? CONNECT_TIMEOUT_MS - (Date.now() - answered.at) : 0;
9106
9327
  const givenUp = !!answered && this.options.offerStanding?.(answered.offer.ts) === false;
9107
- const evidence = givenUp ? null : this.directEvidence();
9108
- this.noteNoPublic(!givenUp);
9328
+ const unread = !!answered && answered.again > 0 && Date.now() - answered.at >= 2e4 && this.options.offerStanding?.(answered.offer.ts) === true;
9329
+ if (unread) traceLink(this.options.myPubKeyZ32, "answer-unread", {
9330
+ again: answered.again,
9331
+ sinceMs: Date.now() - answered.at
9332
+ });
9333
+ const evidence = givenUp || unread ? null : this.directEvidence();
9334
+ this.noteNoPublic(!givenUp && !unread);
9109
9335
  if (answered && answered.again < 2 && left > REANSWER_MARGIN_MS && this.options.offerStanding?.(answered.offer.ts)) {
9110
9336
  answered.again++;
9111
9337
  traceLink(this.options.myPubKeyZ32, "reanswer", {
@@ -9261,6 +9487,7 @@ var DataLink = class {
9261
9487
  * counts from here, so the other side has as long to read it as if it had gone out at once.
9262
9488
  */
9263
9489
  signalWentOut() {
9490
+ if (this.state === "offering" && this.myOfferTs) this.myOfferOutAt = Date.now();
9264
9491
  if (this.pc && this.connectTimer && this.state !== "open" && this.state !== "idle") this.startAttemptTimer(this.pc);
9265
9492
  }
9266
9493
  clearTimers() {
@@ -9272,7 +9499,8 @@ var DataLink = class {
9272
9499
  this.clearTimers();
9273
9500
  const pc = this.pc;
9274
9501
  this.pc = null;
9275
- this.myOfferTs = 0;
9502
+ this.myOfferTs = this.myOfferOutAt = 0;
9503
+ this.answerCameLate = false;
9276
9504
  this.remoteSdp = null;
9277
9505
  if (!pc) return false;
9278
9506
  this.closeConnection(pc);
@@ -11846,7 +12074,10 @@ var MAX_ATTEMPTS = 8;
11846
12074
  var SEQUENCE_BLOCK = 64;
11847
12075
  /** The wait before publication attempt `attempts + 1` of a text, or of a receipt the contact still asks for. */
11848
12076
  var backoff = (attempts) => Math.min(6e4, 4e3 * 2 ** attempts);
11849
- /** The contact's mailbox is read this often while either side is DHT-only, and otherwise… */
12077
+ /**
12078
+ * The contact's mailbox is read this often while this side is DHT-only (a contact that chose it is read at the chat's
12079
+ * pace: `ACTIVE_DHT_POLL_MS` open, or on a daemon, `peerDhtPollMs`), and otherwise…
12080
+ */
11850
12081
  var DHT_POLL_MS = 4e3;
11851
12082
  var STREAM_POLL_MS = 3e4;
11852
12083
  /**
@@ -12205,6 +12436,7 @@ var DhtDelivery = class DhtDelivery {
12205
12436
  this.lastPublish = 0;
12206
12437
  this.leavingUntil = mode === "stream" ? Date.now() + LEAVING_DHT_FAST_MS : 0;
12207
12438
  if (mode === "dht") this.signalReads = 0;
12439
+ else if (this.state.peerMode === "dht") this.signalReads = 3;
12208
12440
  this.changed();
12209
12441
  });
12210
12442
  this.tick();
@@ -13004,6 +13236,7 @@ var DhtDelivery = class DhtDelivery {
13004
13236
  if (isDiscoveryBudgetError(error)) this.readHeld(error.retryInMs);
13005
13237
  else if (readAt >= this.networkBackAt) this.errors.read = `Could not read DHT delivery: ${error instanceof Error ? error.message : String(error)}`;
13006
13238
  }
13239
+ if (signal && this.readHeldUntil > 0) this.signalReads++;
13007
13240
  if (this.state.peerMode !== "dht") this.signalReads = 0;
13008
13241
  await this.publishOnTick();
13009
13242
  this.changed();
@@ -13044,7 +13277,8 @@ var DhtDelivery = class DhtDelivery {
13044
13277
  if (this.mode === "dht" || this.state.peerMode === "dht" && now < this.leavingUntil || now < this.fastUntil) return DHT_POLL_MS;
13045
13278
  if (this.live) return LIVE_POLL_MS;
13046
13279
  if (this.state.pending && this.state.pending.expires > now) return DHT_POLL_MS;
13047
- return this.active ? ACTIVE_DHT_POLL_MS : STREAM_POLL_MS;
13280
+ if (this.active) return ACTIVE_DHT_POLL_MS;
13281
+ return this.state.peerMode === "dht" && this.options.peerDhtPollMs ? Math.min(this.options.peerDhtPollMs, STREAM_POLL_MS) : STREAM_POLL_MS;
13048
13282
  }
13049
13283
  /**
13050
13284
  * How long ago this side's invite was made (or joined), while nobody used it (or its inviter never answered,
@@ -15258,23 +15492,24 @@ function boundVerifiedIdentity(v) {
15258
15492
  if (!isInt$2(v.expiresAt)) throw new Error("Provider returned an invalid expiry");
15259
15493
  out.expiresAt = v.expiresAt;
15260
15494
  }
15261
- if (v.display) {
15262
- const d = v.display;
15263
- const display = {
15264
- source: clean$1(d.source, 120) ?? "Self-described",
15265
- fetchedAt: isInt$2(d.fetchedAt) ? d.fetchedAt : nowSeconds()
15266
- };
15267
- const name = clean$1(d.name, 64);
15268
- if (name) display.name = name;
15269
- if (typeof d.avatar === "string" && d.avatar.length <= 49152 && /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]+$/.test(d.avatar)) display.avatar = d.avatar;
15270
- if (typeof d.url === "string" && d.url.length <= 512) try {
15271
- const u = new URL(d.url);
15272
- if (u.protocol === "https:" && !u.username && !u.password) display.url = u.href;
15273
- } catch {}
15274
- out.display = display;
15275
- }
15495
+ if (v.display) out.display = boundIdentityDisplay(v.display);
15276
15496
  return out;
15277
15497
  }
15498
+ /** Bounds a provider's public name/picture (from a proof or `lookupDisplay`): a name with nothing visible left is dropped. */
15499
+ function boundIdentityDisplay(d) {
15500
+ const display = {
15501
+ source: clean$1(d.source, 120) ?? "Self-described",
15502
+ fetchedAt: isInt$2(d.fetchedAt) ? d.fetchedAt : nowSeconds()
15503
+ };
15504
+ const name = clean$1(d.name, 64);
15505
+ if (name) display.name = name;
15506
+ if (typeof d.avatar === "string" && d.avatar.length <= 49152 && /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]+$/.test(d.avatar)) display.avatar = d.avatar;
15507
+ if (typeof d.url === "string" && d.url.length <= 512) try {
15508
+ const u = new URL(d.url);
15509
+ if (u.protocol === "https:" && !u.username && !u.password) display.url = u.href;
15510
+ } catch {}
15511
+ return display;
15512
+ }
15278
15513
  var emptyIdentityLedger = () => ({
15279
15514
  challenges: [],
15280
15515
  shared: [],
@@ -15320,6 +15555,24 @@ var IdentityCheckUnavailable = class extends Error {
15320
15555
  var IDENTITY_CHECK_UNAVAILABLE = "Your contact's app could not check it. Try again later.";
15321
15556
  var TOO_MANY_RECEIVED = "Your contact keeps too many identities from you already";
15322
15557
  var peerError = (e) => e instanceof IdentityCheckUnavailable ? IDENTITY_CHECK_UNAVAILABLE : shortError(e);
15558
+ var UNSUPPORTED_KIND = "Your contact's app cannot verify this kind of identity yet";
15559
+ var NOT_IN_PROFILE = "That identity is no longer in your profile";
15560
+ var CONTACT_REFUSED = "Your contact could not verify it";
15561
+ var EXPIRED = "The proof has expired";
15562
+ /** The refusals a contact's app writes itself (onRequest, onPresent): the only words of its `idp-result` kept as they came. */
15563
+ var CONTACT_REFUSALS = /* @__PURE__ */ new Set([
15564
+ UNSUPPORTED_KIND,
15565
+ IDENTITY_CHECK_UNAVAILABLE,
15566
+ TOO_MANY_RECEIVED,
15567
+ REVOKED,
15568
+ EXPIRED
15569
+ ]);
15570
+ /**
15571
+ * Why a share of mine was not accepted, as this app may say it under my identity: one of the refusals above or my own
15572
+ * app's line; else nothing past "not verified". Any other words came from the contact (a ledger kept before this check)
15573
+ * and would read as this app's own notice.
15574
+ */
15575
+ var identityRefusal = (error) => typeof error === "string" && (CONTACT_REFUSALS.has(error) || error === NOT_IN_PROFILE) ? error : void 0;
15323
15576
  /**
15324
15577
  * The `idp-*` exchange of one conversation. Frames (all JSON, additive, over the paired channel,
15325
15578
  * only when both offers carry `identity-proof/1`):
@@ -15335,6 +15588,8 @@ var IdentityExchange = class {
15335
15588
  options;
15336
15589
  peerProviders;
15337
15590
  requested = /* @__PURE__ */ new Set();
15591
+ /** The nonces of the presentations in their provider's check now. */
15592
+ checking = /* @__PURE__ */ new Set();
15338
15593
  constructor(options) {
15339
15594
  this.options = options;
15340
15595
  }
@@ -15424,19 +15679,24 @@ var IdentityExchange = class {
15424
15679
  }
15425
15680
  /** Stop sharing here. The contact is told (now or on reconnect); a copy it kept cannot be erased. */
15426
15681
  async withdraw(id, connected) {
15427
- const s = this.shared(id);
15682
+ let s = this.shared(id);
15428
15683
  if (!s || s.status === "withdrawn") return;
15429
15684
  this.requested.delete(id);
15430
15685
  if (s.status === "queued") {
15431
- await this.options.storage.update((l) => this.log({
15432
- ...l,
15433
- shared: l.shared.filter((x) => x.id !== id)
15434
- }, {
15435
- type: "unsent",
15436
- side: "mine",
15437
- proof: id
15438
- }));
15439
- return;
15686
+ let answered;
15687
+ await this.options.storage.update((l) => {
15688
+ answered = l.shared.find((x) => x.id === id && x.status === "pending");
15689
+ return answered ? l : this.log({
15690
+ ...l,
15691
+ shared: l.shared.filter((x) => x.id !== id)
15692
+ }, {
15693
+ type: "unsent",
15694
+ side: "mine",
15695
+ proof: id
15696
+ });
15697
+ });
15698
+ if (!answered) return;
15699
+ s = answered;
15440
15700
  }
15441
15701
  await this.setShared({
15442
15702
  ...s,
@@ -15534,12 +15794,21 @@ var IdentityExchange = class {
15534
15794
  return;
15535
15795
  case "idp-request": return await this.onRequest(id, frame.provider);
15536
15796
  case "idp-challenge": return await this.onChallenge(id, frame.nonce, frame.issuedAt);
15537
- case "idp-present": return await this.onPresent(frame);
15797
+ case "idp-present": {
15798
+ const nonce = typeof frame.nonce === "string" ? frame.nonce : "";
15799
+ if (this.checking.has(nonce)) throw new Error("Unknown or reused identity challenge");
15800
+ this.checking.add(nonce);
15801
+ try {
15802
+ return await this.onPresent(frame);
15803
+ } finally {
15804
+ this.checking.delete(nonce);
15805
+ }
15806
+ }
15538
15807
  case "idp-result": {
15539
15808
  const s = id ? this.shared(id) : void 0;
15540
15809
  if (!s || s.status !== "pending") return;
15541
15810
  const ok = frame.ok === true;
15542
- const error = ok ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
15811
+ const error = ok ? void 0 : typeof frame.error === "string" && CONTACT_REFUSALS.has(frame.error) ? frame.error : CONTACT_REFUSED;
15543
15812
  const entry = {
15544
15813
  ...s,
15545
15814
  status: ok ? "accepted" : "rejected",
@@ -15547,7 +15816,14 @@ var IdentityExchange = class {
15547
15816
  error
15548
15817
  };
15549
15818
  const replaced = (x) => ok && x.status === "accepted" && x.provider === s.provider && x.subject === s.subject;
15550
- await this.options.storage.update((l) => this.log({
15819
+ await this.options.storage.update((l) => l.shared.filter((x) => x.id !== s.id && replaced(x)).reduce((out, x) => this.log(out, {
15820
+ type: "stopped",
15821
+ side: "mine",
15822
+ proof: x.id,
15823
+ provider: x.provider,
15824
+ subject: x.subject,
15825
+ reason: "withdrawn"
15826
+ }), this.log({
15551
15827
  ...l,
15552
15828
  shared: [...l.shared.filter((x) => x.id !== s.id).map((x) => replaced(x) ? {
15553
15829
  ...x,
@@ -15560,7 +15836,7 @@ var IdentityExchange = class {
15560
15836
  proof: s.id,
15561
15837
  ok,
15562
15838
  error
15563
- }));
15839
+ })));
15564
15840
  return;
15565
15841
  }
15566
15842
  case "idp-withdraw": {
@@ -15610,11 +15886,12 @@ var IdentityExchange = class {
15610
15886
  async onRequest(id, provider) {
15611
15887
  if (!id) return;
15612
15888
  if (typeof provider !== "string" || !this.options.providers().includes(provider)) {
15889
+ const error = UNSUPPORTED_KIND;
15613
15890
  this.send({
15614
15891
  t: "idp-result",
15615
15892
  id,
15616
15893
  ok: false,
15617
- error: "Your contact's app cannot verify this kind of identity yet"
15894
+ error
15618
15895
  });
15619
15896
  return;
15620
15897
  }
@@ -15653,7 +15930,7 @@ var IdentityExchange = class {
15653
15930
  this.requested.delete(id);
15654
15931
  const local = await this.options.localProof(id);
15655
15932
  if (!local) {
15656
- const error = "That identity is no longer in your profile";
15933
+ const error = NOT_IN_PROFILE;
15657
15934
  await this.setShared({
15658
15935
  ...s,
15659
15936
  status: "rejected",
@@ -15670,12 +15947,24 @@ var IdentityExchange = class {
15670
15947
  }
15671
15948
  const scope = this.options.scope();
15672
15949
  const sig = signIdentityPresentation(local.seed, id, scope, nonce, issuedAt);
15673
- await this.setShared({
15674
- ...s,
15675
- status: "pending",
15676
- at: this.now(),
15677
- error: void 0
15950
+ let stopped = false;
15951
+ await this.options.storage.update((l) => {
15952
+ const x = l.shared.find((y) => y.id === id);
15953
+ if (!x || x.status !== "queued" && x.status !== "pending") {
15954
+ stopped = true;
15955
+ return l;
15956
+ }
15957
+ return {
15958
+ ...l,
15959
+ shared: [...l.shared.filter((y) => y.id !== id), {
15960
+ ...x,
15961
+ status: "pending",
15962
+ at: this.now(),
15963
+ error: void 0
15964
+ }]
15965
+ };
15678
15966
  });
15967
+ if (stopped) return;
15679
15968
  this.send({
15680
15969
  t: "idp-present",
15681
15970
  nonce,
@@ -15699,6 +15988,7 @@ var IdentityExchange = class {
15699
15988
  let error;
15700
15989
  /** The same, as this side's own timeline says it. */
15701
15990
  let reason;
15991
+ /** Its owner withdrew the proof while this check ran: no result goes out (see below). */
15702
15992
  let withdrawn = false;
15703
15993
  try {
15704
15994
  const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
@@ -15708,7 +15998,7 @@ var IdentityExchange = class {
15708
15998
  if (!verifyIdentityPresentation(binding.key, sig, id, scope, nonce, issuedAt)) throw new Error("The proof key did not sign this conversation's challenge");
15709
15999
  if (binding.issuedAt > now + 300) throw new Error("The proof is dated in the future");
15710
16000
  const result = boundVerifiedIdentity(await this.options.verify(statement, evidence));
15711
- if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error("The proof has expired");
16001
+ if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error(EXPIRED);
15712
16002
  if (await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);
15713
16003
  verified = result;
15714
16004
  } catch (e) {
@@ -15719,6 +16009,11 @@ var IdentityExchange = class {
15719
16009
  const challenge = challengeOf(l);
15720
16010
  if (!challenge) throw new Error("Unknown or reused identity challenge");
15721
16011
  const challenges = l.challenges.filter((c) => c.nonce !== nonce);
16012
+ withdrawn = !!challenge.withdrawn;
16013
+ if (withdrawn && (challenges.some((c) => c.id === challenge.id && !c.withdrawn) || l.received.some((r) => r.id === challenge.id && r.status !== "withdrawn" && r.status !== "revoked"))) return {
16014
+ ...l,
16015
+ challenges
16016
+ };
15722
16017
  const subject = verified?.subject;
15723
16018
  if (verified && revokedHere(l.received, id)) {
15724
16019
  verified = void 0;
@@ -15743,7 +16038,6 @@ var IdentityExchange = class {
15743
16038
  ...logged,
15744
16039
  challenges
15745
16040
  };
15746
- withdrawn = !!challenge.withdrawn;
15747
16041
  const record = {
15748
16042
  id,
15749
16043
  binding,
@@ -15756,11 +16050,18 @@ var IdentityExchange = class {
15756
16050
  checkedAt: now,
15757
16051
  status: withdrawn ? "withdrawn" : "verified"
15758
16052
  };
15759
- const kept = {
16053
+ const kept = l.received.filter((r) => r.id !== id && !received.includes(r) && r.binding.provider === binding.provider && r.verified.subject === subject && r.status !== "withdrawn" && r.status !== "revoked").reduce((out, r) => this.log(out, {
16054
+ type: "stopped",
16055
+ side: "theirs",
16056
+ proof: r.id,
16057
+ provider: r.binding.provider,
16058
+ subject: r.verified.subject,
16059
+ reason: "withdrawn"
16060
+ }), {
15760
16061
  ...logged,
15761
16062
  challenges,
15762
16063
  received: [...received, record]
15763
- };
16064
+ });
15764
16065
  return withdrawn ? this.log(kept, {
15765
16066
  type: "stopped",
15766
16067
  side: "theirs",
@@ -18682,6 +18983,15 @@ function decodeFileData(message) {
18682
18983
  data: message.subarray(body)
18683
18984
  };
18684
18985
  }
18986
+ /**
18987
+ * Why a received file could not be stored, as its record says it. A storage with no room left is told by the error's
18988
+ * name, `QuotaExceededError` (IndexedDB's, the OPFS worker's, the CLI's), never by its words: each storage words it
18989
+ * its own way, and Chromium's own has no message at all. The app reads that name as "no room here" (errorText.ts).
18990
+ */
18991
+ function storeFailure(error) {
18992
+ const message = (error instanceof Error ? error.message : String(error)).trim();
18993
+ return `Could not store the file: ${error?.name === "QuotaExceededError" && !message.startsWith("QuotaExceededError") ? `QuotaExceededError${message ? `: ${message}` : ""}` : message}`;
18994
+ }
18685
18995
  /** What a refusal means to the sender's person. */
18686
18996
  function refusalText(why, room) {
18687
18997
  switch (why) {
@@ -19171,7 +19481,7 @@ var ChatFiles = class {
19171
19481
  this.armNudge(entry);
19172
19482
  }, (error) => {
19173
19483
  incoming.starting = false;
19174
- this.end(entry, "failed", `Could not store the file: ${error instanceof Error ? error.message : String(error)}`);
19484
+ this.end(entry, "failed", storeFailure(error));
19175
19485
  this.send({
19176
19486
  t: "pf-refuse",
19177
19487
  id: entry.record.id,
@@ -19465,7 +19775,7 @@ var ChatFiles = class {
19465
19775
  if (incoming.stored - incoming.checkpointed >= FILE_LIMITS.checkpointBytes) await this.checkpointNow(entry);
19466
19776
  }).catch((error) => {
19467
19777
  if (transferEnded(record)) return;
19468
- this.end(entry, "failed", `Could not store the file: ${error instanceof Error ? error.message : String(error)}`);
19778
+ this.end(entry, "failed", storeFailure(error));
19469
19779
  target.then((t) => t.discard()).catch(() => {});
19470
19780
  this.send({
19471
19781
  t: "pf-refuse",
@@ -19764,6 +20074,28 @@ var ChatFiles = class {
19764
20074
  });
19765
20075
  this.startNext();
19766
20076
  }
20077
+ /**
20078
+ * An offer taken here whose record or message the host could not store: refused, so its sender does not count it
20079
+ * delivered and keeps its Retry, and forgotten, so that retry is a new offer here. Nothing of it is reported changed
20080
+ * (there is nothing to write it to); what was stored of it is removed.
20081
+ */
20082
+ refuse(id, why) {
20083
+ const entry = this.entries.get(key("in", id));
20084
+ if (!entry || transferEnded(entry.record)) return;
20085
+ this.entries.delete(key("in", id));
20086
+ const incoming = entry.in;
20087
+ entry.record.state = "failed";
20088
+ clearTimeout(incoming.timer);
20089
+ clearTimeout(incoming.ackTimer);
20090
+ incoming.dropped = true;
20091
+ incoming.writing.then(() => incoming.target?.then((t) => t.discard())).catch(() => {});
20092
+ this.send({
20093
+ t: "pf-refuse",
20094
+ id,
20095
+ why
20096
+ });
20097
+ this.startNext();
20098
+ }
19767
20099
  pause(direction, id) {
19768
20100
  const entry = this.entry(direction, id), { record } = entry;
19769
20101
  if (transferEnded(record) || record.state === "verifying" || record.state === "paused" && record.pausedBy === "me") return;
@@ -21431,6 +21763,13 @@ function pairedMessageFits(ts, m, reply, forwarded, card) {
21431
21763
  return pairedMessageFrame("A".repeat(22), ts, m, void 0, reply, forwarded, card).length <= SESSION_FRAME_MAX;
21432
21764
  }
21433
21765
  /**
21766
+ * The `paired-edit` frame of this edit fits a session, as `pairedMessageFits` says of a text's: an edit within 16 KiB
21767
+ * can pass it the same way, and the contact's session ends on it each time it is said again.
21768
+ */
21769
+ function pairedEditFits(edit) {
21770
+ return editFrame(edit).length <= SESSION_FRAME_MAX;
21771
+ }
21772
+ /**
21434
21773
  * A native descriptor from the contact's capability record against the one known (a session's, or an older record's).
21435
21774
  * The record carries only how to dial, never an address: the Iroh endpoint id and the relay it is homed on, the
21436
21775
  * HyperDHT key and the relay a browser's goes through. For the same endpoint, a known Iroh descriptor keeps its
@@ -21758,14 +22097,20 @@ var GhostLink = class {
21758
22097
  /** A signal ready to go: on the live session during a switch to WebRTC, in this side's packet otherwise. */
21759
22098
  signalOut(signed, report) {
21760
22099
  if (this.switcher?.pending?.choices.includes("webrtc/1") && this.channel && this.paired?.state.status === "ready") {
21761
- if (signed) this.channel.send(JSON.stringify({
21762
- t: "paired-rtc",
21763
- signal: signed
21764
- }));
22100
+ if (signed) {
22101
+ this.channel.send(JSON.stringify({
22102
+ t: "paired-rtc",
22103
+ signal: signed
22104
+ }));
22105
+ this.rtcViaChannel = true;
22106
+ }
21765
22107
  return;
21766
22108
  }
22109
+ if (!signed) this.rtcViaChannel = false;
21767
22110
  this.session.setRtcSignal(signed, !!this.options.params.profile).catch(report);
21768
22111
  }
22112
+ /** A WebRTC signal of this attempt went over the authenticated channel (a migration), not the relays. */
22113
+ rtcViaChannel = false;
21769
22114
  /** This app is going away (`depart`): no more dials. */
21770
22115
  leaving = false;
21771
22116
  /** `resume` still to act on: the first dial after the start goes to it, and a native one is knocked on. */
@@ -21820,6 +22165,7 @@ var GhostLink = class {
21820
22165
  save: options.dht.save,
21821
22166
  pollMs: options.dht.pollMs,
21822
22167
  firstControlAfterMs: options.dht.firstControlAfterMs,
22168
+ ...options.dht.peerDhtPollMs && { peerDhtPollMs: options.dht.peerDhtPollMs },
21823
22169
  ...backsOff && { inviteMadeAt: options.madeAt ?? Date.now() },
21824
22170
  capsRev: options.dht.capsRev,
21825
22171
  peerCapsRev: options.dht.peerCapsRev,
@@ -21984,6 +22330,9 @@ var GhostLink = class {
21984
22330
  onPeerClock: (packetAt, readBefore, readAt) => events.onPeerClock?.(packetAt, readBefore, readAt),
21985
22331
  onPeerTransports: (value) => this.peerPacketTransports(value),
21986
22332
  onPeerTransportsGone: () => this.peerPacketTransportsGone(),
22333
+ onPeerTransportsUnsaid: (unsaid) => {
22334
+ if (options.packetTransports && !this.stopped) events.onPacketTransportsUnsaid?.(unsaid);
22335
+ },
21987
22336
  onDiscoveryError: (error) => events.onDiscoveryError?.(error),
21988
22337
  onStatus: (status) => events.onStatus?.(status),
21989
22338
  onPoll: (poll) => events.onPoll?.(poll)
@@ -22035,6 +22384,7 @@ var GhostLink = class {
22035
22384
  offerStanding: (ts) => !this.leaving && !this.stopped && !this.streamBlocked && this.peerOfferTs() === ts,
22036
22385
  onAnswerReplaced: () => this.redial(),
22037
22386
  onDirect: (evidence) => events.onDirectEvidence?.(evidence),
22387
+ signalOut: () => this.rtcViaChannel || this.session.rtcSignalPublished,
22038
22388
  onAnswersRefused: () => this.answersRefused(),
22039
22389
  onOpen: (channel) => {
22040
22390
  if (this.streamBlocked || this.keyStopped) {
@@ -22051,7 +22401,9 @@ var GhostLink = class {
22051
22401
  if (this.activeBinding) return;
22052
22402
  const wasLive = !!this.channel && this.paired?.state.status === "ready";
22053
22403
  this.detach();
22054
- if (wasLive) this.peerLost("closed");
22404
+ if (!wasLive) return;
22405
+ if (this.dataLink.state === "idle" && this.awaitsContactDial()) this.resumeAfterAbsence();
22406
+ this.peerLost("closed");
22055
22407
  },
22056
22408
  onState: (state) => {
22057
22409
  const was = this.lastDataLinkState;
@@ -22082,6 +22434,12 @@ var GhostLink = class {
22082
22434
  if (this.offered?.epoch === this.connectionEpoch) this.scheduleRace(this.offered.epoch, this.offered.at);
22083
22435
  if (options.packetTransports) setTimeout(() => {
22084
22436
  if (this.answeredAt !== answeredAt || this.channel || this.stopped || this.dataLink.state !== "connecting") return;
22437
+ if (this.dataLink.answerLate) {
22438
+ traceLink(this.myPubKeyZ32, "rtc-stalled", { late: true });
22439
+ this.dataLink.abandon();
22440
+ this.redial();
22441
+ return;
22442
+ }
22085
22443
  traceLink(this.myPubKeyZ32, "rtc-stalled", {});
22086
22444
  events.onRtcStalled?.();
22087
22445
  }, RACE_ANSWERED_MS);
@@ -22193,7 +22551,7 @@ var GhostLink = class {
22193
22551
  const tracker = this.tracker;
22194
22552
  if (!tracker || tracker.done) return;
22195
22553
  if (state === "answering") tracker.offerReceived();
22196
- else if (state === "connecting" && was === "offering") tracker.answerReceived();
22554
+ else if ((state === "connecting" || state === "open") && was === "offering") tracker.answerReceived();
22197
22555
  else if (state === "idle") {
22198
22556
  if (was === "offering") tracker.failed("timeout", true);
22199
22557
  else if (was === "answering" || was === "connecting") tracker.failed("transport", true);
@@ -22268,7 +22626,7 @@ var GhostLink = class {
22268
22626
  traceLink(this.myPubKeyZ32, "unblocked", { held: !!this.heldSignal });
22269
22627
  this.autoConnectFailures = 0;
22270
22628
  this.lastAutoConnectAt = 0;
22271
- this.session.expectPeer();
22629
+ this.session.expectPeer(false, true);
22272
22630
  const held = this.heldSignal;
22273
22631
  this.heldSignal = null;
22274
22632
  if (held) this.handleRtcSignal(held.signal, held.sight);
@@ -24572,6 +24930,7 @@ var GhostLink = class {
24572
24930
  if (this.channel && this.isDataLinkOpen) {
24573
24931
  if (!this.supportsEdits) return "Your contact's app does not show edits yet";
24574
24932
  if (!edit.rm && !validEditNumber(edit.e) && !(edit.sc && this.supportsStatusCards)) return "Your contact's app takes no more edits of this message";
24933
+ if (!pairedEditFits(edit)) return PAIRED_FRAME_TOO_LARGE;
24575
24934
  try {
24576
24935
  this.channel.send(editFrame(edit));
24577
24936
  return null;
@@ -26273,6 +26632,7 @@ var GhostLink = class {
26273
26632
  if (!this.candidate) {
26274
26633
  this.cancelCandidate();
26275
26634
  this.switcher.stop();
26635
+ this.transitionTarget = this.transitionError = void 0;
26276
26636
  }
26277
26637
  this.activeBinding = void 0;
26278
26638
  this.paired?.stop();
@@ -26681,6 +27041,54 @@ var HEIF_METADATA_ITEMS = /* @__PURE__ */ new Set([
26681
27041
  "mime",
26682
27042
  "uri "
26683
27043
  ]);
27044
+ /**
27045
+ * Item properties that only draw the picture: the codec's configuration (HEVC, AV1, AVC, VVC, JPEG, JPEG 2000,
27046
+ * uncompressed and its components, layered HEVC with its operating points and layers), the size (`ispe`), the bits
27047
+ * per channel (`pixi`), colour (`colr`, its light levels and display volumes `clli`, `mdcv`, `cclv`, `amve`), geometry
27048
+ * (`irot`, `imir`, `clap`, `pasp`, `rloc`, `iscl`), what an auxiliary image is (`auxC`: alpha, depth, a gain map), and
27049
+ * AV1's operating point and layers (`a1op`, `a1lx`).
27050
+ */
27051
+ var HEIF_DRAWS = /* @__PURE__ */ new Set([
27052
+ "hvcC",
27053
+ "av1C",
27054
+ "avcC",
27055
+ "vvcC",
27056
+ "jpgC",
27057
+ "j2kH",
27058
+ "uncC",
27059
+ "cmpd",
27060
+ "lhvC",
27061
+ "oinf",
27062
+ "tols",
27063
+ "lsel",
27064
+ "ispe",
27065
+ "pixi",
27066
+ "colr",
27067
+ "clli",
27068
+ "mdcv",
27069
+ "cclv",
27070
+ "amve",
27071
+ "irot",
27072
+ "imir",
27073
+ "clap",
27074
+ "pasp",
27075
+ "rloc",
27076
+ "iscl",
27077
+ "auxC",
27078
+ "a1op",
27079
+ "a1lx"
27080
+ ]);
27081
+ /** Item properties about the picture: its user description (name, description, tags), accessibility text, creation and modification times, TAI clock and timestamp; and `free`, `skip`. */
27082
+ var HEIF_ABOUT = /* @__PURE__ */ new Set([
27083
+ "udes",
27084
+ "altt",
27085
+ "crtt",
27086
+ "mdft",
27087
+ "taic",
27088
+ "itai",
27089
+ "free",
27090
+ "skip"
27091
+ ]);
26684
27092
  function boxes$1(b, start, end) {
26685
27093
  const found = [];
26686
27094
  for (let at = start; at < end;) {
@@ -26732,8 +27140,16 @@ function stripHeif(b) {
26732
27140
  check$1(at + 6 <= infe.end);
26733
27141
  if (HEIF_METADATA_ITEMS.has(text$1(b, at + 2, 4))) metadata.add(id);
26734
27142
  }
26735
- /** `free` and `skip` boxes, at the top and in `meta`: their bodies go as zeros. */
26736
- const space = [...top, ...children].filter((box) => box.type === "free" || box.type === "skip");
27143
+ const iprp = one("iprp"), properties = [];
27144
+ if (iprp) {
27145
+ const held = boxes$1(b, iprp.body, iprp.end);
27146
+ const ipco = held.filter((box) => box.type === "ipco");
27147
+ check$1(ipco.length === 1 && held.every((box) => box.type === "ipco" || box.type === "ipma"));
27148
+ properties.push(...boxes$1(b, ipco[0].body, ipco[0].end));
27149
+ check$1(properties.every((box) => HEIF_DRAWS.has(box.type) || HEIF_ABOUT.has(box.type)));
27150
+ }
27151
+ /** `free` and `skip` boxes, at the top and in `meta`, and the properties about the picture: their bodies go as zeros. */
27152
+ const space = [...[...top, ...children].filter((box) => box.type === "free" || box.type === "skip"), ...properties.filter((box) => HEIF_ABOUT.has(box.type))];
26737
27153
  const out = b.slice();
26738
27154
  const version = b[iloc.body];
26739
27155
  check$1(version <= 2);
@@ -27071,7 +27487,9 @@ var VIDEO_METADATA_LIMITS = {
27071
27487
  /** The most top-level boxes walked (a fragmented MP4 has two per fragment). */
27072
27488
  maxBoxes: 1e5,
27073
27489
  /** Bytes read first to tell a video from another file. */
27074
- headBytes: 64
27490
+ headBytes: 64,
27491
+ /** Bytes read at once for a box's header or a small box, so the next headers and `moof`s are read with it. */
27492
+ readAhead: 65536
27075
27493
  };
27076
27494
  /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
27077
27495
  var NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
@@ -27412,8 +27830,8 @@ function selfContained(b, minf) {
27412
27830
  }
27413
27831
  /**
27414
27832
  * `moov` with its metadata boxes emptied and its headers' times zeroed, read whole: whether it has a video track, the
27415
- * byte ranges of its metadata and timecode tracks' samples (zeroed by the caller where they are), whether a metadata
27416
- * track has any, and every track's sample table.
27833
+ * byte ranges of its metadata and timecode tracks' samples (zeroed by the caller where they are), whether it has a
27834
+ * metadata or timecode track, and every track's sample table.
27417
27835
  */
27418
27836
  function stripMoov(b) {
27419
27837
  let video = false, fragmented = false, metadata = false;
@@ -27454,11 +27872,12 @@ function stripMoov(b) {
27454
27872
  tables.push(stbl);
27455
27873
  if (handler === "meta") {
27456
27874
  check(selfContained(b, minf));
27457
- const ranges = sampleRanges(b, stbl);
27458
- metadata ||= ranges.length > 0;
27459
- for (const range of ranges) zeroed.push(range);
27460
- } else if (handler === "tmcd" && selfContained(b, minf)) for (const range of sampleRanges(b, stbl)) zeroed.push(range);
27461
- else check(HANDLERS.has(handler));
27875
+ metadata = true;
27876
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
27877
+ } else if (handler === "tmcd" && selfContained(b, minf)) {
27878
+ metadata = true;
27879
+ for (const range of sampleRanges(b, stbl)) zeroed.push(range);
27880
+ } else check(HANDLERS.has(handler));
27462
27881
  if (handler === "vide") video = true;
27463
27882
  if (VISUAL.has(handler)) zeroCompressorNames(b, stbl);
27464
27883
  emptyWithin(b, box.body, box.end);
@@ -27484,6 +27903,26 @@ function meets(ranges, start, end) {
27484
27903
  }
27485
27904
  return low < ranges.length && ranges[low][0] < end;
27486
27905
  }
27906
+ /**
27907
+ * `source` read a window at a time: a read that fits in `readAhead` bytes reads that many from where it starts, and
27908
+ * the reads after it within them (the next boxes' headers, a fragment's `moof`) are served from it, as copies (they
27909
+ * are changed in place). A Blob's read costs about the same whatever its size, so a fragment costs one, not three.
27910
+ */
27911
+ function readingAhead(source) {
27912
+ let start = 0, window = /* @__PURE__ */ new Uint8Array(0);
27913
+ return {
27914
+ size: source.size,
27915
+ async read(offset, length) {
27916
+ const end = start + window.length;
27917
+ if (offset < start || offset + length > end && end < source.size) {
27918
+ if (length > VIDEO_METADATA_LIMITS.readAhead) return source.read(offset, length);
27919
+ start = offset;
27920
+ window = await source.read(offset, VIDEO_METADATA_LIMITS.readAhead);
27921
+ }
27922
+ return window.slice(offset - start, offset - start + length);
27923
+ }
27924
+ };
27925
+ }
27487
27926
  /** A whole box's header in the file at `at`, read from it; undefined where none fits (bytes after the last box). */
27488
27927
  async function headerAt(source, at) {
27489
27928
  const head = await source.read(at, 16);
@@ -27538,7 +27977,8 @@ async function withoutVideoMetadata(source, mime) {
27538
27977
  * the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
27539
27978
  * Throws `NO_VIDEO_METADATA` as it does.
27540
27979
  */
27541
- async function videoMetadataPatches(source, mime) {
27980
+ async function videoMetadataPatches(file, mime) {
27981
+ const source = readingAhead(file);
27542
27982
  const head = await source.read(0, VIDEO_METADATA_LIMITS.headBytes);
27543
27983
  const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
27544
27984
  const container = containerOf(head, mime);
@@ -31604,7 +32044,16 @@ var GROUP_LIMITS = {
31604
32044
  /** A received message is in the saved state within this long (`persistSoon`): a burst of them is one save, not one each. */
31605
32045
  saveWithinMs: 1e3,
31606
32046
  /** New name records of one member taken in `syncWindowMs` (WISP 902 § Messages, "The name record"): one a rename. */
31607
- namesPerMember: 4
32047
+ namesPerMember: 4,
32048
+ /**
32049
+ * Messages of one member taken per `messageWindowMs`, and the bytes of their frames, past a burst of twice its whole
32050
+ * log (`AuthorPace`); its edits the same, counted apart. As a community's (`COMMUNITY_LIMITS.messagesPerAuthor`): each
32051
+ * one taken is a row in every member's app and a frame each hub passes on. The rest are not taken now and come again
32052
+ * in a catch-up.
32053
+ */
32054
+ messagesPerAuthor: 30,
32055
+ messageBytesPerAuthor: 131072,
32056
+ messageWindowMs: 1e4
31608
32057
  };
31609
32058
  /** What every member should know about who can read what, in the words the apps show. */
31610
32059
  var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they are a member. Someone removed keeps what they already received and cannot read what comes after; someone who joins later cannot read what came before. Messages go to each member; whoever was away gets what they missed from any member who has it (the group's last ${GROUP_LIMITS.relay} messages) when they meet again.`;
@@ -31613,6 +32062,33 @@ var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they
31613
32062
  * answer: slices go one after another, each once my app handled the last (`CATCH_UP_PAUSE_MS` at most between them).
31614
32063
  */
31615
32064
  var ANSWER_WINDOW_MS$1 = 5e3;
32065
+ /**
32066
+ * One member's messages (or edits) taken: its whole log handed back at once twice over (`AUTHOR_BURST`: an edge opening
32067
+ * hears it, with what the member says live beside it, and the edits its app says again), then
32068
+ * `GROUP_LIMITS.messagesPerAuthor` and `messageBytesPerAuthor` per `messageWindowMs`, as a community's `MessagePace`.
32069
+ * One not taken is neither seen nor kept nor passed on, so a sync still names it (`miss`) and a catch-up hands it again.
32070
+ * What another member hands on in its answer to my sync is not counted: it took each at its author's pace already, and
32071
+ * a catch-up holds many.
32072
+ */
32073
+ var AUTHOR_BURST = {
32074
+ frames: 2 * GROUP_LIMITS.outlog,
32075
+ bytes: 2 * GROUP_LIMITS.outlogBytes
32076
+ };
32077
+ var AuthorPace = class {
32078
+ frames = AUTHOR_BURST.frames;
32079
+ bytes = AUTHOR_BURST.bytes;
32080
+ at;
32081
+ take(bytes, now) {
32082
+ const elapsed = Math.max(0, now - (this.at ?? now)) / GROUP_LIMITS.messageWindowMs;
32083
+ this.at = now;
32084
+ this.frames = Math.min(AUTHOR_BURST.frames, this.frames + elapsed * GROUP_LIMITS.messagesPerAuthor);
32085
+ this.bytes = Math.min(AUTHOR_BURST.bytes, this.bytes + elapsed * GROUP_LIMITS.messageBytesPerAuthor);
32086
+ if (this.frames < 1 || this.bytes < bytes) return false;
32087
+ this.frames -= 1;
32088
+ this.bytes -= bytes;
32089
+ return true;
32090
+ }
32091
+ };
31616
32092
  var MAX_TEXT_BOX$1 = Math.ceil((GROUP_LIMITS.textBytes + 16) * 4 / 3) + 4;
31617
32093
  /** Sixteen mentions as JSON, each a key and two offsets, with room to spare, sealed. */
31618
32094
  var MAX_MENTIONS_BOX = Math.ceil((MENTION_LIMITS.count * 96 + 16) * 4 / 3) + 4;
@@ -31983,6 +32459,9 @@ var GroupSession = class {
31983
32459
  nameSaid;
31984
32460
  /** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
31985
32461
  namesTaken = /* @__PURE__ */ new Map();
32462
+ /** Messages, and apart from them edits, taken per author (`AuthorPace`). In memory only. */
32463
+ messagePace = /* @__PURE__ */ new Map();
32464
+ editPace = /* @__PURE__ */ new Map();
31986
32465
  queue = Promise.resolve();
31987
32466
  /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
31988
32467
  pendingMeta;
@@ -32164,6 +32643,24 @@ var GroupSession = class {
32164
32643
  get admin() {
32165
32644
  return rosterAdmin(this.roster);
32166
32645
  }
32646
+ /**
32647
+ * The roster in the order its members were last admitted, the creator first (WISP 902 § Transports, the edge a
32648
+ * member keeps): every member holding the same chain reads the same order, and a member reads everyone admitted
32649
+ * before it from its welcome. Kept for the current top commit.
32650
+ */
32651
+ get admissionOrder() {
32652
+ const top = this.top;
32653
+ if (this.admissionCache?.top === top) return this.admissionCache.order;
32654
+ const chain = this.state.chain, at = /* @__PURE__ */ new Map();
32655
+ for (let e = 1; e < chain.length; e++) if (chain[e].k === "add" && chain[e].s) at.set(chain[e].s, e);
32656
+ const order = this.roster.map(([key]) => key).sort((a, b) => (at.get(a) ?? 0) - (at.get(b) ?? 0) || (a < b ? -1 : a > b ? 1 : 0));
32657
+ this.admissionCache = {
32658
+ top,
32659
+ order
32660
+ };
32661
+ return order;
32662
+ }
32663
+ admissionCache;
32167
32664
  get isAdmin() {
32168
32665
  return this.admin === this.myKey && this.state.status === "active";
32169
32666
  }
@@ -32523,16 +33020,29 @@ var GroupSession = class {
32523
33020
  return false;
32524
33021
  }
32525
33022
  }
32526
- /** Another member's edit, kept to hand on: the latest per message; the oldest go once the log is full. False: one as new was kept. */
33023
+ /**
33024
+ * Another member's edit, kept to hand on: the latest per message. Full (in count or in bytes), the oldest of the author
33025
+ * who holds the most of it goes (the one just kept's own on a tie): an author's edits of messages that are not there,
33026
+ * which no keeper can tell (a hub cannot even open them), as many as it likes, push out only its own. False: one as
33027
+ * new was kept, or this one went.
33028
+ */
32527
33029
  keepEdit(frame) {
32528
33030
  const same = (f) => f.s === frame.s && f.e === frame.e && f.n === frame.n;
32529
33031
  const log = this.state.relayEdits ?? [];
32530
33032
  if (log.some((f) => same(f) && f.v >= frame.v)) return false;
32531
- const next = [...log.filter((f) => !same(f)), cleanEdit(frame)];
33033
+ const kept = cleanEdit(frame);
33034
+ const next = [...log.filter((f) => !same(f)), kept];
32532
33035
  let bytes = next.reduce((sum, f) => sum + f.c.length, 0);
32533
- while (next.length > GROUP_LIMITS.relayEdits || bytes > GROUP_LIMITS.relayEditBytes) bytes -= next.shift().c.length;
33036
+ while (next.length > GROUP_LIMITS.relayEdits || bytes > GROUP_LIMITS.relayEditBytes) {
33037
+ const byCount = next.length > GROUP_LIMITS.relayEdits;
33038
+ const held = /* @__PURE__ */ new Map();
33039
+ for (const f of next) held.set(f.s, (held.get(f.s) ?? 0) + (byCount ? 1 : f.c.length));
33040
+ let most = frame.s;
33041
+ for (const [author, amount] of held) if (amount > held.get(most)) most = author;
33042
+ bytes -= next.splice(next.findIndex((f) => f.s === most), 1)[0].c.length;
33043
+ }
32534
33044
  this.state.relayEdits = next;
32535
- return true;
33045
+ return next.includes(kept);
32536
33046
  }
32537
33047
  /** A frame of another member, kept to hand on; the oldest go once the log is full. */
32538
33048
  keep(frame) {
@@ -32930,7 +33440,8 @@ var GroupSession = class {
32930
33440
  /**
32931
33441
  * Says an edit of one of my messages (WISP 902 § Edits): edit `v`, the whole new text and its mentions, sealed under
32932
33442
  * the key of the message's epoch and signed, to every member of that epoch still in the group, or to `to` alone (an
32933
- * edge that just opened). Someone admitted after the message cannot open it and is not sent it. The message's
33443
+ * edge that just opened). Someone admitted after the message cannot open it and is not sent it, but a hub I count on
33444
+ * (`hooks.carriers`), which carries it on to the members who can. The message's
32934
33445
  * epoch key must still be here: past `GROUP_LIMITS.secrets` epochs a message cannot be edited.
32935
33446
  */
32936
33447
  sendEdit(messageId, edit, to) {
@@ -32955,6 +33466,7 @@ var GroupSession = class {
32955
33466
  if (utf8Encode(plain).length > MAX_EDIT_PLAIN) return { error: "Message exceeds 16 KiB" };
32956
33467
  const copies = [ref, ...this.state.sent.filter((f) => f.o && f.o.e === ref.e && f.o.n === ref.n)];
32957
33468
  const told = /* @__PURE__ */ new Set();
33469
+ const carriers = this.hooks.carriers?.() ?? [];
32958
33470
  for (const copy of copies) {
32959
33471
  const readers = this.state.chain[copy.e]?.m, key = this.secret(copy.e);
32960
33472
  if (!readers || !key) continue;
@@ -32977,11 +33489,12 @@ var GroupSession = class {
32977
33489
  ...unsigned,
32978
33490
  sig: toBase64Url(sign(editSigned(unsigned), this.identity.seed))
32979
33491
  };
32980
- const members = (to === void 0 ? this.others : [to]).filter((k) => k !== this.myKey && !told.has(k) && rosterHas(this.roster, k) && rosterHas(readers, k));
32981
- for (const k of members) {
33492
+ const targets = (to === void 0 ? this.others : [to]).filter((k) => k !== this.myKey && rosterHas(this.roster, k));
33493
+ for (const k of targets.filter((k) => !told.has(k) && rosterHas(readers, k))) {
32982
33494
  this.hooks.send(k, frame);
32983
33495
  told.add(k);
32984
33496
  }
33497
+ for (const k of targets.filter((k) => carriers.includes(k) && !rosterHas(readers, k))) this.hooks.send(k, frame);
32985
33498
  }
32986
33499
  return { sent: told.size };
32987
33500
  });
@@ -33404,6 +33917,7 @@ var GroupSession = class {
33404
33917
  delete raw.o;
33405
33918
  delete raw.xs;
33406
33919
  }
33920
+ if (!(relayed && (answer || waited)) && !this.paced(this.messagePace, raw.s, frameBytes(raw))) return;
33407
33921
  const first = raw.o === void 0 ? null : readFirstPlace(raw.o, raw.e);
33408
33922
  if (raw.o !== void 0 && !first) return;
33409
33923
  const secret = this.secret(raw.e);
@@ -33480,7 +33994,7 @@ var GroupSession = class {
33480
33994
  * in, and a member away when it was said would keep the message for good. One for an epoch or a secret not here yet
33481
33995
  * waits, as a message does. Taken, it is kept to hand on in turn.
33482
33996
  */
33483
- async receiveEdit(from, raw) {
33997
+ async receiveEdit(from, raw, waited = false) {
33484
33998
  if (!isEditFrame(raw) || raw.s === this.myKey || !rosterHas(this.roster, from)) return;
33485
33999
  const member = rosterHas(this.roster, raw.s);
33486
34000
  if (!verify(fromBase64Url(raw.sig), editSigned(raw), publicKeyFromZ32(raw.s))) return;
@@ -33489,7 +34003,15 @@ var GroupSession = class {
33489
34003
  return;
33490
34004
  }
33491
34005
  const commit = this.state.chain[raw.e];
33492
- if (!commit || !rosterHas(commit.m, raw.s) || !rosterHas(commit.m, this.myKey)) return;
34006
+ if (!commit || !rosterHas(commit.m, raw.s)) return;
34007
+ if (!(this.state.relayEdits ?? []).some((f) => f.s === raw.s && f.e === raw.e && f.n === raw.n && f.v >= raw.v) && !(raw.s !== from && (this.awaitsAnswer(from) || waited)) && !this.paced(this.editPace, raw.s, raw.c.length + 400)) return;
34008
+ if (!rosterHas(commit.m, this.myKey)) {
34009
+ if (member && this.keepEdit(raw)) {
34010
+ this.persistSoon();
34011
+ this.took(cleanEdit(raw));
34012
+ }
34013
+ return;
34014
+ }
33493
34015
  const secret = this.secret(raw.e);
33494
34016
  if (!secret) {
33495
34017
  if (raw.e >= this.epoch - GROUP_LIMITS.secrets) this.parkEdit(from, raw);
@@ -33524,7 +34046,7 @@ var GroupSession = class {
33524
34046
  ...rm ? { rm: true } : {}
33525
34047
  });
33526
34048
  if (this.keepEdit(raw)) {
33527
- await this.persist();
34049
+ this.persistSoon();
33528
34050
  this.took(cleanEdit(raw));
33529
34051
  }
33530
34052
  }
@@ -33536,6 +34058,11 @@ var GroupSession = class {
33536
34058
  }].slice(-GROUP_LIMITS.outlog);
33537
34059
  this.ask(from);
33538
34060
  }
34061
+ paced(paces, author, bytes) {
34062
+ let pace = paces.get(author);
34063
+ if (!pace) paces.set(author, pace = new AuthorPace());
34064
+ return pace.take(bytes, this.now());
34065
+ }
33539
34066
  wholeSigned(raw) {
33540
34067
  if (typeof raw.xs !== "string" || raw.xs.length !== 86 || !B64$1.test(raw.xs)) return false;
33541
34068
  try {
@@ -33676,7 +34203,7 @@ var GroupSession = class {
33676
34203
  for (const { from, frame } of ready) await this.receiveMessage(from, frame, true);
33677
34204
  const edits = this.waitingEdits.filter((w) => w.frame.e <= this.epoch && !!this.state.secrets[w.frame.e]);
33678
34205
  this.waitingEdits = this.waitingEdits.filter((w) => !edits.includes(w));
33679
- for (const { from, frame } of edits) await this.receiveEdit(from, frame);
34206
+ for (const { from, frame } of edits) await this.receiveEdit(from, frame, true);
33680
34207
  }
33681
34208
  async receiveCommit(from, frame) {
33682
34209
  const raw = frame.commit;
@@ -35157,11 +35684,12 @@ var CommunitySession = class CommunitySession {
35157
35684
  * it was in. What one who left wrote while in the group is taken and handed on, its goodbye included, up to what the
35158
35685
  * member who committed the leave had heard of it then (its `group-left` mark), never past it: the leaver still holds
35159
35686
  * those epochs' secrets, and anything it signs later is not heard (WISP 903 § Leaving and removal). No mark here
35160
- * (one not come yet, or a committer's app before it) and nothing of it is heard.
35687
+ * (one not come yet, or a committer's app before it) and nothing of it is heard. A key let in only on a branch that
35688
+ * lost is heard no more either, as one removed, once this member knows it lost.
35161
35689
  */
35162
35690
  heardAfterOut(f) {
35163
35691
  const i = this.outIndex(f.s);
35164
- if (i < 0) return true;
35692
+ if (i < 0) return rosterHas(this.roster, f.s) || this.isRecentMember(f.s) || !this.lostAt(f.s);
35165
35693
  const commit = this.state.chain[i];
35166
35694
  if (commit.k !== "leave") return false;
35167
35695
  const high = this.state.left?.[communityCommitHash(commit)]?.hi[seenKey(f.e, f.h)];
@@ -35523,6 +36051,7 @@ var CommunitySession = class CommunitySession {
35523
36051
  }
35524
36052
  this.followEntry();
35525
36053
  this.pruneSide();
36054
+ this.state.pendingLeaves = this.state.pendingLeaves.filter((r) => rosterHas(this.roster, r.s));
35526
36055
  if (this.state.status !== status) await this.persist();
35527
36056
  else this.persistSoon();
35528
36057
  this.hooks.changed();
@@ -35720,7 +36249,8 @@ var CommunitySession = class CommunitySession {
35720
36249
  this.requireMember();
35721
36250
  if (!this.isAdmin) throw new Error("Only the admin can do that");
35722
36251
  }
35723
- async commit(kind, fields, now) {
36252
+ /** `alongside`: what else the commit changes in the state, saved in the same write (only once the commit is signed). */
36253
+ async commit(kind, fields, now, alongside) {
35724
36254
  if (!this.adminWork) throw new Error(GROUP_ADMIN_OFF_ERROR);
35725
36255
  if (this.hooks.adminTurn && !await this.hooks.adminTurn()) throw engineError("groupTurnUnconfirmed");
35726
36256
  if (this.state.chain.length >= COMMUNITY_LIMITS.chain) throw new Error("This group has reached its membership history limit. Create a new group.");
@@ -35764,6 +36294,7 @@ var CommunitySession = class CommunitySession {
35764
36294
  this.state.seq = 0;
35765
36295
  this.state.seqH = hash;
35766
36296
  this.pruneSide();
36297
+ alongside?.();
35767
36298
  await this.persist();
35768
36299
  this.hooks.broadcast({
35769
36300
  t: "group-commit",
@@ -35925,12 +36456,12 @@ var CommunitySession = class CommunitySession {
35925
36456
  return this.serialize(async () => {
35926
36457
  this.requireAdmin();
35927
36458
  const entry = off ? null : identityFromSeedB64(toBase64Url(randomBytes(32)));
35928
- await this.commit("link", { x: entry?.pubKeyZ32 ?? "" }, now);
35929
- this.state.entry = {
35930
- key: entry?.pubKeyZ32 ?? "",
35931
- seedB64: entry?.seedB64 ?? ""
35932
- };
35933
- await this.persist();
36459
+ await this.commit("link", { x: entry?.pubKeyZ32 ?? "" }, now, () => {
36460
+ this.state.entry = {
36461
+ key: entry?.pubKeyZ32 ?? "",
36462
+ seedB64: entry?.seedB64 ?? ""
36463
+ };
36464
+ });
35934
36465
  if (entry) {
35935
36466
  const pause = pacer(ENTRY_SLICE_MS);
35936
36467
  for (const key of this.others) {
@@ -36931,7 +37462,9 @@ var CommunitySession = class CommunitySession {
36931
37462
  if (!answered.take()) return;
36932
37463
  if (lost) {
36933
37464
  const at = this.mainIndex.get(frame.h);
36934
- const commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
37465
+ let commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
37466
+ const link = commits.findIndex((c) => c.k === "link" && !!c.x);
37467
+ if (link >= 0) commits = commits.slice(0, link);
36935
37468
  if (commits.length) this.answers.handOut(from, commits.map((commit) => ({
36936
37469
  t: "group-commit",
36937
37470
  v: 2,
@@ -37020,7 +37553,7 @@ var CommunitySession = class CommunitySession {
37020
37553
  const entry = this.entryFrame(from);
37021
37554
  if (entry) answer.push(entry);
37022
37555
  }
37023
- for (const request of this.state.pendingLeaves) answer.push({
37556
+ for (const request of this.state.pendingLeaves) if (rosterHas(this.roster, request.s)) answer.push({
37024
37557
  t: "group-leave",
37025
37558
  v: 2,
37026
37559
  g: this.id,
@@ -37912,6 +38445,6 @@ function readX401SdJwtVc(text) {
37912
38445
  };
37913
38446
  }
37914
38447
  //#endregion
37915
- export { SSHSIG_NAMESPACE as $, validReactionNumber as $a, APP_BUNDLE_MAGIC as $c, newMailbox as $i, seedSigner as $l, parseEngineError as $n, parseLocalTarget as $o, pinIsNewer as $r, readHandoffCancel as $s, PaymentPreflightError as $t, knockIdentity as A, voiceDownloadName as Aa, inboxRecord as Ac, boundVerifiedIdentity as Ai, readCanonicalJson as Al, cashuRequestPayload as An, MAX_GROUP_CHAIN as Ao, mergeLobby as Ar, HANDOFF_VERIFIED as As, didJwsAlg as At, withRequestOptions as Au, GROUP_REACTED_FRAME as B, linkStop as Ba, contactDay as Bc, emptyProofLedger as Bi, encodeInviteCode as Bl, PICTURE_METADATA_LIMITS as Bn, emptyRatchetState as Bo, FileUplink as Br, handoffDataFrame as Bs, parseDidSignaturePaste as Bt, publicKeyFromZ32 as Bu, communityHasFrame as C, PLAYABLE_AUDIO as Ca, enrollHelloFrame as Cc, capsDescriptors as Ci, setAppSignatureFastPath as Cl, pubkyProofPath as Cn, arrivalKey as Co, beaconKeys as Cr, HANDOFF_HAVE as Cs, DID_DOCUMENT_MAX_BYTES as Ct, SLOW_MS as Cu, decodeGroupEntryLink as D, downsamplePeaks as Da, verifyEnrollProof as Dc, IDENTITY_REVOCATION_LABEL as Di, readImageMeta as Dl, resolveLightningDestination as Dn, shownTime as Do, lobbyKeys as Dr, HANDOFF_PIECE_BYTES as Ds, checkDidJws as Dt, traceLink as Du, KNOCK_TTL_MS as E, baseMime as Ea, readEnrollHello as Ec, IDENTITY_MAX_VALIDITY as Ei, parseImageMeta as El, requestLnurlInvoice as En, receivedTimestamp as Eo, freshHubs as Er, HANDOFF_PAKE as Es, DidError as Et, setLinkTraceSink as Eu, GroupWakeLimiter as F, MAX_REMOVAL_NUMBER as Fa, turnOff as Fc, newIdentityBinding as Fi, deviceInviteJoinerParams as Fl, parseFedimintRequestPayload as Fn, rosterHas as Fo, readBeaconHead as Fr, handoffAttemptSucceeded as Fs, didWebFileUrl as Ft, openRelayPayload as Fu, GROUP_EDIT_FRAME as G, GROUP_REACTION_FRAME as Ga, makeStampPaced as Gc, irohDescriptor as Gi, ENROLL_CAPABILITY as Gl, INVITE_TAKEN as Gn, DHT_POLL_INTERVALS as Go, TYPING_REFRESH_MS as Gr, handoffOfferFrame as Gs, didDhtFromPublicKey as Gt, bytesEqual as Gu, GroupSession as H, forwardedAgain as Ha, knockSlotOf as Hc, TRANSPORTS as Hi, inviteOwnership as Hl, stripPictureMetadata as Hn, DirectPathWatch as Ho, transferEnded as Hr, handoffEphemeral as Hs, staticDidDocument as Ht, MAX_AVATAR_LENGTH as Hu, groupWakeFrame as I, REMOVED_TEXT as Ia, ContactRequestError as Ic, receivedIdentityStatus as Ii, readDeviceInvite as Il, NO_VIDEO_METADATA as In, verifyCommitSignature as Io, readLobby as Ir, handoffBusyFrame as Is, didWebHost as It, parseRelayPayload as Iu, meshMessageRef as J, nextReactionNumber as Ja, readKnockSlot as Jc, HOLD_DATED_BACK_MS as Ji, deviceEchoNonce as Jl, pairedMessageFits as Jn, RELAY_POLL_INTERVALS as Jo, typingActivity as Jr, handoffRetryAfter as Js, resolveDidDht as Jt, randomBytes as Ju, GROUP_EDIT_TEXT_BYTES as K, REACTION_LIMITS as Ka, mergeContactKnocks as Kc, irohRelayUrl as Ki, HANDOFF_CAPABILITY as Kl, LIVENESS_PING_MS as Kn, EXPECT_PEER_MS as Ko, TypingSender as Kr, handoffPakeFrame as Ks, encodeDidDhtDeactivated as Kt, fromBase64Url as Ku, groupWakes as L, RateWindow as La, REQUEST_LIFETIME_MS as Lc, revokesIdentity as Li, OwnInviteError as Ll, videoMetadataPatches as Ln, edgeParams as Lo, shouldBeHub as Lr, handoffCancelFrame as Ls, normalizeDid as Lt, createIdentity as Lu, mergeKnocks as M, parseVideoMeta as Ma, planKnocks as Mc, identityRevocationValue as Mi, encodeContactLink as Ml, findEndpoint as Mn, commitHash as Mo, pickHubs as Mr, filePartName as Ms, didWebDocumentUrl as Mt, RELAY_PAYLOAD_MAX_BYTES as Mu, readKnocks as N, EDIT_BUFFER_MS as Na, settleRequest as Nc, identityStatement as Ni, readContactLink as Nl, isFederationId as Nn, parseGroupCommit as No, rankHubs as Nr, handoffAttemptAllowed as Ns, didWebFile as Nt, createRelayPayload as Nu, encodeGroupEntryLink as O, fileMessageText as Oa, clearMissed as Oc, IdentityCheckUnavailable as Oi, canonicalJson as Ol, decodeBolt11 as On, GROUP_ADMIN_OFF_ERROR as Oo, lobbyRecords as Or, HANDOFF_REQUEST as Os, checkDidSignature as Ot, budgetRetryMs as Ou, GROUP_WAKE_FRAME as P, EDIT_RATE_WINDOW_MS as Pa, takeRequest as Pc, isIdentityBinding as Pi, createDeviceInvite as Pl, parseCashuRequestPayload as Pn, rosterAdmin as Po, readBeacon as Pr, handoffAttemptFailed as Ps, didWebFileNames as Pt, newerPacket as Pu, SSHSIG_MAX_ARMOR as Q, readReaction as Qa, APP_BUNDLE_LIMITS as Qc, isHoldUrl as Qi, newDeviceSetSecret as Ql, engineText as Qn, formatLocalTarget as Qo, nextPinNumber as Qr, readHandoffAck as Qs, ONCHAIN_PROVIDER as Qt, utf8Encode as Qu, parseGroupWakeFrame as R, dhtEditId as Ra, contactAskerFrame as Rc, lastSharedWithMe as Ri, createChatInvite as Rl, withoutVideoMetadata as Rn, RATCHET_CAPABILITY as Ro, ChatFiles as Rr, handoffContext as Rs, parseDid as Rt, identityFromSeed as Ru, GROUP_READ_NOTE_COMMUNITY as S, sanitizeMime as Sa, enrollGrantFrame as Sc, DHT_TEXT_CAPABILITY as Si, readAppRevocations as Sl, pubkyProofFile as Sn, statusCardText as So, COMMUNITY_TOPOLOGY as Sr, HANDOFF_DONE as Ss, verifyAtprotoRecordProof as St, RelaysFailedError as Su, encodeCommunityLink as T, VOICE_METER as Ta, readEnrollGrant as Tc, IDENTITY_MAX_EVIDENCE as Ti, signAppRevocation as Tl, pubkyHomeserverOf as Tn, heardTime as To, doorHubs as Tr, HANDOFF_OFFER as Ts, DID_JWS_MAX_LENGTH as Tt, normalizeRelayUrl as Tu, frameBytes as U, readForwarded as Ua, knockSlotRecords as Uc, automaticTransport as Ui, ownInviteRefusal as Ul, withoutPictureMetadata as Un, AWAITING_PEER_MS as Uo, transferStalled as Ur, handoffHelloFrame as Us, strictBase64Url as Ut, sanitizeAvatar as Uu, GROUP_READ_NOTE as V, parseLinkPreview as Va, knockSlotIdentity as Vc, validExternalKey as Vi, inviteLink as Vl, isStrippedPicture as Vn, ratchetSessionOf as Vo, sentWhole as Vr, handoffDigest as Vs, signingKeys as Vt, verify as Vu, COMMUNITY_EDIT_FRAME as W, COMMUNITY_REACTION_FRAME as Wa, linkRecords as Wc, dialableIrohRelay as Wi, DEVICES_CAPABILITY as Wl, GhostLink as Wn, DAEMON_WATCH_PEER_IDLE_MS as Wo, TYPING_KINDS as Wr, handoffManifestFrames as Ws, didDhtDocument as Wt, sanitizeDisplayText as Wu, mentionsMember as X, reactionEmoji as Xa, requestRecords as Xc, HoldKeys as Xi, deviceLinkPairing as Xl, EngineError as Xn, presenceSeenAt as Xo, PIN_LIMITS as Xr, handoffVersions as Xs, ETHEREUM_USDT as Xt, toZ32 as Xu, parseCommunityEdit as Y, queueReaction as Ya, readLinkRecord as Yc, HOLD_LIMITS as Yi, deviceKeyZ32 as Yl, pairedMessageFrame as Yn, WATCH_PEER_MS as Yo, GROUP_PIN_FRAME as Yr, handoffStreamKey as Ys, signDidDhtPacket as Yt, toBase64Url as Yu, groupName as Z, reactionIsNewer as Za, seenEntry as Zc, HoldRefusedError as Zi, devicePingFrame as Zl, engineError as Zn, GhostlyHttpError as Zo, mayPin as Zr, newHandoffId as Zs, EVM_TEST_CHAINS as Zt, utf8Decode as Zu, groupTypingEpoch as _, peekDhtMailbox as _a, ENROLL_PROOF as _c, BUTTONS_CAPABILITY as _i, isAppHash as _l, isPubkyKey as _n, cardLine as _o, readGroupSignal as _r, HTTP_SERVICE_PROTO as _s, isAtprotoDid as _t, turnVerifierMark as _u, appRevocationFor as a, domainWellKnownFile as aa, readHandoffVerified as ac, newWakeToken as ai, checkAppManifest as al, arkAddressPrefix as an, BUTTON_STYLES as ao, groupFileFallback as ar, CALL_SIGNAL_MAX_AGE_MS as as, verifySshSignature as at, turnPutSummary as au, COMMUNITY_LIMITS as b, formatFileSize as ba, enrollDigits as bc, UPGRADE_CAPABILITY as bi, readAppRevocation as bl, normalizePubkyKey as bn, sameButtonText as bo, meshHubs as br, HANDOFF_ACK as bs, shortAtprotoDid as bt, HEDGE_MS as bu, checkAppBeforeRun as c, nip05RootKey as ca, SET_UPDATE as cc, wakeRequest as ci, readAppBundle as cl, formatPaymentAmount as cn, PR_CHECKS as co, readGroupHave as cr, answersOffer as cs, decodeAnyBitcoinAddress as ct, firstDeviceSetSecret as cu, checkAppStoreIndex as d, recordsFromWellKnown as da, setUpdateFrame as dc, APP_RANGE_LIMITS as di, APP_PREFIXES as dl, SPARK_NETWORKS as dn, RUN_RESULTS as do, CarriedTransport as dr, callSignalHeardAt as ds, ATPROTO_PROOF_COLLECTION as dt, signTurnPacket as du, readManifest as ea, readHandoffDone as ec, pinNumberHolds as ei, APP_ICON_PATH as el, SEPOLIA_TEST_USDT as en, wireReaction as eo, GROUP_FILE_LIMITS as er, webLocalFetch as es, SshSigError as et, webCryptoSigner as eu, readAppStore as f, recordsName as fa, signTombstone as fc, isServeId as fi, APP_STATEMENT_LIMITS as fl, SPARK_PROVIDER as fn, STATUS_CARD_LIMITS as fo, GROUP_SIGNAL_FRAME as fr, contactRtcConfig as fs, ATPROTO_PROOF_SCOPE as ft, signTurnRelease as fu, GroupTypingBoard as g, DHT_MESSAGE_TTL as ga, ENROLL_HELLO as gc, APPS_CAPABILITY as gi, checkAppRevokeStatement as gl, PUBKY_PROOF_MAX_BYTES as gn, buttonLabelClash as go, groupSignalFrame as gr, emptyLinkRecords as gs, checkAtprotoProofRecord as gt, turnStatedVerifier as gu, GROUP_TYPING_FRAME as h, DHT_FILE_TOO_LARGE as ha, ENROLL_GRANT as hc, isAppVersion as hi, appRefPublisher as hl, isBitcoinAddress as hn, appCardUrl as ho, SIGNAL_REPLY_MS as hr, signalHasVideo as hs, atprotoProofRkey as ht, turnName as hu, addedAppPermissions as i, domainTxtRecord as ia, readHandoffTurnFrame as ic, deviceWakeRequest as ii, assembleAppBundle as il, WALLET_NETWORKS as in, BUTTON_ID as io, fetchesByItself as ir, BURST_RING_MS as is, sshSignCommand as it, classifyTurnRead as iu, knockRecords as j, voiceLevel as ja, newInbox as jc, emptyIdentityLedger as ji, createContactLink as jl, fedimintRequestPayload as jn, MEMBER_KEY as jo, newerHead as jr, NO_ATTEMPTS as js, didSignedMessages as jt, PacketTooLargeError as ju, entryParams as k, parseVoiceMeta as ka, endedRequests as kc, IdentityExchange as ki, canonicalJsonBytes as kl, ENDPOINT as kn, GROUP_MEMBER_CAP as ko, mergeBeacon as kr, HANDOFF_TIMINGS as ks, didGhostlyServiceEntry as kt, isDiscoveryBudgetError as ku, planAppUpdate as l, normalizeDomain as la, readSetUpdate as lc, checkPushEndpoint as li, readAppBundleAsync as ll, validatePaymentTarget as ln, PR_STATES as lo, readGroupWant as lr, buildSdpFromSignal as ls, ATPROTO_DECLARED_SCOPE as lt, nextTurnPosition as lu, signAppStore as m, wellKnownUrl as ma, ENROLL_DONE as mc, chatAppId as mi, appRef as ml, sparkInvoiceDetails as mn, appCardId as mo, SIGNAL_HOLD_MS as mr, parseCallSignal as ms, atprotoProofRecord as mt, turnKeys as mu, readX401SdJwtVc as n, decodeDnsResponse as na, readHandoffHello as nc, WAKE_CALL_INTERVAL_MS as ni, appDigest as nl, TEST_USDT_FAUCET_AMOUNT as nn, readReply as no, GROUP_WANT_FRAME as nr, decodeControl as ns, parseSshSignature as nt, TURN_RAISE_READ_TIMEOUT_MS as nu, appStoreDecision as o, encodeDnsQuery as oa, sealHandoffPiece as oc, parseWakeFrame as oi, isAppUrl as ol, assertTokenUnits as on, CRON_LINE as oo, isGroupMessageId as or, QUICK_REDIAL_MS as os, verifyBitcoinMessage as ot, TURN_LAST_SEQUENCE as ou, readAppStoreSteps as p, txtValue as pa, verifySetUpdate as pc, APP_DATA_MAX_BYTES as pi, appFingerprint as pl, sparkAddressKind as pn, TASK_STATUSES as po, SIGNAL_FRESH_MS as pr, extractParamsFromSdp as ps, atprotoDidMethod as pt, turnInstance as pu, carryMentions as q, ReactionWindow as qa, openRequest as qc, HOLD_CAPABILITY as qi, deviceEchoFrame as ql, PAIRED_FRAME_TOO_LARGE as qn, PRESENCE_WINDOW as qo, sanitizeTypingStatus as qr, handoffReleaseFrame as qs, encodeDidDhtPacket as qt, isZ32Key as qu, sameX401HolderJwk as r, dnsProofName as ra, readHandoffPake as rc, WakeLimiter as ri, appViewOf as rl, USDT_PUBLIC_RPC as rn, replySnippet as ro, GROUP_WANT_NO_FRAME as rr, encodeControl as rs, sameSshKey as rt, TURN_SETTLE_MS as ru, appUpdateDecision as s, isPublicAddress as sa, SET_ACK as sc, relayRequest as si, pacer as sl, assertWholeSats as sn, ITEM_STATES as so, readGroupFileMeta as sr, RTC_CONFIG as ss, BitcoinAddressError as st, TURN_MAX as su, newX401HolderKey as t, DOMAIN_FILE_MAX_BYTES as ta, readHandoffHave as tc, readPin as ti, APP_PERMISSIONS as tl, SEPOLIA_TEST_USDT_FAUCET as tn, pairedReplyAuthor as to, GROUP_HAVE_FRAME as tr, LIMITS as ts, parseSshPublicKey as tt, TURN_PUT_WINDOW_MS as tu, APP_STORE_LIMITS as u, recordsFromTxt as ua, setAckFrame as uc, vapidKeysMatch as ui, sha256Paced as ul, walletNetworkOf as un, ROUTINE_STATES as uo, readGroupWantNo as ur, callRtcConfig as us, ATPROTO_FULL_SCOPE as ut, readTurnPacket as uu, openGroupTyping as v, DHT_FILE_CAPABILITY as va, enrollCancelFrame as vc, EDIT_CAPABILITY as vi, isAppKey as vl, isPubkyProofFolder as vn, cardUrl as vo, MESH_HUBS as vr, LEGACY_SERVICES as vs, normalizeAtprotoHandle as vt, DEFAULT_RELAYS as vu, decodeCommunityLink as w, VOICE_LIMITS as wa, enrollProofFrame as wc, dialDescriptors as wi, signAppObject as wl, homeserverWebEndpoint as wn, claimedTime as wo, beaconRecords as wr, HANDOFF_HELLO as ws, DID_FILE_MAX_BYTES as wt, currentRelays as wu, CommunitySession as x, sanitizeFileName as xa, enrollDoneFrame as xc, CapsExchange as xi, readAppRevocationShape as xl, pubkyProofCapability as xn, statusCardBytes as xo, pickMeshHubs as xr, HANDOFF_CANCEL as xs, AtprotoProofError as xt, RelayTransport as xu, sealGroupTyping as y, dhtFileId as ya, enrollCancelReason as yc, STATUS_CARD_CAPABILITY as yi, isAppRef as yl, newPubkyProofFolder as yn, checkStatusCard as yo, mayBeHub as yr, serviceIdFromName as ys, parseAtprotoDidDocument as yt, HEDGE_MISSING_MS as yu, GROUP_LIMITS as z, LINK_TRAILING as za, contactAskerHolds as zc, PeerProofs as zi, decodeInviteCode as zl, NO_PICTURE_METADATA as zn, RatchetBox as zo, FILE_LIMITS as zr, handoffContextProof as zs, parseDidDocument as zt, identityFromSeedB64 as zu };
38448
+ export { SSHSIG_NAMESPACE as $, ReactionWindow as $a, openRequest as $c, HOLD_DATED_BACK_MS as $i, deviceEchoFrame as $l, engineError as $n, PRESENCE_WINDOW as $o, PIN_LIMITS as $r, handoffReleaseFrame as $s, ONCHAIN_PROVIDER as $t, sanitizeDisplayText as $u, knockIdentity as A, VOICE_LIMITS as Aa, enrollProofFrame as Ac, IDENTITY_REVOCATION_LABEL as Ai, signAppObject as Al, ENDPOINT as An, claimedTime as Ao, lobbyKeys as Ar, HANDOFF_HELLO as As, didJwsAlg as At, currentRelays as Au, GROUP_REACTED_FRAME as B, EDIT_RATE_WINDOW_MS as Ba, takeRequest as Bc, newIdentityBinding as Bi, createDeviceInvite as Bl, NO_PICTURE_METADATA as Bn, rosterAdmin as Bo, shouldBeHub as Br, handoffAttemptFailed as Bs, parseDidSignaturePaste as Bt, RELAY_PAYLOAD_MAX_BYTES as Bu, communityHasFrame as C, peekDhtMailbox as Ca, ENROLL_PROOF as Cc, UPGRADE_CAPABILITY as Ci, isAppHash as Cl, pubkyProofFile as Cn, cardLine as Co, pickMeshHubs as Cr, HTTP_SERVICE_PROTO as Cs, DID_DOCUMENT_MAX_BYTES as Ct, turnVerifierMark as Cu, decodeGroupEntryLink as D, sanitizeFileName as Da, enrollDoneFrame as Dc, dialDescriptors as Di, readAppRevocationShape as Dl, requestLnurlInvoice as Dn, statusCardBytes as Do, doorHubs as Dr, HANDOFF_CANCEL as Ds, checkDidJws as Dt, RelayTransport as Du, KNOCK_TTL_MS as E, formatFileSize as Ea, enrollDigits as Ec, capsDescriptors as Ei, readAppRevocation as El, pubkyHomeserverOf as En, sameButtonText as Eo, beaconRecords as Er, HANDOFF_ACK as Es, DidError as Et, HEDGE_MS as Eu, GroupWakeLimiter as F, parseVoiceMeta as Fa, endedRequests as Fc, emptyIdentityLedger as Fi, canonicalJsonBytes as Fl, parseCashuRequestPayload as Fn, GROUP_MEMBER_CAP as Fo, pickHubs as Fr, HANDOFF_TIMINGS as Fs, didWebFileUrl as Ft, DiscoveryBudgetError as Fu, GROUP_EDIT_FRAME as G, LINK_TRAILING as Ga, contactAskerHolds as Gc, emptyProofLedger as Gi, decodeInviteCode as Gl, GhostLink as Gn, RatchetBox as Go, transferEnded as Gr, handoffContextProof as Gs, didDhtDocument as Gt, createIdentity as Gu, GroupSession as H, REMOVED_TEXT as Ha, ContactRequestError as Hc, revokesIdentity as Hi, readDeviceInvite as Hl, isStrippedPicture as Hn, verifyCommitSignature as Ho, FILE_LIMITS as Hr, handoffBusyFrame as Hs, staticDidDocument as Ht, newerPacket as Hu, groupWakeFrame as I, voiceDownloadName as Ia, inboxRecord as Ic, identityRefusal as Ii, readCanonicalJson as Il, parseFedimintRequestPayload as In, MAX_GROUP_CHAIN as Io, rankHubs as Ir, HANDOFF_VERIFIED as Is, didWebHost as It, budgetRetryMs as Iu, meshMessageRef as J, forwardedAgain as Ja, knockSlotOf as Jc, automaticTransport as Ji, inviteOwnership as Jl, PAIRED_FRAME_TOO_LARGE as Jn, DirectPathWatch as Jo, TYPING_REFRESH_MS as Jr, handoffEphemeral as Js, encodeDidDhtPacket as Jt, publicKeyFromZ32 as Ju, GROUP_EDIT_TEXT_BYTES as K, linkStop as Ka, contactDay as Kc, validExternalKey as Ki, encodeInviteCode as Kl, INVITE_TAKEN as Kn, emptyRatchetState as Ko, transferStalled as Kr, handoffDataFrame as Ks, didDhtFromPublicKey as Kt, identityFromSeed as Ku, groupWakes as L, voiceLevel as La, newInbox as Lc, identityRevocationValue as Li, createContactLink as Ll, NO_VIDEO_METADATA as Ln, MEMBER_KEY as Lo, readBeacon as Lr, NO_ATTEMPTS as Ls, normalizeDid as Lt, isDiscoveryBudgetError as Lu, mergeKnocks as M, baseMime as Ma, readEnrollHello as Mc, IdentityExchange as Mi, parseImageMeta as Ml, fedimintRequestPayload as Mn, receivedTimestamp as Mo, mergeBeacon as Mr, HANDOFF_PAKE as Ms, didWebDocumentUrl as Mt, relayUrlProblem as Mu, readKnocks as N, downsamplePeaks as Na, verifyEnrollProof as Nc, boundIdentityDisplay as Ni, readImageMeta as Nl, findEndpoint as Nn, shownTime as No, mergeLobby as Nr, HANDOFF_PIECE_BYTES as Ns, didWebFile as Nt, setLinkTraceSink as Nu, encodeGroupEntryLink as O, sanitizeMime as Oa, enrollGrantFrame as Oc, IDENTITY_MAX_EVIDENCE as Oi, readAppRevocations as Ol, resolveLightningDestination as On, statusCardText as Oo, freshHubs as Or, HANDOFF_DONE as Os, checkDidSignature as Ot, RelaysFailedError as Ou, GROUP_WAKE_FRAME as P, fileMessageText as Pa, clearMissed as Pc, boundVerifiedIdentity as Pi, canonicalJson as Pl, isFederationId as Pn, GROUP_ADMIN_OFF_ERROR as Po, newerHead as Pr, HANDOFF_REQUEST as Ps, didWebFileNames as Pt, traceLink as Pu, SSHSIG_MAX_ARMOR as Q, REACTION_LIMITS as Qa, mergeContactKnocks as Qc, HOLD_CAPABILITY as Qi, HANDOFF_CAPABILITY as Ql, EngineError as Qn, EXPECT_PEER_MS as Qo, GROUP_PIN_FRAME as Qr, handoffPakeFrame as Qs, EVM_TEST_CHAINS as Qt, hasVisible as Qu, parseGroupWakeFrame as R, parseVideoMeta as Ra, planKnocks as Rc, identityStatement as Ri, encodeContactLink as Rl, videoMetadataPatches as Rn, commitHash as Ro, readBeaconHead as Rr, filePartName as Rs, parseDid as Rt, withRequestOptions as Ru, GROUP_READ_NOTE_COMMUNITY as S, DHT_MESSAGE_TTL as Sa, ENROLL_HELLO as Sc, STATUS_CARD_CAPABILITY as Si, checkAppRevokeStatement as Sl, pubkyProofCapability as Sn, buttonLabelClash as So, meshHubs as Sr, emptyLinkRecords as Ss, verifyAtprotoRecordProof as St, turnStatedVerifier as Su, encodeCommunityLink as T, dhtFileId as Ta, enrollCancelReason as Tc, DHT_TEXT_CAPABILITY as Ti, isAppRef as Tl, homeserverWebEndpoint as Tn, checkStatusCard as To, beaconKeys as Tr, serviceIdFromName as Ts, DID_JWS_MAX_LENGTH as Tt, HEDGE_MISSING_MS as Tu, frameBytes as U, RateWindow as Ua, REQUEST_LIFETIME_MS as Uc, lastSharedWithMe as Ui, OwnInviteError as Ul, stripPictureMetadata as Un, edgeParams as Uo, FileUplink as Ur, handoffCancelFrame as Us, strictBase64Url as Ut, openRelayPayload as Uu, GROUP_READ_NOTE as V, MAX_REMOVAL_NUMBER as Va, turnOff as Vc, receivedIdentityStatus as Vi, deviceInviteJoinerParams as Vl, PICTURE_METADATA_LIMITS as Vn, rosterHas as Vo, ChatFiles as Vr, handoffAttemptSucceeded as Vs, signingKeys as Vt, createRelayPayload as Vu, COMMUNITY_EDIT_FRAME as W, dhtEditId as Wa, contactAskerFrame as Wc, PeerProofs as Wi, createChatInvite as Wl, withoutPictureMetadata as Wn, RATCHET_CAPABILITY as Wo, sentWhole as Wr, handoffContext as Ws, DidDhtError as Wt, parseRelayPayload as Wu, mentionsMember as X, COMMUNITY_REACTION_FRAME as Xa, linkRecords as Xc, irohDescriptor as Xi, DEVICES_CAPABILITY as Xl, pairedMessageFits as Xn, DAEMON_WATCH_PEER_IDLE_MS as Xo, sanitizeTypingStatus as Xr, handoffManifestFrames as Xs, signDidDhtPacket as Xt, MAX_AVATAR_LENGTH as Xu, parseCommunityEdit as Y, readForwarded as Ya, knockSlotRecords as Yc, dialableIrohRelay as Yi, ownInviteRefusal as Yl, pairedEditFits as Yn, AWAITING_PEER_MS as Yo, TypingSender as Yr, handoffHelloFrame as Ys, resolveDidDht as Yt, verify as Yu, groupName as Z, GROUP_REACTION_FRAME as Za, makeStampPaced as Zc, irohRelayUrl as Zi, ENROLL_CAPABILITY as Zl, pairedMessageFrame as Zn, DHT_POLL_INTERVALS as Zo, typingActivity as Zr, handoffOfferFrame as Zs, ETHEREUM_USDT as Zt, sanitizeAvatar as Zu, groupTypingEpoch as _, recordsName as _a, setUpdateFrame as _c, chatAppId as _i, APP_PREFIXES as _l, PUBKY_PROOF_MAX_BYTES as _n, RUN_RESULTS as _o, SIGNAL_REPLY_MS as _r, callSignalHeardAt as _s, isAtprotoDid as _t, signTurnPacket as _u, appRevocationFor as a, readManifest as aa, readHandoffCancel as ac, toBase64Url as ad, WAKE_CALL_INTERVAL_MS as ai, APP_BUNDLE_MAGIC as al, WALLET_NETWORKS as an, validReactionNumber as ao, GROUP_WANT_NO_FRAME as ar, parseLocalTarget as as, verifySshSignature as at, seedSigner as au, COMMUNITY_LIMITS as b, ACTIVE_DHT_POLL_MS as ba, ENROLL_DONE as bc, BUTTONS_CAPABILITY as bi, appRef as bl, newPubkyProofFolder as bn, appCardId as bo, MESH_HUBS as br, parseCallSignal as bs, shortAtprotoDid as bt, turnKeys as bu, checkAppBeforeRun as c, dnsProofName as ca, readHandoffHello as cc, utf8Encode as cd, newWakeToken as ci, appDigest as cl, assertWholeSats as cn, readReply as co, isGroupMessageId as cr, decodeControl as cs, decodeAnyBitcoinAddress as ct, TURN_RAISE_READ_TIMEOUT_MS as cu, checkAppStoreIndex as d, encodeDnsQuery as da, readHandoffVerified as dc, wakeRequest as di, checkAppManifest as dl, walletNetworkOf as dn, BUTTON_STYLES as do, readGroupWant as dr, CALL_SIGNAL_MAX_AGE_MS as ds, ATPROTO_PROOF_COLLECTION as dt, turnPutSummary as du, HOLD_LIMITS as ea, handoffRetryAfter as ec, stripHidden as ed, mayPin as ei, readKnockSlot as el, PaymentPreflightError as en, nextReactionNumber as eo, engineText as er, RELAY_POLL_INTERVALS as es, SshSigError as et, deviceEchoNonce as eu, readAppStore as f, isPublicAddress as fa, sealHandoffPiece as fc, checkPushEndpoint as fi, isAppUrl as fl, SPARK_NETWORKS as fn, CRON_LINE as fo, readGroupWantNo as fr, QUICK_REDIAL_MS as fs, ATPROTO_PROOF_SCOPE as ft, TURN_LAST_SEQUENCE as fu, GroupTypingBoard as g, recordsFromWellKnown as ga, setAckFrame as gc, APP_DATA_MAX_BYTES as gi, sha256Paced as gl, isBitcoinAddress as gn, ROUTINE_STATES as go, SIGNAL_HOLD_MS as gr, callRtcConfig as gs, checkAtprotoProofRecord as gt, readTurnPacket as gu, GROUP_TYPING_FRAME as h, recordsFromTxt as ha, readSetUpdate as hc, isServeId as hi, readAppBundleAsync as hl, sparkInvoiceDetails as hn, PR_STATES as ho, SIGNAL_FRESH_MS as hr, buildSdpFromSignal as hs, atprotoProofRkey as ht, nextTurnPosition as hu, addedAppPermissions as i, newMailbox as ia, readHandoffAck as ic, randomBytes as id, readPin as ii, APP_BUNDLE_LIMITS as il, USDT_PUBLIC_RPC as in, readReaction as io, GROUP_WANT_FRAME as ir, formatLocalTarget as is, sshSignCommand as it, newDeviceSetSecret as iu, knockRecords as j, VOICE_METER as ja, readEnrollGrant as jc, IdentityCheckUnavailable as ji, signAppRevocation as jl, cashuRequestPayload as jn, heardTime as jo, lobbyRecords as jr, HANDOFF_OFFER as js, didSignedMessages as jt, normalizeRelayUrl as ju, entryParams as k, PLAYABLE_AUDIO as ka, enrollHelloFrame as kc, IDENTITY_MAX_VALIDITY as ki, setAppSignatureFastPath as kl, decodeBolt11 as kn, arrivalKey as ko, hubRank as kr, HANDOFF_HAVE as ks, didGhostlyServiceEntry as kt, SLOW_MS as ku, planAppUpdate as l, domainTxtRecord as la, readHandoffPake as lc, parseWakeFrame as li, appViewOf as ll, formatPaymentAmount as ln, replySnippet as lo, readGroupFileMeta as lr, encodeControl as ls, ATPROTO_DECLARED_SCOPE as lt, TURN_SETTLE_MS as lu, signAppStore as m, normalizeDomain as ma, SET_UPDATE as mc, APP_RANGE_LIMITS as mi, readAppBundle as ml, sparkAddressKind as mn, PR_CHECKS as mo, GROUP_SIGNAL_FRAME as mr, answersOffer as ms, atprotoProofRecord as mt, firstDeviceSetSecret as mu, readX401SdJwtVc as n, HoldRefusedError as na, handoffVersions as nc, fromBase64Url as nd, pinIsNewer as ni, requestRecords as nl, SEPOLIA_TEST_USDT_FAUCET as nn, reactionEmoji as no, GROUP_FILE_LIMITS as nr, presenceSeenAt as ns, parseSshSignature as nt, deviceLinkPairing as nu, appStoreDecision as o, DOMAIN_FILE_MAX_BYTES as oa, readHandoffDone as oc, toZ32 as od, WakeLimiter as oi, APP_ICON_PATH as ol, arkAddressPrefix as on, wireReaction as oo, fetchesByItself as or, webLocalFetch as os, verifyBitcoinMessage as ot, webCryptoSigner as ou, readAppStoreSteps as p, nip05RootKey as pa, SET_ACK as pc, vapidKeysMatch as pi, pacer as pl, SPARK_PROVIDER as pn, ITEM_STATES as po, CarriedTransport as pr, RTC_CONFIG as ps, atprotoDidMethod as pt, TURN_MAX as pu, carryMentions as q, parseLinkPreview as qa, knockSlotIdentity as qc, TRANSPORTS as qi, inviteLink as ql, LIVENESS_PING_MS as qn, ratchetSessionOf as qo, TYPING_KINDS as qr, handoffDigest as qs, encodeDidDhtDeactivated as qt, identityFromSeedB64 as qu, sameX401HolderJwk as r, isHoldUrl as ra, newHandoffId as rc, isZ32Key as rd, pinNumberHolds as ri, seenEntry as rl, TEST_USDT_FAUCET_AMOUNT as rn, reactionIsNewer as ro, GROUP_HAVE_FRAME as rr, GhostlyHttpError as rs, sameSshKey as rt, devicePingFrame as ru, appUpdateDecision as s, decodeDnsResponse as sa, readHandoffHave as sc, utf8Decode as sd, deviceWakeRequest as si, APP_PERMISSIONS as sl, assertTokenUnits as sn, pairedReplyAuthor as so, groupFileFallback as sr, LIMITS as ss, BitcoinAddressError as st, TURN_PUT_WINDOW_MS as su, newX401HolderKey as t, HoldKeys as ta, handoffStreamKey as tc, bytesEqual as td, nextPinNumber as ti, readLinkRecord as tl, SEPOLIA_TEST_USDT as tn, queueReaction as to, parseEngineError as tr, WATCH_PEER_MS as ts, parseSshPublicKey as tt, deviceKeyZ32 as tu, APP_STORE_LIMITS as u, domainWellKnownFile as ua, readHandoffTurnFrame as uc, relayRequest as ui, assembleAppBundle as ul, validatePaymentTarget as un, BUTTON_ID as uo, readGroupHave as ur, BURST_RING_MS as us, ATPROTO_FULL_SCOPE as ut, classifyTurnRead as uu, openGroupTyping as v, txtValue as va, signTombstone as vc, isAppVersion as vi, APP_STATEMENT_LIMITS as vl, isPubkyKey as vn, STATUS_CARD_LIMITS as vo, groupSignalFrame as vr, contactRtcConfig as vs, normalizeAtprotoHandle as vt, signTurnRelease as vu, decodeCommunityLink as w, DHT_FILE_CAPABILITY as wa, enrollCancelFrame as wc, CapsExchange as wi, isAppKey as wl, pubkyProofPath as wn, cardUrl as wo, COMMUNITY_TOPOLOGY as wr, LEGACY_SERVICES as ws, DID_FILE_MAX_BYTES as wt, DEFAULT_RELAYS as wu, CommunitySession as x, DHT_FILE_TOO_LARGE as xa, ENROLL_GRANT as xc, EDIT_CAPABILITY as xi, appRefPublisher as xl, normalizePubkyKey as xn, appCardUrl as xo, mayBeHub as xr, signalHasVideo as xs, AtprotoProofError as xt, turnName as xu, sealGroupTyping as y, wellKnownUrl as ya, verifySetUpdate as yc, APPS_CAPABILITY as yi, appFingerprint as yl, isPubkyProofFolder as yn, TASK_STATUSES as yo, readGroupSignal as yr, extractParamsFromSdp as ys, parseAtprotoDidDocument as yt, turnInstance as yu, GROUP_LIMITS as z, EDIT_BUFFER_MS as za, settleRequest as zc, isIdentityBinding as zi, readContactLink as zl, withoutVideoMetadata as zn, parseGroupCommit as zo, readLobby as zr, handoffAttemptAllowed as zs, parseDidDocument as zt, PacketTooLargeError as zu };
37916
38449
 
37917
- //# sourceMappingURL=src-CCt5s4DK.js.map
38450
+ //# sourceMappingURL=src-BIdfHB7t.js.map