@ghostlytools/cli 1.10.2 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +4 -2
  2. package/dist/assets/{api-DcE4KylM.js → api-BdaxsDvA.js} +2 -2
  3. package/dist/assets/{api-EUGHGnRz.js → api-C4MLg5Rs.js} +42 -17
  4. package/dist/assets/api-C4MLg5Rs.js.map +1 -0
  5. package/dist/assets/{apiKit-CJVp_crp.js → apiKit-BbNaxZGZ.js} +27 -11
  6. package/dist/assets/apiKit-BbNaxZGZ.js.map +1 -0
  7. package/dist/assets/{apps-C54T_MOT.js → apps-BluQgEhv.js} +3 -3
  8. package/dist/assets/{apps-C54T_MOT.js.map → apps-BluQgEhv.js.map} +1 -1
  9. package/dist/assets/{apps-C-KbyLCa.js → apps-BtGFth7o.js} +1 -1
  10. package/dist/assets/{arkade-BmxJTa65.js → arkade-DdZx4b_I.js} +2 -2
  11. package/dist/assets/{arkade-BmxJTa65.js.map → arkade-DdZx4b_I.js.map} +1 -1
  12. package/dist/assets/{backup-BxSH5BZG.js → backup-DyDsW7sC.js} +6 -6
  13. package/dist/assets/{backup-BxSH5BZG.js.map → backup-DyDsW7sC.js.map} +1 -1
  14. package/dist/assets/{backup-C0Plp-DF.js → backup-I1n7ccz7.js} +1 -1
  15. package/dist/assets/{buttons-B-ZJYdo0.js → buttons-Do7dCku6.js} +4 -4
  16. package/dist/assets/{buttons-B-ZJYdo0.js.map → buttons-Do7dCku6.js.map} +1 -1
  17. package/dist/assets/buttons-DpjwXePb.js +2 -0
  18. package/dist/assets/{client-CDa87uYD.js → client-CWsjRiH8.js} +2 -2
  19. package/dist/assets/{client-CDa87uYD.js.map → client-CWsjRiH8.js.map} +1 -1
  20. package/dist/assets/{codec-D45W1L8n.js → codec-DPaXhuYc.js} +2 -2
  21. package/dist/assets/{codec-D45W1L8n.js.map → codec-DPaXhuYc.js.map} +1 -1
  22. package/dist/assets/{envelope-C3yFCQa-.js → envelope-5Gu9yGk_.js} +2 -2
  23. package/dist/assets/{envelope-C3yFCQa-.js.map → envelope-5Gu9yGk_.js.map} +1 -1
  24. package/dist/assets/{fixedHosts-C6nCHjOa.js → fixedHosts-PR1BcfKX.js} +7 -8
  25. package/dist/assets/fixedHosts-PR1BcfKX.js.map +1 -0
  26. package/dist/assets/{groupFiles-DYopNE57.js → groupFiles-BuToTMUk.js} +213 -90
  27. package/dist/assets/groupFiles-BuToTMUk.js.map +1 -0
  28. package/dist/assets/{host-G5seUwaI.js → host-fkQYBvKH.js} +226 -29
  29. package/dist/assets/host-fkQYBvKH.js.map +1 -0
  30. package/dist/assets/{hyperdhtRelay-B_uHjg_r.js → hyperdhtRelay-DDCak5PY.js} +2 -2
  31. package/dist/assets/{hyperdhtRelay-B_uHjg_r.js.map → hyperdhtRelay-DDCak5PY.js.map} +1 -1
  32. package/dist/assets/{irohWeb-C-2oslSU.js → irohWeb-B4_swKx0.js} +2 -2
  33. package/dist/assets/{irohWeb-C-2oslSU.js.map → irohWeb-B4_swKx0.js.map} +1 -1
  34. package/dist/assets/{main-Dk--nD7X.js → main-ClYsttvY.js} +49 -30
  35. package/dist/assets/main-ClYsttvY.js.map +1 -0
  36. package/dist/assets/{mainline-HPlVrl8R.js → mainline-Hsk2SZ1B.js} +63 -3
  37. package/dist/assets/mainline-Hsk2SZ1B.js.map +1 -0
  38. package/dist/assets/{networkReason-CfpO9ayz.js → networkReason-C9Hr-hO7.js} +4 -4
  39. package/dist/assets/{networkReason-CfpO9ayz.js.map → networkReason-C9Hr-hO7.js.map} +1 -1
  40. package/dist/assets/{nwc-BY7BPttn.js → nwc-BbK6qNxS.js} +3 -3
  41. package/dist/assets/{nwc-BY7BPttn.js.map → nwc-BbK6qNxS.js.map} +1 -1
  42. package/dist/assets/{nwcProvider-CfpbNUf7.js → nwcProvider-D_tt2X3Z.js} +2 -2
  43. package/dist/assets/{nwcProvider-CfpbNUf7.js.map → nwcProvider-D_tt2X3Z.js.map} +1 -1
  44. package/dist/assets/{ownDid-DJFZM2cV.js → ownDid-DkK_jem4.js} +2 -2
  45. package/dist/assets/{ownDid-DJFZM2cV.js.map → ownDid-DkK_jem4.js.map} +1 -1
  46. package/dist/assets/{profiles-DKmZGXp6.js → profiles-aV9vaK0B.js} +7 -5
  47. package/dist/assets/profiles-aV9vaK0B.js.map +1 -0
  48. package/dist/assets/{registry-CAzrtV0_.js → registry-C9T6tYCO.js} +1 -1
  49. package/dist/assets/{registry-BUm4cAzV.js → registry-CEjnubep.js} +8 -7
  50. package/dist/assets/registry-CEjnubep.js.map +1 -0
  51. package/dist/assets/{resolve-CDD4X68j.js → resolve-BBOrN13E.js} +24 -5
  52. package/dist/assets/resolve-BBOrN13E.js.map +1 -0
  53. package/dist/assets/{server-DcOsgYDU.js → server-BJ3T-kx3.js} +247 -107
  54. package/dist/assets/server-BJ3T-kx3.js.map +1 -0
  55. package/dist/assets/{src-D31D1_oY.js → src-BIdfHB7t.js} +254 -71
  56. package/dist/assets/src-BIdfHB7t.js.map +1 -0
  57. package/dist/assets/{sshForges-DerRwMf3.js → sshForges-CRg-NGld.js} +2 -2
  58. package/dist/assets/{sshForges-DerRwMf3.js.map → sshForges-CRg-NGld.js.map} +1 -1
  59. package/dist/assets/{translate-C-sj0VJe.js → translate-b0X61WMI.js} +2 -2
  60. package/dist/assets/{translate-C-sj0VJe.js.map → translate-b0X61WMI.js.map} +1 -1
  61. package/dist/assets/{usdt-DwHqp625.js → usdt-6CQdfye1.js} +7 -4
  62. package/dist/assets/usdt-6CQdfye1.js.map +1 -0
  63. package/dist/assets/{waitNotice-D52RWbV4.js → waitNotice-Ce3YCinu.js} +27 -5
  64. package/dist/assets/waitNotice-Ce3YCinu.js.map +1 -0
  65. package/dist/assets/{words-Db9WgatT.js → words-Dk6o6wz4.js} +3 -3
  66. package/dist/assets/words-Dk6o6wz4.js.map +1 -0
  67. package/dist/ghostly.mjs +1 -1
  68. package/package.json +1 -1
  69. package/dist/assets/api-EUGHGnRz.js.map +0 -1
  70. package/dist/assets/apiKit-CJVp_crp.js.map +0 -1
  71. package/dist/assets/buttons-DA3wZfG0.js +0 -2
  72. package/dist/assets/fixedHosts-C6nCHjOa.js.map +0 -1
  73. package/dist/assets/groupFiles-DYopNE57.js.map +0 -1
  74. package/dist/assets/host-G5seUwaI.js.map +0 -1
  75. package/dist/assets/main-Dk--nD7X.js.map +0 -1
  76. package/dist/assets/mainline-HPlVrl8R.js.map +0 -1
  77. package/dist/assets/profiles-DKmZGXp6.js.map +0 -1
  78. package/dist/assets/registry-BUm4cAzV.js.map +0 -1
  79. package/dist/assets/resolve-CDD4X68j.js.map +0 -1
  80. package/dist/assets/server-DcOsgYDU.js.map +0 -1
  81. package/dist/assets/src-D31D1_oY.js.map +0 -1
  82. package/dist/assets/usdt-DwHqp625.js.map +0 -1
  83. package/dist/assets/waitNotice-D52RWbV4.js.map +0 -1
  84. package/dist/assets/words-Db9WgatT.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { n as traceJoin } from "./joinTrace-CjRDFy85.js";
2
- import { $a as reactionEmoji, $c as requestRecords, $i as HoldKeys, $l as deviceLinkPairing, $n as engineError, $o as presenceSeenAt, $r as PIN_LIMITS, $s as handoffVersions, $t as ONCHAIN_PROVIDER, A as knockIdentity, Ac as verifyEnrollProof, An as ENDPOINT, Ao as shownTime, Ar as lobbyKeys, As as HANDOFF_PIECE_BYTES, Ba as RateWindow, Bc as REQUEST_LIFETIME_MS, Bl as OwnInviteError, Bn as NO_PICTURE_METADATA, Bo as edgeParams, Br as shouldBeHub, Bs as handoffCancelFrame, C as communityHasFrame, Ca as formatFileSize, Cc as enrollDigits, Ci as UPGRADE_CAPABILITY, Cl as readAppRevocation, Co as sameButtonText, Cr as pickMeshHubs, Cs as HANDOFF_ACK, D as decodeGroupEntryLink, Dc as enrollProofFrame, Di as dialDescriptors, Do as claimedTime, Dr as doorHubs, Ds as HANDOFF_HELLO, Du as currentRelays, Ec as enrollHelloFrame, Ei as capsDescriptors, Eo as arrivalKey, Er as beaconRecords, Es as HANDOFF_HAVE, F as GroupWakeLimiter, Fa as parseVideoMeta, Fc as planKnocks, Fl as encodeContactLink, Fn as parseCashuRequestPayload, Fo as commitHash, Fr as pickHubs, Fs as filePartName, Fu as PacketTooLargeError, Ga as forwardedAgain, Gc as knockSlotOf, Gi as TRANSPORTS, Gl as inviteOwnership, Gn as GhostLink, Go as DirectPathWatch, Gr as transferEnded, Gs as handoffEphemeral, Gt as didDhtDocument, Gu as verify, H as GroupSession, Hc as contactAskerHolds, Hi as PeerProofs, Hl as decodeInviteCode, Hn as isStrippedPicture, Ho as RatchetBox, Hr as FILE_LIMITS, Hs as handoffContextProof, Hu as identityFromSeed, I as groupWakeFrame, Ia as EDIT_BUFFER_MS, Ic as settleRequest, Il as readContactLink, In as parseFedimintRequestPayload, Io as parseGroupCommit, Ir as rankHubs, Is as handoffAttemptAllowed, J as meshMessageRef, Ja as GROUP_REACTION_FRAME, Jc as makeStampPaced, Jl as ENROLL_CAPABILITY, Jn as PAIRED_FRAME_TOO_LARGE, Jo as DHT_POLL_INTERVALS, Js as handoffOfferFrame, Jt as encodeDidDhtPacket, Ju as hasVisible, K as GROUP_EDIT_TEXT_BYTES, Ka as readForwarded, Kc as knockSlotRecords, Ki as automaticTransport, Kn as INVITE_TAKEN, Kr as transferStalled, Ks as handoffHelloFrame, Kt as didDhtFromPublicKey, L as groupWakes, La as EDIT_RATE_WINDOW_MS, Lc as takeRequest, Ll as createDeviceInvite, Lo as rosterAdmin, Lr as readBeacon, Ls as handoffAttemptFailed, Lu as createRelayPayload, M as mergeKnocks, Ma as parseVoiceMeta, Mc as endedRequests, Mn as fedimintRequestPayload, Mo as GROUP_MEMBER_CAP, Mr as mergeBeacon, Ms as HANDOFF_TIMINGS, Mu as budgetRetryMs, N as readKnocks, Nc as inboxRecord, Nl as readCanonicalJson, Nn as findEndpoint, Nr as mergeLobby, Ns as HANDOFF_VERIFIED, Nu as isDiscoveryBudgetError, O as encodeGroupEntryLink, Oc as readEnrollGrant, Oo as heardTime, Or as freshHubs, Os as HANDOFF_OFFER, Ou as normalizeRelayUrl, Pc as newInbox, Pi as emptyIdentityLedger, Pl as createContactLink, Pn as isFederationId, Po as MEMBER_KEY, Pr as newerHead, Ps as NO_ATTEMPTS, Pu as withRequestOptions, Qa as queueReaction, Qc as readLinkRecord, Qi as HOLD_LIMITS, Ql as deviceKeyZ32, Qn as EngineError, Qo as WATCH_PEER_MS, Qs as handoffStreamKey, Qt as EVM_TEST_CHAINS, Qu as fromBase64Url, R as parseGroupWakeFrame, Ra as MAX_REMOVAL_NUMBER, Rc as turnOff, Rl as deviceInviteJoinerParams, Rn as videoMetadataPatches, Ro as rosterHas, Rr as readBeaconHead, Rs as handoffAttemptSucceeded, S as GROUP_READ_NOTE_COMMUNITY, Sa as dhtFileId, Sc as enrollCancelReason, Si as STATUS_CARD_CAPABILITY, Sl as isAppRef, So as checkStatusCard, Sr as meshHubs, Ss as serviceIdFromName, T as encodeCommunityLink, Ta as sanitizeMime, Tc as enrollGrantFrame, Ti as DHT_TEXT_CAPABILITY, To as statusCardText, Tr as beaconKeys, Ts as HANDOFF_DONE, U as frameBytes, Uc as contactDay, Ui as emptyProofLedger, Ul as encodeInviteCode, Un as stripPictureMetadata, Uo as emptyRatchetState, Us as handoffDataFrame, Uu as identityFromSeedB64, V as GROUP_READ_NOTE, Va as dhtEditId, Vc as contactAskerFrame, Vi as lastSharedWithMe, Vl as createChatInvite, Vn as PICTURE_METADATA_LIMITS, Vo as RATCHET_CAPABILITY, Vr as ChatFiles, Vs as handoffContext, Vu as createIdentity, Wa as parseLinkPreview, Wc as knockSlotIdentity, Wi as validExternalKey, Wl as inviteLink, Wo as ratchetSessionOf, Wr as sentWhole, Ws as handoffDigest, Wu as publicKeyFromZ32, X as mentionsMember, Xa as ReactionWindow, Xc as openRequest, Xi as HOLD_CAPABILITY, Xl as deviceEchoFrame, Xn as pairedMessageFits, Xo as PRESENCE_WINDOW, Xs as handoffReleaseFrame, Xt as signDidDhtPacket, Xu as stripHidden, Y as parseCommunityEdit, Ya as REACTION_LIMITS, Yc as mergeContactKnocks, Yl as HANDOFF_CAPABILITY, Yn as pairedEditFits, Yr as TypingSender, Ys as handoffPakeFrame, Yu as sanitizeDisplayText, Z as groupName, Za as nextReactionNumber, Zc as readKnockSlot, Zi as HOLD_DATED_BACK_MS, Zl as deviceEchoNonce, Zn as pairedMessageFrame, Zo as RELAY_POLL_INTERVALS, Zr as typingActivity, Zs as handoffRetryAfter, Zt as ETHEREUM_USDT, Zu as bytesEqual, _ as groupTypingEpoch, _i as chatAppId, _l as appRef, _s as parseCallSignal, _t as isAtprotoDid, _u as turnKeys, a as appRevocationFor, ac as readHandoffHello, ai as WAKE_CALL_INTERVAL_MS, al as appDigest, an as WALLET_NETWORKS, ao as readReply, as as decodeControl, au as TURN_RAISE_READ_TIMEOUT_MS, b as COMMUNITY_LIMITS, ba as peekDhtMailbox, bi as BUTTONS_CAPABILITY, bl as isAppHash, br as MESH_HUBS, bs as HTTP_SERVICE_PROTO, bu as turnVerifierMark, c as checkAppBeforeRun, cc as readHandoffVerified, ci as newWakeToken, cn as assertWholeSats, cu as turnPutSummary, di as wakeRequest, dn as walletNetworkOf, du as firstDeviceSetSecret, ea as HoldRefusedError, ec as newHandoffId, ed as randomBytes, ei as mayPin, el as seenEntry, en as PaymentPreflightError, eo as reactionIsNewer, er as engineText, es as GhostlyHttpError, eu as devicePingFrame, fc as readSetUpdate, fi as checkPushEndpoint, fl as readAppBundleAsync, fn as SPARK_NETWORKS, fu as nextTurnPosition, g as GroupTypingBoard, gc as verifySetUpdate, gl as appFingerprint, gn as isBitcoinAddress, gu as turnInstance, hc as signTombstone, hi as isServeId, hl as APP_STATEMENT_LIMITS, hn as sparkInvoiceDetails, ho as STATUS_CARD_LIMITS, hs as contactRtcConfig, hu as signTurnRelease, i as addedAppPermissions, ic as readHandoffHave, id as utf8Encode, ii as readPin, in as USDT_PUBLIC_RPC, io as pairedReplyAuthor, is as LIMITS, j as knockRecords, ja as fileMessageText, jc as clearMissed, jl as canonicalJson, jn as cashuRequestPayload, jo as GROUP_ADMIN_OFF_ERROR, jr as lobbyRecords, js as HANDOFF_REQUEST, ju as traceLink, k as entryParams, kc as readEnrollHello, kl as parseImageMeta, kn as decodeBolt11, ko as receivedTimestamp, kr as hubRank, ks as HANDOFF_PAKE, l as planAppUpdate, lc as sealHandoffPiece, li as parseWakeFrame, ll as isAppUrl, ln as formatPaymentAmount, lr as readGroupFileMeta, lu as TURN_LAST_SEQUENCE, mc as setUpdateFrame, mi as APP_RANGE_LIMITS, mn as sparkAddressKind, mu as signTurnPacket, n as readX401SdJwtVc, na as newMailbox, nc as readHandoffCancel, nd as toZ32, ni as pinIsNewer, nl as APP_BUNDLE_MAGIC, no as validReactionNumber, nr as GROUP_FILE_LIMITS, ns as parseLocalTarget, nu as seedSigner, o as appStoreDecision, oc as readHandoffPake, oi as WakeLimiter, ol as appViewOf, on as arkAddressPrefix, oo as replySnippet, os as encodeControl, ou as TURN_SETTLE_MS, p as readAppStoreSteps, pc as setAckFrame, pi as vapidKeysMatch, pl as sha256Paced, pn as SPARK_PROVIDER, pr as CarriedTransport, pu as readTurnPacket, q as carryMentions, qa as COMMUNITY_REACTION_FRAME, qc as linkRecords, ql as DEVICES_CAPABILITY, qn as LIVENESS_PING_MS, qs as handoffManifestFrames, qt as encodeDidDhtDeactivated, qu as sanitizeAvatar, r as sameX401HolderJwk, ra as readManifest, rc as readHandoffDone, rd as utf8Decode, ri as pinNumberHolds, rn as TEST_USDT_FAUCET_AMOUNT, ro as wireReaction, rr as GROUP_HAVE_FRAME, rs as webLocalFetch, ru as webCryptoSigner, s as appUpdateDecision, sc as readHandoffTurnFrame, si as deviceWakeRequest, sn as assertTokenUnits, so as BUTTON_ID, sr as groupFileFallback, su as classifyTurnRead, t as newX401HolderKey, ta as isHoldUrl, tc as readHandoffAck, td as toBase64Url, ti as nextPinNumber, tl as APP_BUNDLE_LIMITS, tn as SEPOLIA_TEST_USDT, to as readReaction, tr as parseEngineError, ts as formatLocalTarget, tu as newDeviceSetSecret, u as APP_STORE_LIMITS, ui as relayRequest, ul as pacer, un as validatePaymentTarget, us as RTC_CONFIG, uu as TURN_MAX, v as openGroupTyping, vi as isAppVersion, vl as appRefPublisher, vn as isPubkyKey, vr as groupSignalFrame, vt as normalizeAtprotoHandle, vu as turnName, w as decodeCommunityLink, wa as sanitizeFileName, wc as enrollDoneFrame, wi as CapsExchange, wl as readAppRevocationShape, wr as COMMUNITY_TOPOLOGY, ws as HANDOFF_CANCEL, wu as RelayTransport, x as CommunitySession, xa as DHT_FILE_CAPABILITY, xc as enrollCancelFrame, xi as EDIT_CAPABILITY, xl as isAppKey, xr as mayBeHub, xs as LEGACY_SERVICES, xu as DEFAULT_RELAYS, y as sealGroupTyping, ya as DHT_MESSAGE_TTL, yi as APPS_CAPABILITY, yr as readGroupSignal, ys as emptyLinkRecords, yu as turnStatedVerifier, z as GROUP_LIMITS, za as REMOVED_TEXT, zc as ContactRequestError, zi as receivedIdentityStatus, zl as readDeviceInvite, zn as withoutVideoMetadata, zo as verifyCommitSignature, zr as readLobby, zs as handoffBusyFrame } from "./src-D31D1_oY.js";
2
+ import { $a as ReactionWindow, $c as openRequest, $i as HOLD_DATED_BACK_MS, $l as deviceEchoFrame, $n as engineError, $o as PRESENCE_WINDOW, $r as PIN_LIMITS, $s as handoffReleaseFrame, $t as ONCHAIN_PROVIDER, $u as sanitizeDisplayText, A as knockIdentity, Ac as enrollProofFrame, An as ENDPOINT, Ao as claimedTime, Ar as lobbyKeys, As as HANDOFF_HELLO, Au as currentRelays, Ba as EDIT_RATE_WINDOW_MS, Bc as takeRequest, Bl as createDeviceInvite, Bn as NO_PICTURE_METADATA, Bo as rosterAdmin, Br as shouldBeHub, Bs as handoffAttemptFailed, C as communityHasFrame, Ca as peekDhtMailbox, Ci as UPGRADE_CAPABILITY, Cl as isAppHash, Cr as pickMeshHubs, Cs as HTTP_SERVICE_PROTO, Cu as turnVerifierMark, D as decodeGroupEntryLink, Da as sanitizeFileName, Dc as enrollDoneFrame, Di as dialDescriptors, Dl as readAppRevocationShape, Dr as doorHubs, Ds as HANDOFF_CANCEL, Du as RelayTransport, Ea as formatFileSize, Ec as enrollDigits, Ei as capsDescriptors, El as readAppRevocation, Eo as sameButtonText, Er as beaconRecords, Es as HANDOFF_ACK, F as GroupWakeLimiter, Fa as parseVoiceMeta, Fc as endedRequests, Fi as emptyIdentityLedger, Fn as parseCashuRequestPayload, Fo as GROUP_MEMBER_CAP, Fr as pickHubs, Fs as HANDOFF_TIMINGS, Gc as contactAskerHolds, Gi as emptyProofLedger, Gl as decodeInviteCode, Gn as GhostLink, Go as RatchetBox, Gr as transferEnded, Gs as handoffContextProof, Gt as didDhtDocument, Gu as createIdentity, H as GroupSession, Ha as REMOVED_TEXT, Hc as ContactRequestError, Hl as readDeviceInvite, Hn as isStrippedPicture, Ho as verifyCommitSignature, Hr as FILE_LIMITS, Hs as handoffBusyFrame, I as groupWakeFrame, Ic as inboxRecord, Il as readCanonicalJson, In as parseFedimintRequestPayload, Ir as rankHubs, Is as HANDOFF_VERIFIED, Iu as budgetRetryMs, J as meshMessageRef, Ja as forwardedAgain, Jc as knockSlotOf, Ji as automaticTransport, Jl as inviteOwnership, Jn as PAIRED_FRAME_TOO_LARGE, Jo as DirectPathWatch, Js as handoffEphemeral, Jt as encodeDidDhtPacket, Ju as publicKeyFromZ32, K as GROUP_EDIT_TEXT_BYTES, Kc as contactDay, Ki as validExternalKey, Kl as encodeInviteCode, Kn as INVITE_TAKEN, Ko as emptyRatchetState, Kr as transferStalled, Ks as handoffDataFrame, Kt as didDhtFromPublicKey, Ku as identityFromSeed, L as groupWakes, Lc as newInbox, Ll as createContactLink, Lo as MEMBER_KEY, Lr as readBeacon, Ls as NO_ATTEMPTS, Lu as isDiscoveryBudgetError, M as mergeKnocks, Mc as readEnrollHello, Ml as parseImageMeta, Mn as fedimintRequestPayload, Mo as receivedTimestamp, Mr as mergeBeacon, Ms as HANDOFF_PAKE, N as readKnocks, Nc as verifyEnrollProof, Nn as findEndpoint, No as shownTime, Nr as mergeLobby, Ns as HANDOFF_PIECE_BYTES, O as encodeGroupEntryLink, Oa as sanitizeMime, Oc as enrollGrantFrame, Oo as statusCardText, Or as freshHubs, Os as HANDOFF_DONE, Pa as fileMessageText, Pc as clearMissed, Pl as canonicalJson, Pn as isFederationId, Po as GROUP_ADMIN_OFF_ERROR, Pr as newerHead, Ps as HANDOFF_REQUEST, Pu as traceLink, Qa as REACTION_LIMITS, Qc as mergeContactKnocks, Qi as HOLD_CAPABILITY, Ql as HANDOFF_CAPABILITY, Qn as EngineError, Qs as handoffPakeFrame, Qt as EVM_TEST_CHAINS, Qu as hasVisible, R as parseGroupWakeFrame, Ra as parseVideoMeta, Rc as planKnocks, Rl as encodeContactLink, Rn as videoMetadataPatches, Ro as commitHash, Rr as readBeaconHead, Rs as filePartName, Ru as withRequestOptions, S as GROUP_READ_NOTE_COMMUNITY, Sa as DHT_MESSAGE_TTL, Si as STATUS_CARD_CAPABILITY, Sr as meshHubs, Ss as emptyLinkRecords, Su as turnStatedVerifier, T as encodeCommunityLink, Ta as dhtFileId, Tc as enrollCancelReason, Ti as DHT_TEXT_CAPABILITY, Tl as isAppRef, To as checkStatusCard, Tr as beaconKeys, Ts as serviceIdFromName, U as frameBytes, Ua as RateWindow, Uc as REQUEST_LIFETIME_MS, Ui as lastSharedWithMe, Ul as OwnInviteError, Un as stripPictureMetadata, Uo as edgeParams, Us as handoffCancelFrame, V as GROUP_READ_NOTE, Va as MAX_REMOVAL_NUMBER, Vc as turnOff, Vi as receivedIdentityStatus, Vl as deviceInviteJoinerParams, Vn as PICTURE_METADATA_LIMITS, Vo as rosterHas, Vr as ChatFiles, Vs as handoffAttemptSucceeded, Vu as createRelayPayload, Wa as dhtEditId, Wc as contactAskerFrame, Wi as PeerProofs, Wl as createChatInvite, Wo as RATCHET_CAPABILITY, Wr as sentWhole, Ws as handoffContext, X as mentionsMember, Xa as COMMUNITY_REACTION_FRAME, Xc as linkRecords, Xl as DEVICES_CAPABILITY, Xn as pairedMessageFits, Xs as handoffManifestFrames, Xt as signDidDhtPacket, Y as parseCommunityEdit, Ya as readForwarded, Yc as knockSlotRecords, Yn as pairedEditFits, Yr as TypingSender, Ys as handoffHelloFrame, Yu as verify, Z as groupName, Za as GROUP_REACTION_FRAME, Zc as makeStampPaced, Zl as ENROLL_CAPABILITY, Zn as pairedMessageFrame, Zo as DHT_POLL_INTERVALS, Zr as typingActivity, Zs as handoffOfferFrame, Zt as ETHEREUM_USDT, Zu as sanitizeAvatar, _ as groupTypingEpoch, _c as setUpdateFrame, _i as chatAppId, _t as isAtprotoDid, _u as signTurnPacket, a as appRevocationFor, aa as readManifest, ac as readHandoffCancel, ad as toBase64Url, ai as WAKE_CALL_INTERVAL_MS, al as APP_BUNDLE_MAGIC, an as WALLET_NETWORKS, ao as validReactionNumber, as as parseLocalTarget, au as seedSigner, b as COMMUNITY_LIMITS, bi as BUTTONS_CAPABILITY, bl as appRef, br as MESH_HUBS, bs as parseCallSignal, bu as turnKeys, c as checkAppBeforeRun, cc as readHandoffHello, cd as utf8Encode, ci as newWakeToken, cl as appDigest, cn as assertWholeSats, co as readReply, cs as decodeControl, cu as TURN_RAISE_READ_TIMEOUT_MS, dc as readHandoffVerified, di as wakeRequest, dn as walletNetworkOf, du as turnPutSummary, ea as HOLD_LIMITS, ec as handoffRetryAfter, ed as stripHidden, ei as mayPin, el as readKnockSlot, en as PaymentPreflightError, eo as nextReactionNumber, er as engineText, es as RELAY_POLL_INTERVALS, eu as deviceEchoNonce, fc as sealHandoffPiece, fi as checkPushEndpoint, fl as isAppUrl, fn as SPARK_NETWORKS, fu as TURN_LAST_SEQUENCE, g as GroupTypingBoard, gc as setAckFrame, gl as sha256Paced, gn as isBitcoinAddress, gu as readTurnPacket, hc as readSetUpdate, hi as isServeId, hl as readAppBundleAsync, hn as sparkInvoiceDetails, hu as nextTurnPosition, i as addedAppPermissions, ia as newMailbox, ic as readHandoffAck, id as randomBytes, ii as readPin, il as APP_BUNDLE_LIMITS, in as USDT_PUBLIC_RPC, io as readReaction, is as formatLocalTarget, iu as newDeviceSetSecret, j as knockRecords, jc as readEnrollGrant, jn as cashuRequestPayload, jo as heardTime, jr as lobbyRecords, js as HANDOFF_OFFER, ju as normalizeRelayUrl, k as entryParams, kc as enrollHelloFrame, kn as decodeBolt11, ko as arrivalKey, kr as hubRank, ks as HANDOFF_HAVE, l as planAppUpdate, lc as readHandoffPake, li as parseWakeFrame, ll as appViewOf, ln as formatPaymentAmount, lo as replySnippet, lr as readGroupFileMeta, ls as encodeControl, lu as TURN_SETTLE_MS, mi as APP_RANGE_LIMITS, mn as sparkAddressKind, mu as firstDeviceSetSecret, n as readX401SdJwtVc, na as HoldRefusedError, nc as handoffVersions, nd as fromBase64Url, ni as pinIsNewer, nl as requestRecords, no as reactionEmoji, nr as GROUP_FILE_LIMITS, ns as presenceSeenAt, nu as deviceLinkPairing, o as appStoreDecision, oc as readHandoffDone, od as toZ32, oi as WakeLimiter, on as arkAddressPrefix, oo as wireReaction, os as webLocalFetch, ou as webCryptoSigner, p as readAppStoreSteps, pi as vapidKeysMatch, pl as pacer, pn as SPARK_PROVIDER, pr as CarriedTransport, ps as RTC_CONFIG, pu as TURN_MAX, q as carryMentions, qa as parseLinkPreview, qc as knockSlotIdentity, qi as TRANSPORTS, ql as inviteLink, qn as LIVENESS_PING_MS, qo as ratchetSessionOf, qs as handoffDigest, qt as encodeDidDhtDeactivated, qu as identityFromSeedB64, r as sameX401HolderJwk, ra as isHoldUrl, rc as newHandoffId, ri as pinNumberHolds, rl as seenEntry, rn as TEST_USDT_FAUCET_AMOUNT, ro as reactionIsNewer, rr as GROUP_HAVE_FRAME, rs as GhostlyHttpError, ru as devicePingFrame, s as appUpdateDecision, sc as readHandoffHave, sd as utf8Decode, si as deviceWakeRequest, sn as assertTokenUnits, so as pairedReplyAuthor, sr as groupFileFallback, ss as LIMITS, t as newX401HolderKey, ta as HoldKeys, tc as handoffStreamKey, td as bytesEqual, ti as nextPinNumber, tl as readLinkRecord, tn as SEPOLIA_TEST_USDT, to as queueReaction, tr as parseEngineError, ts as WATCH_PEER_MS, tu as deviceKeyZ32, u as APP_STORE_LIMITS, uc as readHandoffTurnFrame, ui as relayRequest, un as validatePaymentTarget, uo as BUTTON_ID, uu as classifyTurnRead, v as openGroupTyping, vc as signTombstone, vi as isAppVersion, vl as APP_STATEMENT_LIMITS, vn as isPubkyKey, vo as STATUS_CARD_LIMITS, vr as groupSignalFrame, vs as contactRtcConfig, vt as normalizeAtprotoHandle, vu as signTurnRelease, w as decodeCommunityLink, wa as DHT_FILE_CAPABILITY, wc as enrollCancelFrame, wi as CapsExchange, wl as isAppKey, wr as COMMUNITY_TOPOLOGY, ws as LEGACY_SERVICES, wu as DEFAULT_RELAYS, x as CommunitySession, xi as EDIT_CAPABILITY, xl as appRefPublisher, xr as mayBeHub, xu as turnName, y as sealGroupTyping, yc as verifySetUpdate, yi as APPS_CAPABILITY, yl as appFingerprint, yr as readGroupSignal, yu as turnInstance, z as GROUP_LIMITS, za as EDIT_BUFFER_MS, zc as settleRequest, zl as readContactLink, zn as withoutVideoMetadata, zo as parseGroupCommit, zr as readLobby, zs as handoffAttemptAllowed, zu as PacketTooLargeError } from "./src-BIdfHB7t.js";
3
3
  import { i as SourceUnreachableError, n as PROVIDER_PLATFORMS, o as isNothingSpentError, r as SourceConfigError, t as NothingSpentError, u as redact } from "./types-C4_KafL_.js";
4
4
  import { t as bitcoindRpc } from "./bitcoindProvider-DGw3xBSa.js";
5
- import { t as nwc } from "./nwcProvider-CfpbNUf7.js";
5
+ import { t as nwc } from "./nwcProvider-D_tt2X3Z.js";
6
6
  import { a as clearProfileStores, c as deleteDatabase, d as newestWalletTx, f as openDb, g as wrap, h as transact, i as STORES$1, l as errorLine, m as store, n as APP_STORAGE_SCOPE_INDEX, o as committed, p as profileOpenFailure, r as CARD_INDEX, s as databaseName, t as APP_STORAGE_CHAT_INDEX, u as fileStore } from "./idb-BHsAqENE.js";
7
- import { a as sealSeed, c as openRow, d as sealedStore, f as openSecret, i as newDeviceKey, l as openRows, m as whenDataKeyDropped, o as unsealSeed, p as sealSecret, r as intentRepository, s as RowSeals, u as sealRow } from "./networkReason-CfpO9ayz.js";
8
- import { $ as ModeGate, A as IdentityProofs, B as AskBackoff, C as FileAppender, D as streamStored, E as storedSize, F as normalizePhrase, G as breezDatabase, H as sourceKey, I as journaledPayment, J as dropBreezDatabase, K as breezDatabaseInUse, L as lightningPaying, M as LightningCards, N as cardsKey, P as isRecoveryPhrase, Q as ModeChanged, R as INVOICE_PACE, S as WALLET_TYPES, T as removeStored, U as CASHU_MINT_SOURCE, V as ProviderSources, W as cashuMint, X as iceServerSetting, Y as iceServerProblem, Z as relayOnlyProblem, _ as crossNetwork, a as storedGroupFiles, at as setAwayWallets, b as walletInstances, c as receivedPairedReply, d as paymentAlias, et as WrongNetworkError, f as paymentWireId, g as createTiming, h as createFailure, i as groupOfFile, it as requireTurn, j as CASHU_CARD, l as replyRef, m as assertConfirmedReal, n as groupFileId, nt as awayFrom, o as groupReply, ot as setSingleWriterGate, p as WALLET_NAMES, q as breezDatabasesFor, r as groupFileText, rt as refuseAway, s as pairedWireReply, t as GroupFileDesk, tt as networkLabel, u as replyTo, v as paymentNetwork, w as readStored$2, y as paymentNetworksOf, z as nextInvoiceAsk } from "./groupFiles-DYopNE57.js";
9
- import { a as fedimintDatabase, i as onPublicIrohRelay, n as createIrohWebEndpoint, r as irohRelayProblem, s as loadFedimintSdk, t as DEFAULT_IROH_RELAYS } from "./irohWeb-C-2oslSU.js";
7
+ import { a as sealSeed, c as openRow, d as sealRow, f as sealedStore, g as whenDataKeyDropped, h as sealSecret, i as newDeviceKey, l as openRows, m as openSecret, o as unsealSeed, p as hasDataKey, r as intentRepository, s as RowSeals, u as proofKey } from "./networkReason-C9Hr-hO7.js";
8
+ import { $ as ModeGate, A as IdentityProofs, B as ProviderSources, C as FileAppender, D as streamStored, E as storedSize, F as normalizePhrase, G as breezDatabase, H as AskBackoff, I as journaledPayment, J as dropBreezDatabase, K as breezDatabaseInUse, L as lightningPaying, M as LightningCards, N as cardsKey, P as isRecoveryPhrase, Q as ModeChanged, R as INVOICE_PACE, S as WALLET_TYPES, T as removeStored, U as CASHU_MINT_SOURCE, V as sourceKey, W as cashuMint, X as iceServerSetting, Y as iceServerProblem, Z as relayOnlyProblem, _ as crossNetwork, a as storedGroupFiles, at as setAwayWallets, b as walletInstances, c as receivedPairedReply, d as paymentAlias, et as WrongNetworkError, f as paymentWireId, g as createTiming, h as createFailure, i as groupOfFile, it as requireTurn, j as CASHU_CARD, l as replyRef, m as assertConfirmedReal, n as groupFileId, nt as awayFrom, o as groupReply, ot as setSingleWriterGate, p as WALLET_NAMES, q as breezDatabasesFor, r as groupFileText, rt as refuseAway, s as pairedWireReply, t as GroupFileDesk, tt as networkLabel, u as replyTo, v as paymentNetwork, w as readStored$2, y as paymentNetworksOf, z as nextInvoiceAsk } from "./groupFiles-BuToTMUk.js";
9
+ import { a as fedimintDatabase, i as onPublicIrohRelay, n as createIrohWebEndpoint, r as irohRelayProblem, s as loadFedimintSdk, t as DEFAULT_IROH_RELAYS } from "./irohWeb-B4_swKx0.js";
10
10
  import { c as isTestMint, d as mintUrlSpelling, f as paysItsOwnInvoices, l as isWorthlessMint, n as DEFAULT_MINTS, o as fakesLightning, r as TEST_MINT, t as BITCOIN_INVOICE_ON_TESTNET, u as mintNetwork } from "./mints-j5XAOk4f.js";
11
- import { a as registeredLightningProviders, c as boundedIdentityFetch, d as testSwitch, n as setOwnDidSource, o as registeredOnchainProviders, r as onAdaptersChanged, s as reserveAdapterIds, u as testBuild } from "./ownDid-DJFZM2cV.js";
12
- import { d as chosenResolver, r as resolveAtprotoDid, t as assertPublicServer } from "./resolve-CDD4X68j.js";
11
+ import { a as registeredLightningProviders, c as boundedIdentityFetch, d as testSwitch, n as setOwnDidSource, o as registeredOnchainProviders, r as onAdaptersChanged, s as reserveAdapterIds, u as testBuild } from "./ownDid-DkK_jem4.js";
12
+ import { d as chosenResolver, m as setPkarrRelaySource, r as resolveAtprotoDid, t as assertPublicServer } from "./resolve-BBOrN13E.js";
13
13
  import { c as fileSpace, f as FILE_BYTES_STEP, o as fileBytes, r as blobDigest, s as fileBytesOf, u as removeFileBytes } from "./fileBytes-DjBYYyXT.js";
14
- import { n as MAX_BACKUP_BYTES, t as BACKUP_MEDIA_TYPE } from "./envelope-C3yFCQa-.js";
14
+ import { n as MAX_BACKUP_BYTES, t as BACKUP_MEDIA_TYPE } from "./envelope-5Gu9yGk_.js";
15
15
  import { t as hyperdhtRelayProblem } from "./hyperdhtRelay-1wzya_0L.js";
16
16
  import { sha256 } from "@noble/hashes/sha2.js";
17
17
  import { hkdf } from "@noble/hashes/hkdf.js";
@@ -199,7 +199,7 @@ function viewNews(before, after) {
199
199
  //#endregion
200
200
  //#region ../browser/src/engine/paymentAdapters/usdtWallet.ts
201
201
  /** The Ethereum libraries, a large part of the app: loaded once a USDT wallet is made, opened or restored, not with the engine. */
202
- var loadUsdt = () => import("./usdt-DwHqp625.js");
202
+ var loadUsdt = () => import("./usdt-6CQdfye1.js");
203
203
  /** Every new profile starts with this wallet: an address to receive on, nothing to set up. */
204
204
  var DEFAULT_USDT = {
205
205
  network: "ethereum",
@@ -686,7 +686,7 @@ async function restoreArkDatabase(walletId, snapshot) {
686
686
  //#endregion
687
687
  //#region ../browser/src/engine/paymentAdapters/arkWallet.ts
688
688
  /** The Ark SDK, a large part of the app: loaded once an Ark wallet is made, opened or restored, not with the engine. */
689
- var loadArkade = () => import("./arkade-BmxJTa65.js");
689
+ var loadArkade = () => import("./arkade-DdZx4b_I.js");
690
690
  /** How long a Testnet wallet about to make way for another waits for its server to say what it holds. */
691
691
  var RETIRE_READ_MS = 1e4;
692
692
  /** Every new profile starts with this wallet: nothing to set up before receiving. */
@@ -9234,7 +9234,7 @@ var HostNotContacted = class extends Error {};
9234
9234
  */
9235
9235
  function fixedHostsFetch(fetch) {
9236
9236
  return async (url, options) => {
9237
- const { fixedIdentityHosts } = await import("./fixedHosts-C6nCHjOa.js");
9237
+ const { fixedIdentityHosts } = await import("./fixedHosts-PR1BcfKX.js");
9238
9238
  const host = hostOf$1(url);
9239
9239
  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`);
9240
9240
  return fetch(url, options);
@@ -12164,6 +12164,14 @@ var Apps = class {
12164
12164
  digest
12165
12165
  }) === "equivocation";
12166
12166
  if (other && held.equivocation?.digest !== digest) await this.putStore(this.withIndex(held, index, digest));
12167
+ const seen = held?.removed && held.seen && appStoreDecision({
12168
+ key: held.key,
12169
+ ...held.seen
12170
+ }, {
12171
+ key: index.key,
12172
+ sequence: index.sequence,
12173
+ digest
12174
+ });
12167
12175
  return {
12168
12176
  url: at,
12169
12177
  key: index.key,
@@ -12178,7 +12186,8 @@ var Apps = class {
12178
12186
  ...held && !held.removed && { held: held.index ? {
12179
12187
  sequence: held.index.sequence,
12180
12188
  ...other && { equivocation: true }
12181
- } : {} }
12189
+ } : {} },
12190
+ ...(seen === "rollback" || seen === "equivocation") && { refused: seen }
12182
12191
  };
12183
12192
  }
12184
12193
  /**
@@ -12627,10 +12636,16 @@ var Apps = class {
12627
12636
  ...installed?.checkedAt !== void 0 && { checkedAt: installed.checkedAt }
12628
12637
  };
12629
12638
  }
12630
- /** The person accepted the permissions a waiting update adds: it is installed now. */
12631
- async acceptUpdate({ ref }) {
12639
+ /**
12640
+ * The person accepted the permissions a waiting update adds: it is installed now. `sequence` and `added` are the
12641
+ * waiting update its screen listed (`InstalledAppView.pending`): another one waiting now (the check found a newer one
12642
+ * after the screen was drawn), or one that adds more than `added`, is refused with `permissions-changed`.
12643
+ */
12644
+ async acceptUpdate({ ref, sequence, added: shown }) {
12645
+ if (shown !== void 0 && !Array.isArray(shown)) fail("permissions", "The permissions shown must be a list");
12632
12646
  const installed = await this.installedOrFail(ref);
12633
12647
  const pending = installed.pending ?? fail("no-update", "No update waits for this app");
12648
+ if (sequence !== void 0 && pending.sequence !== sequence) fail("permissions-changed", `Another update waits now, which adds ${pending.added.length ? pending.added.join(", ") : "no permission"}; look at it again`);
12634
12649
  const bytes = await this.readBundleBytes(pending.bytes, pending.digest);
12635
12650
  const read = bytes ? await readAppBundleAsync(bytes) : null;
12636
12651
  if (!read?.ok || read.bundle.digest !== pending.digest) {
@@ -12659,6 +12674,7 @@ var Apps = class {
12659
12674
  });
12660
12675
  fail("permissions-changed", `This update now adds ${added.length ? added.join(", ") : "no permission"}; look at it again`);
12661
12676
  }
12677
+ if (shown && added.some((p) => !shown.includes(p))) fail("permissions-changed", `This update now adds ${added.join(", ")}; look at it again`);
12662
12678
  const { pending: _p, ...without } = installed;
12663
12679
  const next = this.versionRecord(without, read.bundle, pending.bytes, pending.from, installed.store);
12664
12680
  if (!await this.putAppIfUnchanged(next, installed)) {
@@ -14733,25 +14749,9 @@ function storedActiveListed(record, tombstone) {
14733
14749
  return listedIn(tombstone, active);
14734
14750
  }
14735
14751
  var listedIn = (record, key) => record.slots.some((slot) => !!slot && toBase64Url(slot.key) === key);
14736
- /**
14737
- * The device this device believes for a `set-update` signed by `by`: its stored active device; or `by`, when `rec` is a
14738
- * valid ordinary record at the old address, newer than the one stored here, written by `by` as the active device, with
14739
- * a release that the stored active device signed (WISP 06 § Record: a release names its taker). Null when it has none.
14740
- */
14741
- function believed(record, oldKeys, by, rec) {
14742
- const stored = record.activeSlot === void 0 || record.activeSlot === record.ownSlot ? void 0 : record.deviceSet[record.activeSlot]?.key;
14743
- if (!stored) return null;
14744
- if (by === stored || !rec) return stored;
14745
- const carried = readTurnPacket(oldKeys, rec);
14746
- if (carried.kind !== "valid" || carried.record.tombstone) return stored;
14747
- const r = carried.record;
14748
- const author = r.slots[r.author], release = r.release;
14749
- if (!author || toBase64Url(author.key) !== by || !release || release.from === release.to) return stored;
14750
- if (toBase64Url(r.slots[release.from].key) !== stored) return stored;
14751
- const held = record.turnPacket ? readTurnPacket(oldKeys, fromBase64Url(record.turnPacket)) : null;
14752
- if (held?.kind === "valid" && carried.sequence <= held.sequence) return stored;
14753
- if (held?.kind !== "valid" && r.turn <= record.turn) return stored;
14754
- return by;
14752
+ /** The device this device believes for a `set-update`: its stored active device. Null when it has none, or is it. */
14753
+ function believed$1(record) {
14754
+ return record.activeSlot === void 0 || record.activeSlot === record.ownSlot ? null : record.deviceSet[record.activeSlot]?.key ?? null;
14755
14755
  }
14756
14756
  /** The rule above, for `frame` reaching a device whose record is `record`. `now`: when, for the notice. */
14757
14757
  function checkSetUpdate(record, frame, now) {
@@ -14772,7 +14772,7 @@ function checkSetUpdate(record, frame, now) {
14772
14772
  const tomb = read.record;
14773
14773
  if (!verifySetUpdate(update, oldKeys.address)) return refuse("signature");
14774
14774
  const by = toBase64Url(update.by);
14775
- const active = believed(record, oldKeys, by, update.rec);
14775
+ const active = believed$1(record);
14776
14776
  if (!listedIn(tomb, own)) return active && by === active ? refuse("removed") : refuse("signer");
14777
14777
  if (!active || by !== active) return refuse("signer", record.activeSlot !== record.ownSlot);
14778
14778
  if (!listedIn(tomb, active)) return refuse("unlisted", true);
@@ -16012,7 +16012,7 @@ var EnrollInviter = class extends Enrollment {
16012
16012
  }
16013
16013
  this.crash("inviter:after-put");
16014
16014
  const published = await confirmPublished(keeper, this.sleep);
16015
- await this.options.afterWrite?.().catch(() => {});
16015
+ await this.options.afterWrite?.(toBase64Url(joiner.key)).catch(() => {});
16016
16016
  await this.end({
16017
16017
  role: "inviter",
16018
16018
  step: "done",
@@ -16795,11 +16795,9 @@ async function planSetMove(record, signer, options = {}) {
16795
16795
  turn,
16796
16796
  rev: FIRST_REV
16797
16797
  };
16798
- const rec = record.turnPacket ? fromBase64Url(record.turnPacket) : void 0;
16799
16798
  const frame = await setUpdateFrame(oldKeys.address, {
16800
16799
  ...update,
16801
- tomb,
16802
- ...rec ? { rec } : {}
16800
+ tomb
16803
16801
  }, signer);
16804
16802
  const staying = (keys) => keys.filter((key) => key !== own.key && slots.some((slot) => slot?.key === key));
16805
16803
  const earlier = [];
@@ -16816,11 +16814,6 @@ async function planSetMove(record, signer, options = {}) {
16816
16814
  });
16817
16815
  continue;
16818
16816
  }
16819
- let oldRec;
16820
- try {
16821
- const was = JSON.parse(set.setUpdate);
16822
- if (typeof was.rec === "string") oldRec = fromBase64Url(was.rec);
16823
- } catch {}
16824
16817
  const setKeys = turnKeys(fromBase64Url(set.d)), tombBytes = fromBase64Url(set.tombstone);
16825
16818
  const oldTomb = readTurnPacket(setKeys, tombBytes);
16826
16819
  const kept = oldTomb.kind === "valid" ? turnSlots.map((slot, i) => {
@@ -16830,8 +16823,7 @@ async function planSetMove(record, signer, options = {}) {
16830
16823
  const setUpdate = pending.length ? JSON.stringify(await setUpdateFrame(setKeys.address, {
16831
16824
  ...update,
16832
16825
  set: kept,
16833
- tomb: tombBytes,
16834
- ...oldRec ? { rec: oldRec } : {}
16826
+ tomb: tombBytes
16835
16827
  }, signer)) : set.setUpdate;
16836
16828
  earlier.push({
16837
16829
  ...set,
@@ -17663,10 +17655,21 @@ var DeviceLinks = class {
17663
17655
  /** A hint came inside `TURN_HINT_EVERY_MS` of the last read, and a read is due at its end. */
17664
17656
  hintDeferred = false;
17665
17657
  timers = /* @__PURE__ */ new Set();
17658
+ /** When this device added each device it enrolled in this run, by signing key (`expectDevice`). */
17659
+ added = /* @__PURE__ */ new Map();
17666
17660
  constructor(options) {
17667
17661
  this.options = options;
17668
17662
  this.createPeerConnection = "createPeerConnection" in options ? options.createPeerConnection : defaultPeerConnection();
17669
17663
  }
17664
+ /**
17665
+ * This device just added the device of signing key `key` (an enrollment's record was written): its link, opened by the
17666
+ * next `refresh`, awaits it as a chat awaits the contact of an invite just sent (`AWAITING_PEER_MS`). The new device
17667
+ * starts into its standby screen only once the person taps Continue there, after the link's first read: read at the
17668
+ * background pace from then, it went live about 30 s after it started (bug hunt, 2026-11-06).
17669
+ */
17670
+ expectDevice(key) {
17671
+ this.added.set(key, Date.now());
17672
+ }
17670
17673
  /** `host` is the device-link-only server's: it is told when what the standby screen shows changes. */
17671
17674
  async start(host) {
17672
17675
  this.host = host ?? null;
@@ -17818,17 +17821,27 @@ var DeviceLinks = class {
17818
17821
  earlier: false
17819
17822
  });
17820
17823
  });
17821
- for (const earlier of record.earlierSets) for (const key of earlier.pending) {
17822
- if (key === own || earlier.d === record.d) continue;
17823
- const staying = record.deviceSet.find((slot) => slot?.key === key);
17824
- if (!staying) continue;
17825
- if (!wanted.some((w) => w.id === `${earlier.d}|${key}`)) wanted.push({
17826
- id: `${earlier.d}|${key}`,
17827
- d: fromBase64Url(earlier.d),
17828
- key,
17829
- name: staying.name,
17830
- earlier: true
17831
- });
17824
+ const pendingFor = (key, d) => record.earlierSets.find((set) => set.d !== record.d && (d === void 0 || set.d === d) && set.pending.includes(key));
17825
+ for (const staying of record.deviceSet) {
17826
+ if (!staying || staying.key === own) continue;
17827
+ const key = staying.key;
17828
+ for (let set = pendingFor(key); set;) {
17829
+ const id = `${set.d}|${key}`;
17830
+ if (wanted.some((w) => w.id === id)) break;
17831
+ wanted.push({
17832
+ id,
17833
+ d: fromBase64Url(set.d),
17834
+ key,
17835
+ name: staying.name,
17836
+ earlier: true
17837
+ });
17838
+ let next;
17839
+ try {
17840
+ const update = readSetUpdate(JSON.parse(set.setUpdate));
17841
+ if (update) next = toBase64Url(update.d);
17842
+ } catch {}
17843
+ set = next === void 0 ? void 0 : pendingFor(key, next);
17844
+ }
17832
17845
  }
17833
17846
  return wanted;
17834
17847
  }
@@ -17859,7 +17872,7 @@ var DeviceLinks = class {
17859
17872
  packetTransports: true,
17860
17873
  transport: this.options.transport,
17861
17874
  pollIntervals: this.options.pollIntervals,
17862
- madeAt: 0,
17875
+ madeAt: want.earlier ? 0 : this.added.get(want.key) ?? 0,
17863
17876
  autoConnect: true,
17864
17877
  createPeerConnection: () => {
17865
17878
  if (!this.createPeerConnection) throw new ReferenceError("RTCPeerConnection is not defined");
@@ -18917,6 +18930,8 @@ var HandoffGiver = class {
18917
18930
  failure;
18918
18931
  /** What a failure about one wallet names. */
18919
18932
  failed = {};
18933
+ /** The wrong password (`failure: "password"`) left that device refused. */
18934
+ refused = false;
18920
18935
  stays = [];
18921
18936
  retry;
18922
18937
  newer = false;
@@ -18983,6 +18998,7 @@ var HandoffGiver = class {
18983
18998
  total: 0,
18984
18999
  failure: this.failure,
18985
19000
  ...this.retry ? { retry: this.retry } : {},
19001
+ ...this.refused && this.failure === "password" ? { refused: true } : {},
18986
19002
  ...this.failedDetail()
18987
19003
  } : null;
18988
19004
  const confirmed = [...this.sender.confirmed.values()].reduce((a, b) => a + b, 0);
@@ -19093,12 +19109,21 @@ var HandoffGiver = class {
19093
19109
  this.reset("cancelled");
19094
19110
  });
19095
19111
  }
19096
- /** "Let <device> try again": the count of wrong passwords of that device starts again. */
19097
- async allowAgain(key) {
19098
- const record = await this.ports.records.read();
19099
- if (!record?.handoffAttempts?.[key]) return;
19100
- const { [key]: _, ...rest } = record.handoffAttempts;
19101
- await this.ports.records.amend({ handoffAttempts: rest });
19112
+ /**
19113
+ * "Let <device> try again": the count of wrong passwords of that device starts again. The wrong password it was
19114
+ * offered for is answered: the screen shows it no more (it stayed, and the press looked like it did nothing).
19115
+ */
19116
+ allowAgain(key) {
19117
+ return this.exclusive(async () => {
19118
+ const record = await this.ports.records.read();
19119
+ if (record?.handoffAttempts?.[key]) {
19120
+ const { [key]: _, ...rest } = record.handoffAttempts;
19121
+ await this.ports.records.amend({ handoffAttempts: rest });
19122
+ }
19123
+ if (this.phase !== "idle" || this.peer !== key || this.failure !== "password") return;
19124
+ this.failure = void 0;
19125
+ this.changed();
19126
+ });
19102
19127
  }
19103
19128
  /** The link to `key` opened (a new session) or closed. */
19104
19129
  linkChanged(key, live) {
@@ -19265,6 +19290,14 @@ var HandoffGiver = class {
19265
19290
  if (versions.older) return busy("older", 0);
19266
19291
  if (!pushed) {
19267
19292
  const allowed = handoffAttemptAllowed(record.handoffAttempts?.[from], this.now());
19293
+ if (allowed === "refused") {
19294
+ this.peer = from;
19295
+ this.deviceName = name(record, from);
19296
+ this.failure = "password";
19297
+ this.failed = {};
19298
+ this.refused = true;
19299
+ this.changed();
19300
+ }
19268
19301
  if (allowed !== "ok") return busy(allowed, allowed === "refused" ? 0 : handoffRetryAfter(record.handoffAttempts?.[from], this.now()));
19269
19302
  await this.ports.records.amend({ handoffAttempts: {
19270
19303
  ...setAttempts(record, record.handoffAttempts),
@@ -19297,7 +19330,7 @@ var HandoffGiver = class {
19297
19330
  try {
19298
19331
  this.pake = await startPakeGiver(verifier, pake.m);
19299
19332
  } catch {
19300
- this.wrongPassword(from);
19333
+ await this.wrongPassword(from);
19301
19334
  return;
19302
19335
  }
19303
19336
  this.out(handoffPakeFrame({
@@ -19311,7 +19344,7 @@ var HandoffGiver = class {
19311
19344
  const giver = this.pake;
19312
19345
  this.pake = null;
19313
19346
  if (pake.wrong) {
19314
- this.wrongPassword(from);
19347
+ await this.wrongPassword(from);
19315
19348
  return;
19316
19349
  }
19317
19350
  let key;
@@ -19319,7 +19352,7 @@ var HandoffGiver = class {
19319
19352
  key = await giver.finish(pake.m, pake.c, handoffContext(this.ports.turnAddress, this.ports.ownKey, fromBase64Url(from), session.transcript));
19320
19353
  } catch (error) {
19321
19354
  if (error instanceof HandoffPasswordError) {
19322
- this.wrongPassword(from);
19355
+ await this.wrongPassword(from);
19323
19356
  return;
19324
19357
  }
19325
19358
  throw error;
@@ -19330,10 +19363,11 @@ var HandoffGiver = class {
19330
19363
  await this.ports.records.amend({ handoffAttempts: attempts });
19331
19364
  this.authorized(session, key);
19332
19365
  }
19333
- wrongPassword(from) {
19366
+ async wrongPassword(from) {
19334
19367
  this.out(handoffCancelFrame("password"), from);
19335
19368
  this.ports.notice?.("wrong-password", this.deviceName);
19336
- this.reset("password");
19369
+ const record = await this.ports.records.read();
19370
+ this.reset("password", handoffAttemptAllowed(record?.handoffAttempts?.[from], this.now()) === "refused");
19337
19371
  }
19338
19372
  /** The proof held (a pull) or the person agreed (a push): the first session's key, and pass 1. */
19339
19373
  authorized(session, k) {
@@ -19595,7 +19629,7 @@ var HandoffGiver = class {
19595
19629
  this.offerHellos.clear();
19596
19630
  this.sender = new PartSender(this.now);
19597
19631
  }
19598
- reset(failure) {
19632
+ reset(failure, refused = false) {
19599
19633
  this.sender.stop();
19600
19634
  clearInterval(this.stallTimer);
19601
19635
  clearInterval(this.stuckTimer);
@@ -19603,6 +19637,7 @@ var HandoffGiver = class {
19603
19637
  if (this.timer) clearTimeout(this.timer);
19604
19638
  this.phase = "idle";
19605
19639
  this.failure = failure;
19640
+ this.refused = refused;
19606
19641
  this.pake = null;
19607
19642
  this.have = null;
19608
19643
  this.planned = null;
@@ -21065,7 +21100,7 @@ var FileDesk = class {
21065
21100
  wire: fileWire("files/3", file.size)
21066
21101
  }
21067
21102
  });
21068
- }).catch(() => {});
21103
+ }).catch((error) => this.unkept(linkId, chat, record.id, id, error, said));
21069
21104
  }
21070
21105
  if (record.direction === "in" && !chat.local.has(record.id)) {
21071
21106
  const id = `${linkId}-in-${toBase64Url(randomBytes(12))}`;
@@ -21117,7 +21152,7 @@ var FileDesk = class {
21117
21152
  ...file.forwarded && { forwarded: file.forwarded },
21118
21153
  details: { wire: fileWire("files/3", file.size) }
21119
21154
  });
21120
- }).catch(() => {});
21155
+ }).catch((error) => this.unkept(linkId, chat, record.id, id, error));
21121
21156
  }
21122
21157
  const offered = record.direction === "in" && !this.deps.transfers.has(chat.local.get(record.id));
21123
21158
  this.show(linkId, chat, record, transferred, progress);
@@ -21144,6 +21179,29 @@ var FileDesk = class {
21144
21179
  this.deps.changed(progress ? 250 : 50);
21145
21180
  }
21146
21181
  /**
21182
+ * A new offer whose record or message could not be stored: refused (no room, or `invalid` for any other cause), not
21183
+ * taken and said done with no message for it here. What was written of it goes, so the sender's Retry is a new offer.
21184
+ * One said on the floor gets its bubble back, saying it was refused, and waits for the offer again.
21185
+ */
21186
+ unkept(linkId, chat, wireId, id, error, said) {
21187
+ if (said) chat.announced.set(wireId, said);
21188
+ else {
21189
+ chat.local.delete(wireId);
21190
+ this.deps.wireIds(linkId)?.delete(wireId);
21191
+ this.deps.transfers.delete(id);
21192
+ clearTimeout(chat.unsaved.get(id)?.timer);
21193
+ chat.unsaved.delete(id);
21194
+ chat.refused.delete(id);
21195
+ chat.lastSaved.delete(id);
21196
+ this.speeds.delete(id);
21197
+ this.underway.delete(id);
21198
+ this.unwatch(id);
21199
+ chat.saving = chat.saving.then(() => fileStore.delete(id)).catch(() => {});
21200
+ }
21201
+ chat.files.refuse(wireId, error?.name === "QuotaExceededError" ? "no-room" : "invalid");
21202
+ this.deps.changed();
21203
+ }
21204
+ /**
21147
21205
  * Writes a transfer's record and the view of it, after the chat's writes before it; what was held back goes with it.
21148
21206
  * One the database refuses (a full disk) is kept and written again, with the chat's next write and every few seconds,
21149
21207
  * until it goes: dropped, a received file that failed for want of room read "under way" after a restart, then
@@ -21616,6 +21674,7 @@ function withEdit(message, edit) {
21616
21674
  const next = {
21617
21675
  seq: edit.seq,
21618
21676
  at: edit.at,
21677
+ ...edit.heardAt !== void 0 && { heardAt: edit.heardAt },
21619
21678
  history,
21620
21679
  ...edit.pending && { pending: true }
21621
21680
  };
@@ -22307,6 +22366,8 @@ var days = (ms) => {
22307
22366
  var CARD_RESTORE_GAP_MS = 2 * EDIT_RATE_WINDOW_MS / 10;
22308
22367
  /** What makes a card the same card across messages: a new message may reuse a card's id, and the newest stands for it. */
22309
22368
  var cardKey = (message) => message.card && `${message.card.kind}\n${message.card.id}`;
22369
+ /** A row of mine with an edit (or a removal) on its way to the contact. */
22370
+ var waits = (m) => m.sender === "me" && !!m.edit?.pending;
22310
22371
  var EditQueue = class {
22311
22372
  deps;
22312
22373
  pace;
@@ -22369,6 +22430,19 @@ var EditQueue = class {
22369
22430
  reopened() {
22370
22431
  this.sent.clear();
22371
22432
  }
22433
+ /**
22434
+ * The chat's whole history as read elsewhere in this run (the start reads each chat once): the rows with an edit on
22435
+ * their way are known from it, so the first look reads those rows alone instead of the history again. Only with rows
22436
+ * read by their id; without, every look reads the history anyway. An edit made since that read is told (`edited`).
22437
+ */
22438
+ learn(history) {
22439
+ if (!this.deps.rows) return;
22440
+ for (const m of history) if (waits(m)) {
22441
+ if (!this.known.has(m.id)) this.known.set(m.id, this.tick);
22442
+ if (m.wireId) this.wires.set(m.id, m.wireId);
22443
+ }
22444
+ this.learnt = true;
22445
+ }
22372
22446
  /** This row has an edit to send (it was just written so): the next look reads it. */
22373
22447
  edited(id) {
22374
22448
  this.known.set(id, ++this.tick);
@@ -22379,7 +22453,6 @@ var EditQueue = class {
22379
22453
  * alone, in one read, and one that waits no more is forgotten, unless it was told again while it was read.
22380
22454
  */
22381
22455
  async pending(only) {
22382
- const waits = (m) => m.sender === "me" && !!m.edit?.pending;
22383
22456
  const read = this.deps.rows;
22384
22457
  if (!read || !this.learnt) {
22385
22458
  const all = await this.deps.read(), rows = all.filter(waits);
@@ -28828,10 +28901,13 @@ var Groups = class {
28828
28901
  couldRead: (key, messageId, ts) => session.couldRead(key, messageId, ts)
28829
28902
  };
28830
28903
  }
28831
- /** Why this device is out of the group for good, as `fileCheck` says it; undefined while it is in it, or not loaded. */
28904
+ /**
28905
+ * Why this device is out of the group for good, as `fileCheck` says it; undefined while it is in it, or not loaded. A
28906
+ * community join that lost a race (`lost`) is asked again and back in by itself: its files wait, not stop for good.
28907
+ */
28832
28908
  fileOut(groupId) {
28833
28909
  const session = this.isCommunity(groupId) ? this.communities.session(groupId) : this.sessions.get(groupId);
28834
- if (!session || session.status === "active") return void 0;
28910
+ if (!session || session.status === "active" || session.status === "lost") return void 0;
28835
28911
  return session.state.statusReason ?? "You are no longer in this group";
28836
28912
  }
28837
28913
  /**
@@ -30944,6 +31020,7 @@ var Groups = class {
30944
31020
  this.files?.arrivedAgain(state.id, id, frame.e);
30945
31021
  },
30946
31022
  edit: (e) => this.host.groupEdit?.(state.id, e),
31023
+ carriers: () => this.hubs.active(state.id, session, this.now()) ? this.hubs.hubs(state.id, session, this.now()) : [],
30947
31024
  changed: () => {
30948
31025
  if (session.status === "removed" && this.hubs.isHub(state.id) && !this.removedAt.has(state.id)) this.removedAt.set(state.id, this.now());
30949
31026
  this.membershipChanged(state.id).catch(() => {});
@@ -31221,10 +31298,14 @@ function parseGroupPay(raw, groupId) {
31221
31298
  * Whether `author` may say this. A request's state (open, paid, closed) is the payee's to say; a member who paid
31222
31299
  * it says so about itself (`sent`, `by` = itself), and takes that back (`closed`) when its payment came back. A
31223
31300
  * payment without a request: the payer says it sent it (or took it back), the payee that it was paid. Whoever a
31224
- * note names must be in the group.
31225
- */
31226
- function mayAuthor(frame, author, members) {
31227
- if (!members.has(author) || !members.has(frame.to) || frame.f !== "*" && !members.has(frame.f) || frame.by && !members.has(frame.by)) return false;
31301
+ * note names must be in the group, but for the payee's `paid` naming a payer who left since: `known` (the note so
31302
+ * far) shows that payer was in the group when a note naming it was believed (its own `sent`, or the request or
31303
+ * payment made with it as the payer).
31304
+ */
31305
+ function mayAuthor(frame, author, members, known) {
31306
+ const left = (key) => frame.st === "paid" && author === frame.to && !!known && (known.from === key || key === frame.by && !!known.claims?.includes(key));
31307
+ const named = (key) => members.has(key) || left(key);
31308
+ if (!members.has(author) || !members.has(frame.to) || frame.f !== "*" && !named(frame.f) || frame.by && !named(frame.by)) return false;
31228
31309
  if (frame.by && (frame.by === frame.to || frame.f !== "*" && frame.by !== frame.f)) return false;
31229
31310
  if (frame.k === "req") {
31230
31311
  if (author === frame.to) return frame.st !== "sent";
@@ -31247,16 +31328,17 @@ var fieldsOf = (frame) => ({
31247
31328
  ...frame.a ? { ask: true } : {},
31248
31329
  createdAt: frame.ts
31249
31330
  });
31331
+ /** Whether `author`'s `frame` may count for the note kept so far: one about another payment under the same id never does. */
31332
+ var believed = (current, frame, author, members) => mayAuthor(frame, author, members, current) && (!current || current.kind === (frame.k === "req" ? "request" : "payment") && current.to === frame.to);
31250
31333
  /**
31251
31334
  * The note after `author` said `frame`, or undefined when that changes nothing (or may not be believed). What a
31252
31335
  * payment is (who, how much, over what) is its initiator's to say: the payee's for a request, the payer's for a
31253
31336
  * payment; anyone else's description only stands in until the initiator's arrives. States only move forward.
31254
31337
  */
31255
31338
  function mergeGroupPay(current, frame, author, members) {
31256
- if (!mayAuthor(frame, author, members)) return void 0;
31339
+ if (!believed(current, frame, author, members)) return void 0;
31257
31340
  const initiator = frame.k === "req" ? frame.to : frame.f;
31258
31341
  const fields = fieldsOf(frame);
31259
- if (current && (current.kind !== fields.kind || current.to !== fields.to)) return void 0;
31260
31342
  let next = current ? { ...current } : {
31261
31343
  ...fields,
31262
31344
  state: "open",
@@ -31421,8 +31503,12 @@ var GroupPayments = class {
31421
31503
  if (!at) continue;
31422
31504
  const current = (await this.load(at.groupId)).get(paymentWireId(p.id));
31423
31505
  const frame = authoredNote(p, at, answers.get(p.id) ?? [], current, (linkId) => this.host.edgeOf(linkId)?.member, (federation) => this.host.federationNetwork?.(federation));
31424
- if (!frame || JSON.stringify(frame) === JSON.stringify(current?.mine)) continue;
31425
- const merged = mergeGroupPay(current, frame, at.me, membership(at.groupId).members) ?? current;
31506
+ if (!frame) continue;
31507
+ const members = membership(at.groupId).members;
31508
+ if (!believed(current, frame, at.me, members)) continue;
31509
+ const next = mergeGroupPay(current, frame, at.me, members);
31510
+ if (!next && JSON.stringify(frame) === JSON.stringify(current?.mine)) continue;
31511
+ const merged = next ?? current;
31426
31512
  if (!merged) continue;
31427
31513
  await this.write(at.groupId, at.me, {
31428
31514
  ...merged,
@@ -31826,6 +31912,7 @@ var GroupEdits = class {
31826
31912
  const next = withEdit(current, {
31827
31913
  seq: edit.e,
31828
31914
  at: heardTime(edit.ts),
31915
+ heardAt: this.now(),
31829
31916
  text: edit.m,
31830
31917
  card: edit.sc
31831
31918
  });
@@ -34419,6 +34506,11 @@ function amountlessUnderOptions(info) {
34419
34506
  }
34420
34507
  };
34421
34508
  }
34509
+ /**
34510
+ * An invoice from the mint, with `label` as its description when the mint says it takes one. NUT-04's `description` is
34511
+ * optional: cashu-ts refuses to ask a mint that leaves it out for an invoice with one, and the label is only a label.
34512
+ */
34513
+ var mintInvoice = (wallet, amount, label) => wallet.createMintQuoteBolt11(amount, wallet.getMintInfo().supportsNut04Description?.("bolt11", UNIT$1) === false ? void 0 : label);
34422
34514
  /** A Lightning payment can stay in flight for minutes or hours; the mint is asked again this often. */
34423
34515
  var MELT_POLL_MS = 3e4;
34424
34516
  /** Once its request can no longer land, a payment still pending is asked twice as late each time, up to this. */
@@ -34633,6 +34725,8 @@ var CashuWallet = class CashuWallet {
34633
34725
  quoteAsked = /* @__PURE__ */ new Map();
34634
34726
  /** Per quote the screen shows: until when (`watch`). */
34635
34727
  quoteWatched = /* @__PURE__ */ new Map();
34728
+ /** Per open quote whose mint did not answer, or answered with an error: as `meltAsk`, on top of its own pace. */
34729
+ quoteAsk = new AskBackoff(INVOICE_PACE.missedMs, INVOICE_PACE.missedCapMs);
34636
34730
  meltTimer = null;
34637
34731
  /** Per pending melt: when it is asked about next and the wait before that, in this run (a restart asks at once). */
34638
34732
  meltAsk = new AskBackoff(MELT_POLL_MS, MELT_SLOW_POLL_MS);
@@ -34830,7 +34924,7 @@ var CashuWallet = class CashuWallet {
34830
34924
  for (const candidate of this.getMints(network)) try {
34831
34925
  created = {
34832
34926
  mint: candidate,
34833
- response: await within$1(MINT_TIMEOUT_MS, (await this.wallet(candidate)).createMintQuoteBolt11(amount, "Ghostly"), candidate)
34927
+ response: await within$1(MINT_TIMEOUT_MS, mintInvoice(await this.wallet(candidate), amount, "Ghostly"), candidate)
34834
34928
  };
34835
34929
  break;
34836
34930
  } catch (error) {
@@ -34862,6 +34956,7 @@ var CashuWallet = class CashuWallet {
34862
34956
  const quote = (await this.quotes()).find((q) => q.invoice.toLowerCase() === wanted);
34863
34957
  if (!quote) return false;
34864
34958
  this.quoteWatched.set(quote.quote, Date.now() + INVOICE_PACE.watchMs);
34959
+ this.quoteAsk.forget(quote.quote);
34865
34960
  await this.pollQuotes();
34866
34961
  return true;
34867
34962
  }
@@ -34899,7 +34994,7 @@ var CashuWallet = class CashuWallet {
34899
34994
  assertAmount(amount);
34900
34995
  const mint = this.getMints(network).find(paysItsOwnInvoices);
34901
34996
  if (!mint) throw new Error("This wallet has no test mint to ask for test coins");
34902
- const response = await within$1(MINT_TIMEOUT_MS, (await this.wallet(mint)).createMintQuoteBolt11(amount, "Ghostly test coins"), mint);
34997
+ const response = await within$1(MINT_TIMEOUT_MS, mintInvoice(await this.wallet(mint), amount, "Ghostly test coins"), mint);
34903
34998
  const quote = {
34904
34999
  quote: response.quote,
34905
35000
  mint,
@@ -34962,21 +35057,22 @@ var CashuWallet = class CashuWallet {
34962
35057
  }
34963
35058
  const stored = new Set(quotes.map((q) => q.quote));
34964
35059
  for (const pace of [this.quoteAsked, this.quoteWatched]) for (const id of pace.keys()) if (!stored.has(id)) pace.delete(id);
35060
+ this.quoteAsk.keepOnly(stored);
34965
35061
  const open = quotes.filter((q) => !q.issuedUnclaimed && !q.held);
34966
35062
  const at = Date.now();
34967
35063
  for (const settled of await this.settleQuotes(open.filter((q) => now || this.nextAsk(q, at) <= at + INVOICE_PACE.dueSlackMs))) gone.add(settled);
34968
35064
  const next = open.filter((q) => !gone.has(q.quote)).map((q) => this.nextAsk(q, Date.now()));
34969
35065
  if (next.length) this.scheduleQuotes(Math.min(...next));
34970
35066
  }
34971
- /** When the mint is next asked about this quote. */
35067
+ /** When the mint is next asked about this quote: at its pace, and not before the wait its mint's silence earned. */
34972
35068
  nextAsk(quote, now) {
34973
- return nextInvoiceAsk({
35069
+ return Math.max(this.quoteAsk.at(quote.quote, 0), nextInvoiceAsk({
34974
35070
  createdAt: quote.createdAt,
34975
35071
  expiresAt: quote.expiresAt,
34976
35072
  watchedUntil: this.quoteWatched.get(quote.quote),
34977
35073
  closed: !!quote.paymentId && !!this.events.requestClosed?.(quote.paymentId),
34978
35074
  paid: !!quote.paid
34979
- }, this.quoteAsked.get(quote.quote), now);
35075
+ }, this.quoteAsked.get(quote.quote), now));
34980
35076
  }
34981
35077
  /** The next round at `at`, unless one is due sooner. */
34982
35078
  scheduleQuotes(at) {
@@ -34989,19 +35085,37 @@ var CashuWallet = class CashuWallet {
34989
35085
  this.pollQuotes();
34990
35086
  }, Math.max(0, at - Date.now()));
34991
35087
  }
34992
- /** Asks the mints about these quotes. Returns the ones minted. */
35088
+ /**
35089
+ * Asks the mints about these quotes. Returns the ones minted. A quote whose mint does not answer, or answers with an
35090
+ * error, waits longer each time (`quoteAsk`); a mint that could not be loaded is not loaded again in this call for its
35091
+ * other quotes, which wait as that one does. The load runs outside the mint's lock, so a failed one does not hold it.
35092
+ */
34993
35093
  async settleQuotes(quotes) {
34994
35094
  const minted = [];
35095
+ const down = /* @__PURE__ */ new Set();
34995
35096
  for (const { quote, mint } of quotes.filter((q) => !q.issuedUnclaimed && !q.held)) {
34996
35097
  this.quoteAsked.set(quote, Date.now());
35098
+ if (down.has(mint)) {
35099
+ this.quoteAsk.missed(quote, Date.now());
35100
+ continue;
35101
+ }
34997
35102
  try {
35103
+ try {
35104
+ await this.wallet(mint);
35105
+ } catch (error) {
35106
+ down.add(mint);
35107
+ throw error;
35108
+ }
34998
35109
  const paid = await this.locked(mint, () => this.settleQuote(quote));
35110
+ this.quoteAsk.forget(quote);
34999
35111
  if (paid) {
35000
35112
  minted.push(quote);
35001
35113
  if (!paid.testCoins) this.events.onQuotePaid(paid);
35002
35114
  this.events.onChange();
35003
35115
  }
35004
- } catch {}
35116
+ } catch {
35117
+ this.quoteAsk.missed(quote, Date.now());
35118
+ }
35005
35119
  }
35006
35120
  return minted;
35007
35121
  }
@@ -35710,8 +35824,7 @@ var CashuWallet = class CashuWallet {
35710
35824
  * payment then stays, marked `finished`, until the chat has been told (`tellSwap`). Returns whether it stored.
35711
35825
  */
35712
35826
  async finishSwap(swap, keep, send, late) {
35713
- const secrets = new Set(swap.kind === "send" ? swapOf(swap).inputs.map((p) => p.secret) : []);
35714
- const inputs = (await this.allProofs()).filter((p) => p.mint === swap.mint && secrets.has(p.secret));
35827
+ const inputs = (await this.proofsOf(swap.kind === "send" ? swapOf(swap).inputs.map((p) => p.secret) : [])).filter((p) => p.mint === swap.mint);
35715
35828
  const lost = swap.kind === "send" ? swapOf(swap).inputs.reduce((sum, p) => sum + Number(p.amount), 0) - sats(keep) - sats(send) : 0;
35716
35829
  let stored = false;
35717
35830
  await this.sealedTransact([
@@ -35787,8 +35900,7 @@ var CashuWallet = class CashuWallet {
35787
35900
  }
35788
35901
  /** The proofs a split reserved, as they are stored now. */
35789
35902
  async storedInputs(swap) {
35790
- const secrets = new Set(swapOf(swap).inputs.map((p) => p.secret));
35791
- return (await this.allProofs()).filter((p) => p.mint === swap.mint && p.reserved && secrets.has(p.secret));
35903
+ return (await this.proofsOf(swapOf(swap).inputs.map((p) => p.secret))).filter((p) => p.mint === swap.mint && p.reserved);
35792
35904
  }
35793
35905
  async swapsAt(mint) {
35794
35906
  return (await this.readSwaps()).filter((s) => s.mint === mint);
@@ -35866,11 +35978,11 @@ var CashuWallet = class CashuWallet {
35866
35978
  await this.putSwap(swap);
35867
35979
  }
35868
35980
  let outcome = await this.swapOutcome(swap);
35869
- this.swapAsk.forget(id);
35870
35981
  if (outcome.state === "never" && !outcome.final && swap.kind === "receive" && !swap.released) outcome = {
35871
35982
  state: "open",
35872
35983
  idle: true
35873
35984
  };
35985
+ if (!(outcome.state === "open" && outcome.idle && swap.kind === "receive" && !swap.released)) this.swapAsk.forget(id);
35874
35986
  if (outcome.state === "open") {
35875
35987
  if (swap.released && Date.now() >= swap.createdAt + SWAP_WATCH_MS) {
35876
35988
  await this.dropSwap(swap, /* @__PURE__ */ new Set());
@@ -35890,6 +36002,7 @@ var CashuWallet = class CashuWallet {
35890
36002
  const { deserializeSwapPreview } = await loadCashu();
35891
36003
  try {
35892
36004
  const { keep } = await (await this.wallet(mint)).completeSwap(deserializeSwapPreview(swapOf(swap)));
36005
+ this.swapAsk.forget(id);
35893
36006
  if (await this.finishSwap(swap, keep, [], true)) {
35894
36007
  const told = await this.tellSwap(swap, true);
35895
36008
  if (swap.payment && told) await committed((await store(STORES$1.swaps, "readwrite")).delete(swap.id));
@@ -35918,7 +36031,7 @@ var CashuWallet = class CashuWallet {
35918
36031
  await this.dropSwap(swap, refusal.gone);
35919
36032
  await this.tellSwap(swap, false);
35920
36033
  this.events.onChange();
35921
- } else later(SWAP_POLL_MS);
36034
+ } else later(this.swapAsk.missed(id, Date.now()));
35922
36035
  }
35923
36036
  } else if (outcome.pending && swap.kind === "receive" && !swap.released && Date.now() >= swapOverdueAt(swap)) {
35924
36037
  if (Date.now() < swap.createdAt + SWAP_WATCH_MS) {
@@ -36251,8 +36364,7 @@ var CashuWallet = class CashuWallet {
36251
36364
  }
36252
36365
  }
36253
36366
  async reservedProofs(melt) {
36254
- const secrets = new Set(melt.secrets);
36255
- return (await this.allProofs()).filter((p) => secrets.has(p.secret));
36367
+ return this.proofsOf(melt.secrets);
36256
36368
  }
36257
36369
  /** Everything held, as one token per mint; `mints`: only these mints' (one network's wallet). */
36258
36370
  async exportTokens(mints) {
@@ -36313,6 +36425,21 @@ var CashuWallet = class CashuWallet {
36313
36425
  async allProofs() {
36314
36426
  return openRows(STORES$1.proofs, await wrap((await store(STORES$1.proofs, "readonly")).getAll()));
36315
36427
  }
36428
+ /**
36429
+ * The stored proofs of these secrets, each read by its key: a swap's inputs cost what the swap holds, not the wallet.
36430
+ * With the data key, a proof is under the hash of its secret, or under the secret itself until the migration reseals it.
36431
+ */
36432
+ async proofsOf(secrets) {
36433
+ const wanted = [...new Set(secrets)];
36434
+ if (wanted.length === 0) return [];
36435
+ const proofs = await store(STORES$1.proofs, "readonly");
36436
+ const sealed = hasDataKey();
36437
+ const found = await Promise.all(wanted.map(async (secret) => {
36438
+ const [hashed, plain] = await Promise.all([sealed ? wrap(proofs.get(proofKey(secret))) : void 0, wrap(proofs.get(secret))]);
36439
+ return hashed ?? plain;
36440
+ }));
36441
+ return openRows(STORES$1.proofs, found.filter((p) => p !== void 0));
36442
+ }
36316
36443
  async readSwaps() {
36317
36444
  return openRows(STORES$1.swaps, await wrap((await store(STORES$1.swaps, "readonly")).getAll()));
36318
36445
  }
@@ -41715,6 +41842,7 @@ var GhostlyNode = class GhostlyNode {
41715
41842
  this.identities.start();
41716
41843
  await this.did.load();
41717
41844
  setOwnDidSource(() => this.did.id);
41845
+ setPkarrRelaySource(() => this.settings.relays);
41718
41846
  this.did.start();
41719
41847
  await this.contactLinks.load();
41720
41848
  this.contactLinks.start();
@@ -41751,6 +41879,7 @@ var GhostlyNode = class GhostlyNode {
41751
41879
  this.links.set(stored.id, newLiveLink(stored, messages[messages.length - 1]?.timestamp ?? 0, files));
41752
41880
  this.links.get(stored.id).waitingSends = Promise.resolve(new Set(messages.filter(waitsForLive).map((m) => m.id)));
41753
41881
  this.links.get(stored.id).cardsDue = Promise.resolve(new Set(messages.filter(cardDue).map((m) => m.id)));
41882
+ this.editsFor(stored.id).learn([...messages, ...(stored.removals ?? []).map((r) => removalRow(stored.id, r))]);
41754
41883
  this.links.get(stored.id).pkarrSeenAt = pkarrSeenAt(messages);
41755
41884
  for (const message of messages.slice(-20)) this.clockSample(message);
41756
41885
  const note = this.noteFromHistory(stored.id, messages);
@@ -43433,6 +43562,7 @@ var GhostlyNode = class GhostlyNode {
43433
43562
  if (!live || !live.link && !waitsForCheck) return { error: "You are offline" };
43434
43563
  if (!trimmed) return { error: null };
43435
43564
  const timestamp = params.timestamp ?? arrivalKey(Date.now(), this.placedAt.get(linkId));
43565
+ if (params.timestamp === void 0) this.placedAt.set(linkId, timestamp);
43436
43566
  if (live.stored.profile) live.link?.setTyping(false);
43437
43567
  if (live.stored.profile) {
43438
43568
  const found = params.replyTo === void 0 ? void 0 : await this.replyFor(linkId, params.replyTo);
@@ -43923,9 +44053,11 @@ var GhostlyNode = class GhostlyNode {
43923
44053
  async applyPeerEditNow(linkId, message, edit) {
43924
44054
  if (await db.patchMessage(linkId, message.id, (current) => {
43925
44055
  if (!takesPeerEdit(current, edit.m) || (current.edit?.seq ?? 0) >= edit.e) return null;
44056
+ const now = Date.now();
43926
44057
  const next = withEdit(current, {
43927
44058
  seq: edit.e,
43928
- at: heardTime(edit.ts),
44059
+ at: heardTime(edit.ts, now),
44060
+ heardAt: now,
43929
44061
  text: edit.m,
43930
44062
  preview: edit.pv,
43931
44063
  card: edit.sc
@@ -47721,9 +47853,10 @@ var GhostlyNode = class GhostlyNode {
47721
47853
  * The active device's links to the other devices, and its stored turn record put again (WISP 06 § Publishing and
47722
47854
  * reading: "The active device puts its stored bytes at start"). This is also what completes an enrollment that a
47723
47855
  * crash stopped after the record with the new device was stored and before it was put. `justRead`: it starts on a good
47724
- * turn read made a moment before (the read at start, or limited mode's), which counts while it is fresh.
47856
+ * turn read made a moment before (the read at start, or limited mode's), which counts while it is fresh. `added`: the
47857
+ * signing key of a device an enrollment just added, whose link awaits it (`DeviceLinks.expectDevice`).
47725
47858
  */
47726
- async startDeviceSet({ justRead = false } = {}) {
47859
+ async startDeviceSet({ justRead = false, added } = {}) {
47727
47860
  if (this.shuttingDown || !this.networkOn) return;
47728
47861
  const own = await readDeviceRecord(databaseName()).catch(() => null);
47729
47862
  this.ownDeviceKey = own?.ownSlot !== void 0 ? own.deviceSet[own.ownSlot]?.key ?? null : null;
@@ -47745,9 +47878,13 @@ var GhostlyNode = class GhostlyNode {
47745
47878
  pushSend: (request) => this.postPush(request),
47746
47879
  onActiveHint: () => void this.readActiveTurn().catch(() => {})
47747
47880
  });
47881
+ if (added) this.deviceLinks.expectDevice(added);
47748
47882
  await this.deviceLinks.start();
47749
47883
  await this.startHandoff().catch(() => {});
47750
- } else await this.deviceLinks.refresh();
47884
+ } else {
47885
+ if (added) this.deviceLinks.expectDevice(added);
47886
+ await this.deviceLinks.refresh();
47887
+ }
47751
47888
  if (this.settings.wake?.device && this.settings.wake.device === this.ownDeviceKey) await this.deviceLinks.setOwnPush(this.settings.wake).catch(() => {});
47752
47889
  else await this.ownWakeWins().catch(() => {});
47753
47890
  this.emitState();
@@ -48046,9 +48183,9 @@ var GhostlyNode = class GhostlyNode {
48046
48183
  name,
48047
48184
  didSeed: () => this.did.deviceSetSeed(),
48048
48185
  networkSettings: () => deviceNetworkOf(this.settings),
48049
- afterWrite: async () => {
48186
+ afterWrite: async (added) => {
48050
48187
  await this.syncDeviceNetwork();
48051
- await this.startDeviceSet();
48188
+ await this.startDeviceSet({ added });
48052
48189
  },
48053
48190
  onChange: (view) => {
48054
48191
  if (view.step === "failed" || view.step === "done") setTimeout(() => void this.rotateIfDue().catch(() => {}), 0);
@@ -49040,6 +49177,7 @@ var GhostlyNode = class GhostlyNode {
49040
49177
  };
49041
49178
  },
49042
49179
  firstControlAfterMs: STARTUP_QUIET_MS,
49180
+ ...this.options.peerDhtPollMs ? { peerDhtPollMs: this.options.peerDhtPollMs } : {},
49043
49181
  capsRev: () => live.caps?.rev,
49044
49182
  peerCapsRev: (rev) => live.caps?.peerRev(rev),
49045
49183
  peerAcceptsText: () => {
@@ -49541,7 +49679,7 @@ var GhostlyNode = class GhostlyNode {
49541
49679
  nativeFactoriesFor(relayOnly) {
49542
49680
  const relay = relayOnly || this.relaysHyperdhtNatively ? this.hyperdhtRelay : "";
49543
49681
  return {
49544
- ...relay ? { "hyperdht/1": async (seedB64) => (await import("./hyperdhtRelay-B_uHjg_r.js")).createRelayedHyperEndpoint(seedB64, relay) } : {},
49682
+ ...relay ? { "hyperdht/1": async (seedB64) => (await import("./hyperdhtRelay-DDCak5PY.js")).createRelayedHyperEndpoint(seedB64, relay) } : {},
49545
49683
  ...relayOnly ? {} : this.options.nativeTransports,
49546
49684
  ...this.ownIrohRelays && !relayOnly ? { "iroh/1": (seedB64) => this.options.nativeTransports["iroh/1"](seedB64, this.settings.irohRelays?.length ? { relays: [...this.settings.irohRelays] } : {}) } : {},
49547
49685
  ...this.options.irohWeb ? { "iroh/1": (seedB64) => createIrohWebEndpoint(seedB64, { relays: this.irohRelays }) } : {}
@@ -50285,7 +50423,8 @@ var GhostlyNode = class GhostlyNode {
50285
50423
  * of a group's history (a membership change, a rename) is not a message: it stays at its commit's time, but never
50286
50424
  * ahead of this clock nor above a row placed here since the app started. The admin's clock picks that time: two
50287
50425
  * minutes ahead, "X joined" sat under everything said in the next two minutes; behind, it went above what the
50288
- * members had just read. Read late with nothing newer here (a member back after a while), it keeps its moment.
50426
+ * members had just read. Read late with nothing newer here (a member back after a while), it keeps its moment, and
50427
+ * `heardAt` says when it came here.
50289
50428
  * `place`: a received row's place given already (`placeAbove`): it takes it, and the next row still goes past the last.
50290
50429
  */
50291
50430
  placed(message, place) {
@@ -50296,7 +50435,8 @@ var GhostlyNode = class GhostlyNode {
50296
50435
  this.placedAt.set(message.linkId, timestamp);
50297
50436
  return {
50298
50437
  ...message,
50299
- timestamp
50438
+ timestamp,
50439
+ heardAt: now
50300
50440
  };
50301
50441
  }
50302
50442
  if (message.sender === "peer" && message.sentAt === void 0) {
@@ -50919,4 +51059,4 @@ function signalKind(signal) {
50919
51059
  //#endregion
50920
51060
  export { EngineServer };
50921
51061
 
50922
- //# sourceMappingURL=server-DcOsgYDU.js.map
51062
+ //# sourceMappingURL=server-BJ3T-kx3.js.map