@ghostlytools/cli 1.13.2 → 1.13.4

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 (110) hide show
  1. package/README.md +9 -8
  2. package/dist/assets/{api-DV52o7A8.js → api-B5qxNMgg.js} +2 -2
  3. package/dist/assets/{api-O57SNJcb.js → api-iiij_pP5.js} +213 -59
  4. package/dist/assets/api-iiij_pP5.js.map +1 -0
  5. package/dist/assets/{apiKit-CPTFJHA7.js → apiKit-BPuHOoXF.js} +17 -3
  6. package/dist/assets/apiKit-BPuHOoXF.js.map +1 -0
  7. package/dist/assets/{appFetch-Ca9DNQQ2.js → appFetch-D89FnCxr.js} +2 -2
  8. package/dist/assets/{appFetch-Ca9DNQQ2.js.map → appFetch-D89FnCxr.js.map} +1 -1
  9. package/dist/assets/{apps-uZTu5FlR.js → apps-BpZcd86Y.js} +1 -1
  10. package/dist/assets/{apps-gXpGFPiv.js → apps-D2YGSPJe.js} +45 -19
  11. package/dist/assets/apps-D2YGSPJe.js.map +1 -0
  12. package/dist/assets/{backup-CxH3auHB.js → backup-BrMe9VPY.js} +11 -6
  13. package/dist/assets/backup-BrMe9VPY.js.map +1 -0
  14. package/dist/assets/{backup-Di2U6QVH.js → backup-COkkM8Yy.js} +1 -1
  15. package/dist/assets/bark_ffi_wasm_bg-CjjCN3FD.js +5 -0
  16. package/dist/assets/{bitcoind-BpZn3bRN.js → bitcoind-CK1QEUHn.js} +2 -2
  17. package/dist/assets/{bitcoind-BpZn3bRN.js.map → bitcoind-CK1QEUHn.js.map} +1 -1
  18. package/dist/assets/bitcoindevkit_bg-D6IFIaJi.js +5 -0
  19. package/dist/assets/{blobFiles-DDs34n0r.js → blobFiles-DA3UEn37.js} +3 -3
  20. package/dist/assets/{blobFiles-DDs34n0r.js.map → blobFiles-DA3UEn37.js.map} +1 -1
  21. package/dist/assets/buttons-BWEdoxgK.js +1 -0
  22. package/dist/assets/{buttons-D4udKEvT.js → buttons-UsDPQJsQ.js} +4 -4
  23. package/dist/assets/{buttons-D4udKEvT.js.map → buttons-UsDPQJsQ.js.map} +1 -1
  24. package/dist/assets/{client-DGx7E8b3.js → client-Cj-VLeTs.js} +2 -2
  25. package/dist/assets/{client-DGx7E8b3.js.map → client-Cj-VLeTs.js.map} +1 -1
  26. package/dist/assets/{fedimintSdk-D-6H9Pe7.js → fedimintSdk-eLXBrj9i.js} +2 -2
  27. package/dist/assets/{fedimintSdk-D-6H9Pe7.js.map → fedimintSdk-eLXBrj9i.js.map} +1 -1
  28. package/dist/assets/fedimint_client_wasm_bg-CRQlnJdu.js +5 -0
  29. package/dist/assets/{fileBytes-CfvUXdSy.js → fileBytes-B2jXQI8e.js} +3 -3
  30. package/dist/assets/{fileBytes-CfvUXdSy.js.map → fileBytes-B2jXQI8e.js.map} +1 -1
  31. package/dist/assets/{fileBytes-tj6-VZcB.js → fileBytes-BQrW3m-d.js} +2 -2
  32. package/dist/assets/{fileBytes-tj6-VZcB.js.map → fileBytes-BQrW3m-d.js.map} +1 -1
  33. package/dist/assets/{fileBytes-CCKbwqG_.js → fileBytes-CtjxJ6AL.js} +1 -1
  34. package/dist/assets/{fileBytesIdb-BJirUAjI.js → fileBytesIdb-B7Wjw0S8.js} +3 -3
  35. package/dist/assets/{fileBytesIdb-BJirUAjI.js.map → fileBytesIdb-B7Wjw0S8.js.map} +1 -1
  36. package/dist/assets/fileBytesIdb-Fcj2mwj6.js +1 -0
  37. package/dist/assets/{fileBytesOpfs-DRUYLER4.js → fileBytesOpfs-BW0u-_f_.js} +3 -3
  38. package/dist/assets/{fileBytesOpfs-DRUYLER4.js.map → fileBytesOpfs-BW0u-_f_.js.map} +1 -1
  39. package/dist/assets/{fixedHosts-CODN2pTL.js → fixedHosts-CrO01M_y.js} +3 -3
  40. package/dist/assets/{fixedHosts-CODN2pTL.js.map → fixedHosts-CrO01M_y.js.map} +1 -1
  41. package/dist/assets/{groupMeta-CeZpqVVC.js → groupMeta-DHJxOu0K.js} +99 -10
  42. package/dist/assets/groupMeta-DHJxOu0K.js.map +1 -0
  43. package/dist/assets/{host-CRA7h5A2.js → host-C4J4y-Zq.js} +187 -29
  44. package/dist/assets/host-C4J4y-Zq.js.map +1 -0
  45. package/dist/assets/{idb-ewvbqyDI.js → idb-CmIR_bxg.js} +2 -1
  46. package/dist/assets/idb-CmIR_bxg.js.map +1 -0
  47. package/dist/assets/{identityProofs-B8zCp5_0.js → identityProofs-C0rIGT6y.js} +20 -3
  48. package/dist/assets/identityProofs-C0rIGT6y.js.map +1 -0
  49. package/dist/assets/{irohWeb-mnOi2Jp7.js → irohWeb-BXgunUhu.js} +113 -33
  50. package/dist/assets/irohWeb-BXgunUhu.js.map +1 -0
  51. package/dist/assets/{main-Chc871HV.js → main-BLs-zUTt.js} +68 -28
  52. package/dist/assets/main-BLs-zUTt.js.map +1 -0
  53. package/dist/assets/{mainline-CDUXtV-I.js → mainline-CYek1H10.js} +2 -2
  54. package/dist/assets/{mainline-CDUXtV-I.js.map → mainline-CYek1H10.js.map} +1 -1
  55. package/dist/assets/{networkReason-DYlPZS5M.js → networkReason-C6LYbjF2.js} +2 -2
  56. package/dist/assets/{networkReason-DYlPZS5M.js.map → networkReason-C6LYbjF2.js.map} +1 -1
  57. package/dist/assets/{ownDid-BOuSlDv-.js → ownDid-Dg-8e_hs.js} +6 -5
  58. package/dist/assets/ownDid-Dg-8e_hs.js.map +1 -0
  59. package/dist/assets/{ownStatus-CLA1VPkL.js → ownStatus-BOx4vLi6.js} +34 -11
  60. package/dist/assets/ownStatus-BOx4vLi6.js.map +1 -0
  61. package/dist/assets/{profiles-BH1bH9aE.js → profiles-BA0ePikY.js} +33 -8
  62. package/dist/assets/profiles-BA0ePikY.js.map +1 -0
  63. package/dist/assets/{registry-DAq16T-V.js → registry-DuSwXntJ.js} +1 -1
  64. package/dist/assets/{registry-DP_-RA-v.js → registry-OoIgxDrO.js} +25 -13
  65. package/dist/assets/registry-OoIgxDrO.js.map +1 -0
  66. package/dist/assets/{relay-gJTOYQJZ.js → relay-NT5bf1WA.js} +9 -6
  67. package/dist/assets/relay-NT5bf1WA.js.map +1 -0
  68. package/dist/assets/{resolve-B1eQ4dVQ.js → resolve-DUmE70Eo.js} +3 -3
  69. package/dist/assets/{resolve-B1eQ4dVQ.js.map → resolve-DUmE70Eo.js.map} +1 -1
  70. package/dist/assets/{restoredRows-D_WSHE7H.js → restoredRows-Cgaxx1xW.js} +2 -2
  71. package/dist/assets/{restoredRows-D_WSHE7H.js.map → restoredRows-Cgaxx1xW.js.map} +1 -1
  72. package/dist/assets/{server-Bd2ofxc1.js → server-WWlXICVB.js} +555 -110
  73. package/dist/assets/server-WWlXICVB.js.map +1 -0
  74. package/dist/assets/{sshForges-As7dbGXM.js → sshForges-Cfu-dSwc.js} +2 -2
  75. package/dist/assets/{sshForges-As7dbGXM.js.map → sshForges-Cfu-dSwc.js.map} +1 -1
  76. package/dist/assets/translate-DnuQMfj0.js.map +1 -1
  77. package/dist/assets/{usdt-DLmtf8F9.js → usdt-BkO4SY07.js} +2 -2
  78. package/dist/assets/{usdt-DLmtf8F9.js.map → usdt-BkO4SY07.js.map} +1 -1
  79. package/dist/assets/{waitNotice-BHuMofaH.js → waitNotice-DSECf6II.js} +2 -2
  80. package/dist/assets/{waitNotice-BHuMofaH.js.map → waitNotice-DSECf6II.js.map} +1 -1
  81. package/dist/ghostly.mjs +1 -1
  82. package/npm-shrinkwrap.json +2 -2
  83. package/package.json +1 -1
  84. package/dist/assets/api-O57SNJcb.js.map +0 -1
  85. package/dist/assets/apiKit-CPTFJHA7.js.map +0 -1
  86. package/dist/assets/apps-gXpGFPiv.js.map +0 -1
  87. package/dist/assets/backup-CxH3auHB.js.map +0 -1
  88. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +0 -5
  89. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +0 -1
  90. package/dist/assets/bark_ffi_wasm_bg-VNmaJsc9.wasm +0 -0
  91. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +0 -5
  92. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +0 -1
  93. package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
  94. package/dist/assets/buttons-YTYEqvGC.js +0 -1
  95. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +0 -5
  96. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js.map +0 -1
  97. package/dist/assets/fedimint_client_wasm_bg-DeFtkIv6.wasm +0 -0
  98. package/dist/assets/fileBytesIdb-B0zzJ6p7.js +0 -1
  99. package/dist/assets/groupMeta-CeZpqVVC.js.map +0 -1
  100. package/dist/assets/host-CRA7h5A2.js.map +0 -1
  101. package/dist/assets/idb-ewvbqyDI.js.map +0 -1
  102. package/dist/assets/identityProofs-B8zCp5_0.js.map +0 -1
  103. package/dist/assets/irohWeb-mnOi2Jp7.js.map +0 -1
  104. package/dist/assets/main-Chc871HV.js.map +0 -1
  105. package/dist/assets/ownDid-BOuSlDv-.js.map +0 -1
  106. package/dist/assets/ownStatus-CLA1VPkL.js.map +0 -1
  107. package/dist/assets/profiles-BH1bH9aE.js.map +0 -1
  108. package/dist/assets/registry-DP_-RA-v.js.map +0 -1
  109. package/dist/assets/relay-gJTOYQJZ.js.map +0 -1
  110. package/dist/assets/server-Bd2ofxc1.js.map +0 -1
@@ -1,23 +1,23 @@
1
- import { $ as beaconKeys, $i as MAX_SHARED_APPS, $n as reactionEmoji, $t as vapidKeysMatch, Aa as sha256Paced, Ai as GhostlyHttpError, Ar as statusCardText, At as TypingSender, Bn as REMOVED_TEXT, Br as GROUP_MEMBER_CAP, Bt as WAKE_CALL_INTERVAL_MS, C as MESSAGE_PACED, Cn as dhtFileId, Cr as cardEditNumber, Ct as liveStatus, D as pairedMessageFrame, Da as pacer, Di as RELAY_POLL_INTERVALS, Dr as readStatusCard, E as pairedMessageFits, Ei as PRESENCE_WINDOW, En as sanitizeMime, Er as checkStatusCard, Et as TYPING_FRAME, F as readGroupFileMeta, Fa as appRefPublisher, Fi as LIMITS, Fr as heardTime, Ft as mayPin, G as readGroupSignal, Gn as forwardedAgain, Gr as commitHash, Gt as WakeLimiter, Ha as readAppRevocation, Hn as dhtEditId, Hr as MEMBER_KEY, Ht as WAKE_ONLINE_BATCH_MS, Ia as appRevocationsFileEntries, Ii as decodeControl, In as parseVideoMeta, Ir as receivedTimestamp, It as nextPinNumber, J as mayBeHub, Ji as parseCallSignal, Jn as GROUP_REACTION_FRAME, Jr as parseGroupCommit, Jt as parseWakeFrame, K as MESH_HUBS, Ki as contactRtcConfig, Kn as readForwarded, Kr as commitUntaggedHash, Kt as deviceWakeRequest, Li as encodeControl, Ln as EDIT_BUFFER_MS, Lr as shownTime, Lt as pinIsNewer, Mi as formatLocalTarget, Mn as fileMessageText, Mt as typingActivity, N as groupFileFallback, Na as appFingerprint, Ni as parseLocalTarget, Nn as parseVoiceMeta, Nr as arrivalKey, Nt as GROUP_PIN_FRAME, O as GROUP_FILE_LIMITS, Oi as WATCH_PEER_MS, Or as sameButtonText, Pa as appRef, Pi as webLocalFetch, Pr as claimedTime, Pt as PIN_LIMITS, Q as COMMUNITY_TOPOLOGY, Qa as parseImageMeta, Qi as LEGACY_SERVICES, Qn as queueReaction, Qr as signCommit, Qt as checkPushEndpoint, Ra as isAppHash, Rn as EDIT_RATE_WINDOW_MS, Rr as GROUP_ADMIN_OFF_ERROR, Rt as pinNumberHolds, S as LIVENESS_PING_MS, Sa as appViewOf, Sn as DHT_FILE_CAPABILITY, St as STATUS_IDLE_AFTER_MS, T as pairedEditFits, Tn as sanitizeFileName, Ua as readAppRevocationShape, Un as validEditNumber, Ur as OWN_FRAME_LIMIT, Ut as WAKE_ONLINE_DELAY_MS, Va as isAppRef, Vi as RTC_CONFIG, Vn as RateWindow, Vt as WAKE_INTERVAL_MS, W as groupSignalFrame, Wn as validRemovalNumber, Wr as SAID_AGAIN, X as meshRendezvous, Xi as emptyLinkRecords, Xn as ReactionWindow, Xr as rosterAdmin, Xt as wakeFrame, Y as meshHubs, Yn as REACTION_LIMITS, Yr as rememberAlone, Yt as relayRequest, Z as pickMeshHubs, Zi as HTTP_SERVICE_PROTO, Zn as nextReactionNumber, Zr as rosterHas, Zt as wakeRequest, _ as signGroupMeta, _a as seenEntry, _i as RATCHET_CAPABILITY, _o as deviceEchoNonce, a as groupMetaChange, aa as contactDay, ai as confirmationTag, an as APPS_CAPABILITY, ao as OwnInviteError, ar as groupReplyAuthor, at as lobbyRecords, b as GhostLink, bi as ratchetSessionOf, bo as devicePingFrame, bt as transferStalled, c as groupMetaTag, ca as knockSlotOf, ci as encryptText, cn as STATUS_CARD_CAPABILITY, co as encodeInviteCode, cr as replySnippet, ct as newerHead, d as keepPastGroupMeta, da as makeStampPaced, di as newEpochSecret, dn as DHT_TEXT_CAPABILITY, dt as readBeacon, ea as serviceIdFromName, ei as verifyChain, en as APP_RANGE_LIMITS, eo as canonicalJson, er as reactionIsNewer, et as beaconRecords, f as nextGroupMetaRevision, fa as mergeContactKnocks, fn as capsDescriptors, fo as pastedAgain, ft as readBeaconHead, g as parseGroupMetaTag, ga as requestRecords, gi as sha256Hex, gn as validExternalKey, go as deviceEchoFrame, gt as FILE_LIMITS, h as parseGroupMetaFrame, ha as readLinkRecord, hi as sealSecret, hn as emptyProofLedger, ho as HANDOFF_CAPABILITY, ht as ChatFiles, i as groupMetaBody, ia as contactAskerHolds, ii as confirmationMatches, in as isAppVersion, io as INVITE_MAX_LENGTH, ir as REPLY_LIMITS, it as lobbyKeys, jr as withoutAppLink, k as GROUP_HAVE_FRAME, ka as readAppBundleAsync, ki as presenceSeenAt, kt as TypingReceiver, l as groupMetaToHand, la as knockSlotRecords, li as epochKeys, ln as UPGRADE_CAPABILITY, lo as inviteLink, lr as wireReply, lt as pickHubs, m as parseGroupMetaBody, ma as readKnockSlot, mn as PeerProofs, mo as ENROLL_CAPABILITY, mt as shouldBeHub, na as REQUEST_LIFETIME_MS, ni as verifyCommitSignature, no as readCanonicalJson, nr as validReactionNumber, nt as freshHubs, o as groupMetaNewer, oa as knockHolds, oi as decryptText, on as BUTTONS_CAPABILITY, oo as createChatInvite, or as pairedReplyAuthor, ot as mergeBeacon, p as openGroupMeta, pa as openRequest, pi as openSecret, pn as dialDescriptors, po as DEVICES_CAPABILITY, pt as readLobby, q as NO_HUB_POLICY, qn as COMMUNITY_REACTION_FRAME, qr as expectedRoster, qt as newWakeToken, r as groupDisplayName, ra as contactAskerFrame, ri as GROUP_PROFILE, rn as chatAppId, ro as INVITE_HRP, rr as wireReaction, rt as hubRank, s as groupMetaPicture, sa as knockSlotIdentity, si as edgeParams, sn as EDIT_CAPABILITY, so as decodeInviteCode, sr as readReply, st as mergeLobby, t as encodeGroupMetaBody, ta as ContactRequestError, ti as verifyCommit, tn as isServeId, to as canonicalJsonBytes, tr as readReaction, tt as doorHubs, u as groupName, ua as linkRecords, un as CapsExchange, uo as inviteOwnership, ur as BUTTON_ID, ut as rankHubs, v as verifyGroupMetaSignature, va as APP_BUNDLE_LIMITS, vi as RatchetBox, vo as deviceKeyZ32, vr as STATUS_CARD_LIMITS, vt as sentWhole, w as PAIRED_FRAME_TOO_LARGE, wi as DHT_POLL_INTERVALS, wn as formatFileSize, wt as personStatus, x as INVITE_TAKEN, xa as appDigest, xi as DirectPathWatch, xn as peekDhtMailbox, xo as newDeviceSetSecret, y as wrapGroupMeta, ya as APP_BUNDLE_MAGIC, yi as emptyRatchetState, yn as DHT_MESSAGE_TTL, yo as deviceLinkPairing, yt as transferEnded, z as CarriedTransport, za as isAppKey, zn as MAX_REMOVAL_NUMBER, zr as GROUP_ID, zt as readPin } from "./groupMeta-CeZpqVVC.js";
2
- import { _ as receivedIdentityStatus, d as emptyIdentityLedger, y as lastSharedWithMe } from "./identityProofs-B8zCp5_0.js";
3
- import { _ as openDb, a as GROUP_LIGHT_RANGE, b as transact, c as clearProfileStores, d as deleteDatabase, f as errorLine, h as groupLiveKey, i as FILE_INDEX, l as committed, m as groupLightKey, n as APP_STORAGE_SCOPE_INDEX, o as GROUP_LIVE_RANGE, p as fileStore, r as CARD_INDEX, s as STORES$1, t as APP_STORAGE_CHAT_INDEX, u as databaseName, v as profileOpenFailure, x as wrap, y as store } from "./idb-ewvbqyDI.js";
4
- import { c as fileSpace, f as FILE_BYTES_STEP, o as fileBytes, r as blobDigest, s as fileBytesOf, u as removeFileBytes } from "./fileBytes-CfvUXdSy.js";
5
- import { a as sealSeed, c as openRow, d as sealRow, g as whenDataKeyDropped, h as sealSecret$1, i as newDeviceKey, l as openRows, m as openSecret$1, o as unsealSeed, r as intentRepository, s as RowSeals } from "./networkReason-DYlPZS5M.js";
6
- import { $ as cardsKey, $t as validEditText, A as assertConfirmedReal, At as COMMUNITY_LIMITS, B as copyForForward, Bt as encodeGroupEntryLink, C as pairedWireReply, Ct as WrongNetworkError, D as paymentAlias, Dt as requireTurn, E as replyTo, Et as refuseAway, F as paymentNetworksOf, Ft as encodeCommunityLink, G as removeStored, Gt as readKnocks, H as forwardKind, Ht as knockIdentity, I as walletInstances, It as memberAdmissions, Jt as GROUP_EDIT_FRAME, K as storedSize, Kt as CatchUpAnswers, Lt as routedCommunityFrame, M as createTiming, Mt as GROUP_READ_NOTE_COMMUNITY, N as crossNetwork, Nt as communityHasFrame, O as paymentWireId, Ot as setAwayWallets, P as paymentNetwork, Pt as decodeCommunityLink, Q as LightningCards, Qt as parseCommunityEdit, R as WALLET_TYPES, S as groupReply, St as ModeGate, T as replyRef, Tt as awayFrom, U as FileAppender, Ut as knockRecords, V as forwardError, Vt as entryParams, W as readStored$2, Wt as mergeKnocks, X as IdentityProofs, Xt as carryMentions, Yt as GROUP_EDIT_TEXT_BYTES, Z as CASHU_CARD, Zt as meshMessageRef, _ as GroupFileDesk, _t as breezDatabasesFor, a as CashuWallet, at as INVOICE_PACE, b as groupOfFile, bt as relayOnlyProblem, c as assertAmount, ct as CASHU_MINT_SOURCE, d as groupPayLineId, dt as CashuAdapter, en as MENTION_LIMITS, et as BREEZ_SOURCE, ft as swapSettledAt, g as parsePayLink, gt as breezDatabaseInUse, h as pairLinkId, ht as openBreez, i as onPublicIrohRelay, it as lightningPaying, j as createFailure, jt as CommunitySession, k as WALLET_NAMES, kt as setSingleWriterGate, l as normalizeMintUrl, lt as cashuMint, m as groupLinkId, mt as loadBreezSdk, n as createIrohWebEndpoint, nn as validMentions, nt as normalizePhrase, o as SwapUnsettledError, ot as ProviderSources, pt as forgetBreez, q as streamStored, r as irohRelayProblem, rn as wireMentions, rt as journaledPayment, st as sourceKey, t as DEFAULT_IROH_RELAYS, tn as mentionsMember, tt as breez, ut as AskBackoff, v as groupFileId, vt as iceServerProblem, w as receivedPairedReply, wt as networkLabel, x as storedGroupFiles, xt as ModeChanged, y as groupFileText, yt as iceServerSetting, z as FORWARD_MESSAGE_GONE, zt as decodeGroupEntryLink } from "./irohWeb-mnOi2Jp7.js";
1
+ import { $ as beaconKeys, $i as MAX_SHARED_APPS, $n as reactionEmoji, $t as vapidKeysMatch, Aa as sha256Paced, Ai as GhostlyHttpError, Ar as statusCardText, At as TypingSender, Bn as REMOVED_TEXT, Br as GROUP_MEMBER_CAP, Bt as WAKE_CALL_INTERVAL_MS, C as MESSAGE_PACED, Cn as dhtFileId, Cr as cardEditNumber, Ct as liveStatus, D as pairedMessageFrame, Da as pacer, Di as RELAY_POLL_INTERVALS, Dr as readStatusCard, E as pairedMessageFits, Ei as PRESENCE_WINDOW, En as sanitizeMime, Er as checkStatusCard, Et as TYPING_FRAME, F as readGroupFileMeta, Fa as appRefPublisher, Fi as LIMITS, Fr as heardTime, Ft as mayPin, G as readGroupSignal, Gn as forwardedAgain, Gr as commitHash, Gt as WakeLimiter, Ha as readAppRevocation, Hn as dhtEditId, Hr as MEMBER_KEY, Ht as WAKE_ONLINE_BATCH_MS, Ia as appRevocationsFileEntries, Ii as decodeControl, In as parseVideoMeta, Ir as receivedTimestamp, It as nextPinNumber, J as mayBeHub, Ji as parseCallSignal, Jn as GROUP_REACTION_FRAME, Jr as parseGroupCommit, Jt as parseWakeFrame, K as MESH_HUBS, Ki as contactRtcConfig, Kn as readForwarded, Kr as commitUntaggedHash, Kt as deviceWakeRequest, Li as encodeControl, Ln as EDIT_BUFFER_MS, Lr as shownTime, Lt as pinIsNewer, Mi as formatLocalTarget, Mn as fileMessageText, Mt as typingActivity, N as groupFileFallback, Na as appFingerprint, Ni as parseLocalTarget, Nn as parseVoiceMeta, Nr as arrivalKey, Nt as GROUP_PIN_FRAME, O as GROUP_FILE_LIMITS, Oi as WATCH_PEER_MS, Or as sameButtonText, Pa as appRef, Pi as webLocalFetch, Pr as claimedTime, Pt as PIN_LIMITS, Q as COMMUNITY_TOPOLOGY, Qa as parseImageMeta, Qi as LEGACY_SERVICES, Qn as queueReaction, Qr as signCommit, Qt as checkPushEndpoint, Ra as isAppHash, Rn as EDIT_RATE_WINDOW_MS, Rr as GROUP_ADMIN_OFF_ERROR, Rt as pinNumberHolds, S as LIVENESS_PING_MS, Sa as appViewOf, Sn as DHT_FILE_CAPABILITY, St as STATUS_IDLE_AFTER_MS, T as pairedEditFits, Tn as sanitizeFileName, Ua as readAppRevocationShape, Un as validEditNumber, Ur as OWN_FRAME_LIMIT, Ut as WAKE_ONLINE_DELAY_MS, Va as isAppRef, Vi as RTC_CONFIG, Vn as RateWindow, Vt as WAKE_INTERVAL_MS, W as groupSignalFrame, Wn as validRemovalNumber, Wr as SAID_AGAIN, X as meshRendezvous, Xi as emptyLinkRecords, Xn as ReactionWindow, Xr as rosterAdmin, Xt as wakeFrame, Y as meshHubs, Yn as REACTION_LIMITS, Yr as rememberAlone, Yt as relayRequest, Z as pickMeshHubs, Zi as HTTP_SERVICE_PROTO, Zn as nextReactionNumber, Zr as rosterHas, Zt as wakeRequest, _ as signGroupMeta, _a as seenEntry, _i as RATCHET_CAPABILITY, _o as deviceEchoNonce, a as groupMetaChange, aa as contactDay, ai as confirmationTag, an as APPS_CAPABILITY, ao as OwnInviteError, ar as groupReplyAuthor, at as lobbyRecords, b as GhostLink, bi as ratchetSessionOf, bo as devicePingFrame, bt as transferStalled, c as groupMetaTag, ca as knockSlotOf, ci as encryptText, cn as STATUS_CARD_CAPABILITY, co as encodeInviteCode, cr as replySnippet, ct as newerHead, d as keepPastGroupMeta, da as makeStampPaced, di as newEpochSecret, dn as DHT_TEXT_CAPABILITY, dt as readBeacon, ea as serviceIdFromName, ei as verifyChain, en as APP_RANGE_LIMITS, eo as canonicalJson, er as reactionIsNewer, et as beaconRecords, f as nextGroupMetaRevision, fa as mergeContactKnocks, fn as capsDescriptors, fo as pastedAgain, ft as readBeaconHead, g as parseGroupMetaTag, ga as requestRecords, gi as sha256Hex, gn as validExternalKey, go as deviceEchoFrame, gt as FILE_LIMITS, h as parseGroupMetaFrame, ha as readLinkRecord, hi as sealSecret, hn as emptyProofLedger, ho as HANDOFF_CAPABILITY, ht as ChatFiles, i as groupMetaBody, ia as contactAskerHolds, ii as confirmationMatches, in as isAppVersion, io as INVITE_MAX_LENGTH, ir as REPLY_LIMITS, it as lobbyKeys, jr as withoutAppLink, k as GROUP_HAVE_FRAME, ka as readAppBundleAsync, ki as presenceSeenAt, kt as TypingReceiver, l as groupMetaToHand, la as knockSlotRecords, li as epochKeys, ln as UPGRADE_CAPABILITY, lo as inviteLink, lr as wireReply, lt as pickHubs, m as parseGroupMetaBody, ma as readKnockSlot, mn as PeerProofs, mo as ENROLL_CAPABILITY, mt as shouldBeHub, na as REQUEST_LIFETIME_MS, ni as verifyCommitSignature, no as readCanonicalJson, nr as validReactionNumber, nt as freshHubs, o as groupMetaNewer, oa as knockHolds, oi as decryptText, on as BUTTONS_CAPABILITY, oo as createChatInvite, or as pairedReplyAuthor, ot as mergeBeacon, p as openGroupMeta, pa as openRequest, pi as openSecret, pn as dialDescriptors, po as DEVICES_CAPABILITY, pt as readLobby, q as NO_HUB_POLICY, qn as COMMUNITY_REACTION_FRAME, qr as expectedRoster, qt as newWakeToken, r as groupDisplayName, ra as contactAskerFrame, ri as GROUP_PROFILE, rn as chatAppId, ro as INVITE_HRP, rr as wireReaction, rt as hubRank, s as groupMetaPicture, sa as knockSlotIdentity, si as edgeParams, sn as EDIT_CAPABILITY, so as decodeInviteCode, sr as readReply, st as mergeLobby, t as encodeGroupMetaBody, ta as ContactRequestError, ti as verifyCommit, tn as isServeId, to as canonicalJsonBytes, tr as readReaction, tt as doorHubs, u as groupName, ua as linkRecords, un as CapsExchange, uo as inviteOwnership, ur as BUTTON_ID, ut as rankHubs, v as verifyGroupMetaSignature, va as APP_BUNDLE_LIMITS, vi as RatchetBox, vo as deviceKeyZ32, vr as STATUS_CARD_LIMITS, vt as sentWhole, w as PAIRED_FRAME_TOO_LARGE, wi as DHT_POLL_INTERVALS, wn as formatFileSize, wt as personStatus, x as INVITE_TAKEN, xa as appDigest, xi as DirectPathWatch, xn as peekDhtMailbox, xo as newDeviceSetSecret, y as wrapGroupMeta, ya as APP_BUNDLE_MAGIC, yi as emptyRatchetState, yn as DHT_MESSAGE_TTL, yo as deviceLinkPairing, yt as transferEnded, z as CarriedTransport, za as isAppKey, zn as MAX_REMOVAL_NUMBER, zr as GROUP_ID, zt as readPin } from "./groupMeta-DHJxOu0K.js";
2
+ import { _ as receivedIdentityStatus, d as emptyIdentityLedger, y as lastSharedWithMe } from "./identityProofs-C0rIGT6y.js";
3
+ import { _ as openDb, a as GROUP_LIGHT_RANGE, b as transact, c as clearProfileStores, d as deleteDatabase, f as errorLine, h as groupLiveKey, i as FILE_INDEX, l as committed, m as groupLightKey, n as APP_STORAGE_SCOPE_INDEX, o as GROUP_LIVE_RANGE, p as fileStore, r as CARD_INDEX, s as STORES$1, t as APP_STORAGE_CHAT_INDEX, u as databaseName, v as profileOpenFailure, x as wrap, y as store } from "./idb-CmIR_bxg.js";
4
+ import { c as fileSpace, f as FILE_BYTES_STEP, o as fileBytes, r as blobDigest, s as fileBytesOf, u as removeFileBytes } from "./fileBytes-B2jXQI8e.js";
5
+ import { a as sealSeed, c as openRow, d as sealRow, g as whenDataKeyDropped, h as sealSecret$1, i as newDeviceKey, l as openRows, m as openSecret$1, o as unsealSeed, r as intentRepository, s as RowSeals } from "./networkReason-C6LYbjF2.js";
6
+ import { $ as cardsKey, $t as validEditText, A as assertConfirmedReal, At as COMMUNITY_LIMITS, B as copyForForward, Bt as encodeGroupEntryLink, C as pairedWireReply, Ct as WrongNetworkError, D as paymentAlias, Dt as requireTurn, E as replyTo, Et as refuseAway, F as paymentNetworksOf, Ft as encodeCommunityLink, G as removeStored, Gt as readKnocks, H as forwardKind, Ht as knockIdentity, I as walletInstances, It as memberAdmissions, Jt as GROUP_EDIT_FRAME, K as storedSize, Kt as CatchUpAnswers, Lt as routedCommunityFrame, M as createTiming, Mt as GROUP_READ_NOTE_COMMUNITY, N as crossNetwork, Nt as communityHasFrame, O as paymentWireId, Ot as setAwayWallets, P as paymentNetwork, Pt as decodeCommunityLink, Q as LightningCards, Qt as parseCommunityEdit, R as WALLET_TYPES, S as groupReply, St as ModeGate, T as replyRef, Tt as awayFrom, U as FileAppender, Ut as knockRecords, V as forwardError, Vt as entryParams, W as readStored$2, Wt as mergeKnocks, X as IdentityProofs, Xt as carryMentions, Yt as GROUP_EDIT_TEXT_BYTES, Z as CASHU_CARD, Zt as meshMessageRef, _ as GroupFileDesk, _t as breezDatabasesFor, a as CashuWallet, at as INVOICE_PACE, b as groupOfFile, bt as relayOnlyProblem, c as assertAmount, ct as CASHU_MINT_SOURCE, d as groupPayLineId, dt as CashuAdapter, en as MENTION_LIMITS, et as BREEZ_SOURCE, ft as swapSettledAt, g as parsePayLink, gt as breezDatabaseInUse, h as pairLinkId, ht as openBreez, i as onPublicIrohRelay, it as lightningPaying, j as createFailure, jt as CommunitySession, k as WALLET_NAMES, kt as setSingleWriterGate, l as normalizeMintUrl, lt as cashuMint, m as groupLinkId, mt as loadBreezSdk, n as createIrohWebEndpoint, nn as validMentions, nt as normalizePhrase, o as SwapUnsettledError, ot as ProviderSources, pt as forgetBreez, q as streamStored, r as irohRelayProblem, rn as wireMentions, rt as journaledPayment, st as sourceKey, t as DEFAULT_IROH_RELAYS, tn as mentionsMember, tt as breez, ut as AskBackoff, v as groupFileId, vt as iceServerProblem, w as receivedPairedReply, wt as networkLabel, x as storedGroupFiles, xt as ModeChanged, y as groupFileText, yt as iceServerSetting, z as FORWARD_MESSAGE_GONE, zt as decodeGroupEntryLink } from "./irohWeb-BXgunUhu.js";
7
7
  import { C as cashuRequestPayload, D as parseCashuRequestPayload, E as isFederationId, O as parseFedimintRequestPayload, S as ENDPOINT, T as findEndpoint, _ as SPARK_NETWORKS, a as SEPOLIA_TEST_USDT, b as sparkInvoiceDetails, c as USDT_PUBLIC_RPC, d as assertTokenUnits, f as assertWholeSats, g as walletNetworkOf, h as validatePaymentTarget, i as PaymentPreflightError, l as WALLET_NETWORKS, n as EVM_TEST_CHAINS, p as formatPaymentAmount, r as ONCHAIN_PROVIDER, s as TEST_USDT_FAUCET_AMOUNT, t as ETHEREUM_USDT, u as arkAddressPrefix, v as SPARK_PROVIDER, w as fedimintRequestPayload, x as isBitcoinAddress, y as sparkAddressKind } from "./paymentIntent-Cr3uZa_0.js";
8
8
  import { a as decodeBolt11, t as nwc } from "./nwcProvider-pL2XqSbW.js";
9
9
  import { a as parseEngineError, i as engineText, r as engineError, t as EngineError } from "./engineErrors-wWlLy54D.js";
10
- import { r as loadFedimintSdk, t as fedimintDatabase } from "./fedimintSdk-D-6H9Pe7.js";
10
+ import { r as loadFedimintSdk, t as fedimintDatabase } from "./fedimintSdk-eLXBrj9i.js";
11
11
  import { i as SourceUnreachableError, n as PROVIDER_PLATFORMS, o as isNothingSpentError, r as SourceConfigError, t as NothingSpentError, u as redact } from "./types-CdWwgvyt.js";
12
- import { a as registeredLightningProviders, b as isPubkyKey, c as boundedIdentityFetch, d as testSwitch, g as encodeDidDhtPacket, h as encodeDidDhtDeactivated, m as didDhtFromPublicKey, n as setOwnDidSource, o as registeredOnchainProviders, p as didDhtDocument, r as onAdaptersChanged, s as reserveAdapterIds, u as testBuild, v as signDidDhtPacket } from "./ownDid-BOuSlDv-.js";
12
+ import { a as registeredLightningProviders, b as isPubkyKey, c as boundedIdentityFetch, d as testSwitch, g as encodeDidDhtPacket, h as encodeDidDhtDeactivated, m as didDhtFromPublicKey, n as setOwnDidSource, o as registeredOnchainProviders, p as didDhtDocument, r as onAdaptersChanged, s as reserveAdapterIds, u as testBuild, v as signDidDhtPacket } from "./ownDid-Dg-8e_hs.js";
13
+ import { c as normalizeRelayUrl, d as traceLink, g as withRequestOptions, i as RelayTransport, m as isDiscoveryBudgetError, p as budgetRetryMs, s as currentRelays, t as DEFAULT_RELAYS } from "./relay-NT5bf1WA.js";
13
14
  import { S as verify, _ as identityFromSeed, a as createRelayPayload, c as openRelayPayload, d as signRelayPayload, f as decodeDnsAnswers, g as createIdentity, m as encodeTxtPacket, p as decodeTxtPacket, r as PacketTooLargeError, v as identityFromSeedB64, x as sign, y as publicKeyFromZ32 } from "./pkarr-BQo4PcCg.js";
14
- import { c as normalizeRelayUrl, d as traceLink, g as withRequestOptions, i as RelayTransport, m as isDiscoveryBudgetError, p as budgetRetryMs, s as currentRelays, t as DEFAULT_RELAYS } from "./relay-gJTOYQJZ.js";
15
15
  import { a as stripHidden, i as sanitizeNick, n as hasVisible, r as sanitizeDisplayText, s as unwrapPasted, t as dropLoneJoiners } from "./text-li76pThX.js";
16
16
  import { a as fromZ32, d as utf8Decode, f as utf8Encode, i as fromBase64Url, l as toBase64Url, n as concatBytes$1, o as isZ32Key, s as randomBytes, t as bytesEqual, u as toZ32 } from "./bytes-C1DNGY18.js";
17
17
  import { _ as HoldKeys, b as newMailbox, g as HOLD_LIMITS, h as HOLD_DATED_BACK_MS, i as automaticTransport, m as HOLD_CAPABILITY, r as TRANSPORTS, v as HoldRefusedError, w as generateEncryptionKey, x as readManifest, y as isHoldUrl } from "./pairedTransports-DAzupLYo.js";
18
18
  import { a as parseLinkPreview, s as sanitizeAvatar } from "./linkPreview-5kHmKUTN.js";
19
- import { C as isAtprotoDid, d as chosenResolver, h as setPkarrRelaySource, r as resolveAtprotoDid, t as assertPublicServer, w as normalizeAtprotoHandle } from "./resolve-B1eQ4dVQ.js";
20
- import { S as webCryptoSigner, a as besideUrl, c as isGitHubPage, d as appStoreDecision, f as appUpdateDecision, h as APP_STORE_LIMITS, i as appPasteUrl, l as addedAppPermissions, m as planAppUpdate, n as APP_FETCH_LIMITS, o as boundedAppFetch, p as checkAppBeforeRun, r as AppFetchError, s as isAppFetchUrl, u as appRevocationFor, v as readAppStoreSteps, x as seedSigner } from "./appFetch-Ca9DNQQ2.js";
19
+ import { C as isAtprotoDid, d as chosenResolver, h as setPkarrRelaySource, r as resolveAtprotoDid, t as assertPublicServer, w as normalizeAtprotoHandle } from "./resolve-DUmE70Eo.js";
20
+ import { S as webCryptoSigner, a as besideUrl, c as isGitHubPage, d as appStoreDecision, f as appUpdateDecision, h as APP_STORE_LIMITS, i as appPasteUrl, l as addedAppPermissions, m as planAppUpdate, n as APP_FETCH_LIMITS, o as boundedAppFetch, p as checkAppBeforeRun, r as AppFetchError, s as isAppFetchUrl, u as appRevocationFor, v as readAppStoreSteps, x as seedSigner } from "./appFetch-D89FnCxr.js";
21
21
  import { l as isWorthlessMint, n as DEFAULT_MINTS, r as TEST_MINT, u as mintNetwork } from "./mints-CMDLbMeH.js";
22
22
  import { n as traceJoin } from "./joinTrace-xKBe73j9.js";
23
23
  import { n as MAX_BACKUP_BYTES, t as BACKUP_MEDIA_TYPE } from "./envelope-Bi2kMqbp.js";
@@ -1748,6 +1748,12 @@ var GROUP_LIMITS = {
1748
1748
  /** Own messages kept for catch-up: count and total ciphertext bytes. */
1749
1749
  outlog: 32,
1750
1750
  outlogBytes: 131072,
1751
+ /**
1752
+ * Own messages past that log that members may not have taken (`GroupState.owed`): count and total ciphertext bytes.
1753
+ * With the log, the 256 a member takes in one answer.
1754
+ */
1755
+ owed: 224,
1756
+ owedBytes: 524288,
1751
1757
  /** Frames waiting for an epoch (or its secret) that has not arrived yet. */
1752
1758
  waiting: 64,
1753
1759
  waitingBytes: 1048576,
@@ -1835,6 +1841,7 @@ var GROUP_TAKEOVER_META_MS = 6e5;
1835
1841
  * hears it, with what the member says live beside it, and the edits its app says again), then
1836
1842
  * `GROUP_LIMITS.messagesPerAuthor` and `messageBytesPerAuthor` per `messageWindowMs`, as a community's `MessagePace`.
1837
1843
  * One not taken is neither seen nor kept nor passed on, so a sync still names it (`miss`) and a catch-up hands it again.
1844
+ * Every member refuses the same live frames, so only the author holds them: past its log, it keeps them (`owed`).
1838
1845
  * What another member hands on in its answer to my sync (or what waited for a secret) is counted too, and may run the
1839
1846
  * author's allowance below nothing by one answer's worth (`AUTHOR_OWED`): a catch-up holds more than a burst, and lands
1840
1847
  * at once; the author's next frames wait until the pace pays it back. Not counted, a member at the other end of my sync
@@ -1855,25 +1862,47 @@ var AUTHOR_OWED = {
1855
1862
  bytes: GROUP_LIMITS.relayEditBytes
1856
1863
  }
1857
1864
  };
1865
+ /**
1866
+ * The pace my own frames go at, as members count it, with half their burst and the room left spent on a frame it does
1867
+ * not take (one a member may take still): an edge opening hands my log again, and frames arrive closer together than I
1868
+ * said them, so a frame members refuse is never one this takes.
1869
+ */
1870
+ var OWN_BURST = {
1871
+ frames: GROUP_LIMITS.outlog,
1872
+ bytes: GROUP_LIMITS.outlogBytes
1873
+ };
1858
1874
  var AuthorPace = class {
1859
1875
  owed;
1860
- frames = AUTHOR_BURST.frames;
1861
- bytes = AUTHOR_BURST.bytes;
1876
+ burst;
1877
+ frames;
1878
+ bytes;
1862
1879
  at;
1863
- constructor(owed) {
1880
+ constructor(owed, burst = AUTHOR_BURST) {
1864
1881
  this.owed = owed;
1882
+ this.burst = burst;
1883
+ this.frames = burst.frames;
1884
+ this.bytes = burst.bytes;
1865
1885
  }
1866
- /** `answer`: handed on in an answer to my sync, or waited, so it may run the allowance below nothing (`owed`). */
1867
- take(bytes, now, answer = false) {
1886
+ /**
1887
+ * `answer`: handed on in an answer to my sync, or waited, so it may run the allowance below nothing (`owed`).
1888
+ * `spend`: one not taken still spends what is left of the allowance.
1889
+ */
1890
+ take(bytes, now, answer = false, spend = false) {
1868
1891
  const elapsed = Math.max(0, now - (this.at ?? now)) / GROUP_LIMITS.messageWindowMs;
1869
1892
  this.at = now;
1870
- this.frames = Math.min(AUTHOR_BURST.frames, this.frames + elapsed * GROUP_LIMITS.messagesPerAuthor);
1871
- this.bytes = Math.min(AUTHOR_BURST.bytes, this.bytes + elapsed * GROUP_LIMITS.messageBytesPerAuthor);
1893
+ this.frames = Math.min(this.burst.frames, this.frames + elapsed * GROUP_LIMITS.messagesPerAuthor);
1894
+ this.bytes = Math.min(this.burst.bytes, this.bytes + elapsed * GROUP_LIMITS.messageBytesPerAuthor);
1872
1895
  const floor = answer ? this.owed : {
1873
1896
  frames: 0,
1874
1897
  bytes: 0
1875
1898
  };
1876
- if (this.frames + floor.frames < 1 || this.bytes + floor.bytes < bytes) return false;
1899
+ if (this.frames + floor.frames < 1 || this.bytes + floor.bytes < bytes) {
1900
+ if (spend) {
1901
+ this.frames = Math.max(0, this.frames - 1);
1902
+ this.bytes = Math.max(0, this.bytes - bytes);
1903
+ }
1904
+ return false;
1905
+ }
1877
1906
  this.frames -= 1;
1878
1907
  this.bytes -= bytes;
1879
1908
  return true;
@@ -2186,6 +2215,21 @@ function missingIn(frame, from) {
2186
2215
  };
2187
2216
  }
2188
2217
  /**
2218
+ * Whether a member's sync shows it holds my frame `f`: it has seen up to it, and does not name it missing among all its
2219
+ * gaps, or among the newest it names when they are more than a sync holds (`GROUP_LIMITS.miss`).
2220
+ */
2221
+ function heldIn(frame) {
2222
+ const have = frame.have && typeof frame.have === "object" ? frame.have : {};
2223
+ const miss = frame.miss && typeof frame.miss === "object" ? frame.miss : {};
2224
+ return (f) => {
2225
+ const high = have[f.s]?.[f.e];
2226
+ if (!Number.isSafeInteger(high) || high < f.n) return false;
2227
+ const gaps = miss[f.s]?.[f.e];
2228
+ if (!Array.isArray(gaps)) return true;
2229
+ return !gaps.includes(f.n) && (gaps.length < GROUP_LIMITS.miss || gaps.some((n) => typeof n === "number" && n < f.n));
2230
+ };
2231
+ }
2232
+ /**
2189
2233
  * My own messages and the ones I kept of other members, as one list for a member catching up: each log keeps its own
2190
2234
  * order (mine as I sent them, the others' as they reached me, which no member's clock can change), and the two are
2191
2235
  * merged by the time each frame says, mine first when they say the same. A member whose clock is off moves only
@@ -2276,6 +2320,17 @@ var GroupSession = class {
2276
2320
  namesTaken = /* @__PURE__ */ new Map();
2277
2321
  /** Messages, and apart from them edits, taken per author (`AuthorPace`). In memory only. */
2278
2322
  messagePace = /* @__PURE__ */ new Map();
2323
+ /**
2324
+ * My own frames as members pace them (`OWN_BURST`), and those of mine in `sent` it did not take: one of them that falls
2325
+ * out of `sent` goes to `owed`. Then, per frame of `owed`, the members whose sync showed they hold it. In memory only:
2326
+ * after a start, each owed frame waits for a sync of every member.
2327
+ */
2328
+ ownPace = new AuthorPace({
2329
+ frames: 0,
2330
+ bytes: 0
2331
+ }, OWN_BURST);
2332
+ overPace = /* @__PURE__ */ new Set();
2333
+ owedHeld = /* @__PURE__ */ new Map();
2279
2334
  editPace = /* @__PURE__ */ new Map();
2280
2335
  queue = Promise.resolve();
2281
2336
  /** Metadata frames that name a commit or an epoch I do not have yet, one signed by the admin and one by anyone else (`waitMeta`): tried again when the chain moves. */
@@ -2314,6 +2369,12 @@ var GroupSession = class {
2314
2369
  */
2315
2370
  heard = /* @__PURE__ */ new Map();
2316
2371
  /**
2372
+ * Per author and epoch, the highest number of its own signed frames I did not take at its pace (`AuthorPace`): what
2373
+ * `lacking` names, so the author is asked for it again (it keeps it, `GroupState.owed`). Every member refuses the
2374
+ * same frames of a burst, all past the last one it took, so nothing else shows they are missing. In memory only.
2375
+ */
2376
+ refused = /* @__PURE__ */ new Map();
2377
+ /**
2317
2378
  * Per member: until when what comes over its edge may be its answer to my sync (`syncFrame`), a catch-up and not a
2318
2379
  * message written just now. Each frame of the answer keeps it open: it goes a slice at a time. In memory only.
2319
2380
  */
@@ -2591,7 +2652,11 @@ var GroupSession = class {
2591
2652
  */
2592
2653
  lacking() {
2593
2654
  const out = /* @__PURE__ */ new Map();
2594
- for (const sender of /* @__PURE__ */ new Set([...Object.keys(this.state.seen), ...this.heard.keys()])) {
2655
+ for (const sender of /* @__PURE__ */ new Set([
2656
+ ...Object.keys(this.state.seen),
2657
+ ...this.heard.keys(),
2658
+ ...this.refused.keys()
2659
+ ])) {
2595
2660
  if (sender === this.myKey || !rosterHas(this.roster, sender)) continue;
2596
2661
  const marks = Object.entries(this.missOf(sender)).map(([e, gaps]) => `${e}:${gaps.join(".")}`);
2597
2662
  if (marks.length) out.set(sender, marks.join(","));
@@ -2602,16 +2667,24 @@ var GroupSession = class {
2602
2667
  * What a sync names in `miss` for one sender now: per epoch, the newest `GROUP_LIMITS.miss` numbers that never arrived.
2603
2668
  * And, for an epoch of which none arrived, the newest numbers another member said it has (`heard`): a member back
2604
2669
  * after someone joined, whose author wrote 32 since (all its own answer holds), had nothing below them to ask for.
2670
+ * And, first, the oldest of those past the highest seen up to the highest of its frames I refused at its pace
2671
+ * (`refused`): its answer brings them oldest first, so what is named changes as they come.
2605
2672
  */
2606
2673
  missOf(sender) {
2607
2674
  const out = {};
2608
- const seen = this.state.seen[sender] ?? {};
2609
- for (const [e, entry] of Object.entries(seen)) {
2610
- const gaps = this.gaps(entry);
2675
+ const seen = this.state.seen[sender] ?? {}, refused = this.refused.get(sender);
2676
+ for (const e of /* @__PURE__ */ new Set([...Object.keys(seen), ...[...refused?.keys() ?? []].map(String)])) {
2677
+ const entry = seen[e] ?? {
2678
+ high: -1,
2679
+ window: []
2680
+ }, top = refused?.get(Number(e)) ?? -1;
2681
+ const gaps = [];
2682
+ for (let n = entry.high + 1; n <= top && gaps.length < GROUP_LIMITS.miss; n++) gaps.push(n);
2683
+ if (entry.high >= 0) gaps.push(...this.gaps(entry).slice(0, GROUP_LIMITS.miss - gaps.length));
2611
2684
  if (gaps.length) out[e] = gaps;
2612
2685
  }
2613
2686
  for (const [e, high] of this.heard.get(sender) ?? []) {
2614
- if (seen[e]) continue;
2687
+ if (seen[e] || out[e]) continue;
2615
2688
  const numbers = [];
2616
2689
  for (let n = high; n >= 0 && numbers.length < GROUP_LIMITS.miss; n--) numbers.push(n);
2617
2690
  out[e] = numbers;
@@ -2999,6 +3072,7 @@ var GroupSession = class {
2999
3072
  this.state.statusReason = reason;
3000
3073
  this.state.secrets = {};
3001
3074
  this.state.sent = [];
3075
+ delete this.state.owed;
3002
3076
  delete this.state.unsaid;
3003
3077
  this.state.relay = [];
3004
3078
  if (this.onRows) this.onRows = [];
@@ -3054,6 +3128,7 @@ var GroupSession = class {
3054
3128
  this.state.unsaid = [...this.state.unsaid ?? [], ownKey(frame)];
3055
3129
  const unsend = async (free) => {
3056
3130
  this.state.sent = this.state.sent.filter((f) => f !== frame);
3131
+ this.overPace.delete(ownKey(frame));
3057
3132
  this.state.unsaid = (this.state.unsaid ?? []).filter((key) => key !== ownKey(frame));
3058
3133
  if (free && this.state.seqEpoch === epoch && this.state.seq === n + 1) this.state.seq = n;
3059
3134
  await this.persist().catch(() => {});
@@ -3201,11 +3276,46 @@ var GroupSession = class {
3201
3276
  } : {}
3202
3277
  };
3203
3278
  }
3204
- /** Into my bounded log, for members who missed it. */
3279
+ /** Into my bounded log, for members who missed it; one said past the pace members apply goes on to `owed` when it falls out. */
3205
3280
  logOwn(frame) {
3281
+ if (!this.ownPace.take(frameBytes(frame), this.now(), false, true)) this.overPace.add(ownKey(frame));
3206
3282
  this.state.sent.push(frame);
3207
3283
  let bytes = this.state.sent.reduce((sum, f) => sum + f.c.length, 0);
3208
- while (this.state.sent.length > GROUP_LIMITS.outlog || bytes > GROUP_LIMITS.outlogBytes) bytes -= this.state.sent.shift().c.length;
3284
+ while (this.state.sent.length > GROUP_LIMITS.outlog || bytes > GROUP_LIMITS.outlogBytes) {
3285
+ const out = this.state.sent.shift();
3286
+ bytes -= out.c.length;
3287
+ if (this.overPace.delete(ownKey(out))) this.owe(out);
3288
+ }
3289
+ }
3290
+ owe(frame) {
3291
+ const owed = [...this.state.owed ?? [], frame];
3292
+ let bytes = owed.reduce((sum, f) => sum + f.c.length, 0);
3293
+ while (owed.length > GROUP_LIMITS.owed || bytes > GROUP_LIMITS.owedBytes) {
3294
+ const gone = owed.shift();
3295
+ bytes -= gone.c.length;
3296
+ this.owedHeld.delete(ownKey(gone));
3297
+ }
3298
+ this.state.owed = owed;
3299
+ }
3300
+ /** Drops from `owed` each frame every other member of its epoch has shown, in a sync, that it holds. */
3301
+ owedTaken(from, frame) {
3302
+ if (!this.state.owed?.length) return;
3303
+ const holds = heldIn(frame);
3304
+ const owed = this.state.owed.filter((f) => {
3305
+ const key = ownKey(f);
3306
+ let held = this.owedHeld.get(key);
3307
+ if (holds(f)) {
3308
+ if (!held) this.owedHeld.set(key, held = /* @__PURE__ */ new Set());
3309
+ held.add(from);
3310
+ }
3311
+ const readers = this.state.chain[f.e]?.m;
3312
+ const waits = !!readers && this.others.some((k) => rosterHas(readers, k) && !held?.has(k));
3313
+ if (!waits) this.owedHeld.delete(key);
3314
+ return waits;
3315
+ });
3316
+ if (owed.length === this.state.owed.length) return;
3317
+ this.state.owed = owed;
3318
+ this.persistSoon();
3209
3319
  }
3210
3320
  /**
3211
3321
  * My message `id` was deleted for everyone: its frame, and each copy said again, keep their place in my log (`nextSeq`,
@@ -3216,7 +3326,7 @@ var GroupSession = class {
3216
3326
  * I cannot sign theirs, and its author hands it on. Saved soon, as a community's `forget`; `flush` writes it now.
3217
3327
  */
3218
3328
  forget(id) {
3219
- const sent = this.state.sent.map((f) => !f.c ? f : this.messageIdOf(f) === id ? {
3329
+ const emptied = (f) => !f.c ? f : this.messageIdOf(f) === id ? {
3220
3330
  t: f.t,
3221
3331
  g: f.g,
3222
3332
  e: f.e,
@@ -3227,11 +3337,13 @@ var GroupSession = class {
3227
3337
  c: "",
3228
3338
  sig: "",
3229
3339
  ...f.o ? { o: f.o } : {}
3230
- } : this.unquoted(f, id));
3340
+ } : this.unquoted(f, id);
3341
+ const sent = this.state.sent.map(emptied), owed = this.state.owed?.map(emptied);
3231
3342
  const gone = (f) => this.messageIdOf(f) === id || !!this.quoting(f, id);
3232
3343
  const relay = this.state.relay?.filter((f) => !gone(f)), rows = this.onRows?.filter((f) => !gone(f));
3233
- if (sent.every((f, i) => f === this.state.sent[i]) && relay?.length === this.state.relay?.length && rows?.length === this.onRows?.length) return;
3344
+ if (sent.every((f, i) => f === this.state.sent[i]) && (owed ?? []).every((f, i) => f === this.state.owed[i]) && relay?.length === this.state.relay?.length && rows?.length === this.onRows?.length) return;
3234
3345
  this.state.sent = sent;
3346
+ if (owed) this.state.owed = owed;
3235
3347
  if (relay) this.state.relay = relay;
3236
3348
  if (rows) this.onRows = rows;
3237
3349
  this.persistSoon();
@@ -3844,7 +3956,12 @@ var GroupSession = class {
3844
3956
  delete raw.o;
3845
3957
  delete raw.xs;
3846
3958
  }
3847
- if (!this.paced(this.messagePace, raw.s, frameBytes(raw), relayed && (answer || waited))) return;
3959
+ if (!this.paced(this.messagePace, raw.s, frameBytes(raw), relayed && (answer || waited))) {
3960
+ let byEpoch = this.refused.get(raw.s);
3961
+ if (!byEpoch) this.refused.set(raw.s, byEpoch = /* @__PURE__ */ new Map());
3962
+ byEpoch.set(raw.e, Math.max(byEpoch.get(raw.e) ?? -1, raw.n));
3963
+ return;
3964
+ }
3848
3965
  const first = raw.o === void 0 ? null : readFirstPlace(raw.o, raw.e);
3849
3966
  if (raw.o !== void 0 && !first) return;
3850
3967
  const secret = this.secret(raw.e);
@@ -4099,6 +4216,10 @@ var GroupSession = class {
4099
4216
  for (const e of Object.keys(bySender)) if (Number(e) < this.epoch - GROUP_LIMITS.secrets) delete bySender[e];
4100
4217
  if (!Object.keys(bySender).length) delete this.state.seen[sender];
4101
4218
  }
4219
+ for (const [sender, byEpoch] of this.refused) {
4220
+ for (const e of byEpoch.keys()) if (e < this.epoch - GROUP_LIMITS.secrets) byEpoch.delete(e);
4221
+ if (!byEpoch.size) this.refused.delete(sender);
4222
+ }
4102
4223
  }
4103
4224
  park(from, frame) {
4104
4225
  if (frame.e > this.epoch + GROUP_LIMITS.secrets) return;
@@ -4271,6 +4392,7 @@ var GroupSession = class {
4271
4392
  if (!answered) this.syncsAnswered.set(from, answered = new RateWindow(GROUP_LIMITS.syncAnswers, GROUP_LIMITS.syncWindowMs, () => this.hooks.clock?.() ?? Date.now()));
4272
4393
  if (!answered.take()) return;
4273
4394
  this.hear(frame);
4395
+ this.owedTaken(from, frame);
4274
4396
  await this.vouch(from, frame.mt);
4275
4397
  if (frame.e > this.epoch) {
4276
4398
  this.syncedEpoch.set(from, frame.e);
@@ -4347,13 +4469,13 @@ var GroupSession = class {
4347
4469
  handOut(to, frames) {
4348
4470
  this.answers.handOut(to, frames);
4349
4471
  }
4350
- /** My own messages a member's sync says it lacks, from my bounded log, for the epochs it was a member of. */
4472
+ /** My own messages a member's sync says it lacks, from my bounded log (and `owed`), for the epochs it was a member of. */
4351
4473
  handOwn(to, frame) {
4352
4474
  for (const sent of this.ownLacked(to, frame)) this.hooks.send(to, sent);
4353
4475
  }
4354
4476
  ownLacked(to, frame) {
4355
4477
  const lacks = missingIn(frame, to);
4356
- return this.state.sent.filter((sent) => this.state.chain[sent.e] && rosterHas(this.state.chain[sent.e].m, to) && lacks(sent) && !this.isRemoved(sent));
4478
+ return [...this.state.owed ?? [], ...this.state.sent].filter((sent) => this.state.chain[sent.e] && rosterHas(this.state.chain[sent.e].m, to) && lacks(sent) && !this.isRemoved(sent));
4357
4479
  }
4358
4480
  /** A frame of a message deleted for everyone (`hooks.removed`, or one of mine `forget` emptied): handed to nobody, its removal is what they get. */
4359
4481
  isRemoved(f) {
@@ -5258,7 +5380,7 @@ var bitcoindRpc = {
5258
5380
  if (!user || !password) throw new Error("Enter the RPC user and password, or paste the .cookie file");
5259
5381
  },
5260
5382
  async create(settings, host) {
5261
- const { BitcoindOnchain, tauriTransport } = await import("./bitcoind-BpZn3bRN.js");
5383
+ const { BitcoindOnchain, tauriTransport } = await import("./bitcoind-CK1QEUHn.js");
5262
5384
  return BitcoindOnchain.connect({
5263
5385
  url: settings.config.url.trim(),
5264
5386
  wallet: settings.config.wallet?.trim() ?? "",
@@ -5883,7 +6005,7 @@ function viewNews(before, after) {
5883
6005
  }
5884
6006
  // ../browser/src/engine/paymentAdapters/usdtWallet.ts
5885
6007
  /** The Ethereum libraries, a large part of the app: loaded once a USDT wallet is made, opened or restored, not with the engine. */
5886
- var loadUsdt = () => import("./usdt-DLmtf8F9.js");
6008
+ var loadUsdt = () => import("./usdt-BkO4SY07.js");
5887
6009
  /** Every new profile starts with this wallet: an address to receive on, nothing to set up. */
5888
6010
  var DEFAULT_USDT = {
5889
6011
  network: "ethereum",
@@ -6825,7 +6947,7 @@ var loading$2;
6825
6947
  /** Loads the WebAssembly once, on first use: profiles that never open a Bark wallet never fetch its 7.7 MB. */
6826
6948
  function loadBarkSdk() {
6827
6949
  return loading$2 ??= (async () => {
6828
- const [bark, wasm] = await Promise.all([import("@secondts/bark/web"), import("./bark_ffi_wasm_bg-CcafsJla.js")]);
6950
+ const [bark, wasm] = await Promise.all([import("@secondts/bark/web"), import("./bark_ffi_wasm_bg-CjjCN3FD.js")]);
6829
6951
  await bark.default({ module_or_path: wasm.default });
6830
6952
  return {
6831
6953
  async open({ network, mnemonic, server, esplora, database }) {
@@ -9404,7 +9526,7 @@ var BitcoinService = class {
9404
9526
  // ../browser/src/engine/paymentAdapters/providers/bdkSdk.ts
9405
9527
  var WASM_IMPORTS = "./bitcoindevkit_bg.js";
9406
9528
  var appLoader = async () => {
9407
- const [glue, url] = await Promise.all([import("@bitcoindevkit/bdk-wallet-web/bitcoindevkit_bg.js"), import("./bitcoindevkit_bg-BWQHx7vd.js")]);
9529
+ const [glue, url] = await Promise.all([import("@bitcoindevkit/bdk-wallet-web/bitcoindevkit_bg.js"), import("./bitcoindevkit_bg-D6IFIaJi.js")]);
9408
9530
  return {
9409
9531
  glue,
9410
9532
  wasm: await fetch(url.default)
@@ -14459,7 +14581,7 @@ var HostNotContacted = class extends Error {};
14459
14581
  */
14460
14582
  function fixedHostsFetch(fetch) {
14461
14583
  return async (url, options) => {
14462
- const { fixedIdentityHosts } = await import("./fixedHosts-CODN2pTL.js");
14584
+ const { fixedIdentityHosts } = await import("./fixedHosts-CrO01M_y.js");
14463
14585
  const host = hostOf$1(url);
14464
14586
  if (!fixedIdentityHosts().has(host) && host !== hostOf$1("https://public.api.bsky.app") && host !== hostOf$1("https://nexus.pubky.app")) throw new HostNotContacted(`Hide my IP from contacts is on: ${host}, a server your contact chose, was not contacted`);
14465
14587
  return fetch(url, options);
@@ -15998,6 +16120,13 @@ var ChatTextSearch = class {
15998
16120
  const kept = this.texts.get(linkId);
15999
16121
  if (kept) for (const id of ids) kept.changed.add(id);
16000
16122
  }
16123
+ /**
16124
+ * A chat deleted: its texts go. The same invite joined again is a chat of the same id, and only the rows it changes
16125
+ * are read again: it was found by the deleted chat's words for as long as a search went on.
16126
+ */
16127
+ forget(linkId) {
16128
+ this.texts.delete(linkId);
16129
+ }
16001
16130
  textsOf(linkId) {
16002
16131
  let kept = this.texts.get(linkId);
16003
16132
  if (!kept) {
@@ -16074,6 +16203,14 @@ var APP_CHECK_TIMINGS = {
16074
16203
  /** After the engine starts, so the chats come up first. */
16075
16204
  afterStartMs: 6e4,
16076
16205
  everyMs: 864e5,
16206
+ /** A check the network was off for, or whose read of the installed apps failed, is tried again this soon, not a day later. */
16207
+ offlineRetryMs: 6e5,
16208
+ /**
16209
+ * A check that ran while no publisher's file could be reached (the device without a network though Ghostly's is on,
16210
+ * the host down or rate-limiting) is tried again after `offlineRetryMs`, then twice as long each time it fails again,
16211
+ * up to this.
16212
+ */
16213
+ unreachedRetryMaxMs: 72e5,
16077
16214
  /** A check at start is skipped when every app was checked this recently (a page reloaded several times). */
16078
16215
  freshMs: 36e5
16079
16216
  };
@@ -16206,6 +16343,8 @@ function pooled(items, limit, run) {
16206
16343
  for (let w = 0; w < Math.min(limit, items.length); w++) worker();
16207
16344
  return out;
16208
16345
  }
16346
+ /** A jsDelivr URL, which this client reads only at a full commit (`isAppFetchUrl`): its bytes never move on. */
16347
+ var isPinnedAppUrl = (u) => new URL(u).hostname.toLowerCase() === "cdn.jsdelivr.net";
16209
16348
  /**
16210
16349
  * A listing's URLs this client reads, in order, a jsDelivr copy first: one this client reads names a full commit, so it
16211
16350
  * holds exactly the version the store reviewed, where a raw `HEAD` may have moved on to one it has not (WISP 1200 §
@@ -16213,8 +16352,7 @@ function pooled(items, limit, run) {
16213
16352
  */
16214
16353
  function listingUrls(urls) {
16215
16354
  const readable = urls.filter(isAppFetchUrl);
16216
- const pinned = (u) => new URL(u).hostname.toLowerCase() === "cdn.jsdelivr.net";
16217
- return [...readable.filter(pinned), ...readable.filter((u) => !pinned(u))];
16355
+ return [...readable.filter(isPinnedAppUrl), ...readable.filter((u) => !isPinnedAppUrl(u))];
16218
16356
  }
16219
16357
  /** A read that failed for a reason that may pass: offline, the host not reached or too slow, its own trouble (5xx, 429). */
16220
16358
  var passing = (error) => error instanceof AppFetchError && (error.code === "offline" || error.code === "network" || error.code === "slow" || (error.status ?? 0) >= 500 || error.status === 429);
@@ -16579,6 +16717,8 @@ var Apps = class {
16579
16717
  /** Drops `previewed` past `STAGED.ms`: an index is up to 4 MiB, and a closed Add screen sends no call. */
16580
16718
  previewedSweep = null;
16581
16719
  checking = null;
16720
+ /** Checks in a row in which an app's publisher's files could not be reached at all (`checkApp`); 0 after one that reached them all. */
16721
+ unreachedChecks = 0;
16582
16722
  /**
16583
16723
  * Runs the person started with Run anyway (`<ref> <digest>`): a removal does not cut them off. Only that run's: dropped
16584
16724
  * when the version starts without it, when a call finds it no longer removed, and at Uninstall.
@@ -16722,12 +16862,17 @@ var Apps = class {
16722
16862
  this.timer = null;
16723
16863
  (async () => {
16724
16864
  if (this.stopped) return;
16725
- if (this.host.online()) {
16726
- const apps = await this.installed();
16727
- const fresh = atStart && apps.length > 0 && apps.every((a) => this.checkedWithin(a.checkedAt, APP_CHECK_TIMINGS.freshMs));
16728
- if (apps.length && !fresh) await this.checkUpdates().catch(() => {});
16865
+ if (!this.host.online()) return this.schedule(APP_CHECK_TIMINGS.offlineRetryMs, atStart);
16866
+ const apps = await this.installed().catch(() => null);
16867
+ if (!apps) {
16868
+ if (!this.stopped) this.schedule(APP_CHECK_TIMINGS.offlineRetryMs, atStart);
16869
+ return;
16729
16870
  }
16730
- if (!this.stopped) this.schedule(APP_CHECK_TIMINGS.everyMs);
16871
+ const fresh = atStart && apps.length > 0 && apps.every((a) => this.checkedWithin(a.checkedAt, APP_CHECK_TIMINGS.freshMs));
16872
+ if (apps.length && !fresh) await this.checkUpdates().catch(() => {});
16873
+ const unreached = apps.length && !fresh ? this.unreachedChecks : 0;
16874
+ const next = unreached ? Math.min(APP_CHECK_TIMINGS.offlineRetryMs * 2 ** (unreached - 1), APP_CHECK_TIMINGS.unreachedRetryMaxMs) : APP_CHECK_TIMINGS.everyMs;
16875
+ if (!this.stopped) this.schedule(next);
16731
16876
  })();
16732
16877
  }, ms);
16733
16878
  }
@@ -16813,14 +16958,17 @@ var Apps = class {
16813
16958
  }
16814
16959
  /**
16815
16960
  * The bundle the build carries for a built-in app, checked as a fetched one is, and against its entry: the digest the
16816
- * list pins and the entry's reference. Anything else in that file is not this app, and nothing of it is kept.
16961
+ * list pins and the entry's reference. Anything else in that file is not this app, and nothing of it is kept. A read
16962
+ * that says why it failed (`AppFetchError`: offline, the host not reached, its status) says so as is, so the screen
16963
+ * offers Try again: only an unexplained failure is a build that does not carry the app.
16817
16964
  */
16818
16965
  async bundled(app) {
16819
16966
  if (!this.host.readBuiltIn) fail("not-carried", "This build does not carry this app");
16820
16967
  let bytes;
16821
16968
  try {
16822
16969
  bytes = await this.host.readBuiltIn(app);
16823
- } catch {
16970
+ } catch (error) {
16971
+ if (error instanceof AppFetchError) throw error;
16824
16972
  fail("not-carried", "This build does not carry this app");
16825
16973
  }
16826
16974
  if (!(bytes instanceof Uint8Array) || bytes.length > APP_BUNDLE_LIMITS.bundleBytes) fail("not-carried", "This build does not carry this app");
@@ -17345,8 +17493,10 @@ var Apps = class {
17345
17493
  /**
17346
17494
  * The revocations its publisher signed, read beside each URL (`ghostly-revoke.json`); none there is not an error.
17347
17495
  * `read` holds the files already read, which are skipped, and gets the ones read now. Null when no file answered now.
17496
+ * `reach`, when given, learns whether a host answered (a file, or none there) and whether a read failed for a reason
17497
+ * that may pass (offline, the host not reached or too slow, its own trouble).
17348
17498
  */
17349
- async readRevocations(ref, urls, read = /* @__PURE__ */ new Set()) {
17499
+ async readRevocations(ref, urls, read = /* @__PURE__ */ new Set(), reach) {
17350
17500
  let out = null;
17351
17501
  for (const url of new Set(urls.filter(isAppFetchUrl).map((u) => besideUrl(u, "ghostly-revoke.json")))) {
17352
17502
  if (read.has(url)) continue;
@@ -17357,7 +17507,13 @@ var Apps = class {
17357
17507
  revalidate: true
17358
17508
  }));
17359
17509
  if (file) (out ??= []).push(...file);
17360
- } catch {}
17510
+ if (reach) reach.answered = true;
17511
+ } catch (error) {
17512
+ if (reach) {
17513
+ if (passing(error)) reach.failed = true;
17514
+ else reach.answered = true;
17515
+ }
17516
+ }
17361
17517
  }
17362
17518
  return out;
17363
17519
  }
@@ -17810,17 +17966,23 @@ var Apps = class {
17810
17966
  };
17811
17967
  } else fail("bad-source", "No app to fetch");
17812
17968
  if (!urls.length) fail("host", "This listing has no URL Ghostly reads from");
17969
+ const judge = (version) => {
17970
+ if (!expect) return;
17971
+ if (version.ref !== expect.ref) fail("other-app", "The URL holds another app");
17972
+ if (expect.sequence !== void 0 && version.sequence < expect.sequence) fail("rollback", "The URL holds an older version than the one named");
17973
+ if (expect.sequence === version.sequence && expect.digest !== void 0 && expect.digest !== version.digest) fail("equivocation", "The URL holds another version under the same number");
17974
+ if (expect.exact && version.digest !== expect.digest) fail("unlisted", "The URL holds a version the store does not list");
17975
+ };
17813
17976
  let last = null;
17814
17977
  for (const url of urls) try {
17815
17978
  const kept = expect?.digest !== void 0 ? this.staged.get(stagedKey(expect.digest, url, fromStore)) : void 0;
17816
- const { bundle, bytes } = kept && this.checkedWithin(kept.at, STAGED.ms) ? kept : await this.fetchBundle(url);
17817
- const version = versionOf(bundle.manifest, bundle.digest);
17818
- if (expect) {
17819
- if (version.ref !== expect.ref) fail("other-app", "The URL holds another app");
17820
- if (expect.sequence !== void 0 && version.sequence < expect.sequence) fail("rollback", "The URL holds an older version than the one named");
17821
- if (expect.sequence === version.sequence && expect.digest !== void 0 && expect.digest !== version.digest) fail("equivocation", "The URL holds another version under the same number");
17822
- if (expect.exact && version.digest !== expect.digest) fail("unlisted", "The URL holds a version the store does not list");
17979
+ const fresh = kept && this.checkedWithin(kept.at, STAGED.ms);
17980
+ if (!fresh && expect?.exact && !isPinnedAppUrl(url)) {
17981
+ const peek = await this.peekAt(url);
17982
+ if (peek) judge(peek);
17823
17983
  }
17984
+ const { bundle, bytes } = fresh ? kept : await this.fetchBundle(url);
17985
+ judge(versionOf(bundle.manifest, bundle.digest));
17824
17986
  return this.stage(bundle, bytes, url, fromStore);
17825
17987
  } catch (error) {
17826
17988
  if (!passing(last) || passing(error)) last = error;
@@ -18112,6 +18274,7 @@ var Apps = class {
18112
18274
  this.listingsRead = read;
18113
18275
  try {
18114
18276
  const out = (await Promise.all(pooled(apps, APP_CHECK_PARALLEL, (app) => this.checkApp(app, stores).catch(() => null)))).filter((r) => r !== null);
18277
+ this.unreachedChecks = out.some((r) => r.unreached) ? this.unreachedChecks + 1 : 0;
18115
18278
  for (const missed of this.listingMisses.keys()) if (!read.has(missed)) this.listingMisses.delete(missed);
18116
18279
  const kept = out.length ? await this.keptValue() : null;
18117
18280
  return await Promise.all(out.map(async ({ app, outcome }) => ({
@@ -18124,7 +18287,10 @@ var Apps = class {
18124
18287
  this.listingsRead = null;
18125
18288
  }
18126
18289
  }
18127
- /** One app's part of the update check (`checkNow`): its record as written; null when it is not installed any more. */
18290
+ /**
18291
+ * One app's part of the update check (`checkNow`): its record as written; null when it is not installed any more.
18292
+ * `unreached` when none of its publisher's files answered, every read failing for a reason that may pass.
18293
+ */
18128
18294
  async checkApp(listed, stores) {
18129
18295
  if (!await this.hasBundle(listed.bytes, listed.digest, listed.manifest)) await this.fetchFiles({ ref: listed.ref }).catch(() => {});
18130
18296
  const first = await this.app(listed.ref);
@@ -18179,7 +18345,11 @@ var Apps = class {
18179
18345
  } catch {}
18180
18346
  }
18181
18347
  const revokeRead = /* @__PURE__ */ new Set();
18182
- const before = await this.readRevocations(app.ref, [app.from, ...app.manifest.sources ?? []], revokeRead);
18348
+ const reach = {
18349
+ answered: false,
18350
+ failed: false
18351
+ };
18352
+ const before = await this.readRevocations(app.ref, [app.from, ...app.manifest.sources ?? []], revokeRead, reach);
18183
18353
  app = withRevocations(app, before ?? []);
18184
18354
  const kept = await this.keptRevocationsOf(app.ref);
18185
18355
  const judge = (version) => this.runStatus(version, this.storeViews(stores), [...app.revocations ?? [], ...kept]);
@@ -18317,7 +18487,7 @@ var Apps = class {
18317
18487
  }
18318
18488
  break;
18319
18489
  }
18320
- const after = await this.readRevocations(app.ref, [app.from, ...app.manifest.sources ?? []], revokeRead);
18490
+ const after = await this.readRevocations(app.ref, [app.from, ...app.manifest.sources ?? []], revokeRead, reach);
18321
18491
  const revocations = before || after ? [...before ?? [], ...after ?? []] : null;
18322
18492
  const versions = this.versionsOf(app);
18323
18493
  const stays = revocations ? stopping(versions, app.revocations ?? []) : app.revocations ?? [];
@@ -18332,17 +18502,19 @@ var Apps = class {
18332
18502
  const { store: _s, ...unpinned } = app;
18333
18503
  app = unpinned;
18334
18504
  }
18505
+ const unreached = reach.failed && !reach.answered;
18335
18506
  app = {
18336
18507
  ...app,
18337
18508
  ...merged.size && { revocations: [...merged.values()] },
18338
- checkedAt: this.now()
18509
+ ...!unreached && { checkedAt: this.now() }
18339
18510
  };
18340
- const put = this.checkedWithin(stored.checkedAt, APP_CHECK_TIMINGS.freshMs / 2) && sameExceptChecked(app, stored) ? sameRecord(current, stored) : await this.putAppIfUnchanged(app, stored);
18511
+ const put = sameExceptChecked(app, stored) && (unreached || this.checkedWithin(stored.checkedAt, APP_CHECK_TIMINGS.freshMs / 2)) ? sameRecord(current, stored) : await this.putAppIfUnchanged(app, stored);
18341
18512
  for (const files of [...dropped, ...!put && wrote ? [wrote] : []]) await this.removeUnusedBundle(app.ref, files.bytes, files.digest);
18342
18513
  if (!put) return null;
18343
18514
  return {
18344
18515
  app,
18345
- outcome
18516
+ outcome,
18517
+ ...unreached && { unreached: true }
18346
18518
  };
18347
18519
  }
18348
18520
  /**
@@ -22276,19 +22448,42 @@ var RELAY_TEXT_CHARS = 120;
22276
22448
  * The push relay answered, but not with a push service's status: its own refusal (403 `Origin not allowed`, 400 naming
22277
22449
  * a header, 429), a web page or JSON without `status` (a wrong address or path, a proxy with no route). `text` is the
22278
22450
  * relay's own `{ error }` text when it gave one, on one line and cut to `RELAY_TEXT_CHARS`; a web page gives none.
22451
+ * `http` 0 is fetch's status for an answer the page may not read: the address answered, but without CORS (another
22452
+ * kind of server, a proxy's error page in front of a relay that is down), so it is no push relay this page can use.
22279
22453
  */
22280
22454
  var PushRelayRefusal = class extends Error {
22281
22455
  http;
22282
22456
  text;
22283
22457
  cause;
22284
22458
  constructor(http, text, cause) {
22285
- super(`The push relay did not forward it (HTTP ${http})`);
22459
+ super(http === 0 ? "The push relay's address answered without CORS" : `The push relay did not forward it (HTTP ${http})`);
22286
22460
  this.http = http;
22287
22461
  this.text = text;
22288
22462
  this.cause = cause;
22289
22463
  this.name = "PushRelayRefusal";
22290
22464
  }
22291
22465
  };
22466
+ /**
22467
+ * Whether something answers at `url` at all, read with a `no-cors` GET: its answer is opaque, but it arrives, where
22468
+ * offline, a name that does not resolve or a host that refuses the connection fail as the post did. Only asked after
22469
+ * the post failed with a `TypeError`, which is all a page gets both for an answer without CORS and for no answer.
22470
+ */
22471
+ async function answersWithoutCors(url) {
22472
+ if (typeof navigator !== "undefined" && navigator.onLine === false) return false;
22473
+ try {
22474
+ await fetch(url, {
22475
+ method: "GET",
22476
+ mode: "no-cors",
22477
+ credentials: "omit",
22478
+ referrerPolicy: "no-referrer",
22479
+ cache: "no-store",
22480
+ signal: AbortSignal.timeout(1e4)
22481
+ });
22482
+ return true;
22483
+ } catch {
22484
+ return false;
22485
+ }
22486
+ }
22292
22487
  /** The relay's own `{ error: "..." }` text in `body`, one line, cut; undefined when it gave none. */
22293
22488
  function relayErrorText(body) {
22294
22489
  const error = body && typeof body === "object" ? body.error : void 0;
@@ -22301,8 +22496,8 @@ function relayErrorText(body) {
22301
22496
  /**
22302
22497
  * Posts a push: the host's way (Desktop and the CLI post it themselves), or `fetch`, then the person's push relay when
22303
22498
  * a page may not post it (the push services answer without CORS). Answers the push service's HTTP status; throws a
22304
- * `PushRelayRefusal` when the relay answers without it (`relayed` is told when it answers with it), and the fetch's
22305
- * own error when the relay cannot be reached at all.
22499
+ * `PushRelayRefusal` when the relay answers without it (`relayed` is told when it answers with it), or when its address
22500
+ * answers but without CORS (`http` 0), and the fetch's own error when the relay cannot be reached at all.
22306
22501
  */
22307
22502
  async function postPush(request, options) {
22308
22503
  if (options.pushSend) return options.pushSend(request);
@@ -22321,13 +22516,19 @@ async function postPush(request, options) {
22321
22516
  })).status;
22322
22517
  } catch (error) {
22323
22518
  if (!options.relay) throw error;
22324
- const response = await fetch(options.relay, {
22325
- method: "POST",
22326
- headers: { "Content-Type": "application/json" },
22327
- body: JSON.stringify(relayRequest(request)),
22328
- signal: AbortSignal.timeout(15e3),
22329
- ...quiet
22330
- });
22519
+ let response;
22520
+ try {
22521
+ response = await fetch(options.relay, {
22522
+ method: "POST",
22523
+ headers: { "Content-Type": "application/json" },
22524
+ body: JSON.stringify(relayRequest(request)),
22525
+ signal: AbortSignal.timeout(15e3),
22526
+ ...quiet
22527
+ });
22528
+ } catch (relayError) {
22529
+ if (relayError instanceof TypeError && await answersWithoutCors(options.relay)) throw new PushRelayRefusal(0, void 0, relayError);
22530
+ throw relayError;
22531
+ }
22331
22532
  const answer = await response.json().catch(() => null);
22332
22533
  if (!response.ok || typeof answer?.status !== "number") throw new PushRelayRefusal(response.status, relayErrorText(answer), error);
22333
22534
  options.relayed?.();
@@ -22689,6 +22890,8 @@ function verifierStands(record, latest) {
22689
22890
  const stated = turnStatedVerifier(latest.instance);
22690
22891
  return !stated || bytesEqual(stated, turnVerifierMark(record.verifier));
22691
22892
  }
22893
+ /** Whether the record names a pull's staging namespace apart from the profile's own (`handoff.ts`, `dropStaging`). */
22894
+ var staged = (record) => record.handoff?.role === "taking" && !!record.handoff.staging && record.handoff.staging !== record.profile;
22692
22895
  /** A name as it is seen and typed: nobody types a joiner, a variation selector or a filler, which draw nothing. */
22693
22896
  var typedName = (name) => name.normalize("NFC").replace(/\p{Default_Ignorable_Code_Point}/gu, "").trim().toLocaleLowerCase();
22694
22897
  var sameName = (a, b) => typedName(a) === typedName(b);
@@ -22736,6 +22939,11 @@ async function forceTakeover(ports, request) {
22736
22939
  });
22737
22940
  const keeper = await ports.keeper();
22738
22941
  if (!keeper) throw new TakeoverRefusal("offline", "Go online to take over.");
22942
+ if (staged(record)) {
22943
+ await ports.dropStaging?.().catch(() => {});
22944
+ const now = await ports.read();
22945
+ if (!now || staged(now)) throw new TakeoverRefusal("state", "A move to this device is still being undone. Try again.");
22946
+ }
22739
22947
  const outcome = await keeper.raise({ before: (latest) => {
22740
22948
  if (!verifierStands(record, latest)) throw new TakeoverRefusal("changed", `The lock password was changed${target ? ` on ${target}` : ""}. Use here moves the profile with the new one.`);
22741
22949
  } });
@@ -24354,7 +24562,10 @@ var DeviceLinks = class {
24354
24562
  read: () => (this.options.readRecord ?? readDeviceRecord)(this.options.profile),
24355
24563
  amend: (patch) => amendDevice(this.options.profile, patch),
24356
24564
  proves: (verifier, password) => provesHandoffPassword(verifier, password),
24357
- keeper: () => this.turnKeeper()
24565
+ keeper: () => this.turnKeeper(),
24566
+ dropStaging: async () => {
24567
+ await this.handoff?.dropStaging?.();
24568
+ }
24358
24569
  }, {
24359
24570
  password: typeof p.password === "string" ? p.password : "",
24360
24571
  name: typeof p.name === "string" ? p.name : ""
@@ -24890,13 +25101,15 @@ var HandoffGiver = class {
24890
25101
  return this.exclusive(() => this.handle(from, frame)).catch(() => {});
24891
25102
  }
24892
25103
  /**
24893
- * A turn read on this standby found the record of `key` at `turn`: the device it released to took the turn, which is
25104
+ * A turn read on this standby found a record at `turn`: the device it released to took the turn, which is
24894
25105
  * what the `handoff-done` would have said. That frame goes once, as the taker reloads, and can be lost; without this
24895
- * the screen said "Moving to …" for good, with no Use here, until that device offered the profile back.
25106
+ * the screen said "Moving to …" for good, with no Use here, until that device offered the profile back. Another
25107
+ * device's record at the release's turn or above (a forced takeover that won) ends the release too: the taker steps
25108
+ * back from it, and the screen and a Take over follow the record's active device, not the one released to.
24896
25109
  */
24897
- turnTaken(key, turn) {
25110
+ turnTaken(turn) {
24898
25111
  return this.exclusive(async () => {
24899
- if (this.stopped || this.phase !== "released" || key !== this.peer || turn <= this.turn) return;
25112
+ if (this.stopped || this.phase !== "released" || turn <= this.turn) return;
24900
25113
  await this.taken();
24901
25114
  }).catch(() => {});
24902
25115
  }
@@ -26391,6 +26604,8 @@ var FileDesk = class {
26391
26604
  deciding = /* @__PURE__ */ new Set();
26392
26605
  /** Received files whose offer waits for the person, by local id: the room they show is read again (`rooms`). */
26393
26606
  asking = /* @__PURE__ */ new Set();
26607
+ /** Ends what was said on the floor and never offered (`sweepAnnounced`), from the first one said. */
26608
+ announcedSweeper;
26394
26609
  constructor(deps) {
26395
26610
  this.deps = deps;
26396
26611
  }
@@ -26452,7 +26667,10 @@ var FileDesk = class {
26452
26667
  records.push(file.wire3);
26453
26668
  if (file.wire3.direction === "in") chat.local.set(file.wire3.id, file.id);
26454
26669
  if (!transferEnded(file.wire3)) this.restored.add(file.id);
26455
- else if (file.wire3.state !== "done" || !unsettled.has(file.id)) this.ended.add(file.id);
26670
+ else if (file.wire3.state !== "done" || !unsettled.has(file.id)) {
26671
+ this.ended.add(file.id);
26672
+ if (file.wire3.direction === "out" && (file.wire3.state === "cancelled" || file.wire3.state === "declined") && file.bytes) this.dropStaged(chat, file.id);
26673
+ }
26456
26674
  if (file.wire3.state === "done") continue;
26457
26675
  this.deps.transfers.set(file.id, this.view(chat, file.wire3, file.wire3.confirmed, transferStalled(file.wire3, elapsed(), this.restored.has(file.id), elapsed())));
26458
26676
  }
@@ -26521,6 +26739,9 @@ var FileDesk = class {
26521
26739
  transferred: 0,
26522
26740
  size
26523
26741
  });
26742
+ if (this.announcedSweeper) return;
26743
+ this.announcedSweeper = setInterval(() => this.sweepAnnounced(), FILE_LIMITS.sweepEveryMs);
26744
+ this.announcedSweeper.unref?.();
26524
26745
  }
26525
26746
  /** This device refuses the offer of a file said on the floor: its bubble ends, saying why (`floorRefusal`). */
26526
26747
  refusedHere(chat, frame) {
@@ -26696,13 +26917,18 @@ var FileDesk = class {
26696
26917
  this.speeds.delete(fileId);
26697
26918
  this.unwatch(fileId);
26698
26919
  }
26699
- /** Offers nobody answered in a week end; the peer calls this now and then. */
26920
+ /** Offers nobody answered in a week end (each chat's own sweep does it while its session is open), and so do files said on the floor. */
26700
26921
  sweep() {
26922
+ for (const chat of this.chats.values()) chat.files.sweep();
26923
+ this.sweepAnnounced();
26924
+ }
26925
+ /**
26926
+ * Said on the floor and never offered live within the week an offer waits: it is not coming. Run every
26927
+ * `FILE_LIMITS.sweepEveryMs` from the first one said (`announcedHere`): nothing called `sweep`, so its bubble waited for good.
26928
+ */
26929
+ sweepAnnounced() {
26701
26930
  const now = Date.now();
26702
- for (const chat of this.chats.values()) {
26703
- chat.files.sweep();
26704
- for (const [wireId, said] of [...chat.announced]) if (now - said.at > ANNOUNCED_FOR_MS) this.withdrawn(chat, wireId, "It did not come within a week");
26705
- }
26931
+ for (const chat of this.chats.values()) for (const [wireId, said] of [...chat.announced]) if (now - said.at > ANNOUNCED_FOR_MS) this.withdrawn(chat, wireId, "It did not come within a week");
26706
26932
  }
26707
26933
  /**
26708
26934
  * The chat went away: its transfers stop here. An unfinished one ends on the contact's side too, as deleting its
@@ -26726,6 +26952,12 @@ var FileDesk = class {
26726
26952
  ]) if (id.startsWith(`${linkId}-`)) this.unwatch(id);
26727
26953
  return said;
26728
26954
  }
26955
+ /** The app stops: no chat's files are swept any more (`ChatFiles.stop`), nor what was said on the floor. */
26956
+ stop() {
26957
+ for (const chat of this.chats.values()) chat.files.stop();
26958
+ clearInterval(this.announcedSweeper);
26959
+ this.announcedSweeper = void 0;
26960
+ }
26729
26961
  /** Stops tracking whether a transfer is stuck, and the room an offer of it shows. */
26730
26962
  unwatch(id) {
26731
26963
  clearTimeout(this.stallChecks.get(id));
@@ -26895,6 +27127,7 @@ var FileDesk = class {
26895
27127
  wire: fileWire("files/3", file.size)
26896
27128
  }
26897
27129
  });
27130
+ if (this.deps.deleted(linkId, `peer_${record.id}`)) this.deletedMeanwhile(linkId, id);
26898
27131
  }).catch((error) => this.unkept(linkId, chat, record.id, id, error, said));
26899
27132
  }
26900
27133
  if (record.direction === "in" && !chat.local.has(record.id)) {
@@ -26947,6 +27180,7 @@ var FileDesk = class {
26947
27180
  ...file.forwarded && { forwarded: file.forwarded },
26948
27181
  details: { wire: fileWire("files/3", file.size) }
26949
27182
  });
27183
+ if (this.deps.deleted(linkId, `peer_${record.id}`)) this.deletedMeanwhile(linkId, id);
26950
27184
  }).catch((error) => this.unkept(linkId, chat, record.id, id, error));
26951
27185
  }
26952
27186
  const offered = record.direction === "in" && !this.deps.transfers.has(chat.local.get(record.id));
@@ -26997,6 +27231,14 @@ var FileDesk = class {
26997
27231
  chat.files.refuse(wireId, error?.name === "QuotaExceededError" ? "no-room" : "invalid");
26998
27232
  this.deps.changed();
26999
27233
  }
27234
+ /** An offer whose message was deleted before its row was kept: forgotten as a deleted message's file is. */
27235
+ deletedMeanwhile(linkId, id) {
27236
+ this.forget(linkId, id);
27237
+ this.deps.transfers.delete(id);
27238
+ const chat = this.chats.get(linkId);
27239
+ if (chat) chat.saving = chat.saving.then(() => removeStored(id)).catch(() => {});
27240
+ this.deps.changed();
27241
+ }
27000
27242
  /**
27001
27243
  * Writes a transfer's record and the view of it, after the chat's writes before it; what was held back goes with it.
27002
27244
  * One the database refuses (a full disk) is kept and written again, with the chat's next write and every few seconds,
@@ -27080,8 +27322,16 @@ var FileDesk = class {
27080
27322
  this.ended.add(id);
27081
27323
  this.deps.settled?.(linkId, id, record, this.underway.delete(id));
27082
27324
  if (record.direction === "in") this.rooms();
27325
+ else if (record.state === "cancelled" || record.state === "declined") this.dropStaged(chat, id);
27083
27326
  }
27084
27327
  }
27328
+ /** The bytes a sent file was staged in, after the chat's writes before; a small one kept whole in its record stays. */
27329
+ dropStaged(chat, id) {
27330
+ chat.saving = chat.saving.then(async () => {
27331
+ const stored = await fileStore.get(id);
27332
+ if (stored?.bytes) await (await fileBytesOf(stored.bytes))?.remove(id);
27333
+ }).catch(() => {});
27334
+ }
27085
27335
  /**
27086
27336
  * Whether a transfer is stuck (`transferStalled`): not moved for `FILE_LIMITS.stallMs`, or not since the app started.
27087
27337
  * Only bytes moving count (`progress`: confirmed by the receiver, stored here), not a session saying again where it
@@ -29651,7 +29901,7 @@ var Reactions = class {
29651
29901
  if (!e && !current?.e) return { error: "No reaction of yours to take back" };
29652
29902
  let history;
29653
29903
  const read = async () => history ??= await this.host.messages(chat);
29654
- if (group && current?.e && current.at < await this.joinedAt(chat, read)) return { error: "Your reaction to this message went out before you were invited back, and stays as it is" };
29904
+ if (group && current?.e && current.at < await this.joinedAt(chat, read)) return { error: "Your reaction to this message is from before you were removed and invited back, and stays as it is" };
29655
29905
  let last = this.last.get(chat) ?? lastMine(await read());
29656
29906
  for (const p of pending) last = Math.max(last, p.n);
29657
29907
  const reaction = {
@@ -30050,6 +30300,7 @@ var LIVE = [
30050
30300
  "seqEpoch",
30051
30301
  "seen",
30052
30302
  "sent",
30303
+ "owed",
30053
30304
  "alone",
30054
30305
  "provisional",
30055
30306
  "nicks",
@@ -30141,6 +30392,7 @@ function liveOf(group) {
30141
30392
  seen: s.seen,
30142
30393
  sent: s.sent,
30143
30394
  nicks: s.nicks,
30395
+ ...s.owed?.length ? { owed: s.owed } : {},
30144
30396
  ...s.alone && { alone: s.alone },
30145
30397
  ...s.provisional && { provisional: s.provisional },
30146
30398
  ...s.unsaid?.length ? { unsaid: s.unsaid } : {}
@@ -33033,7 +33285,10 @@ var Communities = class {
33033
33285
  ...m.frame && { frame: m.frame }
33034
33286
  }, m.live);
33035
33287
  placing(stored !== false);
33036
- if (stored === false && this.stored.get(id)?.removedIds?.includes(m.id)) return false;
33288
+ if (stored === false && this.stored.get(id)?.removedIds?.includes(m.id)) {
33289
+ if (file) await this.files?.forget(id, m.id);
33290
+ return false;
33291
+ }
33037
33292
  const came = m.sender === session.myKey ? timestamp : cameAt(timestamp, stored, arrivalNow(this.now()));
33038
33293
  markCame(this.marks, id, m.id, came, m.sender !== session.myKey, mentioned);
33039
33294
  noteCame(this.stored.get(id), came, m.sender !== session.myKey, mentioned);
@@ -37481,7 +37736,7 @@ var Groups = class {
37481
37736
  }
37482
37737
  const lacking = session.lacking();
37483
37738
  out.push(...this.gapsOf(groupId, session, via, lacking));
37484
- this.ownGap(groupId, via, lacking);
37739
+ this.ownGap(groupId, session, via, lacking);
37485
37740
  if (out.length) this.lastGossip.set(groupId, now);
37486
37741
  return out;
37487
37742
  }
@@ -37603,9 +37858,10 @@ var Groups = class {
37603
37858
  }
37604
37859
  /**
37605
37860
  * Whether a sync to `via` asks it for its own messages that never reached me, for the first time since what is
37606
- * missing changed: any sync names them (`miss`), and an author answers from its own log (`GROUP_LIMITS.outlog`).
37861
+ * missing changed: any sync names them (`miss`), and an author answers from its own log (`GROUP_LIMITS.outlog`) and
37862
+ * the frames past it members did not take at its pace (`GroupState.owed`).
37607
37863
  */
37608
- ownGap(groupId, via, lacking) {
37864
+ ownGap(groupId, session, via, lacking) {
37609
37865
  const mark = lacking.get(via);
37610
37866
  if (mark === void 0) return false;
37611
37867
  let tried = this.gapsAsked.get(groupId);
@@ -37616,11 +37872,16 @@ var Groups = class {
37616
37872
  mark,
37617
37873
  of: /* @__PURE__ */ new Set(),
37618
37874
  noticed: entry?.noticed ?? now,
37619
- last: entry?.last
37875
+ last: entry?.last,
37876
+ own: entry?.own
37620
37877
  });
37621
37878
  if (entry.of.has(via)) return false;
37622
37879
  entry.of.add(via);
37623
37880
  entry.at = now;
37881
+ entry.own = {
37882
+ at: now,
37883
+ asked: session.missOf(via)
37884
+ };
37624
37885
  return true;
37625
37886
  }
37626
37887
  /** Whether some of a member's messages are still on their way (not known gone): in any epoch, or in those below `below`. */
@@ -37684,8 +37945,20 @@ var Groups = class {
37684
37945
  of: /* @__PURE__ */ new Set(),
37685
37946
  noticed: now
37686
37947
  });
37687
- const { last } = entry;
37948
+ const { last, own } = entry;
37688
37949
  if (!up(key)) continue;
37950
+ if (own && now - own.at >= 1e4 && session.filledSince(key, own.asked)) {
37951
+ entry.of.add(key);
37952
+ entry.at = now;
37953
+ entry.own = {
37954
+ at: now,
37955
+ asked: session.missOf(key)
37956
+ };
37957
+ try {
37958
+ this.host.sendOnLink(edges.get(key), session.syncFrame([], key));
37959
+ } catch {}
37960
+ continue;
37961
+ }
37689
37962
  if (!last) {
37690
37963
  if (now - (entry.noticed ?? now) >= 1e4) fresh.set(key, mark);
37691
37964
  continue;
@@ -37706,7 +37979,8 @@ var Groups = class {
37706
37979
  via,
37707
37980
  at: now,
37708
37981
  asked: session.missOf(key)
37709
- }
37982
+ },
37983
+ own: tried.get(key)?.own
37710
37984
  });
37711
37985
  asked?.set(key, {
37712
37986
  via,
@@ -37771,7 +38045,7 @@ var Groups = class {
37771
38045
  at: now
37772
38046
  });
37773
38047
  const ask = [...away, ...this.gapsOf(groupId, session, via, lacking)];
37774
- if (!this.ownGap(groupId, via, lacking) && !ask.length) continue;
38048
+ if (!this.ownGap(groupId, session, via, lacking) && !ask.length) continue;
37775
38049
  try {
37776
38050
  this.host.sendOnLink(edges.get(via), session.syncFrame(ask, via));
37777
38051
  } catch {}
@@ -37914,6 +38188,7 @@ var Groups = class {
37914
38188
  ...row,
37915
38189
  at: this.now()
37916
38190
  }, placedAbove);
38191
+ if (stored === false && file && this.isRemoved(state.id, m.id)) await this.files?.forget(state.id, m.id);
37917
38192
  if (stored === false && !completed && this.isRemoved(state.id, m.id)) {
37918
38193
  this.typings.messageFrom(state.id, m.sender);
37919
38194
  return;
@@ -38682,7 +38957,8 @@ var GroupEdits = class {
38682
38957
  const chat = chatOf(groupId);
38683
38958
  const message = await this.find(chat, messageId);
38684
38959
  looked.missing = !message;
38685
- if (!message || !canEditInGroup(message) || underOldKey(message, membership)) return refuse("Only your own text messages can be edited");
38960
+ if (!message || !canEditInGroup(message)) return refuse("Only your own text messages can be edited");
38961
+ if (underOldKey(message, membership)) return refuse("This message is from before you were removed and invited back, and can't be edited now");
38686
38962
  const text = raw.trim();
38687
38963
  if (!text) return refuse("An edit cannot be empty. Delete the message instead.");
38688
38964
  if (isJoinNotice(text)) return refuse("An edit cannot read as a join notice.");
@@ -38732,7 +39008,8 @@ var GroupEdits = class {
38732
39008
  if (!membership) return refuse(this.notMember(groupId));
38733
39009
  const chat = chatOf(groupId);
38734
39010
  const message = typeof messageId === "string" ? await this.find(chat, messageId) : void 0;
38735
- if (!message || message.removed || message.sender !== "me" || !GROUP_MESSAGE_ID.test(message.id) || underOldKey(message, membership)) return refuse("Only your own messages can be deleted for everyone");
39011
+ if (!message || message.removed || message.sender !== "me" || !GROUP_MESSAGE_ID.test(message.id)) return refuse("Only your own messages can be deleted for everyone");
39012
+ if (underOldKey(message, membership)) return refuse("This message is from before you were removed and invited back, and can't be deleted for everyone now");
38736
39013
  if (!canRemove(message)) return refuse("A payment, a request or a notice cannot be deleted for everyone");
38737
39014
  const e = removalNumber(message.edit?.seq);
38738
39015
  await this.host.removeMine(chat, message, {
@@ -41039,6 +41316,61 @@ var TransportLog = class {
41039
41316
  return entry;
41040
41317
  }
41041
41318
  };
41319
+ // ../browser/src/engine/resumeTurns.ts
41320
+ /**
41321
+ * The chats live when this app last ran, back after a restart a few at a time (`RESUMES_AT_ONCE` in node.ts), the most
41322
+ * recently live first; the next starts as soon as one is done: live again, its contact found away, or its resume
41323
+ * window over (`RESUME_SPENT_MS`). Started all at once, every chat read its contact and offered or answered in the
41324
+ * same second, the relays' per-minute budget was spread over all of them, and few got through a whole offer/answer
41325
+ * round: a daemon whose 50 contacts were all online had 13 to 30 of them back after 3 to 4.5 min, most chats' resumes
41326
+ * spent before they finished. A chat someone wants now (opened, written to) starts at once, ahead of the line. A chat
41327
+ * waiting its turn has not started: it reads as offline until then, as a chat does before its link starts.
41328
+ */
41329
+ var ResumeTurns = class {
41330
+ atOnce;
41331
+ begin;
41332
+ /** The chats resuming now. */
41333
+ running = /* @__PURE__ */ new Set();
41334
+ /** The chats waiting for a turn, first in line first. */
41335
+ line = [];
41336
+ /** `begin`: starts the chat's link; false when it did not start (gone, started already, offline). */
41337
+ constructor(atOnce, begin) {
41338
+ this.atOnce = atOnce;
41339
+ this.begin = begin;
41340
+ }
41341
+ /** Starts the chat now if a turn is free, or puts it at the end of the line. */
41342
+ add(linkId) {
41343
+ if (this.running.has(linkId) || this.line.includes(linkId)) return;
41344
+ this.line.push(linkId);
41345
+ this.next();
41346
+ }
41347
+ /** The chat is done resuming (live, its contact away, its window over, gone): its turn goes to the next in line. */
41348
+ finished(linkId) {
41349
+ const at = this.line.indexOf(linkId);
41350
+ if (at >= 0) this.line.splice(at, 1);
41351
+ if (this.running.delete(linkId)) this.next();
41352
+ }
41353
+ /** Someone wants the chat now: if it waits in line, it starts at once, past the turns. */
41354
+ now(linkId) {
41355
+ const at = this.line.indexOf(linkId);
41356
+ if (at < 0) return;
41357
+ this.line.splice(at, 1);
41358
+ this.running.add(linkId);
41359
+ if (!this.begin(linkId)) this.running.delete(linkId);
41360
+ }
41361
+ /** Nothing waits any more (the network went off, the app stops): links started later queue anew. */
41362
+ clear() {
41363
+ this.running.clear();
41364
+ this.line.length = 0;
41365
+ }
41366
+ next() {
41367
+ while (this.running.size < this.atOnce && this.line.length) {
41368
+ const linkId = this.line.shift();
41369
+ this.running.add(linkId);
41370
+ if (!this.begin(linkId)) this.running.delete(linkId);
41371
+ }
41372
+ }
41373
+ };
41042
41374
  // ../browser/src/backup/database.ts
41043
41375
  /** Whether a database of this name exists; opening one that does not would create it. */
41044
41376
  async function databaseExists(name) {
@@ -45243,6 +45575,14 @@ var SPARE_INVITE_WARM_AFTER_TAKE_MS = 3e4;
45243
45575
  var STARTUP_QUIET_MS = 15e3;
45244
45576
  /** At start, how long links start in one task before the page gets the thread back (`startNow`). */
45245
45577
  var START_SLICE_MS = 10;
45578
+ /**
45579
+ * How many chats live when this app last ran resume at once (`ResumeTurns`): the relays' per-minute budget
45580
+ * (`REQUESTS_PER_MINUTE`) over the requests an offer/answer round costs a chat (a read, an offer or answer, a read for
45581
+ * the answer: 3). All 50 of a daemon's chats at once, none got through a round in the first minute; 10 at a time get
45582
+ * through it in seconds, and the line moves on. More at once can spend the minute again: 12 at a time had 7 of 50
45583
+ * back after 5 min in one run of two, against 40 at 10 (engine test, one relay).
45584
+ */
45585
+ var RESUMES_AT_ONCE = Math.floor(10);
45246
45586
  /** How long the wallets' changes gather into one view of them (`walletChanged`). */
45247
45587
  var WALLET_CHANGE_MS = 50;
45248
45588
  /** How often the shared services' request counts may send a state while contacts use them (`hostedService`). */
@@ -45456,6 +45796,8 @@ var GhostlyNode = class GhostlyNode {
45456
45796
  get nativeQueue() {
45457
45797
  return Promise.all(this.nativeQueues.values()).then(() => {});
45458
45798
  }
45799
+ /** Per chat, how many transport choices it was given (`setChatTransport`): one still settling knows a later one came. */
45800
+ transportChoices = /* @__PURE__ */ new Map();
45459
45801
  shuttingDown = false;
45460
45802
  /** Settles as `shutdown` begins: what is still starting is not waited for past it. */
45461
45803
  stopBegan;
@@ -47738,6 +48080,7 @@ var GhostlyNode = class GhostlyNode {
47738
48080
  if (this.activeSlotRetry) clearTimeout(this.activeSlotRetry);
47739
48081
  for (const timer of this.resumeTimers.values()) clearTimeout(timer);
47740
48082
  this.resumeTimers.clear();
48083
+ this.resumeLine?.clear();
47741
48084
  if (this.paymentTimer) clearTimeout(this.paymentTimer);
47742
48085
  clearTimeout(this.awaitingTimer);
47743
48086
  clearTimeout(this.walletChangeTimer);
@@ -47778,6 +48121,8 @@ var GhostlyNode = class GhostlyNode {
47778
48121
  this.groupEdits.stop();
47779
48122
  this.reactions.stop();
47780
48123
  this.cardEdits.stop();
48124
+ this.fileDesk.stop();
48125
+ this.groups.files?.stopSweeps();
47781
48126
  await Promise.allSettled([
47782
48127
  linksStopped,
47783
48128
  links?.stop(),
@@ -49077,12 +49422,14 @@ var GhostlyNode = class GhostlyNode {
49077
49422
  const filesEnded = this.fileDesk.drop(linkId);
49078
49423
  this.links.delete(linkId);
49079
49424
  this.removedChats.set(linkId, (this.removedChats.get(linkId) ?? 0) + 1);
49425
+ this.resumeLine?.finished(linkId);
49080
49426
  this.newestAt.delete(linkId);
49081
49427
  this.clockLeads.delete(linkId);
49082
49428
  this.placedAt.delete(linkId);
49083
49429
  this.reactionNotes.delete(linkId);
49084
49430
  this.reactionNotesBefore.delete(linkId);
49085
49431
  this.reactionNotesWhole.delete(linkId);
49432
+ this.chatSearch.forget(linkId);
49086
49433
  if (filesEnded) setTimeout(() => void live.link?.stop(true), FILES_END_MS);
49087
49434
  else live.link?.stop(true);
49088
49435
  live.caps?.stop();
@@ -49094,7 +49441,10 @@ var GhostlyNode = class GhostlyNode {
49094
49441
  this.wakeLimiter.reset(linkId);
49095
49442
  this.callWakeLimiter.reset(linkId);
49096
49443
  if (live.stored.wakeToken) this.rotateWake().then(() => this.emitState());
49097
- db.deleteLink(linkId).finally(() => this.appShelf?.forgetScope(linkId));
49444
+ db.deleteLink(linkId).finally(() => {
49445
+ this.chatSearch.forget(linkId);
49446
+ this.appShelf?.forgetScope(linkId);
49447
+ });
49098
49448
  this.desk.forgetLink(linkId);
49099
49449
  this.awaitingSoon();
49100
49450
  this.emitState();
@@ -49119,6 +49469,7 @@ var GhostlyNode = class GhostlyNode {
49119
49469
  const groupId = linkId?.startsWith("group:") ? linkId.slice(6) : void 0;
49120
49470
  const chat = groupId === void 0 ? linkId : null;
49121
49471
  if (groupId !== void 0) this.groupOnScreen(groupId);
49472
+ if (chat) this.resumeTurns.now(chat);
49122
49473
  if (chat) this.ensureNativeEndpoints(chat);
49123
49474
  if (chat && this.settings.nostr?.autoLoadProfiles) this.nostrSocial.ledgerChanged(chat).catch(() => {});
49124
49475
  if (chat) this.hold.wake(chat);
@@ -50521,6 +50872,7 @@ var GhostlyNode = class GhostlyNode {
50521
50872
  ...forwarded && { forwarded }
50522
50873
  };
50523
50874
  const wire = reply && pairedWireReply(reply);
50875
+ this.resumeTurns.now(linkId);
50524
50876
  const live = this.linksAdding.has(linkId) ? await this.linkWhenAdded(linkId) : this.links.get(linkId);
50525
50877
  const fail = (error) => {
50526
50878
  const transfer = {
@@ -51196,9 +51548,13 @@ var GhostlyNode = class GhostlyNode {
51196
51548
  * Iroh's relay or the HyperDHT out of reach, so `chat disconnect --hold 0` blocked that long.
51197
51549
  */
51198
51550
  async setDeliveryMode({ linkId, mode }) {
51199
- await this.switchDeliveryMode(linkId, mode, false);
51551
+ await this.switchDeliveryMode(linkId, mode);
51200
51552
  }
51201
- /** `setDeliveryMode`; `native`: back on a live link, wait for its native listeners too (a choice that names one). */
51553
+ /**
51554
+ * `setDeliveryMode`; `native`: back on a live link, wait for a native listener too: the one a choice names, or every
51555
+ * one (Automatic on an app with no WebRTC). Not every one for a named choice: HyperDHT chosen waited 10 s for Iroh's
51556
+ * listener with its relay out of reach, the chat live on the HyperDHT at 2 s.
51557
+ */
51202
51558
  async switchDeliveryMode(linkId, mode, native) {
51203
51559
  const live = this.links.get(linkId);
51204
51560
  if (!live?.stored.profile || !live.link || mode !== "stream" && mode !== "dht") throw new Error("Delivery method unavailable.");
@@ -51209,7 +51565,7 @@ var GhostlyNode = class GhostlyNode {
51209
51565
  };
51210
51566
  await live.link.setDeliveryMode(mode);
51211
51567
  if (mode === "stream") {
51212
- const listening = this.ensureNativeEndpoints(linkId);
51568
+ const listening = this.ensureNativeEndpoints(linkId, false, native === "all" ? void 0 : native);
51213
51569
  if (native) await listening;
51214
51570
  }
51215
51571
  this.observeTransport(linkId);
@@ -51258,9 +51614,15 @@ var GhostlyNode = class GhostlyNode {
51258
51614
  * (WISP 400: it travels as the DHT envelope's mode; either side choosing it keeps both off the live link). Choosing
51259
51615
  * anything else while on DHT only leaves it first. Fallback stays as it was. A live session moves over without
51260
51616
  * reconnecting; if the new transport fails, it stays where it was.
51617
+ *
51618
+ * The last choice wins: one still waiting for its listener when a later one comes stops there, the chat as the later
51619
+ * one left it (as that one is recorded, so it stays after a restart). It ended on the earlier one, with nothing
51620
+ * said, the later one already answered (Automatic 3 s after HyperDHT, Iroh's relay out of reach: bug hunt, 2026-11-17).
51261
51621
  */
51262
51622
  async setChatTransport({ linkId, transport }) {
51263
51623
  const live = this.links.get(linkId);
51624
+ const choice = (this.transportChoices.get(linkId) ?? 0) + 1;
51625
+ this.transportChoices.set(linkId, choice);
51264
51626
  if (transport === "dht") {
51265
51627
  await this.setDeliveryMode({
51266
51628
  linkId,
@@ -51270,13 +51632,17 @@ var GhostlyNode = class GhostlyNode {
51270
51632
  }
51271
51633
  if (live?.stored.deliveryMode === "dht") {
51272
51634
  const preferredTransport = transport === "auto" ? void 0 : transport;
51273
- const native = transport === "auto" ? !live.link?.availableTransports.includes("webrtc/1") : transport !== "webrtc/1";
51635
+ const native = transport === "auto" ? live.link?.availableTransports.includes("webrtc/1") ? void 0 : "all" : transport === "webrtc/1" ? void 0 : transport;
51274
51636
  live.stored = {
51275
51637
  ...live.stored,
51276
51638
  preferredTransport
51277
51639
  };
51278
51640
  await db.patchLink(linkId, { preferredTransport });
51279
51641
  await this.switchDeliveryMode(linkId, "stream", native);
51642
+ if (this.transportChoices.get(linkId) !== choice) {
51643
+ if (this.links.get(linkId)?.stored.deliveryMode === "dht") throw new Error("Transport unavailable");
51644
+ return;
51645
+ }
51280
51646
  }
51281
51647
  if (transport !== "auto") {
51282
51648
  await this.setTransportPreference({
@@ -51440,6 +51806,7 @@ var GhostlyNode = class GhostlyNode {
51440
51806
  this.emitState();
51441
51807
  }
51442
51808
  async connect({ linkId }) {
51809
+ this.resumeTurns.now(linkId);
51443
51810
  const link = this.links.get(linkId)?.link;
51444
51811
  if (!link) throw new Error("You are offline. Go online before reconnecting.");
51445
51812
  const live = this.links.get(linkId), native = this.ensureNativeEndpoints(linkId);
@@ -53738,6 +54105,7 @@ var GhostlyNode = class GhostlyNode {
53738
54105
  }
53739
54106
  if (wasOnline && !this.networkOn) {
53740
54107
  this.enrollment?.cancel("offline").catch(() => {});
54108
+ this.resumeLine?.clear();
53741
54109
  await Promise.allSettled([...this.links.values()].map(async (live) => {
53742
54110
  live.carried?.stop();
53743
54111
  await live.link?.stop(true);
@@ -54658,9 +55026,11 @@ var GhostlyNode = class GhostlyNode {
54658
55026
  * The chat by its id, once it has started if it is still being added: the app may send to it by that id (a message,
54659
55027
  * a file, a forward, a payment) right after a reload, and that send waits for the chat rather than say "You are
54660
55028
  * offline" for that moment. A chat not being added is returned at once, offline or not; one whose adding failed is gone.
55029
+ * One waiting for its turn to resume after a restart (`ResumeTurns`) starts now, ahead of the line.
54661
55030
  */
54662
55031
  async linkWhenAdded(linkId) {
54663
55032
  await this.linksAdding.get(linkId)?.catch(() => {});
55033
+ this.resumeTurns.now(linkId);
54664
55034
  return this.links.get(linkId);
54665
55035
  }
54666
55036
  addLink(params, inviteCode) {
@@ -55180,6 +55550,7 @@ var GhostlyNode = class GhostlyNode {
55180
55550
  * the next ones follow the setting. No goodbye: the contacts see the chat back in a moment.
55181
55551
  */
55182
55552
  async restartLinksForRelayOnly() {
55553
+ this.resumeLine?.clear();
55183
55554
  await Promise.allSettled([...this.links.values()].map(async (live) => {
55184
55555
  const link = live.link;
55185
55556
  live.carried?.stop();
@@ -55196,15 +55567,18 @@ var GhostlyNode = class GhostlyNode {
55196
55567
  * Starts these chats' and groups' links, the chats most recently live first (`nativeStartOrder`), in slices that let
55197
55568
  * the page go: each link derives its keys and seals its capability record as it starts, and 50 chats and 20 groups in
55198
55569
  * one task held the page for 575-762 ms at 4x CPU, right as the chat list appeared. A chat not started yet reads as
55199
- * offline until its turn. `started`: after each link started. Gone offline or shut down meanwhile: the links left
55200
- * start with the network, if ever.
55570
+ * offline until its turn. The chats live when this app last ran resume a few at a time, in that order
55571
+ * (`ResumeTurns`). `started`: after each link started or took its place in that line. Gone offline or shut down
55572
+ * meanwhile: the links left start with the network, if ever.
55201
55573
  */
55202
55574
  async startLinks(linkIds, started) {
55203
55575
  const pause = pacer(START_SLICE_MS);
55204
55576
  for (const linkId of this.nativeStartOrder(linkIds)) {
55205
55577
  if (!this.networkOn || this.shuttingDown) break;
55206
- if (!this.links.has(linkId)) continue;
55207
- this.startLink(linkId);
55578
+ const live = this.links.get(linkId);
55579
+ if (!live) continue;
55580
+ if (!live.link && !this.deferredChats.has(linkId) && this.resumesAtStart(live).resume) this.resumeTurns.add(linkId);
55581
+ else this.startLink(linkId);
55208
55582
  started?.(linkId);
55209
55583
  await pause();
55210
55584
  }
@@ -55244,7 +55618,7 @@ var GhostlyNode = class GhostlyNode {
55244
55618
  verifiedPeerKey: stored.peerTrust ? stored.peerTrust.verifiedKey : stored.pairedPeerKey,
55245
55619
  expectedPeerKey: stored.peerParticipationKeyZ32
55246
55620
  } : void 0;
55247
- const resumed = stored.pairedPeerKey && stored.deliveryMode !== "dht" ? resumeHere(this.transportLogOf(live), this.transportsHere(), stored.peerTransports ?? live.caps?.peer?.transports) : {};
55621
+ const resumed = this.resumesAtStart(live);
55248
55622
  let dhtShown;
55249
55623
  let dhtFlushed;
55250
55624
  let wasTaken = false;
@@ -55479,6 +55853,7 @@ var GhostlyNode = class GhostlyNode {
55479
55853
  interval: nextInMs || live.poll.interval
55480
55854
  };
55481
55855
  if (was && !polling) live.firstReadDone = true;
55856
+ if (was && !polling && !live.presence.online && this.transport.readAnsweredAt?.(stored.peerPubKeyZ32) !== void 0) this.resumeTurns.finished(linkId);
55482
55857
  if (linkId === this.activeLinkId || first && polling !== was) this.chatChanged(linkId);
55483
55858
  },
55484
55859
  onMessageReceipt: async (id) => {
@@ -55523,6 +55898,7 @@ var GhostlyNode = class GhostlyNode {
55523
55898
  live.dataLink = state;
55524
55899
  if (state === "open") {
55525
55900
  live.pairedAt = void 0;
55901
+ this.resumeTurns.finished(linkId);
55526
55902
  this.wakeLimiter.reset(linkId);
55527
55903
  this.desk.replay(linkId).catch(() => {}).then(() => this.sendWaiting(linkId)).catch(() => {});
55528
55904
  this.identities.ready(linkId);
@@ -56101,8 +56477,11 @@ var GhostlyNode = class GhostlyNode {
56101
56477
  this.ensureNativeEndpoints(live.stored.id);
56102
56478
  }
56103
56479
  }
56104
- /** `inUse`: a text is going or coming in the chat now, which counts as the chat on screen does for taking a listener. */
56105
- ensureNativeEndpoints(linkId, inUse = false) {
56480
+ /**
56481
+ * `inUse`: a text is going or coming in the chat now, which counts as the chat on screen does for taking a listener.
56482
+ * `only`: what it answers on is that transport's start alone (each still starts); otherwise every one's.
56483
+ */
56484
+ ensureNativeEndpoints(linkId, inUse = false, only) {
56106
56485
  const expected = this.links.get(linkId)?.link;
56107
56486
  const starts = Object.entries(this.nativeFactories).map(([transport, factory]) => {
56108
56487
  const key = transport;
@@ -56110,7 +56489,8 @@ var GhostlyNode = class GhostlyNode {
56110
56489
  this.nativeQueues.set(key, Promise.all([this.nativeQueues.get(key), operation.then(() => {}, () => {})]).then(() => {}));
56111
56490
  return operation;
56112
56491
  });
56113
- return Promise.all(starts).then((full) => {
56492
+ const named = only ? Object.keys(this.nativeFactories).indexOf(only) : -1;
56493
+ const all = Promise.all(starts).then((full) => {
56114
56494
  const live = this.links.get(linkId), link = live?.link;
56115
56495
  if (this.shuttingDown || !live || !link || link !== expected) return;
56116
56496
  const group = !!live.stored.group;
@@ -56127,6 +56507,9 @@ var GhostlyNode = class GhostlyNode {
56127
56507
  } else this.nativeFailed.delete(linkId);
56128
56508
  this.emitState();
56129
56509
  });
56510
+ if (named < 0) return all;
56511
+ all.catch(() => {});
56512
+ return starts[named].then(() => {});
56130
56513
  }
56131
56514
  /**
56132
56515
  * A start's turn in its transport's queue: one at a time, in the order asked, but the chat in use (on screen, a text
@@ -56381,13 +56764,31 @@ var GhostlyNode = class GhostlyNode {
56381
56764
  if (before) clearTimeout(before);
56382
56765
  this.resumeTimers.set(linkId, setTimeout(() => {
56383
56766
  this.resumeTimers.delete(linkId);
56384
- const live = this.links.get(linkId), log = live && this.transportLogOf(live);
56385
- if (this.shuttingDown || !live || !log || live.link !== link) return;
56767
+ const live = this.links.get(linkId);
56768
+ if (!live || live.link !== link) return;
56769
+ this.resumeTurns.finished(linkId);
56770
+ const log = this.transportLogOf(live);
56771
+ if (this.shuttingDown || !log) return;
56386
56772
  if (!log.notBackAfterRestart(Date.now())) return;
56387
56773
  traceLink(live.myPubKeyZ32, "resume-spent", {});
56388
56774
  this.saveTransportLog(live, log);
56389
56775
  }, RESUME_SPENT_MS));
56390
56776
  }
56777
+ /** The chats back after a restart, resuming a few at a time (`RESUMES_AT_ONCE`). */
56778
+ resumeLine;
56779
+ get resumeTurns() {
56780
+ return this.resumeLine ??= new ResumeTurns(this.options.resumesAtOnce ?? RESUMES_AT_ONCE, (linkId) => {
56781
+ const live = this.links.get(linkId);
56782
+ if (!live || live.link || !this.networkOn || this.shuttingDown) return false;
56783
+ this.startLink(linkId);
56784
+ return !!live.link;
56785
+ });
56786
+ }
56787
+ /** A chat that resumes when it starts: it was live when this app last ran (`resumeHere`). */
56788
+ resumesAtStart(live) {
56789
+ const { stored } = live;
56790
+ return stored.pairedPeerKey && stored.deliveryMode !== "dht" && !stored.group ? resumeHere(this.transportLogOf(live), this.transportsHere(), stored.peerTransports ?? live.caps?.peer?.transports) : {};
56791
+ }
56391
56792
  /** The chat on screen found every native slot busy: it tries again in a moment, while it stays on screen. */
56392
56793
  activeSlotRetry = null;
56393
56794
  retryActiveSlot(linkId) {
@@ -57001,6 +57402,19 @@ var EngineServer = class {
57001
57402
  */
57002
57403
  unheardAttention;
57003
57404
  /**
57405
+ * A contact's call that rings while no client is attached (`signal`, its offer), and the end of one told so (`null`:
57406
+ * the contact hung up, or a page that opened since answered or declined it): the host tells the person itself, as it
57407
+ * does a message (`unheardAttention`). A ring nobody answers sends nothing more: the host ends it after the app's ring.
57408
+ */
57409
+ unheardCall;
57410
+ /** The chats whose ringing call the host was told of (`unheardCall`) and not yet of its end, and when it began to ring. */
57411
+ unheardRings = /* @__PURE__ */ new Map();
57412
+ /**
57413
+ * Per chat, when the contact's last call told to the host was missed after it barely rang, or held back since
57414
+ * (`QUICK_REDIAL_MS`, on the monotonic clock): the next one that comes this soon is not told, as a page does not ring it.
57415
+ */
57416
+ unheardMissedAt = /* @__PURE__ */ new Map();
57417
+ /**
57004
57418
  * `keepNewest`: the start keeps each chat's and group's newest rows that many, from the whole histories it reads anyway,
57005
57419
  * for `takeStartNewest` (the CLI's event check at start, which read them again).
57006
57420
  */
@@ -57024,13 +57438,16 @@ var EngineServer = class {
57024
57438
  this.inOrder(linkId, () => this.sendChanges(linkId, changes)).catch(() => {});
57025
57439
  },
57026
57440
  onCallSignal: (linkId, signal) => {
57027
- if (signalKind(signal) === "o") this.offers.set(linkId, signal);
57441
+ const kind = signalKind(signal);
57442
+ if (kind === "o") this.offers.set(linkId, signal);
57028
57443
  else this.offers.delete(linkId);
57029
57444
  this.broadcast({
57030
57445
  kind: "call-signal",
57031
57446
  linkId,
57032
57447
  signal
57033
57448
  });
57449
+ if (kind === "o" && !this.clients.size && parseCallSignal(signal)?.t === "o") this.ringUnheard(linkId, signal);
57450
+ else if (kind === "h") this.unheardRingEnded(linkId, true);
57034
57451
  },
57035
57452
  onAppFrame: (linkId, event) => this.broadcast({
57036
57453
  kind: "app-frame",
@@ -57336,11 +57753,39 @@ var EngineServer = class {
57336
57753
  if (typeof linkId !== "string" || !this.offers.delete(linkId)) return;
57337
57754
  const kind = typeof signal === "string" ? signalKind(signal) : void 0;
57338
57755
  if (kind !== "a" && kind !== "h") return;
57756
+ this.unheardRingEnded(linkId);
57339
57757
  for (const client of [...this.clients]) if (client !== from) this.post(client, {
57340
57758
  kind: "call-handled",
57341
57759
  linkId
57342
57760
  });
57343
57761
  }
57762
+ /**
57763
+ * The contact's offer with no page to ring it: the host is told, unless it came right after a call that barely rang
57764
+ * (`QUICK_REDIAL_MS`), which a bot looping call and hang-up places and a page keeps as missed with no ring or
57765
+ * notification (useWebRTC). Held back, it starts the wait over, so a burst rings once.
57766
+ */
57767
+ ringUnheard(linkId, signal) {
57768
+ const now = performance.now(), missedAt = this.unheardMissedAt.get(linkId);
57769
+ if (!this.unheardRings.has(linkId) && missedAt !== void 0 && now - missedAt >= 0 && now - missedAt < 2e3) {
57770
+ this.unheardMissedAt.set(linkId, now);
57771
+ return;
57772
+ }
57773
+ this.unheardRings.set(linkId, now);
57774
+ this.unheardCall?.(linkId, signal);
57775
+ }
57776
+ /**
57777
+ * A ring the host was told of (`unheardCall`) is over: it is told so, once. `byContact`: the contact hung up, which
57778
+ * holds their next call back when it barely rang (`BURST_RING_MS`), and nothing when it rang a while.
57779
+ */
57780
+ unheardRingEnded(linkId, byContact = false) {
57781
+ const since = this.unheardRings.get(linkId);
57782
+ if (since === void 0) return;
57783
+ this.unheardRings.delete(linkId);
57784
+ const now = performance.now();
57785
+ if (byContact && now - since < 1e3) this.unheardMissedAt.set(linkId, now);
57786
+ else this.unheardMissedAt.delete(linkId);
57787
+ this.unheardCall?.(linkId, null);
57788
+ }
57344
57789
  };
57345
57790
  /** Whether a call only reads a group's stored history (`GhostlyNode.groupsRead`). */
57346
57791
  function readsGroupHistory(request) {
@@ -57358,4 +57803,4 @@ function signalKind(signal) {
57358
57803
  }
57359
57804
  export { EngineServer, credentials as n, bitcoindRpc as t };
57360
57805
 
57361
- //# sourceMappingURL=server-Bd2ofxc1.js.map
57806
+ //# sourceMappingURL=server-WWlXICVB.js.map