@ghostlytools/cli 1.10.1 → 1.10.2

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 (94) hide show
  1. package/README.md +10 -8
  2. package/SKILL.md +3 -2
  3. package/dist/assets/{api-BOWLZYXM.js → api-DcE4KylM.js} +2 -2
  4. package/dist/assets/{api-Bi6hCcwG.js → api-EUGHGnRz.js} +95 -43
  5. package/dist/assets/api-EUGHGnRz.js.map +1 -0
  6. package/dist/assets/{apiKit-DzXHZojD.js → apiKit-CJVp_crp.js} +68 -22
  7. package/dist/assets/apiKit-CJVp_crp.js.map +1 -0
  8. package/dist/assets/{apps-0Ks6KjqS.js → apps-C-KbyLCa.js} +1 -1
  9. package/dist/assets/{apps-DIQbzG08.js → apps-C54T_MOT.js} +5 -5
  10. package/dist/assets/{apps-DIQbzG08.js.map → apps-C54T_MOT.js.map} +1 -1
  11. package/dist/assets/{arkade-zozCldAE.js → arkade-BmxJTa65.js} +2 -2
  12. package/dist/assets/{arkade-zozCldAE.js.map → arkade-BmxJTa65.js.map} +1 -1
  13. package/dist/assets/{backup-BL49Kt-T.js → backup-BxSH5BZG.js} +7 -7
  14. package/dist/assets/{backup-BL49Kt-T.js.map → backup-BxSH5BZG.js.map} +1 -1
  15. package/dist/assets/{backup-BvIFcZM7.js → backup-C0Plp-DF.js} +1 -1
  16. package/dist/assets/{buttons-CAW5v5EE.js → buttons-B-ZJYdo0.js} +6 -6
  17. package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-B-ZJYdo0.js.map} +1 -1
  18. package/dist/assets/buttons-DA3wZfG0.js +2 -0
  19. package/dist/assets/{client-CyApKBEw.js → client-CDa87uYD.js} +3 -3
  20. package/dist/assets/{client-CyApKBEw.js.map → client-CDa87uYD.js.map} +1 -1
  21. package/dist/assets/{codec-DqFxxB_q.js → codec-D45W1L8n.js} +2 -2
  22. package/dist/assets/{codec-DqFxxB_q.js.map → codec-D45W1L8n.js.map} +1 -1
  23. package/dist/assets/{envelope-CMUgz31I.js → envelope-C3yFCQa-.js} +2 -2
  24. package/dist/assets/{envelope-CMUgz31I.js.map → envelope-C3yFCQa-.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-C6nCHjOa.js} +4 -4
  28. package/dist/assets/{fixedHosts-C2hdCfzK.js.map → fixedHosts-C6nCHjOa.js.map} +1 -1
  29. package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-DYopNE57.js} +156 -41
  30. package/dist/assets/groupFiles-DYopNE57.js.map +1 -0
  31. package/dist/assets/{host-CaRlDMTd.js → host-G5seUwaI.js} +108 -55
  32. package/dist/assets/host-G5seUwaI.js.map +1 -0
  33. package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-B_uHjg_r.js} +28 -20
  34. package/dist/assets/hyperdhtRelay-B_uHjg_r.js.map +1 -0
  35. package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-C-2oslSU.js} +112 -34
  36. package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-C-2oslSU.js.map} +1 -1
  37. package/dist/assets/{main-Bc4Ow56Z.js → main-Dk--nD7X.js} +69 -41
  38. package/dist/assets/main-Dk--nD7X.js.map +1 -0
  39. package/dist/assets/{mainline-DWh4Ccri.js → mainline-HPlVrl8R.js} +5 -5
  40. package/dist/assets/mainline-HPlVrl8R.js.map +1 -0
  41. package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-CfpO9ayz.js} +3 -3
  42. package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-CfpO9ayz.js.map} +1 -1
  43. package/dist/assets/{nwc-DoSEhUKb.js → nwc-BY7BPttn.js} +3 -3
  44. package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BY7BPttn.js.map} +1 -1
  45. package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-CfpbNUf7.js} +2 -2
  46. package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-CfpbNUf7.js.map} +1 -1
  47. package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DJFZM2cV.js} +2 -2
  48. package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DJFZM2cV.js.map} +1 -1
  49. package/dist/assets/{profiles-DgIfvBeN.js → profiles-DKmZGXp6.js} +13 -6
  50. package/dist/assets/profiles-DKmZGXp6.js.map +1 -0
  51. package/dist/assets/{registry-BSyxGjN6.js → registry-BUm4cAzV.js} +54 -15
  52. package/dist/assets/registry-BUm4cAzV.js.map +1 -0
  53. package/dist/assets/{registry-C5cn80Rw.js → registry-CAzrtV0_.js} +1 -1
  54. package/dist/assets/{resolve-D-9YRFhl.js → resolve-CDD4X68j.js} +5 -3
  55. package/dist/assets/resolve-CDD4X68j.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-DcOsgYDU.js} +821 -299
  62. package/dist/assets/server-DcOsgYDU.js.map +1 -0
  63. package/dist/assets/{src-CCt5s4DK.js → src-D31D1_oY.js} +417 -67
  64. package/dist/assets/src-D31D1_oY.js.map +1 -0
  65. package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-DerRwMf3.js} +2 -2
  66. package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-DerRwMf3.js.map} +1 -1
  67. package/dist/assets/{translate-Cb-6hMhD.js → translate-C-sj0VJe.js} +3 -3
  68. package/dist/assets/{translate-Cb-6hMhD.js.map → translate-C-sj0VJe.js.map} +1 -1
  69. package/dist/assets/{usdt-ds461mzA.js → usdt-DwHqp625.js} +3 -3
  70. package/dist/assets/{usdt-ds461mzA.js.map → usdt-DwHqp625.js.map} +1 -1
  71. package/dist/assets/{waitNotice-B8D8WhbE.js → waitNotice-D52RWbV4.js} +38 -4
  72. package/dist/assets/waitNotice-D52RWbV4.js.map +1 -0
  73. package/dist/assets/{words-B1ylON2h.js → words-Db9WgatT.js} +3 -3
  74. package/dist/assets/words-Db9WgatT.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/groupFiles-BAQIt_bJ.js.map +0 -1
  82. package/dist/assets/host-CaRlDMTd.js.map +0 -1
  83. package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
  84. package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
  85. package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
  86. package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
  87. package/dist/assets/registry-BSyxGjN6.js.map +0 -1
  88. package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
  89. package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
  90. package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
  91. package/dist/assets/server-BufntkX8.js.map +0 -1
  92. package/dist/assets/src-CCt5s4DK.js.map +0 -1
  93. package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
  94. 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. */
@@ -1086,10 +1102,10 @@ var GROUP_SIGNALING_ALLOWANCE_SHARE = 2 / 15;
1086
1102
  * 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
1103
  * goes to every relay). A member asks it only while it has no edge up in that community.
1088
1104
  *
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").
1105
+ * At worst a relay then sees, in one minute, its limit, the chats' allowance past it, the edges', this one and the edges'
1106
+ * answer reads' (`ANSWER_READ_ALLOWANCE`): 49 on a relay of 30 (pkarr.pubky.org allows 50 an address,
1107
+ * `x-ratelimit-limit`), 95 on pkarr.pubky.app's 60 (it allows 1000) and 7 on a relay of 5 (relay.pkarr.org and
1108
+ * pkarr.miguelmedeiros.dev allow 10). A share raised past those limits gets 429s (docs/TRANSPORTS.md, "The default list").
1093
1109
  */
1094
1110
  var WAY_BACK_SHARE = 1 / 5;
1095
1111
  /** Past the limit, a group's reads within its allowance go no more often than this on a relay. */
@@ -1257,6 +1273,22 @@ function normalizeRelayUrl(input) {
1257
1273
  return null;
1258
1274
  }
1259
1275
  }
1276
+ /**
1277
+ * Why a line of a Pkarr relay list is not a relay `normalizeRelayUrl` keeps, with the line as typed; null when it is
1278
+ * one. A host alone or another scheme (`relay.example.org`, `wss://…`) was meant as an https:// relay.
1279
+ */
1280
+ function relayUrlProblem(input) {
1281
+ const line = input.trim();
1282
+ if (normalizeRelayUrl(line)) return null;
1283
+ return looksLikeHost(line) || looksLikeHost(line.replace(/^[a-z][a-z\d+.-]*:\/\//i, "")) ? `Use an https:// relay address: ${line}` : `Not a relay address: ${line}`;
1284
+ }
1285
+ /** No space, and a dot after the first character, before the last one and before any `/` or `:`; linear, for a long pasted line. */
1286
+ function looksLikeHost(text) {
1287
+ if (/\s/.test(text)) return false;
1288
+ const slash = text.search(/[/:]/);
1289
+ const dot = text.indexOf(".", 1);
1290
+ return dot > 0 && dot < text.length - 1 && (slash < 0 || dot < slash);
1291
+ }
1260
1292
  /** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
1261
1293
  var RelayLeftAloneError = class extends Error {};
1262
1294
  /**
@@ -1301,8 +1333,9 @@ var RelayTransport = class {
1301
1333
  spentBackground = /* @__PURE__ */ new Map();
1302
1334
  /** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
1303
1335
  spentBackgroundWrites = /* @__PURE__ */ new Map();
1304
- /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
1336
+ /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`: edges' reads for an answer apart (`ANSWER_READ_FIRST_MS`). */
1305
1337
  spentGroupUrgent = /* @__PURE__ */ new Map();
1338
+ spentAnswerUrgent = /* @__PURE__ */ new Map();
1306
1339
  /** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
1307
1340
  spentWatch = /* @__PURE__ */ new Map();
1308
1341
  /** 1:1 chats' watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`CHAT_WATCH_SHARE`). */
@@ -1313,6 +1346,8 @@ var RelayTransport = class {
1313
1346
  spentGroupSignal = /* @__PURE__ */ new Map();
1314
1347
  /** Community members' ways back on each relay in the last minute: their allowance (`WAY_BACK_SHARE`). */
1315
1348
  spentWayBack = /* @__PURE__ */ new Map();
1349
+ /** Edges' reads for an answer that only their own allowance let through, on each relay in the last minute (`ANSWER_READ_ALLOWANCE`). */
1350
+ spentAnswerAllowance = /* @__PURE__ */ new Map();
1316
1351
  /** Per contact, its departed reads past the limit in the last minute, every relay together (`DEPARTED_READS`). */
1317
1352
  departedOver = /* @__PURE__ */ new Map();
1318
1353
  /**
@@ -1331,6 +1366,8 @@ var RelayTransport = class {
1331
1366
  groupsFullAt = /* @__PURE__ */ new Map();
1332
1367
  /** When a link's write was last refused on each relay (`chat <relay>`, `group <relay>`), while it waits for the budget. */
1333
1368
  writeWaiting = /* @__PURE__ */ new Map();
1369
+ /** Per relay, the keys whose edges' reads for an answer it last refused, and when, until one is read (`ANSWER_READ_FIRST_MS`). */
1370
+ answerReadWaiting = /* @__PURE__ */ new Map();
1334
1371
  /**
1335
1372
  * Per key a 1:1 chat asks for: when it last read urgently (for the next minute, groups leave it `CHAT_RESERVE` on
1336
1373
  * every relay) and when the budget last refused it on each relay (the same, on that relay). A read of the key at a
@@ -2109,9 +2146,14 @@ var RelayTransport = class {
2109
2146
  if (isGroupRead(who) && (this.spent.get(relay)?.length ?? 0) >= this.limitOf(relay)) this.groupsFullAt.set(relay, now);
2110
2147
  if (isChat(who)) this.chatNeed(key, now, relay);
2111
2148
  if (writer) this.writeWaiting.set(`${writer} ${relay}`, now);
2149
+ if (isGroupAnswerRead(who)) {
2150
+ const waiting = this.answerReadWaiting.get(relay) ?? /* @__PURE__ */ new Map();
2151
+ this.answerReadWaiting.set(relay, waiting.set(key, now));
2152
+ }
2112
2153
  return false;
2113
2154
  }
2114
2155
  if (writer) this.writeWaiting.delete(`${writer} ${relay}`);
2156
+ if (isGroupAnswerRead(who)) this.answerReadWaiting.get(relay)?.delete(key);
2115
2157
  if (isWayBack(who) && this.heldFor(relay, {
2116
2158
  ...who,
2117
2159
  back: false
@@ -2126,6 +2168,18 @@ var RelayTransport = class {
2126
2168
  });
2127
2169
  return true;
2128
2170
  }
2171
+ if (isGroupAnswerRead(who) && this.heldFor(relay, who, now, key, false, false) > 0) {
2172
+ this.spentAnswerAllowance.set(relay, [...this.spentAnswerAllowance.get(relay) ?? [], now]);
2173
+ this.readTurns.set(key, {
2174
+ servedAt: now,
2175
+ askedAt: now,
2176
+ waiting: false,
2177
+ watch: false,
2178
+ lane: watchLane(who),
2179
+ answer: true
2180
+ });
2181
+ return true;
2182
+ }
2129
2183
  if (isGroupSignal(who) && !who.write && this.spent.get(relay).length >= this.limitOf(relay)) this.spentGroupOver.get(relay).push(now);
2130
2184
  if (isGroupSignal(who)) this.spentGroupSignal.get(relay).push(now);
2131
2185
  const departedOver = isDepartedRead(who) && this.spent.get(relay).length >= this.limitOf(relay);
@@ -2133,7 +2187,8 @@ var RelayTransport = class {
2133
2187
  this.spent.get(relay).push(now);
2134
2188
  if (who.background) this.spentBackground.get(relay).push(now);
2135
2189
  if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
2136
- if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
2190
+ if (isGroupUrgentRead(who) && isGroupAnswerRead(who)) this.spentAnswerUrgent.set(relay, [...this.spentAnswerUrgent.get(relay) ?? [], now]);
2191
+ else if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
2137
2192
  if (isWatch(who)) this.spentWatch.get(relay).push(now);
2138
2193
  if (isChatWatch(who) && !departedOver) this.spentChatWatch.get(relay).push(now);
2139
2194
  if (isGroupRead(who)) this.spentGroupReads.get(relay).push(now);
@@ -2159,9 +2214,10 @@ var RelayTransport = class {
2159
2214
  * Who goes first: a chat's refused write holds back everything but chat writes; a group's refused write holds back
2160
2215
  * group reads and background requests, never a chat's. Background requests yield to a link that signals. A chat's
2161
2216
  * 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`).
2217
+ * contact that just went away (`DEPARTED_READS`). `ownAllowance` false: what holds an edge's read for its answer
2218
+ * without its own allowance (`ANSWER_READ_ALLOWANCE`).
2163
2219
  */
2164
- heldFor(relay, who, now = Date.now(), key, turns = true) {
2220
+ heldFor(relay, who, now = Date.now(), key, turns = true, ownAllowance = true) {
2165
2221
  const recent = (this.spent.get(relay) ?? []).filter((at) => now - at < 6e4);
2166
2222
  const recentBackground = (this.spentBackground.get(relay) ?? []).filter((at) => now - at < 6e4);
2167
2223
  this.spent.set(relay, recent);
@@ -2190,9 +2246,12 @@ var RelayTransport = class {
2190
2246
  }
2191
2247
  const burst = (this.spentGroupUrgent.get(relay) ?? []).filter((at) => now - at < GROUP_BURST_MS);
2192
2248
  this.spentGroupUrgent.set(relay, burst);
2249
+ const answerBurst = (this.spentAnswerUrgent.get(relay) ?? []).filter((at) => now - at < GROUP_BURST_MS);
2250
+ this.spentAnswerUrgent.set(relay, answerBurst);
2193
2251
  if (isGroupUrgentRead(who)) {
2194
2252
  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);
2253
+ const spent = isGroupAnswerRead(who) ? answerBurst : burst;
2254
+ if (spent.length >= most) wait = Math.max(wait, spent[spent.length - most] + GROUP_BURST_MS - now);
2196
2255
  }
2197
2256
  const watched = (this.spentWatch.get(relay) ?? []).filter((at) => now - at < GROUP_RATION_WINDOW_MS);
2198
2257
  this.spentWatch.set(relay, watched);
@@ -2215,7 +2274,7 @@ var RelayTransport = class {
2215
2274
  if (isGroupRead(who) && !pastLimit && now - (this.groupsFullAt.get(relay) ?? -Infinity) < GROUP_RATION_MS) {
2216
2275
  const most = Math.max(1, Math.ceil(limit * GROUP_RATION_WINDOW_MS / 6e4));
2217
2276
  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;
2277
+ if (this.readsAhead(key, now, void 0, isGroupAnswerRead(who)) > 0) turn = TURN_WAIT_MS;
2219
2278
  }
2220
2279
  if (who.group && !groupFloor || who.background) {
2221
2280
  const reserved = this.chatReservedFor(relay, now);
@@ -2227,11 +2286,44 @@ var RelayTransport = class {
2227
2286
  return at !== void 0 && now - at < 5e3 ? at + WRITE_FIRST_MS - now : 0;
2228
2287
  };
2229
2288
  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"));
2289
+ if ((writer === null && who.group && !pastLimit && !isGroupAnswerRead(who) || who.background) && !starved) wait = Math.max(wait, waiting("group"));
2290
+ if (isGroupSignal(who) && !isGroupAnswerRead(who)) {
2291
+ const ahead = this.answerReadAhead(relay, now);
2292
+ if (ahead && this.heldFor(relay, ANSWER_READER, now, ahead.key, false, false) <= 0) wait = Math.max(wait, ahead.ms);
2293
+ }
2231
2294
  if (turns && wait <= 0 && isTurnRead(who) && this.turnAhead(relay, key, who, now)) turn = TURN_WAIT_MS;
2232
2295
  if (wait > 0 && isWayBack(who) && this.wayBackLeft(relay, who, now) > 0) return 0;
2296
+ if (wait > 0 && ownAllowance && isGroupAnswerRead(who) && this.answerAllowanceFree(relay, now)) return 0;
2233
2297
  return Math.max(wait, turn, 0);
2234
2298
  }
2299
+ /**
2300
+ * The edges' reads for their answers may take their own allowance on this relay now (`ANSWER_READ_ALLOWANCE`): fewer
2301
+ * than it in the last minute, and none within `ANSWER_READ_SPACING_MS`. None where the groups have no allowance.
2302
+ */
2303
+ answerAllowanceFree(relay, now) {
2304
+ const spent = (this.spentAnswerAllowance.get(relay) ?? []).filter((at) => now - at < 6e4);
2305
+ this.spentAnswerAllowance.set(relay, spent);
2306
+ const most = Math.min(3, Math.floor(this.limitOf(relay) * GROUP_SIGNALING_ALLOWANCE_SHARE));
2307
+ return spent.length < most && (spent.length === 0 || now - spent[spent.length - 1] >= 2e4);
2308
+ }
2309
+ /**
2310
+ * The edges' reads for their answers the budget refused on this relay within `ANSWER_READ_FIRST_MS`, still not read:
2311
+ * the key refused last, and how long the groups' other signaling waits for them there. Undefined when there is none.
2312
+ */
2313
+ answerReadAhead(relay, now) {
2314
+ const waiting = this.answerReadWaiting.get(relay);
2315
+ if (!waiting) return void 0;
2316
+ let last;
2317
+ for (const [key, at] of waiting) if (now - at >= 5e3) waiting.delete(key);
2318
+ else if (!last || at > last.at) last = {
2319
+ key,
2320
+ at
2321
+ };
2322
+ return last && {
2323
+ key: last.key,
2324
+ ms: last.at + 5e3 - now
2325
+ };
2326
+ }
2235
2327
  /** 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
2328
  wayBackLeft(relay, who, now) {
2237
2329
  const spent = (this.spentWayBack.get(relay) ?? []).filter((at) => now - at < 6e4);
@@ -2247,20 +2339,23 @@ var RelayTransport = class {
2247
2339
  askedAt: now,
2248
2340
  waiting: true,
2249
2341
  watch: isWatch(who) || isChatWatch(who),
2250
- lane: watchLane(who)
2342
+ lane: watchLane(who),
2343
+ answer: isGroupAnswerRead(who)
2251
2344
  });
2252
2345
  }
2253
2346
  /**
2254
2347
  * Keys a group reads, still asking (within `WATCH_TURN_MS`), that were read longer ago than `key`: a share keeps a
2255
2348
  * 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`).
2349
+ * would keep a turn it cannot take. The chats' watched keys only in their own lane (`CHAT_WATCH_SHARE`). `answer`: an
2350
+ * edge's read for its answer, which waits only for the others' (`ANSWER_READ_FIRST_MS`).
2257
2351
  */
2258
- readsAhead(key, now, watchLane) {
2352
+ readsAhead(key, now, watchLane, answer = false) {
2259
2353
  const mine = key === void 0 ? -Infinity : this.readTurns.get(key)?.servedAt ?? -Infinity;
2260
2354
  let ahead = 0;
2261
2355
  for (const [other, turn] of this.readTurns) {
2262
2356
  if (other === key || !turn.waiting || now - turn.askedAt >= WATCH_TURN_MS) continue;
2263
2357
  if (watchLane !== void 0 ? !turn.watch || turn.lane !== watchLane : turn.lane === "chat") continue;
2358
+ if (answer && !turn.answer) continue;
2264
2359
  if (turn.servedAt < mine) ahead++;
2265
2360
  }
2266
2361
  return ahead;
@@ -6535,6 +6630,8 @@ var ICE_UFRAG = /^[A-Za-z0-9+/]{4,256}$/;
6535
6630
  var ICE_PWD = /^[A-Za-z0-9+/]{22,256}$/;
6536
6631
  var ICE_FOUNDATION = /^[A-Za-z0-9+/]{1,32}$/;
6537
6632
  var CANDIDATE_ADDRESS = /^[A-Za-z0-9.:-]{1,64}$/;
6633
+ 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}$/;
6634
+ 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
6635
  var CANDIDATE_TYPES$1 = /* @__PURE__ */ new Set([
6539
6636
  "host",
6540
6637
  "srflx",
@@ -6544,6 +6641,24 @@ var CANDIDATE_TYPES$1 = /* @__PURE__ */ new Set([
6544
6641
  var EXTENSION_TOKEN = /^[A-Za-z0-9+/._-]{1,64}$/;
6545
6642
  var DIGITS = /^\d{1,10}$/;
6546
6643
  var MAX_CANDIDATES = 8;
6644
+ function isIpv6(text) {
6645
+ const halves = text.split("::");
6646
+ if (halves.length > 2) return false;
6647
+ const groups = halves.flatMap((half) => half ? half.split(":") : []);
6648
+ const v4 = groups.length > 0 && IPV4.test(groups[groups.length - 1]);
6649
+ if (v4) groups.pop();
6650
+ if (!groups.every((group) => /^[0-9a-fA-F]{1,4}$/.test(group))) return false;
6651
+ const count = groups.length + (v4 ? 2 : 0);
6652
+ return halves.length === 2 ? count < 8 : count === 8;
6653
+ }
6654
+ /**
6655
+ * Whether a contact's candidate address may go into this device's remote description: an IPv4 or IPv6 literal, or the
6656
+ * `<uuid>.local` name a browser gives its host candidate. Any other name would have this side's ICE agent look it up in
6657
+ * DNS, a request the contact chose, whatever the relay policy says.
6658
+ */
6659
+ function isCandidateAddress(address) {
6660
+ return IPV4.test(address) || MDNS_NAME.test(address) || address.includes(":") && isIpv6(address);
6661
+ }
6547
6662
  function uint(value, max) {
6548
6663
  if (!DIGITS.test(value)) return null;
6549
6664
  const n = Number(value);
@@ -6553,7 +6668,8 @@ function uint(value, max) {
6553
6668
  * Parses the part of an `a=candidate:` line that the signal carries
6554
6669
  * (`foundation component transport priority address port typ type [raddr a rport p] [ext value]...`)
6555
6670
  * 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.
6671
+ * well-formed candidate that is not UDP or not on an address (`isCandidateAddress`), skipped, and `null` for anything
6672
+ * malformed.
6557
6673
  */
6558
6674
  function normalizeCandidate(candidate) {
6559
6675
  if (typeof candidate !== "string" || candidate.length > 512) return null;
@@ -6582,6 +6698,7 @@ function normalizeCandidate(candidate) {
6582
6698
  } else if (!EXTENSION_TOKEN.test(value)) return null;
6583
6699
  }
6584
6700
  if (transport.toLowerCase() !== "udp") return void 0;
6701
+ if (!isCandidateAddress(address) || raddr !== null && !isCandidateAddress(raddr)) return void 0;
6585
6702
  let line = `${foundation} ${component} udp ${priority} ${address} ${port} typ ${type}`;
6586
6703
  if (raddr !== null && rport !== null) line += ` raddr ${raddr} rport ${rport}`;
6587
6704
  return line;
@@ -7024,6 +7141,7 @@ function parseRtcSignal(json) {
7024
7141
  const [type, address, port] = c.split(",");
7025
7142
  if (!CANDIDATE_TYPE_NAME[type] || !SAFE_ADDRESS.test(address ?? "") || !/^\d{1,5}$/.test(port ?? "")) return null;
7026
7143
  }
7144
+ const c = raw.c.filter((candidate) => isCandidateAddress(candidate.split(",")[1]));
7027
7145
  return {
7028
7146
  t: raw.t,
7029
7147
  ts: raw.ts,
@@ -7032,7 +7150,7 @@ function parseRtcSignal(json) {
7032
7150
  p: raw.p,
7033
7151
  f: raw.f,
7034
7152
  s: raw.s,
7035
- c: raw.c
7153
+ c
7036
7154
  };
7037
7155
  }
7038
7156
  function buildDataSdp(signal) {
@@ -8076,6 +8194,10 @@ var LinkSession = class {
8076
8194
  lastCallSignalIn = null;
8077
8195
  /** The `_rtc` signal the last packet that went out carried. */
8078
8196
  rtcSignalOut = null;
8197
+ /** Counts the signals taken back (`setRtcSignal(null)`): each ends an attempt. */
8198
+ rtcAttempt = 0;
8199
+ /** A publish that went out carried a signal of this attempt (since the last take-back). */
8200
+ rtcAttemptOut = false;
8079
8201
  lastRtcSignalIn = null;
8080
8202
  /** The `_rtc` signal the peer's packet carried as last read (null: none), whether or not it was new. */
8081
8203
  peerRtcSignal = null;
@@ -8085,6 +8207,8 @@ var LinkSession = class {
8085
8207
  /** When a read first found the peer's packet advertising with no `_tr` (0: the last packet that said carried one). */
8086
8208
  transportsAbsentSince = 0;
8087
8209
  transportsGone = false;
8210
+ /** The peer's packet carried a `_tr` and the last read found none (`onPeerTransportsUnsaid`). */
8211
+ transportsUnsaid = false;
8088
8212
  running = false;
8089
8213
  /** Stopped without a last packet (`stop(false)`): nothing more goes out. */
8090
8214
  silent = false;
@@ -8113,6 +8237,8 @@ var LinkSession = class {
8113
8237
  fastStepsAfter = 0;
8114
8238
  /** Fast reads still signaling since this side's last new offer or answer went out (`SIGNAL_OUT_READS`). */
8115
8239
  signalReadsLeft = 0;
8240
+ /** Fast reads still signaling while the contact's offer is due (`SIGNAL_DUE_READS`). */
8241
+ dueSignalReadsLeft = 0;
8116
8242
  /** When the last `expectPeer` window ends (or ended): the pace slows down from there step by step. */
8117
8243
  expectUntil = 0;
8118
8244
  /**
@@ -8182,6 +8308,13 @@ var LinkSession = class {
8182
8308
  get peerPresence() {
8183
8309
  return this.presence;
8184
8310
  }
8311
+ /**
8312
+ * The relays took a WebRTC signal of this attempt: its answer, or an earlier one of it. Not an earlier attempt's still
8313
+ * in the packet out: its take-back, a background write, is the first the relays' budget holds back.
8314
+ */
8315
+ get rtcSignalPublished() {
8316
+ return this.rtcAttemptOut;
8317
+ }
8185
8318
  /** The `_rtc` signal the peer's packet carries, as last read: null when it carries none. */
8186
8319
  get peerSignal() {
8187
8320
  return this.peerRtcSignal;
@@ -8268,21 +8401,24 @@ var LinkSession = class {
8268
8401
  setFastPoll(fast, offer = false) {
8269
8402
  this.fastPollUntil = fast ? Date.now() + (offer ? OFFER_LOOK_MS : FAST_POLL_MAX_MS) : 0;
8270
8403
  this.fastStepsAfter = fast && offer ? Date.now() + OFFER_FAST_MS : 0;
8271
- this.signalReadsLeft = 0;
8404
+ this.signalReadsLeft = this.dueSignalReadsLeft = 0;
8272
8405
  if (fast) this.pollNow();
8273
8406
  }
8274
8407
  /**
8275
8408
  * 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.
8409
+ * then slow down step by step (`nextInterval`) rather than at once. `signal`: its offer is due now (it may be out
8410
+ * already): a read goes at once, even inside a window already looking fast, and the first reads that look for it are
8411
+ * signaling (`SIGNAL_DUE_READS`).
8277
8412
  */
8278
- expectPeer(awaited = false) {
8413
+ expectPeer(awaited = false, signal = false) {
8279
8414
  const until = Date.now() + EXPECT_PEER_MS;
8280
8415
  this.expectUntil = Math.max(this.expectUntil, until);
8281
8416
  if (awaited) this.awaitedUntil = Math.max(this.awaitedUntil, until);
8417
+ if (signal) this.dueSignalReadsLeft = 3;
8282
8418
  const stepping = this.fastStepsAfter > 0 && Date.now() >= this.fastStepsAfter;
8283
8419
  if (this.fastStepsAfter) this.fastStepsAfter = Math.max(this.fastStepsAfter, until);
8284
8420
  if (until <= this.fastPollUntil) {
8285
- if (stepping) this.pollNow();
8421
+ if (stepping || signal) this.pollNow();
8286
8422
  return;
8287
8423
  }
8288
8424
  this.fastPollUntil = until;
@@ -8307,7 +8443,7 @@ var LinkSession = class {
8307
8443
  */
8308
8444
  calm() {
8309
8445
  if (this.rtcSignal !== null) return;
8310
- this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = this.lingerUntil = 0;
8446
+ this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = this.lingerUntil = this.dueSignalReadsLeft = 0;
8311
8447
  }
8312
8448
  /** The data link carries chat and services while it is up. */
8313
8449
  setDataLinkOpen(open) {
@@ -8365,6 +8501,10 @@ var LinkSession = class {
8365
8501
  async setRtcSignal(signal, reportFailure = false) {
8366
8502
  if (this.rtcSignal === signal) return;
8367
8503
  this.rtcSignal = signal;
8504
+ if (signal === null) {
8505
+ this.rtcAttempt++;
8506
+ this.rtcAttemptOut = false;
8507
+ }
8368
8508
  if (reportFailure) await this.publish(signal === null);
8369
8509
  else await this.publish(signal === null).catch(() => {});
8370
8510
  if (signal) this.pollNow();
@@ -8514,6 +8654,7 @@ var LinkSession = class {
8514
8654
  }
8515
8655
  async publishOnce(advertise, upkeep = false) {
8516
8656
  const rtcSignal = advertise ? this.rtcSignal : null;
8657
+ const attempt = this.rtcAttempt;
8517
8658
  const started = Date.now();
8518
8659
  let keptMessages;
8519
8660
  try {
@@ -8567,6 +8708,7 @@ var LinkSession = class {
8567
8708
  if (lapsed) this.pollNow();
8568
8709
  }
8569
8710
  this.rtcSignalOut = rtcSignal;
8711
+ if (rtcSignal && attempt === this.rtcAttempt) this.rtcAttemptOut = true;
8570
8712
  traceLink(this.identity.pubKeyZ32, "publish", {
8571
8713
  ms,
8572
8714
  rtc: !!rtcSignal,
@@ -8602,14 +8744,23 @@ var LinkSession = class {
8602
8744
  });
8603
8745
  const started = Date.now();
8604
8746
  let heldBackMs;
8747
+ /** This read is one of `SIGNAL_DUE_READS`: one the budget held back asked nothing of the relays, and is not counted. */
8748
+ let dueRead = false;
8605
8749
  try {
8606
8750
  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--;
8751
+ const signalOut = pace === "fast" && this.rtcSignalOut !== null && (this.fastStepsAfter > 0 || this.signalReadsLeft > 0);
8752
+ const signal = signalOut || pace === "fast" && this.dueSignalReadsLeft > 0;
8753
+ if (signalOut) {
8754
+ if (!this.fastStepsAfter) this.signalReadsLeft--;
8755
+ } else if (signal) {
8756
+ this.dueSignalReadsLeft--;
8757
+ dueRead = true;
8758
+ }
8609
8759
  const watch = !signal && this.watching();
8610
8760
  const departed = !signal && Date.now() < this.departedUntil;
8611
8761
  const background = pace === "background" || pace === "connected" || pace === "idle" && !this.active;
8612
8762
  const resume = !signal && !watch && (this.resumeReads || Date.now() < this.awaitedUntil);
8763
+ let unread;
8613
8764
  const packet = await this.transport.resolve(this.peerPubKeyZ32, {
8614
8765
  background,
8615
8766
  urgent: pace === "fast",
@@ -8617,9 +8768,13 @@ var LinkSession = class {
8617
8768
  ...watch && { watch },
8618
8769
  ...departed && { departed },
8619
8770
  ...resume && { resume }
8771
+ }, false).catch((error) => {
8772
+ if (!(error instanceof RelaysFailedError)) throw error;
8773
+ unread = error;
8774
+ return error.kept;
8620
8775
  });
8621
8776
  if (!this.running) return;
8622
- this.discoveryResult("read");
8777
+ this.discoveryResult("read", unread);
8623
8778
  const ms = Date.now() - started;
8624
8779
  const wasOnline = this.presence.online, wasSeen = this.presence.lastPacketAt;
8625
8780
  const readBefore = this.lastReadAt, peerPacketBefore = this.peerPacketAt;
@@ -8668,8 +8823,16 @@ var LinkSession = class {
8668
8823
  this.lastTransportsIn = batch.transports;
8669
8824
  this.events.onPeerTransports?.(batch.transports);
8670
8825
  }
8826
+ if (this.transportsUnsaid) {
8827
+ this.transportsUnsaid = false;
8828
+ this.events.onPeerTransportsUnsaid?.(false);
8829
+ }
8671
8830
  } else if (batch.services !== null && !this.transportsGone) {
8672
8831
  this.transportsAbsentSince ||= Date.now();
8832
+ if (!this.transportsUnsaid && this.lastTransportsIn !== null) {
8833
+ this.transportsUnsaid = true;
8834
+ this.events.onPeerTransportsUnsaid?.(true);
8835
+ }
8673
8836
  if (Date.now() - this.transportsAbsentSince >= 12e4) {
8674
8837
  this.transportsGone = true;
8675
8838
  this.lastTransportsIn = null;
@@ -8694,6 +8857,7 @@ var LinkSession = class {
8694
8857
  first: wasSeen === 0
8695
8858
  });
8696
8859
  if (newSignal) {
8860
+ this.dueSignalReadsLeft = 0;
8697
8861
  this.lastRtcSignalIn = batch.rtcSignal;
8698
8862
  this.events.onRtcSignal?.(batch.rtcSignal, readBefore ? {
8699
8863
  since: readBefore,
@@ -8730,6 +8894,7 @@ var LinkSession = class {
8730
8894
  }
8731
8895
  } finally {
8732
8896
  this.polling = false;
8897
+ if (dueRead && heldBackMs !== void 0) this.dueSignalReadsLeft++;
8733
8898
  if (this.running && this.pollAgain) {
8734
8899
  this.pollAgain = false;
8735
8900
  if (this.pollTimer) clearTimeout(this.pollTimer);
@@ -8870,6 +9035,17 @@ var ANSWER_REFUSED_AFTER_MS = 1e3;
8870
9035
  /** An offer this close to the end of the offerer's attempt is not answered again: the new answer would come too late. */
8871
9036
  var REANSWER_MARGIN_MS = 15e3;
8872
9037
  /**
9038
+ * An answer to this side's offer that comes this long or more after the offer reached the relays was read late (the
9039
+ * relays' request budget held the read back, a restart's first minute), and an attempt that ends after this side made
9040
+ * its answer again (`REANSWERS`) this long after it took an offer that still stands answered one the offerer has not
9041
+ * read yet. Neither says anything about direct connections (`DirectEvidence`): the answering side's ICE gives up about
9042
+ * 30 s after its answer with no reply, so the answer that went in late found nobody there, and the offerer gives up on
9043
+ * the attempt and offers again. Taken for a network that lets nothing through, a group's edge went native on both
9044
+ * sides, and past the native slots members stayed unreachable for the rest of a restart lab (agents#971, 2026-11-03):
9045
+ * of 38 answers read 60 s or more after their offer, 13 connected nothing; of 78 read within 20 s, none failed.
9046
+ */
9047
+ var LATE_ANSWER_MS = 2e4;
9048
+ /**
8873
9049
  * Traces the candidate pair an opened data link uses, by type only (host, srflx, prflx, relay; never an address): two
8874
9050
  * devices on one network should meet host to host. A connection without stats (a test's fake) traces nothing.
8875
9051
  */
@@ -8899,6 +9075,10 @@ var DataLink = class {
8899
9075
  /** Each connection's listeners, and its data channel's (`wrapDataChannel`), dropped once it is closed. */
8900
9076
  ends = /* @__PURE__ */ new WeakMap();
8901
9077
  myOfferTs = 0;
9078
+ /** When this side's offer reached the relays, as far as this link knows (`signalWentOut`). */
9079
+ myOfferOutAt = 0;
9080
+ /** The answer to this side's offer came `LATE_ANSWER_MS` or more after the offer went out. */
9081
+ answerCameLate = false;
8902
9082
  /**
8903
9083
  * An offer or answer of this side's that went without a public candidate came to nothing (both descriptions were
8904
9084
  * exchanged, and no path connected): the next one waits for its STUN servers as long as it takes
@@ -8951,7 +9131,8 @@ var DataLink = class {
8951
9131
  this.setState("offering");
8952
9132
  this.options.setFastPoll(true, true);
8953
9133
  }
8954
- this.myOfferTs = Date.now();
9134
+ this.myOfferTs = this.myOfferOutAt = Date.now();
9135
+ this.answerCameLate = false;
8955
9136
  this.sentLacksPublic = !PUBLIC_CANDIDATE.test(pc.localDescription?.sdp ?? "");
8956
9137
  const signal = {
8957
9138
  t: "o",
@@ -9018,6 +9199,9 @@ var DataLink = class {
9018
9199
  } else if (this.state === "offering" && signal.o === this.myOfferTs && this.pc) {
9019
9200
  this.lastSignalTs = signal.ts;
9020
9201
  const pc = this.pc;
9202
+ const sinceOffer = Date.now() - this.myOfferOutAt;
9203
+ this.answerCameLate = sinceOffer >= LATE_ANSWER_MS;
9204
+ if (this.answerCameLate) traceLink(this.options.myPubKeyZ32, "answer-late", { ms: sinceOffer });
9021
9205
  try {
9022
9206
  this.remoteSdp = buildDataSdp(signal);
9023
9207
  await pc.setRemoteDescription({
@@ -9050,6 +9234,28 @@ var DataLink = class {
9050
9234
  return null;
9051
9235
  }
9052
9236
  }
9237
+ /**
9238
+ * The answer this side's offer is connecting on came `LATE_ANSWER_MS` or more after the offer went out: if it connects
9239
+ * nothing, that says nothing about direct connections, and the link offers again (`GhostLink`'s stall of a group link).
9240
+ */
9241
+ get answerLate() {
9242
+ return this.state === "connecting" && !!this.myOfferTs && this.answerCameLate;
9243
+ }
9244
+ /**
9245
+ * This side answered, and no answer of its went out in this attempt (`signalOut`: the relays' budget held every one
9246
+ * back): the offerer never had one to try (agents#1637). The answering side's twin of `answerLate`.
9247
+ */
9248
+ get answerNotOut() {
9249
+ return this.state === "connecting" && !this.myOfferTs && this.options.signalOut?.() === false;
9250
+ }
9251
+ /**
9252
+ * This attempt, if it ends now without opening, says nothing about direct connections: the answer to this side's offer
9253
+ * was read late (`answerLate`), or this side's answer never went out (`answerNotOut`). An answer made again and still
9254
+ * unread `LATE_ANSWER_MS` on (`failed`) is the same case, seen from the offer that still stands.
9255
+ */
9256
+ get saysNothing() {
9257
+ return this.answerLate || this.answerNotOut;
9258
+ }
9053
9259
  /** The peer connection this link holds now (null when idle): a later one is another attempt. */
9054
9260
  get connection() {
9055
9261
  return this.pc;
@@ -9075,7 +9281,7 @@ var DataLink = class {
9075
9281
  * nothing: the next offer or answer gathers for as long as it takes.
9076
9282
  */
9077
9283
  noteNoPublic(ended) {
9078
- if (ended && (this.myOfferTs || this.answered) && this.sentLacksPublic && this.state === "connecting") this.fullGather = true;
9284
+ if (ended && !this.saysNothing && (this.myOfferTs || this.answered) && this.sentLacksPublic && this.state === "connecting") this.fullGather = true;
9079
9285
  }
9080
9286
  /**
9081
9287
  * What this attempt says about direct connections if it ends now without opening: nothing unless both descriptions
@@ -9083,7 +9289,7 @@ var DataLink = class {
9083
9289
  * candidate, a public port per STUN server, or (for the side that offered) candidates that read as reachable.
9084
9290
  */
9085
9291
  directEvidence() {
9086
- if (this.state !== "connecting" || !this.pc) return null;
9292
+ if (this.state !== "connecting" || !this.pc || this.saysNothing) return null;
9087
9293
  const local = this.pc.localDescription?.sdp ?? "";
9088
9294
  return !PUBLIC_CANDIDATE.test(local) ? "no-public" : symmetricNat(local) ? "symmetric" : this.myOfferTs ? "no-path" : null;
9089
9295
  }
@@ -9104,8 +9310,13 @@ var DataLink = class {
9104
9310
  const answered = this.state === "connecting" ? this.answered : null;
9105
9311
  const left = answered ? CONNECT_TIMEOUT_MS - (Date.now() - answered.at) : 0;
9106
9312
  const givenUp = !!answered && this.options.offerStanding?.(answered.offer.ts) === false;
9107
- const evidence = givenUp ? null : this.directEvidence();
9108
- this.noteNoPublic(!givenUp);
9313
+ const unread = !!answered && answered.again > 0 && Date.now() - answered.at >= 2e4 && this.options.offerStanding?.(answered.offer.ts) === true;
9314
+ if (unread) traceLink(this.options.myPubKeyZ32, "answer-unread", {
9315
+ again: answered.again,
9316
+ sinceMs: Date.now() - answered.at
9317
+ });
9318
+ const evidence = givenUp || unread ? null : this.directEvidence();
9319
+ this.noteNoPublic(!givenUp && !unread);
9109
9320
  if (answered && answered.again < 2 && left > REANSWER_MARGIN_MS && this.options.offerStanding?.(answered.offer.ts)) {
9110
9321
  answered.again++;
9111
9322
  traceLink(this.options.myPubKeyZ32, "reanswer", {
@@ -9261,6 +9472,7 @@ var DataLink = class {
9261
9472
  * counts from here, so the other side has as long to read it as if it had gone out at once.
9262
9473
  */
9263
9474
  signalWentOut() {
9475
+ if (this.state === "offering" && this.myOfferTs) this.myOfferOutAt = Date.now();
9264
9476
  if (this.pc && this.connectTimer && this.state !== "open" && this.state !== "idle") this.startAttemptTimer(this.pc);
9265
9477
  }
9266
9478
  clearTimers() {
@@ -9272,7 +9484,8 @@ var DataLink = class {
9272
9484
  this.clearTimers();
9273
9485
  const pc = this.pc;
9274
9486
  this.pc = null;
9275
- this.myOfferTs = 0;
9487
+ this.myOfferTs = this.myOfferOutAt = 0;
9488
+ this.answerCameLate = false;
9276
9489
  this.remoteSdp = null;
9277
9490
  if (!pc) return false;
9278
9491
  this.closeConnection(pc);
@@ -12205,6 +12418,7 @@ var DhtDelivery = class DhtDelivery {
12205
12418
  this.lastPublish = 0;
12206
12419
  this.leavingUntil = mode === "stream" ? Date.now() + LEAVING_DHT_FAST_MS : 0;
12207
12420
  if (mode === "dht") this.signalReads = 0;
12421
+ else if (this.state.peerMode === "dht") this.signalReads = 3;
12208
12422
  this.changed();
12209
12423
  });
12210
12424
  this.tick();
@@ -13004,6 +13218,7 @@ var DhtDelivery = class DhtDelivery {
13004
13218
  if (isDiscoveryBudgetError(error)) this.readHeld(error.retryInMs);
13005
13219
  else if (readAt >= this.networkBackAt) this.errors.read = `Could not read DHT delivery: ${error instanceof Error ? error.message : String(error)}`;
13006
13220
  }
13221
+ if (signal && this.readHeldUntil > 0) this.signalReads++;
13007
13222
  if (this.state.peerMode !== "dht") this.signalReads = 0;
13008
13223
  await this.publishOnTick();
13009
13224
  this.changed();
@@ -15320,6 +15535,18 @@ var IdentityCheckUnavailable = class extends Error {
15320
15535
  var IDENTITY_CHECK_UNAVAILABLE = "Your contact's app could not check it. Try again later.";
15321
15536
  var TOO_MANY_RECEIVED = "Your contact keeps too many identities from you already";
15322
15537
  var peerError = (e) => e instanceof IdentityCheckUnavailable ? IDENTITY_CHECK_UNAVAILABLE : shortError(e);
15538
+ var UNSUPPORTED_KIND = "Your contact's app cannot verify this kind of identity yet";
15539
+ var NOT_IN_PROFILE = "That identity is no longer in your profile";
15540
+ var CONTACT_REFUSED = "Your contact could not verify it";
15541
+ var EXPIRED = "The proof has expired";
15542
+ /** The refusals a contact's app writes itself (onRequest, onPresent): the only words of its `idp-result` kept as they came. */
15543
+ var CONTACT_REFUSALS = /* @__PURE__ */ new Set([
15544
+ UNSUPPORTED_KIND,
15545
+ IDENTITY_CHECK_UNAVAILABLE,
15546
+ TOO_MANY_RECEIVED,
15547
+ REVOKED,
15548
+ EXPIRED
15549
+ ]);
15323
15550
  /**
15324
15551
  * The `idp-*` exchange of one conversation. Frames (all JSON, additive, over the paired channel,
15325
15552
  * only when both offers carry `identity-proof/1`):
@@ -15335,6 +15562,8 @@ var IdentityExchange = class {
15335
15562
  options;
15336
15563
  peerProviders;
15337
15564
  requested = /* @__PURE__ */ new Set();
15565
+ /** The nonces of the presentations in their provider's check now. */
15566
+ checking = /* @__PURE__ */ new Set();
15338
15567
  constructor(options) {
15339
15568
  this.options = options;
15340
15569
  }
@@ -15424,19 +15653,24 @@ var IdentityExchange = class {
15424
15653
  }
15425
15654
  /** Stop sharing here. The contact is told (now or on reconnect); a copy it kept cannot be erased. */
15426
15655
  async withdraw(id, connected) {
15427
- const s = this.shared(id);
15656
+ let s = this.shared(id);
15428
15657
  if (!s || s.status === "withdrawn") return;
15429
15658
  this.requested.delete(id);
15430
15659
  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;
15660
+ let answered;
15661
+ await this.options.storage.update((l) => {
15662
+ answered = l.shared.find((x) => x.id === id && x.status === "pending");
15663
+ return answered ? l : this.log({
15664
+ ...l,
15665
+ shared: l.shared.filter((x) => x.id !== id)
15666
+ }, {
15667
+ type: "unsent",
15668
+ side: "mine",
15669
+ proof: id
15670
+ });
15671
+ });
15672
+ if (!answered) return;
15673
+ s = answered;
15440
15674
  }
15441
15675
  await this.setShared({
15442
15676
  ...s,
@@ -15534,12 +15768,21 @@ var IdentityExchange = class {
15534
15768
  return;
15535
15769
  case "idp-request": return await this.onRequest(id, frame.provider);
15536
15770
  case "idp-challenge": return await this.onChallenge(id, frame.nonce, frame.issuedAt);
15537
- case "idp-present": return await this.onPresent(frame);
15771
+ case "idp-present": {
15772
+ const nonce = typeof frame.nonce === "string" ? frame.nonce : "";
15773
+ if (this.checking.has(nonce)) throw new Error("Unknown or reused identity challenge");
15774
+ this.checking.add(nonce);
15775
+ try {
15776
+ return await this.onPresent(frame);
15777
+ } finally {
15778
+ this.checking.delete(nonce);
15779
+ }
15780
+ }
15538
15781
  case "idp-result": {
15539
15782
  const s = id ? this.shared(id) : void 0;
15540
15783
  if (!s || s.status !== "pending") return;
15541
15784
  const ok = frame.ok === true;
15542
- const error = ok ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
15785
+ const error = ok ? void 0 : typeof frame.error === "string" && CONTACT_REFUSALS.has(frame.error) ? frame.error : CONTACT_REFUSED;
15543
15786
  const entry = {
15544
15787
  ...s,
15545
15788
  status: ok ? "accepted" : "rejected",
@@ -15547,7 +15790,14 @@ var IdentityExchange = class {
15547
15790
  error
15548
15791
  };
15549
15792
  const replaced = (x) => ok && x.status === "accepted" && x.provider === s.provider && x.subject === s.subject;
15550
- await this.options.storage.update((l) => this.log({
15793
+ await this.options.storage.update((l) => l.shared.filter((x) => x.id !== s.id && replaced(x)).reduce((out, x) => this.log(out, {
15794
+ type: "stopped",
15795
+ side: "mine",
15796
+ proof: x.id,
15797
+ provider: x.provider,
15798
+ subject: x.subject,
15799
+ reason: "withdrawn"
15800
+ }), this.log({
15551
15801
  ...l,
15552
15802
  shared: [...l.shared.filter((x) => x.id !== s.id).map((x) => replaced(x) ? {
15553
15803
  ...x,
@@ -15560,7 +15810,7 @@ var IdentityExchange = class {
15560
15810
  proof: s.id,
15561
15811
  ok,
15562
15812
  error
15563
- }));
15813
+ })));
15564
15814
  return;
15565
15815
  }
15566
15816
  case "idp-withdraw": {
@@ -15610,11 +15860,12 @@ var IdentityExchange = class {
15610
15860
  async onRequest(id, provider) {
15611
15861
  if (!id) return;
15612
15862
  if (typeof provider !== "string" || !this.options.providers().includes(provider)) {
15863
+ const error = UNSUPPORTED_KIND;
15613
15864
  this.send({
15614
15865
  t: "idp-result",
15615
15866
  id,
15616
15867
  ok: false,
15617
- error: "Your contact's app cannot verify this kind of identity yet"
15868
+ error
15618
15869
  });
15619
15870
  return;
15620
15871
  }
@@ -15653,7 +15904,7 @@ var IdentityExchange = class {
15653
15904
  this.requested.delete(id);
15654
15905
  const local = await this.options.localProof(id);
15655
15906
  if (!local) {
15656
- const error = "That identity is no longer in your profile";
15907
+ const error = NOT_IN_PROFILE;
15657
15908
  await this.setShared({
15658
15909
  ...s,
15659
15910
  status: "rejected",
@@ -15670,12 +15921,24 @@ var IdentityExchange = class {
15670
15921
  }
15671
15922
  const scope = this.options.scope();
15672
15923
  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
15924
+ let stopped = false;
15925
+ await this.options.storage.update((l) => {
15926
+ const x = l.shared.find((y) => y.id === id);
15927
+ if (!x || x.status !== "queued" && x.status !== "pending") {
15928
+ stopped = true;
15929
+ return l;
15930
+ }
15931
+ return {
15932
+ ...l,
15933
+ shared: [...l.shared.filter((y) => y.id !== id), {
15934
+ ...x,
15935
+ status: "pending",
15936
+ at: this.now(),
15937
+ error: void 0
15938
+ }]
15939
+ };
15678
15940
  });
15941
+ if (stopped) return;
15679
15942
  this.send({
15680
15943
  t: "idp-present",
15681
15944
  nonce,
@@ -15699,6 +15962,7 @@ var IdentityExchange = class {
15699
15962
  let error;
15700
15963
  /** The same, as this side's own timeline says it. */
15701
15964
  let reason;
15965
+ /** Its owner withdrew the proof while this check ran: no result goes out (see below). */
15702
15966
  let withdrawn = false;
15703
15967
  try {
15704
15968
  const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
@@ -15708,7 +15972,7 @@ var IdentityExchange = class {
15708
15972
  if (!verifyIdentityPresentation(binding.key, sig, id, scope, nonce, issuedAt)) throw new Error("The proof key did not sign this conversation's challenge");
15709
15973
  if (binding.issuedAt > now + 300) throw new Error("The proof is dated in the future");
15710
15974
  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");
15975
+ if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error(EXPIRED);
15712
15976
  if (await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);
15713
15977
  verified = result;
15714
15978
  } catch (e) {
@@ -15719,6 +15983,11 @@ var IdentityExchange = class {
15719
15983
  const challenge = challengeOf(l);
15720
15984
  if (!challenge) throw new Error("Unknown or reused identity challenge");
15721
15985
  const challenges = l.challenges.filter((c) => c.nonce !== nonce);
15986
+ withdrawn = !!challenge.withdrawn;
15987
+ 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 {
15988
+ ...l,
15989
+ challenges
15990
+ };
15722
15991
  const subject = verified?.subject;
15723
15992
  if (verified && revokedHere(l.received, id)) {
15724
15993
  verified = void 0;
@@ -15743,7 +16012,6 @@ var IdentityExchange = class {
15743
16012
  ...logged,
15744
16013
  challenges
15745
16014
  };
15746
- withdrawn = !!challenge.withdrawn;
15747
16015
  const record = {
15748
16016
  id,
15749
16017
  binding,
@@ -15756,11 +16024,18 @@ var IdentityExchange = class {
15756
16024
  checkedAt: now,
15757
16025
  status: withdrawn ? "withdrawn" : "verified"
15758
16026
  };
15759
- const kept = {
16027
+ 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, {
16028
+ type: "stopped",
16029
+ side: "theirs",
16030
+ proof: r.id,
16031
+ provider: r.binding.provider,
16032
+ subject: r.verified.subject,
16033
+ reason: "withdrawn"
16034
+ }), {
15760
16035
  ...logged,
15761
16036
  challenges,
15762
16037
  received: [...received, record]
15763
- };
16038
+ });
15764
16039
  return withdrawn ? this.log(kept, {
15765
16040
  type: "stopped",
15766
16041
  side: "theirs",
@@ -18682,6 +18957,15 @@ function decodeFileData(message) {
18682
18957
  data: message.subarray(body)
18683
18958
  };
18684
18959
  }
18960
+ /**
18961
+ * 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
18962
+ * name, `QuotaExceededError` (IndexedDB's, the OPFS worker's, the CLI's), never by its words: each storage words it
18963
+ * its own way, and Chromium's own has no message at all. The app reads that name as "no room here" (errorText.ts).
18964
+ */
18965
+ function storeFailure(error) {
18966
+ const message = (error instanceof Error ? error.message : String(error)).trim();
18967
+ return `Could not store the file: ${error?.name === "QuotaExceededError" && !message.startsWith("QuotaExceededError") ? `QuotaExceededError${message ? `: ${message}` : ""}` : message}`;
18968
+ }
18685
18969
  /** What a refusal means to the sender's person. */
18686
18970
  function refusalText(why, room) {
18687
18971
  switch (why) {
@@ -19171,7 +19455,7 @@ var ChatFiles = class {
19171
19455
  this.armNudge(entry);
19172
19456
  }, (error) => {
19173
19457
  incoming.starting = false;
19174
- this.end(entry, "failed", `Could not store the file: ${error instanceof Error ? error.message : String(error)}`);
19458
+ this.end(entry, "failed", storeFailure(error));
19175
19459
  this.send({
19176
19460
  t: "pf-refuse",
19177
19461
  id: entry.record.id,
@@ -19465,7 +19749,7 @@ var ChatFiles = class {
19465
19749
  if (incoming.stored - incoming.checkpointed >= FILE_LIMITS.checkpointBytes) await this.checkpointNow(entry);
19466
19750
  }).catch((error) => {
19467
19751
  if (transferEnded(record)) return;
19468
- this.end(entry, "failed", `Could not store the file: ${error instanceof Error ? error.message : String(error)}`);
19752
+ this.end(entry, "failed", storeFailure(error));
19469
19753
  target.then((t) => t.discard()).catch(() => {});
19470
19754
  this.send({
19471
19755
  t: "pf-refuse",
@@ -21431,6 +21715,13 @@ function pairedMessageFits(ts, m, reply, forwarded, card) {
21431
21715
  return pairedMessageFrame("A".repeat(22), ts, m, void 0, reply, forwarded, card).length <= SESSION_FRAME_MAX;
21432
21716
  }
21433
21717
  /**
21718
+ * The `paired-edit` frame of this edit fits a session, as `pairedMessageFits` says of a text's: an edit within 16 KiB
21719
+ * can pass it the same way, and the contact's session ends on it each time it is said again.
21720
+ */
21721
+ function pairedEditFits(edit) {
21722
+ return editFrame(edit).length <= SESSION_FRAME_MAX;
21723
+ }
21724
+ /**
21434
21725
  * A native descriptor from the contact's capability record against the one known (a session's, or an older record's).
21435
21726
  * The record carries only how to dial, never an address: the Iroh endpoint id and the relay it is homed on, the
21436
21727
  * HyperDHT key and the relay a browser's goes through. For the same endpoint, a known Iroh descriptor keeps its
@@ -21758,14 +22049,20 @@ var GhostLink = class {
21758
22049
  /** A signal ready to go: on the live session during a switch to WebRTC, in this side's packet otherwise. */
21759
22050
  signalOut(signed, report) {
21760
22051
  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
- }));
22052
+ if (signed) {
22053
+ this.channel.send(JSON.stringify({
22054
+ t: "paired-rtc",
22055
+ signal: signed
22056
+ }));
22057
+ this.rtcViaChannel = true;
22058
+ }
21765
22059
  return;
21766
22060
  }
22061
+ if (!signed) this.rtcViaChannel = false;
21767
22062
  this.session.setRtcSignal(signed, !!this.options.params.profile).catch(report);
21768
22063
  }
22064
+ /** A WebRTC signal of this attempt went over the authenticated channel (a migration), not the relays. */
22065
+ rtcViaChannel = false;
21769
22066
  /** This app is going away (`depart`): no more dials. */
21770
22067
  leaving = false;
21771
22068
  /** `resume` still to act on: the first dial after the start goes to it, and a native one is knocked on. */
@@ -21984,6 +22281,9 @@ var GhostLink = class {
21984
22281
  onPeerClock: (packetAt, readBefore, readAt) => events.onPeerClock?.(packetAt, readBefore, readAt),
21985
22282
  onPeerTransports: (value) => this.peerPacketTransports(value),
21986
22283
  onPeerTransportsGone: () => this.peerPacketTransportsGone(),
22284
+ onPeerTransportsUnsaid: (unsaid) => {
22285
+ if (options.packetTransports && !this.stopped) events.onPacketTransportsUnsaid?.(unsaid);
22286
+ },
21987
22287
  onDiscoveryError: (error) => events.onDiscoveryError?.(error),
21988
22288
  onStatus: (status) => events.onStatus?.(status),
21989
22289
  onPoll: (poll) => events.onPoll?.(poll)
@@ -22035,6 +22335,7 @@ var GhostLink = class {
22035
22335
  offerStanding: (ts) => !this.leaving && !this.stopped && !this.streamBlocked && this.peerOfferTs() === ts,
22036
22336
  onAnswerReplaced: () => this.redial(),
22037
22337
  onDirect: (evidence) => events.onDirectEvidence?.(evidence),
22338
+ signalOut: () => this.rtcViaChannel || this.session.rtcSignalPublished,
22038
22339
  onAnswersRefused: () => this.answersRefused(),
22039
22340
  onOpen: (channel) => {
22040
22341
  if (this.streamBlocked || this.keyStopped) {
@@ -22082,6 +22383,12 @@ var GhostLink = class {
22082
22383
  if (this.offered?.epoch === this.connectionEpoch) this.scheduleRace(this.offered.epoch, this.offered.at);
22083
22384
  if (options.packetTransports) setTimeout(() => {
22084
22385
  if (this.answeredAt !== answeredAt || this.channel || this.stopped || this.dataLink.state !== "connecting") return;
22386
+ if (this.dataLink.answerLate) {
22387
+ traceLink(this.myPubKeyZ32, "rtc-stalled", { late: true });
22388
+ this.dataLink.abandon();
22389
+ this.redial();
22390
+ return;
22391
+ }
22085
22392
  traceLink(this.myPubKeyZ32, "rtc-stalled", {});
22086
22393
  events.onRtcStalled?.();
22087
22394
  }, RACE_ANSWERED_MS);
@@ -22193,7 +22500,7 @@ var GhostLink = class {
22193
22500
  const tracker = this.tracker;
22194
22501
  if (!tracker || tracker.done) return;
22195
22502
  if (state === "answering") tracker.offerReceived();
22196
- else if (state === "connecting" && was === "offering") tracker.answerReceived();
22503
+ else if ((state === "connecting" || state === "open") && was === "offering") tracker.answerReceived();
22197
22504
  else if (state === "idle") {
22198
22505
  if (was === "offering") tracker.failed("timeout", true);
22199
22506
  else if (was === "answering" || was === "connecting") tracker.failed("transport", true);
@@ -22268,7 +22575,7 @@ var GhostLink = class {
22268
22575
  traceLink(this.myPubKeyZ32, "unblocked", { held: !!this.heldSignal });
22269
22576
  this.autoConnectFailures = 0;
22270
22577
  this.lastAutoConnectAt = 0;
22271
- this.session.expectPeer();
22578
+ this.session.expectPeer(false, true);
22272
22579
  const held = this.heldSignal;
22273
22580
  this.heldSignal = null;
22274
22581
  if (held) this.handleRtcSignal(held.signal, held.sight);
@@ -24572,6 +24879,7 @@ var GhostLink = class {
24572
24879
  if (this.channel && this.isDataLinkOpen) {
24573
24880
  if (!this.supportsEdits) return "Your contact's app does not show edits yet";
24574
24881
  if (!edit.rm && !validEditNumber(edit.e) && !(edit.sc && this.supportsStatusCards)) return "Your contact's app takes no more edits of this message";
24882
+ if (!pairedEditFits(edit)) return PAIRED_FRAME_TOO_LARGE;
24575
24883
  try {
24576
24884
  this.channel.send(editFrame(edit));
24577
24885
  return null;
@@ -26273,6 +26581,7 @@ var GhostLink = class {
26273
26581
  if (!this.candidate) {
26274
26582
  this.cancelCandidate();
26275
26583
  this.switcher.stop();
26584
+ this.transitionTarget = this.transitionError = void 0;
26276
26585
  }
26277
26586
  this.activeBinding = void 0;
26278
26587
  this.paired?.stop();
@@ -27071,7 +27380,9 @@ var VIDEO_METADATA_LIMITS = {
27071
27380
  /** The most top-level boxes walked (a fragmented MP4 has two per fragment). */
27072
27381
  maxBoxes: 1e5,
27073
27382
  /** Bytes read first to tell a video from another file. */
27074
- headBytes: 64
27383
+ headBytes: 64,
27384
+ /** Bytes read at once for a box's header or a small box, so the next headers and `moof`s are read with it. */
27385
+ readAhead: 65536
27075
27386
  };
27076
27387
  /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
27077
27388
  var NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
@@ -27484,6 +27795,26 @@ function meets(ranges, start, end) {
27484
27795
  }
27485
27796
  return low < ranges.length && ranges[low][0] < end;
27486
27797
  }
27798
+ /**
27799
+ * `source` read a window at a time: a read that fits in `readAhead` bytes reads that many from where it starts, and
27800
+ * the reads after it within them (the next boxes' headers, a fragment's `moof`) are served from it, as copies (they
27801
+ * are changed in place). A Blob's read costs about the same whatever its size, so a fragment costs one, not three.
27802
+ */
27803
+ function readingAhead(source) {
27804
+ let start = 0, window = /* @__PURE__ */ new Uint8Array(0);
27805
+ return {
27806
+ size: source.size,
27807
+ async read(offset, length) {
27808
+ const end = start + window.length;
27809
+ if (offset < start || offset + length > end && end < source.size) {
27810
+ if (length > VIDEO_METADATA_LIMITS.readAhead) return source.read(offset, length);
27811
+ start = offset;
27812
+ window = await source.read(offset, VIDEO_METADATA_LIMITS.readAhead);
27813
+ }
27814
+ return window.slice(offset - start, offset - start + length);
27815
+ }
27816
+ };
27817
+ }
27487
27818
  /** A whole box's header in the file at `at`, read from it; undefined where none fits (bytes after the last box). */
27488
27819
  async function headerAt(source, at) {
27489
27820
  const head = await source.read(at, 16);
@@ -27538,7 +27869,8 @@ async function withoutVideoMetadata(source, mime) {
27538
27869
  * the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
27539
27870
  * Throws `NO_VIDEO_METADATA` as it does.
27540
27871
  */
27541
- async function videoMetadataPatches(source, mime) {
27872
+ async function videoMetadataPatches(file, mime) {
27873
+ const source = readingAhead(file);
27542
27874
  const head = await source.read(0, VIDEO_METADATA_LIMITS.headBytes);
27543
27875
  const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
27544
27876
  const container = containerOf(head, mime);
@@ -32164,6 +32496,24 @@ var GroupSession = class {
32164
32496
  get admin() {
32165
32497
  return rosterAdmin(this.roster);
32166
32498
  }
32499
+ /**
32500
+ * The roster in the order its members were last admitted, the creator first (WISP 902 § Transports, the edge a
32501
+ * member keeps): every member holding the same chain reads the same order, and a member reads everyone admitted
32502
+ * before it from its welcome. Kept for the current top commit.
32503
+ */
32504
+ get admissionOrder() {
32505
+ const top = this.top;
32506
+ if (this.admissionCache?.top === top) return this.admissionCache.order;
32507
+ const chain = this.state.chain, at = /* @__PURE__ */ new Map();
32508
+ for (let e = 1; e < chain.length; e++) if (chain[e].k === "add" && chain[e].s) at.set(chain[e].s, e);
32509
+ 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));
32510
+ this.admissionCache = {
32511
+ top,
32512
+ order
32513
+ };
32514
+ return order;
32515
+ }
32516
+ admissionCache;
32167
32517
  get isAdmin() {
32168
32518
  return this.admin === this.myKey && this.state.status === "active";
32169
32519
  }
@@ -37912,6 +38262,6 @@ function readX401SdJwtVc(text) {
37912
38262
  };
37913
38263
  }
37914
38264
  //#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 };
38265
+ export { SSHSIG_NAMESPACE as $, reactionEmoji as $a, requestRecords as $c, HoldKeys as $i, deviceLinkPairing as $l, engineError as $n, presenceSeenAt as $o, PIN_LIMITS as $r, handoffVersions as $s, ONCHAIN_PROVIDER as $t, isZ32Key as $u, knockIdentity as A, downsamplePeaks as Aa, verifyEnrollProof as Ac, IDENTITY_REVOCATION_LABEL as Ai, readImageMeta as Al, ENDPOINT as An, shownTime as Ao, lobbyKeys as Ar, HANDOFF_PIECE_BYTES as As, didJwsAlg as At, setLinkTraceSink as Au, GROUP_REACTED_FRAME as B, RateWindow as Ba, REQUEST_LIFETIME_MS as Bc, revokesIdentity as Bi, OwnInviteError as Bl, NO_PICTURE_METADATA as Bn, edgeParams as Bo, shouldBeHub as Br, handoffCancelFrame as Bs, parseDidSignaturePaste as Bt, parseRelayPayload as Bu, communityHasFrame as C, formatFileSize as Ca, enrollDigits as Cc, UPGRADE_CAPABILITY as Ci, readAppRevocation as Cl, pubkyProofFile as Cn, sameButtonText as Co, pickMeshHubs as Cr, HANDOFF_ACK as Cs, DID_DOCUMENT_MAX_BYTES as Ct, HEDGE_MS as Cu, decodeGroupEntryLink as D, VOICE_LIMITS as Da, enrollProofFrame as Dc, dialDescriptors as Di, signAppObject as Dl, requestLnurlInvoice as Dn, claimedTime as Do, doorHubs as Dr, HANDOFF_HELLO as Ds, checkDidJws as Dt, currentRelays as Du, KNOCK_TTL_MS as E, PLAYABLE_AUDIO as Ea, enrollHelloFrame as Ec, capsDescriptors as Ei, setAppSignatureFastPath as El, pubkyHomeserverOf as En, arrivalKey as Eo, beaconRecords as Er, HANDOFF_HAVE as Es, DidError as Et, SLOW_MS as Eu, GroupWakeLimiter as F, parseVideoMeta as Fa, planKnocks as Fc, identityRevocationValue as Fi, encodeContactLink as Fl, parseCashuRequestPayload as Fn, commitHash as Fo, pickHubs as Fr, filePartName as Fs, didWebFileUrl as Ft, PacketTooLargeError as Fu, GROUP_EDIT_FRAME as G, forwardedAgain as Ga, knockSlotOf as Gc, TRANSPORTS as Gi, inviteOwnership as Gl, GhostLink as Gn, DirectPathWatch as Go, transferEnded as Gr, handoffEphemeral as Gs, didDhtDocument as Gt, verify as Gu, GroupSession as H, LINK_TRAILING as Ha, contactAskerHolds as Hc, PeerProofs as Hi, decodeInviteCode as Hl, isStrippedPicture as Hn, RatchetBox as Ho, FILE_LIMITS as Hr, handoffContextProof as Hs, staticDidDocument as Ht, identityFromSeed as Hu, groupWakeFrame as I, EDIT_BUFFER_MS as Ia, settleRequest as Ic, identityStatement as Ii, readContactLink as Il, parseFedimintRequestPayload as In, parseGroupCommit as Io, rankHubs as Ir, handoffAttemptAllowed as Is, didWebHost as It, RELAY_PAYLOAD_MAX_BYTES as Iu, meshMessageRef as J, GROUP_REACTION_FRAME as Ja, makeStampPaced as Jc, irohDescriptor as Ji, ENROLL_CAPABILITY as Jl, PAIRED_FRAME_TOO_LARGE as Jn, DHT_POLL_INTERVALS as Jo, TYPING_REFRESH_MS as Jr, handoffOfferFrame as Js, encodeDidDhtPacket as Jt, hasVisible as Ju, GROUP_EDIT_TEXT_BYTES as K, readForwarded as Ka, knockSlotRecords as Kc, automaticTransport as Ki, ownInviteRefusal as Kl, INVITE_TAKEN as Kn, AWAITING_PEER_MS as Ko, transferStalled as Kr, handoffHelloFrame as Ks, didDhtFromPublicKey as Kt, MAX_AVATAR_LENGTH as Ku, groupWakes as L, EDIT_RATE_WINDOW_MS as La, takeRequest as Lc, isIdentityBinding as Li, createDeviceInvite as Ll, NO_VIDEO_METADATA as Ln, rosterAdmin as Lo, readBeacon as Lr, handoffAttemptFailed as Ls, normalizeDid as Lt, createRelayPayload as Lu, mergeKnocks as M, parseVoiceMeta as Ma, endedRequests as Mc, IdentityExchange as Mi, canonicalJsonBytes as Ml, fedimintRequestPayload as Mn, GROUP_MEMBER_CAP as Mo, mergeBeacon as Mr, HANDOFF_TIMINGS as Ms, didWebDocumentUrl as Mt, budgetRetryMs as Mu, readKnocks as N, voiceDownloadName as Na, inboxRecord as Nc, boundVerifiedIdentity as Ni, readCanonicalJson as Nl, findEndpoint as Nn, MAX_GROUP_CHAIN as No, mergeLobby as Nr, HANDOFF_VERIFIED as Ns, didWebFile as Nt, isDiscoveryBudgetError as Nu, encodeGroupEntryLink as O, VOICE_METER as Oa, readEnrollGrant as Oc, IDENTITY_MAX_EVIDENCE as Oi, signAppRevocation as Ol, resolveLightningDestination as On, heardTime as Oo, freshHubs as Or, HANDOFF_OFFER as Os, checkDidSignature as Ot, normalizeRelayUrl as Ou, GROUP_WAKE_FRAME as P, voiceLevel as Pa, newInbox as Pc, emptyIdentityLedger as Pi, createContactLink as Pl, isFederationId as Pn, MEMBER_KEY as Po, newerHead as Pr, NO_ATTEMPTS as Ps, didWebFileNames as Pt, withRequestOptions as Pu, SSHSIG_MAX_ARMOR as Q, queueReaction as Qa, readLinkRecord as Qc, HOLD_LIMITS as Qi, deviceKeyZ32 as Ql, EngineError as Qn, WATCH_PEER_MS as Qo, GROUP_PIN_FRAME as Qr, handoffStreamKey as Qs, EVM_TEST_CHAINS as Qt, fromBase64Url as Qu, parseGroupWakeFrame as R, MAX_REMOVAL_NUMBER as Ra, turnOff as Rc, newIdentityBinding as Ri, deviceInviteJoinerParams as Rl, videoMetadataPatches as Rn, rosterHas as Ro, readBeaconHead as Rr, handoffAttemptSucceeded as Rs, parseDid as Rt, newerPacket as Ru, GROUP_READ_NOTE_COMMUNITY as S, dhtFileId as Sa, enrollCancelReason as Sc, STATUS_CARD_CAPABILITY as Si, isAppRef as Sl, pubkyProofCapability as Sn, checkStatusCard as So, meshHubs as Sr, serviceIdFromName as Ss, verifyAtprotoRecordProof as St, HEDGE_MISSING_MS as Su, encodeCommunityLink as T, sanitizeMime as Ta, enrollGrantFrame as Tc, DHT_TEXT_CAPABILITY as Ti, readAppRevocations as Tl, homeserverWebEndpoint as Tn, statusCardText as To, beaconKeys as Tr, HANDOFF_DONE as Ts, DID_JWS_MAX_LENGTH as Tt, RelaysFailedError as Tu, frameBytes as U, linkStop as Ua, contactDay as Uc, emptyProofLedger as Ui, encodeInviteCode as Ul, stripPictureMetadata as Un, emptyRatchetState as Uo, FileUplink as Ur, handoffDataFrame as Us, strictBase64Url as Ut, identityFromSeedB64 as Uu, GROUP_READ_NOTE as V, dhtEditId as Va, contactAskerFrame as Vc, lastSharedWithMe as Vi, createChatInvite as Vl, PICTURE_METADATA_LIMITS as Vn, RATCHET_CAPABILITY as Vo, ChatFiles as Vr, handoffContext as Vs, signingKeys as Vt, createIdentity as Vu, COMMUNITY_EDIT_FRAME as W, parseLinkPreview as Wa, knockSlotIdentity as Wc, validExternalKey as Wi, inviteLink as Wl, withoutPictureMetadata as Wn, ratchetSessionOf as Wo, sentWhole as Wr, handoffDigest as Ws, DidDhtError as Wt, publicKeyFromZ32 as Wu, mentionsMember as X, ReactionWindow as Xa, openRequest as Xc, HOLD_CAPABILITY as Xi, deviceEchoFrame as Xl, pairedMessageFits as Xn, PRESENCE_WINDOW as Xo, sanitizeTypingStatus as Xr, handoffReleaseFrame as Xs, signDidDhtPacket as Xt, stripHidden as Xu, parseCommunityEdit as Y, REACTION_LIMITS as Ya, mergeContactKnocks as Yc, irohRelayUrl as Yi, HANDOFF_CAPABILITY as Yl, pairedEditFits as Yn, EXPECT_PEER_MS as Yo, TypingSender as Yr, handoffPakeFrame as Ys, resolveDidDht as Yt, sanitizeDisplayText as Yu, groupName as Z, nextReactionNumber as Za, readKnockSlot as Zc, HOLD_DATED_BACK_MS as Zi, deviceEchoNonce as Zl, pairedMessageFrame as Zn, RELAY_POLL_INTERVALS as Zo, typingActivity as Zr, handoffRetryAfter as Zs, ETHEREUM_USDT as Zt, bytesEqual as Zu, groupTypingEpoch as _, wellKnownUrl as _a, ENROLL_DONE as _c, chatAppId as _i, appRef as _l, PUBKY_PROOF_MAX_BYTES as _n, appCardId as _o, SIGNAL_REPLY_MS as _r, parseCallSignal as _s, isAtprotoDid as _t, turnKeys as _u, appRevocationFor as a, decodeDnsResponse as aa, readHandoffHello as ac, WAKE_CALL_INTERVAL_MS as ai, appDigest as al, WALLET_NETWORKS as an, readReply as ao, GROUP_WANT_NO_FRAME as ar, decodeControl as as, verifySshSignature as at, TURN_RAISE_READ_TIMEOUT_MS as au, COMMUNITY_LIMITS as b, peekDhtMailbox as ba, ENROLL_PROOF as bc, BUTTONS_CAPABILITY as bi, isAppHash as bl, newPubkyProofFolder as bn, cardLine as bo, MESH_HUBS as br, HTTP_SERVICE_PROTO as bs, shortAtprotoDid as bt, turnVerifierMark as bu, checkAppBeforeRun as c, domainWellKnownFile as ca, readHandoffVerified as cc, newWakeToken as ci, checkAppManifest as cl, assertWholeSats as cn, BUTTON_STYLES as co, isGroupMessageId as cr, CALL_SIGNAL_MAX_AGE_MS as cs, decodeAnyBitcoinAddress as ct, turnPutSummary as cu, checkAppStoreIndex as d, nip05RootKey as da, SET_UPDATE as dc, wakeRequest as di, readAppBundle as dl, walletNetworkOf as dn, PR_CHECKS as do, readGroupWant as dr, answersOffer as ds, ATPROTO_PROOF_COLLECTION as dt, firstDeviceSetSecret as du, HoldRefusedError as ea, newHandoffId as ec, randomBytes as ed, mayPin as ei, seenEntry as el, PaymentPreflightError as en, reactionIsNewer as eo, engineText as er, GhostlyHttpError as es, SshSigError as et, devicePingFrame as eu, readAppStore as f, normalizeDomain as fa, readSetUpdate as fc, checkPushEndpoint as fi, readAppBundleAsync as fl, SPARK_NETWORKS as fn, PR_STATES as fo, readGroupWantNo as fr, buildSdpFromSignal as fs, ATPROTO_PROOF_SCOPE as ft, nextTurnPosition as fu, GroupTypingBoard as g, txtValue as ga, verifySetUpdate as gc, APP_DATA_MAX_BYTES as gi, appFingerprint as gl, isBitcoinAddress as gn, TASK_STATUSES as go, SIGNAL_HOLD_MS as gr, extractParamsFromSdp as gs, checkAtprotoProofRecord as gt, turnInstance as gu, GROUP_TYPING_FRAME as h, recordsName as ha, signTombstone as hc, isServeId as hi, APP_STATEMENT_LIMITS as hl, sparkInvoiceDetails as hn, STATUS_CARD_LIMITS as ho, SIGNAL_FRESH_MS as hr, contactRtcConfig as hs, atprotoProofRkey as ht, signTurnRelease as hu, addedAppPermissions as i, DOMAIN_FILE_MAX_BYTES as ia, readHandoffHave as ic, utf8Encode as id, readPin as ii, APP_PERMISSIONS as il, USDT_PUBLIC_RPC as in, pairedReplyAuthor as io, GROUP_WANT_FRAME as ir, LIMITS as is, sshSignCommand as it, TURN_PUT_WINDOW_MS as iu, knockRecords as j, fileMessageText as ja, clearMissed as jc, IdentityCheckUnavailable as ji, canonicalJson as jl, cashuRequestPayload as jn, GROUP_ADMIN_OFF_ERROR as jo, lobbyRecords as jr, HANDOFF_REQUEST as js, didSignedMessages as jt, traceLink as ju, entryParams as k, baseMime as ka, readEnrollHello as kc, IDENTITY_MAX_VALIDITY as ki, parseImageMeta as kl, decodeBolt11 as kn, receivedTimestamp as ko, hubRank as kr, HANDOFF_PAKE as ks, didGhostlyServiceEntry as kt, relayUrlProblem as ku, planAppUpdate as l, encodeDnsQuery as la, sealHandoffPiece as lc, parseWakeFrame as li, isAppUrl as ll, formatPaymentAmount as ln, CRON_LINE as lo, readGroupFileMeta as lr, QUICK_REDIAL_MS as ls, ATPROTO_DECLARED_SCOPE as lt, TURN_LAST_SEQUENCE as lu, signAppStore as m, recordsFromWellKnown as ma, setUpdateFrame as mc, APP_RANGE_LIMITS as mi, APP_PREFIXES as ml, sparkAddressKind as mn, RUN_RESULTS as mo, GROUP_SIGNAL_FRAME as mr, callSignalHeardAt as ms, atprotoProofRecord as mt, signTurnPacket as mu, readX401SdJwtVc as n, newMailbox as na, readHandoffCancel as nc, toZ32 as nd, pinIsNewer as ni, APP_BUNDLE_MAGIC as nl, SEPOLIA_TEST_USDT_FAUCET as nn, validReactionNumber as no, GROUP_FILE_LIMITS as nr, parseLocalTarget as ns, parseSshSignature as nt, seedSigner as nu, appStoreDecision as o, dnsProofName as oa, readHandoffPake as oc, WakeLimiter as oi, appViewOf as ol, arkAddressPrefix as on, replySnippet as oo, fetchesByItself as or, encodeControl as os, verifyBitcoinMessage as ot, TURN_SETTLE_MS as ou, readAppStoreSteps as p, recordsFromTxt as pa, setAckFrame as pc, vapidKeysMatch as pi, sha256Paced as pl, SPARK_PROVIDER as pn, ROUTINE_STATES as po, CarriedTransport as pr, callRtcConfig as ps, atprotoDidMethod as pt, readTurnPacket as pu, carryMentions as q, COMMUNITY_REACTION_FRAME as qa, linkRecords as qc, dialableIrohRelay as qi, DEVICES_CAPABILITY as ql, LIVENESS_PING_MS as qn, DAEMON_WATCH_PEER_IDLE_MS as qo, TYPING_KINDS as qr, handoffManifestFrames as qs, encodeDidDhtDeactivated as qt, sanitizeAvatar as qu, sameX401HolderJwk as r, readManifest as ra, readHandoffDone as rc, utf8Decode as rd, pinNumberHolds as ri, APP_ICON_PATH as rl, TEST_USDT_FAUCET_AMOUNT as rn, wireReaction as ro, GROUP_HAVE_FRAME as rr, webLocalFetch as rs, sameSshKey as rt, webCryptoSigner as ru, appUpdateDecision as s, domainTxtRecord as sa, readHandoffTurnFrame as sc, deviceWakeRequest as si, assembleAppBundle as sl, assertTokenUnits as sn, BUTTON_ID as so, groupFileFallback as sr, BURST_RING_MS as ss, BitcoinAddressError as st, classifyTurnRead as su, newX401HolderKey as t, isHoldUrl as ta, readHandoffAck as tc, toBase64Url as td, nextPinNumber as ti, APP_BUNDLE_LIMITS as tl, SEPOLIA_TEST_USDT as tn, readReaction as to, parseEngineError as tr, formatLocalTarget as ts, parseSshPublicKey as tt, newDeviceSetSecret as tu, APP_STORE_LIMITS as u, isPublicAddress as ua, SET_ACK as uc, relayRequest as ui, pacer as ul, validatePaymentTarget as un, ITEM_STATES as uo, readGroupHave as ur, RTC_CONFIG as us, ATPROTO_FULL_SCOPE as ut, TURN_MAX as uu, openGroupTyping as v, DHT_FILE_TOO_LARGE as va, ENROLL_GRANT as vc, isAppVersion as vi, appRefPublisher as vl, isPubkyKey as vn, appCardUrl as vo, groupSignalFrame as vr, signalHasVideo as vs, normalizeAtprotoHandle as vt, turnName as vu, decodeCommunityLink as w, sanitizeFileName as wa, enrollDoneFrame as wc, CapsExchange as wi, readAppRevocationShape as wl, pubkyProofPath as wn, statusCardBytes as wo, COMMUNITY_TOPOLOGY as wr, HANDOFF_CANCEL as ws, DID_FILE_MAX_BYTES as wt, RelayTransport as wu, CommunitySession as x, DHT_FILE_CAPABILITY as xa, enrollCancelFrame as xc, EDIT_CAPABILITY as xi, isAppKey as xl, normalizePubkyKey as xn, cardUrl as xo, mayBeHub as xr, LEGACY_SERVICES as xs, AtprotoProofError as xt, DEFAULT_RELAYS as xu, sealGroupTyping as y, DHT_MESSAGE_TTL as ya, ENROLL_HELLO as yc, APPS_CAPABILITY as yi, checkAppRevokeStatement as yl, isPubkyProofFolder as yn, buttonLabelClash as yo, readGroupSignal as yr, emptyLinkRecords as ys, parseAtprotoDidDocument as yt, turnStatedVerifier as yu, GROUP_LIMITS as z, REMOVED_TEXT as za, ContactRequestError as zc, receivedIdentityStatus as zi, readDeviceInvite as zl, withoutVideoMetadata as zn, verifyCommitSignature as zo, readLobby as zr, handoffBusyFrame as zs, parseDidDocument as zt, openRelayPayload as zu };
37916
38266
 
37917
- //# sourceMappingURL=src-CCt5s4DK.js.map
38267
+ //# sourceMappingURL=src-D31D1_oY.js.map